/* =============================================================================
   Refera — today surface styles. Owned by the today surface agent.
   LAYOUT ONLY: reuse components from ../styles.css (the design-system API is
   documented at the top of that file). New shared components go in styles.css.

   Liquid Precision note: glass lives on the CHROME. This is the command view,
   so its surfaces are CONTENT and stay near-opaque (>= 4.5:1). What is added
   here is the *machined edge* language — a fine specular rim, concentric radii,
   float shadows and spring motion on the interactive tiles/pills — never a
   translucent fill that a number must be read through. All selectors are scoped
   under .today-* so nothing bleeds into other surfaces.
   ========================================================================== */

/* ---------------------------------------------------------------- view head */
.today-head { margin-bottom: 18px; }

/* On PC the explainer is a compact header action, not a third block pushing
   the working queue down the page. Mobile keeps the proven stacked layout. */
@media (min-width: 900px) {
  .today-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    column-gap: 24px;
    align-items: center;
    margin-bottom: 14px;
  }
  .today-head .view-title,
  .today-head .view-sub { grid-column: 1; }
  .today-head .today-tour-pill {
    grid-column: 2;
    grid-row: 1 / 3;
    margin-top: 0;
  }
}

/* "Watch how it works" — a quiet ghost pill with an ink play token: the same
   two voices as the site's hero actions (ink disc + hairline pill). Flat at
   rest; a 1px rise with a soft shadow on hover. */
.today-tour-pill {
  display: inline-flex; align-items: center; gap: 11px;
  margin-top: 16px; padding: 6px 18px 6px 7px;
  border: 1px solid var(--hair-dark); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink); cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.today-tour-pill:hover {
  border-color: var(--ink); transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(17, 24, 39, .06);
}
.today-tour-pill:hover .today-tour-play {
  transform: scale(1.05);
  box-shadow: 0 6px 18px rgba(17, 24, 39, .18);
}
.today-tour-pill:active { transform: translateY(1px); box-shadow: none; }
.today-tour-play {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%; color: var(--pill-fg);
  background: var(--pill-bg);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.today-tour-play svg { margin-left: 1.5px; }
.today-tour-text { display: inline-flex; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 600; }
.today-tour-dur { font-weight: 500; color: var(--ink3); }
.today-tour-dur::before { content: '·'; margin-right: 7px; color: var(--hair-dark); }

/* --------------------------------------------------------------- stat strip
   Icon-topped KPI tiles: a quiet line-glyph pinned to the top, the tabular
   figure and its label anchored to the bottom. The glyph gives each metric a
   scannable identity and turns the old dead space into an intentional command
   layout; a hover chevron reveals that every tile deep-links into its filtered
   Inbox view. Fill stays opaque white so figures keep ~16:1 contrast — the
   specular rim is the only "glass" here and it carries no text. */
.today-stats {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--r-card);
  box-shadow: var(--elev-1);
}
/* One caption line under the whole strip keeps all six metrics uniform. */
.today-stats-note { margin: 0 0 18px; }

.today-stats .stat {
  display: flex; flex-direction: column;
  min-height: 104px; padding: 13px 15px 14px;
  border: 0; border-left: 1px solid var(--hair); border-radius: 0;
  background: transparent; box-shadow: none;
}
.today-stats .stat:first-child { border-left: 0; }
/* top row: metric glyph (left) + reveal-on-hover "open" chevron (right) */
.today-stats .stat-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px; color: var(--ink3);
}
.today-stats .stat-ico { display: flex; }
.today-stats .stat-ico svg { width: 19px; height: 19px; }
.today-stats .stat-go {
  display: flex; color: var(--ink3); opacity: 0; transform: translateX(-4px);
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--spring);
}
.today-stats .stat-go svg { width: 16px; height: 16px; }
/* value + label anchored to the bottom of the tile */
.today-stats .stat-value { display: block; margin-top: auto; font-size: 27px; }
.today-stats .stat-label,
.today-stats .stat-note { display: block; }

.today-stats a.stat:hover {
  border-color: var(--hair);
  background: var(--paper);
  transform: none;
  box-shadow: none;
}
.today-stats a.stat:hover .stat-ico,
.today-stats a.stat:focus-visible .stat-ico { color: var(--teal); }
.today-stats a.stat:hover .stat-go,
.today-stats a.stat:focus-visible .stat-go {
  opacity: 1; transform: translateX(0); color: var(--teal);
}
.today-stats a.stat:active { background: var(--teal-wash); transform: none; box-shadow: none; }
.today-stats a.stat:focus-visible { outline-offset: -3px; border-radius: 3px; }

/* The primary metric spends the one accent in this rail. The shared surface
   and dividers keep it reading as one summary, not six dashboard cards. */
.today-stats .stat-hero .stat-ico,
.today-stats .stat-hero .stat-value { color: var(--teal); }

/* ---------------------------------------------------------------- lane heads
   The shared "worker" head for the three command cards. A machined teal-wash
   token carrying the lane's glyph sits beside the title/sub, so the front door,
   the week's intake and the sealed ledger read as one coordinated system rather
   than three unrelated boxes. */
.today-lane-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 12px; }
.today-lane-heading { min-width: 0; }
.today-lane-heading .card-title { margin-bottom: 2px; }
.today-lane-heading .card-sub { margin-bottom: 0; }
.today-lane-token {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: var(--r-input);
  background: var(--teal-wash); color: var(--teal);
  border: 1px solid var(--tone-teal-border);
}
.today-lane-token svg { width: 18px; height: 18px; }
/* the flush queue card pads its own head + empty state (title padding lived on
   the flush title, which is now nested inside the lane head) */
