/* fin-home.css — Home dashboard (sheet mode). Built on the Silver kit
   (FinPageHead, FinMetrics, FinSummary, FinPanel); this file only adds the
   page-scoped fin-home- pieces: the two-column panel grid, the shared
   list-row well (To do, Latest invoices, Data checks), the month-at-a-glance
   grid and the unreadable-sheet panel.
   COMMENT RULE: never type an asterisk inside a CSS comment. */

.fin-home { container: finhome / inline-size; }

.fin-home-dash { color: var(--fin-text-3); }
.fin-home-sheetname { overflow-wrap: anywhere; }

/* Receivables (15 Oct 2026) — superseded same day by the full dashboard
   redesign below: the owner's reference mock shows this card on the
   normal dark surface like Payables/Invoiced, only the icon badge
   tinted green, not a full glass card. Keeping the icon tint, dropping
   the glass background so it matches the newer, more complete spec. */
.fin-home-sum .fin-summary-l .fin-metric-ico { background: var(--fin-ok-soft); color: var(--fin-ok-ink); }

/* ── Financial overview cards (15 Oct 2026 full redesign) ─────────────
   Owner's brief: "COMPLEX DATA. SIMPLE UNDERSTANDING." — premium dark
   fintech, mobile-first, restrained gradients (no heavy blur/glow like
   the one-off Receivables treatment above), 16px gaps and 16-20px radii
   (already this kit's --fin-gap / --fin-r-lg, nothing new to add there),
   emerald = positive, blue = incoming, amber = outgoing + aging, soft
   red = overdue. FinHomeStatCard (fin-home.jsx) is the one building
   block for Cash Available (hero), Money In/Out, Net Cash Flow (row),
   Overdue, Payables and Invoiced (DPP). */
.fin-home-stat {
  display: flex; flex-direction: column; gap: var(--fin-s-3); min-width: 0; width: 100%;
  padding: var(--fin-s-5); border-radius: var(--fin-r-lg);
  background: var(--fin-surface-1); border: 1px solid var(--fin-border);
  text-align: left; font: inherit; color: inherit; position: relative; overflow: hidden;
}
.fin-home-stat.is-click { cursor: pointer; transition: border-color .15s ease; }
.fin-home-stat.is-click:hover { border-color: var(--fin-border-strong); }
.fin-home-stat.is-static, .fin-home-stat:disabled { opacity: 1; cursor: default; }
.fin-home-stat-top { display: flex; align-items: flex-start; gap: var(--fin-s-3); min-width: 0; }
.fin-home-stat-ico { display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: var(--fin-r-pill); background: var(--fin-neutral-soft); color: var(--fin-neutral-ink); }
.fin-home-stat-tx { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1 1 auto; }
.fin-home-stat-tx b { font-size: var(--fin-fs-body); font-weight: var(--fin-fw-semi); color: var(--fin-text-1); }
.fin-home-stat-tx span { font-size: var(--fin-fs-meta); line-height: 1.4; color: var(--fin-text-3); overflow-wrap: anywhere; }
.fin-home-stat-chev { flex: none; color: var(--fin-text-3); margin-top: 2px; }
.fin-home-stat-v { font-family: var(--fin-font-display); font-size: var(--fin-fs-num); font-weight: var(--fin-fw-bold); letter-spacing: -.02em; line-height: 1.05; color: var(--fin-text-1); font-variant-numeric: tabular-nums; position: relative; z-index: 1; }
.fin-home-stat-v small { font-family: var(--fin-font-body); font-size: max(12px, .5em); font-weight: var(--fin-fw-medium); color: var(--fin-text-2); margin: 0 .25em; }

/* Tones: a restrained tinted wash + matching icon badge — one low-alpha
   gradient stop fading back into the normal surface, no extra shadow. */
.fin-home-stat.is-ok { background: linear-gradient(165deg, rgba(69, 196, 134, .16), rgba(69, 196, 134, .02) 70%, var(--fin-surface-1)); border-color: rgba(69, 196, 134, .2); }
.fin-home-stat.is-ok .fin-home-stat-ico { background: var(--fin-ok-soft); color: var(--fin-ok-ink); }
.fin-home-stat.is-info { background: linear-gradient(165deg, rgba(94, 158, 234, .16), rgba(94, 158, 234, .02) 70%, var(--fin-surface-1)); border-color: rgba(94, 158, 234, .2); }
.fin-home-stat.is-info .fin-home-stat-ico { background: var(--fin-info-soft); color: var(--fin-info-ink); }
.fin-home-stat.is-warn { background: linear-gradient(165deg, rgba(232, 169, 58, .16), rgba(232, 169, 58, .02) 70%, var(--fin-surface-1)); border-color: rgba(232, 169, 58, .2); }
.fin-home-stat.is-warn .fin-home-stat-ico { background: var(--fin-warn-soft); color: var(--fin-warn-ink); }
.fin-home-stat.is-crit { background: linear-gradient(165deg, rgba(240, 113, 107, .18), rgba(240, 113, 107, .02) 70%, var(--fin-surface-1)); border-color: rgba(240, 113, 107, .22); }
.fin-home-stat.is-crit .fin-home-stat-ico { background: var(--fin-crit-soft); color: var(--fin-crit-ink); }
.fin-home-stat.is-crit .fin-home-stat-v { color: var(--fin-crit-ink); }

