/* =====================================================================
   Design tokens: "Liquid Glass" style (iOS 26-like), 2026-11-12
   EVERY colour, blur, radius, shadow and timing lives here.
   ===================================================================== */
:root {
  /* Base colours */
  /* Graphite grey with hints of blue (Apple dark mode style), 2026-11-12 */
  --bg: #0b0b0d;                          /* page base and input fields */
  --text: #f5f5f7;                        /* main text */
  --text-muted: rgba(235, 235, 245, 0.6); /* secondary text */
  --accent: #0a84ff;                      /* system blue: primary buttons, links, focus, active tab, selected items */
  --on-accent: #ffffff;                   /* text on blue */
  --accent-soft: rgba(10, 132, 255, 0.22);/* blue-tinted glass (active tab bubble, selections) */
  --accent-edge: rgba(10, 132, 255, 0.55);/* its edge */
  --accent-glow: rgba(10, 132, 255, 0.32);/* soft halo under blue buttons */
  --accent-shine: rgba(255, 255, 255, 0.3); /* top-edge shine on blue buttons */
  --positive: #30d158;                    /* green: gains, done */
  --negative: #ff453a;                    /* red: losses, overdue, errors, delete */
  --border: rgba(255, 255, 255, 0.10);    /* dividers and thin outlines */
  --card: rgba(255, 255, 255, 0.06);      /* light glass fill (no blur), e.g. phone table rows */
  --card-hover: rgba(255, 255, 255, 0.11);

  /* Day score colours (Life → Today wheel). Orange is ONLY used here. */
  --day-good: #30d158;                    /* 80%+ */
  --day-mid: #ff9f0a;                     /* 50–79% */
  --day-bad: #ff453a;                     /* under 50% */
  --day-none: rgba(142, 142, 147, 0.38);  /* nothing logged */
  --day-future: rgba(255, 255, 255, 0.04);/* days still to come */
  --wheel-divider: rgba(28, 28, 30, 0.9);  /* lines between wheel slices */
  --wheel-shine: #ffffff;                 /* glass highlight on the wheel rim / hub (used with low opacity) */
  --lift-shadow: rgba(0, 0, 0, 0.55);      /* shadow under a lifted slice */

  /* Backdrop behind everything (what the glass blurs): near-black to charcoal */
  --backdrop-top: #1c1c1e;
  --backdrop-bottom: #000000;
  --blob-grey: rgba(142, 142, 147, 0.16);
  --blob-blue: rgba(10, 132, 255, 0.09);  /* only a faint hint of blue */
  --blob-graphite: rgba(99, 99, 102, 0.14);

  /* Glass panels: neutral grey tint */
  --glass-fill: rgba(255, 255, 255, 0.07);
  --glass-fill-hover: rgba(255, 255, 255, 0.11);
  --glass-fill-strong: rgba(255, 255, 255, 0.16);
  --glass-tint-dark: rgba(0, 0, 0, 0.38);          /* darker glass behind dense tables */
  --glass-solid: rgba(28, 28, 30, 0.97);           /* no-blur fallback / reduced transparency */
  --glass-pop: rgba(44, 44, 46, 0.66);             /* picker popovers (a bit denser than cards) */
  --glass-sheet: rgba(36, 36, 38, 0.82);           /* phone bottom sheets */
  --scrim: rgba(0, 0, 0, 0.55);                    /* dims the page behind a bottom sheet */
  --photo-backdrop: rgba(0, 0, 0, 0.94);          /* behind a full-screen photo (Journal) */
  --glass-border: rgba(255, 255, 255, 0.14);
  --glass-border-strong: rgba(255, 255, 255, 0.24);
  --glass-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.18);  /* light catching the top edge */
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --glass-shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.28);
  --glass-blur: blur(24px) saturate(180%);
  --glow: rgba(255, 255, 255, 0.12);               /* highlight that follows the mouse on tab bars */
  --tab-glow: rgba(255, 255, 255, 0.45);           /* soft glow on a hovered tab */

  /* Shape */
  --radius: 24px;          /* cards */
  --radius-lg: 28px;       /* modal, side bar */
  --radius-sm: 14px;
  --radius-pill: 999px;    /* buttons, inputs, tabs */

  /* Motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-bubble: 350ms;       /* active-tab bubble slide */
  --t-page: 300ms;         /* page slide in / out */
  --t-hover: 260ms;
  --t-press: 90ms;         /* squish down; springs back over --t-hover */
  --t-drift: 40s;          /* backdrop blobs */
  --page-shift: 40px;      /* how far a page slides */
  --bubble-stretch: 1.18;  /* bubble stretches this much along its path mid-slide */
  --press-scale: 0.97;     /* buttons */
  --tab-press-scale: 0.95;
  --tab-hover-scale: 1.06;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "SF Pro Display", "SF Pro Text", "Inter", system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Backdrop: dark gradient + slow-drifting colour blobs ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: linear-gradient(160deg, var(--backdrop-top), var(--backdrop-bottom) 70%);
}
.blob {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  will-change: transform;
  animation: drift var(--t-drift) ease-in-out infinite alternate;
}
.blob-1 { background: radial-gradient(circle, var(--blob-grey), transparent 65%); top: -28vmax; left: -18vmax; }
.blob-2 { background: radial-gradient(circle, var(--blob-graphite), transparent 65%); bottom: -32vmax; right: -22vmax;
          animation-duration: calc(var(--t-drift) * 1.3); animation-direction: alternate-reverse; }
.blob-3 { background: radial-gradient(circle, var(--blob-blue), transparent 65%); width: 45vmax; height: 45vmax;
          top: 35%; left: 40%; animation-duration: calc(var(--t-drift) * 0.8); }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(9vmax, 6vmax) scale(1.15); }
}

/* ---------- Glass panels ---------- */
.card, .side-tabs, .subnav, .modal-box {
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
}

/* ---------- Tab bars: shared bubble + mouse highlight (added by script.js) ---------- */
.glass-bubble {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  box-shadow: var(--glass-highlight), var(--glass-shadow-sm);
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-hover) ease;
}
.glass-glow {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 0;
  width: 140px;
  height: 140px;
  margin: -70px 0 0 -70px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), transparent 70%);
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-hover) ease, transform 120ms linear;
}
.glowing > .glass-glow { opacity: 1; }

/* ---------- Side tabs (PC): one glass bar that slides out on hover ---------- */
.side-tabs {
  position: fixed;
  top: 50%;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px;
  border-left: none;
  border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
  overflow: hidden;
  z-index: 10;
  /* Hidden state: slide left so only the icons peek out */
  transform: translate(-98px, -50%);
  transition: transform var(--t-bubble) var(--ease-out);
}
.side-tabs:hover,
.side-tabs:focus-within { transform: translate(0, -50%); }

.tab {
  position: relative;
  z-index: 1;              /* above the bubble */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 150px;
  padding: 12px 16px 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), color var(--t-hover) ease;
}
.tab:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: -2px; }

.tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: currentColor;
  transition: fill var(--t-hover) ease;
}

.tab.active { color: var(--text); }
.tab.active .tab-icon { fill: var(--accent); }

/* ---------- Tab hover (mouse only) and press (everyone) ---------- */
@media (hover: hover) {
  .tab:hover, .subnav-link:hover {
    transform: scale(var(--tab-hover-scale));
    color: var(--text);
    text-shadow: 0 0 14px var(--tab-glow);
  }
  .tab:hover .tab-icon { filter: drop-shadow(0 0 6px var(--tab-glow)); }
}
.tab:active, .subnav-link:active {
  transform: scale(var(--tab-press-scale));
  transition-duration: var(--t-press);
  transition-timing-function: ease-out;
}

/* ---------- Pages ---------- */
main {
  position: relative;          /* the outgoing page is positioned against this while it fades */
  overflow-x: clip;            /* sliding pages never cause a sideways scrollbar */
  padding: 32px 32px 32px 88px;   /* left padding leaves room for the tabs */
}

.page { display: none; }
.page.active, .page.leaving { display: block; }
.leaving { position: absolute; pointer-events: none; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.page-header h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Empty placeholder area so the layout is visible */
.content-area {
  min-height: 60vh;
  background: var(--card);
  border: 1px dashed var(--glass-border);
  border-radius: var(--radius);
}

/* ---------- Buttons: glass pills, squish when pressed ---------- */
.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  box-shadow: var(--glass-highlight);
  padding: 9px 18px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), background var(--t-hover) ease, opacity var(--t-hover) ease;
}

.btn:hover { background: var(--glass-fill-hover); }
.btn:active {
  transform: scale(var(--press-scale));
  transition-duration: var(--t-press);
  transition-timing-function: ease-out;
}

/* ---------- Modal ---------- */
.modal {
  position: fixed;
  inset: 0;                 /* cover the whole window */
  display: flex;
  align-items: center;      /* centre the box */
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal[hidden] { display: none; }

/* Dimmed backdrop: the existing page background colour, made see-through */
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: var(--bg);
  opacity: 0.8;
}

