/* Shared layout for full-page screens (Settings first; Home, Expenses
   and the rest will reuse it). Tokens only: no raw colours or sizes. */

.page {
  max-width: 48rem;
  margin: 0 auto;
  padding: var(--space-4) var(--space-4) var(--space-7);
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.page-header .wordmark { margin: 0; }
.back-link {
  color: var(--ink-soft);
  font-size: var(--text-sm);
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
}
.title-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
}
.title-row h1 { margin: 0; }

/* Glance / Breakdown / Details switch: a segmented control. */
.levels {
  display: inline-flex;
  background: var(--surface-panel);
  border-radius: var(--radius-pill);
  padding: var(--space-1);
}
.levels label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: calc(var(--tap-min) - 8px);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-regular);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-soft);
}
.levels input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  min-height: 0;
}
.levels label:has(input:checked) {
  background: var(--surface-card);
  box-shadow: var(--shadow-card);
  font-weight: var(--weight-medium);
}
.levels label:has(input:focus-visible) { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* Cards that fill the page width */
.card-wide {
  max-width: none;
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.glance-number {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-variant-numeric: var(--numbers);
  line-height: var(--leading-tight);
  margin-bottom: var(--space-2);
}
.glance p { margin: 0; }

/* Which parts each level shows */
body[data-level="glance"] #groups { display: none; }
body:not([data-level="details"]) .detail-only { display: none; }

/* One setting */
.setting-list { display: grid; }
.setting {
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line);
}
.setting:first-child { border-top: 0; padding-top: 0; }
.setting-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}
.setting-label { font-size: var(--text-sm); color: var(--ink-soft); }
.setting-value {
  font-size: var(--text-lg);
  font-variant-numeric: var(--numbers);
  overflow-wrap: anywhere;
}
.setting-value.empty { color: var(--ink-soft); font-size: var(--text-md); font-style: italic; }
.setting .help { margin: var(--space-2) 0 0; }
.setting .change { padding: 0 var(--space-2); flex-shrink: 0; }

.badge {
  display: inline-block;
  margin-top: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
}
.badge-info { background: var(--info-soft); color: var(--info-ink); }
.badge-info::before { content: "\23F2\FE0E  "; }   /* clock icon + words: colour is never the only signal */

.history {
  margin: var(--space-3) 0 0;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
}
.history li { margin-bottom: var(--space-1); }
.history-value { font-variant-numeric: var(--numbers); font-weight: var(--weight-medium); }
/* A value replaced by a same-day correction (#44): kept, but crossed out.
   The badge says it in words too, so colour is never the only signal. */
.history li.replaced .history-value { text-decoration: line-through; font-weight: var(--weight-regular, 400); }
.history li.replaced .badge { margin-left: var(--space-2); }

/* The change form, opened under a setting */
.change-form {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--surface-panel);
  border-radius: var(--radius-sm);
}
.change-form .field:last-of-type { margin-bottom: var(--space-3); }
select {
  font: inherit;
  font-size: var(--text-md);
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  color: var(--ink);
}
.preview { font-size: var(--text-sm); margin: 0 0 var(--space-3); }
.preview:empty { display: none; }
.preview[data-tone="info"]  { color: var(--info-ink); }
.preview[data-tone="error"] { color: var(--urgent-ink); }
.preview[data-tone="error"]::before { content: "\26A0\FE0E  "; }
.form-actions {
  display: flex;
  gap: var(--space-4);
  align-items: center;
}
.form-actions .button { width: auto; }

@media (max-width: 30rem) {
  .title-row { flex-direction: column; align-items: stretch; }
  .levels { justify-content: space-between; }
}

/* =====================================================================
   Expenses (Phase 1, slice 1c). Phone first: Alexia snaps and confirms
   receipts on her phone; the laptop gets the image beside the form.
   ===================================================================== */
