/* vvsplit — Workspace design.
   Stripe-flavored: Inter, indigo accent, soft surfaces, generous space.
   PyScript-only (no JS): chip toggle and uneven-mode weight visibility
   are driven by CSS :has() against the form's radios/checkboxes. */

:root {
  --bg: #fafbfc;
  --surface: #ffffff;
  --surface-1: #f7f9fc;
  --surface-2: #eef2f7;
  --surface-3: #e3e8ee;
  --border: #e3e8ee;
  --border-soft: #eef1f6;
  --border-strong: #c9d2dd;

  --ink: #0a2540;
  --ink-2: #3c4257;
  --ink-3: #6b7280;
  --ink-4: #94a3b8;

  --indigo: #635bff;
  --indigo-2: #5046e4;
  --indigo-soft: #f0eefe;
  --indigo-tint: #f6f5ff;
  --success: #00b878;
  --danger: #df1b41;

  --hero-grad: linear-gradient(120deg, #5ee9ff 0%, #635bff 50%, #b14eff 100%);

  --sh-1: 0 1px 2px rgba(50,50,93,.06), 0 1px 1px rgba(0,0,0,.04);
  --sh-2: 0 2px 5px rgba(50,50,93,.08), 0 1px 2px rgba(0,0,0,.05);
  --sh-3: 0 7px 14px rgba(50,50,93,.10), 0 3px 6px rgba(0,0,0,.07);

  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --nav-w: 244px;
  --people-w: 320px;
  --rail-w: 340px;

  --ease: cubic-bezier(.2, .8, .2, 1);
  --focus-ring: 0 0 0 3px rgba(99, 91, 255, 0.18);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--ink); }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-feature-settings: "cv11", "ss01";
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
}
.num { font-variant-numeric: tabular-nums; }
::selection { background: rgba(99, 91, 255, 0.25); }

/* ================ APP SHELL ================ */
/* Desktop layout (≥1181px):
     col 1 (people) | col 2 (topbar/head/main) | col 3 (rail)
   The People rail spans all three rows on the left; the right rail
   spans all three rows on the right. Topbar and page-head stay over
   the central column, so the desktop visual is unchanged from before
   the restructure.
   Mobile layout (≤1180px) collapses to a single column with the
   People rail slotted between page-head and main — matching the
   pre-restructure mobile order. */
.app {
  display: grid;
  grid-template-columns: var(--people-w) 1fr var(--rail-w);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "people topbar rail"
    "people head   rail"
    "people main   rail";
  min-height: 100vh;
}
.people-rail { grid-area: people; }
.topbar      { grid-area: topbar; }
.page-head   { grid-area: head; }
.main        { grid-area: main; }
.rail        { grid-area: rail; }

/* Desktop: People rail mirrors the right rail — sticky column, scrolls
   on its own if the roster grows. The panel inside keeps its full
   card styling; we only override its left/right margin to fit the
   narrower column without feeling cramped. */
.people-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.people-rail .panel { margin: 22px 12px; }
/* Long names should wrap rather than truncate — a narrow sidebar
   ellipsis hides the very information the rail exists to show.
   Scoped to .people-rail so the items table's payer cells (which have
   their own tight grid) keep their nowrap+ellipsis behavior. */
.people-rail .people-list .nm {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

/* Narrower screens: stack the rows. Order matches what the page used
   to look like on mobile: topbar → page-head → People → main → rail. */
@media (max-width: 1180px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas:
      "topbar"
      "head"
      "people"
      "main"
      "rail";
  }
  .people-rail {
    position: static;
    height: auto;
    overflow: visible;
    border-right: none;
    background: transparent;
  }
  .people-rail .panel { margin: 18px 28px; }
  .rail {
    position: static;
    height: auto;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 18px 28px;
  }
}
@media (max-width: 760px) {
  .rail { padding: 18px 16px; }
  .people-rail .panel { margin: 18px 16px; }
}