.modal-box {
  position: relative;       /* sits above the backdrop */
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;         /* long forms scroll inside the box */
  border-radius: var(--radius-lg);
  padding: 20px 22px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  font: inherit;
  font-size: 22px;
  line-height: 1;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-pill);
}

.modal-close:hover {
  color: var(--text);
  background: var(--card-hover);
}

.modal-muted {
  margin: 0;
  color: var(--text-muted);
}

/* Cards: glass (see "Glass panels" above) with big rounded corners */
.card {
  border-radius: var(--radius);
  padding: 20px 22px;
}

/* =====================================================================
   PnL section
   Colours come only from the variables at the top.
   ===================================================================== */

a { color: var(--accent); }
.muted { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.small { font-size: 12px; }
p.muted { margin: 8px 0; }
.pos { color: var(--positive); }
.neg { color: var(--negative); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Buttons (extra variants) ---------- */
/* Primary action (+ Sale, Save): filled orange */
.btn-primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 600;
  box-shadow: inset 0 1px 0 var(--accent-shine), 0 6px 20px var(--accent-glow);
}
.btn-primary:hover { background: var(--accent); opacity: 0.92; }
.btn-sm { font-size: 13px; padding: 5px 12px; }
.btn-ghost { background: none; border-color: transparent; box-shadow: none; color: var(--text-muted); }
.btn-ghost:hover { background: var(--card-hover); color: var(--text); }
.btn-ghost.danger:hover { color: var(--negative); }
label.btn { display: inline-block; }
.link {
  font: inherit;
  font-size: 12px;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- Sub-tabs: one glass pill bar with a sliding bubble ---------- */
.subnav {
  position: relative;            /* the bubble is positioned inside it */
  display: flex;
  gap: 2px;
  width: fit-content;
  max-width: 100%;
  padding: 5px;
  margin-bottom: 20px;
  border-radius: var(--radius-pill);
  overflow-x: auto;              /* swipe sideways on narrow screens */
  scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav-link {
  position: relative;
  z-index: 1;                    /* above the bubble */
  flex-shrink: 0;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), color var(--t-hover) ease;
}
.subnav-link.active { color: var(--text); }
.subnav-link:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: -2px; }
.pnl-pages { position: relative; }   /* the outgoing sub-page is positioned against this */

/* ---------- Page layout ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.section-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.group-title { font-size: 15px; font-weight: 600; margin: 24px 0 12px; }
.card h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-sub { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.stat .row-actions { margin-top: 10px; justify-content: flex-start; }

.panels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.capital { margin-bottom: 8px; }
.capital-value { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; margin: 6px 0 14px; font-variant-numeric: tabular-nums; }
.panels .capital-value { font-size: 30px; margin-bottom: 4px; }
.capital-parts { display: flex; flex-wrap: wrap; gap: 12px 32px; }
.capital-parts div { display: flex; flex-direction: column; gap: 4px; }
.capital-parts b { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.notice { display: block; margin-bottom: 12px; color: var(--text); text-decoration: none; }
.notice.warn { box-shadow: inset 3px 0 0 var(--negative), var(--glass-highlight), var(--glass-shadow); color: var(--negative); }
.empty { color: var(--text-muted); text-align: center; padding: 32px 22px; margin-bottom: 16px; }
.total-line { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.backup p { margin-top: 0; }

/* Ranked lists with bars (dashboard, expense categories) */
.rank { margin-bottom: 12px; }
.rank-top { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 6px; }
.bar { height: 6px; background: var(--border); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  white-space: nowrap;
}
.badge.warn { color: var(--negative); border-color: var(--negative); }

/* ---------- Tables ---------- */
.table-card { padding: 4px 0; overflow-x: auto; margin-bottom: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl th.num { text-align: right; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.overdue td:first-child { box-shadow: inset 3px 0 0 var(--negative); }
/* Tap a row to open it (edit sheet with Delete at the bottom) */
.tbl tr.tap { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background var(--t-hover) ease; }
.tbl tr.tap:hover { background: var(--card-hover); }
.tbl tr.tap:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: -2px; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
td.actions { width: 1%; white-space: nowrap; }

.history { margin-bottom: 16px; }
.history summary { cursor: pointer; color: var(--text-muted); font-size: 14px; padding: 8px 0 12px; }
.history summary:hover { color: var(--text); }

/* ---------- Forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form p { margin: 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; color: var(--text-muted); }
.field-hint { font-size: 12px; color: var(--text-muted); }
.field input, .field select, .field textarea, .bill input {
  font: inherit;
  font-size: 15px;
  width: 100%;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  color-scheme: dark;            /* dark date pickers and dropdowns */
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .bill input:focus { outline: none; border-color: var(--accent); }
.form-error { color: var(--negative); font-size: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-extra { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
  color: var(--text-muted);
}
.preview:empty { display: none; }

/* "Count by bills" on the Add / Spend money form: compact grid, 3 across even on phones */
.bills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bill { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-muted); min-width: 0; }
/* Quick sale: big button on the Dashboard, qty stepper, roomy preview */
.btn-big { display: block; width: 100%; max-width: 320px; font-size: 18px; padding: 14px 20px; border-radius: var(--radius-pill); margin-bottom: 16px; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.stepper .btn { font-size: 22px; padding: 0; }
.stepper input { text-align: center; }
.more summary { cursor: pointer; color: var(--text-muted); font-size: 14px; }
.more summary:hover { color: var(--text); }
.more .form { margin-top: 12px; }
.preview.big { font-size: 16px; }
.preview.big b { font-size: 18px; }

/* Monthly net profit chart (Dashboard) */
.chart-card { margin-bottom: 8px; }
.chart { display: block; max-width: 100%; overflow: visible; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-pos { fill: var(--positive); }
.chart-neg { fill: var(--negative); }
.chart-col path { opacity: 0.55; transition: opacity 0.15s ease; }
.chart-col.sel path { opacity: 1; }
.chart-col.sel .chart-label { fill: var(--text); }
.chart-zero { stroke: var(--border); stroke-width: 1; }
.chart-label { fill: var(--text-muted); font-size: 11px; font-family: inherit; }
.chart-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.chart-detail .preview { margin-top: 6px; }

/* Tick box (e.g. "Paid later" on the sale form) */
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
[data-later-fields][hidden], [data-account-wrap][hidden] { display: none; }

/* Price tiers: rows in the product form, lines in the Products table */
.tier-rows { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; }
/* One grid for all of a product's tiers, so the columns line up: range, price, total, margin */
.tier-list { display: grid; grid-template-columns: repeat(4, max-content); gap: 4px 12px; font-size: 13px; font-variant-numeric: tabular-nums; }
.tier-line { display: contents; }
.tier-line .muted { margin: 0; }

.preview b { color: var(--text); font-weight: 600; }
.preview b.pos { color: var(--positive); }
.preview b.neg { color: var(--negative); }

.filters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filters .field { width: 200px; }

/* ---------- Accounts page ---------- */
/* Hero card: overall balance, ⋯ menu, Cash / Bank tiles (tap = filter history) */
.acct-hero-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-icon { font-size: 18px; line-height: 1; padding: 6px 12px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 5;
  min-width: 170px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--glass-solid);
}
.menu-item {
  font: inherit;
  font-size: 14px;
  display: block;
  width: 100%;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
}
.menu-item:hover { background: var(--glass-fill-hover); }
.acct-hero .capital-value { margin-bottom: 16px; }
.acct-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.acct-tile {
  font: inherit;
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  color: var(--text);
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  box-shadow: var(--glass-highlight);
  padding: 14px 16px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), background var(--t-hover) ease;
}
.acct-tile b { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.acct-tile:hover { background: var(--glass-fill-hover); }
.acct-tile:active { transform: scale(var(--press-scale)); transition-duration: var(--t-press); }
.acct-tile.active { background: var(--accent-soft); border-color: var(--accent-edge); }
/* Three actions in one row */
.acct-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 4px; }

/* Filter chips (All / Cash / Bank) */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--text); background: var(--glass-fill-hover); }
.chip.active { color: var(--text); background: var(--accent-soft); border-color: var(--accent-edge); }

/* History: rows grouped under date headers; tap a row to edit it */
.hist { padding: 4px 0 8px; margin-bottom: 12px; }
.hist-date { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 14px 22px 4px; }
.hist-row {
  font: inherit;
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  color: var(--text);
  background: none;
  border: none;
  padding: 9px 22px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.hist-row:hover { background: var(--card-hover); }
.hist-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 16px;
  border-radius: 50%;
  background: var(--glass-fill);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}
.hist-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-note { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); min-width: 0; }
.hist-amt { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.show-more { display: flex; justify-content: center; margin-bottom: 8px; }

/* Forms: Cash / Bank pill picker, Move direction with swap, Delete on the left */
.seg {
  display: inline-flex;
  gap: 2px;
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
}
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; padding: 7px 18px; border-radius: var(--radius-pill); font-size: 14px; color: var(--text-muted); cursor: pointer; }
.seg input:checked + span { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-edge); }
.seg input:focus-visible + span { outline: 2px solid var(--glass-border-strong); }
.move-pick { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.move-acct { text-align: center; padding: 9px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font-size: 15px; }
.form-delete { margin-right: auto; }
[data-bills][hidden], [data-from-field][hidden] { display: none; }

.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

/* =====================================================================
   Glass pickers (pickers.js): select, date, time. Used in every form.
   ===================================================================== */
.gp { position: relative; display: block; min-width: 0; }
.gp-value {                        /* the real value, invisible; sits over the field for "required" bubbles */
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; border: 0; padding: 0;
}
.gp-field {
  font: inherit;
  font-size: 15px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color var(--t-hover) ease, background var(--t-hover) ease;
}
.gp-field:hover { background: var(--card); }
.gp-field:focus-visible, .gp-open .gp-field { outline: none; border-color: var(--accent); }
.gp-field.gp-invalid { border-color: var(--negative); }
.gp-field svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--text-muted); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.gp-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-placeholder { color: var(--text-muted); }
.filters .gp-field, .gp-compact .gp-field { background: var(--glass-fill); border-color: var(--glass-border); border-radius: var(--radius-pill); }

