/* =============================================================================
   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); }

/* --------------------------------------------------------------- summary rail
   Four exact links read as one ruled summary, not four dashboard cards. The
   worklist immediately below remains the dominant operational surface. */
.today-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--r-input);
  box-shadow: none;
}
/* One caption line under the whole strip keeps the operational metrics uniform. */
.today-stats-note { margin: 0 0 12px; }

.today-stats .stat {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; gap: 8px;
  min-height: 66px; padding: 9px 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: none;
}
.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: 0; font-size: 22px; line-height: 1; }
.today-stats .stat-label,
.today-stats .stat-note { display: block; font-size: 11.5px; line-height: 1.2; }

.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 280ms var(--spring-in) both; transform-origin: center; }
}

/* The daily work stays dominant. Owners and administrators get one narrow,
   ruled practice overview beside it rather than a second field of cards. */
.today-owner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.today-primary-work { min-width: 0; }
.today-primary-work > [data-testid="today-attention"] {
  border-top: 3px solid var(--teal);
  border-radius: var(--r-card);
  overflow: hidden;
}
.today-owner-rail {
  min-width: 0;
  overflow: hidden;
  order: -1;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-top: 3px solid var(--teal);
  border-radius: var(--r-card);
}
.today-owner-rail-head { padding: 17px 16px 14px; }
.today-owner-rail-head .section-label {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.today-owner-title {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.2;
  letter-spacing: -.015em;
}
.today-owner-rail-head .hint { margin: 0; font-size: 12px; }
.today-owner-rail .today-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}
.today-owner-rail .today-stats .stat:nth-child(3) {
  border-left: 0;
  border-top: 1px solid var(--hair);
}
.today-owner-rail .today-stats .stat:nth-child(4) { border-top: 1px solid var(--hair); }
.today-owner-rail .today-stats-note {
  margin: 0;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--hair);
  font-size: 11.5px;
}
.today-owner-rail .free-usage-banner.fu-calm {
  margin: 0;
  padding: 11px 16px;
  border: 0;
  border-bottom: 1px solid var(--hair);
  border-radius: 0;
  box-shadow: none;
}
.today-owner-rail .today-value-ledger {
  margin: 0;
  padding: 15px 16px 16px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.today-owner-rail .today-card-heading { margin-bottom: 10px; }
.today-owner-rail .today-card-heading > a { min-height: 28px; font-size: 12px; }
.today-owner-rail .today-ledger-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.today-owner-rail .today-ledger-metric { padding-block: 10px; }
.today-owner-rail .today-value-ledger.is-compact {
  display: block;
  padding: 15px 16px 16px;
}
.today-owner-rail .today-value-ledger.is-compact .today-card-heading { margin-bottom: 10px; }
.today-owner-rail .today-value-ledger.is-compact .today-ledger-metric,
.today-owner-rail .today-value-ledger.is-compact .today-ledger-empty {
  padding: 10px 0 0;
  border-top: 1px solid var(--hair);
  border-left: 0;
}

.today-demo-shell { display: grid; gap: 14px; }
.today-demo-summary { min-width: 0; }
.today-demo-lower { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }

@media (min-width: 1180px) {
  .today-owner-layout {
    grid-template-columns: minmax(610px, 1.7fr) minmax(294px, .72fr);
    gap: 16px;
  }
  .today-owner-rail {
    position: sticky;
    top: calc(var(--command-top-h, 58px) + 16px);
    order: 0;
  }
  .today-demo-lower { grid-template-columns: minmax(560px, 1.45fr) minmax(280px, .72fr); }
}

/* ------------------------------------------------ operations command list */
.today-op-columns,
.today-op-row {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(132px, .46fr) minmax(168px, .58fr) 44px;
  column-gap: 14px;
  align-items: center;
}
.today-op-columns {
  min-height: 30px;
  padding: 4px 16px;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
  background: var(--bar);
  color: var(--ink3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .005em;
}
.today-op-columns span:last-child { text-align: right; }
.today-operations-list { list-style: none; margin: 0; padding: 0; }
.today-op-row {
  position: relative;
  min-height: 62px;
  padding: 7px 20px 7px 26px;
  border-bottom: 1px solid var(--hair);
  background: var(--surface);
}
.today-op-row::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 11px;
  width: 1px;
  background: var(--hair-dark);
}
.today-op-row::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 8px;
  width: 7px;
  height: 7px;
  margin-top: -3.5px;
  border: 1.5px solid var(--teal);
  border-radius: 50%;
  background: var(--surface);
}
.today-op-row:last-child { border-bottom: 0; }
.today-op-row:hover { background: var(--paper); }
.today-op-ref.queue-row {
  display: flex;
  min-width: 0;
  min-height: 44px;
  padding: 4px 0;
  border: 0;
  border-radius: 3px;
  flex-direction: column;
  justify-content: center;
  /* the base .queue-row grid centres its cells; in this column flex that
     centred every name and REF id - identity stays left-aligned (3-zone) */
  align-items: stretch;
  gap: 1px;
  color: var(--ink);
}
.today-op-ref.queue-row:hover { background: transparent; text-decoration: none; }
.today-op-ref.queue-row.is-unread:before { left: -10px; }
.today-op-ref .q-name,
.today-op-ref .q-line2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-op-owner {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--ink2);
  font-size: 12.5px;
}
.today-owner-ico { flex: none; color: var(--ink3); }
.today-owner-ico svg { width: 16px; height: 16px; }
.today-op-owner[data-owner-state="assigned"] .today-owner-ico { color: var(--teal); }
.today-owner-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-owner-select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 0 24px 0 7px;
  border: 1px solid var(--hair);
  border-radius: 3px;
  color: var(--ink2);
  background-color: var(--surface);
  font: inherit;
  font-size: 12px;
  text-overflow: ellipsis;
}
.today-owner-select:hover { border-color: var(--ink3); }
.today-owner-select:focus-visible { border-color: var(--teal); }
.today-owner-action {
  flex: none;
  min-height: 32px;
  padding: 4px 7px;
  margin: -4px -7px -4px 0;
  font-size: 12px;
}
.today-next-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}
.today-next-action:hover { color: var(--teal); text-decoration: none; }
.today-next-action.is-waiting { color: var(--ink2); }
.today-next-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-next-arrow { flex: none; color: var(--ink3); }
.today-next-arrow svg { width: 17px; height: 17px; }
.today-next-action:hover .today-next-arrow { color: var(--teal); transform: translateX(2px); }
.today-op-age { justify-self: end; color: var(--ink3); font-size: 12px; }
.today-owner-notice {
  margin: 0;
  padding: 9px 16px;
  border-top: 1px solid var(--hair);
  color: var(--ink2);
  background: var(--teal-wash);
  font-size: 12.5px;
}
.today-owner-notice.is-error { color: var(--red); background: var(--red-wash); }

