/* Neo-brutalist redesign. Plain CSS, no build step (CLAUDE.md / REQUIREMENTS.md
   section 9). Hard borders, hard offset shadows, flat colours, no gradients,
   no blur except the two explicitly allowed glass elements. The review
   table, all forms and every figure a worker must verify stay FLAT: no
   tilt, no 3D, no animation on them. */
:root {
  --ink: #0D1330;
  --navy: #1E2A5E;
  --teal: #00A896; /* decorative and large numerals only, never small text or button fills */
  --primary: #007F73;
  --amber: #FFC233;
  --highlight: #FFF4C2;
  --highlight-border: #E0A800;
  --paper: #E8ECFF; /* page background, not pure white */
  --white: #FFFFFF; /* card surfaces */
  --muted: #38426E;
  --error: #B3261E;
  --error-bg: #FDECEA;

  --bd: 3px solid var(--ink);
  /* ONE shadow offset drives every hard shadow and every gap that has to clear one.
     Whatever follows a shadowed element needs at least offset + 8px of space. */
  --off: 6px;
  --off-sm: calc(var(--off) * 2 / 3);
  --gap: calc(var(--off) + 8px); /* between stacked cards, buttons, notes (large shadow) */
  --gap-sm: calc(var(--off-sm) + 8px); /* between small buttons and chips, and in rows */
  --ring: 7px; /* keyboard focus ring: 4px outline + 3px offset */
  --hard: var(--off) var(--off) 0 var(--ink);
  --hard-sm: var(--off-sm) var(--off-sm) 0 var(--ink);
  --hard-hover: calc(var(--off) + 2px) calc(var(--off) + 2px) 0 var(--ink);

  --display-latin: "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --display: var(--display-latin);
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;

  /* Type scale: 14 / 16 / 20 / 28 / 40 / 56 px */
  --fs-100: 0.875rem;
  --fs-200: 1rem;
  --fs-300: 1.25rem;
  --fs-400: 1.75rem;
  --fs-500: 2.5rem;
  --fs-600: 3.5rem;

  /* 8px spacing grid */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 2.5rem;

  --radius: 12px;
  --tap: 44px;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font);
  font-weight: 600;
  color: var(--ink);
  background: var(--paper);
  margin: 0;
  padding: 0 0 var(--space-4);
  line-height: 1.5;
  font-size: var(--fs-200);
  min-width: 0;
  overflow-x: hidden;
  overflow-wrap: anywhere; /* long words in any language wrap instead of clipping */
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 3px;
}

/* Screen headings and the landing headline take focus only through a
   programmatic focus() when a screen changes (tabindex="-1", so the
   keyboard never tabs onto them). That must never draw an outline, after a
   tap or otherwise. Real keyboard focus on buttons and inputs is unchanged. */
[tabindex="-1"]:focus,
[tabindex="-1"]:focus-visible {
  outline: none;
}

.app-header {
  padding: var(--space-2);
  border-bottom: var(--bd);
  background: var(--white);
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.app-header .auth-status {
  flex-basis: 100%;
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1);
  min-width: 0;
  max-width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  /* Reset button chrome: this is a real <button> for keyboard/SR access
     (item 1c, 14 Oct 2026) but must look exactly like the plain logo lockup
     it replaced, not a bordered/shadowed button. */
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  min-height: 0;
  cursor: pointer;
  text-align: left;
}
.brand:active { transform: none; box-shadow: none; }

.header-home-btn {
  flex: 0 0 auto;
}

.brand-mark {
  flex: 0 0 auto;
  display: block;
  width: 40px;
  height: 40px;
  border: var(--bd);
  border-radius: 10px;
  box-shadow: var(--hard-sm);
  background: var(--navy);
}

.brand-bar {
  transform-origin: bottom center;
  animation: brandBarRise 350ms ease-out both;
}
.brand-bar-1 { animation-delay: 0ms; }
.brand-bar-2 { animation-delay: 80ms; }
.brand-bar-3 { animation-delay: 160ms; }
.brand-bar-4 { animation-delay: 240ms; }

@keyframes brandBarRise {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

.app-header h1 {
  margin: 0;
  font-family: var(--display);
  font-size: var(--fs-300);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.auth-status {
  color: var(--muted);
  font-size: var(--fs-100);
  font-weight: 700;
  margin-top: var(--space-1);
}

main#app {
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-2);
}