/* Clear layer behind an open picker: catches the outside tap (dimmed on phone) */
.gp-scrim { position: fixed; inset: 0; z-index: 200; }
.gp-scrim.gp-dim { background: var(--scrim); }

/* The glass popover itself */
.gp-pop {
  position: fixed;
  z-index: 201;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--glass-pop);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-strong);
  box-shadow: var(--glass-highlight), var(--glass-shadow);
  color: var(--text);
}
.gp-pop-date, .gp-pop-time { padding: 12px; border-radius: var(--radius); }

/* Select */
.gp-search { padding: 2px 2px 6px; }
.gp-search input {
  font: inherit; font-size: 15px; width: 100%;
  color: var(--text); background: var(--glass-fill); border: 1px solid var(--glass-border);
  border-radius: var(--radius-pill); padding: 8px 14px; outline: none;
}
.gp-search input:focus { border-color: var(--accent); }
.gp-list { max-height: min(320px, 52vh); overflow-y: auto; outline: none; overscroll-behavior: contain; }
.gp-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 15px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, transform var(--t-press) ease-out;
}
.gp-opt.active { background: var(--glass-fill-hover); }
.gp-list:focus-visible .gp-opt.active { box-shadow: inset 0 0 0 1px var(--glass-border-strong); }
.gp-opt:active { background: var(--glass-fill-strong); transform: scale(0.985); }
.gp-opt.sel { font-weight: 600; }
.gp-check { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.gp-none { padding: 14px 12px; color: var(--text-muted); font-size: 14px; }

/* Date */
.gp-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.gp-cal-title { font-size: 15px; font-weight: 600; }
.gp-nav {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: none; border: none; color: var(--text); cursor: pointer;
}
.gp-nav:hover, .gp-nav:focus-visible { background: var(--glass-fill-hover); outline: none; }
.gp-nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gp-cal-week, .gp-cal-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.gp-cal-week span { text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 4px 0; }
.gp-cal-clip { overflow: hidden; }
.gp-day {
  font: inherit; font-size: 14px; font-variant-numeric: tabular-nums;
  aspect-ratio: 1; width: 100%; max-height: 42px; margin: 1px 0;
  display: grid; place-items: center;
  color: var(--text); background: none; border: none; border-radius: 50%; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 120ms ease, transform var(--t-hover) var(--ease-spring);
}
.gp-day:hover { background: var(--glass-fill-hover); }
.gp-day:active { transform: scale(0.9); transition-duration: var(--t-press); }
.gp-day:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: -2px; }
.gp-day.out { color: var(--text-muted); opacity: 0.55; }
.gp-day.today { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--accent); font-weight: 600; }
.gp-day.sel { background: var(--accent); color: var(--on-accent); font-weight: 700; box-shadow: 0 0 0 0 transparent, 0 4px 14px var(--accent-glow); opacity: 1; }
.gp-day:disabled { opacity: 0.25; cursor: default; }
.gp-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.gp-chips .chip, .gp-time-actions .chip { font-size: 13px; padding: 6px 12px; }
.gp-clear { margin-left: auto; }

/* Time: two scroll wheels with a highlighted middle band */
.gp-time {
  position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  height: 200px; perspective: 600px;
  -webkit-mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
  mask-image: linear-gradient(transparent, #000 28%, #000 72%, transparent);
}
.gp-band {
  position: absolute; left: 0; right: 0; top: 80px; height: 40px;
  border-radius: 10px; background: var(--glass-fill-hover); border: 1px solid var(--glass-border);
  pointer-events: none;
}
.gp-wheel {
  position: relative; height: 200px; overflow-y: auto; scroll-snap-type: y mandatory;
  scrollbar-width: none; outline: none; overscroll-behavior: contain;
  transform-style: preserve-3d;
}
.gp-wheel::-webkit-scrollbar { display: none; }
.gp-wheel:focus-visible .gp-wheel-item.on { color: var(--accent); }
.gp-wheel-pad { height: 80px; }
.gp-wheel-item {
  height: 40px; line-height: 40px; text-align: center; scroll-snap-align: center;
  font-size: 22px; font-variant-numeric: tabular-nums; color: var(--text-muted); cursor: pointer;
  backface-visibility: hidden;
}
.gp-wheel-item.on { color: var(--text); font-weight: 600; }
.gp-colon { font-size: 22px; font-weight: 600; padding: 0 4px; position: relative; }
.gp-time-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.gp-time-actions .gp-clear { margin-left: 0; }
.gp-spacer { flex: 1; }

/* Phone: every picker is a bottom sheet */
.gp-pop.gp-sheet {
  left: 0; right: 0; bottom: 0; top: auto; width: auto;
  max-height: 82vh; overflow-y: auto;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  border-bottom: none;
  background: var(--glass-sheet);
}
.gp-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--glass-border-strong); margin: 0 auto 10px; }
.gp-title { font-size: 15px; font-weight: 600; text-align: center; margin-bottom: 10px; }
.gp-sheet .gp-list { max-height: 60vh; }
.gp-sheet .gp-opt { padding: 13px 14px; font-size: 16px; }
.gp-sheet .gp-day { max-height: 48px; font-size: 16px; }
.gp-sheet .gp-time { max-width: 320px; margin: 0 auto; }

/* =====================================================================
   Life section (life.js). Calm: big key number, lists, lots of space.
   ===================================================================== */
.lf-page { padding-bottom: 24px; }
.lf-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 8px 0 28px; }
.lf-hero { min-width: 0; flex: 1; border-radius: var(--radius); }
.lf-hero.lf-tap { cursor: pointer; padding: 10px 14px; margin: -10px -14px; transition: background var(--t-hover) ease; }
.lf-hero.lf-tap:hover { background: var(--card); }
.lf-hero.lf-tap:focus-visible { outline: 2px solid var(--glass-border-strong); }
.lf-big { font-size: 52px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin-top: 6px; font-variant-numeric: tabular-nums; }
.lf-of { color: var(--text-muted); font-weight: 600; font-size: 0.6em; }
.lf-unit { color: var(--text-muted); font-weight: 600; font-size: 0.45em; margin-left: 4px; letter-spacing: 0; }
.lf-sub { color: var(--text-muted); font-size: 14px; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.lf-bar { max-width: 320px; margin-top: 12px; }
.bar span.pos-fill { background: var(--positive); }
.lf-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.lf-chip {
  font: inherit; font-size: 13px; color: var(--text); cursor: pointer;
  background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill); padding: 3px 10px;
}
.lf-chip:hover { background: var(--glass-fill-hover); }
.lf-group { display: flex; align-items: center; gap: 8px; margin-top: 28px; }
.lf-group .badge { font-weight: 500; }