/* ----------------------------------------------------- measured outcomes */
.today-card-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.today-card-heading .card-title { margin-bottom: 2px; }
.today-card-heading > a { flex: none; min-height: 32px; display: inline-flex; align-items: center; }
.today-ledger-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--hair);
}
.today-ledger-metric {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 12px 10px 10px 0;
  border-bottom: 1px solid var(--hair);
}
.today-ledger-metric:nth-child(even) { padding-left: 12px; border-left: 1px solid var(--hair); }
.today-ledger-metric dt { color: var(--ink2); font-size: 11.5px; }
.today-ledger-metric dd { order: -1; margin: 0; color: var(--ink); font-size: 22px; font-weight: 600; line-height: 1.2; }
.today-ledger-metric dd.today-ledger-note {
  order: 0;
  margin-top: 2px;
  color: var(--ink3);
  font-size: 11.5px;
  font-weight: 400;
  line-height: 1.45;
}
.today-ledger-empty { padding-top: 10px; border-top: 1px solid var(--hair); }

.today-value-ledger.is-compact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  border-radius: var(--r-input);
  box-shadow: none;
}
.today-value-ledger.is-compact .today-card-heading { margin: 0; }
.today-value-ledger.is-compact .today-card-heading .card-sub { margin: 0; }
.today-value-ledger.is-compact .today-ledger-grid { grid-template-columns: 1fr; }
.today-value-ledger.is-compact .today-ledger-metric {
  min-width: 132px;
  padding: 0 0 0 18px;
  border: 0;
  border-left: 1px solid var(--hair);
}
.today-value-ledger.is-compact .today-ledger-empty {
  margin: 0;
  padding: 0 0 0 18px;
  border-top: 0;
  border-left: 1px solid var(--hair);
}