.screen[hidden] { display: none; }

h2 {
  font-family: var(--display);
  font-size: var(--fs-400);
  font-weight: 900;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2);
  color: var(--ink);
}
h3 {
  font-family: var(--display);
  font-size: var(--fs-300);
  font-weight: 900;
  margin: var(--space-2) 0 var(--space-1);
  color: var(--ink);
}

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

.privacy-note {
  font-size: var(--fs-100);
  color: var(--muted);
  border-left: 4px solid var(--primary);
  padding-left: var(--space-2);
  margin-top: var(--space-2);
}

button {
  font: inherit;
  font-size: var(--fs-200);
  font-weight: 800;
  letter-spacing: -0.01em;
  min-height: var(--tap);
  min-width: 0;
  max-width: 100%; /* a long label (any language) wraps inside the button instead of overflowing or being clipped */
  flex-shrink: 0; /* in a flex row the button keeps its natural width up to max-width; rows that can run out of room wrap (.field-row, .deduction-row) */
  white-space: normal;
  overflow-wrap: anywhere;
  padding: var(--space-1) var(--space-2);
  border-radius: 8px;
  border: var(--bd);
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--hard-sm);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

button:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink);
}

/* Reconciliation panels (trip and weekly): 16px above the panel (from the
   "Add another trip" button) and 16px between its two stacked buttons, so
   the hard shadows never touch. */
#trip-reconciliation-gate,
#reconciliation-gate {
  margin-top: var(--space-2);
}
#trip-reconciliation-gate button,
#reconciliation-gate button {
  display: block;
}
#trip-reconciliation-gate button + button,
#reconciliation-gate button + button {
  margin-top: var(--space-2);
}

button.primary {
  background: var(--primary);
  color: #FFFFFF;
  border-color: var(--ink);
  width: 100%;
  box-shadow: var(--hard);
}
button.primary:active { box-shadow: 0 0 0 var(--ink); }

button.secondary {
  width: 100%;
  color: var(--ink);
  background: var(--white);
}

button.small {
  padding: 0.35rem var(--space-1);
  min-height: 36px;
  font-size: 0.8125rem; /* 13px: a bit smaller than fs-100, extra headroom at 320-360px */
  letter-spacing: -0.015em;
  box-shadow: var(--hard-sm);
}
button.small:active { box-shadow: 0 0 0 var(--ink); transform: translate(3px, 3px); }

.back-btn {
  display: inline-flex;
  margin-bottom: var(--space-2);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--hard-sm);
}

button.confirm-btn.is-confirmed {
  background: var(--teal);
  border-color: var(--ink);
  color: var(--ink);
}

