/* ============================================================
   The Transactor design language — warm paper / warm ink
   One stylesheet for every app "by Transactor".
   A paper-white page in light, a brown-black one in dark; green and
   red are the money colours. The light counterpart follows the system.

   This file holds everything the apps share. It does not hold an
   app's own colour: each app sets --accent, --accent-ring and
   --accent-glow in its own css/app.css, loaded after this file.

   Edit this file only in the transactor-design repository. An app's
   copy, in its shared-design/ folder, is replaced on every update.
   ============================================================ */

:root {
  --bg: #141311;
  --card: #1e1d1a;
  --skel: #2a2825;            /* loading placeholder block; an empty split bar */
  --skel-hi: #36332f;         /* the sweep that crosses it */
  --text: #f3f1ec;
  --text-2: #a8a39a;
  --text-3: #6e6a63;
  --hairline: rgba(243, 241, 236, 0.07);
  --pos: #4bd98e;
  --neg: #f27360;
  --pos-fill: rgba(75, 217, 142, 0.12);
  --neg-fill: rgba(242, 115, 96, 0.12);
  --shadow-sheet: 0 -12px 48px rgba(0, 0, 0, 0.6);
  --backdrop: rgba(0, 0, 0, 0.55);
  --card-shadow: none;
  --toast-bg: #2a2825;
  --toast-text: #f3f1ec;
  /* a surface nested inside a card or sheet: inputs, the seg track */
  --inset: #2a2825;
  --seg-on: #3a3733;          /* the chosen half of a .seg */
  /* frosted glass, for controls that float over content */
  --glass-bg: rgba(48, 46, 42, 0.55);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  --bar-glass: rgba(20, 19, 17, 0.72);   /* --bg, see-through: the top bar once scrolled */
  /* the tint of each person and each trip (circles, the name in the top bar) */
  --av-bg-s: 36%;
  --av-bg-l: 22%;
  --av-fg-s: 80%;
  --av-fg-l: 80%;
}

/* light counterpart — same language, inverted surfaces */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f2ee;
    --card: #ffffff;
    /* Darker than --inset: a placeholder has to read on --card (#fff) and on the
       page (#f4f2ee) alike, and the sweep must not go brighter than the page or
       the block vanishes at the peak. */
    --skel: #e2ded6;
    --skel-hi: #efece6;
    --text: #1c1b19;
    --text-2: #6b6862;
    --text-3: #9a968f;
    --hairline: rgba(28, 27, 25, 0.08);
    --pos: #17804c;
    --neg: #c23b2a;
    --pos-fill: rgba(23, 128, 76, 0.12);
    --neg-fill: rgba(194, 59, 42, 0.1);
    --shadow-sheet: 0 -12px 48px rgba(28, 27, 25, 0.16);
    --backdrop: rgba(28, 27, 25, 0.34);
    --card-shadow: 0 1px 2px rgba(28, 27, 25, 0.04), 0 6px 20px rgba(28, 27, 25, 0.05);
    --toast-bg: #1c1b19;
    --toast-text: #f4f2ee;
    --inset: #f3f0eb;
    --seg-on: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.95);
    --glass-shadow: 0 1px 2px rgba(28, 27, 25, 0.06), 0 8px 24px rgba(28, 27, 25, 0.08), inset 0 1px 0 #ffffff;
    --bar-glass: rgba(244, 242, 238, 0.72);
    --av-bg-s: 64%;
    --av-bg-l: 93%;
    --av-fg-s: 46%;
    --av-fg-l: 40%;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

[hidden] { display: none !important; }

html { height: 100%; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
}

input {
  font: inherit;
  color: var(--text);
  user-select: text;
  -webkit-user-select: text;
}

/* ============ Components ============
   The reusable pieces. Every screen builds from these rather than restyling its
   own copy — a button is .btn plus a variant, a raised surface is .card, a group
   of rows in a sheet is .inset-group. A screen-specific class may sit beside
   one (e.g. .signedout-btn, a JS hook) but should only add spacing, never
   restate what the component already says. */

/* A raised surface. */
.card {
  background: var(--card);
  box-shadow: var(--card-shadow);
  border-radius: 24px;
}

/* A full-width pill button, or a link dressed as one. Always paired with a
   variant below. */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 56px;
  padding: 0 20px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: transform 0.12s, opacity 0.15s, background 0.15s, color 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn:disabled { opacity: 0.45; }

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: currentColor;
}

.btn + .btn { margin-top: 12px; }