/* Hero (Cash Available): full width, the biggest figure on the page, a
   fixed decorative squiggle bleeding off the bottom-right corner. */
.fin-home-stat.is-hero { padding: var(--fin-s-6); gap: var(--fin-s-4); }
.fin-home-stat.is-hero .fin-home-stat-ico { width: 40px; height: 40px; }
.fin-home-stat.is-hero .fin-home-stat-v { font-size: clamp(34px, 9vw, 48px); }
.fin-home-stat-spark { position: absolute; right: 0; bottom: 0; width: min(60%, 280px); height: 72px; color: var(--fin-ok); opacity: .5; pointer-events: none; }

/* Row (Net Cash Flow): label + hint on the left, value + chevron on the
   right, one line — the only card that isn't stacked top-to-bottom. */
.fin-home-stat.is-row .fin-home-stat-top { align-items: center; }
.fin-home-stat.is-row .fin-home-stat-v { margin-left: auto; font-size: var(--fin-fs-section); }
.fin-home-stat.is-row.is-ok .fin-home-stat-v { color: var(--fin-ok-ink); }

.fin-home-overview, .fin-home-bills { display: flex; flex-direction: column; gap: var(--fin-gap); }

/* Money In/Out and Payables/Invoiced stay side by side even at the 390px
   primary breakpoint (the reference mock pairs them at phone width; only
   Overdue — the one that needs the most attention — gets the full row to
   itself, both above and below this width). */
.fin-home-flow-row, .fin-home-bills-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--fin-gap); }
@media (max-width: 360px) {
  .fin-home-flow-row, .fin-home-bills-row { grid-template-columns: 1fr; }
}

/* Two panels side by side once there is room. */
.fin-home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--fin-gap); min-width: 0; }
@container finhome (min-width: 980px) {
  .fin-home-grid { grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); align-items: stretch; }
}

/* Shared list: rows are flat wells inside the panel. */
.fin-home-list { container: finhomelist / inline-size; display: flex; flex-direction: column; gap: var(--fin-s-2); min-width: 0; }
.fin-home-attn, .fin-home-rec, .fin-home-chk {
  appearance: none; display: grid; align-items: center; column-gap: var(--fin-s-3); row-gap: 2px;
  width: 100%; min-height: 60px; margin: 0; padding: var(--fin-s-2) var(--fin-s-3);
  border: 1px solid transparent; border-radius: var(--fin-r-sm);
  background: var(--fin-surface-2); box-shadow: inset 0 1px 0 var(--fin-kit-hl);
  color: var(--fin-text-1); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color var(--fin-t-fast) var(--fin-ease), border-color var(--fin-t-fast) var(--fin-ease);
}
div.fin-home-chk { cursor: default; }
.fin-home-attn:hover, .fin-home-rec:hover, a.fin-home-chk:hover { background: var(--fin-surface-hover); border-color: var(--fin-border); }
.fin-home-attn:focus-visible, .fin-home-rec:focus-visible, a.fin-home-chk:focus-visible { outline: 2px solid var(--fin-focus); outline-offset: 2px; }

/* Line one: semibold title + amount. Line two: muted text. */
.fin-home-attn-t, .fin-home-rec-t { min-width: 0; font-size: var(--fin-fs-body); font-weight: var(--fin-fw-semi); line-height: 1.35; color: var(--fin-text-1); }
.fin-home-attn-s, .fin-home-rec-s { min-width: 0; font-size: var(--fin-fs-meta); line-height: 1.35; color: var(--fin-text-3); }
.fin-home-amt, .fin-home-rec-a { font-size: var(--fin-fs-body); font-weight: var(--fin-fw-semi); line-height: 1.35; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--fin-text-1); text-align: right; }