/* Lists of tappable rows */
.lf-list { padding: 6px 0; margin-bottom: 8px; }
.lf-row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 11px 22px; cursor: pointer; position: relative;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-hover) ease;
}
.lf-row:not(:has(.lf-lead)) { grid-template-columns: 1fr auto; }
.lf-row + .lf-row::before { content: ""; position: absolute; top: 0; left: 22px; right: 22px; border-top: 1px solid var(--border); }
.lf-row:hover { background: var(--card-hover); }
.lf-row:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: -2px; }
.lf-row.overdue { box-shadow: inset 3px 0 0 var(--negative); }
.lf-row.done .lf-title { color: var(--text-muted); }
.lf-row.task.done .lf-title { text-decoration: line-through; }
.lf-lead { display: flex; align-items: center; justify-content: center; min-width: 30px; }
.lf-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lf-title { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-meta { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-trail { font-size: 14px; font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lf-trail .muted { font-weight: 400; }
.lf-emoji { margin-right: 8px; }
.lf-big-emoji { font-size: 22px; line-height: 1; }
.lf-flag { color: var(--negative); }
.lf-code {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted);
  border: 1px solid var(--glass-border); border-radius: 8px; padding: 4px 6px; min-width: 40px; text-align: center;
}

/* Round tick button */
.lf-tick {
  width: 30px; height: 30px; border-radius: 50%; padding: 0; flex-shrink: 0;
  display: grid; place-items: center; cursor: pointer;
  background: none; border: 1.5px solid var(--glass-border-strong);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-hover) var(--ease-spring);
}
.lf-tick svg { width: 18px; height: 18px; fill: none; stroke: var(--bg); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0; transform: scale(0.5); transition: opacity 150ms ease, transform var(--t-hover) var(--ease-spring); }
.lf-tick:hover { border-color: var(--positive); }
.lf-tick:active { transform: scale(0.85); transition-duration: var(--t-press); }
.lf-tick.on { background: var(--positive); border-color: var(--positive); }
.lf-tick.on svg { opacity: 1; transform: none; }
.lf-tick:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: 2px; }

/* Today: quick sleep log */
.lf-sleep { margin-bottom: 8px; }
.lf-sleep-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.lf-sleep-head h3 { margin: 0; }
.lf-sleep-hours { font-size: 20px; font-variant-numeric: tabular-nums; }
.lf-sleep-times { margin-bottom: 14px; }
.lf-quality { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 8px; }
.lf-q {
  position: relative;
  font: inherit; color: var(--text-muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px;
  background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-hover) ease, transform var(--t-hover) var(--ease-spring);
}
.lf-q span { font-size: 24px; line-height: 1; }
.lf-q small { font-size: 11px; }
.lf-q:hover { background: var(--glass-fill-hover); color: var(--text); }
.lf-q:active { transform: scale(0.92); transition-duration: var(--t-press); }
.lf-q.on, .lf-q:has(input:checked) { background: var(--accent-soft); color: var(--text); border-color: var(--accent-edge); }
.lf-q input { position: absolute; opacity: 0; pointer-events: none; }
.lf-q:has(input:focus-visible) { outline: 2px solid var(--glass-border-strong); }
.lf-quality-pick { margin-bottom: 0; }

.lf-collapse { margin-top: 20px; }
/* Day score colours */
.lf-score { font-weight: 700; }
.lf-score-good { color: var(--day-good); }
.lf-score-mid { color: var(--day-mid); }
.lf-score-bad { color: var(--day-bad); }
.lf-score-none, .lf-score-future { color: var(--text-muted); }
.lf-checks { display: flex; flex-direction: column; gap: 10px; }