/* A button set apart from the one above — e.g. Delete under Save, so the
   destructive action is not one slip of the thumb away. */
.btn + .btn.btn-spaced { margin-top: 32px; }

/* The one main action: a solid pill in the text colour, so it is near-black on
   paper and off-white on ink. */
.btn-primary {
  background: var(--text);
  color: var(--bg);
}

.btn-primary:active { opacity: 0.85; }

/* Destructive or leaving: sign out, delete. Soft until a two-tap confirm arms
   it, then solid. */
.btn-danger {
  background: var(--neg-fill);
  color: var(--neg);
}

.btn-danger.confirm {
  background: var(--neg);
  color: var(--bg);
}

/* Frosted glass, for controls that float over content: the round header
   buttons, Home's tab bar and the action tray at the foot of a page. Only on
   floating things — glass on a card that never has anything behind it is just
   a grey card. */
.icon-btn,
.tabbar,
.action-bar {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  backdrop-filter: blur(20px) saturate(1.8);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* Round icon button. */
.icon-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: transform 0.1s, opacity 0.12s;
}

.icon-btn:active { transform: scale(0.92); opacity: 0.8; }

/* A labelled text input. */
.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin: 0 4px 7px;
}

.field input {
  width: 100%;
  height: 52px;
  border: 1px solid transparent;
  border-radius: 20px;
  background: var(--inset);
  padding: 0 16px;
  /* 16px or more, or iOS Safari zooms the page on focus */
  font-size: 17px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* The amount: the one number the sheet exists for, set large in the display
   serif with no box around it. */
.amount-field label {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.amount-field input {
  height: 76px;
  background: transparent;
  text-align: center;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 56px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
}

.amount-field input:focus {
  border-color: transparent;
  box-shadow: none;
  background: var(--inset);
}

/* The grouped box inside a sheet: rows on the inset surface with hairlines
   between them — like iOS Settings. It holds either kind of row: .form-row
   (a labelled input, below) or .list-row (a link, further down). On the inset
   surface rather than a raised card, so it does not read as a card on a card. */
.inset-group {
  background: var(--inset);
  border-radius: 20px;
  padding: 0 16px;
}

/* A form row: the label sits inside the row above its value. Each row is a
   <label>, so a tap anywhere on it focuses the input.
   Markup: .inset-group > label.form-row > .form-row-main > .form-row-label + input,
   with an optional trailing .form-row-icon. */

.form-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 0;
  cursor: text;
}

.form-row + .form-row { border-top: 1px solid var(--hairline); }

.form-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.form-row-label {
  font-size: 13px;
  color: var(--text-2);
  transition: color 0.15s;
}

/* The focused row's label turns indigo — the group has no box of its own to
   ring, so this is the focus mark. */
.form-row:focus-within .form-row-label { color: var(--accent); }

.form-row input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  padding: 0;
  font-size: 17px; /* 16px or more, or iOS zooms on focus */
  font-weight: 500;
  line-height: 1.4;
}

.form-row input::placeholder { color: var(--text-3); font-weight: 400; }

.form-row-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: var(--text-2);
}

/* Date field: friendly text in the row, and the real <input type="date">
   stretched invisibly over the whole row so a tap anywhere opens the phone's
   own picker (wireDateField in app.js). */
.date-field { cursor: pointer; }

.date-field-text {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.4;
}

.date-field input[type="date"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 17px;
}

/* Two-way switch on a pill track — the chosen half lifts out as a raised pill
   and takes its money colour. */
.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: var(--inset);
  margin-bottom: 22px;
}

.seg button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.seg button.on {
  background: var(--seg-on);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  font-weight: 600;
}

.seg button svg { width: 16px; height: 16px; stroke: currentColor; }

.seg button.on.sent { color: var(--neg); }
.seg button.on.received { color: var(--pos); }

/* A grouped list: rows inside a .card, hairlines between them. Markup is
   `.card.list` holding `.list-row`s (or, inside a sheet, an .inset-group
   holding them), each with up to three slots —
     leading:  an .avatar or a .list-icon
     .list-row-main:  .list-row-title over .list-row-sub
     .list-row-trail: .list-row-value over .list-row-note
   Rows are <button>s when they open something. */
.list { padding: 0 18px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 0;
  text-align: left;
  transition: opacity 0.12s;
}

.list-row + .list-row { border-top: 1px solid var(--hairline); }

button.list-row:active,
a.list-row:active { opacity: 0.55; }

a.list-row { color: inherit; text-decoration: none; }