/* ================ BRAND MARK (used in topbar) ================ */
.brand-mark {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 8px;
  background: var(--hero-grad);
  box-shadow: 0 2px 8px rgba(99, 91, 255, .40), inset 0 1px 0 rgba(255, 255, 255, .4);
  display: grid; place-items: center;
  color: white;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.04em;
}

/* ================ TOPBAR SAVED PILL ================ */
.saved-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  white-space: nowrap;
}
.saved-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(0, 184, 120, .18);
}
/* Error state: a save attempt failed. _set_save_status() in ui.py sets the
   label text + title; the dot/color signal here. The label is kept visible
   on narrow screens (below) so the warning is never color-only. */
.saved-pill.err { color: var(--danger); }
.saved-pill.err .dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(223, 27, 65, .18);
}
@media (max-width: 560px) {
  .saved-pill .saved-label { display: none; }
  .saved-pill.err .saved-label { display: inline; }
}

/* ================ PEOPLE PANEL ================ */
.people-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
}
.people-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  font-size: 14px;
  transition: background 0.12s var(--ease);
}
.people-list li:hover { background: var(--surface-1); }
.people-list .nm {
  color: var(--ink);
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-list .paid {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.people-list .rm {
  width: 26px; height: 26px;
  border: none; background: transparent;
  color: var(--ink-4);
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s var(--ease), background 0.12s var(--ease), color 0.12s var(--ease);
}
.people-list li:hover .rm,
.people-list .rm:focus-visible { opacity: 1; }
.people-list .rm:hover { background: #fdecef; color: var(--danger); }

.row-add-person {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.row-add-person .input { flex: 1; }
.row-add-person .btn { flex: none; }
@media (max-width: 560px) {
  .row-add-person { flex-wrap: wrap; }
  .row-add-person .btn { width: 100%; }
}

/* ================ AVATARS ================ */
.av {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .1), inset 0 1px 0 rgba(255, 255, 255, .2);
  flex: none;
}
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-1 { background: linear-gradient(140deg, #6f8cff, #4f46e5); }
.av-2 { background: linear-gradient(140deg, #ff7eb6, #d946ef); }
.av-3 { background: linear-gradient(140deg, #34d399, #0d9488); }
.av-4 { background: linear-gradient(140deg, #fbbf24, #ea580c); }

/* ================ MAIN ================ */
.main {
  padding: 0;
  min-width: 0;
  background: var(--bg);
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 251, 252, 0.92);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.crumb {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}
.crumb .sep { color: var(--border-strong); margin: 0 4px; }
.crumb b { color: var(--ink); font-weight: 600; }

.boot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 16px;
  color: var(--ink-3);
  font-size: 13px;
}
.boot-spinner {
  width: 16px; height: 16px;
  border: 2.5px solid var(--surface-2);
  border-top-color: var(--indigo);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-head {
  padding: 28px 28px 18px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.page-head h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}
.page-head p {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 14px;
}

/* KPI strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 0 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--sh-1);
}
@media (max-width: 880px) { .kpi-strip { grid-template-columns: 1fr 1fr; } }
.kpi { padding: 16px 18px; border-left: 1px solid var(--border-soft); }
.kpi:first-child { border-left: none; }
@media (max-width: 880px) {
  .kpi:nth-child(3) { border-left: none; border-top: 1px solid var(--border-soft); }
  .kpi:nth-child(4) { border-top: 1px solid var(--border-soft); }
}
.kpi .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 4px;
}
.kpi .v {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.025em;
}
.kpi .v.grad {
  background: var(--hero-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.kpi .sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 2px;
  font-weight: 500;
}

/* Panels */
.panel {
  margin: 18px 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.panel-head {
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-soft);
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.panel-head .desc {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 400;
}
.panel-body { padding: 18px 20px 20px; }

/* Items table */
.table { list-style: none; }
.table-head {
  display: grid;
  grid-template-columns: 36px 1.6fr 1fr 130px 110px 32px;
  gap: 14px;
  padding: 10px 20px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 600;
}
.table-head .num-col { text-align: right; }
.table-row {
  display: grid;
  grid-template-columns: 36px 1.6fr 1fr 130px 110px 32px;
  gap: 14px;
  padding: 12px 20px;
  align-items: center;
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.12s var(--ease);
}
.table-row:hover { background: var(--surface-1); }
.table-row:last-child { border-bottom: none; }
.item-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--indigo-soft);
  color: var(--indigo);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
}
.item-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.item-among {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 1px;
  overflow-wrap: anywhere;
}
.paid-by {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.paid-by .nm {
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.uneven { background: #fff4e8; color: #b45309; }
.table-row .amt {
  font-weight: 600;
  color: var(--ink);
  font-size: 15px;
  letter-spacing: -0.01em;
  text-align: right;
}
.btn-x {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none; background: transparent;
  color: var(--ink-3);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 13px;
  line-height: 1;
}
.btn-x:hover { background: #fdecef; color: var(--danger); }

@media (max-width: 720px) {
  .table-head { display: none; }
  .table-row {
    grid-template-columns: 32px minmax(0, 1fr) auto auto;
    grid-template-areas: none;
    gap: 8px 10px;
    padding: 12px 14px;
    align-items: center;
  }
  /* Hide paid-by and badge to save space on phones; keep the remove
     button so items can still be deleted. */
  .table-row > .paid-by,
  .table-row > .badge-cell { display: none; }
  /* Grid children don't inherit min-width:0 — without this, long item
     titles push past the 1fr column and overflow the panel. */
  .table-row > .body { min-width: 0; }
}

/* Quick form */
.quick-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 880px) {
  /* Linearise the Add-expense panel so the order is:
     Description → Amount → Paid by → Method → Participants → Add → Error.
     `display: contents` lifts the .quick-form children into .panel-body's
     flex layout so `order` can reposition the Add button below extras. */
  .panel-body:has(.quick-form) {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .panel-body:has(.quick-form) .quick-form { display: contents; }
  .panel-body:has(.quick-form) .quick-form > .field { width: 100%; }
  .panel-body:has(.quick-form) > .form-extras {
    order: 1;
    margin-top: 0;
  }
  .panel-body:has(.quick-form) #add-item {
    order: 2;
    width: 100%;
  }
  .panel-body:has(.quick-form) > .error {
    order: 3;
    margin-top: 0;
  }
}
.field { position: relative; }
.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 5px;
}

/* Inputs */
.input {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  font: 500 13.5px/1.4 inherit;
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input::placeholder { color: var(--ink-4); font-weight: 400; }
.input:hover { border-color: #a3adb9; }
.input:focus {
  border-color: var(--indigo);
  box-shadow: var(--focus-ring);
}
select.input {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5l5 5 5-5' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>") no-repeat right 12px center;
  padding-right: 30px;
  cursor: pointer;
}
.input-amount {
  padding-left: 26px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.currency-prefix {
  position: absolute;
  left: 12px; bottom: 10px;
  color: var(--ink-3);
  font-weight: 600;
  pointer-events: none;
  font-size: 13px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font: 600 13px/1 "Inter", sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease),
              box-shadow 0.15s var(--ease), transform 0.05s var(--ease);
  -webkit-appearance: none;
}
.btn:active { transform: translateY(0.5px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn-primary {
  background: var(--indigo);
  color: white;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .06), 0 2px 5px rgba(99, 91, 255, .40), inset 0 1px 0 rgba(255, 255, 255, .15);
}
.btn-primary:hover { background: var(--indigo-2); }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: var(--sh-1);
}
.btn-secondary:hover { background: var(--surface-1); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }

/* Segmented control */
.form-extras {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 720px) { .form-extras { grid-template-columns: 1fr; } }
.extras-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}
.seg {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  background: var(--surface-2);
  border-radius: var(--r-md);
}
.seg label {
  position: relative;
  text-align: center;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  border-radius: calc(var(--r-md) - 3px);
  transition: color 0.15s var(--ease);
}
.seg input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.seg input:checked + .t {
  position: absolute;
  inset: 3px;
  display: grid; place-items: center;
  background: white;
  color: var(--ink);
  border-radius: calc(var(--r-md) - 3px);
  box-shadow: var(--sh-1);
}
.seg label:focus-within { box-shadow: var(--focus-ring); border-radius: var(--r-md); }

/* Participant chips (CSS-only toggle via :has) */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  align-items: center;
}
.chip-row .empty {
  color: var(--ink-3);
  font-size: 12.5px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease), color 0.12s var(--ease);
}
.chip:hover { background: white; border-color: var(--border-strong); }
.chip .p-check {
  position: absolute;
  opacity: 0;
  width: 1px; height: 1px;
  pointer-events: none;
}
.chip .av { width: 22px; height: 22px; font-size: 9px; }
.chip:has(.p-check:checked) {
  background: var(--indigo-soft);
  border-color: rgba(99, 91, 255, 0.25);
  color: var(--indigo);
}
.chip:has(.p-check:checked) .av {
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, .1),
              inset 0 1px 0 rgba(255, 255, 255, .3),
              0 0 0 2px white;
}
.chip:has(.p-check:focus-visible) { box-shadow: var(--focus-ring); }

/* p-weight: hidden by default; visible only when uneven AND chip is on. */
.p-weight {
  width: 56px; height: 26px;
  margin-left: 4px;
  font: 600 12.5px/1 "Inter", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0 8px;
  text-align: right;
  outline: none;
  display: none;
}
.p-weight:focus { border-color: var(--indigo); box-shadow: var(--focus-ring); }
body:has(#mode-uneven:checked) .chip:has(.p-check:checked) .p-weight {
  display: inline-block;
}

/* ================ RIGHT RAIL ================ */
.rail {
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 18px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.rail h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.total-block .lbl {
  font-size: 12px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 6px;
}
.total-block .big {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.total-block .big .currency {
  font-size: 0.5em;
  color: var(--ink-3);
  font-weight: 600;
  vertical-align: 14px;
  margin-right: 4px;
}
.total-block .meta {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
  font-weight: 500;
}

.rail-shares {
  list-style: none;
  display: grid;
  gap: 12px;
}
.rail-shares li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}
.rail-shares .row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}
.rail-shares .nm {
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-shares .a {
  font-weight: 600;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: -0.005em;
}
.rail-shares .bar {
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}
.rail-shares .bar-fill {
  position: absolute; inset: 0;
  background: var(--hero-grad);
  border-radius: 999px;
  transform-origin: left;
  transform: scaleX(0);
  animation: grow 0.9s var(--ease) forwards;
  animation-delay: var(--d, 0ms);
}
@keyframes grow { to { transform: scaleX(var(--scale, 0)); } }

.transfer-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.transfer-card + .transfer-card { margin-top: 6px; }
.transfer-card:hover {
  background: white;
  border-color: var(--indigo);
  box-shadow: var(--sh-2);
}
.transfer-card .from-to {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.from-to .nm {
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
}
.from-to .arr { color: var(--ink-4); }
.transfer-card .amt {
  font-weight: 700;
  color: var(--indigo);
  font-size: 14px;
  letter-spacing: -0.005em;
}

.muted {
  color: var(--ink-3);
  font-size: 13px;
  padding: 16px 0;
  text-align: center;
}
/* Empty-state row inside #people-list must drop the grid so the single
   text node can actually center across the full row. */
.people-list li.muted { display: block; }

.error {
  color: var(--danger);
  font-size: 12px;
  min-height: 1.1em;
  margin-top: 6px;
}

/* ================ MOBILE TWEAKS ================ */
@media (max-width: 760px) {
  .topbar { padding: 14px 16px; }
  .page-head, .panel, .kpi-strip { margin-left: 16px; margin-right: 16px; }
  .page-head { padding: 18px 0; }
}

@media (pointer: coarse) {
  .input { height: 44px; font-size: 15px; }
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }
  .people-list .rm { opacity: 1; width: 28px; height: 28px; }
  .btn-x { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .rail-shares .bar-fill { transform: scaleX(var(--scale, 0)); }
}

/* Production: don't leak Python tracebacks into the page. */
py-script-error, .py-error, .py-error-banner { display: none !important; }