/* Today: month wheel (one slice per day, coloured by day score) */
.lf-head-today { margin-bottom: 16px; }
.lf-today-date { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.lf-wheel-card { padding: 16px 12px 18px; margin-bottom: 14px; }
.lf-wheel-wrap { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; }
.lf-wheel { max-width: 380px; width: 100%; margin: 0 auto; border-radius: 50%; outline: none; touch-action: pan-y; }
.lf-wheel:focus-visible { box-shadow: 0 0 0 2px var(--accent-edge); }
.lf-wheel-svg { display: block; width: 100%; height: auto; overflow: visible; }
.lf-wheel-arrow {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; padding: 0; cursor: pointer;
  color: var(--text); background: var(--glass-fill); border: 1px solid var(--glass-border);
  transition: background var(--t-hover) ease, transform var(--t-hover) var(--ease-spring);
}
.lf-wheel-arrow:hover { background: var(--glass-fill-hover); }
.lf-wheel-arrow:active { transform: scale(0.9); }
.lf-wheel-arrow:focus-visible { outline: 2px solid var(--accent); }
.lf-wheel-arrow svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lf-wheel-rot { transform-box: view-box; transform-origin: 50% 50%; }
.lf-wheel-rim { fill: none; stroke: url(#lfWheelRim); stroke-width: 7; }
.lf-rim-hi { stop-color: var(--accent); stop-opacity: 0.55; }
.lf-rim-mid { stop-color: var(--wheel-shine); stop-opacity: 0.12; }
.lf-rim-lo { stop-color: var(--wheel-shine); stop-opacity: 0.05; }
.lf-wheel-hub { fill: url(#lfWheelCentre); stroke: var(--accent-edge); stroke-width: 1; }
.lf-wc-hi { stop-color: var(--wheel-shine); stop-opacity: 0.13; }
.lf-wc-lo { stop-color: var(--wheel-shine); stop-opacity: 0.03; }
.lf-slice { cursor: pointer; transition: transform 420ms var(--ease-spring); -webkit-tap-highlight-color: transparent; }
.lf-slice path { stroke: var(--wheel-divider); stroke-width: 1.5; transition: fill 700ms ease, opacity 200ms ease; }
.lf-slice:hover path { opacity: 0.85; }
.wd-good path { fill: var(--day-good); }
.wd-mid path { fill: var(--day-mid); }
.wd-bad path { fill: var(--day-bad); }
.wd-none path { fill: var(--day-none); }
.wd-future path { fill: var(--day-future); }
.wd-future { cursor: default; }
.lf-slice.today { transform: translate(var(--tx), var(--ty)); }
.lf-slice.today path { stroke: var(--accent); stroke-width: 2.5; }
.lf-slice.sel { transform: translate(var(--lx), var(--ly)); }
.lf-slice.sel path { filter: drop-shadow(0 3px 6px var(--lift-shadow)); }
.lf-wheel-num { fill: var(--text-muted); font-size: 10px; font-family: inherit; font-variant-numeric: tabular-nums; pointer-events: none; }
.lf-slice.today .lf-wheel-num { fill: var(--accent); font-weight: 700; }
.lf-slice.sel .lf-wheel-num { fill: var(--text); font-weight: 700; }
.lf-wheel-month { fill: var(--text); font-size: 17px; font-weight: 700; font-family: inherit; }
.lf-wheel-sum { fill: var(--text-muted); font-size: 10.5px; font-family: inherit; }
.wt-good { fill: var(--day-good); font-weight: 700; }
.wt-mid { fill: var(--day-mid); font-weight: 700; }
.wt-bad { fill: var(--day-bad); font-weight: 700; }
.lf-wheel-detail { margin-top: 10px; padding: 12px 10px 0; border-top: 1px solid var(--border); min-height: 52px; }
.lf-wheel-hint { margin: 6px 0 0; text-align: center; color: var(--text-muted); font-size: 13px; }
.lf-wheel-day { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lf-wheel-score { font-size: 26px; font-weight: 700; margin: 2px 0 4px; }
.lf-wheel-score .muted { font-size: 16px; font-weight: 500; }
.lf-update-btn { max-width: none; margin-bottom: 8px; }

/* "Update my day": full glass sheet, one step per screen */
.modal-box.lf-ci-box { max-width: 620px; height: min(780px, calc(100vh - 32px)); display: flex; flex-direction: column; overflow: hidden; }
.lf-ci-box .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lf-ci { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.lf-ci-dots { display: flex; gap: 4px; justify-content: space-between; }
.lf-ci-dot {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; cursor: pointer;
  font: inherit; color: var(--text-muted); background: none; border: none; -webkit-tap-highlight-color: transparent;
}
.lf-ci-dot span { width: 100%; height: 4px; border-radius: 999px; background: var(--glass-fill-strong); transition: background var(--t-hover) ease; }
.lf-ci-dot small { font-size: 11px; }
.lf-ci-dot.past span { background: var(--accent-edge); }
.lf-ci-dot.on span { background: var(--accent); }
.lf-ci-dot.on small { color: var(--text); font-weight: 600; }
.lf-ci-dot:focus-visible { outline: 2px solid var(--accent); border-radius: 8px; }
.lf-ci-clip { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px; }
.lf-ci-step { display: flex; flex-direction: column; gap: 16px; padding: 4px 0 8px; }
.lf-ci-head h3 { margin: 6px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.lf-ci-head p { margin: 6px 0 0; }
.lf-ci-nav { display: flex; align-items: center; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.lf-ci-nav .btn-primary { min-width: 110px; }
.lf-ci-habit { cursor: pointer; }
.lf-ci-task { grid-template-columns: auto 1fr auto; }
.lf-ci-task .btn { white-space: nowrap; }
.lf-ci-yesno { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lf-ci-big { font-size: 18px; padding: 18px; border-radius: var(--radius); }
.lf-ci-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lf-ci-std { display: grid; grid-template-columns: 1fr minmax(150px, 190px); gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.lf-ci-summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.lf-ci-wheel { max-width: 280px; width: 100%; margin: 0 auto; }
.lf-ci-result .lf-big { font-size: 56px; }
.lf-ci-parts { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.lf-ci-part { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--border); }
.lf-in-sheet { background: none; border: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; padding: 0; }
.lf-in-sheet .lf-row { padding-left: 4px; padding-right: 4px; }
.lf-in-sheet .lf-row + .lf-row::before { left: 4px; right: 4px; }

/* Three small numbers in a sheet (streak / best / 30 days) */
.lf-stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.lf-stats3 > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--glass-fill); border: 1px solid var(--glass-border); }
.lf-stats3 b { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Habit heatmap: 12 week columns × 7 days */
.lf-hm { --cell: 20px; overflow-x: auto; }
.lf-hm-months, .lf-hm-grid { display: grid; grid-template-columns: repeat(12, var(--cell)); gap: 4px; }
.lf-hm-months { margin-left: 22px; margin-bottom: 4px; font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.lf-hm-months span { overflow: visible; }
.lf-hm-body { display: flex; gap: 6px; }
.lf-hm-days { display: grid; grid-template-rows: repeat(7, var(--cell)); gap: 4px; width: 16px; font-size: 10px; color: var(--text-muted); line-height: var(--cell); }
.lf-hm-col { display: grid; grid-template-rows: repeat(7, var(--cell)); gap: 4px; }
.lf-hm-cell {
  width: var(--cell); height: var(--cell); padding: 0; border-radius: 6px; cursor: pointer;
  background: var(--glass-fill-hover); border: 1px solid transparent;
  transition: background 120ms ease, transform var(--t-hover) var(--ease-spring);
}
.lf-hm-cell:hover { border-color: var(--glass-border-strong); }
.lf-hm-cell:active { transform: scale(0.85); }
.lf-hm-cell:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: 1px; }
.lf-hm-cell.off { background: var(--card); opacity: 0.5; }
.lf-hm-cell.done { background: var(--positive); opacity: 1; }
.lf-hm-cell.today { border-color: var(--accent); }
.lf-hm-cell.future { background: none; cursor: default; }
.lf-emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: -4px; }
.lf-emoji-pick .chip { font-size: 16px; padding: 4px 9px; }
.seg { flex-wrap: wrap; }

/* Plans: goal cards */
.lf-goals { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 8px; }
.lf-goal { cursor: pointer; display: flex; flex-direction: column; gap: 12px; transition: background var(--t-hover) ease, transform var(--t-hover) var(--ease-spring); }
.lf-goal:hover { background: var(--glass-fill-hover); }
.lf-goal:active { transform: scale(var(--press-scale)); transition-duration: var(--t-press); }
.lf-goal:focus-visible { outline: 2px solid var(--glass-border-strong); }
.lf-goal-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.lf-goal-title { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lf-goal-top b { font-size: 20px; font-variant-numeric: tabular-nums; }
.lf-goal-meta { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); }
.lf-goal-hero .lf-big { font-size: 44px; margin: 0 0 10px; }
.lf-goal-hero .lf-sub { margin-top: 10px; }
.lf-inline { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.lf-inline:has(> .field + .field) { grid-template-columns: 1fr 1fr auto; }
.lf-chart-box { min-height: 40px; }
.more .form { margin-top: 12px; }
[data-number][hidden] { display: none; }

/* School: credits split into Excellence / Merit / Achieved (shades of green) */
.lf-credit { display: flex; flex-direction: column; gap: 10px; padding: 4px 0 18px; }
.lf-credit + .lf-credit { border-top: 1px solid var(--border); padding-top: 18px; }
.lf-stack { display: flex; height: 10px; border-radius: 999px; background: var(--border); overflow: hidden; }
.lf-stack span, .lf-legend i { background: var(--positive); }
.lf-stack .m, .lf-legend i.m { opacity: 0.7; }
.lf-stack .a, .lf-legend i.a { opacity: 0.42; }
.lf-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-muted); }
.lf-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.lf-legend b { color: var(--text); font-weight: 600; margin-left: 2px; }

/* Fitness: workout form */
.lf-pr { color: var(--positive); font-weight: 600; font-size: 13px; }
.lf-ex { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; margin-bottom: 10px; border-radius: var(--radius-sm); background: var(--glass-fill); border: 1px solid var(--glass-border); transition: border-color var(--t-hover) ease; }
.lf-ex.is-pr { border-color: var(--positive); }
.lf-ex-head { display: flex; align-items: center; gap: 10px; }
.lf-ex-head b { font-size: 15px; }
.lf-ex-head .muted { margin: 0 0 0 auto; }
.lf-ex-head .btn { padding: 4px 9px; }
.lf-set { display: grid; grid-template-columns: 18px 1fr auto 1fr auto auto; align-items: center; gap: 8px; }
.lf-set-n { font-size: 12px; color: var(--text-muted); text-align: center; font-variant-numeric: tabular-nums; }
.lf-set input {
  font: inherit; font-size: 15px; width: 100%; min-width: 0; text-align: center;
  color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 8px 6px;
}
.lf-set input:focus { outline: none; border-color: var(--accent); }
.lf-set .muted { margin: 0; }
.lf-ex > .btn { align-self: flex-start; }
.lf-add-ex { display: flex; flex-direction: column; gap: 10px; }
[data-gym] { display: flex; flex-direction: column; gap: 10px; }
[data-gym][hidden], [data-new-ex][hidden] { display: none; }
[data-copy-last] { align-self: flex-start; font-size: 14px; }

/* Bar chart extras (sleep, workouts per week) */
.lf-bar-muted { fill: var(--text-muted); }
.lf-bar-empty { fill: var(--border); }
.lf-page .chart-card { margin-bottom: 8px; }
.lf-page .chart-detail { min-height: 22px; }

/* Line chart */
.lf-line-path { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.lf-dot { fill: var(--bg); stroke: var(--accent); stroke-width: 2; }
.lf-target { stroke: var(--positive); stroke-width: 1.5; stroke-dasharray: 5 5; opacity: 0.8; }
.lf-pace { stroke: var(--text-muted); stroke-width: 1.5; stroke-dasharray: 2 5; opacity: 0.7; }
.lf-line-last { fill: var(--text); font-size: 12px; font-weight: 600; font-family: inherit; }
[data-days][hidden], [data-times][hidden] { display: none; }
.lf-toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 0);
  z-index: 300; max-width: calc(100vw - 32px);
  padding: 11px 20px; border-radius: var(--radius-pill); font-size: 14px; font-weight: 500;
  background: var(--glass-pop); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-strong); box-shadow: var(--glass-highlight), var(--glass-shadow);
}
/* "Update available, tap to refresh" (script.js): same glass pill, but a button that stays until tapped */
.update-toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom)); transform: translate(-50%, 0);
  z-index: 310; max-width: calc(100vw - 32px); min-height: 44px; white-space: nowrap; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--text);
  padding: 11px 20px; border-radius: var(--radius-pill);
  background: var(--glass-pop); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--accent-edge); box-shadow: var(--glass-highlight), var(--glass-shadow), 0 0 0 4px var(--accent-soft);
  -webkit-tap-highlight-color: transparent;
}
.update-toast:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Export on phones: "Backup ready" with its size, then one button that opens the share sheet */
.bk-ready { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0 4px; text-align: center; }
.bk-size { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-bottom: 14px; }
.bk-ready .bk-share { width: 100%; max-width: 320px; }

/* =====================================================================
   Journal section (journal.js): song of the week + saved feed
   Cards in the grid are light glass WITHOUT blur (many blurred panels
   would make phones slow); sheets and the mini-player use real glass.
   ===================================================================== */
#journal-root { padding-bottom: 24px; }
.jr-head { margin-top: 28px; }

/* Filter row: chips, tag picker, search */
.jr-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.jr-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.jr-chips { margin: 0; }
.jr-tag-filter .gp-field { font-size: 13px; font-weight: 500; padding: 5px 12px; background: none; border-color: var(--glass-border); border-radius: var(--radius-pill); color: var(--text-muted); }
.jr-tag-filter.on .gp-field { color: var(--text); background: var(--accent-soft); border-color: var(--accent-edge); }
.jr-tag-filter .gp-field svg { width: 14px; height: 14px; }
.jr-search {
  margin-left: auto; display: flex; align-items: center; gap: 8px; width: 220px; max-width: 100%;
  padding: 6px 14px; border-radius: var(--radius-pill); background: var(--glass-fill); border: 1px solid var(--glass-border);
}
.jr-search:focus-within { border-color: var(--accent); }
.jr-search svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }
.jr-search input { font: inherit; font-size: 14px; color: var(--text); background: none; border: none; outline: none; width: 100%; min-width: 0; padding: 0; }

