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