/* To do row: toned 32px icon tile, title over a muted line, amount, chevron. */
.fin-home-attn {
  grid-template-columns: 32px minmax(0, 1fr) auto 16px;
  grid-template-areas: "i t a g" "i s a g";
  padding-left: var(--fin-s-2);
}
.fin-home-attn-ico {
  grid-area: i; display: grid; place-items: center; width: 32px; height: 32px;
  border-radius: var(--fin-r-xs); background: var(--fin-neutral-soft); color: var(--fin-neutral-ink);
}
.fin-home-attn.is-warn .fin-home-attn-ico { background: var(--fin-warn-soft); color: var(--fin-warn-ink); }
.fin-home-attn.is-crit .fin-home-attn-ico { background: var(--fin-crit-soft); color: var(--fin-crit-ink); }
.fin-home-attn.is-info .fin-home-attn-ico { background: var(--fin-info-soft); color: var(--fin-info-ink); }
.fin-home-attn-t { grid-area: t; align-self: end; overflow-wrap: anywhere; }
.fin-home-attn-s { grid-area: s; align-self: start; }
.fin-home-attn > .fin-home-amt { grid-area: a; }
.fin-home-go { color: var(--fin-text-3); }
.fin-home-attn > .fin-home-go { grid-area: g; }

/* Latest-invoice row: customer + amount, then number + date + status pill. */
.fin-home-rec {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "t a" "s p";
  padding-left: var(--fin-s-4);
}
.fin-home-rec-t { grid-area: t; align-self: end; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fin-home-rec-s { grid-area: s; align-self: center; display: flex; align-items: baseline; }
.fin-home-rec-s code { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--fin-font-mono); font-size: var(--fin-fs-micro); color: var(--fin-text-2); }
.fin-home-rec-due { flex: none; white-space: pre; }
.fin-home-rec-s code > .is-short { display: none; }
@container finhomelist (max-width: 419px) {
  /* A narrow row keeps the date text whole and shows the number's last two parts (full number in the tooltip). */
  .fin-home-rec-s code > .is-full { display: none; }
  .fin-home-rec-s code > .is-short { display: inline; }
}
.fin-home-rec-a { grid-area: a; align-self: end; }
.fin-home-rec-p { grid-area: p; justify-self: end; align-self: center; line-height: 0; }

/* Data check row: level pill + where (tab, cell), the message under it, an
   open-in-sheet arrow at the end. The message keeps two lines (full text in
   the tooltip). */
.fin-home-chk {
  grid-template-columns: auto minmax(0, 1fr) 16px;
  grid-template-areas: "p w g" "m m g";
  align-items: center; row-gap: var(--fin-s-1);
  padding: var(--fin-s-2) var(--fin-s-3) var(--fin-s-2) var(--fin-s-4);
}
.fin-home-chk-p { grid-area: p; line-height: 0; }
.fin-home-chk-w { grid-area: w; min-width: 0; overflow-wrap: anywhere; font-size: var(--fin-fs-meta); font-weight: var(--fin-fw-semi); color: var(--fin-text-2); }
.fin-home-chk-m {
  grid-area: m; min-width: 0; font-size: var(--fin-fs-meta); line-height: 1.45; color: var(--fin-text-3);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere;
}
.fin-home-chk > .fin-home-go { grid-area: g; }
/* Checks about several years / tabs: a headline, the whole message (both
   numbers, both rows) and one link per location. */
.fin-home-chk-h { font-weight: var(--fin-fw-semi); color: var(--fin-text-1); }
.fin-home-chk-wt { font-weight: var(--fin-fw-regular); }
.fin-home-chk-m.is-full { display: block; -webkit-line-clamp: none; overflow: visible; color: var(--fin-text-2); }
.fin-home-chk.has-locs { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "p w" "m m" "l l"; }
.fin-home-chk > .fin-home-chk-l { grid-area: l; }
.fin-home-more { align-self: flex-start; }

/* Phone rows: the chevron goes (the whole row is the button); title and amount keep one line. */
@container finhomelist (max-width: 399px) {
  .fin-home-attn { grid-template-columns: 32px minmax(0, 1fr) auto; grid-template-areas: "i t a" "i s s"; }
  .fin-home-attn > .fin-home-go { display: none; }
}