/* Song of the week: "now playing" card */
.jr-song { padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.jr-song-top { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 16px; }
.jr-cover {
  width: 96px; height: 96px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; display: grid; place-items: center;
  background: var(--card); border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow-sm);
}
.jr-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.jr-cover-empty { background: var(--accent-soft); border-color: var(--accent-edge); }
.jr-cover-empty svg, .jr-cover svg { width: 40%; height: 40%; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jr-cover-sm { width: 40px; height: 40px; border-radius: 10px; box-shadow: none; }
.jr-song-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; border-radius: var(--radius-sm); }
.jr-song-info[role=button] { cursor: pointer; }
.jr-song-info:focus-visible { outline: 2px solid var(--glass-border-strong); outline-offset: 4px; }
.jr-song-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-song-title.muted-title { color: var(--text-muted); font-weight: 600; }
.jr-song-artist { font-size: 15px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-song-play {
  width: 56px; height: 56px; border-radius: 50%; padding: 0; cursor: pointer; display: grid; place-items: center; flex-shrink: 0;
  background: var(--glass-fill-strong); border: 1px solid var(--glass-border-strong); box-shadow: var(--glass-highlight), var(--glass-shadow-sm);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), background var(--t-hover) ease;
}
.jr-song-play svg { width: 24px; height: 24px; fill: var(--text); }
.jr-song-play.on { background: var(--accent-soft); border-color: var(--accent-edge); }
.jr-song-play:not(.on) svg { margin-left: 3px; }
.jr-song-play:hover { background: var(--glass-fill-hover); }
.jr-song-play.on:hover { background: var(--accent-soft); }
.jr-song-play:active { transform: scale(0.9); transition-duration: var(--t-press); }
.jr-song-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.jr-seekrow { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.jr-time { font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 34px; }
.jr-time:last-child { text-align: right; }
.jr-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0; background: none; cursor: pointer; }
.jr-seek::-webkit-slider-runnable-track { height: 5px; border-radius: var(--radius-pill); background: var(--glass-fill-strong); }
.jr-seek::-moz-range-track { height: 5px; border-radius: var(--radius-pill); background: var(--glass-fill-strong); }
.jr-seek::-moz-range-progress { height: 5px; border-radius: var(--radius-pill); background: var(--accent); }
.jr-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -5px; border-radius: 50%; background: var(--text); box-shadow: var(--glass-shadow-sm); }
.jr-seek::-moz-range-thumb { width: 15px; height: 15px; border: none; border-radius: 50%; background: var(--text); }
.jr-seek:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-pill); }
.jr-song-embed:empty { display: none; }
.jr-song-embed iframe { display: block; width: 100%; border: 0; border-radius: var(--radius-sm); background: var(--bg); }
.jr-song-note { font-size: 14px; line-height: 1.5; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 12px; border-left: 2px solid var(--accent-edge); }
.jr-song-back { align-self: flex-start; font-size: 13px; text-decoration: none; }
.jr-prev-weeks { margin: 10px 0 0; }
.jr-prev-weeks .lf-list { margin-bottom: 0; }
.jr-song-row .lf-lead { min-width: 40px; }

/* Song form: audio / cover file buttons */
.jr-filepick { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.jr-filepick[hidden], [data-src-link][hidden] { display: none; }
.jr-pickbtn {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; font-size: 14px;
  padding: 10px 14px; border-radius: var(--radius-sm); background: var(--bg); border: 1px dashed var(--glass-border-strong);
}
.jr-pickbtn:hover { background: var(--card); }
.jr-pickbtn:focus-within { border-color: var(--accent); }
.jr-pickbtn > svg { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jr-pickbtn > span:not(.jr-cover) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-pickcover { color: var(--text-muted); }

/* Mini-player: docked while a Journal song plays on another tab */
.jr-mini {
  position: fixed; right: 24px; bottom: 24px; z-index: 50; width: 340px; max-width: calc(100vw - 32px);
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px; padding: 8px 8px 10px; overflow: hidden;
  border-radius: var(--radius); background: var(--glass-pop);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-strong); box-shadow: var(--glass-highlight), var(--glass-shadow);
}
.jr-mini[hidden] { display: none; }
.jr-mini-open {
  font: inherit; color: var(--text); background: none; border: none; cursor: pointer; text-align: left; min-width: 0;
  display: flex; align-items: center; gap: 10px; padding: 2px 6px 2px 2px; border-radius: var(--radius-sm);
  -webkit-tap-highlight-color: transparent;
}
.jr-mini-open:focus-visible, .jr-mini-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.jr-mini-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.jr-mini-text b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-mini-text span { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-mini-btn {
  width: 40px; height: 40px; border-radius: 50%; padding: 0; display: grid; place-items: center; cursor: pointer;
  background: none; border: none; color: var(--text); -webkit-tap-highlight-color: transparent;
  transition: background var(--t-hover) ease, transform var(--t-hover) var(--ease-spring);
}
.jr-mini-btn:hover { background: var(--glass-fill-hover); }
.jr-mini-btn:active { transform: scale(0.88); transition-duration: var(--t-press); }
.jr-mini-btn svg { width: 22px; height: 22px; fill: var(--text); }
.jr-mini-x svg { width: 16px; height: 16px; fill: none; stroke: var(--text-muted); stroke-width: 2; stroke-linecap: round; }
.jr-mini-bar { position: absolute; left: 14px; right: 14px; bottom: 4px; height: 2px; border-radius: var(--radius-pill); background: var(--glass-fill-strong); overflow: hidden; }
.jr-mini-bar span { display: block; height: 100%; background: var(--accent); transform-origin: 0 50%; transform: scaleX(0); }

/* Global player host (player.js): the <audio> and the sites' players live here.
   Off-screen and see-through, but never display:none (some browsers pause or reload
   hidden iframes). 200×200 because YouTube won't play in a smaller player. */
.player-host { position: fixed; left: -400px; top: 0; width: 200px; height: 200px; overflow: hidden; opacity: 0; pointer-events: none; z-index: -1; }
.player-host iframe, .player-slot { width: 200px; height: 200px; border: 0; }
.player-host audio { display: block; width: 1px; height: 1px; }

/* Song card: volume, outside links, errors, loading */
.jr-song-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: -4px; }
.jr-song-foot:has(> span:only-child) { display: none; }
.jr-vol { display: flex; align-items: center; gap: 8px; width: 160px; max-width: 50%; color: var(--text-muted); }
.jr-vol svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jr-vol svg path:first-child { fill: currentColor; }
.jr-song-ext { font-size: 13px; margin-left: auto; }
.jr-song-err { font-size: 13px; color: var(--negative); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.jr-song-err[hidden] { display: none; }
.jr-song-err .jr-out { color: var(--accent); }
.jr-song-open { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.jr-song-open svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jr-song-play.loading { animation: jr-pulse 1.1s ease-in-out infinite; }
@keyframes jr-pulse { 50% { opacity: 0.55; } }
.jr-mini-note { display: grid; place-items: center; width: 100%; height: 100%; background: var(--accent-soft); }
.jr-mini-note[hidden] { display: none; }
.jr-mini-note svg { width: 45%; height: 45%; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jr-mini .jr-cover img[hidden] { display: none; }

/* Masonry grid: columns filled by journal.js (shortest first) */
.jr-grid { display: flex; gap: 12px; align-items: flex-start; }
.jr-grid > .empty { flex: 1; }
.jr-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.jr-sentinel { height: 1px; }
.jr-card {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--radius-sm);
  box-shadow: var(--glass-highlight), var(--glass-shadow-sm);
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--t-hover) var(--ease-spring), background var(--t-hover) ease;
}
.jr-card:hover { background: var(--glass-fill-hover); }
.jr-card:active { transform: scale(var(--press-scale)); transition-duration: var(--t-press); }
.jr-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jr-card.got { opacity: 0.6; }
.jr-media { position: relative; background: var(--card); overflow: hidden; }
.jr-media img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity var(--t-hover) ease; }
.jr-media img.loaded { opacity: 1; }
.jr-media.missing::after { content: "Picture missing"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--text-muted); }
.jr-play {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  display: grid; place-items: center; background: var(--glass-pop); border: 1px solid var(--glass-border-strong);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-shadow-sm);
}
.jr-play svg { width: 20px; height: 20px; fill: var(--text); margin-left: 2px; }
.jr-play-sm { position: static; margin: 0 0 0 auto; width: 30px; height: 30px; }
.jr-play-sm svg { width: 14px; height: 14px; }
.jr-gif {
  position: absolute; left: 8px; top: 8px; padding: 2px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--text); background: var(--glass-pop); border: 1px solid var(--glass-border-strong);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.jr-site { display: flex; align-items: center; gap: 10px; padding: 14px 14px 4px; color: var(--text); text-decoration: none; }