/* A row's trailing arrow: › for a page here, ↗ for a page elsewhere. */
.list-row-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke: var(--text-2);
}

.list-row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-row-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* a placeholder title, e.g. "No remark" */
.list-row-title.muted { color: var(--text-2); font-weight: 500; }

.list-row-sub { font-size: 13px; color: var(--text-2); }

.list-row-trail {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  flex-shrink: 0;
}

/* The number stays in the text colour; direction is carried by the note's
   colour (.pos / .neg), the same rule as the big balances. */
.list-row-value {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.list-row-note { font-size: 12px; font-weight: 500; color: var(--text-2); }

/* Round tinted icon in the leading slot: the sent / received arrow. */
.list-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.list-icon svg { width: 18px; height: 18px; stroke: currentColor; }

.list-icon.sent { background: var(--neg-fill); color: var(--neg); }
.list-icon.plain { width: 28px; height: 28px; color: var(--text); }
.list-icon.plain svg { width: 22px; height: 22px; }
.list-icon.received { background: var(--pos-fill); color: var(--pos); }

/* The small heading above a list: "PEOPLE  6". .list-label-date is the
   sentence-case variant for date groups ("Today", "18 November 2026"). */
.list-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 22px 6px 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}

.list-label:first-child { margin-top: 6px; }

.list-label-date {
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
}

/* What a filtered list says when nothing matches. */
.list-none {
  margin: 28px 6px;
  text-align: center;
  font-size: 15px;
  color: var(--text-2);
}

/* Top bar: a button, a centred title, a button. The grid's two fixed 44px
   columns are what keep the title truly centred whatever the buttons are. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 12px) 20px 12px;
}

/* The bar's frosted band. A separate layer so it can FADE in — backdrop-filter
   itself does not transition well — and only once something is scrolled under
   the bar (.is-scrolled): frosted glass over bare page is just a grey band. */
.topbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--bar-glass);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  backdrop-filter: blur(24px) saturate(1.8);
  border-bottom: 1px solid var(--hairline);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.topbar.is-scrolled::before { opacity: 1; }

/* A title that can swap for a compact second line (Home: the app's name ⇄ the total).
   Both sit in the same grid cell and cross-fade with a short slide. */
.topbar-titles {
  display: grid;
  /* Centre both in the cell: the two-line compact title sets the cell's height,
     and the one-line title would otherwise ride up above the buttons. */
  place-items: center;
  min-width: 0;
}

.topbar-titles > * {
  grid-area: 1 / 1;
  /* No wider than the cell. A centred grid item is as wide as its text, so a
     long trip or person name would run under the buttons instead of ending in "…". */
  max-width: 100%;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.topbar-compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  opacity: 0;
  transform: translateY(8px);
}

.topbar-compact-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}

.topbar-compact-label.pos { color: var(--pos); }
.topbar-compact-label.neg { color: var(--neg); }

.topbar-compact-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-compact-amount {
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.topbar.is-compact .topbar-title { opacity: 0; transform: translateY(-8px); }
.topbar.is-compact .topbar-compact { opacity: 1; transform: none; }

/* Fades stay (opacity is not movement); the slides go. */
@media (prefers-reduced-motion: reduce) {
  .topbar-titles > *,
  .topbar.is-compact .topbar-title { transform: none; }
}

.topbar-title {
  text-align: center;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The hero: one big number on the open page, not in a card. Direction label in
   small capitals (its colour carries the direction), the amount in the display
   serif, a grey line under it. */
.hero {
  text-align: center;
  padding: 18px 24px 0;
}

.hero-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-2);
}

.hero-label.pos { color: var(--pos); }
.hero-label.neg { color: var(--neg); }

.hero-amount {
  margin-top: 8px;
  font-family: "EB Garamond", Georgia, serif;
  font-size: min(64px, 15vw);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: lining-nums tabular-nums;
  white-space: nowrap;
}

.hero-amount.long { font-size: min(52px, 12vw); }
.hero-amount.zero { color: var(--text-3); }

/* A short .split-bar under the hero amount (the person page). */
.hero-bar {
  width: 200px;
  margin: 18px auto 0;
}

.hero-sub {
  margin-top: 10px;
  font-size: 15px;
  color: var(--text-2);
}

/* Sent / received, side by side, over a .split-bar. */
.split {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
}

.split-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.split-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.split-col-end { align-items: flex-end; text-align: right; }

.split-key {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-2);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot.pos { background: var(--pos); }
.dot.neg { background: var(--neg); }

.split-value {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}

