:root {
    --primary: #f20f4b;
    --bg: #0b0d14;
    --sidebar: #10131c;
    --card: #161a26;
    --border: rgba(255, 255, 255, 0.07);
    --text: #eef1f8;
    --muted: #8b95ad;
    --success: #4ade80;
    --warning: #fbbf24;
    --danger: #fb7185;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

code,
pre {
    font-family: "SFMono-Regular", Consolas, monospace;
}

.muted {
    color: var(--muted);
}

/* ── Login ── */
.login-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 36px;
    border-radius: 20px;
    background: var(--card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.login-card .eyebrow,
.login-card .tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.12);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
    font-weight: 800;
}

.login-card .muted {
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 24px;
}

.notice {
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(74, 222, 128, 0.12);
    color: #9af0b7;
    font-weight: 600;
    font-size: 13px;
}

.notice.error {
    background: rgba(251, 113, 133, 0.12);
    color: #ffacb8;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.field span {
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
}

.field input,
.field textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #0a0c12;
    color: var(--text);
    font: inherit;
}

.field textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.field.full,
.form-actions.full,
.slot-grid.full {
    grid-column: 1 / -1;
}

.stack-lg {
    display: grid;
    gap: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 10px;
    padding: 11px 18px;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: inherit;
}

.btn.primary {
    background: linear-gradient(135deg, var(--primary), #ff4b77);
}

.login-card .btn.primary {
    width: 100%;
    padding: 13px;
    font-size: 14px;
}

/* ── Shell layout ── */
.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
}

.sb-brand {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sb-brand h2 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
}

.sb-brand span {
    font-size: 11px;
    color: var(--muted);
}

.sb-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 14px;
}

.sb-metric {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
}

.sb-metric .n {
    font-size: 20px;
    font-weight: 800;
    line-height: 1;
}

.sb-metric .l {
    font-size: 9px;
    color: var(--muted);
    text-transform: uppercase;
    margin-top: 4px;
    letter-spacing: 0.04em;
}

.sb-nav {
    flex: 1;
    padding: 8px 10px;
    overflow-y: auto;
}

.sb-group {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 12px 10px 6px;
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 2px;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}

.sb-link i {
    width: 16px;
    text-align: center;
    font-size: 12px;
    opacity: 0.85;
}

.sb-link:hover,
.sb-link.active {
    background: rgba(242, 15, 75, 0.12);
    color: #fff;
}

.sb-link.active {
    border-left-color: var(--primary);
}

.sb-link .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    margin-left: auto;
    flex-shrink: 0;
}

.dot-g { background: var(--success); }
.dot-y { background: var(--warning); }
.dot-r { background: var(--danger); }

.sb-foot {
    padding: 14px;
    border-top: 1px solid var(--border);
}

.sb-foot a {
    color: var(--muted);
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
}

.sb-foot a:hover,
.sb-foot a.active {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.top {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    background: rgba(16, 26, 38, 0.5);
}

.top h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
}

.top-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 3px;
}

.top-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.tbtn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tbtn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.tbtn-p {
    background: var(--primary);
    border-color: var(--primary);
}

.tbtn-p:hover {
    opacity: 0.92;
}

.menu-toggle {
    display: none;
}

.content {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
}

.content .notice {
    margin-bottom: 20px;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 18px;
}

.chip {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.chip.ok,
.chip.badge-live {
    color: var(--success);
    background: rgba(74, 222, 128, 0.1);
}

.chip.badge-warning {
    color: var(--warning);
    background: rgba(251, 191, 36, 0.12);
}

.chip.badge-missing {
    color: var(--danger);
    background: rgba(251, 113, 133, 0.12);
}

.summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.summary-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
}

.metric-label {
    display: block;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 6px;
}

.summary-value,
.metric-value {
    font-size: 22px;
    font-weight: 800;
    line-height: 1;
}

.card,
.hero-card,
.rail-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.card-header h3,
.card h3,
.hero-card h2 {
    margin: 0 0 4px;
    font-size: 15px;
}

.card-header .muted,
.card .sub {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.5;
}

.small-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.small-badge.ok,
.badge-live {
    background: rgba(74, 222, 128, 0.14);
    color: #97efb4;
}

.small-badge.warn,
.badge-warning {
    background: rgba(251, 191, 36, 0.16);
    color: #f8cd76;
}

.badge-missing {
    background: rgba(251, 113, 133, 0.14);
    color: #ffacb7;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.slot-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.slot-field textarea {
    min-height: 90px;
    font-family: monospace;
    font-size: 11px;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.empty-state {
    padding: 24px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
    line-height: 1.7;
    font-size: 13px;
}

.code-block {
    white-space: pre-wrap;
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: #d9e1f5;
    font-size: 12px;
    line-height: 1.6;
}

.info-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.info-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 12px;
}

.info-box strong {
    display: block;
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}

.info-box span {
    word-break: break-all;
    color: #d5def3;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {
    .menu-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 99;
    }

    .sidebar-overlay.show {
        display: block;
    }

    .form-grid,
    .slot-grid,
    .split-grid,
    .summary-row {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 16px;
    }
}
