/* ==========================================================================
   Home (Components/Pages/Home.razor) — the page layout of the Figma
   "OnixBI — Home v0.1" over the primitives of onix-glass.css.

   Desktop 1440: PageHeader · Grid(gap 24){ Col/Main fill · Col/Side 424 }, every
   column a 24px stack. Phone 393: one 14px stack in the order hero → alert →
   KPI 2×2 → note → recent documents → upcoming → trend; "Add documents" gives
   way to the tab bar's capture button.
   ========================================================================== */

.home { max-width: 1560px; }

/* ─── Header ───────────────────────────────────────────────────────────── */

.home-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.home-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.home-title h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.home-title h1:focus { outline: none; }

.home-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px 8px;
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}
.home-meta-cap { text-transform: none; }
.home-glyph { width: 16px; height: 16px; flex: none; }

.home-head-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ─── Grid ─────────────────────────────────────────────────────────────── */

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 424px; gap: 24px; align-items: start; }
.home-main, .home-side { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.home-lite { display: grid; grid-template-columns: minmax(0, 424px) minmax(0, 1fr); gap: 24px; align-items: start; }
.home-lite > :only-child { grid-column: 1 / -1; }
/* ACC-108: the documents requested from the person, above the capture card and the apps. */
.home-lite > .home-alert { grid-column: 1 / -1; }

/* ─── Cash hero ────────────────────────────────────────────────────────── */

.home-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 24px;
    padding: 32px;
    border-radius: 24px;
    /* The one coloured surface of the page: Apple's blue, as the App Store Connect app tile is drawn. */
    background: linear-gradient(135deg, #0066CC 0%, #0071E3 55%, #1A85F0 100%);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 24px rgba(0, 113, 227, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.18);
    color: #FFFFFF;
}

/* glow/teal: a 520×360 teal ellipse, blurred 120, behind the top-right corner. */
.home-hero-glow {
    position: absolute;
    z-index: -1;
    top: -200px;
    right: -190px;
    width: 800px;
    height: 640px;
    pointer-events: none;
    background: radial-gradient(closest-side, rgba(127, 192, 255, 0.55), rgba(127, 192, 255, 0.22) 50%, transparent 100%);
}

.home-hero-cash { display: flex; flex-direction: column; gap: 14px; min-width: 0; flex: 1 1 auto; }

.home-hero-overline {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.70);
}

.home-hero-amount {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.home-hero-delta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 8px;
    border-radius: 999px;
    background: rgba(135, 189, 198, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.20);
    font-size: 13px;
    font-weight: 600;
    color: var(--dnt-teal-100);
    white-space: nowrap;
}
.home-hero-chip-vs { display: none; }
.home-hero-vs { font-size: 14px; color: rgba(255, 255, 255, 0.70); }

.home-hero-accounts { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.home-hero-account {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.16);
    font: inherit;
    text-align: left;
    color: inherit;
    min-width: 0;
}
.home-hero-account-name { font-size: 12px; line-height: 1.35; color: rgba(255, 255, 255, 0.66); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.home-hero-account-balance { font-size: 15px; line-height: 1.3; font-weight: 600; color: #FFFFFF; white-space: nowrap; }
/* QA #27: a foreign-currency account's own figure under the converted one. */
.home-hero-account-native { display: block; font-size: 12px; font-weight: 500; opacity: .75; }
.home-hero-account--add { cursor: pointer; background: transparent; border-style: dashed; border-color: rgba(255, 255, 255, 0.28); transition: background 0.16s ease, border-color 0.16s ease; }
.home-hero-account--add:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.5); }
.home-hero-account--add .home-hero-account-balance { font-weight: 500; color: var(--dnt-teal-100); }

.home-hero-foot { margin: 0; font-size: 12px; line-height: 1.35; color: rgba(255, 255, 255, 0.50); }

/* IDE-031: the bars beside the amount gave way to the receipts / payments
   chart beside the tile (the "Bank row" section at the end of this file). */

/* ─── Missing-documents alert ──────────────────────────────────────────── */

.home-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 14px 14px 18px;
    border-radius: 18px;
    background: var(--glass-fill-strong);
    -webkit-backdrop-filter: blur(var(--glass-blur));
    backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border-chrome);
    box-shadow: 0 8px 24px rgba(16, 27, 65, 0.05), var(--glass-highlight);
    color: inherit !important;
    text-decoration: none !important;
}
.home-alert-message { display: flex; align-items: center; gap: 14px; min-width: 0; }
.home-alert-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-alert-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.home-alert-desc { font-size: 13px; color: var(--muted); }
.home-alert-desc-short, .home-alert-chevron { display: none; }