input[type="text"],
input[type="number"],
input[type="date"],
textarea {
  font: inherit;
  font-size: var(--fs-200);
  width: 100%;
  min-height: 48px;
  padding: var(--space-1) 0.6rem;
  border: var(--bd);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

textarea { resize: vertical; }

.field {
  margin-bottom: var(--space-2);
}

.field label {
  display: block;
  font-size: var(--fs-100);
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.field-row {
  display: flex;
  flex-wrap: wrap; /* a long Confirm label drops below the input rather than squeezing it */
  align-items: stretch;
  gap: var(--space-1);
}

.field-row > input { flex: 1 1 7rem; min-width: 0; }

/* Cells that need checking: colour AND the visible "Confirm"/"Confirmed"
   label on the button (never colour alone). Flat -- no animation. */
.field.unconfirmed input {
  background: var(--highlight);
  border-color: var(--highlight-border);
}

.hint {
  font-size: var(--fs-100);
  color: var(--muted);
  font-weight: 600;
  margin-top: 0.2rem;
}

.banner {
  background: var(--highlight);
  border: var(--bd);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin-bottom: var(--space-2);
  font-weight: 800;
  color: var(--ink);
}

.error-banner {
  background: var(--error-bg);
  color: var(--error);
  border: var(--bd);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin-bottom: var(--space-2);
  font-weight: 700;
}

.card {
  border: var(--bd);
  border-radius: var(--radius);
  padding: var(--space-2);
  margin-bottom: var(--space-2);
  background: var(--white);
}

img.preview { /* trip-mode previews sit outside a .card, so no .card prefix */
  max-width: 100%;
  max-height: 40vh;
  width: auto;
  object-fit: contain;
  border-radius: var(--radius);
  border: var(--bd);
  display: block;
  margin: 0 auto var(--space-1);
  cursor: zoom-in;
}

.card .preview-hint {
  text-align: center;
  font-size: var(--fs-100);
  color: var(--muted);
  margin: -0.4rem 0 var(--space-1);
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(13, 19, 48, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 70;
  padding: var(--space-2);
  cursor: zoom-out;
}

.lightbox[hidden] { display: none; }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* ---------------------------------------------------------------------
   Chunky step indicator: Upload, Check, Costs, Results (item 2)
--------------------------------------------------------------------- */

.step-indicator {
  display: flex;
  align-items: center;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--space-2);
  gap: 0;
}

.step-indicator[hidden] { display: none; }

.step-dot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
  /* Reset button chrome: a completed step is a real tappable <button>
     (item 1b, 14 Oct 2026), but the dot/label pair below supplies all the
     visible styling -- the button itself must stay invisible. */
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  min-width: 0;
  min-height: 0;
  font: inherit;
}
.step-dot:active { transform: none; }
.step-dot:disabled {
  opacity: 1; /* current/future steps are dimmed via step-dot-num/-label colour, not global disabled opacity */
  cursor: default;
}
.step-dot:not(:disabled) { cursor: pointer; }
.step-dot.done:not(:disabled):hover .step-dot-num { box-shadow: var(--hard); }

.step-dot-num {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: var(--bd);
  background: var(--white);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-100);
  font-weight: 900;
  box-shadow: var(--hard-sm);
}

.step-dot.active .step-dot-num {
  background: var(--amber);
  border-color: var(--ink);
  color: var(--ink);
}

.step-dot.done .step-dot-num {
  background: var(--teal);
  border-color: var(--ink);
  color: var(--ink);
}

.step-dot-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  max-width: 3.6rem; /* four labels plus three lines must fit 320px in every language */
  text-align: center;
  line-height: 1.25;
}

.step-dot.active .step-dot-label { color: var(--ink); font-weight: 900; }

.step-line {
  flex: 1 1 auto;
  height: 4px;
  background: var(--white);
  border-top: var(--bd);
  border-bottom: var(--bd);
  position: relative;
  overflow: hidden;
  margin: 0 0.25rem;
  margin-bottom: 1.3rem;
}

.step-line-fill {
  position: absolute;
  inset: 0;
  background: var(--primary);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 250ms ease;
}

.step-line.filled .step-line-fill { transform: scaleX(1); }

/* ---------------------------------------------------------------------
   Bottom nav: one of the two elements allowed a glass treatment
   (item 7), with a solid fallback inside @supports.
--------------------------------------------------------------------- */

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-2);
  max-width: 560px;
  margin: 0 auto;
  position: sticky;
  bottom: 0;
  background: var(--white);
  border-top: var(--bd);
  z-index: 10;
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .app-nav {
    background: rgba(255, 255, 255, 0.75);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}

.app-nav[hidden] { display: none; }

.app-nav button {
  flex: 1 1 auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.app-nav button.active {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--ink);
}

.verified-badge {
  display: inline-block;
  background: var(--teal);
  border: var(--bd);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.3rem var(--space-2);
  font-size: var(--fs-100);
  font-weight: 800;
  margin-bottom: var(--space-1);
}

