/**
 * Gemeinsames, neutrales Design für interne Panels
 * (gate.html, admin.html, client-panel.html, maintenance.html).
 * Folgt automatisch dem System-Farbschema (prefers-color-scheme).
 * Bewusst schlicht: Systemschrift, dezente Töne, ein Akzent.
 */

:root {
    --bg:          #f7f7f8;
    --surface:     #ffffff;
    --border:      #e4e4e7;
    --text:        #18181b;
    --text-muted:  #71717a;
    --text-faint:  #a1a1aa;
    --accent:      #18181b;
    --accent-text: #ffffff;
    --danger:      #dc2626;
    --success:     #16a34a;
    --warning:     #d97706;
    --radius:      12px;
    --radius-sm:   8px;
    --shadow:      0 1px 2px rgba(0,0,0,.04), 0 1px 8px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg:          #0b0b0c;
        --surface:     #1a1a1c;
        --border:      #2c2c30;
        --text:        #f4f4f5;
        --text-muted:  #a1a1aa;
        --text-faint:  #6b6b70;
        --accent:      #f4f4f5;
        --accent-text: #0b0b0c;
        --danger:      #f87171;
        --success:     #4ade80;
        --warning:     #fbbf24;
        --shadow:      0 1px 2px rgba(0,0,0,.3), 0 1px 8px rgba(0,0,0,.3);
    }
}

* , *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body.panel-body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.panel-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 36px 32px;
}

.panel-eyebrow {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin: 0 0 4px;
}

.panel-title {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0 0 24px;
    color: var(--text);
}

.panel-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-muted);
    margin: 0 0 24px;
}

/* ── Form fields ─────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field:last-of-type { margin-bottom: 0; }
.field label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}
.field input,
.field textarea,
.field select {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s;
}
.field input:focus,
.field textarea:focus,
.field select:focus { border-color: var(--text-faint); }
.field textarea { resize: vertical; min-height: 64px; line-height: 1.5; }
.field-error {
    font-size: 13px;
    color: var(--danger);
    min-height: 18px;
    margin-top: 4px;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    padding: 11px 20px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-block { width: 100%; }

.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-primary:hover { opacity: 0.85; }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-faint); }

.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: rgba(220,38,38,0.08); }

.btn-ghost { background: transparent; color: var(--text-muted); padding: 6px 10px; font-size: 13px; }
.btn-ghost:hover { color: var(--text); }

/* ── Toggle switch ───────────────────────────────────── */
.switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
    position: absolute; inset: 0;
    background: var(--border);
    border-radius: 24px;
    cursor: pointer;
    transition: background 0.2s;
}
.switch-track::before {
    content: '';
    position: absolute;
    height: 18px; width: 18px;
    left: 3px; top: 3px;
    background: var(--surface);
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--success); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }

/* ── Status / badges ─────────────────────────────────── */
.status-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.status-dot.preview { background: var(--warning); }
.status-dot.live { background: var(--success); }

.badge { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge-preview { color: var(--warning); background: rgba(217,119,6,0.12); }
.badge-live { color: var(--success); background: rgba(22,163,74,0.12); }

/* ── Cards / sections (dashboard layout) ─────────────── */
.panel-shell { max-width: 720px; }
.section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.section + .section { margin-top: 16px; }
.section-title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-muted);
    margin: 0 0 16px;
}
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header .section-title { margin: 0; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.row + .row { margin-top: 12px; }
.row-label { font-size: 14px; color: var(--text); }

.date-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.item-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px;
}
.item-card + .item-card { margin-top: 10px; }
.item-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.item-card-header span { font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

.link-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.link-row + .link-row { margin-top: 8px; }
.link-row-label { font-size: 11px; font-weight: 600; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.link-row-url { font-size: 13px; color: var(--text-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.link-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.feedback { font-size: 13px; color: var(--text-muted); min-height: 18px; margin-top: 10px; }
.feedback.ok  { color: var(--success); }
.feedback.err { color: var(--danger); }

.empty-note { font-size: 13px; color: var(--text-faint); font-style: italic; }

/* ── Overlay / confirm ────────────────────────────────── */
.overlay {
    display: none;
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    align-items: center; justify-content: center;
    padding: 24px;
}
.overlay.show { display: flex; }
.overlay-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 380px;
    width: 100%;
}
.overlay-box h3 { font-size: 16px; font-weight: 600; margin: 0 0 10px; }
.overlay-box p { font-size: 14px; line-height: 1.6; color: var(--text-muted); margin: 0 0 22px; }
.overlay-actions { display: flex; gap: 10px; }
.overlay-actions .btn { flex: 1; }

.add-row-btn {
    width: 100%;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    padding: 10px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.add-row-btn:hover { border-color: var(--text-faint); color: var(--text); }

.panel-footer { font-size: 12px; color: var(--text-faint); margin-top: 20px; text-align: center; }