.jr-site-letter {
  width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 10px;
  font-weight: 700; font-size: 16px; color: var(--text); background: var(--accent-soft); border: 1px solid var(--accent-edge);
}
.jr-site-name { font-size: 13px; color: var(--text-muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-card-body { padding: 10px 14px 13px; display: flex; flex-direction: column; gap: 4px; }
.jr-card-body:empty { display: none; }
.jr-card-title { font-size: 14px; font-weight: 600; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jr-card-line { font-size: 13px; line-height: 1.35; color: var(--text-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jr-badge { align-self: flex-start; margin-top: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); }
.jr-badge.want { color: var(--text); background: var(--accent-soft); border: 1px solid var(--accent-edge); }
.jr-badge.got { color: var(--positive); border: 1px solid var(--glass-border); }

/* Save sheet: two big choices (also used by Export backup) */
.jr-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.jr-choice {
  position: relative; font: inherit; color: var(--text); cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 26px 12px;
  background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--radius); box-shadow: var(--glass-highlight);
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-hover) ease, transform var(--t-hover) var(--ease-spring);
}
.jr-choice:hover { background: var(--glass-fill-hover); }
.jr-choice:active { transform: scale(var(--press-scale)); transition-duration: var(--t-press); }
.jr-choice:focus-within, .jr-choice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jr-choice:disabled { opacity: 0.6; cursor: default; }
.jr-choice svg { width: 30px; height: 30px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.jr-choice b { font-size: 16px; font-weight: 600; }
.jr-choice span { font-size: 13px; color: var(--text-muted); }
.jr-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Forms: link preview, photo, tags, switches */
.jr-prev { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); }
.jr-prev img { width: 96px; flex-shrink: 0; object-fit: cover; border-radius: 10px; background: var(--card); }
.jr-prev-text { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.jr-prev-text b { font-size: 14px; font-weight: 600; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jr-prev-text span { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jr-preview:empty { display: none; }
.jr-photo-pick { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.jr-photo-pick img { display: block; max-width: 100%; max-height: 260px; border-radius: var(--radius-sm); background: var(--card); }
.jr-photo-pick img:not([src]) { width: 100%; height: 160px; }
.jr-change { position: relative; cursor: pointer; }
.jr-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.jr-newtag { display: inline-flex; align-items: center; gap: 4px; }
.field .jr-newtag input { width: 110px; padding: 5px 12px; font-size: 13px; border-radius: var(--radius-pill); }
.jr-switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; cursor: pointer; }
.jr-switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0; cursor: pointer; position: relative;
  width: 46px; height: 28px; border-radius: var(--radius-pill); background: var(--glass-fill-strong); border: 1px solid var(--glass-border);
  transition: background var(--t-hover) ease;
}
.jr-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--text); box-shadow: var(--glass-shadow-sm); transition: transform var(--t-hover) var(--ease-spring);
}
.jr-switch:checked { background: var(--positive); border-color: transparent; }
.jr-switch:checked::after { transform: translateX(18px); }
.jr-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jr-want { display: flex; flex-direction: column; gap: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); }
.jr-want[hidden] { display: none; }

/* Item sheet (full size) */
.modal-box.jr-view-box { max-width: 760px; }
.jr-view { display: flex; flex-direction: column; gap: 14px; }
.jr-embed { width: 100%; margin: 0 auto; border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); max-width: 100%; }
.jr-embed iframe { display: block; width: 100%; height: 100%; border: 0; }
.jr-view-photo { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius-sm); overflow: hidden; }
.jr-view-photo img, .jr-view-thumb img { display: block; width: 100%; max-height: 70vh; object-fit: contain; background: var(--bg); }
.jr-view-thumb { display: block; border-radius: var(--radius-sm); overflow: hidden; }
.jr-site-big { padding: 18px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); }
.jr-view-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.jr-out { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; }
.jr-out svg, .jr-wish-actions .btn svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.jr-wish-actions .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.jr-view-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.jr-thoughts { font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.jr-wish { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--border); }
.jr-wish-price { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.jr-wish.got .jr-wish-price { color: var(--text-muted); text-decoration: line-through; }
.jr-wish-actions { display: flex; align-items: center; gap: 14px; }
.jr-got { font-size: 14px; }

/* Photo full screen */
.jr-full { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; background: var(--photo-backdrop); cursor: zoom-out; outline: none; }
.jr-full img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; }
.jr-full-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer; padding: 0;
  background: var(--glass-pop); border: 1px solid var(--glass-border-strong); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
}
.jr-full-close svg { width: 18px; height: 18px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; }

/* Storage sheet */
.jr-storage { display: flex; flex-direction: column; gap: 14px; }
.jr-st-list { display: flex; flex-direction: column; }
.jr-st-row { display: flex; justify-content: space-between; padding: 9px 0; font-size: 14px; color: var(--text-muted); }
.jr-st-row + .jr-st-row { border-top: 1px solid var(--border); }
.jr-st-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* =====================================================================
   Phone layout (screens up to 700px wide)
   ===================================================================== */
@media (max-width: 700px) {
  /* Side tabs become a floating glass pill near the bottom of the screen */
  .side-tabs,
  .side-tabs:hover,
  .side-tabs:focus-within {
    top: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    transform: none;
    flex-direction: row;
    gap: 0;
    padding: 6px;
    border-left: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
  }
  .tab {
    flex: 1;
    width: auto;
    flex-direction: column-reverse;
    justify-content: center;
    gap: 3px;
    padding: 8px 0;
    font-size: 11px;
  }
  .tab-icon { width: 20px; height: 20px; }

  main { padding: 20px 16px 120px; }
  .btn-big { max-width: none; }

  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .filters .field { width: auto; flex: 1; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 22px; }
  .capital-value { font-size: 38px; }
  .hist-date { padding: 14px 16px 4px; }
  .hist-row { padding: 9px 16px; gap: 10px; }

  /* Life */
  .lf-head { margin-bottom: 22px; }
  .lf-big { font-size: 44px; }
  .lf-row { padding: 12px 16px; gap: 12px; }
  .lf-row + .lf-row::before { left: 16px; right: 16px; }
  .lf-toast, .update-toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.jr-mini-on .update-toast, body.jr-mini-on .lf-toast { bottom: calc(160px + env(safe-area-inset-bottom)); }

  /* Journal */
  .jr-head { margin-top: 22px; }
  .jr-bar { gap: 8px; }
  .jr-search { order: -1; width: 100%; margin-left: 0; }
  .jr-grid, .jr-col { gap: 10px; }
  .jr-card-body { padding: 9px 11px 11px; }
  .jr-card-title { font-size: 13px; }
  .jr-card-line { font-size: 12px; }
  .jr-site { padding: 12px 11px 2px; }
  .modal:has(.jr-view-box) { padding: 0; align-items: flex-end; }
  .modal-box.jr-view-box { max-height: calc(100dvh - 20px); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .jr-embed { border-radius: 10px; }
  .jr-song { padding: 14px; gap: 12px; }
  .jr-song-top { gap: 12px; }
  .jr-cover { width: 72px; height: 72px; }
  .jr-cover-sm { width: 40px; height: 40px; }
  .jr-song-title { font-size: 18px; }
  .jr-song-artist { font-size: 14px; }
  .jr-song-play { width: 48px; height: 48px; }
  .jr-song-empty .jr-song-top { grid-template-columns: auto 1fr; }
  .jr-song-empty .jr-song-top > .btn { grid-column: 1 / -1; }
  .jr-filepick { grid-template-columns: 1fr; }
  .jr-mini { left: 16px; right: 16px; width: auto; max-width: none; bottom: calc(86px + env(safe-area-inset-bottom)); }
  body.jr-mini-on main { padding-bottom: 190px; }
  .lf-q small { display: none; }
  .lf-wheel-wrap { grid-template-columns: 30px 1fr 30px; }
  .lf-wheel-arrow { width: 30px; height: 30px; }
  .lf-wheel-card { padding: 12px 6px 16px; }
  .modal:has(.lf-ci-box) { padding: 0; align-items: flex-end; }
  .modal-box.lf-ci-box { height: calc(100dvh - 20px); max-height: none; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .lf-ci-summary { grid-template-columns: 1fr; gap: 8px; }
  .lf-ci-wheel { max-width: 220px; }
  .lf-ci-std { grid-template-columns: 1fr; gap: 8px; }
  .lf-ci-task .btn { padding: 5px 10px; font-size: 12px; }
  .form-row.lf-sleep-times, .form-row.lf-pair { grid-template-columns: 1fr 1fr; }


  /* Tables turn into a stack of small cards, each value labelled */
  .table-card { background: none; border: none; padding: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 10px;
  }
  .tbl tr.overdue { box-shadow: inset 3px 0 0 var(--negative); }
  .tbl tr.overdue td:first-child { box-shadow: none; }
  .tbl td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 6px 0;
    border: none;
    text-align: right;
  }
  .tbl td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 13px;
    text-align: left;
    flex-shrink: 0;
  }
  .tbl td .cell { text-align: right; min-width: 0; }
  /* Price tiers are too wide to sit beside their label: put them underneath */
  .tbl td:has(.tier-list) { flex-direction: column; gap: 6px; }
  .tier-list { gap: 4px 8px; font-size: 12px; text-align: left; }
  .tbl td.actions { width: 100%; justify-content: flex-end; padding-top: 8px; }
  .tbl td.actions::before { display: none; }
}

/* =====================================================================
   Accounts and sync (cloud.js), 2026-11-12
   ===================================================================== */
