/* ==========================================================================
   Tradevane 今日概览 — the dashboard's first screen.

   One title, one rhythm. The block opens on the greeting header (greeting, the
   Beijing date, the single read time of the page and one line of today) with the
   7/30-day toggle on the right edge. The garden greeting, the 34px Beijing clock
   and the three metric cards that used to sit above the garden panels are gone,
   so #dashboardOverview is the only thing that names this page.

   Colour comes only from the tokens in theme.css: the brand green is the one
   accent, neutrals are the --tv-* scale, and the overdue / error states borrow
   the semantic danger tokens. No colour literal is declared in this file, so a
   retheme needs no edit on this page.

   Rhythm: 16px inside a group (KPI cards, the trend/stage row), 24px between
   groups (header, KPI row, charts row, attention card). The KPI value step is
   the one size this page adds to the shared type scale: 24px tabular, so the
   number leads its card while the label stays at the 13px floor.

   The two trend series stay inside the one accent: inbound messages are solid
   brand, scored inquiries are the same brand at 55% with a 1px outline, and the
   plot carries gridlines, the unit (条) and a value above every non-zero bar.
   The stage ladder is one measure with one fill: every track is visible even at
   zero, the stages that carry conversations come first, and the empty stages
   sit behind one expandable summary row instead of seven rows of "0 · 0.0%".

   Controls keep the conventions already defined for .button / .ghost / input in
   theme.css, so an overview control weighs the same as one in the mailbox:
     window toggle     30px --tv-control-h-sm, full radius, 3px brand ring
     row actions       whole row is the link, 30px hit area, ring on focus
     cards             radius-lg, surface, shadow-sm, 1px border
     focus             3px --tv-brand-ring halo on every control, because a
                       keyboard user must see where the focus is
   Nothing here goes below 13px. Every transition has a reduced-motion fallback
   at the end of the file.

   Sections: 01 shell and rhythm · 02 header · 03 error notice · 04 KPI row ·
             05 cards · 06 legend · 07 trend chart · 08 loading skeleton ·
             09 stage distribution · 10 today's list · 10b the follow-up views ·
             11 responsive · 12 reduced motion
   ========================================================================== */

/* ---- 01 shell and rhythm ------------------------------------------------ */
.dbo-root { display: flex; flex-direction: column; gap: var(--tv-s6); min-width: 0; color: var(--tv-text); --dbo-kpi-value: 24px; }

/* ---- 02 header ---------------------------------------------------------- */
.dbo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--tv-s4); flex-wrap: wrap; }
.dbo-head-copy { min-width: 0; }

/* Three classes on purpose: the shell styles `.view h2:first-of-type` at 22px and this
   single title wants the 20px step of the shared scale. */
.dbo-root .dbo-head .dbo-title { margin: 0 0 var(--tv-s1); color: var(--tv-text); font-size: var(--tv-fs-title); font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.dbo-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tv-s2); margin: 0 0 var(--tv-s1); color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.5; font-variant-numeric: tabular-nums; }
.dbo-date { color: var(--tv-text-2); font-weight: 500; }
.dbo-stamp { color: var(--tv-text-3); }
.dbo-summary { margin: 0; max-width: 100ch; color: var(--tv-text-2); font-size: var(--tv-fs-md); line-height: 1.6; }

.dbo-seg { display: inline-flex; align-items: center; gap: 2px; padding: 2px; border: 1px solid var(--tv-border); border-radius: var(--tv-radius-full); background: var(--tv-bg); flex: 0 0 auto; }
.dbo-seg-button { min-width: 64px; height: var(--tv-control-h-sm); padding: 0 var(--tv-s3); border: 1px solid transparent; border-radius: var(--tv-radius-full); background: none; color: var(--tv-text-2); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 600; line-height: 1; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.dbo-seg-button:hover { background: var(--tv-surface); color: var(--tv-text); }
.dbo-seg-button:active { background: var(--tv-brand-soft); color: var(--tv-brand-hover); }
.dbo-seg-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }
.dbo-seg-button[aria-pressed="true"] { border-color: var(--tv-border-strong); background: var(--tv-surface); color: var(--tv-brand); box-shadow: var(--tv-shadow-sm); }

