:root {
    --bg: #0d1117;
    --bg-soft: #121926;
    --panel: rgba(18, 25, 38, 0.74);
    --panel-strong: rgba(25, 34, 52, 0.88);
    --line: rgba(255, 255, 255, 0.08);
    --text: #ebf1ff;
    --muted: #9db0ce;
    --accent: #4798F7;
    --accent-2: #76b5ff;
    --danger: #ff6b7a;
    --success: #76e0a0;
    --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    --radius: 24px;
    --radius-sm: 16px;
    --font: "SF Pro Display", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(71, 152, 247, 0.24), transparent 32%),
        radial-gradient(circle at top right, rgba(118, 181, 255, 0.14), transparent 28%),
        linear-gradient(160deg, #0b1018 0%, #141c2b 45%, #0c1118 100%);
}

.app-shell { min-height: 100vh; padding: 14px; }
.view.hidden { display: none; }
.glass-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow);
}

.login-card {
    width: min(460px, 100%);
    margin: 10vh auto 0;
    padding: 28px;
    border-radius: 32px;
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 20px;
}

.login-brand {
    width: 100%;
    justify-content: center;
}

.brand-logo {
    display: block;
    width: min(100%, 320px);
    height: auto;
}

.brand-logo-small { width: 150px; }

.eyebrow {
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 10px;
    margin-bottom: 6px;
}

h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: 18px; }
.lead { color: var(--muted); line-height: 1.45; margin: 8px 0 18px; font-size: 14px; }
.stack { display: grid; gap: 12px; }
label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
input, select, textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 8px 10px;
    font: inherit;
}

textarea { min-height: 72px; resize: vertical; }

.primary-button, .ghost-button, .danger-button {
    border: 0;
    border-radius: 10px;
    padding: 8px 12px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
    font-size: 13px;
}

.primary-button {
    background: linear-gradient(135deg, var(--accent), #5aa7ff);
    color: white;
}

.ghost-button {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--line);
}

.danger-button {
    background: rgba(255, 107, 122, 0.14);
    color: #ffd5db;
    border: 1px solid rgba(255, 107, 122, 0.18);
}

.primary-button:hover, .ghost-button:hover, .danger-button:hover { transform: translateY(-1px); }

.error-text { color: #ff9fb0; min-height: 20px; font-size: 14px; }

.topbar {
    border-radius: 18px;
    padding: 12px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.topbar-actions, .toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
}

.year-picker {
    display: flex;
    gap: 8px;
    align-items: center;
    color: var(--muted);
}

.year-picker select { width: auto; min-width: 120px; }

.layout {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
}

.summary-card {
    padding: 12px;
    border-radius: 14px;
}

.summary-card h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    margin-bottom: 10px;
}

.summary-card strong { display: block; font-size: clamp(18px, 2vw, 24px); }

.section-card {
    border-radius: var(--radius);
    padding: 14px;
}

.section-card-tight { padding: 12px; }

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}

.table-wrap {
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
}

.table-wrap-tall { max-height: calc(100vh - 230px); }
.table-wrap-medium { max-height: calc(100vh - 280px); }

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

.data-table th:nth-child(1),
.data-table td:nth-child(1) { min-width: 120px; }

th, td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: normal;
    word-break: break-word;
}

th {
    position: sticky;
    top: 0;
    background: var(--panel-strong);
    color: var(--muted);
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 1;
}

td.copyable { cursor: copy; }
td.copyable:hover { background: rgba(71, 152, 247, 0.08); }
td.actions { white-space: nowrap; width: 1%; }
td .cell-note { color: var(--muted); font-size: 11px; margin-top: 2px; }
.cell-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(71, 152, 247, 0.14);
    color: #cfe5ff;
    font-size: 11px;
}

.sheet-nav {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-radius: 16px;
    flex-wrap: wrap;
}

.sheet-tab {
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.04);
    color: var(--muted);
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
}

.sheet-tab.active {
    background: rgba(71, 152, 247, 0.18);
    color: var(--text);
    border-color: rgba(71, 152, 247, 0.28);
}

.sheet-panel.hidden { display: none; }
.sheet-panel.active {
    display: grid;
    gap: 10px;
}

.toast {
    position: fixed;
    right: 14px;
    bottom: 14px;
    background: rgba(10, 15, 24, 0.92);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px 12px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    font-size: 13px;
}

.toast.hidden { display: none; }

.inline-editor {
    min-width: 160px;
}

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

@media (max-width: 980px) {
    .app-shell { padding: 10px; }
    .topbar, .section-head, .toolbar, .topbar-actions, .year-picker {
        display: grid;
    }
    .toolbar input, .toolbar button, .topbar-actions button, .topbar-actions select { width: 100%; }
    .table-wrap-tall, .table-wrap-medium { max-height: none; }
}
