/* To review. Layout only — shared tokens stay in styles.css. */

/* B3: compact chrome so the first card row is visible without scrolling. */
.today-page-header {
  margin-bottom: var(--space-1);
}

.today-page-header .page-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.today-headline {
  font-size: 15px;
  line-height: 1.25;
  margin: 0 0 4px;
  color: var(--muted);
  font-weight: var(--weight-semibold);
}

.today-note {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: var(--text-body);
}

.today-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
  margin: 0 0 6px;
}

.today-stats .stat-tile {
  min-width: 0;
  min-height: 0;
  padding: 4px 8px;
}

.today-stats .stat-label {
  margin: 0;
  font-size: var(--text-xs);
  line-height: 1.15;
}

.today-stats .stat-value {
  margin: 1px 0 0;
  font-size: 17px;
  line-height: 1.1;
}

button.stat-tile {
  font: inherit;
  color: inherit;
  width: 100%;
  cursor: pointer;
}

button.stat-tile[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
}

.today-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 6px;
}

.today-filters .field {
  flex: 1 1 160px;
  min-width: 0;
}

.today-filters .field-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.today-filter-more {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.today-filter-more[hidden] {
  display: flex;
}

.today-filter-toggle {
  display: none;
}

.today-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
  max-width: 100%;
}

.today-group {
  min-width: 0;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-3);
}

.today-group .today-group {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 0 var(--space-3);
  margin-top: var(--space-1);
}

.today-group-toggle,
.today-row-toggle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: var(--space-2) 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.today-group-head,
.today-row-line {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  min-width: 0;
}

.today-group-head .today-group-toggle {
  flex: 1 1 auto;
  min-width: 0;
}

.today-group-head .today-group-action {
  flex: 0 0 auto;
  align-self: center;
  min-height: var(--tap-min);
}

.today-group-select,
.today-row-select,
.today-bulk-select-all {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin: 0;
  align-self: center;
  accent-color: var(--navy);
}

.today-row-line .today-row-toggle {
  flex: 1 1 auto;
  min-width: 0;
}

.today-group-panel {
  padding: var(--space-2) 0 var(--space-3) calc(18px + var(--space-2));
  min-width: 0;
}

.today-group-toggle-company {
  font-weight: var(--weight-semibold);
}