@supports (backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px)) {
  .verified-badge {
    background: rgba(0, 168, 150, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
}

.suggestion-chip {
  display: inline-block;
  margin: 0 0.4rem 0.4rem 0;
  font-size: var(--fs-100);
}

/* ---------------------------------------------------------------------
   Results: navy hero card + two side-by-side rate cards (item 3)
--------------------------------------------------------------------- */

.results-hero {
  background: var(--navy);
  color: #FFFFFF;
  border: var(--bd);
  border-radius: var(--radius);
  box-shadow: var(--hard);
  padding: var(--space-3) var(--space-2);
  text-align: center;
  margin-bottom: var(--space-3);
}

.net-earnings-label {
  font-size: var(--fs-100);
  font-weight: 700;
  color: #D4DAFF;
  margin: 0 0 0.25rem;
}

.net-earnings-value {
  font-family: var(--display);
  font-size: clamp(2rem, 11.5vw, var(--fs-600)); /* the figure never outgrows the card at 320px */
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #FFFFFF;
  margin: 0;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

.rate-cards {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

@media (max-width: 480px) {
  .rate-cards { flex-direction: column; }
}

.rate-card {
  flex: 1 1 0;
  text-align: center;
  padding: var(--space-2);
}

.rate-card-value {
  font-family: var(--display);
  font-size: var(--fs-400);
  font-weight: 900;
  color: var(--ink);
  margin: 0 0 0.2rem;
  font-variant-numeric: tabular-nums;
}

.rate-card-label {
  font-size: var(--fs-100);
  font-weight: 700;
  color: var(--muted);
  margin: 0;
}

.rate-card-note {
  font-size: var(--fs-100);
  font-weight: 600;
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.why-differ {
  text-align: center;
}

.results-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-1) 0;
  border-bottom: 2px solid var(--ink);
}

.results-row .label { color: var(--muted); font-weight: 700; flex: 1 1 10rem; min-width: 0; }
.results-row .value {
  font-weight: 900;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.readonly-note {
  font-size: var(--fs-100);
  color: var(--muted);
}

.deduction-row,
.line-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  align-items: flex-end;
  margin-bottom: var(--space-1);
}

.deduction-row .field,
.line-row .field {
  flex: 1 1 6rem;
  min-width: 0; /* the two text/amount fields shrink at 320-360px; the Remove button (global button rule) does not */
  margin-bottom: 0;
}

.deduction-row .field input,
.line-row .field input {
  min-width: 0;
}

.toast {
  position: fixed;
  left: var(--space-2);
  right: var(--space-2);
  bottom: var(--space-2);
  background: var(--ink);
  color: #fff;
  border: var(--bd);
  box-shadow: var(--off-sm) var(--off-sm) 0 var(--amber);
  padding: var(--space-2);
  border-radius: 8px;
  font-size: var(--fs-100);
  font-weight: 700;
  z-index: 50;
}

.toast[hidden] { display: none; }

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(232, 236, 255, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-weight: 800;
  z-index: 60;
}

.loading-overlay[hidden] { display: none; }

/* Loading state: mini bar-logo, bars rise and fall in turn (item 6),
   CSS only -- distinct from the review table, which never animates. */
.loading-bars {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 36px;
}
.loading-bars span {
  display: block;
  width: 10px;
  background: var(--teal);
  border: 2px solid var(--ink);
  border-radius: 2px;
  animation: loadingBarBounce 900ms ease-in-out infinite;
}
.loading-bars span:nth-child(1) { height: 14px; animation-delay: 0ms; }
.loading-bars span:nth-child(2) { height: 24px; animation-delay: 120ms; }
.loading-bars span:nth-child(3) { height: 34px; animation-delay: 240ms; }
.loading-bars span:nth-child(4) { height: 20px; animation-delay: 360ms; }

@keyframes loadingBarBounce {
  0%, 100% { transform: scaleY(0.6); }
  50% { transform: scaleY(1); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-bars span { animation: none; transform: scaleY(1); }
}

.rejected-list {
  margin: 0 0 var(--space-2);
  padding-left: 1.1rem;
}

.error-line {
  position: fixed;
  left: var(--space-2);
  right: var(--space-2);
  bottom: 4.5rem;
  background: var(--error-bg);
  color: var(--error);
  border: var(--bd);
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
  font-size: var(--fs-100);
  font-family: ui-monospace, "Courier New", monospace;
  z-index: 55;
  cursor: pointer;
}

.error-line[hidden] { display: none; }

.version-stamp {
  /* Hidden from the visible UI (owner's call, 14 Oct 2026) -- still set in
     the DOM via frontend/version.js, so it's there to check in devtools
     (Elements panel / "Inspect") without being shown to a visitor or judge. */
  display: none;
}

.sample-card h4 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: var(--fs-200);
  font-weight: 900;
  color: var(--ink);
}

.sample-card p {
  margin: 0 0 var(--space-1);
  font-size: var(--fs-100);
  color: var(--muted);
  font-weight: 600;
}

.date-human {
  display: block;
  font-size: var(--fs-100);
  color: var(--muted);
  margin-top: 0.2rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

label.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-1) var(--space-2);
  border-radius: 8px;
  border: var(--bd);
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  box-shadow: var(--hard-sm);
  transition: transform 150ms ease, box-shadow 150ms ease;
  margin-bottom: var(--space-2);
}
label.upload-btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--ink); }