/* The red / green split bar: two solid pieces with a gap, sized in proportion
   by renderSplitBar() in app.js, so neither colour reads as a faded track. Used
   on Home's split card and the person page's balance card. */
.split-bar {
  display: flex;
  gap: 3px;
  height: 6px;
}

.split-bar > span {
  flex: 1 1 0;
  min-width: 6px;
  border-radius: 999px;
  transition: flex-grow 0.4s cubic-bezier(0.32, 0.72, 0.28, 1);
}

.split-bar-sent { background: var(--neg); }
.split-bar-received { background: var(--pos); }

.split-bar.empty > span { background: var(--skel); }

/* The "Privacy · Terms" line, under the sign-in button and in the account
   sheet. */
.legal-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-3);
}

.legal-links a { color: var(--text-2); text-decoration: none; }

.legal-links a:hover { color: var(--text); }

/* ============ App shell / views ============ */

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.28, 1);
  overflow: hidden;
}

.view-right { transform: translateX(100%); z-index: 6; }

.view-right.active { transform: translateX(0); }

/* ============ Home ============ */

/* ---- Home scrolling ----
   Home is one scrolling page, not a fixed header over a scrolling list: the
   big number takes real room, and pinning it would leave the list half the
   screen. The view itself scrolls; the .topbar inside it is sticky. It is a
   plain block, not the flex column .view is, because flex children shrink to
   fit — which is exactly how a fixed-height search bar came out squashed. */
.view-scroll {
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.scroll-sentinel { height: 1px; margin-bottom: -1px; }

/* A scroller nested in a .view (the person page) fills it. */
.view > .view-scroll { height: 100%; }

#view-home .split { margin: 22px 20px 18px; }

/* With no people the empty state sits in the page, under the hero and card,
   rather than centred over the whole view on top of them. */
#home-empty {
  position: static;
  padding: 48px 40px;
}

.pos { color: var(--pos); }
#net-label.neg { color: var(--neg); }

.pos { color: var(--pos); }
.neg { color: var(--neg); }

/* Search: a pill-shaped .card with a magnifier. */
.search-wrap {
  margin: 0 20px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  box-shadow: var(--card-shadow);
  border-radius: 999px;
  padding: 0 18px;
  color: var(--text-2);
}

.search-wrap input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  height: 50px;
  font-size: 17px;
}

.search-wrap input::placeholder { color: var(--text-2); }

.people-list {
  padding: 2px 20px calc(env(safe-area-inset-bottom) + 40px);
}

/* category-icon style avatars: dark tint, colored glyph */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 650;
  background: hsl(var(--av-h, 240) var(--av-bg-s) var(--av-bg-l));
  color: hsl(var(--av-h, 240) var(--av-fg-s) var(--av-fg-l));
}

/* ============ Person view ============ */

/* The top bar's title, tinted with the person's own hue. */
.person-name { color: hsl(var(--av-h, 240) var(--av-fg-s) var(--av-fg-l)); }

/* The person page scrolls inside #person-scroll, so the action tray can sit
   outside it and stay put. Its empty state sits in the page like Home's. */
#person-empty {
  position: static;
  padding: 40px 40px calc(env(safe-area-inset-bottom) + 124px);
}

.txn-list {
  /* air under the hero; room under the last entry for the floating action tray */
  padding: 20px 20px calc(env(safe-area-inset-bottom) + 122px);
}

/* ============ Bottom action bar ============ */

/* A floating glass tray (glass from the Components block) holding two
   .btn-primary pills. The entries scroll underneath it, which is what the glass
   is for. */
.action-bar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
}

.action-bar .btn {
  flex: 1;
  min-width: 0;
  /* Half-width pills: the .btn's 20px sides would wrap "You received". */
  padding: 0 12px;
  white-space: nowrap;
}

/* .btn + .btn spacing is for stacked buttons, not side-by-side ones. */
.action-bar .btn + .btn { margin-top: 0; }

/* The icons in the tray's pills take the pill's own text colour. */
.action-bar .btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; }

/* ============ Empty states ============ */

.empty-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  pointer-events: none;
}

/* A line drawing on a raised disc, a serif heading, one grey line. */
.empty-art {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--card-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.empty-art svg { width: 44px; height: 44px; stroke: var(--text-2); }

.empty-state h2 {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 260px;
  line-height: 1.45;
}

/* ============ Sheet / backdrop ============ */

#backdrop {
  position: fixed;
  inset: 0;
  background: var(--backdrop);
  z-index: 40;
  opacity: 0;
  transition: opacity 0.28s ease;
}