/* ---- 03 error notice ---------------------------------------------------- */
.dbo-notice--error { display: flex; align-items: center; gap: var(--tv-s3); flex-wrap: wrap; padding: var(--tv-s3) var(--tv-s4); border: 1px solid var(--tv-danger-border); border-radius: var(--tv-radius); background: var(--tv-danger-bg); font-size: var(--tv-fs-md); line-height: 1.5; }
.dbo-notice-title { color: var(--tv-danger); font-weight: 600; }
.dbo-notice-text { color: var(--tv-text-2); }
.dbo-retry { margin-left: auto; height: var(--tv-control-h-sm); padding: 0 var(--tv-s4); border: 1px solid var(--tv-danger-border); border-radius: var(--tv-radius-sm); background: var(--tv-surface); color: var(--tv-danger); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 600; cursor: pointer; transition: background .12s ease, border-color .12s ease; }
.dbo-retry:hover { border-color: var(--tv-danger); background: var(--tv-danger-bg); }
.dbo-retry:active { background: var(--tv-danger-bg); }
.dbo-retry:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }

/* ---- 04 KPI row --------------------------------------------------------- */
.dbo-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--tv-s4); }
.dbo-kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: var(--tv-s3) var(--tv-s4); border: 1px solid var(--tv-border); border-radius: var(--tv-radius-lg); background: var(--tv-surface); box-shadow: var(--tv-shadow-sm); color: inherit; text-decoration: none; transition: background .12s ease, border-color .12s ease, box-shadow .12s ease; }
.dbo-kpi:hover { border-color: var(--tv-border-strong); background: var(--tv-surface-hover); }
.dbo-kpi:active { background: var(--tv-brand-soft); }
.dbo-kpi:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }
.dbo-kpi-label { color: var(--tv-text-2); font-size: var(--tv-fs-md); font-weight: 500; line-height: 1.4; }
.dbo-kpi-value { color: var(--tv-text); font-size: var(--dbo-kpi-value); font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.dbo-kpi-note { color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.4; }
/* The late count is information, not an alarm: 13px, medium weight, danger colour. */
.dbo-kpi-danger { color: var(--tv-danger); font-size: var(--tv-fs-md); font-weight: 500; }

/* ---- 05 cards ----------------------------------------------------------- */
.dbo-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--tv-s4); align-items: start; }
.dbo-card { display: flex; flex-direction: column; gap: var(--tv-s3); min-width: 0; padding: var(--tv-s4) var(--tv-s5); border: 1px solid var(--tv-border); border-radius: var(--tv-radius-lg); background: var(--tv-surface); box-shadow: var(--tv-shadow-sm); }
.dbo-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--tv-s3); flex-wrap: wrap; }
.dbo-card-head > div { min-width: 0; }
.dbo-card-heading { display: flex; align-items: center; flex-wrap: wrap; gap: var(--tv-s1) var(--tv-s4); min-width: 0; }
.dbo-card-title { margin: 0 0 2px; color: var(--tv-text); font-size: var(--tv-fs-lg); font-weight: 600; line-height: 1.35; }
.dbo-card-note { margin: 0; color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.5; font-variant-numeric: tabular-nums; }
.dbo-jump { display: inline-flex; align-items: center; height: var(--tv-control-h-sm); padding: 0 var(--tv-s2); border-radius: var(--tv-radius-sm); color: var(--tv-brand); font-size: var(--tv-fs-md); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .12s ease, color .12s ease; }
.dbo-jump:hover { background: var(--tv-brand-soft); color: var(--tv-brand-hover); }
.dbo-jump:active { color: var(--tv-brand-hover); }
.dbo-jump:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }

/* ---- 06 legend ---------------------------------------------------------- */
/* The legend sits with the card title, not alone in the far corner: a reader should not
   have to cross the whole card to find out what the two bars mean. */
.dbo-legend { display: flex; align-items: center; gap: var(--tv-s3); margin: 0; padding: 0; list-style: none; }
.dbo-legend-item { display: inline-flex; align-items: center; gap: var(--tv-s1); color: var(--tv-text-2); font-size: var(--tv-fs-md); font-weight: 500; }
.dbo-legend-item::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: var(--tv-radius-xs); background: var(--tv-brand); }
.dbo-legend-item--inquiry::before { opacity: .55; box-shadow: 0 0 0 1px var(--tv-brand); }

