/* Navigation, and the phone layout (≤760 px): one type scale, one spacing scale, standard control and
   icon sizes. Loaded after styles.css and ui.css so it is the last word on these.
   Type: 26 page title · 19 card heading · 16 emphasis · 15 body · 13 secondary · 11.5 eyebrow (px).
   Space: 4 · 8 · 12 · 16 · 20 · 24 · 32. Touch targets ≥ 44 px. Icons 22 px (navigation), 20 px (inline). */

/* ── Navigation: icons and the active item, every size ── */
nav:not(.pt) button .nav-icon { display: grid; place-items: center; width: 24px; height: 24px; margin: 0; flex: none; }
nav:not(.pt) button .nav-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
nav:not(.pt) button .nav-label { display: inline; width: auto; margin: 0; font-size: inherit; }
/* Desktop sidebar: icon and label in a row, a mint marker on the active item. */
@media (min-width: 761px) {
  nav:not(.pt) button { display: flex; align-items: center; gap: 12px; position: relative; padding: 11px 14px; border-radius: 12px; font-size: 14px; }
  nav:not(.pt) button.active { background: #ffffff1f; font-weight: 700; }
  nav:not(.pt) button.active::before { content: ''; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--color-mint); }
}

@media (max-width: 760px) {
  /* ── Bottom bar: Material-style pill behind the active icon ── */
  nav:not(.pt) { padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; box-shadow: 0 -6px 20px #0B3F320d; }
  nav:not(.pt) button {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
    min-height: 60px; padding: 6px 2px 4px; background: none; border-radius: 0; color: var(--color-grey);
    font: 500 11.5px/1.2 var(--font-body); text-align: center;
  }
  nav:not(.pt) button.active { background: none; color: var(--color-brand); font-weight: 700; }
  nav:not(.pt) button .nav-icon { width: 60px; height: 32px; border-radius: 16px; transition: background-color .2s ease; }
  nav:not(.pt) button.active .nav-icon { background: var(--color-mint-soft); box-shadow: inset 0 0 0 1px #0B3F3214; }
  nav:not(.pt) button.active .nav-icon svg { stroke-width: 2.1; }
  nav:not(.pt) button:not(.active):hover .nav-icon { background: #0B3F320a; }
  nav:not(.pt) button:focus-visible { outline: none; }
  nav:not(.pt) button:focus-visible .nav-icon { outline: 2px solid var(--color-brand); outline-offset: 2px; }
  nav:not(.pt) button .nav-label { max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; }

  /* ── Page rhythm ── */
  body { font-size: 15px; line-height: 1.5; }
  main { padding: 20px 20px calc(104px + env(safe-area-inset-bottom)); }
  aside { padding: 16px 20px 4px; }
  #content > * + *, #content > section + section { margin-top: 16px; }
  .notice { font-size: 13px; line-height: 1.5; padding: 12px 14px; margin: 0 0 20px; }

  /* ── Type ── */
  h1 { font-size: 26px; line-height: 1.2; letter-spacing: -.01em; }
  main h2 { font-size: 19px; line-height: 1.3; margin-bottom: 8px; }
  main h3 { font-size: 16px; line-height: 1.35; }
  main p { font-size: 15px; line-height: 1.5; }
  main p.detail, main small, .row small, .privacy { font-size: 13px; line-height: 1.45; }
  main label, .ui-dialog-label { font-size: 14px; }
  .eyebrow, .badge { font-size: 11.5px; letter-spacing: .08em; }
  .status, .status-button { font-size: 12.5px; }
  .status { padding: 7px 12px; }
  .row { font-size: 15px; gap: 12px; padding-top: 14px; padding-bottom: 14px; }
  .value { font-size: 22px; line-height: 1.2; margin-top: 6px; }
  .space-card .value { font-size: 20px; }

  /* ── Transaction rows: title + amount on top, details below, action bottom right ── */
  .row:has(> .amount) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 3px; align-items: start; }
  .row:has(> .amount) > div { display: contents; }
  .row:has(> .amount) > div:first-child > strong {
    grid-column: 1; grid-row: 1; font-size: 15px; line-height: 1.35; overflow-wrap: normal; word-break: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .row:has(> .amount) > div:first-child > small { grid-column: 1; display: block; margin: 0; }
  .row:has(> .amount) > div:first-child > small:nth-of-type(1) { grid-column: 1 / -1; grid-row: 2; }
  .row:has(> .amount) > div:first-child > small:nth-of-type(2) { grid-row: 3; align-self: center; }
  .row:has(> .amount) > .amount > strong { grid-column: 2; grid-row: 1; white-space: nowrap; font-size: 15px; line-height: 1.35; text-align: right; }
  .row:has(> .amount) > .amount > button { grid-column: 2; grid-row: 3; justify-self: end; align-self: center; margin: 0 -12px 0 0; }

  /* ── Space chips wrap instead of scrolling off screen; filters stack label over field ── */
  :has(> [data-space]) { display: flex; flex-wrap: wrap; gap: 8px; overflow: visible; scrollbar-width: none; }
  .date-heading { display: block; }
  .date-heading > label { display: block; margin-bottom: 8px; }
  .date-heading > .ui-field { width: 100%; }

  /* ── Cards ── */
  .card, .assistant-card { padding: 18px; border-radius: 16px; }
  .stats { gap: 12px; }
  .hero { padding: 20px; }
  .avatar { width: 40px; height: 40px; font-size: 18px; flex: none; display: grid; place-items: center; }
  .moni-wave { font-size: 26px; }

  /* ── Buttons: one height, one text size; quiet ones a step smaller ── */
  main button:not(.pt *):not(.ui-field):not(.info-button):not(.status-button):not(.card):not(.meet-moni-button):not([data-space]):not(.chip),
  dialog button:not(.pt *):not(.pt-sheet *):not(.ui-field):not(.info-button):not(.quiet) {
    min-height: 44px; padding: 11px 18px; font-size: 15px; font-weight: 600; line-height: 1.25; border-radius: 12px;
  }
  main button.quiet, dialog button.quiet { min-height: 40px; padding: 8px 12px; font-size: 14px; font-weight: 600; }
  main [data-space] { min-height: 40px; padding: 8px 14px; font-size: 14px; font-weight: 600; border-radius: 20px; }
  .actions, .chips { gap: 10px; }
  .actions button, .chips button { margin: 0; }
  .meet-moni-button { font-size: 13px; padding: 10px 14px; }

  /* ── Help buttons: small icon, full-size touch area ── */
  .info-button { width: 26px !important; height: 26px !important; font-size: 13px; position: relative; }
  .info-button::after { content: ''; position: absolute; inset: -9px; }

  /* ── Forms ── */
  input:not([type="checkbox"]):not(.ui-native):not(.pt *), textarea:not(.pt *) { min-height: 48px; font-size: 16px; padding: 12px 14px; }
  form > label, form label + .ui-field, form label + input { margin-top: 8px; }
  form > label:not(:first-child) { margin-top: 16px; display: block; }

  /* ── Dialogs (Moni, set-up) ── */
  dialog { padding: 20px; border-radius: 20px; width: calc(100% - 24px); }
  .dialog-head { gap: 8px; margin-bottom: 12px; }
  .dialog-head > strong { flex: 1; }
  .dialog-head > button.quiet { margin-left: auto; }
  .bubble { font-size: 17px; line-height: 1.4; padding: 16px 18px; }
  .chips { display: flex; flex-wrap: wrap; }
  .chips button { flex: 1 1 calc(50% - 5px); }
}

/* ══ UI revamp (feature/ui-revamp): cards, buttons, headers, Home hierarchy, empty states, focus ══
   Look only. Navigation, tab and chip buttons keep their behaviour (no lift, shrink, shadow or gradient). */

/* Cards: one radius, one border, one soft shadow. Buttons that look like cards get none. */
.card:not(button), .assistant-card, .record-filters { box-shadow: var(--shadow-card); }
.card, .assistant-card, .record-filters { border-radius: var(--radius-card); }
.hero { border-radius: var(--radius-card); background: var(--color-mint-soft); border: 1px solid #0B3F3214; }
.hero h2 { font-size: var(--fs-xl); line-height: 1.25; margin: 4px 0 6px; color: var(--color-brand); }
.hero p { color: var(--color-dark); }

/* Headers: a clear page title, quiet supporting line. */
.greeting h2 { font-size: var(--fs-2xl); line-height: 1.2; letter-spacing: -.01em; font-weight: 800; color: var(--color-brand); }
.greeting p, .detail { color: var(--color-grey); }
.eyebrow, .badge { font-size: var(--fs-xs); font-weight: 700; color: var(--color-grey); }
.chip, .chips-row .chip { font-size: var(--fs-xs); }
main small, .row small { font-size: var(--fs-xs); }

/* Home hierarchy: the number you came for is the largest thing on the screen. */
.stats .card:last-child { padding: var(--space-5) var(--space-5) var(--space-6); border-radius: 24px; border: 0; background: var(--color-brand); color: var(--color-on-dark); box-shadow: 0 10px 28px #0B3F3238; }
.stats .card:last-child .value { font-size: 34px; line-height: 1.1; letter-spacing: -.02em; color: var(--color-on-dark); }
.stats .card:last-child small { color: var(--color-on-dark-muted); }
.stats .card:not(:last-child) .value { font-size: 22px; }
.space-card .value { letter-spacing: -.01em; }
.section-top { align-items: baseline; }
.section-top h2 { font-size: var(--fs-xl); margin: 0; }

/* Buttons: primary actions are 44px tall. Secondary is outlined, quiet is text. */
main .actions button, .ui-btn-primary { min-height: 44px; padding: 11px 18px; font-size: var(--fs-md); border-radius: var(--radius-button); }
button.secondary { color: var(--color-brand); background: var(--color-surface); border: 1px solid var(--color-line-strong); }
button.quiet { background: none; border: 0; box-shadow: none; color: var(--color-brand); }

/* Empty states: a calm centred block with room to breathe. */
.empty { display: grid; justify-items: center; gap: var(--space-2); padding: var(--space-6) var(--space-4); text-align: center; color: var(--color-grey); font-size: var(--fs-md); line-height: 1.5; }

/* Focus is always visible. On Deep surfaces the ring is Mint (the Deep ring would vanish there). */
a:focus-visible, summary:focus-visible, textarea:focus-visible, [tabindex]:not([tabindex="-1"]):focus-visible { outline: 3px solid var(--color-brand); outline-offset: 3px; }
aside :focus-visible, .stats .card:last-child :focus-visible, .update-ready :focus-visible, .ob-screen :focus-visible { outline-color: var(--color-mint); }
@media (min-width: 761px) { nav button:focus-visible { outline: 3px solid var(--color-mint); outline-offset: -3px; } }
html { scroll-padding-top: 16px; scroll-padding-bottom: 96px; } /* a focused control is never hidden behind the bottom bar */

@media (max-width: 760px) {
  /* Bottom bar, look only: 12px labels (nothing under 12px), a clear top edge. */
  nav:not(.pt) { border-top: 1px solid var(--color-line-strong); background: var(--color-surface); }
  nav:not(.pt) button { font-size: 12px; }
  nav:not(.pt) button.active { color: var(--color-brand); }
}

/* Form controls: the border is at least 3:1 against the surface (WCAG 1.4.11), so a field is findable without colour tricks. */
.ui-field, .ui-dialog-label .ui-input, input:not([type="checkbox"]):not([type="radio"]), textarea, select, .support-input { border-color: var(--color-control); }
input[type="checkbox"] { border-color: var(--color-control); }
.ui-field:hover { border-color: var(--color-brand); }
.value { font-weight: 750; }
.hero h2, .section-top h2, .greeting h2 { font-weight: 750; }