.today-group-name,
.today-row-title {
  flex: 1 1 140px;
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The date, state word and age travel together so a phone can put the whole
   group on a second line without touching the desktop row (Y6 item 4). */
.today-row-meta {
  display: contents;
}

.today-group-count,
.today-group-total,
.today-row-amount,
.today-row-date,
.today-row-age {
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.today-group-total,
.today-row-amount {
  margin-left: auto;
  color: var(--ink);
  font-weight: var(--weight-semibold);
}

.today-row {
  border-top: 1px solid var(--row-line);
  min-width: 0;
}

/* The card a hub row or a count link named (rd L2): a quiet gold edge and
   ground, so the person can see which row the page opened for them. */
.today-row-handoff {
  background: var(--gold-soft);
  box-shadow: inset 3px 0 0 var(--gold);
  scroll-margin-top: 24px;
}

.today-row-body {
  padding: 0 0 var(--space-3);
  min-width: 0;
}

.today-row-body .queue-card {
  margin: 0;
}

.today-chevron {
  display: inline-flex;
  flex: 0 0 auto;
  transform: rotate(-90deg);
  transition: transform var(--motion-fast) var(--ease-out);
}

.today-chevron[data-open="true"] {
  transform: rotate(0deg);
}

.today-empty {
  margin: 0;
  padding: var(--space-4) 0;
  color: var(--muted);
}

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

@media (max-width: 640px) {
  .today-page-header .page-title {
    font-size: 20px;
  }

  .today-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .today-stats .stat-tile {
    padding: 4px 5px;
  }

  .today-stats .stat-label {
    font-size: 10px;
  }

  .today-stats .stat-value {
    font-size: 16px;
  }

  .today-filters {
    align-items: stretch;
    margin-bottom: 6px;
  }

  .today-filters .field {
    flex: 1 1 auto;
  }

  .today-filter-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap-min);
  }

  .today-filter-more {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-top: 4px;
  }

  .today-filter-more[hidden] {
    display: none;
  }

  /* M16 / Y6 item 4: the row header stays a header. The first line is
     chevron, title and the amount on the right; the date, state word and age
     sit on a second line inside the same control. Measured at 390px this
     keeps the whole header under ~90px and never scrolls sideways. */
  .today-row-toggle {
    flex-wrap: wrap;
    gap: 2px var(--space-2);
  }

  .today-row-title {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .today-row-amount {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .today-row-meta {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    overflow: hidden;
  }

  .today-row-meta > * {
    flex: 0 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* A group header never wraps its count and total onto a second line: the
     name gives way first, and the Accept-suggestions action drops to its own
     line instead of squeezing the count and total apart. */
  .today-group-head {
    flex-wrap: wrap;
  }

  .today-group-head .today-group-action {
    flex: 1 1 100%;
    margin-left: calc(18px + var(--space-2));
  }

  .today-group-name {
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .today-group-count,
  .today-group-total {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .today-group-total {
    margin-left: 0;
  }
}

/* Card face, account dropdown, and the booking button. */

.card-face {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
}

.card-happened,
.card-suggest,
.card-bank-suggestion,
.rule-preview,
.approve-hint {
  margin: 0;
}

/* The focused card heading is a heading, not a field. It wears the SAME two
   rings every other focused control wears (Y4 items in styles.css): the navy
   inner ring holds on the white card (~14:1 light, ~13:1 in dark where the
   inner ring is near-white) and the gold outer ring holds on the navy bar. An
   inset gold bar was ~2.3:1 on white and was the only indicator, which failed
   WCAG 1.4.11 (Y6 send-back round 1). The offset keeps the ring outside the
   text bounds, so it reads as "focus is here", not "type here". */
.today-row-body .question:focus,
.today-row-body .question:focus-visible {
  outline: 2px solid var(--focus-ring-outer);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--focus-ring);
}

/* "Make this a rule" and the sentence about what the rule covers are ONE
   control: the sentence sits under the checkbox label it explains (Y6 item 3). */
.rule-check-row.rule-check-with-preview {
  align-items: flex-start;
  flex-wrap: nowrap;
  white-space: normal;
}

.rule-check-with-preview .rule-check-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.rule-check-with-preview .rule-preview {
  color: var(--muted);
  font-size: var(--text-sm);
  white-space: normal;
}

/* Accept suggestions: one summary line per reason, the cards behind a
   disclosure (Y6 brief item 5). */
.bulk-accept [data-role="bulk-accept-excluded-summary"] {
  margin: 0 0 var(--space-1);
  color: var(--ink);
  font-size: var(--text-sm);
}

.bulk-accept [data-role="bulk-accept-excluded-summary"] p {
  margin: 0 0 2px;
}

.bulk-accept [data-role="bulk-accept-excluded"] summary {
  color: var(--muted);
  font-size: var(--text-sm);
  cursor: pointer;
}

.bulk-accept [data-role="bulk-accept-excluded"][hidden] {
  display: none;
}

.card-chip {
  align-self: flex-start;
  margin: 0;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--navy);
  font-size: var(--text-caption);
}

.card-chip[data-tone="waiting on the system"],
.card-chip[data-tone="waiting on the owner"] {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.chart-chooser-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
}

.chart-chooser-row .account-input,
.chart-chooser-row .location-input {
  flex: 1 1 auto;
  min-width: 0;
}

.chart-chooser-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  border: 1px solid var(--line);
  border-left: 0;
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}

.chart-chooser-count,
.chart-chooser-chosen,
.location-fixed-text {
  margin: 4px 0 0;
  color: var(--ink);
  font-size: var(--text-caption);
}

.chart-chooser-group {
  padding: 6px 12px 2px;
  color: var(--muted);
  font-size: var(--text-caption);
  cursor: default;
}

.location-fixed .location-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.fields label.rule-check-row,
.rule-check-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  white-space: nowrap;
}

.rule-check-row input[type="checkbox"],
.rule-check-row input[type="radio"] {
  flex: 0 0 auto;
  margin: 0;
}

.more-options {
  margin-top: 8px;
}

.btn-book-ready,
button.btn-primary.btn-book-ready {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

/* Q-c: select, answer in bulk, and see what was answered. */

.today-bulk {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--space-3);
  margin: 0 auto;
  transform: none;
  z-index: 30;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  width: min(1100px, calc(100vw - 32px));
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgb(0 0 0 / 18%);
}

.today-bulk[hidden] {
  display: none !important;
}

.today-bulk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

.today-bulk-select-all-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 0;
  font-size: var(--text-sm);
}