/* ---------------------------------------------------------------------
   First screen: hero card with the static isometric bar chart (item 5)
--------------------------------------------------------------------- */

.landing-hero {
  background: var(--navy);
  border: var(--bd);
  border-radius: var(--radius);
  box-shadow: var(--hard);
  padding: var(--space-3) var(--space-2) var(--space-2);
  margin-bottom: var(--space-3);
  color: #FFFFFF;
}

.landing-hero svg { display: block; width: 100%; height: auto; }

.landing-headline {
  font-family: var(--display);
  font-size: var(--fs-400);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: var(--space-2) 0 var(--space-1);
  color: #FFFFFF;
}

.landing-subhead {
  color: #D4DAFF;
  font-weight: 700;
  font-size: var(--fs-200);
  margin-bottom: 0;
}

.how-it-works {
  display: grid;
  gap: var(--space-1);
  margin: var(--space-2) 0;
  padding: 0;
  list-style: none;
}

.how-it-works li {
  display: flex;
  gap: var(--space-1);
  align-items: baseline;
  font-weight: 700;
  font-size: var(--fs-100);
  color: var(--ink);
}

.how-it-works li::before {
  content: attr(data-step);
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--amber);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 900;
}

/* ---------------------------------------------------------------------
   Floating cards: layered hard shadows, resting tilt, hover lift
   (item 3/6). Never applied to the review table, forms or plain numbers.
--------------------------------------------------------------------- */

.tilt-card {
  box-shadow: var(--hard);
  transform: perspective(900px) rotateX(2deg) rotateY(-2deg);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .tilt-card:hover {
    transform: perspective(900px) translateY(-4px) rotateX(0deg) rotateY(0deg);
    box-shadow: var(--hard-hover);
  }
}

@media (hover: none) {
  .tilt-card:active { transform: perspective(900px) scale(0.98); }
}

/* General button hover lift (pointer devices only) -- deliberately scoped
   away from the review table and the costs/review forms (#screen-review,
   #screen-costs) and from .confirm-btn, so nothing a worker must verify
   ever animates. Everywhere else (landing, results, ask, evidence,
   navigation) gets the same lift-and-bigger-shadow feedback as the tilt
   cards. */
@media (hover: hover) and (pointer: fine) {
  #screen-landing button:not(.confirm-btn):hover,
  #screen-rejected button:hover,
  #screen-results button:not(.confirm-btn):hover,
  #screen-ask button:not(.confirm-btn):hover,
  #screen-evidence button:not(.confirm-btn):hover,
  .app-nav button:hover,
  label.upload-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: var(--hard-hover);
  }
  #screen-landing button.small:hover {
    box-shadow: var(--hard);
  }
}

/* ---------------------------------------------------------------------
   Motion: transform/opacity only, each under 700ms, nothing looping.
   Disabled under prefers-reduced-motion -- final values appear at once.
   Never applied to the review table, error messages or refusal screens.
--------------------------------------------------------------------- */

.fade-slide-in {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeSlideIn 300ms ease-out both;
  animation-delay: calc(var(--stagger-index, 0) * 80ms);
}

@keyframes fadeSlideIn {
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
   Opening splash (item 4)
--------------------------------------------------------------------- */

#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 350ms ease-in;
}

#splash.splash-hide { transform: translateY(-100%); }
#splash[hidden] { display: none; }

#splash .stage {
  width: min(94vw, 440px);
  background: var(--navy);
  border: var(--bd);
  box-shadow: var(--hard);
  padding: var(--space-1);
}

#splash svg { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) {
  .fade-slide-in,
  .brand-bar {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
  .tilt-card {
    transition: none !important;
    transform: none !important;
  }
  button, .step-line-fill, #splash, .money-chart-bar {
    transition: none !important;
  }
}