.card-flush .today-lane-head { padding: 16px 16px 0; }
.card-flush > .empty { padding: 4px 20px 20px; }
@media (prefers-reduced-motion: no-preference) {
  .today-lane-token { animation: today-seal-in 560ms var(--spring-in) both; transform-origin: center; }
}

/* main split: queue (wide) + week/custody column */
.today-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.today-cols > .stack { gap: 12px; }
.today-cols > .stack > .card:not(.card-flush) { padding: 16px; }

/* footer link inside the flush queue card needs its own side padding */
.card-flush .today-foot { padding: 11px 16px 14px; margin-top: 10px; }
.today-foot a { font-weight: 500; }

/* The working queue is the primary PC surface. Keep it table-dense while
   retaining the shared 44px mobile targets and every existing row action. */
.today-cols .queue-row { min-height: 52px; padding: 7px 16px; }

/* big-number line inside week/custody cards */
.today-week-line { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }

/* this-week channel split rows */
.today-ch-list { display: flex; flex-direction: column; gap: 6px; }
.today-ch { display: flex; align-items: center; gap: 10px; }
.today-ch .chip-channel { width: 108px; flex: none; border: 0; background: none; padding-left: 0; }
.today-ch-bar {
  flex: 1; height: 5px; border-radius: 3px; background: var(--hair);
  overflow: hidden;
}
.today-ch-fill {
  display: block; height: 100%; border-radius: 3px; background: var(--teal);
}
.today-ch-n { flex: none; min-width: 20px; text-align: right; font-size: 12px; color: var(--ink2); }

/* monthly intake micro-bars */
.today-bars { margin: 8px 0 6px; }
.today-bars svg { max-width: 100%; height: auto; }

/* ------------------------------------------------------- chain of custody
   The sealed-ledger card is the anchor "worker": it uses the shared lane head,
   but its token is the larger notched seal medallion (a genuine seal, not a
   function glyph), so the ledger reads as the heaviest of the three panels. */
.today-seal-medallion {
  flex: none; display: flex; align-items: center; justify-content: center;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--teal-wash);
  border: 1px solid var(--tone-teal-border);
}
@media (prefers-reduced-motion: no-preference) {
  .today-seal-medallion svg { animation: today-seal-in 620ms var(--spring-in) both; transform-origin: center; }
}
@keyframes today-seal-in { from { transform: scale(.7) rotate(-14deg); opacity: 0; } }

.today-verify-btn { gap: 8px; }
.today-verify-ico { display: flex; color: var(--teal); }

/* ------------------------------------------------------------ first-open rise
   A restrained staggered entrance for the command view. Disabled outright by
   the global prefers-reduced-motion rule in styles.css. */
@media (prefers-reduced-motion: no-preference) {
  .today-stats .stat { animation: today-rise 460ms var(--spring-in) both; }
  .today-stats .stat:nth-child(1) { animation-delay: 20ms; }
  .today-stats .stat:nth-child(2) { animation-delay: 55ms; }
  .today-stats .stat:nth-child(3) { animation-delay: 90ms; }
  .today-stats .stat:nth-child(4) { animation-delay: 125ms; }
  .today-stats .stat:nth-child(5) { animation-delay: 160ms; }
  .today-stats .stat:nth-child(6) { animation-delay: 195ms; }
  .today-cols > .card { animation: today-rise 500ms var(--spring-in) both; animation-delay: 180ms; }
  .today-cols .stack > .card:nth-child(1) { animation: today-rise 500ms var(--spring-in) both; animation-delay: 210ms; }
  .today-cols .stack > .card:nth-child(2) { animation: today-rise 500ms var(--spring-in) both; animation-delay: 250ms; }
}
@keyframes today-rise { from { transform: translateY(8px); } }

/* ------------------------------------------------------------------- 900px */
@media (max-width: 899px) {
  .today-cols { grid-template-columns: minmax(0, 1fr); }
  .today-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .today-stats .stat:nth-child(4) { border-left: 0; }
  .today-stats .stat:nth-child(n + 4) { border-top: 1px solid var(--hair); }
}

/* ------------------------------------------------------------------- 390px */
@media (max-width: 719px) {
  /* Compact metrics put the working queue back in the first viewport. */
  .today-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 8px; }
  .today-stats .stat {
    display: grid; grid-template-columns: auto minmax(0, 1fr);
    align-items: center; gap: 7px; min-height: 58px; padding: 7px 9px;
  }
  .today-stats .stat-top { display: none; }
  .today-stats .stat-value { margin: 0; font-size: 22px; line-height: 1; }
  .today-stats .stat-label { font-size: 11px; line-height: 1.18; }
  .today-stats-note { margin-bottom: 14px; font-size: 11.5px; line-height: 1.4; }
  .card-flush .today-foot { padding: 12px 16px 14px; }
  .card-flush .today-lane-head { padding: 16px 16px 0; }
  .today-tour-pill { margin-top: 14px; }
  .today-lane-token { width: 34px; height: 34px; }
  .today-lane-token svg { width: 18px; height: 18px; }
  .today-seal-medallion { width: 46px; height: 46px; }
  .today-cols .queue-row { min-height: 56px; padding: 9px 16px; }
}

@media (max-width: 350px) {
  .today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-stats .stat { min-height: 56px; }
  .today-stats .stat:nth-child(3),
  .today-stats .stat:nth-child(5) { border-left: 0; }
  .today-stats .stat:nth-child(4) { border-left: 1px solid var(--hair); }
  .today-stats .stat:nth-child(n + 3) { border-top: 1px solid var(--hair); }
}