/* Button/Primary with the design's amber chevron. */
.home-alert-cta {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px 10px 16px;
    border-radius: 12px;
    background: var(--solid);
    box-shadow: var(--solid-shadow);
    font-size: 14px;
    font-weight: 600;
    color: var(--solid-ink);
    white-space: nowrap;
    transition: background 0.16s ease, transform 0.16s ease;
}
.home-alert-cta svg { width: 16px; height: 16px; color: #E0A93B; }
.home-alert:hover .home-alert-cta { background: var(--solid-hover); transform: translateX(1px); }
.home-alert-chevron svg { width: 18px; height: 18px; color: var(--warn); }

/* ─── KPI row ──────────────────────────────────────────────────────────── */

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

.home-kpi { display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 20px; }
.home-kpi-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.home-kpi-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-kpi-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.home-kpi-label-short { display: none; }
.home-kpi-value {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 0 4px; font-size: 12px; color: var(--muted); }
.home-note .home-glyph { width: 14px; height: 14px; margin-top: 1px; }
.home-note-short { display: none; }

/* ─── Trend ────────────────────────────────────────────────────────────── */

/* The card as the design draws it: the legend with the period's totals on the
   left, the grouped bars on the right under gridlines, the axis at the right
   edge. The bar area (--plot-h) and the month row (--plot-foot) are fixed so a
   gridline and its axis label can sit at the same --y share from the bottom. */
.home-trend { display: flex; flex-direction: column; gap: 16px; padding: 24px 24px 20px; }
.home-plot-wrap { display: flex; align-items: stretch; gap: 28px; }

.home-plot-legend { flex: none; display: flex; flex-direction: column; justify-content: center; gap: 18px; min-width: 136px; margin: 0; padding: 0 0 30px; list-style: none; }
.home-plot-legend li { display: flex; align-items: flex-start; gap: 10px; }
.home-legend-dot { flex: none; width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; }
.home-legend-dot--revenue { background: var(--series-income); }
.home-legend-dot--expenses { background: var(--series-expense); }
.home-legend-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.home-legend-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.home-legend-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.home-legend-period { padding-left: 20px; font-size: 12px; color: var(--muted-2); }

.home-plot { --plot-h: 190px; --plot-foot: 30px; --axis-w: 48px; flex: 1 1 auto; min-width: 0; display: flex; align-items: flex-start; gap: 10px; padding-top: 8px; }
.home-plot-groups { position: relative; flex: 1 1 0; min-width: 0; display: flex; justify-content: space-between; gap: 4px; }
.home-plot-grid { position: absolute; left: 0; right: 0; top: 0; bottom: var(--plot-foot); pointer-events: none; }
.home-plot-gridline { position: absolute; left: 0; right: 0; bottom: calc(var(--y, 0) * 100%); height: 1px; background: var(--hairline); }
.home-plot-gridline.is-base { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.home-plot-group { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.home-plot-bars { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: var(--plot-h); width: 100%; }
.home-plot-bar { display: block; box-sizing: border-box; width: 14px; max-width: 42%; border-radius: 5px 5px 0 0; transition: height 0.35s ease; }
.home-plot-bar--revenue { background: linear-gradient(180deg, color-mix(in srgb, var(--series-income) 76%, #FFFFFF), var(--series-income)); }
.home-plot-bar--expenses { background: linear-gradient(180deg, color-mix(in srgb, var(--series-expense) 80%, #FFFFFF), var(--series-expense)); }
/* The month still being posted: the design's dashed outline over a tint. */
.home-plot-group.is-provisional .home-plot-bar--revenue { background: color-mix(in srgb, var(--series-income) 14%, transparent); border: 1.5px dashed var(--series-income); border-bottom: 0; }
.home-plot-group.is-provisional .home-plot-bar--expenses { background: color-mix(in srgb, var(--series-expense) 18%, transparent); border: 1.5px dashed var(--series-expense); border-bottom: 0; }
.home-plot-group.is-provisional .home-plot-label { color: var(--brand); font-weight: 600; }
.home-plot-label { height: 14px; font-size: 11px; line-height: 14px; color: var(--muted); white-space: nowrap; }
.home-plot-axis { position: relative; flex: none; width: var(--axis-w); height: var(--plot-h); }
.home-plot-axis span { position: absolute; right: 0; bottom: calc(var(--y, 0) * 100%); transform: translateY(50%); font-size: 11px; line-height: 1; color: var(--muted-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ─── Side column ──────────────────────────────────────────────────────── */

.home-recent { display: flex; flex-direction: column; gap: 4px; padding: 24px 24px 16px; }
.home-recent .onix-card-head { align-items: center; margin-bottom: 4px; }
.home-recent-all-short, .home-doc-ref-short { display: none; }
.home-doc:hover { text-decoration: none; }
.home-doc:hover .onix-row-title { color: var(--brand-strong); }

.home-add { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.home-add-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; gap: 10px; }
.home-add-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 8px 12px;
    border-radius: 16px;
    background: var(--glass-fill-inset);
    border: 1px solid var(--glass-border-chrome);
    font-size: 12px;
    font-weight: 500;
    text-align: center;
    color: var(--ink) !important;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.home-add-tile:hover { text-decoration: none; transform: translateY(-2px); background: var(--glass-fill-tile); box-shadow: 0 6px 16px rgba(16, 27, 65, 0.08); }
.home-add-tile img { width: 40px; height: 40px; display: block; }

.home-upcoming { display: flex; flex-direction: column; gap: 4px; padding: 24px 24px 20px; }
.home-upcoming .onix-card-head { margin-bottom: 4px; }
.home-upcoming-total { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.home-upcoming .onix-progress { margin-top: 10px; }
.home-upcoming-foot { margin-top: 12px; }
.home-obligation-end { align-items: flex-end; }
/* "Mark paid" waits for the row: visible on hover / focus, always on touch. */
.home-obligation-settle { opacity: 0; transition: opacity 0.16s ease; }
.home-obligation:hover .home-obligation-settle,
.home-obligation:focus-within .home-obligation-settle { opacity: 1; }
@media (hover: none) { .home-obligation-settle { opacity: 1; } }

.home-none { margin: 8px 0 4px; font-size: 13px; color: var(--muted); }
.home-rows { display: flex; flex-direction: column; }

/* ─── Inline forms (add account / obligation) ──────────────────────────── */

.home-form-card { display: flex; flex-direction: column; gap: 14px; }
.home-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.home-form--stack { margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--hairline); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.home-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 500; color: var(--muted); }
.home-form input,
.home-form select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--glass-fill-tile);
    font: inherit;
    font-size: 13px;
    color: var(--ink);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.home-form input:focus,
.home-form select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.home-form-actions { display: flex; gap: 8px; align-items: center; }

/* ─── States ───────────────────────────────────────────────────────────── */

/* ── Onboarding: the steps until the books are set up ─────────────────── */
.home-onboarding { display: flex; flex-direction: column; gap: 14px; }
.home-onboarding .onix-card-head { align-items: flex-start; }
.home-onboarding-count { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--brand); line-height: 1; }
.home-onboarding-steps { list-style: none; margin: 0; padding: 0; }
.home-onboarding-step { gap: 12px; }
.home-onboarding-mark {
    flex: none; width: 24px; height: 24px; border-radius: 50%;
    border: 1.5px solid var(--hairline); display: inline-flex; align-items: center; justify-content: center;
    color: var(--good);
}
.home-onboarding-mark svg { width: 14px; height: 14px; }
.home-onboarding-step.is-done .home-onboarding-mark { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, transparent); }
.home-onboarding-step.is-done .onix-row-title { color: var(--muted); text-decoration: line-through; }
.home-onboarding-step .onix-row-sub { white-space: normal; }
.home-onboarding-step .onix-row-end { flex-direction: row; align-items: center; gap: 8px; }
.home-onboarding-step .onix-link { white-space: nowrap; }
@media (max-width: 720px) {
    .home-onboarding-step { flex-wrap: wrap; }
    .home-onboarding-step .onix-row-end { width: 100%; justify-content: flex-end; padding-left: 36px; }
}

.home-empty { text-align: center; padding: 44px 24px; }
.home-empty h2 { margin: 0 0 8px; }
.home-empty p { margin: 0 auto 14px; max-width: 520px; color: var(--muted); }

.home-skel { border-radius: 20px; }
.home-skel--hero { height: 292px; border-radius: 24px; }
.home-skel--kpi { height: 148px; }
.home-skel--trend { height: 330px; }
.home-skel--side { height: 400px; }
.home-skel--side-sm { height: 200px; }

/* Page-wide drop target (js/onix-shell.js adds .is-dragging / .is-uploading). */
.home-drop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}
.home.is-dragging .home-drop { display: flex; }
.home-drop-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 36px 56px;
    border-radius: 24px;
    border: 2px dashed var(--brand);
    background: var(--glass-pop);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}
.home.is-uploading { cursor: progress; }

.home-only-mobile { display: none; }

/* ─── Narrow desktop / tablet: the side column drops under the main one ── */

@media (max-width: 1240px) {
    .home-grid { grid-template-columns: minmax(0, 1fr); }
    .home-side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
    .home-side > .home-recent { grid-row: span 2; }
    .home-lite { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1040px) {
    .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-hero-amount { font-size: 48px; }
}

/* ─── Phone (frame "Home / Mobile 393") ────────────────────────────────── */

@media (max-width: 767.98px) {
    .home-head { margin-bottom: 14px; gap: 14px; }
    .home-title { gap: 4px; }
    /* The company switcher in the bar above plays the overline's part. */
    .home-title .onix-overline { display: none; }
    .home-title h1 { font-size: 24px; letter-spacing: -0.02em; }
    .home-meta { font-size: 13px; }
    .home-meta-full { display: none; }
    .home-meta-cap { text-transform: capitalize; }
    .home-glyph { width: 14px; height: 14px; }
    .home-only-mobile { display: inline; }
    .home-only-desktop { display: none; }

    .home-head-actions { width: 100%; }
    .home-head-actions .onix-segmented { display: flex; width: 100%; }
    .home-head-actions .onix-segmented button { flex: 1 1 0; padding: 9px 4px; }
    .home-period { display: none; }

    /* One stack, in the phone's order. */
    .home-grid { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
    .home-main, .home-side { display: contents; }
    .home-grid > *, .home-main > *, .home-side > * { min-width: 0; max-width: 100%; }
    .home-hero { order: 1; }
    .home-form-card { order: 2; }
    .home-alert { order: 3; }
    .home-kpis { order: 4; }
    .home-note { order: 5; }
    .home-recent { order: 6; }
    .home-upcoming { order: 7; }
    .home-trend { order: 8; }
    .home-add { display: none; }
    .home-lite .home-add { display: flex; }

    .home-hero { padding: 20px; border-radius: 24px; }
    .home-hero-cash { gap: 10px; }
    .home-hero-amount { font-size: clamp(28px, 9.4vw, 38px); }
    .home-hero-vs { display: none; }
    .home-hero-chip-vs { display: inline; }
    .home-hero-foot { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .home-hero-glow { top: -220px; right: -320px; }

    .home-alert { padding: 14px 16px; border-radius: 20px; }
    .home-alert-total, .home-alert-desc-long, .home-alert-cta { display: none; }
    .home-alert-desc-short, .home-alert-chevron { display: inline-flex; }
    .home-alert-desc-short { display: inline; }

    .home-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .home-kpi { padding: 16px; gap: 12px; border-radius: 22px; }
    .home-kpi-value { font-size: 22px; }
    .home-kpi-label-long { display: none; }
    .home-kpi-label-short { display: inline; }
    .home-note-long { display: none; }
    .home-note-short { display: inline; }

    .home-recent, .home-upcoming, .home-trend { padding: 20px 18px 14px; border-radius: 22px; }
    .home-recent-all-long { display: none; }
    .home-recent-all-short { display: inline; }
    .home-doc .onix-row-amount, .home-doc-ref { display: none; }
    .home-doc-ref-short { display: block; }
    .home-doc:nth-child(n+5) { display: none; }
    .home-doc:nth-child(4) { border-bottom: 0; }

    .home-trend { gap: 14px; }
    .home-plot-wrap { gap: 12px; }
    .home-plot-legend { min-width: 0; width: 100px; gap: 14px; }
    .home-legend-value { font-size: 15px; }
    .home-legend-period { font-size: 11px; }
    .home-plot { --plot-h: 150px; --axis-w: 40px; gap: 6px; padding-top: 6px; }
    .home-plot-groups { gap: 2px; }
    /* A year does not fit a phone: the last six months, as the design shows. */
    .home-plot-group:nth-last-child(n+7) { display: none; }
    .home-plot-bars { gap: 3px; }
    .home-plot-bar { width: 9px; border-radius: 4px 4px 0 0; }
    .home-plot-label { font-size: 10px; }
    .home-plot-axis span { font-size: 10px; }

    .home-form--stack { grid-template-columns: minmax(0, 1fr); }
    .home-lite { gap: 14px; }

    /* The bell and the avatar ride beside the greeting, as the design draws
       them. Progressive: without :has() they simply stay in the bar above. */
    .shell:has(.home) .shell-topbar { padding-bottom: 0; }
    .shell:has(.home) .shell-iconbtn.shell-search-icon { display: none; }
    .shell:has(.home) .shell-bell,
    .shell:has(.home) .shell-user { transform: translateY(40px); z-index: 3; }
    .shell:has(.home) main.shell-main { padding-top: 2px; }
    .shell:has(.home) .home-title { padding-right: 100px; }
}

/* ---- General-ledger sections: position, invoiced, ratios, benchmarks ---- */
.home-hero-account-tag { color: var(--muted); font-size: 0.85em; margin-left: 4px; }

.home-position, .home-invoiced, .home-ratios, .home-gauges { display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.home-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-stat { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.home-stat-label { color: var(--muted); font-size: 0.85em; }
.home-stat-value { font-family: var(--font-display); font-size: 1.35em; color: var(--ink); }
.home-stat-sub { color: var(--muted); font-size: 0.8em; }

.home-invoiced-chart { width: 100%; height: auto; }
.home-invoiced-base { stroke: var(--line-strong); stroke-width: 1; }
.home-invoiced-bar rect:first-child { fill: var(--brand); opacity: 0.55; }
.home-invoiced-bar.is-current rect:first-child { opacity: 1; }
.home-invoiced-bar:hover rect:first-child { opacity: 0.85; }
.home-invoiced-hit { fill: transparent; }
.home-invoiced-bar text { fill: var(--muted); font-size: 11px; font-family: var(--font-text); }

.home-ratio-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.home-ratio-group h3 { margin: 0 0 8px; }
.home-ratio-group dl { margin: 0; display: grid; gap: 6px; }
.home-ratio { display: flex; justify-content: space-between; gap: 8px; font-size: 0.9em; border-bottom: 1px solid var(--hairline); padding-bottom: 6px; }
.home-ratio dt { color: var(--muted); }
.home-ratio dd { margin: 0; color: var(--ink); white-space: nowrap; }

.home-gauge-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 24px; }
.home-gauge { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.home-gauge-head { display: flex; align-items: baseline; gap: 8px; }
.home-gauge-name { flex: 1; color: var(--ink); font-size: 0.9em; }
.home-gauge-value { font-family: var(--font-display); color: var(--ink); }
.home-gauge.is-good .home-gauge-chip { background: var(--good-soft); color: var(--good); }
.home-gauge.is-fair .home-gauge-chip { background: var(--warn-soft); color: var(--warn); }
.home-gauge.is-poor .home-gauge-chip { background: var(--danger-soft); color: var(--danger); }
.home-gauge.is-none .home-gauge-chip { color: var(--muted); }
.home-gauge-track { position: relative; height: 8px; border-radius: 4px; overflow: visible; }
.home-gauge-zone { position: absolute; top: 0; bottom: 0; border-right: 2px solid var(--panel); }
.home-gauge-zone:first-child { border-radius: 4px 0 0 4px; }
.home-gauge-zone:last-of-type { border-radius: 0 4px 4px 0; border-right: 0; }
.home-gauge-zone.is-good { background: var(--good-soft); }
.home-gauge-zone.is-fair { background: var(--warn-soft); }
.home-gauge-zone.is-poor { background: var(--danger-soft); }
.home-gauge-marker { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px;
    background: var(--ink); box-shadow: 0 0 0 2px var(--panel); }
.home-gauge-text { margin: 0; color: var(--muted); font-size: 0.8em; }

@media (max-width: 900px) {
    .home-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .home-ratio-groups, .home-gauge-list { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Colour — the KPI tiles each in their own hue, a second glow in the hero,
   the alert in amber. Tokens: onix-theme.css.
   ═══════════════════════════════════════════════════════════════════════════ */

.home-kpi { --kpi-color: var(--brand); position: relative; overflow: hidden; }
.home-kpi--revenue  { --kpi-color: #059669; }
.home-kpi--expenses { --kpi-color: #DC2626; }
.home-kpi--profit   { --kpi-color: #4338CA; }
.home-kpi--score    { --kpi-color: #D97706; }
:root[data-theme="dark"] .home-kpi--revenue  { --kpi-color: #5FCFA4; }
:root[data-theme="dark"] .home-kpi--expenses { --kpi-color: #F9ACB0; }
:root[data-theme="dark"] .home-kpi--profit   { --kpi-color: #A5B4FC; }
:root[data-theme="dark"] .home-kpi--score    { --kpi-color: #FBBF24; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .home-kpi--revenue  { --kpi-color: #5FCFA4; }
    :root:not([data-theme="light"]) .home-kpi--expenses { --kpi-color: #F9ACB0; }
    :root:not([data-theme="light"]) .home-kpi--profit   { --kpi-color: #A5B4FC; }
    :root:not([data-theme="light"]) .home-kpi--score    { --kpi-color: #FBBF24; }
}
/* A soft disc of the hue behind the icon's corner. */
.home-kpi::before {
    content: "";
    position: absolute;
    top: -70px;
    left: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    pointer-events: none;
    background: radial-gradient(circle, color-mix(in srgb, var(--kpi-color) 24%, transparent), transparent 68%);
}
.home-kpi > * { position: relative; }
.home-kpi .onix-icontile--kpi {
    background: color-mix(in srgb, var(--kpi-color) 14%, #FFFFFF);
    border-color: color-mix(in srgb, var(--kpi-color) 28%, transparent);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--kpi-color) 22%, transparent);
}
.home-kpi-label { color: var(--kpi-color); font-weight: 600; }
.home-kpi { box-shadow: var(--glass-shadow), var(--glass-highlight), inset 0 3px 0 color-mix(in srgb, var(--kpi-color) 70%, transparent); }

/* The hero: the teal glow top-right, a coral → violet one bottom-left. */
.home-hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    left: -180px;
    bottom: -240px;
    width: 560px;
    height: 460px;
    pointer-events: none;
    background: radial-gradient(closest-side, rgba(242, 82, 90, 0.34), rgba(109, 40, 217, 0.18) 55%, transparent 100%);
}
.home-hero-chip { background: rgba(95, 207, 164, 0.22); border-color: rgba(95, 207, 164, 0.35); color: #BFF0DA; }

/* The missing-documents alert: amber at its edge and behind its icon. */
.home-alert {
    background: linear-gradient(90deg, color-mix(in srgb, #E0A93B 16%, var(--glass-fill-strong)), var(--glass-fill-strong) 55%);
    box-shadow: 0 8px 24px rgba(16, 27, 65, 0.05), var(--glass-highlight), inset 4px 0 0 #E0A93B;
}

/* Recent documents: the chip colours of onix-glass; the row title warms to the brand on hover. */
.home-onboarding-count { color: var(--brand); }
.home-onboarding-step.is-done .home-onboarding-mark { border-color: var(--hue-green); background: var(--hue-green-soft); color: var(--hue-green); }
.home-legend-dot--expenses { background: var(--series-expense); }
.home-invoiced-bar rect:first-child { fill: var(--series-income); }

/* ═══ Onix BI identity: the hero in the signature gradient ═════════════════
   The fleet dashboard's hero: #0D47A1 → #1E88E5 → #42A5F5 under a white light,
   good in sky, attention in pale amber; the KPI tiles revenue blue, expenses
   amber (the series pair), profit deep blue, the score cyan. */
.home-hero {
    background: linear-gradient(135deg, #0D47A1 0%, #1E88E5 52%, #42A5F5 100%);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: 0 18px 44px rgba(13, 71, 161, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.30);
}
.home-hero-glow { background: radial-gradient(closest-side, rgba(255, 255, 255, 0.30), rgba(187, 222, 251, 0.14) 50%, transparent 100%); }
.home-hero::after { background: radial-gradient(closest-side, rgba(10, 31, 60, 0.30), rgba(13, 71, 161, 0.12) 55%, transparent 100%); }
.home-hero-chip { background: rgba(255, 255, 255, 0.18); border-color: rgba(255, 255, 255, 0.34); color: #FFFFFF; }
.home-hero-overline, .home-hero-vs, .home-hero-foot { color: rgba(255, 255, 255, 0.78); }
.home-hero-account { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.24); }
.home-hero-account--add .home-hero-account-balance { color: #E3F2FD; }
.home-alert {
    background: linear-gradient(90deg, rgba(255, 243, 224, 0.92), var(--glass-fill-strong) 55%);
    border-color: rgba(245, 124, 0, 0.35);
    box-shadow: 0 8px 24px rgba(10, 31, 60, 0.05), var(--glass-highlight), inset 4px 0 0 #F57C00;
}
.home-alert-cta svg { color: #FFB74D; }
.home-kpi--revenue  { --kpi-color: #0057D2; }
.home-kpi--expenses { --kpi-color: #E76500; }
.home-kpi--profit   { --kpi-color: #0D47A1; }
.home-kpi--score    { --kpi-color: #0288D1; }
:root[data-theme="dark"] .home-kpi--revenue  { --kpi-color: #64B5F6; }
:root[data-theme="dark"] .home-kpi--expenses { --kpi-color: #FFB74D; }
:root[data-theme="dark"] .home-kpi--profit   { --kpi-color: #90CAF9; }
:root[data-theme="dark"] .home-kpi--score    { --kpi-color: #4FC3F7; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .home-kpi--revenue  { --kpi-color: #64B5F6; }
    :root:not([data-theme="light"]) .home-kpi--expenses { --kpi-color: #FFB74D; }
    :root:not([data-theme="light"]) .home-kpi--profit   { --kpi-color: #90CAF9; }
    :root:not([data-theme="light"]) .home-kpi--score    { --kpi-color: #4FC3F7; }
}
/* Dark: the alert's amber as a tint over the glass, not the light page's cream. */
:root[data-theme="dark"] .home-alert { background: linear-gradient(90deg, rgba(245, 124, 0, 0.22), var(--glass-fill-strong) 55%); border-color: rgba(255, 183, 77, 0.30); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home-alert { background: linear-gradient(90deg, rgba(245, 124, 0, 0.22), var(--glass-fill-strong) 55%); border-color: rgba(255, 183, 77, 0.30); } }

/* ═══════════════════════════════════════════════════════════════════════════
   Dashboard editor (HomeView.Editor.cs) — "Edit dashboard": the toolbox beside
   the grid, every placed block in a dashed frame with its handle and tools, a
   drop zone at the end of each column. Nothing here applies outside edit mode:
   the frames exist only while .home--editing. Tokens: onix-theme.css.
   ═══════════════════════════════════════════════════════════════════════════ */

.home-edit { cursor: pointer; transition: background 0.16s ease, border-color 0.16s ease; }
.home-edit:hover { background: var(--glass-fill-tile); border-color: var(--line-strong); }
.home-edit svg { color: var(--brand); }

.home-editor { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 24px; align-items: start; }
/* Beside the toolbox the columns are narrower: the side column gives a little, the KPI tiles go 2 × 2. */
.home-grid.is-editing { grid-template-columns: minmax(0, 1fr) 380px; }
.home-grid.is-editing .home-kpis, .home-grid.is-editing .home-bi-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.home-toolbox {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px);
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    scrollbar-width: thin;
}
.home-toolbox .onix-card-head { align-items: flex-start; }
.home-toolbox-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding-bottom: 12px; border-bottom: 1px solid var(--hairline); }
.home-toolbox-reset { margin-left: auto; color: var(--muted); }
.home-toolbox-reset:hover { color: var(--danger); }
.home-toolbox-group h3 { margin: 0 0 8px; }
.home-toolbox-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.home-toolbox-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--glass-fill-inset);
    border: 1px solid var(--glass-border-chrome);
}
.home-toolbox-item.is-placed { opacity: 0.72; }
.home-toolbox-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.home-toolbox-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.home-toolbox-desc { font-size: 11px; line-height: 1.35; color: var(--muted); }
.home-toolbox-item .button { flex: none; white-space: nowrap; }

/* The frame around a placed block. */
.home-block.is-editing {
    position: relative;
    padding: 8px;
    border-radius: 24px;
    border: 1.5px dashed color-mix(in srgb, var(--brand) 55%, transparent);
    background: color-mix(in srgb, var(--brand-soft) 35%, transparent);
    transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}
.home-block.is-editing.is-dragging { opacity: 0.45; }
.home-block.is-editing.is-drop-target { border-style: solid; border-color: var(--brand); box-shadow: 0 0 0 3px var(--ring); }
.home-block-bar { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; }
.home-block-handle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    background: var(--glass-fill-control);
    border: 1px solid var(--glass-border);
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    min-width: 0;
}
.home-block-handle:active { cursor: grabbing; }
.home-block-handle svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.home-block-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-block-tools { margin-left: auto; display: inline-flex; gap: 4px; flex: none; }
.home-block-btn {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: var(--glass-fill-control);
    color: var(--ink);
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.home-block-btn svg { width: 14px; height: 14px; }
.home-block-btn:hover { background: var(--panel-hover); }
.home-block-btn:disabled { opacity: 0.35; cursor: default; }
.home-block-btn--remove:hover { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.home-block-body { min-width: 0; }
.home-block-body > * + * { margin-top: 24px; }
.home-block-empty { margin: 6px 8px 4px; font-size: 12px; color: var(--muted); }

.home-dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 64px;
    border-radius: 18px;
    border: 1.5px dashed var(--line-strong);
    font-size: 13px;
    color: var(--muted);
    transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}
.home-dropzone.is-empty { min-height: 160px; }
.home-dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }

/* ─── OP-041: the named layouts — the header's switcher and TV mode, the toolbox's Layouts and Daily digest ─── */

.home-layout { position: relative; gap: 6px; padding-right: 10px; }
.home-layout-label { color: var(--muted); }
.home-layout select {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    padding: 0 18px 0 0;
    min-height: 0;
    max-width: 180px;
    cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: right 6px center, right 2px center;
    background-size: 4px 4px, 4px 4px;
    background-repeat: no-repeat;
}
.home-layout select:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 6px; }
.home-tv { text-decoration: none; cursor: pointer; transition: background 0.16s ease, border-color 0.16s ease; }
.home-tv:hover { background: var(--glass-fill-tile); border-color: var(--line-strong); }
.home-tv svg { color: var(--brand); }

.home-layouts, .home-digest {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--hairline);
}
.home-digest { border-bottom: 0; padding-top: 12px; border-top: 1px solid var(--hairline); }
.home-layouts-field, .home-digest-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.home-layouts-field .home-layout-label { color: inherit; }
.home-layouts-field select, .home-layouts-field input, .home-digest-field select { width: 100%; font-size: 13px; color: var(--ink); }
.home-digest-field small { font-size: 11px; color: var(--muted); }
.home-layouts-actions, .home-digest-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.home-layouts-delete { margin-left: auto; color: var(--muted); }
.home-layouts-delete:hover { color: var(--danger); }
.home-layouts-hint, .home-digest-sub { margin: 0; font-size: 11px; line-height: 1.4; color: var(--muted); }
.home-digest-set { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 4px; }
.home-digest-set legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.home-digest-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.home-digest-check input { width: auto; min-height: 0; margin: 0; }
.home-digest-on { font-weight: 600; }
.home-digest-problem { margin: 0; font-size: 12px; color: var(--danger); }
.home-digest-off { margin: 0; font-size: 12px; color: var(--muted); }
.home-digest-status { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; margin: 0; font-size: 12px; }
.home-digest-status dt { color: var(--muted); }
.home-digest-status dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.home-digest-preview {
    padding: 10px 12px;
    border-radius: 14px;
    background: var(--glass-fill-inset);
    border: 1px solid var(--glass-border-chrome);
    font-size: 12px;
    line-height: 1.45;
}
.home-digest-preview h4 { margin: 0 0 4px; font-size: 13px; color: var(--ink); }
.home-digest-preview p { margin: 0; color: var(--ink); }

@media (max-width: 1240px) {
    .home-editor { grid-template-columns: minmax(0, 1fr); }
    .home-toolbox { position: static; max-height: none; }
    .home-grid.is-editing { grid-template-columns: minmax(0, 1fr); }
    .home-grid.is-editing .home-side { display: flex; flex-direction: column; }
}
@media (max-width: 767.98px) {
    .home-toolbox { padding: 16px; }
    .home-layout-label { display: none; }
    .home-layout select { max-width: 140px; }
    .home-block.is-editing { padding: 6px; border-radius: 22px; }
    .home-block-tools .home-block-btn { width: 32px; height: 32px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Onix BI blocks on the Home (HomeBiBlock.razor) — the legacy executive
   dashboard's blocks over the glass cards, coloured with the --bi-* tokens of
   onix-bi.css (the legacy palette, light and dark).
   ═══════════════════════════════════════════════════════════════════════════ */

.home-bi { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.home-bi .onix-card-head { align-items: flex-start; }
.home-bi-chart { width: 100%; height: auto; display: block; }
.home-bi-chart .bi-value { font-size: 10px; }
.home-bi-chart g.is-negative .bi-bar { opacity: 0.6; }

.home-bi-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.home-bi-metrics .bi-metric { border-radius: 20px; box-shadow: var(--glass-shadow); }
.home-bi-metrics .bi-metric-icon svg { width: 40px; height: 40px; }
.home-bi-metrics .bi-metric-value { font-size: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-bi--empty .onix-card-head { margin-bottom: 2px; }
.home-bi-empty-title { margin: 0; font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--ink); }
.home-bi-empty-text { margin: 0; font-size: 13px; line-height: 1.45; color: var(--muted); }
.home-bi-empty-links { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }

.home-bi-donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.home-bi-donut-wrap .bi-donut { flex: none; }
.home-bi-donut-center { font-family: var(--font-display); font-size: 15px; font-weight: 700; fill: var(--ink); }
.home-bi-legend { display: flex; flex-direction: column; gap: 8px; flex: 1 1 180px; min-width: 0; }
.home-bi-legend-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; font-size: 13px; color: var(--ink); }
.home-bi-legend-row .bi-legend-swatch { margin: 0; }
.home-bi-legend-share { color: var(--muted); font-size: 12px; }

.home-bi-ring-track { fill: none; stroke: var(--panel-hover); stroke-width: 14; }
.home-bi-ring-value { fill: none; stroke-width: 14; stroke-linecap: round; transition: stroke-dasharray 0.4s ease; }
.home-bi-ring-num { font-family: var(--font-display); font-size: 34px; font-weight: 800; }
.home-bi-scorecard { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; align-items: center; }
.home-bi-scorecard .bi-gauge { max-width: 180px; }
.home-bi-dims { display: flex; flex-direction: column; gap: 10px; }
.home-bi-dims .bi-bar-row { grid-template-columns: minmax(0, 1fr) 2fr 40px; }
.home-bi-dims .bi-bar-row > span:first-child { white-space: nowrap; }
.home-bi-weight { color: var(--muted); font-size: 11px; }
.home-bi-dim-value { text-align: right; font-weight: 600; }

.home-bi-table-wrap { overflow-x: auto; margin: 0 -8px; padding: 0 8px; }
.home-bi-table-wrap .bi-table th:first-child, .home-bi-table-wrap .bi-table td:first-child { padding-left: 4px; }
.home-bi-center { text-align: center; }
.home-bi-kpi-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); }
.home-bi-kpi-mark { display: inline-block; width: 4px; height: 20px; border-radius: 2px; background: var(--bi-series, var(--bi-primary)); flex: none; }
.home-bi-kpi-value { font-weight: 700; white-space: nowrap; }
.home-bi-kpi-change { margin-left: 4px; font-size: 11px; font-weight: 600; }
.home-bi-progress { display: block; min-width: 90px; }

.home-bi-warning-counts { display: flex; flex-wrap: wrap; gap: 8px; }
.home-bi-warning { padding-left: 12px; border-left: 3px solid var(--bi-severity, var(--bi-primary)); }
.home-bi-warning .onix-row-sub { white-space: normal; }

.home-bi-questions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.home-bi-questions a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bi-tertiary-faint);
    border: 1px solid var(--glass-border-chrome);
    font-size: 13px;
    color: var(--ink);
    text-decoration: none;
    transition: background 0.16s ease;
}
.home-bi-questions a:hover { background: var(--bi-tertiary-soft); text-decoration: none; }
.home-bi-mayla-foot { margin: 0; }

@media (max-width: 1040px) {
    .home-bi-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    /* On the phone's single stack the BI blocks follow the trend card. */
    .home-bi, .home-bi-metrics { order: 9; }
    .home-bi { padding: 20px 18px 16px; border-radius: 22px; }
    .home-bi-metrics { gap: 12px; }
    .home-bi-metrics .bi-metric-value { font-size: clamp(16px, 5.2vw, 22px); }
    .home-bi-scorecard { grid-template-columns: minmax(0, 1fr); justify-items: center; }
    .home-bi-dims { width: 100%; }
    .home-bi-dims .bi-bar-row { grid-template-columns: auto minmax(0, 1fr) 36px; }
}

/* ═══ Flat ═══════════════════════════════════════════════════════════════════
   The hero one blue, no glows; the KPI tiles white with a grey icon tile and
   a grey label; the alert a white card with its amber icon; flat bars. */
.home-hero,
:root[data-theme="dark"] .home-hero { background: var(--solid); border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home-hero { background: var(--solid); border: 0; box-shadow: none; } }
.home-hero-glow, .home-hero::after { display: none; }
.home-kpi::before { display: none; }
.home-kpi { box-shadow: var(--glass-shadow); }
.home-kpi .onix-icontile--kpi { background: var(--panel-hover); border-color: transparent; box-shadow: none; }
.home-kpi-label { color: var(--muted); font-weight: 500; }
.home-alert,
:root[data-theme="dark"] .home-alert { background: var(--panel); border-color: var(--line); box-shadow: var(--glass-shadow); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home-alert { background: var(--panel); border-color: var(--line); box-shadow: var(--glass-shadow); } }
.home-plot-bar--revenue { background: var(--series-income); }
.home-plot-bar--expenses { background: var(--series-expense); }

/* ---- OP-040: the Home's Operational figures block ---- */
.home-bi-ops { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.home-bi-op { display: flex; flex-direction: column; gap: 4px; padding: 12px; border-radius: var(--radius-md); border-left: 3px solid var(--bi-series, var(--bi-primary)); background: color-mix(in srgb, var(--bi-series, var(--bi-primary)) 6%, transparent); }
.home-bi-op-label { font-size: 12px; color: var(--muted); }
.home-bi-op-value { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.home-bi-op-year { font-size: 12px; font-weight: 600; }
.home-bi-op-link { font-size: 12px; margin-top: 2px; }

/* ═══ Bank row (IDE-031) ══════════════════════════════════════════════════════
   The Home's first row, as the accountant reads Odoo's bank journal card: the
   compact cash tile (.home-hero, the one coloured surface) at the left, the
   money in and out of the last six months at its right (HomeBankChart: receipts
   up in green, payments down in ink, the month's net over each column), the
   "Latest bank movements" card (HomeBankMovements) under the row. The row stacks
   when its own width is short (a narrow main column, a phone). Tokens only. */

.home-bank { container: home-bank / inline-size; min-width: 0; }
.home-bank-row { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 20px; align-items: stretch; }
@container home-bank (max-width: 640px) {
    .home-bank-row { grid-template-columns: minmax(0, 1fr); }
}

/* The tile: the hero's look, compact — the figure smaller, the accounts a list. */
.home-bank .home-hero { flex-direction: column; justify-content: flex-start; gap: 12px; padding: 22px; border-radius: 22px; min-width: 0; }
.home-bank .home-hero-cash { gap: 10px; }
.home-bank .home-hero-amount { font-size: 36px; }
.home-bank .home-hero-accounts { flex-direction: column; flex-wrap: nowrap; gap: 6px; padding-top: 4px; }
.home-bank .home-hero-account { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 12px; }
.home-bank .home-hero-account-name { flex: 1 1 auto; max-width: none; min-width: 0; }
.home-bank .home-hero-account-balance { flex: none; text-align: right; }
.home-bank .home-hero-account.is-selected { background: rgba(255, 255, 255, 0.24); border-color: rgba(255, 255, 255, 0.50); }
.home-hero-more {
    align-self: flex-start;
    padding: 2px 0;
    border: 0;
    background: none;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: inherit;
    opacity: 0.85;
    cursor: pointer;
}
.home-hero-more:hover { opacity: 1; text-decoration: underline; }

/* The chart card. */
.home-bank-chart { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px 18px; min-width: 0; }
.home-bank-select { max-width: 240px; padding: 7px 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; }
.home-bank-legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 0; padding: 0; list-style: none; font-size: 12px; color: var(--muted); }
.home-bank-legend li { display: inline-flex; align-items: center; gap: 6px; }
.home-bank-legend-value { font-family: var(--font-display); font-size: 14px; font-weight: 700; color: var(--ink); }
.home-bank-dot { flex: none; width: 10px; height: 10px; border-radius: 3px; }
.home-bank-dot--in { background: var(--good); }
.home-bank-dot--out { background: var(--ink); }
.home-bank-svg { display: block; width: 100%; height: auto; overflow: visible; }
.home-bank-base { stroke: var(--line-strong); stroke-width: 1; }
.home-bank-bar--in { fill: var(--good); }
.home-bank-bar--out { fill: var(--ink); opacity: 0.82; }
.home-bank-col:hover .home-bank-bar { opacity: 1; }
.home-bank-col:hover .home-bank-bar--in { fill: color-mix(in srgb, var(--good) 85%, var(--ink)); }
.home-bank-hit { fill: transparent; }
.home-bank-net { font-family: var(--font-text); font-size: 11px; font-weight: 600; fill: var(--muted); font-variant-numeric: tabular-nums; }
.home-bank-net.is-up { fill: var(--good); }
.home-bank-net.is-down { fill: var(--ink); }
.home-bank-month { font-family: var(--font-text); font-size: 11px; fill: var(--muted); }
.home-bank-col.is-current .home-bank-month { fill: var(--ink); font-weight: 600; }
.home-bank-note { margin: 0; font-size: 12px; color: var(--muted); }
/* Without figures: the silhouette of six empty months, dashed. */
.home-bank-ghost { display: flex; align-items: flex-end; justify-content: space-around; gap: 8px; height: 120px; padding: 0 12px; border-bottom: 1px solid var(--line-strong); }
.home-bank-ghost span { width: 24px; height: 40%; border: 1.5px dashed var(--line-strong); border-bottom: 0; border-radius: 4px 4px 0 0; }

/* Latest bank movements. */
.home-bank-moves { display: flex; flex-direction: column; gap: 4px; padding: 22px 24px 14px; }
.home-bank-moves .onix-card-head { align-items: center; margin-bottom: 4px; }
.home-bank-move { gap: 12px; }
.home-bank-move:hover { text-decoration: none; }
.home-bank-move:hover .onix-row-title { color: var(--brand-strong); }
.home-bank-move-date { flex: none; width: 52px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.home-bank-move-partner { font-weight: 600; }
.home-bank-move-sep, .home-bank-move-label { color: var(--muted); font-weight: 400; }
.home-bank-move:hover .home-bank-move-label { color: inherit; }
.home-bank-move-amount { flex: none; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.home-bank-move-amount.is-in { color: var(--good); }
.home-bank-state { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.home-bank-state.is-matched { background: var(--good); }
.home-bank-state.is-to-match { background: var(--warn); }

@media (max-width: 767.98px) {
    .home-bank { order: 1; }
    .home-bank-moves { order: 2; padding: 20px 18px 12px; border-radius: 22px; }
    .home-bank .home-hero { padding: 20px; }
    .home-bank .home-hero-amount { font-size: clamp(28px, 9.4vw, 36px); }
    .home-bank-chart { padding: 20px 18px 14px; border-radius: 22px; }
    .home-bank-move-date { width: 44px; }
}