.today-bulk-count {
  color: var(--muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.today-bulk-controls {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.today-bulk-account {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 260px;
  min-width: 0;
}

.today-bulk-account .field-label {
  white-space: nowrap;
  font-size: var(--text-sm);
}

.today-bulk-account .field-input {
  width: 100%;
  min-width: 0;
}

.today-bulk-note {
  flex: 1 1 180px;
  margin: 0;
  color: var(--muted);
  font-size: var(--text-sm);
}

.today-bulk-progress {
  flex: 0 0 auto;
  margin: 0;
  color: var(--ink);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

.today-bulk-failures,
.today-bulk [data-role="bulk-confirm-host"] {
  flex: 1 1 100%;
  min-width: 0;
}

.today-bulk-failures h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-body);
}

.today-bulk-failure-list {
  margin: 0;
  padding-left: 18px;
}

.today-bulk-failure-list li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  margin: 0 0 var(--space-1);
}

.today-bulk-failure-list [data-role="bulk-failure-title"] {
  overflow-wrap: anywhere;
}

.today-bulk-failure-list [data-role="bulk-failure-reason"] {
  color: var(--muted);
  font-size: var(--text-sm);
}

.today-bulk [data-role="bulk-confirm-host"].open {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: var(--space-3);
  background: rgb(15 37 64 / 35%);
}

.today-bulk [data-role="bulk-confirm-host"].open .today-confirm {
  width: min(640px, 100%);
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow);
}

.today-confirm-account {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 var(--space-2);
}

.today-confirm {
  padding: var(--space-3);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: var(--gold-soft);
}

.today-confirm h3 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-body);
}

.today-confirm p {
  margin: 0 0 var(--space-2);
}

.today-confirm label {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.today-confirm textarea {
  width: 100%;
  min-height: 72px;
  font: inherit;
}

.today-answered {
  margin: var(--space-4) 0 0;
  padding: var(--space-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.today-answered-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}

.today-answered-body {
  padding: var(--space-2) 0 0;
}

.today-answered-body p {
  margin: 0 0 var(--space-2);
}

.today-answered-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.today-answered-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-2) 0;
  border-top: 1px solid var(--row-line);
}

.today-answered-row [data-role="answered-row-title"] {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.today-answered-row [data-role="answered-row-account"],
.today-answered-row [data-role="answered-row-when"] {
  color: var(--muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.today-more {
  margin: var(--space-4) 0 0;
  padding: var(--space-2) var(--space-3);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.today-more-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.today-more-body {
  padding: var(--space-2) 0 var(--space-3);
}

@media (max-width: 640px) {
  .today-bulk {
    left: var(--space-2);
    right: var(--space-2);
    bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom, 0px) + 6px);
    transform: none;
    width: auto;
    max-height: 120px;
    padding: 6px 8px;
    gap: 4px 8px;
    overflow: auto;
  }

  .today-bulk-row {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .today-bulk-controls {
    flex: 1 1 100%;
    gap: 4px;
  }

  .today-bulk-account {
    display: none;
  }

  .today-bulk-account .field-label {
    display: none;
  }

  .today-bulk-note {
    display: none;
  }

  .today-bulk-progress {
    flex: 1 1 100%;
  }
}

.stage.today-bulk-open {
  padding-bottom: 140px;
}

@media (min-width: 641px) {
  .stage.today-bulk-open {
    padding-bottom: 110px;
  }
}

.today-answered {
  margin: 0 0 4px;
  padding: 0 var(--space-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.today-answered-toggle {
  min-height: 36px;
  font-size: var(--text-sm);
}

/* G6: Dismissed. Same shape as Answered recently; the facts and the note
   stay readable at 390px with a 44px Reopen target and no sideways scroll. */
.today-dismissed {
  margin: 0 0 4px;
  padding: 0 var(--space-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.today-dismissed-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-align: left;
  cursor: pointer;
}

.today-dismissed-body {
  padding: var(--space-2) 0;
  min-width: 0;
}

.today-dismissed-body p {
  margin: 0 0 var(--space-2);
}

.today-dismissed-body p.today-dismissed-message {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.today-dismissed-body p.today-dismissed-message[hidden] {
  display: none;
}

.today-dismissed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

.today-dismissed-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
  padding: var(--space-2) 0;
  border-top: 1px solid var(--row-line);
}

.today-dismissed-main {
  flex: 1 1 200px;
  min-width: 0;
}

.today-dismissed-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px var(--space-2);
  min-width: 0;
}

.today-dismissed-row [data-role="dismissed-row-title"] {
  flex: 1 1 160px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.today-dismissed-row [data-role="dismissed-row-date"],
.today-dismissed-row [data-role="dismissed-row-company"],
.today-dismissed-row [data-role="dismissed-row-when"] {
  color: var(--muted);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

/* The amount is a fact of the dismissed row, never inherited from the title:
   the fallback title carries no money at all (Y6 brief item 2). */
.today-dismissed-row [data-role="dismissed-row-amount"] {
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  font-variant-numeric: tabular-nums;
}

.today-dismissed-note {
  margin: 2px 0 0;
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.today-dismissed-row [data-action="reopen-card"] {
  flex: 0 0 auto;
  min-height: var(--tap-min);
  margin-left: auto;
}

@media (max-width: 640px) {
  .today-dismissed-main {
    flex: 1 1 100%;
  }

  .today-dismissed-row [data-action="reopen-card"] {
    margin-left: 0;
  }
}