#backdrop.show { opacity: 1; }

#sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: var(--card);
  border-top: 1px solid var(--hairline);
  border-radius: 32px 32px 0 0;
  box-shadow: var(--shadow-sheet);
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 24px);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.28, 1);
  max-height: 88dvh;
  overflow-y: auto;
}

#sheet.show { transform: translateY(0); }

.sheet-handle {
  width: 38px;
  height: 5px;
  border-radius: 999px;
  background: var(--text-3);
  opacity: 0.4;
  margin: 4px auto 16px;
}

/* Every sheet's head (built by openSheet): an empty cell, the centred title with
   an optional grey line under it, and a round close button. The empty cell
   mirrors the button's width, which is what keeps the title truly centred. */
.sheet-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin-bottom: 22px;
}

.sheet-head-text { text-align: center; min-width: 0; }

.sheet-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-sub {
  margin-top: 2px;
  font-size: 13px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--inset);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, opacity 0.12s;
}

.sheet-close svg { width: 16px; height: 16px; stroke: currentColor; }

.sheet-close:active { transform: scale(0.92); opacity: 0.8; }

/* The sheet's buttons sit a little apart from the fields above them. */
#sheet .inset-group + .btn { margin-top: 24px; }



/* ============ Toast ============ */

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 96px);
  transform: translate(-50%, 16px);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 15px;
  font-weight: 500;
  padding: 12px 20px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 60;
  /* As wide as its text. Without it, a box that starts at left: 50% may only fill
     the right half of the screen, so even a short message wrapped. */
  width: max-content;
  max-width: 84vw;
  text-align: center;
}

#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ Loading shimmers ============ */
/* #app carries `loading` in the markup, so the very first frame is already the
   placeholder. Without it the shell paints a real "₹0" and a settled label —
   somebody else's number, effectively, until /api/state answers. app.js drops the
   class once it has, and a 401 never drops it: the browser is on its way to
   /login.html and no wrong figure was ever on screen.

   The people list needs no class of its own. Its placeholder rows sit in the
   markup and renderHome() overwrites the whole list on its first pass, so they
   clear themselves. */
#app.loading .hero-label,
#app.loading .hero-amount,
#app.loading .hero-sub,
#app.loading .split-value,
#app.loading .split-bar,
.skel-avatar,
.skel-line {
  /* Text stays in place and stays measured — it is just not readable, so a block
     the width of the real thing needs no hardcoded size. */
  color: transparent;
  background-color: var(--skel);
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    var(--skel-hi) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: skel-shimmer 1.4s ease-in-out infinite;
  border-radius: 8px;
}

/* The hero's lines are full-width blocks centred by text-align, so they are
   shrunk to blocks of their own, centred, at the proportions of what they stand
   in for — "₹0" alone would be a small square. */
#app.loading .hero-label,
#app.loading .hero-amount,
#app.loading .hero-sub {
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

#app.loading .hero-label { min-width: 108px; }
#app.loading .hero-amount { min-width: 200px; }
#app.loading .hero-sub { min-width: 120px; }
#app.loading .split-value { min-width: 88px; }

/* The segments are shares of totals nobody has sent yet. */
#app.loading .split-bar > span { visibility: hidden; }

@keyframes skel-shimmer {
  from { background-position: -50% 0; }
  to { background-position: 150% 0; }
}

/* Placeholder rows are .list-row themselves (see home.html), so they have the
   real rows' box exactly — same gap, padding and hairline — and the real rows land
   where the placeholders were instead of shifting. */

.skel-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Widths live here, not on the elements: `style-src 'self'` has no
   'unsafe-inline', so a style attribute would be blocked outright. */
.skel-line {
  height: 11px;
  border-radius: 6px;
}

.list-row:nth-child(1) > .skel-line { width: 42%; }
.list-row:nth-child(2) > .skel-line { width: 58%; }
.list-row:nth-child(3) > .skel-line { width: 34%; }

/* Loading is the one place a static placeholder says nothing at all, so the
   blocks stay and only the sweep stops. */
@media (prefers-reduced-motion: reduce) {
  #app.loading .hero-label,
  #app.loading .hero-amount,
  #app.loading .hero-sub,
  #app.loading .split-value,
  #app.loading .split-bar,
  .skel-avatar,
  .skel-line {
    background-image: none;
    animation: none;
  }
}

/* ============ Signed out ============ */
/* The one screen shown without a session. Redesigned 24 Nov 2026 (the
   Flow-inspired canvas): the brand — logo, serif title, Transactor byline, serif
   tagline — sits centred in the open space, and the one action sits at the
   bottom of the screen, where a thumb already is. */