/* Month at a glance: 7-column day grid of the period's own range. */
.fin-home-cal { display: flex; flex-direction: column; gap: var(--fin-s-3); min-width: 0; }
.fin-home-cal-g { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--fin-s-1); min-width: 0; }
.fin-home-cal-w {
  padding-bottom: var(--fin-s-1); font-size: var(--fin-fs-micro); font-weight: var(--fin-fw-semi);
  letter-spacing: .04em; text-align: center; text-transform: uppercase; color: var(--fin-text-3);
}
.fin-home-cal-d {
  appearance: none; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  min-width: 0; height: 52px; margin: 0; padding: 6px 2px;
  border: 1px solid transparent; border-radius: var(--fin-r-xs);
  background: var(--fin-surface-2); box-shadow: inset 0 1px 0 var(--fin-kit-hl);
  color: var(--fin-text-2); font: inherit; cursor: pointer;
  transition: background-color var(--fin-t-fast) var(--fin-ease), border-color var(--fin-t-fast) var(--fin-ease);
}
.fin-home-cal-d.is-blank { background: transparent; box-shadow: none; cursor: default; }
.fin-home-cal-d:not(.is-blank):hover { background: var(--fin-surface-hover); border-color: var(--fin-border); }
.fin-home-cal-d:focus-visible { outline: 2px solid var(--fin-focus); outline-offset: 2px; }
.fin-home-cal-d.is-act { color: var(--fin-text-1); }
.fin-home-cal-d.is-future { opacity: .55; }
.fin-home-cal-d.is-today { border-color: var(--fin-accent-line); opacity: 1; }
.fin-home-cal-n { font-size: var(--fin-fs-meta); font-weight: var(--fin-fw-semi); line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fin-home-cal-n small { font-size: var(--fin-fs-micro); font-weight: var(--fin-fw-medium); color: var(--fin-text-3); }
.fin-home-cal-dots { display: flex; justify-content: center; gap: 3px; min-height: 8px; }
.fin-home-cal-dots .fin-chip-dot { width: 6px; height: 6px; }
.fin-home-cal-key { display: flex; flex-wrap: wrap; gap: var(--fin-s-2) var(--fin-s-4); font-size: var(--fin-fs-meta); color: var(--fin-text-3); }
.fin-home-cal-k { display: inline-flex; align-items: center; gap: var(--fin-s-2); white-space: nowrap; }
.fin-home-cal-sum { margin: 0; font-size: var(--fin-fs-meta); line-height: 1.45; color: var(--fin-text-3); }
.fin-home-cal-sum b { font-weight: var(--fin-fw-semi); color: var(--fin-text-1); font-variant-numeric: tabular-nums; white-space: nowrap; }
@container finhome (max-width: 520px) {
  /* Phones: single-letter weekdays, the month tag drops from the day number. */
  .fin-home-cal-w2 { display: none; }
  .fin-home-cal-d { height: 44px; padding: 5px 1px; }
  .fin-home-cal-n small { display: none; }
  /* Four keys as 2 by 2, never 3 + 1. */
  .fin-home-cal-key { display: grid; grid-template-columns: repeat(2, max-content); column-gap: var(--fin-s-5); }
}

/* Shared by every page (FinStaleNote in fin-home.jsx): "Couldn't reach the
   sheet" note. The reason reads quieter; on phones the button drops under
   the text instead of squeezing it. */
.fin-stale-note .fin-stale-why { color: var(--fin-text-2); }
@media (max-width: 560px) {
  .fin-stale-note { flex-wrap: wrap; }
  .fin-stale-note > .fin-alert-t { flex-basis: calc(100% - 30px); }
  .fin-stale-note > .fin-btn { margin: 0 0 0 calc(15px + var(--fin-s-2)); }
}

/* Shared: a month with no dated rows (FinNoRows). The sentence keeps a
   readable measure inside wide panels. */
.fin-norows .fin-empty-s { max-width: 520px; }
.fin-norows-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--fin-s-2); margin-top: var(--fin-s-2); }
/* Side-by-side form (compact, or not centred in a panel): the actions take
   the kit's button column, and drop under the text on narrower screens. */
.fin-panel .fin-empty.fin-norows:not(.is-center) > .fin-norows-acts, .fin-empty.fin-norows.is-compact > .fin-norows-acts {
  grid-column: 3; grid-row: 1 / span 2; align-self: center; justify-content: flex-end; flex-wrap: nowrap; margin: 0 0 0 var(--fin-s-1);
}
@media (max-width: 1100px) {
  .fin-panel .fin-empty.fin-norows:not(.is-center) > .fin-norows-acts, .fin-empty.fin-norows.is-compact > .fin-norows-acts {
    grid-column: 2; grid-row: auto; justify-content: flex-start; flex-wrap: wrap; margin: var(--fin-s-2) 0 0;
  }
}

/* Ask Jarvis: suggestion chips wrap their text on narrow screens. */
.fin-home-ask .fin-ask-suggest .fin-chip { max-width: 100%; }
@media (max-width: 768px) {
  .fin-home-ask .fin-ask-suggest .fin-chip { height: auto; min-height: 40px; padding-top: 6px; padding-bottom: 6px; white-space: normal; text-align: left; line-height: 1.3; }
}