.today-owner-layout .free-usage-banner.fu-calm,
.today-demo-shell .free-usage-banner.fu-calm {
  padding: 9px 14px;
  border-radius: var(--r-input);
  box-shadow: none;
}
.today-owner-layout .free-usage-banner.fu-calm .fu-main,
.today-demo-shell .free-usage-banner.fu-calm .fu-main { gap: 10px; }
.today-owner-layout .free-usage-banner.fu-calm .fu-headline,
.today-demo-shell .free-usage-banner.fu-calm .fu-headline { font-size: 12.5px; }
.today-owner-layout .free-usage-banner.fu-calm .fu-detail,
.today-demo-shell .free-usage-banner.fu-calm .fu-detail { margin-top: 1px; font-size: 11px; }
.today-owner-layout .free-usage-banner.fu-calm .fu-track,
.today-demo-shell .free-usage-banner.fu-calm .fu-track { height: 3px; margin-top: 7px; }

/* footer link inside the flush queue card needs its own side padding */
.card-flush .today-foot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 16px;
  padding: 11px 16px 14px; margin-top: 10px;
}
.today-foot a { font-weight: 500; }

@keyframes today-seal-in { from { transform: scale(.7) rotate(-14deg); opacity: 0; } }

/* ------------------------------------------------------------------- 900px */
@media (max-width: 899px) {
  .today-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ------------------------------------------------------------------- 390px */
@media (max-width: 719px) {
  /* Compact metrics put the working queue back in the first viewport. */
  .today-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 8px; }
  .today-stats .stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--hair); }
  .today-stats .stat:nth-child(4) { border-top: 1px solid var(--hair); }
  .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-op-columns { display: none; }
  .today-op-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    gap: 0 12px;
    min-height: 116px;
    padding: 8px 16px 8px 24px;
  }
  .today-op-ref.queue-row {
    grid-column: 1 / -1;
    min-height: 48px;
    padding: 3px 0;
  }
  .today-op-ref.queue-row.is-unread:before { left: -10px; }
  .today-op-owner { grid-column: 1; min-height: 44px; }
  .today-owner-action { min-height: 44px; padding: 8px; margin: -8px -8px -8px 0; }
  .today-owner-select { height: 44px; }
  .today-next-action { grid-column: 1; min-height: 44px; }
  .today-op-age { grid-column: 2; grid-row: 2 / 4; align-self: center; }
  .today-ledger-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .today-value-ledger.is-compact {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .today-value-ledger.is-compact .today-ledger-metric,
  .today-value-ledger.is-compact .today-ledger-empty {
    padding: 10px 0 0;
    border-top: 1px solid var(--hair);
    border-left: 0;
  }
  .today-owner-layout .free-usage-banner.fu-calm .fu-main,
  .today-demo-shell .free-usage-banner.fu-calm .fu-main {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 350px) {
  .today-stats .stat {
    min-height: 58px;
    padding-inline: 7px;
  }
  .today-stats .stat-value { font-size: 20px; }
  .today-stats .stat-label { font-size: 10px; }
}
