/* FAS - Financial Analysis System
   Layout: fixed dark sidebar, top bar, scrolling content column.
   The sidebar collapses to an off-canvas drawer below 900px. */

:root {
    --sidebar-width: 250px;
    --topbar-height: 58px;

    /* Base palette: yellow on white. Yellow carries the surfaces and the
       branding; anything that has to be read uses ink or deep amber, because
       yellow text on white fails contrast badly at any usable weight. */
    --brand: #f6c445;          /* primary yellow - sidebar, accents, fills */
    --brand-strong: #e2a90c;   /* hover and active yellow */
    --brand-soft: #fdf5da;     /* yellow tint for tile and pill backgrounds */
    --brand-ink: #8a6800;      /* readable "yellow" for links and emphasis */

    --ink: #221e14;
    --ink-soft: #6b6455;
    --ink-faint: #9a9384;
    --line: #e8e3d6;
    --page-bg: #fdfbf6;
    --surface: #ffffff;

    /* Sidebar reads as yellow with dark ink rather than light text on dark. */
    --sidebar-bg: var(--brand);
    --sidebar-ink: #4a3c08;
    --sidebar-ink-bright: #241d00;
    --sidebar-hover: rgba(255, 255, 255, .42);
    --sidebar-active: rgba(255, 255, 255, .78);
    --sidebar-rule: rgba(60, 46, 0, .16);
    --sidebar-ink-muted: rgba(74, 60, 8, .88);

    --accent: var(--brand-ink);
    --good: #1f8f4e;
    --alert: #c0392b;
    --pending: #8a6800;

    --tile-bg: #fffdf6;

    --radius: 10px;
    --shadow: 0 1px 2px rgba(60, 46, 0, .06), 0 4px 14px rgba(60, 46, 0, .05);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.05rem; }
a { color: inherit; text-decoration: none; }

/* ---------- Sidebar ---------- */

.app-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    color: var(--sidebar-ink);
    overflow-y: auto;
    z-index: 40;
}

.sidebar-brand {
    display: block;
    padding: 20px 18px 16px;
    border-bottom: 1px solid var(--sidebar-rule);
}

.sidebar-brand-mark {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--sidebar-ink-bright);
}

.sidebar-brand-sub {
    display: block;
    margin-top: 2px;
    font-size: .74rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--sidebar-ink-muted);
}

.sidebar-nav { flex: 1; padding: 12px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: .93rem;
    color: var(--sidebar-ink);
    cursor: pointer;
}

.nav-link:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-bright); }
.nav-link.is-active { background: var(--sidebar-active); color: var(--sidebar-ink-bright); font-weight: 650; }

.nav-text { flex: 1; }

.menu-icon { display: inline-flex; flex: 0 0 19px; }
.menu-icon svg { width: 19px; height: 19px; }

.nav-group { margin-top: 2px; }
.nav-group-summary { list-style: none; }
.nav-group-summary::-webkit-details-marker { display: none; }

.nav-chevron {
    width: 7px; height: 7px;
    border-right: 1.8px solid currentColor;
    border-bottom: 1.8px solid currentColor;
    transform: rotate(-45deg);
    opacity: .55;
    transition: transform .15s ease;
}
.nav-group[open] .nav-chevron { transform: rotate(45deg); }

.nav-group-items { padding: 2px 0 6px 42px; }

.nav-sublink {
    display: block;
    padding: 7px 10px;
    border-radius: 7px;
    font-size: .88rem;
    color: var(--sidebar-ink);
}
.nav-sublink:hover { background: var(--sidebar-hover); color: var(--sidebar-ink-bright); }
.nav-sublink.is-active { background: var(--sidebar-active); color: var(--sidebar-ink-bright); font-weight: 600; }

.sidebar-footer-link {
    margin: 10px;
    border: 1px solid var(--sidebar-rule);
    border-radius: 8px;
}

/* ---------- Main column ---------- */

.app-main { margin-left: var(--sidebar-width); min-height: 100vh; }

.app-topbar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 26px;
    background: var(--surface);
    border-bottom: 2px solid var(--brand);
    z-index: 30;
}

.topbar-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-business { font-weight: 650; }
.topbar-divider { width: 1px; height: 18px; background: var(--line); }
.topbar-context { color: var(--ink-soft); font-size: .92rem; }
.topbar-app { color: var(--ink-faint); font-size: .82rem; letter-spacing: .03em; text-transform: uppercase; }

.app-content { max-width: 1080px; padding: 26px; }

.page-intro { margin-bottom: 22px; }
.page-lead { margin: 8px 0 0; max-width: 62ch; color: var(--ink-soft); }

/* ---------- Cards ---------- */

.card {
    margin-bottom: 20px;
    padding: 20px 22px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.card-note { color: var(--ink-faint); font-size: .84rem; }
.card-footnote { margin: 14px 0 0; color: var(--ink-soft); font-size: .87rem; max-width: 70ch; }
.card-placeholder { border-style: dashed; box-shadow: none; }

/* ---------- Metric tiles ---------- */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
}

.metric-tile {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 15px 16px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--tile-bg);
}

.metric-label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.metric-value { font-size: 1.5rem; font-weight: 680; letter-spacing: -.02em; }
.metric-detail { font-size: .79rem; color: var(--ink-faint); }
.metric-tile.is-empty .metric-value { color: var(--ink-faint); font-weight: 600; }

/* ---------- Steps ---------- */

.step-list { margin: 0; padding-left: 22px; display: grid; gap: 14px; }
.step-list li { padding-left: 4px; }
.step-title { display: block; font-weight: 620; }
.step-detail { display: block; color: var(--ink-soft); font-size: .88rem; }
.step-link { display: inline-block; margin-top: 4px; color: var(--accent); font-size: .88rem; font-weight: 600; }
.step-link:hover { text-decoration: underline; }

/* ---------- Status ---------- */

.status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.status-text { color: var(--ink-soft); font-size: .9rem; }

.status-pill {
    padding: 3px 11px;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 650;
    letter-spacing: .02em;
}
.status-pill.is-good    { background: #e6f4ec; color: var(--good); }
.status-pill.is-alert   { background: #fbeae8; color: var(--alert); }
.status-pill.is-pending { background: var(--brand-soft); color: var(--pending); }

/* ---------- Mobile drawer ---------- */

.mobile-menu-button,
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 0 0 30px rgba(60, 46, 0, .28);
    }
    body.sidebar-open .app-sidebar { transform: translateX(0); }

    .app-main { margin-left: 0; padding-top: 46px; }

    .mobile-menu-button {
        position: fixed;
        top: 8px; left: 10px;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        padding: 7px 13px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--surface);
        color: var(--ink);
        font: inherit;
        font-size: .88rem;
        cursor: pointer;
        z-index: 50;
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        border: 0;
        background: rgba(40, 32, 4, .42);
        z-index: 35;
    }
    body.sidebar-open .sidebar-backdrop { display: block; }

    .app-topbar { padding: 0 16px; }
    .topbar-app { display: none; }
    .app-content { padding: 18px 16px; }
}