/* ---------------------------------------------------------------------
   "Where your money went" bar chart (item 2, 14 Oct 2026): flat, inline
   SVG, bar length is only a visual scaling of the API's own ₹ figures --
   no numbers are computed here.
--------------------------------------------------------------------- */

.money-chart { margin-top: var(--space-3); }

.money-chart-row + .money-chart-row { margin-top: var(--space-2); }

.money-chart-label-line {
  display: flex;
  justify-content: space-between;
  gap: var(--space-1);
  font-size: var(--fs-100);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.money-chart-label { color: var(--muted); min-width: 0; }
.money-chart-value { color: var(--ink); font-weight: 900; flex: 0 0 auto; }

.money-chart-svg {
  display: block;
  width: 100%;
  height: 22px;
  overflow: visible;
}

.money-chart-track { fill: var(--paper); stroke: var(--ink); stroke-width: 3; }

.money-chart-bar {
  stroke: var(--ink);
  stroke-width: 3;
  transform: scaleX(0);
  transform-origin: 0 0;
  transition: transform 400ms ease-out;
}
.money-chart-bar.grow { transform: scaleX(1); }

.money-chart-bar-gross { fill: #8FA3F7; } /* light blue: distinct from the ink frame and the navy hero card */
.money-chart-bar-deductions { fill: var(--error); }
.money-chart-bar-costs { fill: var(--amber); }
.money-chart-bar-net { fill: var(--primary); }

/* ---------------------------------------------------------------------
   Language selector (stage 1, language setting)
--------------------------------------------------------------------- */

.lang-select,
select,
option {
  font-family: var(--font);
}

.lang-select {
  font-size: var(--fs-100);
  font-weight: 700;
  min-height: 36px;
  max-width: 100%;
  padding: 0.25rem var(--space-1);
  border: var(--bd);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  box-shadow: var(--hard-sm);
}

/* ---------------------------------------------------------------------
   Voice input on Ask
--------------------------------------------------------------------- */

.voice-row {
  display: flex;
  gap: var(--space-1);
  align-items: flex-start;
}

.voice-row > textarea {
  flex: 1 1 auto;
  min-width: 0;
}

.mic-btn {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  min-width: 48px;
  padding: 0;
  display: grid;
  place-items: center;
}

.mic-btn[hidden] { display: none; }

.mic-btn.listening {
  background: var(--amber);
  animation: micPulse 1.3s ease-out infinite;
}

@keyframes micPulse {
  0% { box-shadow: var(--hard-sm), 0 0 0 0 rgba(255, 194, 51, 0.9); }
  100% { box-shadow: var(--hard-sm), 0 0 0 16px rgba(255, 194, 51, 0); }
}

.voice-status {
  margin: var(--space-1) 0 0;
  font-size: var(--fs-100);
  font-weight: 800;
  color: var(--ink);
}

.voice-status.error-banner { margin-bottom: 0; }

.voice-check {
  margin: var(--space-1) 0 0;
  padding: var(--space-1) var(--space-2);
  font-size: var(--fs-100);
}

@media (prefers-reduced-motion: reduce) {
  .mic-btn.listening { animation: none; }
}

/* ---------------------------------------------------------------------
   Scripts: each Indic script gets its own system font stack. The heavy
   Latin display font stays first in --display, so it is used only for
   Latin letters, digits and the rupee sign; Indic text falls through to
   the script's own font. Negative letter-spacing breaks conjuncts in
   these scripts, so it is switched off, and line height is raised for
   their taller marks.
--------------------------------------------------------------------- */

:lang(hi) {
  --font: "Noto Sans Devanagari", "Nirmala UI", "Mangal", system-ui, sans-serif;
  --display: var(--display-latin), "Noto Sans Devanagari", "Nirmala UI", "Mangal", system-ui, sans-serif;
}
:lang(ta) {
  --font: "Noto Sans Tamil", "Nirmala UI", "Latha", system-ui, sans-serif;
  --display: var(--display-latin), "Noto Sans Tamil", "Nirmala UI", "Latha", system-ui, sans-serif;
}
:lang(te) {
  --font: "Noto Sans Telugu", "Nirmala UI", "Gautami", system-ui, sans-serif;
  --display: var(--display-latin), "Noto Sans Telugu", "Nirmala UI", "Gautami", system-ui, sans-serif;
}
:lang(kn) {
  --font: "Noto Sans Kannada", "Nirmala UI", "Tunga", system-ui, sans-serif;
  --display: var(--display-latin), "Noto Sans Kannada", "Nirmala UI", "Tunga", system-ui, sans-serif;
}
:lang(ml) {
  --font: "Noto Sans Malayalam", "Nirmala UI", "Kartika", system-ui, sans-serif;
  --display: var(--display-latin), "Noto Sans Malayalam", "Nirmala UI", "Kartika", system-ui, sans-serif;
}

/* body sets font-family from the variable already; the splash tagline is SVG text with its own font-family attribute. */
:lang(hi) .bars-tag, :lang(ta) .bars-tag, :lang(te) .bars-tag, :lang(kn) .bars-tag, :lang(ml) .bars-tag {
  font-family: var(--font);
}

html:lang(hi) body { line-height: 1.6; }
html:lang(ta) body, html:lang(te) body, html:lang(kn) body, html:lang(ml) body { line-height: 1.7; }

:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) :is(h2, h3, h4, .landing-headline) {
  line-height: 1.4;
  font-weight: 800;
}

:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) :is(h2, h3, h4, p, li, label, button, span, .landing-headline, .landing-subhead):not(.net-earnings-value, .rate-card-value, .brand h1) {
  letter-spacing: normal !important;
}

