:root {
    --fb-sidebar-1: #0e1a2b;
    --fb-sidebar-2: #16273f;
    --fb-sidebar-text: #b9c6da;
    --fb-sidebar-muted: #66799a;
    --fb-accent: #2f6bde;
    --fb-accent-dark: #2456b8;
    --fb-accent-soft: #e8effc;
    --fb-bg: #f6f7f9;
    --fb-surface: #ffffff;
    --fb-ink: #1c2430;
    --fb-muted: #64748b;
    --fb-positive: #16794c;
    --fb-negative: #b42318;
    --fb-warning: #b54708;
    --fb-border: #e4e7ec;
    --fb-shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --fb-radius: 10px;
}

html, body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--fb-bg);
    color: var(--fb-ink);
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.015em; color: var(--fb-ink); }
h1:focus { outline: none; }
a { color: var(--fb-accent); text-decoration: none; }
a:hover { color: var(--fb-accent-dark); text-decoration: underline; }
.btn { border-radius: 8px; font-weight: 550; }
.btn-primary { background-color: var(--fb-accent); border-color: var(--fb-accent); }
.btn-primary:hover, .btn-primary:focus { background-color: var(--fb-accent-dark); border-color: var(--fb-accent-dark); }
.btn-outline-primary { color: var(--fb-accent); border-color: #c6d4f0; }
.btn-outline-primary:hover { background-color: var(--fb-accent); border-color: var(--fb-accent); }
.btn-outline-secondary { color: var(--fb-muted); border-color: var(--fb-border); }
.btn-outline-secondary:hover { background: #f1f3f7; color: var(--fb-ink); border-color: var(--fb-border); }
.btn-link { text-decoration: none; }
.form-control, .form-select { border-color: var(--fb-border); border-radius: 8px; color: var(--fb-ink); }
.form-control:focus, .form-select:focus {
    border-color: var(--fb-accent);
    box-shadow: 0 0 0 3px rgba(47, 107, 222, .15);
}
.form-label { color: var(--fb-muted); font-weight: 550; margin-bottom: .25rem; }

/* ---- App shell ---- */
.page { position: relative; display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
.sidebar { background-image: linear-gradient(180deg, var(--fb-sidebar-1) 0%, var(--fb-sidebar-2) 100%); }

.top-row {
    background-color: var(--fb-surface);
    border-bottom: 1px solid var(--fb-border);
    height: 3.5rem;
    display: flex;
    align-items: center;
}
.top-row a.top-link { color: var(--fb-muted); text-decoration: none; font-size: 1.05rem; }
.top-row a.top-link:hover { color: var(--fb-accent); }
.user-chip { color: var(--fb-muted); font-size: .875rem; font-weight: 500; }
.company-switcher {
    min-width: 230px;
    font-weight: 600;
    border: 1px solid var(--fb-border);
    background-color: #fbfcfe;
}
.company-icon { color: var(--fb-accent); font-size: 1.15rem; }

.content { padding-top: 1.5rem; padding-bottom: 3rem; max-width: 1320px; }

@media (max-width: 640.98px) {
    .top-row { justify-content: space-between; }
}
@media (min-width: 641px) {
    .page { flex-direction: row; }
    .sidebar { width: 252px; height: 100vh; position: sticky; top: 0; flex-shrink: 0; }
    .top-row { position: sticky; top: 0; z-index: 10; }
    main { min-width: 0; }
}

/* ---- Nav ---- */
.navbar-toggler { appearance: none; cursor: pointer; width: 3.5rem; height: 2.5rem; color: #fff; position: absolute; top: .5rem; right: 1rem; border: 1px solid rgba(255,255,255,.3); border-radius: .25rem; background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255, 255, 255, 0.55)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center / 1.75rem rgba(255,255,255,.1); }
.navbar-toggler:checked { background-color: rgba(255,255,255,.25); }
.navbar-brand { font-size: 1.02rem; color: #fff; font-weight: 650; letter-spacing: -.01em; }
.navbar-brand i { color: #6f9bee; }

.nav-scrollable { display: none; }
.navbar-toggler:checked ~ .nav-scrollable { display: block; }
@media (min-width: 641px) {
    .navbar-toggler { display: none; }
    .nav-scrollable { display: block; height: calc(100vh - 3.5rem); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a4d6b transparent; }
}

.nav-section {
    color: var(--fb-sidebar-muted);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    padding: 1.15rem 1rem .3rem 1.5rem;
}
.nav-item { font-size: .9rem; padding-bottom: .1rem; }
.nav-item:first-of-type { padding-top: .9rem; }
.nav-item a.nav-link {
    color: var(--fb-sidebar-text);
    border-radius: 7px;
    height: 2.35rem;
    display: flex;
    align-items: center;
    line-height: 2.35rem;
    padding-left: .8rem;
    font-weight: 500;
}
.nav-item a.nav-link i { opacity: .75; }
.nav-item a.nav-link.active { background-color: rgba(84, 129, 214, .28); color: #fff; }
.nav-item a.nav-link.active i { opacity: 1; color: #8db2f5; }
.nav-item a.nav-link:hover { background-color: rgba(255,255,255,.07); color: #fff; text-decoration: none; }

/* ---- Cards / panels ---- */
.stat-card {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
    padding: 1.1rem 1.3rem;
    height: 100%;
}
.stat-card .label { color: var(--fb-muted); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; }
.stat-card .value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin: .15rem 0 .35rem; font-variant-numeric: tabular-nums; }
.panel {
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: var(--fb-radius);
    box-shadow: var(--fb-shadow);
    padding: 1.35rem;
}
.panel h6 { font-size: .95rem; margin-bottom: 1rem; }

/* ---- Tables ---- */
.table { background: transparent; margin-bottom: 0; --bs-table-hover-bg: #f4f7fd; }
.table > :not(caption) > * > * { padding: .55rem .75rem; }
.table thead th {
    color: var(--fb-muted);
    font-size: .72rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--fb-border);
    background: #fafbfc;
    white-space: nowrap;
}
.table tbody td { border-color: #eef0f4; vertical-align: middle; }
.table tbody tr:hover { background-color: #f4f7fd; }
.panel.p-0 { overflow: hidden; }
.panel.p-0 .table thead th:first-child { padding-left: 1.25rem; }
.panel.p-0 .table td:first-child { padding-left: 1.25rem; }
.panel.p-0 .table thead th:last-child, .panel.p-0 .table td:last-child { padding-right: 1.25rem; }

.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--fb-positive); }
.neg { color: var(--fb-negative); }
.voided { text-decoration: line-through; opacity: .5; }
.depth-1 { padding-left: 2.4rem !important; }
.depth-2 { padding-left: 3.8rem !important; }
.depth-3 { padding-left: 5.2rem !important; }
.report-total { font-weight: 700; border-top: 2px solid var(--fb-ink); }
.report-total td { border-bottom: none; }
.section-head { font-weight: 650; background: #f3f5f8 !important; }
.section-head td { color: var(--fb-ink); }

/* Status badges — soft tints */
.badge { font-weight: 600; letter-spacing: .01em; border-radius: 6px; padding: .32em .6em; }
.badge.bg-success, .badge.text-bg-success { background-color: #e7f6ee !important; color: var(--fb-positive) !important; }
.badge.bg-danger, .badge.text-bg-danger { background-color: #fdeceb !important; color: var(--fb-negative) !important; }
.badge.bg-warning, .badge.text-bg-warning { background-color: #fdf1e2 !important; color: var(--fb-warning) !important; }
.badge.bg-primary, .badge.text-bg-primary { background-color: var(--fb-accent-soft) !important; color: var(--fb-accent-dark) !important; }
.badge.bg-secondary, .badge.text-bg-secondary { background-color: #eef0f3 !important; color: var(--fb-muted) !important; }
.badge.bg-info, .badge.text-bg-info { background-color: #e6f4f9 !important; color: #0b6e8f !important; }

.alert { border-radius: 8px; }

/* ---- Login ---- */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: radial-gradient(1200px 700px at 75% -10%, #2c4a7c 0%, transparent 55%),
        linear-gradient(160deg, var(--fb-sidebar-1), var(--fb-sidebar-2) 70%, #1d3557);
}
.login-card {
    background: var(--fb-surface);
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(4, 10, 22, .45);
    padding: 2.5rem;
    width: 100%;
    max-width: 410px;
}
.login-brand { font-weight: 700; font-size: 1.35rem; color: var(--fb-sidebar-1); letter-spacing: -.02em; }

/* ---- Misc ---- */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,.2);
    display: none;
    left: 0;
    padding: .6rem 1.25rem .7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem 1rem 1rem 3.7rem; color: white; }
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

@media print {
    .sidebar, .top-row, .no-print, #blazor-error-ui { display: none !important; }
    .content { padding: 0 !important; max-width: none; }
    .panel, .stat-card { border: none; box-shadow: none; padding: 0; }
    body { background: #fff; font-size: 12px; }
    a { color: inherit; }
}