/* Not logged in: the app is hidden behind the log-in screen */
html.signed-out main, html.signed-out .side-tabs, html.signed-out .jr-mini, html.signed-out .cloud-bar { visibility: hidden; }
.auth { display: none; }
/* A sheet opened from the log-in screen (e.g. "Export a backup first") sits above it */
html.signed-out .modal { z-index: 210; }
html.signed-out .auth {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; overflow-y: auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px 24px; border-radius: var(--radius-lg); display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.auth-logo { width: 64px; height: 64px; border-radius: 16px; align-self: center; box-shadow: var(--glass-shadow-sm); }
.auth-title, .auth-q { margin: 0; text-align: center; font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.auth-q { font-size: 20px; line-height: 1.3; }
.auth-note { margin: -6px 0 0; text-align: center; color: var(--text-muted); font-size: 14px; }
.auth-seg { align-self: center; }
.auth-form { gap: 14px; }
.auth-go { width: 100%; min-height: 46px; font-size: 16px; }
.auth-link { align-self: center; font-size: 14px; text-decoration: none; padding: 6px 8px; }
.auth-actions { display: flex; flex-direction: column; gap: 10px; }
.auth-actions .btn { width: 100%; min-height: 46px; }
.form-error.ok { color: var(--positive); }
.auth-form .form-error { text-align: center; }
.auth input[aria-invalid="true"] { border-color: var(--negative); }
/* Password box with a show / hide eye */
.auth-pw { position: relative; display: block; }
.auth-pw input { padding-right: 48px; }
.auth-eye {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 40px; padding: 0;
  display: grid; place-items: center; background: none; border: none; color: var(--text-muted); cursor: pointer; border-radius: 10px;
}
.auth-eye:hover { color: var(--text); }
.auth-eye:focus-visible { outline: 2px solid var(--accent); }
.auth-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Top corner: sync status + account button (scrolls with the page) */
.cloud-bar {
  position: absolute; z-index: 20; display: flex; align-items: center; gap: 8px;
  top: calc(32px + env(safe-area-inset-top)); right: max(32px, env(safe-area-inset-right));
}
.cloud-bar[hidden] { display: none; }
.cloud-status {
  font: inherit; font-size: 13px; font-weight: 500; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; min-height: 32px;
  background: var(--glass-fill); border: 1px solid var(--glass-border); border-radius: var(--radius-pill);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: var(--glass-highlight);
}
.cloud-status:hover { color: var(--text); }
.cloud-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--positive); flex-shrink: 0; }
.cloud-bar[data-state="syncing"] .cloud-dot { background: var(--accent); animation: jr-pulse 1.1s ease-in-out infinite; }
.cloud-bar[data-state="offline"] .cloud-dot { background: var(--text-muted); }
.cloud-bar[data-state="error"] .cloud-dot { background: var(--negative); }
.cloud-short { display: none; }
.cloud-acct { position: relative; }
.cloud-avatar {
  width: 36px; height: 36px; border-radius: 50%; padding: 0; cursor: pointer; font: inherit; font-size: 15px; font-weight: 700;
  color: var(--text); background: var(--accent-soft); border: 1px solid var(--accent-edge); box-shadow: var(--glass-highlight);
}
.cloud-avatar:focus-visible, .cloud-status:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cloud-menu { min-width: 230px; z-index: 30; }
.cloud-who { padding: 9px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.cloud-name { font-size: 15px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cloud-email { font-size: 13px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item.danger-item { color: var(--negative); }
.btn-danger { background: var(--negative); border-color: transparent; color: var(--on-accent); font-weight: 600; }
.btn-danger:hover { background: var(--negative); opacity: 0.9; }
.cloud-warn { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
@media (max-width: 700px) {
  .cloud-bar { top: calc(20px + env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); gap: 6px; }
  .cloud-long { display: none; }
  .cloud-short { display: inline; }
}
@media (prefers-reduced-motion: reduce) { .cloud-bar[data-state="syncing"] .cloud-dot { animation: none; } }

/* =====================================================================
   Phone polish (iPhone), 2026-11-12
   ===================================================================== */

/* Safe areas: with viewport-fit=cover the page runs under the notch / Dynamic
   Island and the home bar. env(safe-area-inset-*) is how much each edge is
   covered (0 on PCs), so content is pushed clear of them. */
main {
  padding-top: calc(32px + env(safe-area-inset-top));
  padding-right: max(32px, env(safe-area-inset-right));
  padding-left: calc(88px + env(safe-area-inset-left));
}
.side-tabs { left: env(safe-area-inset-left); }
.modal {
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
           max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.modal-box { max-height: calc(100vh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom))); }
.jr-mini { right: max(24px, calc(env(safe-area-inset-right) + 12px)); bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px)); }

@media (max-width: 700px) {
  main {
    padding: calc(20px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
             calc(120px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  body.jr-mini-on main { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  /* Floating bottom bar and mini-player: clear of the home bar and the rounded sides */
  .side-tabs, .side-tabs:hover, .side-tabs:focus-within {
    left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right));
  }
  .jr-mini { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: calc(86px + env(safe-area-inset-bottom)); }
  /* Full-height bottom sheets stop below the status bar */
  .modal:has(.lf-ci-box), .modal:has(.jr-view-box) { padding: env(safe-area-inset-top) 0 0; }
  .modal-box.lf-ci-box { height: calc(100dvh - 20px - env(safe-area-inset-top)); }
  .modal-box.jr-view-box { max-height: calc(100dvh - 20px - env(safe-area-inset-top)); }
  .gp-pop.gp-sheet { max-height: calc(100dvh - 40px - env(safe-area-inset-top)); overflow-y: auto; }
}

/* Touch screens (and the phone layout) */
@media (max-width: 700px), (pointer: coarse) {
  /* iPhone zooms the page into any text box under 16px: keep them all at 16px */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), textarea, select { font-size: 16px !important; }

  /* Tap targets at least 44 × 44px. Small controls keep their look but get an
     invisible ::after that reaches 44px (it only grows, never shrinks). */
  .chip, .btn, .link, .lf-chip, .lf-tick, .modal-close, .lf-wheel-arrow, .jr-mini-btn, .gp-field { position: relative; }
  .chip::after, .btn-sm::after, .btn-icon::after, .link::after, .lf-chip::after, .lf-tick::after,
  .modal-close::after, .lf-wheel-arrow::after, .jr-mini-btn::after {
    content: ""; position: absolute;
    top: min(0px, calc((100% - 44px) / 2)); bottom: min(0px, calc((100% - 44px) / 2));
    left: min(0px, calc((100% - 44px) / 2)); right: min(0px, calc((100% - 44px) / 2));
  }
  .btn:not(.btn-sm):not(.btn-icon) { min-height: 44px; }
  .subnav-link { padding: 12px 16px; }
  .menu-item { min-height: 44px; }
  .seg span { padding: 12px 18px; }
  .jr-switch-row { min-height: 44px; }
  .gp-field { min-height: 44px; }
  .jr-tag-filter .gp-field { min-height: 32px; }
  .jr-tag-filter .gp-field::after { content: ""; position: absolute; inset: -6px 0; }
  .field .jr-newtag input { width: 130px; }
  .jr-search { padding: 9px 14px; }
  /* Sliders (seek, volume): a taller touch strip and a bigger knob */
  .jr-seek { height: 44px; }
  .jr-seek::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8.5px; }
  .jr-seek::-moz-range-thumb { width: 22px; height: 22px; }
  .jr-vol { width: 200px; max-width: 60%; }

  /* No double-tap zoom anywhere (pinch zoom still works), no grey tap flash */
  html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  /* Buttons, tabs, rows and the day wheel: no text selection or "copy" bubble on a long press */
  button, .btn, .chip, .tab, .subnav-link, .lf-row, .hist-row, .acct-tile, .jr-card, .jr-choice, .jr-mini,
  .lf-wheel, .lf-wheel-svg, .seg, .menu-item, .tbl tr, .gp-field, .lf-q, label.jr-switch-row, .update-toast {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
}

/* =====================================================================
   Fallbacks and accessibility
   ===================================================================== */
/* No backdrop-filter support: solid dark panels instead of see-through ones */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card, .side-tabs, .subnav, .modal-box, .gp-pop, .gp-pop.gp-sheet, .jr-play, .jr-gif, .jr-full-close, .jr-mini, .update-toast, .lf-toast, .cloud-status { background: var(--glass-solid); }
}

/* "Reduce transparency" turned on: more solid panels */
@media (prefers-reduced-transparency: reduce) {
  .card, .side-tabs, .subnav, .modal-box, .gp-pop, .gp-pop.gp-sheet, .jr-play, .jr-gif, .jr-full-close, .jr-mini, .update-toast, .lf-toast, .cloud-status {
    background: var(--glass-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* "Reduce motion" turned on: still backdrop, no springs or slides (script.js also skips its animations) */
@media (prefers-reduced-motion: reduce) {
  .blob, .jr-song-play.loading { animation: none; }
  *, *::before, *::after { transition-duration: 0s !important; }
  .tab:hover, .subnav-link:hover, .tab:active, .subnav-link:active, .btn:active { transform: none; }
}