/* Step indicator: the dots are invisible buttons, so the global disabled
   shadow must not draw a box around a dot and its label. Narrow screens give
   the labels more room by tightening the row; Indic labels are a little smaller. */
.step-dot:disabled { box-shadow: none; }

@media (max-width: 400px) {
  .step-indicator { padding-left: 0.5rem; padding-right: 0.5rem; }
  .step-line { margin-left: 0.15rem; margin-right: 0.15rem; }
}

:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) .step-dot-label {
  font-size: 0.65rem;
  max-width: max(4.4rem, calc((100vw - 2.5rem) / 4)); /* wider phones give long words room; at 320px a very long word may still wrap */
}

/* Indic scripts are wider and taller than Latin at the same size: smaller headings keep them to a few lines. */
:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) h2 { font-size: 1.4rem; }
:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) h3 { font-size: 1.125rem; }
:is(html:lang(hi), html:lang(ta), html:lang(te), html:lang(kn), html:lang(ml)) .landing-headline { font-size: 1.6rem; }

/* ---------------------------------------------------------------------
   Stacking: room for the hard shadows (stage 1.1). Every shadow reaches
   --off (large) or --off-sm (small) below and to the right of its box, so the
   next element needs at least offset + 8px: --gap and --gap-sm are derived
   from the single --off, and nothing below is a per-element exception.
--------------------------------------------------------------------- */

button.primary,
button.secondary {
  margin-bottom: var(--gap);
}

/* the last button inside a card has the card's own padding below it */
.card button.primary:last-child,
.card button.secondary:last-child {
  margin-bottom: 0;
}

.tilt-card {
  margin-bottom: max(var(--space-2), var(--gap));
}

.suggestion-chip {
  margin: 0 var(--gap-sm) var(--gap-sm) 0;
}

.field-row,
.deduction-row,
.app-nav,
.header-controls,
.voice-row {
  gap: var(--gap-sm);
}

.deduction-row,
.line-row {
  margin-bottom: var(--gap-sm);
}

/* room under the dot for its shadow, and the connecting line moves with it */
.step-dot { gap: var(--gap-sm); }
.step-line { margin-bottom: calc(1.3rem + 8px); }

/* labels and notes around a text box clear its focus ring */
.field label { margin-bottom: 0.5rem; }
.voice-status,
.voice-check {
  margin-top: calc(var(--ring) + 8px);
}

/* Trip total mismatch: the sum fields get an amber dashed outline (dashes plus aria-invalid, so not colour alone) */
input.sum-mismatch {
  outline: 4px dashed var(--amber);
  outline-offset: 2px;
}
input.sum-mismatch:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 3px;
}