#signedout {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  background: var(--bg);
  z-index: 20; /* above the app views, below nothing — sheets never coexist with it */
  padding: calc(env(safe-area-inset-top) + 24px) 28px calc(env(safe-area-inset-bottom) + 28px);
}

/* Full height, two parts: the hero takes whatever space the actions leave and
   centres itself in it; the actions keep their natural height at the bottom. */
.signedout-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 360px;
  height: 100%;
}

.signedout-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-bottom: 24px;
}

.signedout-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- Holding the sign-in page back until we know it is wanted ----

   This page is static and CloudFront cannot read a cookie, so login.js has to
   ASK /auth/me whether the visitor already has a session — and one who does is
   sent straight to /home.html. Painting the whole page immediately means that
   visitor sees a flash of a sign-in page they never needed, which is every
   launch of the Mac app: it opens at this URL by design (mac/src-tauri/src/lib.rs).

   So the whole column waits and a LOADING STATE stands in its place: the logo,
   centred on the screen, with three dots under it. It shows what belongs to
   NEITHER answer, so nothing wrong is ever on screen, and it reads as a launch
   screen on purpose rather than as a page that stopped halfway.

   The splash carries its own logo (see login.html) instead of the column's. That
   is what buys the centring: the column keeps its natural position — the logo
   sits above the middle, since the hero is centred in the space the bottom
   actions leave — while the wait sits at the true middle of the screen, and the
   two CROSS-FADE. The logo therefore appears to travel to its
   place without anything measuring the distance, which a translate would have to
   do and would get wrong the day the column's content changes.

   The cost, and it is a real reversal: the logo now moves at reveal. The earlier
   version held the column's children and left the logo painted in place
   precisely so nothing moved. Centring the wait and keeping the logo still are
   not both available; the cross-fade is what makes the move deliberate.

   login.js adds .ready to #signedout the moment the answer is "nobody" — the
   class is on the SECTION, not the column, because it now governs both the column
   and the splash. Each of the two has a pair of animations: a delayed one for the
   fallback, and a same-shape one under .ready that runs at once.

   Those pairs have DIFFERENT NAMES on purpose, and it is not cosmetic. Changing
   animation-name restarts an animation, so the fade always runs from its start;
   reusing one name and dropping the delay only retimes the animation already
   running, and once the wait has outlasted the 200ms duration, retiming lands
   past the end and the column snaps into place. Transitions do not work here
   either — the reveal has to remove a filling animation, and removing one starts
   no transition (verified: the fade was instant until these became keyframes).

   The delay is only a FALLBACK, for when no answer ever comes, so a visitor is
   never left staring at a logo forever. 1s, so that it never fires ahead of a
   real answer — a cold round trip is ~150–300ms once DNS, TCP and TLS are paid
   for, and well past that on a poor connection.

   Note which failures the fallback actually covers, because it is narrower than
   it looks: login.js reveals the page the moment Store.me() SETTLES, and a
   rejection counts, so an unreachable API is an instant reveal rather than a
   wait. What is left is JavaScript that never ran or was blocked, and a request
   that hangs without ever rejecting. Those are the cases that wait the full 1s —
   which is also why the fallback has to stay CSS, not a setTimeout. */
.signedout-inner > * {
  opacity: 0;
  animation: signedout-reveal 200ms ease 1s both;
}

/* The answer arrived and it is "not signed in" — fade the column in now. */
#signedout.ready .signedout-inner > * {
  animation: signedout-reveal-now 200ms ease both;
}

@keyframes signedout-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes signedout-reveal-now {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* The loading state. Fixed and content-centred, so it is the middle of the
   SCREEN rather than the top of the column.

   The LOGO is what gets centred, not the logo and dots as a group — which is why
   the dots are taken out of flow below rather than being a second grid row. In
   flow they push the logo up by half their own height, and "nearly centred" is
   the kind of near-miss that reads as an accident. */
.signedout-splash {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  /* Never a click target. It covers the whole screen and, once faded, stays
     there at opacity 0 — so without this it would quietly swallow every tap on
     the sign-in link behind it. */
  pointer-events: none;
  animation: signedout-splash-out 150ms ease 1s both;
}

#signedout.ready .signedout-splash {
  animation: signedout-splash-out-now 150ms ease both;
}

@keyframes signedout-splash-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes signedout-splash-out-now {
  from { opacity: 1; }
  to { opacity: 0; }
}