.page-wide { max-width: 72rem; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; min-height: 0; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.button-quiet { background: var(--surface-panel); color: var(--ink); }
.button-quiet:hover { background: var(--accent-soft); }
.button-warning { background: var(--urgent); }
.button-warning:hover { background: var(--urgent-ink); }

/* Upload */
.upload-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-bottom: var(--space-3); }
.upload-button { cursor: pointer; }
input:focus-visible + .upload-button, .upload-card input:focus-visible { outline: 3px solid var(--focus-ring); }
.upload-buttons:has(+ #camera:focus-visible) .upload-button:first-child,
.upload-buttons:has(~ #file:focus-visible) .upload-button:last-child { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.upload-progress { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.upload-item {
  display: flex; justify-content: space-between; gap: var(--space-3); align-items: center;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); background: var(--surface-panel);
  font-size: var(--text-sm);
}
.upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-item[data-tone="ok"]    { background: var(--ok-soft); }
.upload-item[data-tone="ok"] .upload-status::before { content: "\2713  "; color: var(--ok-ink); }
.upload-item[data-tone="error"] { background: var(--urgent-soft); color: var(--urgent-ink); }
.upload-item[data-tone="error"] .upload-status { color: var(--urgent-ink); }
.upload-item[data-tone="error"] .upload-status::before { content: "\26A0\FE0E  "; }
.upload-item[data-tone="info"]  { background: var(--info-soft); }

/* Lists */
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3); }
.list-total { font-variant-numeric: var(--numbers); color: var(--ink-soft); }
.expense-list { list-style: none; margin: 0; padding: 0; }
.expense-row { border-top: 1px solid var(--line); }
.expense-row:first-child { border-top: 0; }
.expense-link {
  display: block; padding: var(--space-3) 0; color: inherit; text-decoration: none; min-height: var(--tap-min);
}
.expense-link:hover .expense-supplier { text-decoration: underline; }
.expense-main { display: flex; justify-content: space-between; gap: var(--space-3); }
.expense-supplier { font-weight: var(--weight-medium); overflow-wrap: anywhere; }
.expense-amount { font-variant-numeric: var(--numbers); white-space: nowrap; }
.status-void .expense-supplier, .status-void .expense-amount { text-decoration: line-through; color: var(--ink-soft); }
body[data-level="glance"] #lists { display: none; }

/* Tags: icon + word, never colour alone */
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
.tag {
  display: inline-block; padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
  font-size: var(--text-xs); background: var(--surface-panel); color: var(--ink-soft);
}
.tag:empty { display: none; }
.tag-attention { background: var(--attention-soft); color: var(--attention-ink); }
.tag-attention::before { content: "\25CF  "; color: var(--attention); }
.tag-info { background: var(--info-soft); color: var(--info-ink); }
.tag-info::before { content: "\2139\FE0E  "; }
.tag-ok { background: var(--ok-soft); color: var(--ok-ink); }
.tag-ok::before { content: "\2713  "; }
.tag-muted::before { content: "\2715  "; }

/* Messages that need a look (amber) */
.message[data-tone="attention"] { background: var(--attention-soft); color: var(--attention-ink); flex-wrap: wrap; }
.message[data-tone="attention"]::before { content: "\25CF  Check:"; font-weight: var(--weight-bold); color: var(--attention-ink); }
.message a { color: inherit; font-weight: var(--weight-medium); }