/* ---- 07 trend chart ----------------------------------------------------- */
.dbo-chart { min-width: 0; overflow-x: auto; }
.dbo-chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Thirty days keep a 40-unit day slot and scroll: 60 labeled bars squeezed into 700px
   would drop below the 13px floor and lose every value. */
.dbo-chart-svg[data-dbo-wide] { width: var(--dbo-chart-w); max-width: none; }
.dbo-grid-line { stroke: var(--tv-border-strong); stroke-width: 1; }
.dbo-axis { fill: var(--tv-text-3); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 500; font-variant-numeric: tabular-nums; }
.dbo-axis-unit { fill: var(--tv-text-3); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 600; }
.dbo-bar--in { fill: var(--tv-brand); }
.dbo-bar--in:hover { fill-opacity: .82; }
.dbo-bar--inquiry { fill: var(--tv-brand); fill-opacity: .55; stroke: var(--tv-brand); stroke-width: 1; }
.dbo-bar--inquiry:hover { fill-opacity: .8; }
.dbo-bar--zero { fill: var(--tv-border-strong); }
.dbo-bar-value { fill: var(--tv-text-2); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.dbo-chart-zero { fill: var(--tv-text-3); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 500; }

/* ---- 08 loading skeleton ------------------------------------------------ */
.dbo-chart-loading { display: flex; align-items: flex-end; gap: var(--tv-s2); height: 150px; padding: var(--tv-s2) 0; }
.dbo-skeleton { flex: 1 1 0; height: var(--dbo-h, 40%); min-width: 4px; border-radius: var(--tv-radius-sm); background: var(--tv-subtle); animation: dbo-pulse 1.4s ease-in-out infinite; }
@keyframes dbo-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

.dbo-quiet { margin: 0; color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.6; }

/* ---- 09 stage distribution ---------------------------------------------- */
.dbo-stages { display: flex; flex-direction: column; gap: var(--tv-s2); }
.dbo-stage-list { display: flex; flex-direction: column; gap: var(--tv-s2); margin: 0; padding: 0; list-style: none; }
/* The author `display` above would beat the browser's [hidden] rule, so hide it by hand:
   an expanded list is the only thing standing between this card and nine rows of zeros. */
.dbo-stage-list[hidden] { display: none; }
.dbo-stage { display: grid; grid-template-columns: 68px minmax(0, 1fr) 96px; align-items: center; gap: var(--tv-s2); font-size: var(--tv-fs-md); }
.dbo-stage-name { color: var(--tv-text-2); font-weight: 500; line-height: 1.4; }
/* Every track keeps a hairline outline, so a stage at zero is a visible empty rung and
   not a missing row. */
.dbo-stage-track { position: relative; height: 10px; overflow: hidden; border-radius: var(--tv-radius-full); background: var(--tv-subtle); box-shadow: inset 0 0 0 1px var(--tv-border); }
.dbo-stage-fill { display: block; height: 100%; border-radius: inherit; background: var(--tv-brand); transition: width .2s ease; }
.dbo-stage-count { color: var(--tv-text-2); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dbo-stage.is-zero .dbo-stage-name { color: var(--tv-text-3); font-weight: 500; }
.dbo-stage.is-zero .dbo-stage-count { color: var(--tv-text-3); font-weight: 500; }
.dbo-stage-more { display: flex; align-items: center; justify-content: space-between; gap: var(--tv-s2); width: 100%; min-height: var(--tv-control-h-sm); padding: 0 var(--tv-s2); border: 1px dashed var(--tv-border-strong); border-radius: var(--tv-radius-sm); background: none; color: var(--tv-text-3); font-family: var(--tv-font); font-size: var(--tv-fs-md); font-weight: 500; text-align: left; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.dbo-stage-more:hover { border-color: var(--tv-border-strong); background: var(--tv-surface-hover); color: var(--tv-text); }
.dbo-stage-more:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }
.dbo-stage-more-hint { color: var(--tv-brand); font-weight: 600; }

/* ---- 10 today's list ---------------------------------------------------- */
.dbo-rows { display: flex; flex-direction: column; }
.dbo-group { display: flex; flex-direction: column; min-width: 0; }
.dbo-group + .dbo-group { margin-top: var(--tv-s3); }
.dbo-group-title { display: flex; align-items: baseline; gap: var(--tv-s2); margin: 0 0 var(--tv-s1); color: var(--tv-text-3); font-size: var(--tv-fs-md); font-weight: 600; letter-spacing: .02em; }
/* The count is the group's own number, not a second badge: same muted step as the label. */
.dbo-group-count { color: var(--tv-text-3); font-weight: 600; font-variant-numeric: tabular-nums; }
/* One rule per row, one link per row: the row itself is the anchor and the bottom rule is
   what keeps two orders from reading as one block. */
.dbo-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tv-s1) var(--tv-s3); padding: var(--tv-s2); border-bottom: 1px solid var(--tv-border); border-radius: var(--tv-radius-sm); color: var(--tv-text-2); font-size: var(--tv-fs-md); text-decoration: none; transition: background .12s ease; }
.dbo-row:last-child { border-bottom: 0; }
.dbo-row:hover { background: var(--tv-surface-hover); }
.dbo-row:active { background: var(--tv-brand-soft); }
.dbo-row:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--tv-brand-ring); }
/* The type chip says which table a row came from. Both tones already exist in the token
   set: a follow-up borrows the brand tint, a task stays neutral, so colour ranks nothing. */