/* The splash logo is the column's logo in every respect — same size, radius and
   shadow — because the cross-fade has to read as one object, not two. Only the
   margin goes: it is centred, so it carries no spacing of its own. */
.signedout-splash .signedout-logo { margin-bottom: 0; }

/* Held back 300ms of their own. On a fast answer the wait is over before these
   ever appear, and a 30ms flash of a loading indicator is precisely the
   unintentional look the loading state exists to avoid. */
.signedout-dots {
  display: flex;
  gap: 6px;
  /* Out of flow, so the logo above stays exactly centred. 72px = half the 88px
     logo, putting this at its bottom edge, plus 28px of air. Tied to the logo's
     size: change one and change the other. */
  position: absolute;
  top: calc(50% + 72px);
  left: 50%;
  transform: translateX(-50%);
  animation: signedout-dots-in 160ms ease 300ms both;
}

.signedout-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-2);
  animation: signedout-dot 1.2s ease-in-out infinite;
}

/* Staggered, which is what makes three dots read as progress rather than as a
   blinking row. */
.signedout-dots span:nth-child(2) { animation-delay: 160ms; }
.signedout-dots span:nth-child(3) { animation-delay: 320ms; }

@keyframes signedout-dots-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes signedout-dot {
  0%, 100% { opacity: 0.25; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}

/* The only looping motion on the page, so it is the only thing that has to go.
   The fades stay: they are opacity, not movement, and losing them would put the
   snap back. */
@media (prefers-reduced-motion: reduce) {
  .signedout-dots span {
    animation: none;
    opacity: 0.55;
  }
}

.signedout-logo {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  /* An indigo glow rather than a grey drop shadow: the tile is the one saturated
     thing on a warm neutral page, and a neutral shadow under it reads as dirt. */
  box-shadow: 0 12px 32px var(--accent-glow);
  display: block;
  margin-bottom: 28px;
}

.signedout-title {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 52px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* "by ⊙ Transactor" — the parent brand: its circular mark and its wordmark
   face. Caveat runs small for its point size, so the wordmark is set larger
   than the "by"; centering (not baseline) keeps the icon on the line. */
.signedout-brand {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  /* it is a link to transactor.app, but dressed as the byline it always was */
  text-decoration: none;
}

.signedout-brandmark {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

/* Transactor's scheme, spoken in the app's tokens: a text-colored circle with
   background-colored arrows, so it inverts with the color scheme exactly as
   the original does on transactor.app. */
.signedout-brandmark circle { fill: var(--text); }
.signedout-brandmark path { stroke: var(--bg); }

.signedout-wordmark {
  font-family: "Caveat", cursive;
  font-weight: 600;
  font-size: 25px;
  line-height: 1;
  color: var(--text);
}

/* The tagline, in the display serif. Its one italic phrase carries the brand
   indigo — the only colour on the page besides the logo. */
.signedout-sub {
  font-family: "EB Garamond", Georgia, serif;
  font-size: 30px;
  line-height: 1.2;
  color: var(--text);
  max-width: 300px;
  margin-top: 36px;
}

.signedout-sub em { color: var(--accent); }

/* The sign-in link is a plain .btn .btn-primary; .signedout-btn on it is only
   the hook login.js uses to point it at the API host. */

.signedout-note {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-2);
  max-width: 310px;
  margin-top: 16px;
}



/* ============ Account sheet ============ */

/* Transactor's circular mark, in the app's tokens: a text-coloured disc with
   arrows in the surface colour, so it inverts per scheme like the original. */
.transactor-mark circle { fill: var(--text); }
.transactor-mark path { stroke: var(--inset); fill: none; }

/* ---- Account sheet ---- */

/* Who is signed in: a large initials circle, the name in the display serif,
   the email, and a tag saying where the account lives. */
.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: -4px 0 24px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  font-size: 24px;
}

/* An avatar with nothing to show yet: a person outline on the inset surface. */
.avatar.is-empty {
  background: var(--inset);
  color: var(--text-2);
}

.avatar.is-empty svg { width: 34px; height: 34px; stroke: currentColor; }

.profile-name {
  margin-top: 14px;
  max-width: 100%;
  font-family: "EB Garamond", Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* No name on the Transactor account: the email is the heading. An address runs
   long and is not a name, so it is set in the text face, smaller, and allowed to
   wrap rather than be cut off mid-address. */
.profile-name.is-email {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: anywhere;
}

.profile-email {
  margin-top: 4px;
  font-size: 15px;
  color: var(--text-2);
}

.profile-tag {
  margin-top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--inset);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

/* A quiet line under a sheet's last button. */
.sheet-note {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-2);
  text-align: center;
}

/* Smooth corners. A plain border-radius is a straight edge joined to a quarter
   circle, so the bend starts all at once. corner-shape: squircle eases into the
   bend and out of it again, the way hardware corners are cut.
   Inside @supports on purpose: a smooth corner hugs the edge more, so it needs a
   radius about one and a half times larger to look as round. A browser that
   cannot draw one must keep the plain sizes above, not get the larger ones as
   quarter circles. Pills and circles stay as they are.
   This block must stay after the rules it overrides (.card, .inset-group,
   .field input, #sheet) — same specificity, so the later one wins. */
@supports (corner-shape: squircle) {
  .card {
    border-radius: 36px;
    corner-shape: squircle;
  }

  /* The amount field sits directly above an .inset-group at the same width,
     so the two share one corner. */
  .inset-group,
  .field input {
    border-radius: 30px;
    corner-shape: squircle;
  }

  #sheet {
    border-radius: 48px 48px 0 0;
    corner-shape: squircle;
  }
}