/* One receipt: image beside the form on a laptop, stacked on a phone */
.receipt-layout { display: grid; gap: var(--space-4); align-items: start; }
@media (min-width: 56rem) {
  .receipt-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .receipt-image { position: sticky; top: var(--space-4); }
}
.receipt-image, .receipt-form { margin-bottom: 0; }
.receipt-photo {
  display: block; width: 100%; max-height: 70vh; object-fit: contain; cursor: zoom-in;
  border-radius: var(--radius-sm); background: var(--surface-panel);
}
.receipt-photo.zoomed { max-height: none; cursor: zoom-out; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled select { background: var(--surface-panel); color: var(--ink); opacity: 1; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.field-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field input, .field select { width: 100%; }
.field input[inputmode="decimal"] { font-variant-numeric: var(--numbers); }
.check { display: flex; gap: var(--space-2); align-items: center; margin-bottom: var(--space-3); font-weight: var(--weight-regular); }
.check input { min-height: 0; width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }

/* The AI wasn't sure about this field: check it first */
.field.unsure input { border-color: var(--attention); border-width: 2px; }
.field.unsure > label::after { content: "  \25CF AI unsure, check it"; color: var(--attention-ink); font-weight: var(--weight-regular); }

.live-check { font-size: var(--text-sm); margin: 0 0 var(--space-4); }
.live-check:empty { display: none; }
.live-check[data-tone="ok"] { color: var(--ok-ink); }
.live-check[data-tone="ok"]::before { content: "\2713  "; }
.live-check[data-tone="attention"] { color: var(--attention-ink); }
.live-check[data-tone="attention"]::before { content: "\25CF  "; color: var(--attention); }

.gst-claim { background: var(--attention-soft); color: var(--attention-ink); border-radius: var(--radius-sm); padding: var(--space-3); margin-bottom: var(--space-4); font-size: var(--text-sm); }
.gst-claim:empty { display: none; }
.gst-claim p { margin: 0 0 var(--space-2); }
.gst-claim ul { margin: 0 0 var(--space-2); padding-left: var(--space-5); }
.blockers { margin: 0 0 var(--space-3); padding-left: var(--space-5); font-size: var(--text-sm); color: var(--ink-soft); }
.blockers:empty { display: none; }
.new-category, .void-panel {
  margin-top: var(--space-3); padding: var(--space-4); background: var(--surface-panel); border-radius: var(--radius-sm);
  display: grid; gap: var(--space-2);
}
.void-panel { margin-bottom: var(--space-4); }
.detail-raw { margin-top: var(--space-4); }
.detail-raw pre { font-size: var(--text-xs); overflow: auto; max-height: 24rem; background: var(--surface-panel); padding: var(--space-3); border-radius: var(--radius-sm); }
.form-actions { flex-wrap: wrap; }
@media (max-width: 30rem) {
  .field-row { gap: var(--space-2); }
  .form-actions #confirm { width: 100%; }
}
.title-row .tag { align-self: flex-start; }
/* Plain links inside screens use the brand ink (6.9:1 on white), not browser blue. */
:where(.page) a:not([class]) { color: var(--accent-hover); }

/* Import from Fresha (slice 3b) */
.check-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: grid; gap: var(--space-2); }
.check-list .live-check { margin: 0; }
.filter-question { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); display: grid; gap: var(--space-2); }
.filter-question legend { font-weight: var(--weight-bold); padding: 0 var(--space-2); }
.filter-question p { margin: 0; }
.filter-question label { display: flex; gap: var(--space-2); align-items: flex-start; }
#steps { margin-top: var(--space-3); }
#steps .upload-item { min-width: 0; }

/* Sales (slice 3c) */
.month-list, .mix-list { list-style: none; margin: 0; padding: 0; }
.month-row { border-top: 1px solid var(--line); padding: var(--space-3) 0; }
.month-row:first-child { border-top: 0; padding-top: 0; }
.month-row .live-check { margin: var(--space-2) 0 0; }
.mix-row { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) 0; border-top: 1px solid var(--line); }
.mix-row:first-child { border-top: 0; }
.mix-row > span:first-child { overflow-wrap: anywhere; }
#mix-card h3 { font-size: var(--text-md); margin: var(--space-4) 0 var(--space-2); }
.period-pick select { min-width: 12rem; }
.glance .live-check { font-size: var(--text-md); margin: 0 0 var(--space-2); }
.live-check[data-tone="info"] { color: var(--info-ink); }
.live-check[data-tone="info"]::before { content: "\2139\FE0E  "; }
div.expense-link { cursor: default; }