.dbo-chip { display: inline-flex; align-items: center; align-self: center; flex: 0 0 auto; height: 20px; padding: 0 var(--tv-s2); border: 1px solid var(--tv-border); border-radius: var(--tv-radius-full); background: var(--tv-subtle); color: var(--tv-text-2); font-size: var(--tv-fs-md); font-weight: 600; line-height: 1; white-space: nowrap; }
.dbo-chip--follow { border-color: transparent; background: var(--tv-brand-soft); color: var(--tv-brand); }
/* Money rows keep the same five columns; the chip is neutral so the amount, not the
   type, is what the eye lands on. */
.dbo-chip--order { border-color: transparent; background: var(--tv-subtle); color: var(--tv-text-2); }
.dbo-row-when { flex: 0 0 88px; color: var(--tv-text-3); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.dbo-row-when.is-late { color: var(--tv-danger); }
.dbo-row-title { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--tv-text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.dbo-row-meta { flex: 1 1 220px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbo-row-go { flex: 0 0 auto; margin-left: auto; color: var(--tv-brand); font-weight: 600; white-space: nowrap; }
/* The capped group says how many follow-ups it had to leave out, so a count of ten never
   reads as "only ten exist". */
.dbo-group-more { margin: var(--tv-s2) 0 0; color: var(--tv-text-3); font-size: var(--tv-fs-md); line-height: 1.6; }
/* The card's own empty state: one sentence and the next place to go. */
.dbo-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--tv-s2); }

/* ---- 10b the follow-up views -------------------------------------------- */
/* 即将跟进 and 全部客户 are the old 我的跟进 list, moved into this card: one more view of
   the same block, with its table, its empty state and its footer. The table keeps the same
   columns and the same one row action; only the type bottom follows this file's 13px floor
   instead of the old 11/12px steps. */
.dbo-follow { display: flex; flex-direction: column; gap: var(--tv-s3); min-width: 0; }
.follow-table-wrap { overflow: auto; max-height: 420px; border: 1px solid var(--tv-border); border-radius: var(--tv-radius); }
.follow-table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; }
.follow-table th { padding: var(--tv-s2); background: var(--tv-subtle); color: var(--tv-text-3); font-weight: 600; }
.follow-table td { padding: var(--tv-s3) var(--tv-s2); border-bottom: 1px solid var(--tv-border); color: var(--tv-text-2); vertical-align: middle; overflow-wrap: anywhere; }
.follow-table tbody tr:last-child td { border-bottom: 0; }
.follow-table th:first-child { width: 22%; }
.follow-table th:nth-child(2) { width: 30%; }
.follow-table th:last-child { width: 12%; }
.follow-table strong { color: var(--tv-text); font-weight: 600; }
.follow-table small { display: block; margin-top: var(--tv-s1); color: var(--tv-text-3); }
.follow-table a { color: var(--tv-brand); font-weight: 600; text-decoration: none; white-space: nowrap; }
.follow-table a:hover { text-decoration: underline; }
.follow-table tbody tr:hover { background: var(--tv-surface-hover); }
.follow-table .overdue { color: var(--tv-danger); }
/* The moved empty state keeps the shared .garden-empty shape, sized for a card instead of
   a panel that filled a whole grid column. */