/* Desktop: center the app like a phone */
@media (min-width: 520px) {
  #app {
    max-width: 430px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 1px solid var(--hairline);
    border-right: 1px solid var(--hairline);
  }
  #sheet { max-width: 430px; left: 50%; margin-left: -215px; }
}

/* Opened from an iPhone's home screen, iOS reports the screen as shorter than it
   is, by the height of the status bar, while the page still starts at the very top.
   So everything sized or pinned to the screen (inset: 0, bottom: 0) stops that far
   above the bottom edge, and the tab bar, action tray, sheet and toast float. In a
   home-screen app 100lvh is the true height, and 100lvh - 100dvh is the missing
   part. Only there: in Safari 100lvh is taller than what is visible, and the bars
   would slide under its toolbar. The body gets the true height too: at the short
   height it cuts off whatever reaches past it, the bottom of a bar included. */
@media (display-mode: standalone) {
  body { height: 100lvh; }
  #app,
  #backdrop,
  #signedout,
  .signedout-splash { bottom: auto; height: 100lvh; }
  #sheet { bottom: calc(100dvh - 100lvh); }
  #toast { bottom: calc(env(safe-area-inset-bottom) + 96px + 100dvh - 100lvh); }
}

/* ============ Tab bar, trip circles, ticks and invitations ============ */

/* A second action under the main one (Decline under Join trip): the same pill,
   on the inset colour. */
.btn-quiet {
  background: var(--inset);
  color: var(--text);
}

/* Home's two tabs, Trips and People: a floating glass tray like the action
   tray (glass from the Components block). The chosen tab is a solid pill in the
   text colour; the other has no fill. */
.tabbar {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  display: flex;
  gap: 8px;
  padding: 6px;
  border-radius: 999px;
}

.tabbar button {
  flex: 1;
  min-width: 0;
  height: 56px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.tabbar button svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; }

.tabbar button[aria-selected="true"] {
  background: var(--text);
  color: var(--bg);
}

/* A trip's circle: a suitcase in the trip's own tint, where a person has
   initials. Sized like .avatar; 72 at the top of a trip's sheet. */
.trip-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: hsl(var(--av-h, 240) var(--av-bg-s) var(--av-bg-l));
  color: hsl(var(--av-h, 240) var(--av-fg-s) var(--av-fg-l));
}

.trip-icon svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; }

.trip-icon.is-large { width: 72px; height: 72px; }
.trip-icon.is-large svg { width: 32px; height: 32px; }

/* The circle that leads "Add someone new": the same size as an avatar, empty. */
.avatar.is-add {
  box-sizing: border-box;
  background: none;
  border: 1.5px dashed var(--text-3);
  color: var(--text-2);
}

.avatar.is-add svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; }

/* The tick at the end of a person's row: who is going, who shares an expense. */
.tick {
  width: 24px;
  height: 24px;
  box-sizing: border-box;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--text-3);
  color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tick svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 3; }

.tick.on {
  border-color: var(--text);
  background: var(--text);
  color: var(--bg);
}

/* Whether a person has joined, at the end of their row in the invite sheet. */
.list-row-state {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-2);
}

.list-row-state.joined { font-weight: 500; color: var(--pos); }
.list-row-state svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2.6; }

/* The dot on something waiting for you: an invitation. The only use of the
   app's colour on Home. */
.list-row-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--accent);
}