.dbo-card--attention .garden-empty { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 0; padding: var(--tv-s7) var(--tv-s5); text-align: center; }
.dbo-card--attention .empty-plant { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: var(--tv-s1); border: 1px solid var(--tv-border); border-radius: var(--tv-radius-lg); background: var(--tv-subtle); color: var(--tv-text-3); }
.dbo-card--attention .empty-plant .ph { font-size: var(--tv-fs-title); }
.dbo-card--attention .garden-empty h4 { margin: var(--tv-s2) 0 0; color: var(--tv-text); font-weight: 600; }
.dbo-card--attention .garden-empty p { max-width: 46ch; margin: var(--tv-s1) 0 var(--tv-s4); color: var(--tv-text-3); }
.follow-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--tv-s3); padding-top: var(--tv-s3); border-top: 1px solid var(--tv-border); }
.follow-footer > span { color: var(--tv-text-3); }
/* The animated example the footer link opens: the same box the panel had. */
.contact-demo { margin-top: var(--tv-s2); padding: var(--tv-s4); border: 1px dashed var(--tv-border-strong); border-radius: var(--tv-radius); background: var(--tv-subtle); }
.demo-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--tv-s3); color: var(--tv-text-3); }
.demo-company { display: flex; align-items: center; gap: var(--tv-s4); margin-top: var(--tv-s3); }
.demo-company strong { font-weight: 600; }
.demo-company small { margin-left: var(--tv-s1); color: var(--tv-text-3); }
.demo-company p { min-height: var(--tv-s8); margin: var(--tv-s1) 0; color: var(--tv-text-2); }
.demo-dots { display: flex; justify-content: center; gap: var(--tv-s1); margin-top: var(--tv-s3); }
.demo-dots b { width: 15px; height: 4px; border-radius: var(--tv-radius-full); background: var(--tv-border-strong); transition: width .2s ease, background .2s ease; }
.demo-dots b.current { width: 28px; background: var(--tv-brand); }

/* ---- 11 responsive ------------------------------------------------------ */
@media (max-width: 900px) {
  .dbo-grid { grid-template-columns: minmax(0, 1fr); }
  .dbo-card { padding: var(--tv-s3) var(--tv-s4); }
}

@media (max-width: 600px) {
  .dbo-head { flex-direction: column; align-items: stretch; }
  .dbo-seg { align-self: flex-start; }
  .dbo-stage { grid-template-columns: 58px minmax(0, 1fr) 76px; }
  .dbo-row-when { flex-basis: 76px; }
}

/* ---- 12 reduced motion -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .dbo-root *,
  .dbo-root *::before,
  .dbo-root *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---- 01b the operator's rituals ------------------------------------------ */
/* The greeting, the daily line and the Beijing clock are not decoration: they are the
   first thing the operator reads every morning, so they stay at the top, large and
   unmistakable. Nothing here may push them below the fold. */
.dbo-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--tv-s5); }
.dbo-head-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.dbo-head-side { display: flex; flex-direction: column; align-items: flex-end; gap: var(--tv-s3); flex: 0 0 auto; }
.dbo-clock { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.dbo-clock-zone { font-size: var(--tv-fs-md); color: var(--tv-text-3); }
.dbo-clock-time { font-family: var(--tv-mono); font-size: var(--tv-fs-display); line-height: 1.25; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--tv-text); }
.dbo-clock-label { display: inline-flex; align-items: center; gap: 5px; }
.dbo-clock-label { font-size: var(--tv-fs-md); color: var(--tv-text-3); }
/* The daily line reads the way it always read: the sentence itself, one muted step below
   the greeting, with a small caption under it saying where it comes from. No pill, no badge
   in front of the sentence — that inverted the hierarchy and turned a sentence into a chip. */
.dbo-tip { margin: 0; max-width: 62ch; font-size: var(--tv-fs-body); line-height: 1.6; color: var(--tv-text-3); }
.dbo-tip-caption { display: inline-flex; align-items: center; gap: 6px; font-size: var(--tv-fs-md); color: var(--tv-text-3); }
.dbo-tip-caption .ph { color: var(--tv-brand); font-size: var(--tv-fs-lg); }
