:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #5f6873;
  --border: #e2e5ea;
  --accent: #0f766e;
  --accent-text: #ffffff;
  --ok: #15803d;
  --ok-bg: #e8f6ec;
  --warn: #b45309;
  --warn-bg: #fdf3e3;
  --bad: #b91c1c;
  --bad-bg: #fdecec;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111417;
    --card: #1b1f24;
    --text: #e8eaed;
    --muted: #9aa3ad;
    --border: #2c323a;
    --accent: #2dd4bf;
    --accent-text: #062a26;
    --ok: #4ade80;
    --ok-bg: #12301d;
    --warn: #fbbf24;
    --warn-bg: #33270d;
    --bad: #f87171;
    --bad-bg: #3a1616;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}

h2 { font-size: 1.05rem; margin: 0 0 .5rem; display: inline; }
h2 small, .field small { font-weight: 400; color: var(--muted); }
.card > h2, .row-head h2 { display: block; }

.balance {
  background: var(--accent);
  color: var(--accent-text);
  padding: calc(1.25rem + env(safe-area-inset-top)) 1rem 1rem;
  text-align: center;
}
.balance .eyebrow { margin: 0; opacity: .92; font-size: .9rem; }
.balance .big { margin: .1rem 0 0; font-size: 2.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.balance .muted { margin: .35rem 0 0; font-size: .85rem; opacity: .95; }

.tabs {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.tabs button {
  flex: 1 1 auto;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  padding: .8rem .25rem;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }

main { max-width: 560px; margin: 0 auto; padding: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
}
details.card summary { cursor: pointer; list-style-position: outside; }
details.card[open] summary { margin-bottom: .5rem; }

.hint { color: var(--muted); font-size: .9rem; margin: .25rem 0 .75rem; }

.field { display: block; margin-top: .75rem; }
.field span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
.field input, .view-date input {
  width: 100%;
  font: inherit;
  font-size: 1.1rem;
  padding: .65rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
#amount { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.denoms { list-style: none; margin: 0; padding: 0; }
.denoms li {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .55rem 0;
  border-top: 1px solid var(--border);
}
.denoms li:first-child { border-top: 0; }
.denoms .label { flex: 1; min-width: 0; }
.denoms .label strong { display: block; }
.denoms .label small { color: var(--muted); }
.denoms .label small.low { color: var(--warn); font-weight: 600; }
.denoms .label small.over { color: var(--bad); font-weight: 600; }
.denoms .count {
  min-width: 2.2ch;
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.denoms li.zero .count { color: var(--muted); font-weight: 400; }

.stepper { display: flex; align-items: center; gap: .4rem; }
.stepper button {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
}
.stepper button:disabled { opacity: .35; }
.stepper button:not(:disabled):active { background: var(--border); }

.summary { margin: 0; }
.summary div { display: flex; justify-content: space-between; padding: .3rem 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.summary .diff { border-top: 1px solid var(--border); margin-top: .3rem; padding-top: .6rem; font-size: 1.15rem; }

.status { padding: .7rem .85rem; border-radius: 10px; margin: .75rem 0; font-weight: 500; }
.status.ok { background: var(--ok-bg); color: var(--ok); }
.status.warn { background: var(--warn-bg); color: var(--warn); }
.status.bad { background: var(--bad-bg); color: var(--bad); }
.status.neutral { background: var(--bg); color: var(--muted); }

.actions { display: flex; gap: .75rem; margin-top: .75rem; }
.actions button { flex: 1; }
button.primary, button.secondary {
  font: inherit;
  font-weight: 600;
  padding: .8rem 1rem;
  border-radius: 10px;
  border: 1px solid transparent;
}
button.primary { background: var(--accent); color: var(--accent-text); }
button.primary:disabled { opacity: .4; }
button.secondary { background: var(--bg); color: var(--text); border-color: var(--border); }
button.small { padding: .4rem .7rem; font-size: .9rem; }

.row-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }

.history { list-style: none; padding: 0; margin: 0; }
.history li { border-top: 1px solid var(--border); padding: .75rem 0; }
.history li:first-child { border-top: 0; }
.history .top { display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.history .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.history .meta, .history .denom-detail { color: var(--muted); font-size: .85rem; }
.history li.undone .top { text-decoration: line-through; opacity: .6; }
.history .undo { margin-top: .4rem; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: .7rem 1rem;
  border-radius: 10px;
  max-width: calc(100% - 2rem);
  box-shadow: 0 6px 20px rgb(0 0 0 / .2);
}

/* ---- Shared across apps ---------------------------------------------------- */

.balance { position: relative; }
.back {
  position: absolute;
  left: 1rem;
  top: calc(.3rem + env(safe-area-inset-top));
  color: inherit;
  text-decoration: none;
  font-weight: 600;
  font-size: .9rem;
  opacity: .9;
  z-index: 1;
  padding: .7rem .9rem .7rem 0; /* a 44px tap area around the small label */
}

/* Home screen */
.hub { max-width: 560px; margin: 0 auto; padding: calc(1.5rem + env(safe-area-inset-top)) 1rem 1rem; }
.hub h1 { margin: 0 0 .25rem; font-size: 1.6rem; }
.hub > p { margin: 0 0 1.25rem; color: var(--muted); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .85rem; }
.tile {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  padding: 1rem;
  min-height: 9rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
}
.tile:active { background: var(--border); }
.tile .icon { font-size: 2rem; line-height: 1; }
.tile strong { font-size: 1.05rem; margin-top: auto; }
.tile small { color: var(--muted); }

/* Sushiro */
.plate-dot {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  flex: none;
  border: 3px solid var(--plate);
  box-shadow: inset 0 0 0 3px var(--card), inset 0 0 0 20px var(--plate);
}
.specials { list-style: none; margin: 0; padding: 0; }
.specials li { display: flex; align-items: center; gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--border); }
.specials li:first-child { border-top: 0; }
.specials .label { flex: 1; min-width: 0; }
.specials .price { font-weight: 600; font-variant-numeric: tabular-nums; }
.icon-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
}
.inline-form { display: flex; gap: .5rem; margin-top: .75rem; }
.inline-form input {
  min-width: 0;
  font: inherit;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.inline-form input.name { flex: 2; }
.inline-form input.price { flex: 1; }
.inline-form button { flex: none; }
.settings-row { display: grid; grid-template-columns: 1.4rem 1fr 5.5rem 2.2rem; gap: .5rem; align-items: center; padding: .4rem 0; }
.settings-row input, .rates input {
  width: 100%;
  font: inherit;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.settings-row input[type="color"] { padding: 0; height: 1.6rem; border: 0; background: none; }
.rates { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.stats { display: flex; gap: .75rem; margin-bottom: 1rem; }
.stats div { flex: 1; background: var(--bg); border-radius: 10px; padding: .6rem .75rem; }
.stats dt { color: var(--muted); font-size: .8rem; }
.stats dd { margin: 0; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.visit summary { list-style: none; cursor: pointer; }
.visit summary::-webkit-details-marker { display: none; }
.visit .lines { margin: .5rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9rem; }
.visit .lines li { display: flex; justify-content: space-between; border: 0; padding: .1rem 0; }

/* ---- Sushiro theme: red and white, cream paper, wave pattern ------------- */

.theme-sushiro {
  --bg: #fbf6ee;
  --card: #ffffff;
  --text: #2a1a14;
  --muted: #7a675c;
  --border: #eadfd2;
  --accent: #d7001b;
  --accent-text: #ffffff;
  --accent-ink: #d7001b; /* red text on the page; lighter in dark mode so it stays readable */
  font-family: "M PLUS Rounded 1c", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  .theme-sushiro {
    --bg: #1a1210;
    --card: #251a17;
    --text: #f5ebe3;
    --muted: #b8a59a;
    --border: #3a2b26;
    --accent: #c8102e;
    --accent-text: #ffffff;
    --accent-ink: #ff6b7a;
  }
}
.theme-sushiro .balance {
  /* seigaiha-style waves */
  background-color: var(--accent);
  background-image:
    radial-gradient(circle at 50% 100%, transparent 38%, rgb(255 255 255 / .12) 39%, rgb(255 255 255 / .12) 46%, transparent 47%,
      transparent 58%, rgb(255 255 255 / .12) 59%, rgb(255 255 255 / .12) 66%, transparent 67%);
  background-size: 44px 22px;
  padding-bottom: 1.4rem;
  border-bottom: 5px solid #fff;
  box-shadow: 0 5px 0 var(--accent);
}
.theme-sushiro .balance .eyebrow { letter-spacing: .08em; font-weight: 700; }
.theme-sushiro .balance .big { font-weight: 800; text-shadow: 0 2px 0 rgb(0 0 0 / .15); }
.theme-sushiro .brand { margin: 0 0 .1rem; font-size: 1.05rem; font-weight: 800; letter-spacing: .04em; }
.theme-sushiro .brand span { display: inline-block; margin-right: .3rem; }
.theme-sushiro .tabs { margin-top: 5px; }
.theme-sushiro .tabs button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent-ink); }
.theme-sushiro .card { border-radius: 18px; box-shadow: 0 2px 0 var(--border); }
.theme-sushiro h2 { font-weight: 800; }
.theme-sushiro .card > h2::before { content: "●"; color: var(--accent-ink); font-size: .7em; margin-right: .45rem; vertical-align: .15em; }
.theme-sushiro button.primary { border-radius: 999px; box-shadow: 0 3px 0 rgb(0 0 0 / .18); }
.theme-sushiro button.secondary { border-radius: 999px; }
.theme-sushiro .stepper button:last-child { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.theme-sushiro .summary .diff dd { color: var(--accent-ink); font-size: 1.3rem; }

/* Plates drawn as plates: coloured rim, white well */
.theme-sushiro .plate-dot {
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  background: radial-gradient(circle, #fff 0 46%, var(--plate) 47% 62%, #fff 63% 66%, var(--plate) 67% 100%);
  box-shadow: 0 2px 0 rgb(0 0 0 / .18), inset 0 0 0 1px rgb(0 0 0 / .08);
}
.theme-sushiro .count.pop { animation: pop .18s ease-out; }
@keyframes pop { 50% { transform: scale(1.35); } }

.tile.sushiro { background: #d7001b; color: #fff; border-color: #d7001b; }
.tile.sushiro small { color: rgb(255 255 255 / .95); }
.tile.radar { background: #3b2a8a; color: #fff; border-color: #3b2a8a; }
.tile.radar small { color: rgb(255 255 255 / .95); }

/* ---- Petty Cash theme switch ------------------------------------------------ */

.theme-toggle {
  position: absolute;
  right: 1rem;
  top: calc(.6rem + env(safe-area-inset-top));
  z-index: 1;
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: .3rem .6rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / .5);
  background: rgb(0 0 0 / .18);
  color: inherit;
}
.win-titlebar, .win-taskbar { display: none; }

/* ---- Windows 95 theme ------------------------------------------------------- */

.theme-win95 {
  --bg: #c0c0c0;
  --card: #c0c0c0;
  --text: #000000;
  --muted: #404040;
  --border: #808080;
  --accent: #000080;
  --accent-text: #ffffff;
  --ok: #000000;
  --ok-bg: #c0c0c0;
  --warn: #000000;
  --warn-bg: #ffffe1;
  --bad: #ffffff;
  --bad-bg: #800000;
  --raised: inset -1px -1px #0a0a0a, inset 1px 1px #ffffff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --sunken: inset -1px -1px #ffffff, inset 1px 1px #808080, inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  color-scheme: light;
}
.theme-win95 body {
  background: #008080;
  font-family: Tahoma, "MS Sans Serif", "Microsoft Sans Serif", Geneva, Verdana, sans-serif;
  font-size: 15px;
  padding: 4px 4px calc(2.6rem + env(safe-area-inset-bottom));
  -webkit-font-smoothing: none;
}
.theme-win95 * { border-radius: 0 !important; }

/* The page is one big window */
.theme-win95 .win-titlebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: env(safe-area-inset-top);
  padding: 3px 3px 3px 6px;
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  position: relative;
}
.win-ctrls { display: flex; gap: 2px; }
.win-ctrls i, .win-ctrls a {
  display: grid;
  place-items: center;
  width: 1.3rem;
  height: 1.15rem;
  background: #c0c0c0;
  color: #000;
  font-style: normal;
  font-weight: 700;
  font-size: .8rem;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--raised);
}
.win-ctrls a { margin-left: 2px; }
.theme-win95 .balance {
  background: #c0c0c0;
  color: #000;
  text-align: left;
  padding: 2.4rem .75rem .75rem;
  margin: 0; /* right under the title bar, so the window's edge runs on without a gap */
}
.theme-win95 .balance .eyebrow { opacity: 1; }
.theme-win95 .balance .big {
  font-family: "Courier New", Courier, monospace;
  background: #000;
  color: #33ff33;
  padding: .2rem .6rem;
  box-shadow: var(--sunken);
  text-align: right;
  font-size: 2.1rem;
  letter-spacing: .05em;
}
.theme-win95 .balance .muted { color: #800000; font-weight: 700; }
.theme-win95 .back, .theme-win95 .theme-toggle {
  top: .5rem;
  color: #000;
  background: #c0c0c0;
  border: 0;
  box-shadow: var(--raised);
  padding: .25rem .6rem;
  opacity: 1;
  font-weight: 400;
}
.theme-win95 .back { left: .75rem; }
.theme-win95 .theme-toggle { right: .75rem; }

/* Tabs */
.theme-win95 .tabs {
  position: static;
  background: #c0c0c0;
  border: 0;
  padding: 0 .5rem;
  gap: 2px;
}
.theme-win95 .tabs button {
  color: #000;
  font-weight: 400;
  border: 0;
  padding: .45rem .25rem;
  margin-top: 3px;
  box-shadow: inset 1px 1px #ffffff, inset -1px 0 #0a0a0a, inset -2px 0 #808080;
}
.theme-win95 .tabs button[aria-selected="true"] { margin-top: 0; padding-bottom: .7rem; font-weight: 700; }

main { position: relative; }
.theme-win95 main { padding: .5rem; background: #c0c0c0; }
/* One window frame (3px grey, then a white left/top and black right/bottom edge) around the
   title bar, header, tabs and page together, at every width, so no part sticks out. */
.theme-win95 .balance, .theme-win95 .tabs { box-shadow: 3px 0 #c0c0c0, -3px 0 #c0c0c0, 4px 0 #0a0a0a, -4px 0 #ffffff; }
.theme-win95 .win-titlebar { box-shadow: 0 0 0 3px #c0c0c0, -4px -4px 0 #ffffff, 4px -4px 0 #0a0a0a, 4px 0 #0a0a0a, -4px 0 #ffffff; }
.theme-win95 main { box-shadow: 3px 0 #c0c0c0, -3px 0 #c0c0c0, 4px 0 #0a0a0a, -4px 0 #ffffff, 0 3px #c0c0c0, 4px 4px #0a0a0a, -4px 4px #808080; }

/* Group boxes and controls */
.theme-win95 .card {
  border: 0;
  padding: 1.1rem .75rem .75rem;
  margin: 1rem 0 .75rem;
  box-shadow: inset 1px 1px #808080, inset -1px -1px #ffffff, 1px 1px #ffffff, -1px -1px #808080;
  position: relative;
}
.theme-win95 .card > h2, .theme-win95 .row-head h2, .theme-win95 details.card summary {
  position: absolute;
  top: -.7rem;
  left: .5rem;
  background: #c0c0c0;
  padding: 0 .3rem;
  font-size: .95rem;
  font-weight: 400;
}
.theme-win95 details.card summary { position: static; margin: -.4rem 0 0; padding: 0; }
.theme-win95 .row-head { min-height: 1rem; justify-content: flex-end; }
.theme-win95 .hint { color: #000; }
.theme-win95 .field span { color: #000; }
.theme-win95 .field input {
  background: #fff;
  border: 0;
  box-shadow: var(--sunken);
  font-family: inherit;
}
.theme-win95 #amount { font-family: "Courier New", Courier, monospace; }
.theme-win95 .denoms li { border-top: 1px dotted #808080; }
.theme-win95 .denoms li:first-child { border-top: 0; }
.theme-win95 .denoms .count {
  background: #fff;
  min-width: 2.6rem;
  padding: .1rem .3rem;
  box-shadow: var(--sunken);
  font-family: "Courier New", Courier, monospace;
}
.theme-win95 .denoms .label small, .theme-win95 .summary dt { color: #000; }
.theme-win95 .denoms .label small.low { color: #800000; }

.theme-win95 .stepper button,
.theme-win95 button.primary,
.theme-win95 button.secondary {
  background: #c0c0c0;
  color: #000;
  border: 0;
  box-shadow: var(--raised);
  font-family: inherit;
  font-weight: 400;
}
.theme-win95 .stepper button { width: 2.3rem; height: 2.3rem; font-size: 1.1rem; }
.theme-win95 button.primary { font-weight: 700; outline: 1px solid #000; outline-offset: -1px; }
.theme-win95 button:not(:disabled):active { box-shadow: var(--sunken); background: #c0c0c0; }
.theme-win95 button:disabled { opacity: 1; color: #808080; text-shadow: 1px 1px #fff; }

.theme-win95 .summary .diff { border-top: 1px solid #808080; box-shadow: 0 -1px #fff inset; }
.theme-win95 .status { border: 1px solid #000; font-weight: 400; }
.theme-win95 .status::before { margin-right: .4rem; }
.theme-win95 .status.ok::before { content: "✔"; }
.theme-win95 .status.warn::before { content: "⚠"; }
.theme-win95 .status.bad::before { content: "⛔"; }
.theme-win95 .status.neutral::before { content: "ℹ"; color: #000080; }
.theme-win95 .history li { border-top: 1px dotted #808080; }
.theme-win95 .history .meta, .theme-win95 .history .denom-detail { color: #000; }

.theme-win95 .toast {
  background: #ffffe1;
  color: #000;
  border: 1px solid #000;
  box-shadow: 2px 2px 0 rgb(0 0 0 / .5);
  bottom: calc(3rem + env(safe-area-inset-bottom));
}

/* Taskbar */
.theme-win95 .win-taskbar {
  display: flex;
  align-items: center;
  gap: 4px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 3px 3px calc(3px + env(safe-area-inset-bottom));
  background: #c0c0c0;
  box-shadow: inset 0 1px #dfdfdf, inset 0 2px #ffffff;
}
.win-start, .win-task, .win-clock { padding: .25rem .5rem; color: #000; text-decoration: none; font-size: .85rem; white-space: nowrap; }
.win-start { font-weight: 700; box-shadow: var(--raised); }
.win-start b { color: #000080; }
.win-task { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--sunken); background: #dfdfdf; font-weight: 700; }
.win-clock { box-shadow: inset -1px -1px #ffffff, inset 1px 1px #808080; }

/* ---- Wide screens: show each app as a centred column ------------------------ */

@media (min-width: 640px) {
  .balance, .tabs, main, .win-titlebar {
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
  }
  .balance { margin-top: 1.5rem; border-radius: 18px 18px 0 0; }
  .tabs { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  main { padding-left: 0; padding-right: 0; }
  .theme-sushiro .tabs { margin-top: 5px; }

  /* Windows 95: a window sitting on the teal desktop */
  .theme-win95 body { padding-top: 1.5rem; }
  .theme-win95 .win-titlebar { margin-top: 0; }
  .theme-win95 .balance { margin: 0 auto; border-radius: 0; }
  .theme-win95 .tabs { border: 0; }
  .theme-win95 main { padding: .5rem .75rem; margin-bottom: 1.5rem; }
}

/* ---- Sushiro receipt check ---------------------------------------------- */

.receipt { margin-top: 1rem; padding-top: .75rem; border-top: 1px dashed var(--border); }
.receipt h3 { margin: 0 0 .25rem; font-size: .95rem; }
.receipt h3 small { font-weight: 400; color: var(--muted); }
label.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  cursor: pointer;
  text-align: center;
}
.receipt textarea {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: .5rem;
}
.receipt progress { width: 100%; accent-color: var(--accent); }
.receipt-row { display: flex; gap: .75rem; align-items: flex-end; }
.receipt-row .field { flex: 1; margin: 0; }
.receipt-thumb {
  flex: none;
  width: 4rem;
  height: 5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg);
}
.receipt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.visit .receipt-thumb { margin-top: .5rem; }
.receipt-items { margin: .25rem 0 .75rem; }
.receipt-items h4 { margin: 0 0 .35rem; font-size: .9rem; }
.receipt-plates { list-style: none; margin: 0; padding: 0; }
.receipt-plates li { display: flex; align-items: center; gap: .6rem; padding: .25rem 0; }
.receipt-plates .plate-dot { width: 1.5rem; height: 1.5rem; }
.receipt-plates .label { flex: 1; }
.receipt-plates .nums { font-variant-numeric: tabular-nums; font-weight: 600; }
.receipt-plates li.same .nums { color: var(--ok); }
.receipt-plates li.diff .nums { color: var(--warn); }
.receipt-others { font-size: .9rem; margin: .4rem 0; }
.chip { display: inline-block; font-size: .75rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; margin-left: .35rem; vertical-align: .1em; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.photo-viewer {
  border: 0;
  padding: .75rem;
  max-width: min(96vw, 700px);
  max-height: 94vh;
  background: var(--card);
  color: var(--text);
  border-radius: 14px;
}
.photo-viewer::backdrop { background: rgb(0 0 0 / .7); }
.photo-viewer form { text-align: right; margin-bottom: .5rem; }
.photo-viewer img { display: block; max-width: 100%; max-height: calc(94vh - 4.5rem); margin: 0 auto; }

/* Home screen: built-in apps vs links to other sites */
.hub .section-title { display: block; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.5rem 0 .6rem; }
.hub .section-title:first-of-type { margin-top: 0; }
.hub .section-title small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.links { display: grid; grid-template-columns: minmax(0, 1fr); gap: .6rem; }
.link-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 1rem;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
}
.link-row:active { background: var(--border); }
.link-row .icon { font-size: 1.6rem; line-height: 1; }
.link-row .text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.link-row small { color: var(--muted); }
.link-row .url { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .ext { font-size: 1.2rem; font-weight: 700; color: var(--muted); }

/* ---- Wallet Radar ---------------------------------------------------------------- */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-radar { --accent: #3b2a8a; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-radar { --accent: #8b7cf6; --accent-text: #120d2e; } }
.theme-radar .balance {
  background: radial-gradient(circle at 85% 20%, rgb(255 255 255 / .14) 0 18%, transparent 19%),
    radial-gradient(circle at 85% 20%, transparent 0 32%, rgb(255 255 255 / .1) 33% 34%, transparent 35% 48%, rgb(255 255 255 / .08) 49% 50%, transparent 51%),
    var(--accent);
}
.radar-title { margin: .1rem 0 .6rem; font-size: 1.35rem; font-weight: 800; }
.chain-pick select {
  font: inherit;
  font-weight: 600;
  padding: .4rem .7rem;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / .45);
  background: rgb(255 255 255 / .14);
  color: inherit;
  max-width: 100%;
}
.chain-pick option { color: #111; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
input.mono, textarea.mono { font-size: .95rem !important; }
.field textarea, .field select {
  width: 100%;
  font: inherit;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.token-line { margin: .5rem 0 0; min-height: 1.2em; }
.speed-note { margin: 0 0 1rem; padding: .65rem .85rem; border-radius: 10px; background: var(--card); border: 1px solid var(--border); color: var(--muted); font-size: .9rem; }
.window-row { display: grid; grid-template-columns: 1fr; gap: 0; }
.window-row .field { min-width: 0; }
.window-row .field input { font-size: .95rem; padding: .55rem .5rem; min-width: 0; }
@media (min-width: 560px) { .window-row { grid-template-columns: 1fr 1fr; gap: .6rem; } }
.presets { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
label.check { display: flex; gap: .5rem; align-items: center; margin-top: .75rem; font-size: .92rem; }
.seg { display: flex; gap: .4rem; margin-top: .75rem; }
.seg label { flex: 1; text-align: center; padding: .5rem; border: 1px solid var(--border); border-radius: 10px; font-weight: 600; font-size: .92rem; }
.seg label:has(input:checked) { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.progress { margin: .75rem 0 0; font-size: .92rem; color: var(--muted); }
.progress.error { color: var(--bad); }
.summary-line { margin: .25rem 0 .75rem; }
.card h2 small { font-weight: 400; color: var(--muted); }
.card h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.wallets { list-style: none; margin: 0; padding: 0; }
.wallets li { border-top: 1px solid var(--border); }
.wallets li:first-child { border-top: 0; }
.wallet-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  padding: .6rem 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.wallet-row .rank { width: 1.6rem; flex: none; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.wallet-row .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.wallet-row .who small { color: var(--muted); font-size: .8rem; }
.wallet-row .nums { text-align: right; display: flex; flex-direction: column; flex: none; max-width: 48%; }
.wallet-row .nums strong { font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.wallet-row .nums small { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.buyers-headline { display: flex; align-items: center; gap: .8rem; margin: .5rem 0 .25rem; }
.buyers-headline .big-count { margin: 0; font-size: 2.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }
.buyers-headline p:last-child { margin: 0; }
.levels { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0; }
.levels span { border: 1px solid var(--border); border-radius: 999px; padding: .15rem .6rem; font-size: .85rem; color: var(--muted); }
.levels b { color: var(--text); font-variant-numeric: tabular-nums; }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; }
.badges:empty { display: none; }
.badge { font-size: .7rem; font-weight: 700; padding: .05rem .4rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); }
.badge.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.small-list { font-size: .8rem; color: var(--muted); overflow-wrap: anywhere; }
.groups { list-style: none; margin: 0; padding: 0; }
.groups li { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-top: 1px solid var(--border); }
.groups li:first-child { border-top: 0; }
.groups li > span { flex: 1; display: flex; flex-direction: column; }
.groups small { color: var(--muted); }
.notes { margin: 0; padding-left: 1.1rem; font-size: .9rem; color: var(--muted); }
.notes li { margin-bottom: .35rem; }
.sheet {
  border: 0;
  border-radius: 16px;
  padding: 1rem;
  width: min(420px, calc(100vw - 2rem));
  background: var(--card);
  color: var(--text);
}
.sheet::backdrop { background: rgb(0 0 0 / .5); }
.sheet-title { font-size: .8rem; overflow-wrap: anywhere; color: var(--muted); margin: 0 0 .75rem; }
.sheet-actions { display: grid; gap: .5rem; margin-bottom: .5rem; }
.sheet form > button { width: 100%; }

.token-search { margin-top: .5rem; border: 1px solid var(--border); border-radius: 12px; padding: .25rem .6rem; background: var(--card); }
.token-search ul { list-style: none; margin: 0; padding: 0; }
.token-search li { border-top: 1px solid var(--border); }
.token-search li:first-child { border-top: 0; }
.token-search button { display: flex; gap: .6rem; align-items: center; width: 100%; padding: .55rem 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.token-search .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.token-search .who small { color: var(--muted); }
.token-search .nums { display: flex; flex-direction: column; text-align: right; flex: none; }
.token-search .nums small { color: var(--muted); font-size: .78rem; }
details.programs { margin-top: .75rem; }
details.programs summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .3rem 0; }

/* ---- BaZi ------------------------------------------------------------------------------- */

.theme-bazi {
  --accent: #7a1f1f; --accent-text: #fff8ec;
  --wood: #2f7d32; --fire: #c62828; --earth: #9a6a1c; --metal: #6b7280; --water: #1e5aa8;
}
@media (prefers-color-scheme: dark) {
  .theme-bazi {
    --accent: #e0b25a; --accent-text: #2a1606;
    --wood: #6fcf73; --fire: #ff7a6e; --earth: #e2ad55; --metal: #c4cad3; --water: #6fa8ff;
  }
}
.theme-bazi .balance { background: linear-gradient(160deg, rgb(255 255 255 / .1), transparent 55%), var(--accent); }
.bazi-headline { margin: .2rem 0 0; font-size: 1.6rem; font-weight: 700; }
.bazi-headline.cjk { font-size: 1.9rem; letter-spacing: .12em; }
.el-wood { color: var(--wood); } .el-fire { color: var(--fire); } .el-earth { color: var(--earth); }
.el-metal { color: var(--metal); } .el-water { color: var(--water); }
.pgrid { display: grid; grid-template-columns: 3.4rem repeat(4, minmax(0, 1fr)); margin-top: .5rem; }
.pc { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 .3rem; padding: .25rem .1rem; border-top: 1px solid var(--border); min-width: 0; text-align: center; }
.pgrid > .pc:first-child, .pc.ph { border-top: 0; font-size: .75rem; color: var(--muted); font-weight: 600; padding-bottom: .35rem; }
.pc.is-day { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.pc.ph.is-day { border-radius: 10px 10px 0 0; color: var(--text); }
.pc.missing { opacity: .5; }
.pc.rl { justify-content: flex-start; text-align: left; }
:where(.pv) { color: inherit; }
.pv { border: 0; background: none; font: inherit; padding: .1rem .15rem; border-radius: 6px; cursor: pointer; line-height: 1.2; }
.pv:hover, .pv.on { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.pc.rl .pv { display: flex; flex-direction: column; align-items: flex-start; font-size: .82rem; font-weight: 700; }
.pc.rl small { font-size: .75rem; font-weight: 400; color: var(--muted); }
.pc:not(.rl) .pv { font-size: .8rem; }
.pc.hid .pv { display: inline-flex; flex-direction: column; align-items: center; font-weight: 600; font-size: .95rem; }
.pc.hid small { font-size: .75rem; color: var(--muted); font-weight: 400; }
.pc.sub .pv { font-size: .78rem; color: var(--muted); }
.explain { margin: .75rem 0 0; padding: .65rem .8rem; border-radius: 10px; background: var(--bg); font-size: .9rem; color: var(--muted); }
.explain strong { color: var(--text); }
.glyph { display: block; font-size: 2.1rem; line-height: 1.15; font-weight: 700; font-family: "Songti SC", "Noto Serif SC", "Noto Serif CJK SC", serif; }
.pc:not(.rl) .pv.glyph { font-size: 2rem; }
.dm-line { display: flex; gap: .8rem; align-items: center; margin: .25rem 0 0; }
.dm-line small { color: var(--muted); }
.dm-glyph { font-size: 2.6rem; font-weight: 700; line-height: 1; font-family: "Songti SC", "Noto Serif SC", serif; }
.elements { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .45rem; }
.elements li { display: grid; grid-template-columns: 6rem 1fr 3.6rem; gap: .6rem; align-items: center; }
.el-name { font-weight: 600; font-size: .92rem; }
.bar { height: .7rem; background: var(--bg); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: currentColor; border-radius: 999px; }
.el-num { text-align: right; font-variant-numeric: tabular-nums; }
.el-num small { color: var(--muted); }
.luck-row { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; scroll-snap-type: x proximity; }
.lp {
  flex: 0 0 4.1rem; display: flex; flex-direction: column; align-items: center; gap: .05rem;
  padding: .45rem .1rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  color: inherit; font: inherit; scroll-snap-align: start; cursor: pointer;
}
div.lp { cursor: default; }
.lp .glyph { font-size: 1.6rem; }
.lp[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.lp.now { background: var(--bg); }
.lp.now .lp-bottom { color: var(--accent); font-weight: 700; }
.lp-top { font-size: .8rem; font-weight: 700; }
.lp-god { font-size: .75rem; color: var(--muted); }
.lp-bottom { font-size: .75rem; color: var(--muted); }
.tile.bazi { background: #7a1f1f; color: #fff8ec; border-color: #7a1f1f; }
.tile.bazi small { color: rgb(255 248 236 / .85); }
.reading dl { margin: 0; }
.reading dt { font-weight: 700; margin-top: .75rem; }
.reading dt:first-child { margin-top: 0; }
.reading dd { margin: .2rem 0 0; }
.how-to { margin-top: .5rem; }
.tz-line { margin: .4rem 0 0; min-height: 1em; }
.lp { position: relative; overflow: hidden; }
.lp::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; }
.lp.fav-good::before, .fav.good { background: var(--ok); }
.lp.fav-mixed::before, .fav.mixed { background: var(--warn); }
.lp.fav-hard::before, .fav.hard { background: var(--bad); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .45rem; font-size: .8rem; margin: .5rem 0 0; }
.fav { display: inline-block; width: .9rem; height: .3rem; border-radius: 2px; }
.pts { display: inline-block; min-width: 2.2rem; text-align: center; font-size: .8rem; border-radius: 999px; padding: 0 .35rem; margin-right: .25rem; font-variant-numeric: tabular-nums; }
.pts.plus { background: var(--ok-bg); color: var(--ok); }
.pts.minus { background: var(--bad-bg); color: var(--bad); }
.pts.zero { background: var(--bg); color: var(--muted); }
.lunar-row { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: .5rem; }
.lunar-row .field { min-width: 0; }
.lunar-row input, .lunar-row select { font-size: 1rem !important; padding: .55rem .5rem !important; min-width: 0; }
.lunar-line { margin: .4rem 0 0; min-height: 1em; }
input[type="date"]:disabled { opacity: .7; }
.pv.glyph .py { display: block; font-size: .75rem; font-weight: 400; font-family: system-ui, sans-serif; color: var(--muted); line-height: 1; }
.hour-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.hour { display: flex; flex-direction: column; align-items: center; padding: .45rem .1rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: inherit; font: inherit; cursor: pointer; }
.hour > span:nth-child(2), .hour > span:nth-child(3) { font-size: 1.3rem; font-weight: 700; font-family: "Songti SC", "Noto Serif SC", serif; line-height: 1.1; }
.hour > span:nth-child(2) { margin-top: .15rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .25rem; text-align: center; }
.cal-h { font-size: .75rem; color: var(--muted); font-weight: 700; }
.cal-d { display: flex; flex-direction: column; padding: .3rem 0 .25rem; border-radius: 8px; background: var(--bg); border-bottom: 3px solid transparent; min-width: 0; }
.cal-d b { font-size: .85rem; }
.cal-d small { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; }
button.cal-d { font: inherit; color: inherit; border-top: 0; border-left: 0; border-right: 0; cursor: pointer; }
.view-date { display: flex; gap: .4rem; align-items: center; margin: .5rem 0 .75rem; }
.view-date input { flex: 1; min-width: 0; width: auto; font-size: 1rem; padding: .5rem .6rem; }
.view-date button { flex: none; }
.cal-d small.clash { color: var(--bad); font-weight: 700; }
.cal-d.fav-good { border-bottom-color: var(--ok); }
.cal-d.fav-mixed { border-bottom-color: var(--warn); }
.cal-d.fav-hard { border-bottom-color: var(--bad); }
.cal-d.now { outline: 2px solid var(--accent); }
#now .lp { flex: 1 1 0; }
.theme-bazi .tabs { overflow-x: auto; scrollbar-width: none; }
.theme-bazi .tabs button { flex: 1 0 auto; padding-left: .55rem; padding-right: .55rem; }
@media (max-width: 360px) { .theme-bazi .tabs button { padding-left: .35rem; padding-right: .35rem; font-size: .95rem; } }
.summary-cta { width: 100%; margin-bottom: 1rem; }
.sum-hero { text-align: center; }
.sum-name { margin: 0 0 .5rem; font-weight: 700; font-size: 1.1rem; }
.sum-pillars { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; }
.sum-p { display: flex; flex-direction: column; align-items: center; padding: .4rem 0; border-radius: 12px; }
.sum-p.is-day { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.sum-p.missing { opacity: .5; }
.sum-p small { color: var(--muted); font-size: .75rem; }
.sum-p b { font-size: 2.2rem; line-height: 1.15; font-family: "Songti SC", "Noto Serif SC", serif; }
.sum { margin: 0; }
.sum-row { padding: .55rem 0; border-top: 1px solid var(--border); }
.sum-row:first-child { border-top: 0; padding-top: 0; }
.sum dt { font-size: .8rem; color: var(--muted); font-weight: 600; }
.sum dd { margin: .15rem 0 0; font-size: 1rem; }
.fav-badge.good { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.fav-badge.mixed { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.fav-badge.hard { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.sum-more { text-align: center; }
.linkish { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; padding: 0; cursor: pointer; text-decoration: underline; }
.lang-switch {
  position: absolute; right: 1rem; top: calc(.6rem + env(safe-area-inset-top)); z-index: 1;
  display: flex; border: 1px solid rgb(255 255 255 / .5); border-radius: 999px; overflow: hidden; font-size: .8rem; font-weight: 700;
}
.lang-switch label { padding: .3rem .6rem; cursor: pointer; }
.lang-switch label + label { border-left: 1px solid rgb(255 255 255 / .35); }
.lang-switch label:has(input:checked) { background: var(--accent-text); color: var(--accent); }
.lang-switch input { position: absolute; opacity: 0; pointer-events: none; }
.lang-switch label:has(input:focus-visible) { outline: 2px solid var(--accent-text); outline-offset: -3px; }
.theme-bazi .balance { padding-top: calc(2.6rem + env(safe-area-inset-top)); padding-bottom: .8rem; }
.theme-bazi .balance .eyebrow { font-size: .8rem; }
.full-reading > summary {
  list-style: none; cursor: pointer; text-align: center; font-weight: 700; padding: .8rem 1rem; margin-bottom: 1rem;
  border-radius: 10px; border: 1px solid var(--border); background: var(--card);
}
.full-reading > summary::-webkit-details-marker { display: none; }

/* ---- BaZi: tap targets, markers, folded form ---- */
.theme-bazi .back { padding: .7rem .5rem .7rem 0; top: calc(.1rem + env(safe-area-inset-top)); }
.lang-switch { top: calc(.35rem + env(safe-area-inset-top)); font-size: .85rem; }
.lang-switch label { padding: .65rem .85rem; min-width: 2.9rem; text-align: center; }
.theme-bazi .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); }
.theme-bazi .check { min-height: 2.75rem; }
.theme-bazi .check input { width: 1.25rem; height: 1.25rem; flex: none; }
.theme-bazi .seg label { padding: .75rem .5rem; }
.pc .pv { min-height: 2.75rem; min-width: 2.75rem; }
.pc.rl .pv { width: 100%; justify-content: center; }
.pc.hid .pv { min-height: 2.75rem; min-width: 2.5rem; justify-content: center; }
.show-chart { width: 100%; margin-top: 1rem; }
.form-compact { display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem; }
.form-compact p { flex: 1; margin: 0; font-weight: 600; font-size: .95rem; min-width: 0; }
.form-compact button { min-height: 2.75rem; }
.fav-mark { position: absolute; top: 6px; right: 5px; font-size: .75rem; font-weight: 800; line-height: 1; }
.fav-mark.good, .fav.good { color: var(--ok); }
.fav-mark.mixed, .fav.mixed { color: var(--warn); }
.fav-mark.hard, .fav.hard { color: var(--bad); }
.fav { width: auto; height: auto; background: none !important; font-weight: 800; }
.cal-d { position: relative; }
.cal-d .fav-mark { top: 3px; right: 3px; font-size: .75rem; }
.luck-row { -webkit-mask-image: linear-gradient(to right, #000 88%, transparent); mask-image: linear-gradient(to right, #000 88%, transparent); }
#now { -webkit-mask-image: none; mask-image: none; }
.lp .lp-top { padding: 0 .85rem; }

/* ---- Feng Shui (builds on the BaZi theme) ------------------------------------------------- */

.theme-fengshui { --accent: #14503c; --accent-text: #f7efd9; --gold: #b8892b; }
@media (prefers-color-scheme: dark) {
  .theme-fengshui { --accent: #d9b864; --accent-text: #1a1406; --gold: #e2c06e; }
}
.tile.fengshui { background: #14503c; color: #f7efd9; border-color: #14503c; }
.tile.fengshui small { color: rgb(247 239 217 / .85); }
.fs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; margin-top: .6rem; }
.fs-cell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem;
  min-height: 6.2rem; padding: 1.15rem .2rem .35rem; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: inherit; font: inherit; cursor: pointer; min-width: 0;
}
.fs-cell.center { background: var(--bg); }
.fs-cell.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fs-cell.combo-good { background: var(--ok-bg); }
.fs-cell.combo-bad { background: var(--bad-bg); }
.fs-cell.combo-mixed { background: var(--warn-bg); }
.fs-palace { position: absolute; top: .3rem; left: .4rem; font-size: .72rem; font-weight: 700; color: var(--muted); }
.fs-palace i { font-style: normal; font-weight: 400; }
.fs-tags { display: flex; gap: .15rem; flex-wrap: wrap; justify-content: center; }
.fs-tags:empty { display: none; }
.fs-tag { font-size: .62rem; font-weight: 800; line-height: 1.3; padding: 0 .3rem; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.fs-tag.sit { background: var(--muted); color: var(--card); }
.fs-tag.warn { background: var(--bad); color: #fff; }
.fs-stars { display: flex; gap: 1.1rem; font-size: 1.7rem; line-height: 1; font-variant-numeric: tabular-nums; }
.fs-stars.one { font-size: 2.2rem; }
.fs-base { display: flex; align-items: center; gap: .4rem; font-size: 1rem; color: var(--muted); font-weight: 600; min-height: 1.4rem; }
.fs-base .an {
  font-style: normal; font-size: .8rem; font-weight: 700; width: 1.35rem; height: 1.35rem; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1.5px solid var(--gold); color: var(--gold);
}
.fs-base .an.hard { border-color: var(--bad); color: var(--bad); }
.ts-good { color: var(--ok); }
.ts-mixed { color: var(--warn); }
.ts-hard { color: var(--bad); }
.ts-dim { color: var(--text); font-weight: 500; }
.fs-legend span { color: var(--muted); }
.fs-legend span.ts-good, .fs-legend span.ts-mixed, .fs-legend span.ts-hard { margin-left: .35rem; }
.fs-legend .ts-good { color: var(--ok); } .fs-legend .ts-mixed { color: var(--warn); } .fs-legend .ts-hard { color: var(--bad); }
.ms-key, .ws-key { color: var(--text); }
.fs-tone { font-weight: 800; }
.fs-tone.good { color: var(--ok); } .fs-tone.bad { color: var(--bad); } .fs-tone.mixed { color: var(--warn); }
.explain p { margin: .35rem 0 0; }
.explain p:first-child { margin-top: 0; }
.seg-mini { margin-top: 0; flex: none; }
.seg-mini label { padding: .35rem .6rem !important; font-size: .8rem; white-space: nowrap; }
.fs-more { margin-top: .75rem; }
.fs-more summary { cursor: pointer; color: var(--muted); font-size: .9rem; padding: .3rem 0; }
.fs-more select { width: 100%; font: inherit; padding: .6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
.fs-grid-small .fs-cell { min-height: 4.6rem; padding-top: 1.1rem; cursor: default; }
.fs-cell.mz.good { background: var(--ok-bg); }
.fs-cell.mz.bad { background: var(--bad-bg); }
.fs-mz { font-weight: 700; font-size: .85rem; }
.fs-cell.mz.good .fs-mz { color: var(--ok); }
.fs-cell.mz.bad .fs-mz { color: var(--bad); }
.fs-small { font-size: .7rem; color: var(--muted); text-align: center; line-height: 1.2; }
.fs-kua { font-size: 2rem; font-weight: 800; line-height: 1; color: var(--accent); }
.fs-import { display: flex; flex-direction: column; gap: .4rem; }
.fs-import button { text-align: left; }
.fs-import small { color: var(--muted); font-weight: 400; }
.fs-error { color: var(--bad); font-size: .9rem; margin: .5rem 0; }
.fs-months { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3rem; }
.fs-month { display: flex; flex-direction: column; align-items: center; padding: .4rem .2rem; border-radius: 10px; background: var(--bg); text-align: center; min-width: 0; }
.fs-month small { font-size: .7rem; color: var(--muted); }
.fs-month b { font-size: 1.4rem; line-height: 1.2; }
.fs-month.now { outline: 2px solid var(--accent); }
.fs-compass-card { text-align: center; }
.fs-compass-card button { width: 100%; margin-top: .5rem; }
.fs-dial-wrap { position: relative; width: min(100%, 320px); margin: 0 auto; aspect-ratio: 1; }
.fs-dial { width: 100%; height: 100%; display: block; }
.fs-dial .ring0 { fill: var(--accent); }
.fs-dial .ring1 { fill: color-mix(in srgb, var(--accent) 82%, #000); }
.fs-dial .ring2 { fill: color-mix(in srgb, var(--accent) 65%, #000); }
.fs-dial .ring3 { fill: color-mix(in srgb, var(--accent) 50%, #000); }
.fs-dial .tick { stroke: var(--accent-text); stroke-width: 1; opacity: .7; }
.fs-dial .edge { stroke: var(--accent-text); stroke-width: .6; opacity: .35; }
.fs-dial .edge.big { stroke-width: 1.4; opacity: .7; }
.fs-dial text { fill: var(--accent-text); text-anchor: middle; dominant-baseline: central; }
.fs-dial .mtn { font-size: 15px; font-weight: 700; font-family: "Songti SC", "Noto Serif SC", serif; }
.fs-dial .tri { fill: var(--accent-text); font-size: 22px; }
.fs-dial .dir { font-size: 12px; font-weight: 800; }
.fs-dial .pin { fill: var(--bad); }
.fs-needle { position: absolute; left: 50%; top: -2px; bottom: 50%; width: 3px; margin-left: -1.5px; background: var(--bad); border-radius: 2px; pointer-events: none; }
.fs-needle::before { content: ""; position: absolute; top: -2px; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top: 10px solid var(--bad); }
.fs-heading { margin: .8rem 0 0; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.fs-center { text-align: center; }
.fs-steps { margin: 0; padding-left: 1.2rem; }
.fs-steps li { margin: .35rem 0; }
.fs-disclaimer { text-align: center; font-size: .8rem; }
.fs-guide > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; }
.fs-guide > summary::-webkit-details-marker { display: none; }
.fs-guide > summary h2 { margin: 0; }
.fs-guide > summary::after { content: "+"; font-size: 1.3rem; color: var(--muted); }
.fs-guide[open] > summary::after { content: "–"; }
.fs-guide .fs-steps { font-size: .95rem; }
.fs-file { position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.fs-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
label.fs-file.primary { display: flex; width: 100%; padding: .75rem 1rem; border-radius: 10px; font-weight: 600; background: var(--accent); color: var(--accent-text); }
label.fs-file.secondary { padding: .4rem .7rem; font-size: .9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-weight: 600; }
.fs-plan { margin-top: .6rem; border-radius: 10px; overflow: auto; max-height: 75vh; border: 1px solid var(--border); background: #fff; }
.fs-plan-stage { position: relative; min-width: 100%; }
.fs-plan img { display: block; width: 100%; height: auto; }
.fs-plan-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.fs-plan-svg.fitting { touch-action: none; }
.fs-plan-svg .pfill { fill: rgb(255 255 255 / .08); cursor: pointer; }
.fs-plan-svg .good .pfill { fill: rgb(21 128 61 / .16); }
.fs-plan-svg .bad .pfill { fill: rgb(185 28 28 / .16); }
.fs-plan-svg .mixed .pfill { fill: rgb(180 83 9 / .14); }
.fs-plan-svg .on .pfill { stroke: #14503c; stroke-width: 6; }
.fs-plan-svg .hatch { stroke: rgb(0 0 0 / .25); stroke-width: 4; }
.fs-plan-svg .pline { stroke: #14503c; stroke-width: 2.5; stroke-dasharray: 10 6; }
.fs-plan-svg .pframe { fill: none; stroke: #14503c; }
.fs-plan-svg .pdoor { stroke: #c2410c; stroke-linecap: round; }
.fs-plan-svg .phandle { fill: #b8892b; stroke: #fff; cursor: grab; }
.fs-plan-svg text { text-anchor: middle; dominant-baseline: central; pointer-events: none; paint-order: stroke; stroke: rgb(255 255 255 / .9); stroke-width: 5px; stroke-linejoin: round; }
.fs-plan-svg .plabel { fill: #3f4650; font-weight: 700; }
.fs-plan-svg .pmain { fill: #1a1d21; font-weight: 800; }
.fs-plan-svg .good .pmain { fill: #15803d; }
.fs-plan-svg .bad .pmain { fill: #b91c1c; }
.fs-plan-svg .psub { fill: #3f4650; font-weight: 600; }
.fs-plan-svg .ts-good { fill: #15803d; } .fs-plan-svg .ts-mixed { fill: #b45309; } .fs-plan-svg .ts-hard { fill: #b91c1c; } .fs-plan-svg .ts-dim { fill: #1a1d21; }
.fs-label { margin: .75rem 0 0; font-size: .9rem; color: var(--muted); }
.fs-plan-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .75rem; }
#plan-detail { margin-top: .75rem; }
.fs-role { margin-top: .25rem; }
.fs-role select, #p-role { width: 100%; font: inherit; padding: .55rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
.fs-plan-svg .fitting .pfill, .fs-plan-svg.fitting .pfill { fill: rgb(20 80 60 / .06); cursor: move; }
.fs-plan-svg .plabel.faint { fill: #14503c; opacity: .7; }
.fs-plan-fit { margin-top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.fs-ctl { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.fs-ctl input[type="range"] { flex: 1; min-width: 6rem; }
.fs-ctl output { min-width: 3rem; text-align: center; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }
.fs-ctl button { min-width: 2.5rem; min-height: 2.5rem; }
.fs-spacer { flex: 1; }

/* ---- AI for Beginners ------------------------------------------------------------------- */

.theme-learnai { --accent: #1e40af; --accent-text: #fff; }
@media (prefers-color-scheme: dark) { .theme-learnai { --accent: #93b4ff; --accent-text: #0b1a40; } }
.theme-learnai .balance { background: linear-gradient(160deg, rgb(255 255 255 / .12), transparent 55%), var(--accent); }
.theme-learnai .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); }
.la-level { margin: 1.4rem .25rem .2rem; font-size: 1.15rem; }
.la-level small { display: block; margin-top: .15rem; font-size: .8rem; font-weight: 500; color: var(--muted); }
.la-level-about { margin: 0 .25rem .6rem; }
.tile.learnai { background: #1e40af; color: #fff; border-color: #1e40af; }
.tile.learnai small { color: rgb(255 255 255 / .95); }
.la-progress { height: .45rem; margin: .6rem auto 0; max-width: 16rem; border-radius: 999px; background: rgb(255 255 255 / .25); overflow: hidden; }
.la-progress span { display: block; height: 100%; width: 0; background: var(--accent-text); border-radius: 999px; transition: width .3s; }
.la-continue { width: 100%; margin-bottom: 1rem; padding: .9rem 1rem; font-size: 1rem; text-align: left; }
.la-lessons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.la-lesson { width: 100%; display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: inherit; font: inherit; text-align: left; cursor: pointer; }
.la-lesson.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--border)); }
.la-emoji { font-size: 1.6rem; flex: none; }
.la-text { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.la-text small { color: var(--muted); }
.la-check { flex: none; font-size: 1.2rem; font-weight: 800; color: var(--muted); }
.la-lesson.done .la-check { color: var(--ok); }
.la-reset { text-align: center; margin-top: 1rem; font-size: .9rem; }
.la-cert { text-align: center; }
.la-cert-emoji { font-size: 3rem; margin: 0; line-height: 1.2; }
.la-lesson-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; font-weight: 700; }
.la-dots { display: flex; gap: .25rem; margin-bottom: .8rem; }
.la-dots span { flex: 1; height: .3rem; border-radius: 999px; background: var(--border); }
.la-dots span.q { background: color-mix(in srgb, var(--accent) 20%, var(--border)); }
.la-dots span.past { background: var(--accent); opacity: .5; }
.la-dots span.now { background: var(--accent); }
.la-card, .la-demo, .la-quiz, .la-finish { font-size: 1.05rem; line-height: 1.55; }
.la-card h2, .la-quiz h2, .la-demo h2 { font-size: 1.25rem; line-height: 1.3; margin: 0 0 .6rem; }
.la-card ul, .la-card ol { padding-left: 1.2rem; }
.la-card li { margin: .3rem 0; }
.eyebrow-dark { margin: 0 0 .3rem; font-size: .8rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }
.la-nav { display: flex; gap: .6rem; }
.la-nav button { flex: 1; padding: .85rem; font-size: 1rem; }
.la-nav button:disabled { opacity: .4; }
.la-options { display: flex; flex-direction: column; gap: .5rem; }
.la-option { text-align: left; padding: .8rem .9rem; border-radius: 12px; border: 1.5px solid var(--border); background: var(--card); color: inherit; font: inherit; cursor: pointer; }
.la-option.right { border-color: var(--ok); background: var(--ok-bg); }
.la-option.wrong { border-color: var(--bad); background: var(--bad-bg); }
.la-option.dim { opacity: .55; }
.la-option:disabled { cursor: default; }
.la-why { margin: .8rem 0 0; padding: .7rem .8rem; border-radius: 10px; font-size: .95rem; }
.la-why.right { background: var(--ok-bg); }
.la-why.wrong { background: var(--warn-bg); }
.la-finish { text-align: center; display: flex; flex-direction: column; gap: .6rem; }
.la-finish button { width: 100%; }
.la-label { margin: .8rem 0 .3rem; font-size: .9rem; color: var(--muted); }
.la-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.la-chip { padding: .55rem .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: inherit; font: inherit; font-weight: 600; cursor: pointer; }
.la-sentence { font-size: 1.3rem; font-weight: 700; margin: .6rem 0; min-height: 1.6rem; }
.la-caret { color: var(--accent); animation: la-blink 1s steps(1) infinite; }
@keyframes la-blink { 50% { opacity: 0; } }
.la-odds { display: flex; flex-direction: column; gap: .35rem; }
.la-odd { display: grid; grid-template-columns: 5.5rem 1fr 3rem; align-items: center; gap: .5rem; padding: .5rem .6rem; border-radius: 10px; border: 1px solid var(--border); background: var(--card); color: inherit; font: inherit; cursor: pointer; text-align: left; }
.la-odd .w { font-weight: 700; }
.la-odd .bar { height: .6rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.la-odd .bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.la-odd .p { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.la-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.la-two > * { flex: 1; }
.la-msg { margin: .6rem 0; padding: .9rem 1rem; border-radius: 14px 14px 14px 4px; background: var(--bg); border: 1px solid var(--border); font-size: 1.05rem; }
.la-big { padding: .9rem; border-radius: 12px; border: 0; font: inherit; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.la-big.bad { background: var(--bad-bg); color: var(--bad); }
.la-big.good { background: var(--ok-bg); color: var(--ok); }
.la-test { margin-top: .6rem; padding: .7rem .8rem; border-radius: 12px; border: 1px solid var(--border); }
.la-test p { margin: 0; }
.la-test p + p { margin-top: .3rem; }
.la-test.ok { border-color: color-mix(in srgb, var(--ok) 50%, var(--border)); }
.la-test.miss { border-color: color-mix(in srgb, var(--bad) 50%, var(--border)); }
.la-verdict { font-weight: 700; }
.la-verdict small { font-weight: 400; color: var(--muted); }
.la-verdict b.ok { color: var(--ok); } .la-verdict b.miss { color: var(--bad); }
.la-clue { display: inline-block; padding: 0 .4rem; border-radius: 999px; font-weight: 600; }
.la-clue.bad { background: var(--bad-bg); color: var(--bad); }
.la-clue.good { background: var(--ok-bg); color: var(--ok); }
.la-score { margin: .8rem 0 .4rem; }
.la-textarea, .la-search { width: 100%; font: inherit; padding: .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); resize: vertical; }
.la-tokens { display: flex; flex-wrap: wrap; gap: 2px; margin-top: .7rem; font-family: ui-monospace, Menlo, monospace; font-size: .95rem; }
.la-tokens .tk { padding: .15rem .2rem; border-radius: 4px; white-space: pre; }
.tk.c0 { background: #dbeafe; color: #1e3a8a; } .tk.c1 { background: #dcfce7; color: #14532d; } .tk.c2 { background: #fef3c7; color: #78350f; }
.tk.c3 { background: #fce7f3; color: #831843; } .tk.c4 { background: #ede9fe; color: #4c1d95; }
.la-built { padding: .8rem; border-radius: 10px; background: var(--bg); border: 1px dashed var(--accent); margin-bottom: .6rem; }
.la-weak { color: var(--muted); font-style: italic; }
.la-prompt h3 { margin: 0 0 .4rem; font-size: 1rem; }
.la-prompt p { margin: 0 0 .6rem; }
.la-prompt mark { background: color-mix(in srgb, var(--accent) 18%, transparent); color: inherit; border-radius: 4px; padding: 0 .15rem; }
.la-search { margin-top: .5rem; }
.la-glossary dt { font-weight: 700; margin-top: .8rem; }
.la-glossary dd { margin: .2rem 0 0; color: var(--muted); }
.fs-door-btn { width: 100%; margin-top: .75rem; }
.fs-plan-svg .prose-bg { fill: rgb(255 255 255 / .85); stroke: #14503c; stroke-width: 1; }
.fs-plan-svg .prose-n { stroke: #c2410c; stroke-linecap: round; }
.fs-plan-svg .prose-l { stroke: #14503c; opacity: .6; }
.fs-plan-svg .prose-t { fill: #14503c; font-weight: 800; stroke: none; }
.fs-plan-svg .prose-t.n { fill: #c2410c; }
.fs-plan-svg .pdoor-pin { fill: #c2410c; stroke: #fff; }
.fs-plan-svg .pdoor-label { fill: #c2410c; font-weight: 800; }
.fs-offset { text-align: left; }
.fs-offset input { flex: 1; min-width: 0; font: inherit; padding: .55rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }

/* ---- Split ------------------------------------------------------------------- */

.theme-split { --accent: #6d28d9; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-split { --accent: #a78bfa; --accent-text: #1e1035; } }
.tile.split { background: #6d28d9; color: #fff; border-color: #6d28d9; }
.tile.split small { color: rgb(255 255 255 / .95); }
.theme-split .history li.tap { cursor: pointer; }
.theme-split .row-head { margin-bottom: .35rem; }
.theme-split .row-head h2 { margin: 0; }
.group-list { list-style: none; margin: .25rem -.5rem 0; padding: 0; }
.group-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .5rem; border-radius: 12px; }
.group-row + .group-row { margin-top: .15rem; }
.group-row[data-group] { cursor: pointer; }
.group-row[data-group]:hover, .group-row[data-group]:focus-visible { background: var(--bg); outline: none; }
.gr-badge { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 800; font-size: 1.1rem; }
.gr-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.gr-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gr-sub { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.gr-status { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: .1rem; }
.gr-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gr-amt.muted { color: var(--muted); font-weight: 600; }
.gr-label { color: var(--muted); font-size: .75rem; }
.gr-chev { flex: none; color: var(--muted); font-size: 1.4rem; line-height: 1; margin-left: -.2rem; }
.text-btn { border: 0; background: none; padding: .25rem .1rem; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; }
.bin-btn { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--bad) 12%, transparent); color: var(--bad); cursor: pointer; }
.bin-btn:active { background: color-mix(in srgb, var(--bad) 22%, transparent); }
.theme-split .history li.editing { background: var(--bg); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 10px; }
.theme-split .pos { color: var(--ok); }
.theme-split .neg { color: var(--bad); }
.check-row { display: flex; gap: .55rem; align-items: center; margin-top: .75rem; font-size: .92rem; }
.check-row input, .big-check { width: 1.35rem; height: 1.35rem; accent-color: var(--accent); flex: none; }
.check-row small { color: var(--muted); font-weight: 600; }
.split-rows { margin-top: .5rem; }
#split-field .field-label { margin: 1rem 0 0; font-size: .9rem; color: var(--muted); }
#split-field .seg { margin-top: .4rem; }
.seg-2line label { display: flex; flex-direction: column; align-items: center; gap: .1rem; line-height: 1.2; padding: .55rem .3rem; }
.seg-2line label small { font-weight: 500; font-size: .72rem; opacity: .75; }
.split-hint { margin: .55rem 0 0; }
.charges .check-row { margin-top: .55rem; gap: .4rem; }
.charges .check-row input[type="checkbox"] { margin-right: .15rem; }
.check-row .rate-input { width: 3.6rem; height: auto; flex: none; accent-color: auto; font: inherit; text-align: right; padding: .3rem .45rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
.charges small { display: block; margin: .35rem 0 0 1.9rem; color: var(--muted); font-weight: 600; font-size: .85rem; }
.who-btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.who-btns button { flex: 1 1 8rem; font-size: 1.05rem; padding: .8rem 1rem; }
.you-card .eyebrow { margin: 0 0 .25rem; }
.you-card button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.you-line + .you-line { border-top: 1px solid var(--border); margin-top: .7rem; padding-top: .7rem; }
.you-big { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .25rem .75rem; margin: .2rem 0; font-size: 1.15rem; }
.you-big .amt { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.you-line .row-btns { justify-content: flex-start; }
.you-how { margin-top: .9rem; }
.sh-sub { font-size: 1rem; margin: 1rem 0 .25rem; }
.sh-foot { text-align: center; margin: 1rem 1rem 2rem; }
.share-edit { margin-top: 1rem; }
.share-edit summary { cursor: pointer; font-weight: 600; color: var(--muted); }
.you-how summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.cents-input {
  width: 6.5rem;
  font: inherit;
  text-align: right;
  font-variant-numeric: tabular-nums;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.amount-row { display: flex; gap: .5rem; }
.amount-row input { flex: 1; min-width: 0; }
.amount-row select { flex: none; width: 5.5rem; font: inherit; font-weight: 600; padding: .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.fx-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .6rem; font-size: .92rem; color: var(--muted); }
.fx-row input { width: 7rem; font: inherit; padding: .45rem .55rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
.fx-row small { flex-basis: 100%; }
.row-btns { display: flex; gap: .5rem; margin-top: .5rem; justify-content: flex-end; }
.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; gap: .5rem; align-items: center; padding: .4rem 0; }
.member-list input {
  min-width: 0;
  font: inherit;
  padding: .55rem .65rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.member-list .name { flex: 3; }
.member-list .paynow { flex: 2; }
.member-list .icon-btn { flex: none; }
.member-list .icon-btn:disabled { opacity: .3; }
button.danger { color: var(--bad); }
.qr-dialog { border: 0; border-radius: 16px; padding: 1.25rem; width: min(92vw, 360px); background: var(--card); color: var(--text); }
.qr-dialog::backdrop { background: rgb(0 0 0 / .5); }
.qr-dialog h2 { display: block; text-align: center; }
.qr-code { background: #fff; color: #111; border-radius: 12px; padding: .5rem; margin: .75rem 0; min-height: 4rem; display: grid; place-items: center; text-align: center; font-size: .9rem; }
.qr-code svg { width: 100%; height: auto; }

/* ---- Trip Planner -------------------------------------------------------------- */

.theme-trip { --accent: #0369a1; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-trip { --accent: #38bdf8; --accent-text: #062033; } }
.tile.trip { background: #0369a1; color: #fff; border-color: #0369a1; }
.tile.trip small { color: rgb(255 255 255 / .95); }
.theme-trip .history li.tap { cursor: pointer; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.date-row .field { min-width: 0; }
.date-row input, .date-row select { min-width: 0; font-size: 1rem !important; }
.day-card.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-items { list-style: none; margin: .5rem 0 0; padding: 0; }
.plan-items li { display: flex; gap: .6rem; align-items: flex-start; padding: .6rem 0; border-top: 1px solid var(--border); cursor: pointer; }
.plan-items li:first-child { border-top: 0; }
.plan-items .time { width: 3.1rem; flex: none; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); padding-top: .05rem; }
.plan-items .kind { flex: none; }
.plan-items .body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.plan-items .body small { color: var(--muted); white-space: pre-line; }
.plan-items .place { color: var(--accent); font-size: .9rem; text-decoration: none; align-self: flex-start; }
.progress-bar { height: .6rem; border-radius: 999px; background: var(--bg); border: 1px solid var(--border); overflow: hidden; margin-top: .5rem; }
.progress-bar span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.muted-text { color: var(--muted); }
.pack-list { list-style: none; margin: .25rem 0 0; padding: 0; }
.pack-list li { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; border-top: 1px solid var(--border); }
.pack-list li:first-child { border-top: 0; }
.pack-list label { flex: 1; display: flex; gap: .65rem; align-items: center; min-width: 0; cursor: pointer; }
.pack-list input { width: 1.35rem; height: 1.35rem; accent-color: var(--accent); flex: none; }
.pack-list span { display: flex; flex-direction: column; min-width: 0; }
.pack-list small { color: var(--muted); font-size: .8rem; }
.pack-list li.packed strong { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.pack-list .icon-btn { width: 1.9rem; height: 1.9rem; font-size: .8rem; color: var(--muted); flex: none; }
.cat-select { flex: none; width: 8.5rem; font: inherit; padding: .6rem .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.field-label { font-size: .9rem; color: var(--muted); margin: 1rem 0 .4rem; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.chip-toggle { padding: .45rem .75rem; border: 1px solid var(--border); border-radius: 999px; font-size: .92rem; font-weight: 600; cursor: pointer; }
.chip-toggle:has(input:checked) { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.chip-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.sheet { border: 0; border-radius: 16px; padding: 1.1rem; width: min(94vw, 480px); background: var(--card); color: var(--text); }
.sheet::backdrop { background: rgb(0 0 0 / .5); }
.sheet h2 { display: block; }
.sheet .seg label { padding: .5rem .2rem; }
@media (max-width: 420px) { .kind-label { display: none; } }
@media (max-width: 400px) { .date-row { grid-template-columns: 1fr; gap: 0; } }

/* ---- BaZi: Zi Wei Dou Shu chart -------------------------------------------------- */

.zw-card { padding: .75rem; }
.zw-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; margin-top: .5rem; }
.zw-cell {
  display: flex; flex-direction: column; gap: .15rem; min-height: 6.6rem; padding: .3rem .25rem;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text);
  font: inherit; font-size: .68rem; line-height: 1.25; text-align: left; cursor: pointer; min-width: 0; overflow: hidden;
}
.zw-cell.life { border-color: var(--accent); }
.zw-cell.life .zw-name { color: var(--accent); }
.zw-cell.now { box-shadow: inset 0 0 0 2px var(--accent); }
.zw-cell.year { background: color-mix(in srgb, var(--accent) 9%, var(--bg)); }
.zw-cell.sel { outline: 2px solid var(--text); outline-offset: -2px; }
.zw-name { font-weight: 700; font-size: .72rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .1rem .2rem; }
.zw-body { font-style: normal; font-size: .58rem; padding: 0 .2rem; border-radius: 4px; background: var(--accent); color: var(--accent-text); white-space: nowrap; }
.zw-stars { display: flex; flex-wrap: wrap; gap: 0 .3rem; }
.zw-main { font-size: .86rem; font-weight: 700; white-space: nowrap; }
.zw-empty { color: var(--muted); }
.zw-minors { display: flex; flex-wrap: wrap; gap: 0 .25rem; }
.zw-minor { white-space: nowrap; }
.zw-minor.good { color: var(--ok); }
@media (prefers-color-scheme: light) { .zw-minor.good { color: #166534; } }
.zw-minor.bad { color: var(--bad); }
.zw-foot { margin-top: auto; display: flex; flex-wrap: wrap; justify-content: space-between; color: var(--muted); font-size: .62rem; gap: 0 .2rem; }
.zw-foot span { white-space: nowrap; }
.zw-centre {
  grid-column: 2 / 4; grid-row: 2 / 4; display: flex; flex-direction: column; justify-content: center; align-items: center;
  gap: .25rem; text-align: center; font-size: .72rem; color: var(--muted); padding: .4rem;
}
.zw-centre strong { color: var(--text); font-size: .95rem; }
.zw-hua-line { color: var(--text); font-weight: 600; }
.hua { display: inline-block; font-size: .6rem; font-weight: 800; line-height: 1; padding: .1rem .18rem; margin-left: .1rem; border-radius: 3px; color: #fff; vertical-align: .1em; }
.hua.h0 { background: #15803d; }
.hua.h1 { background: #7c3aed; }
.hua.h2 { background: #0369a1; }
.hua.h3 { background: #b91c1c; }
.zw-key { display: inline-block; width: .9rem; height: .7rem; border-radius: 3px; vertical-align: -.05em; border: 1px solid var(--border); }
.zw-key.now { box-shadow: inset 0 0 0 2px var(--accent); }
.zw-key.year { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); }
@media (max-width: 380px) { .zw-cell { font-size: .62rem; } .zw-main { font-size: .78rem; } }

/* ---- Zi Wei Dou Shu app ---------------------------------------------------------- */

.theme-ziwei { --accent: #5b21b6; --accent-text: #faf5ff; }
@media (prefers-color-scheme: dark) { .theme-ziwei { --accent: #c4b5fd; --accent-text: #1e0a3c; } }
.tile.ziwei { background: #5b21b6; color: #fff; border-color: #5b21b6; }
.tile.ziwei small { color: rgb(255 255 255 / .95); }
.theme-ziwei .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); padding-bottom: .8rem; }
.theme-ziwei .balance .eyebrow { font-size: .8rem; }
.theme-ziwei .back { padding: .7rem .5rem .7rem 0; top: calc(.1rem + env(safe-area-inset-top)); }
.theme-ziwei .check { min-height: 2.75rem; }
.theme-ziwei .check input { width: 1.25rem; height: 1.25rem; flex: none; }
.theme-ziwei .seg label { padding: .75rem .5rem; }
.zw-periods, .zw-hours { list-style: none; margin: 0; padding: 0; }
.zw-periods li, .zw-hours li { border-top: 1px solid var(--border); }
.zw-periods li:first-child, .zw-hours li:first-child { border-top: 0; }
.zw-periods li { display: flex; gap: .75rem; padding: .6rem 0; }
.zw-periods li.now, .zw-hours li.now { background: color-mix(in srgb, var(--accent) 8%, transparent); margin: 0 -.5rem; padding-left: .5rem; padding-right: .5rem; border-radius: 10px; }
.zw-periods small, .zw-hours small { color: var(--muted); }
.zw-age { flex: none; width: 4.2rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.zw-hour { display: flex; gap: .75rem; width: 100%; padding: .6rem 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }

/* ---- Petty Cash: Stats ----------------------------------------------------------- */

:root { --chart: #0d9488; }
@media (prefers-color-scheme: dark) { :root:not(.theme-win95) { --chart: #13a898; } }
.theme-win95 { --chart: #1084d0; }
.stats-period { margin: 0 0 1rem; }
.stats-period label { font-size: .85rem; padding: .55rem .2rem; }
.stats-hero { text-align: center; }
.hero-label { margin: 0; color: var(--muted); font-size: .9rem; }
.hero-value { margin: .1rem 0; font-size: 3rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hero-delta { margin: 0; font-size: .88rem; color: var(--muted); min-height: 1.2em; }
.hero-delta.up { color: var(--warn); font-weight: 600; }
.hero-delta.down { color: var(--ok); font-weight: 600; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin: 0 0 1rem; }
.kpis div { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: .65rem .8rem; }
.kpis dt { color: var(--muted); font-size: .8rem; }
.kpis dd { margin: .1rem 0 0; font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpis small { color: var(--muted); font-size: .72rem; }
.colchart { position: relative; height: 11rem; margin: 1rem 0 1.6rem 2.6rem; }
.colchart .grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--border); }
.colchart .grid i { position: absolute; right: calc(100% + .35rem); top: -.55em; font-style: normal; font-size: .7rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.colchart .cols { position: absolute; inset: 0; display: flex; align-items: stretch; }
.col { flex: 1; min-width: 0; position: relative; border: 0; background: none; padding: 0 1px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center; }
.col .bar { display: block; width: 100%; max-width: 24px; background: var(--chart); border-radius: 4px 4px 0 0; }
.col:hover .bar, .col:focus-visible .bar { filter: brightness(1.15); }
.col:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; border-radius: 4px; }
.col .peak { position: absolute; left: 50%; transform: translate(-50%, -.25rem); font-size: .72rem; font-weight: 700; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.colchart .xlabels { position: absolute; left: 0; right: 0; top: calc(100% + .35rem); height: 1rem; }
.colchart .xlabels span { position: absolute; transform: translateX(-50%); font-size: .7rem; color: var(--muted); white-space: nowrap; }
.colchart .xlabels span:first-child { transform: none; left: 0 !important; }
.colchart .xlabels span:last-child { transform: translateX(-100%); left: 100% !important; }
.chart-tip { position: absolute; z-index: 10; pointer-events: none; background: var(--text); color: var(--bg); font-size: .8rem; font-weight: 600; padding: .35rem .55rem; border-radius: 8px; white-space: nowrap; box-shadow: 0 4px 14px rgb(0 0 0 / .2); }
.table-view summary { cursor: pointer; color: var(--muted); font-size: .85rem; }
.table-view table { width: 100%; border-collapse: collapse; margin-top: .5rem; font-size: .88rem; }
.table-view th, .table-view td { text-align: left; padding: .3rem .2rem; border-top: 1px solid var(--border); }
.table-view .num { text-align: right; font-variant-numeric: tabular-nums; }
.hbars { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .55rem; }
.hbars li { display: grid; grid-template-columns: minmax(0, 7.5rem) 1fr; gap: .6rem; align-items: center; }
.hb-label { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.hb-bar { display: block; height: 14px; min-width: 3px; background: var(--chart); border-radius: 0 4px 4px 0; flex: none; }
.hb-value { font-size: .8rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.stats-empty { text-align: center; }

/* ---- Go Digital: picture guides for seniors ---- */
.theme-godigital { --accent: #0f766e; --accent-text: #fff; font-size: 1.08rem; }
@media (prefers-color-scheme: dark) { .theme-godigital { --accent: #5eead4; --accent-text: #042f2e; } }
.theme-godigital .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); background: linear-gradient(160deg, rgb(255 255 255 / .14), transparent 55%), var(--accent); }
.tile.godigital { background: #0f766e; color: #fff; border-color: #0f766e; }
.tile.godigital small { color: rgb(255 255 255 / .95); }
.gd-bigtext { font-size: 1.3rem; }
.gd-intro { font-size: 1.1em; margin: .25rem .25rem 1rem; }
.gd-app { margin-bottom: 1.25rem; }
.gd-app h2 { display: flex; gap: .7rem; align-items: center; margin: 0 .25rem .6rem; font-size: 1.35em; }
.gd-app h2 small { display: block; font-size: .62em; font-weight: 500; color: var(--muted); }
.gd-app h2 .gd-appicon { width: 2.6rem; height: 2.6rem; font-size: 1.5rem; }
.gd-appicon { display: inline-grid; place-items: center; flex: none; border-radius: 22%; background: var(--app, #00a651); color: #fff; }
.gd-lessons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.gd-lesson {
  display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left; font: inherit; color: var(--text);
  padding: .9rem .85rem; border-radius: 16px; background: var(--card); border: 2px solid var(--border); border-left: 6px solid var(--app); cursor: pointer; min-height: 7.2rem;
}
.gd-lesson .gd-lemoji { font-size: 2rem; line-height: 1; }
.gd-lesson b { font-size: 1.02em; line-height: 1.25; }
.gd-lesson small { color: var(--muted); font-size: .85em; }
.gd-lesson.done small { color: var(--ok); font-weight: 700; }
.gd-settings { display: grid; gap: .5rem; }
.gd-disclaimer { margin: .5rem .25rem 2rem; }

.gd-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.gd-head span { font-weight: 700; font-size: 1.05em; min-width: 0; }
.gd-dots { display: flex; gap: .3rem; justify-content: center; margin: .25rem 0 .6rem; flex-wrap: wrap; }
.gd-dots span { width: .65rem; height: .65rem; border-radius: 50%; background: var(--border); }
.gd-dots .past { background: var(--accent); opacity: .5; }
.gd-dots .now { background: var(--accent); transform: scale(1.3); }
.gd-stage { display: flex; justify-content: center; }
.gd-phone {
  height: min(480px, 56vh); aspect-ratio: 9 / 17.5; border-radius: 30px; padding: 10px; background: #111827;
  box-shadow: 0 10px 30px rgb(0 0 0 / .25); flex: none;
}
.gd-screen {
  position: relative; height: 100%; overflow: hidden; border-radius: 22px; background: #fff; color: #1f2937;
  font-size: clamp(9.5px, 2.9vw, 12.5px); line-height: 1.3; display: flex; flex-direction: column;
}
.gd-screen b { font-weight: 700; }
.gd-screen small { color: #6b7280; }
.gd-top { display: flex; align-items: center; gap: .5em; padding: .9em .9em .6em; font-size: 1.15em; border-bottom: 1px solid #eef0f3; }
.gd-back { font-size: 1.4em; line-height: .8; color: #6b7280; }
.gd-btn { margin: .45em .9em; padding: .8em; border-radius: 999px; text-align: center; font-weight: 700; border: 1.5px solid #d1d5db; background: #fff; }
.gd-btn.primary { background: var(--app); border-color: var(--app); color: #fff; }
.gd-btn.ghost { background: #fff; }
.gd-btn.small { margin: 0; padding: .45em 1em; background: var(--app); border-color: var(--app); color: #fff; font-size: .95em; }
.gd-row { display: flex; align-items: center; gap: .65em; padding: .6em .9em; border-bottom: 1px solid #f1f2f4; }
.gd-ic { font-size: 1.35em; width: 1.6em; text-align: center; flex: none; }
.gd-rt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.gd-rt b, .gd-rt small { overflow: hidden; text-overflow: ellipsis; }
.gd-rr { flex: none; color: #374151; }
.gd-field { margin: .4em .9em; padding: .5em .7em; border: 1.5px solid #d1d5db; border-radius: 10px; display: flex; flex-direction: column; }
.gd-field .ph { color: #9ca3af; }
.gd-two { display: grid; grid-template-columns: 1fr 1fr; }
.gd-search { margin: .6em .9em; padding: .65em .9em; border-radius: 999px; background: #f3f4f6; color: #6b7280; }
.gd-search.typed { color: #111827; background: #fff; border: 1.5px solid var(--app); }
.gd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3em; padding: .3em .6em; }
.gd-tile { display: flex; flex-direction: column; align-items: center; gap: .15em; padding: .45em .1em; border-radius: 12px; }
.gd-tile span { font-size: 1.8em; line-height: 1.1; background: #f0fdf4; border-radius: 14px; width: 1.75em; height: 1.75em; display: grid; place-items: center; }
.gd-tile small { color: #374151; font-size: .9em; }
.gd-banner { margin: .4em .9em; padding: 1.1em .9em; border-radius: 14px; background: linear-gradient(120deg, #dcfce7, #bbf7d0); font-weight: 700; }
.gd-banner.fp { background: linear-gradient(120deg, #dbeafe, #fee2e2); }
.gd-greet { padding: 1em .9em .2em; font-size: 1.1em; display: flex; align-items: center; gap: .4em; }
.gd-tabs { margin-top: auto; display: flex; border-top: 1px solid #e5e7eb; background: #fff; }
.gd-tab { flex: 1; display: flex; flex-direction: column; align-items: center; padding: .45em 0 .6em; position: relative; }
.gd-tab span { font-size: 1.3em; position: relative; }
.gd-tab small { font-size: .78em; }
.gd-tab.on small { color: var(--app); font-weight: 700; }
.gd-badge { position: absolute; top: -.3em; right: -.7em; background: #dc2626; color: #fff; font-size: .55em; font-style: normal; border-radius: 999px; padding: 0 .4em; }
.gd-map { position: relative; flex: 1; min-height: 9em; background: #e8efe6; overflow: hidden; }
.gd-road { position: absolute; background: #fff; }
.gd-road.h { left: 0; right: 0; height: .9em; }
.gd-road.v { top: 0; bottom: 0; width: .9em; }
.gd-park { position: absolute; left: 40%; top: 40%; width: 25%; height: 20%; background: #c8e6c0; border-radius: 30%; }
.gd-pin { position: absolute; left: 50%; top: 48%; transform: translate(-50%, -100%); font-size: 1.9em; display: flex; flex-direction: column; align-items: center; }
.gd-pin small { font-size: .38em; background: #111827; color: #fff; padding: .2em .6em; border-radius: 999px; white-space: nowrap; }
.gd-sheet { background: #fff; border-radius: 16px 16px 0 0; box-shadow: 0 -4px 14px rgb(0 0 0 / .08); padding-bottom: .5em; }
.gd-sheet.tight { margin-top: auto; }
.gd-route { padding: .5em .9em; background: #f9fafb; font-size: .95em; }
.gd-cars .gd-row { padding: .5em .9em; }
.gd-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3em; text-align: center; font-size: 1.2em; }
.gd-hero small { font-size: .75em; }
.gd-appicon.big { width: 3.2em; height: 3.2em; font-size: 1.6em; margin-bottom: .3em; }
.gd-appicon.fp { background: #1d4ed8; }
.gd-appicon.ok { background: #16a34a; }
.gd-store { display: flex; align-items: center; gap: .7em; padding: .8em .9em; }
.gd-store .gd-appicon { width: 3.4em; height: 3.4em; font-size: 1.6em; }
.gd-note { margin: .5em .9em; padding: .6em .7em; background: #fffbeb; border-radius: 10px; font-size: .92em; color: #78350f; }
.gd-p { margin: .6em .9em; }
.gd-p.center { text-align: center; }
.gd-otp { display: flex; gap: .4em; justify-content: center; margin: .6em .9em; }
.gd-otp span { width: 2.1em; height: 2.6em; border: 1.5px solid #d1d5db; border-radius: 8px; display: grid; place-items: center; font-size: 1.2em; }
.gd-keys { margin-top: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: .25em; padding: .4em; background: #e5e7eb; }
.gd-keys span { background: #fff; border-radius: 6px; text-align: center; padding: .55em 0; font-size: 1.05em; }
.gd-keys span:empty { background: transparent; }
.gd-spin { width: 2.4em; height: 2.4em; margin: 1em auto .2em; border-radius: 50%; border: .3em solid #e5e7eb; border-top-color: var(--app); animation: gd-spin 1s linear infinite; }
@keyframes gd-spin { to { transform: rotate(360deg); } }
.gd-driver { display: flex; align-items: center; gap: .6em; padding: .3em .9em; }
.gd-face { font-size: 1.8em; }
.gd-plate { font-weight: 800; letter-spacing: .04em; padding: .35em .55em; border: 2px solid #111827; border-radius: 6px; background: #fef9c3; flex: none; }
.gd-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
.gd-actions .gd-btn { margin: .35em .25em; padding: .55em .2em; font-size: .9em; }
.gd-sos { margin: .3em .9em; padding: .55em; text-align: center; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-weight: 700; }
.gd-addr { padding: .6em .9em .2em; font-size: .95em; }
.gd-shopbanner { height: 4.5em; display: grid; place-items: center; font-size: 2.6em; background: #fff7ed; }
.gd-plus { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: var(--app); color: #fff; font-weight: 700; }
.gd-basketbar { margin: auto .9em .8em; padding: .8em 1em; border-radius: 999px; background: var(--app); color: #fff; display: flex; justify-content: space-between; gap: .5em; }
.gd-basketbar b { color: #fff; }
.gd-qty { margin: .4em auto; padding: .35em 1em; border: 1.5px solid #d1d5db; border-radius: 999px; text-align: center; font-weight: 700; width: max-content; }
.gd-qty.small { margin: 0; padding: .25em .6em; font-size: .9em; }
.gd-total { display: flex; justify-content: space-between; padding: .7em .9em; font-size: 1.1em; }
.gd-progress { margin: .4em .9em; padding-left: 1.4em; display: grid; gap: .35em; }
.gd-progress li { color: #9ca3af; }
.gd-progress .done { color: #16a34a; }
.gd-progress .now { color: #111827; font-weight: 700; }
.gd-card { margin: .7em .9em; padding: 1em; border-radius: 14px; background: linear-gradient(135deg, #1e3a8a, #6d28d9); color: #fff; display: flex; flex-direction: column; gap: .35em; }
.gd-card small { color: rgb(255 255 255 / .85); }
.gd-card.wallet { background: linear-gradient(135deg, var(--app), #065f46); }
.gd-card b { font-size: 1.15em; letter-spacing: .05em; }
.gd-products { display: grid; grid-template-columns: 1fr 1fr; gap: .4em; padding: .3em .7em; }
.gd-product { border: 1px solid #e5e7eb; border-radius: 12px; padding: .5em; display: flex; flex-direction: column; gap: .15em; align-items: flex-start; }
.gd-pic { font-size: 2em; align-self: center; }
.gd-price { font-weight: 700; color: #111827; }
.gd-product .gd-btn.small { align-self: stretch; text-align: center; margin-top: .2em; }
.gd-days { display: flex; gap: .4em; padding: .6em .9em; }
.gd-days span { flex: 1; text-align: center; padding: .45em 0; border-radius: 10px; border: 1.5px solid #e5e7eb; }
.gd-days .on { background: var(--app); border-color: var(--app); color: #fff; }
.gd-appicon.dbs { background: #c8102e; }
.gd-in { color: #16a34a; }
.gd-bubble { margin: .9em; padding: .8em .9em; border-radius: 16px 16px 16px 4px; background: #f3f4f6; display: flex; flex-direction: column; gap: .3em; }
.gd-link { color: #2563eb; }
.gd-actions.two { grid-template-columns: 1fr 1fr; padding: 0 .65em; }
/* DBS: the first screen, log-in, dark amount bar and the rest, after DBS's own screenshots */
.gd-btn.outline { margin: 0; border-radius: 3px; background: transparent; color: #fff; border-color: #fff; }
.gd-top.center { justify-content: center; }
.gd-dial { flex: 1; background: linear-gradient(180deg, #1f2937, #111827); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4em; text-align: center; padding: 1em; }
.gd-dial b { font-size: 1.6em; letter-spacing: .03em; }
.gd-dial small { color: #d1d5db !important; }
.gd-ivr { margin: 1em 0; padding: .7em .9em; border-radius: 12px; background: rgb(255 255 255 / .1); }
.gd-callbtn { display: grid; place-items: center; width: 2.8em; height: 2.8em; border-radius: 50%; background: #16a34a; font-size: 1.4em; margin-top: .5em; }

/* The button to press: a glow and a pointing hand. */
/* Real screenshots: the picture sets the phone's shape; spots are the buttons laid over it. */
.gd-phone.photo { height: auto; width: min(250px, 27vh, 72vw); aspect-ratio: auto; }
.gd-phone.photo .gd-screen { height: auto; }
.gd-shot { position: relative; width: 100%; overflow: hidden; }
.gd-shot img { display: block; width: 100%; height: auto; }
/* The ring hugs the real button: drawn just outside it, so it doesn't hide the label. */
.gd-spot, .gd-spot.gd-glow { position: absolute; border-radius: 8px; outline-width: 2.5px; outline-offset: 1px; }
.gd-wm { position: absolute; inset: -30%; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around; gap: 2.5em 1.5em; transform: rotate(-30deg); pointer-events: none; }
.gd-wm span { font-size: 1.05em; font-weight: 800; letter-spacing: .05em; color: rgb(15 118 110 / .22); white-space: nowrap; text-shadow: 0 0 2px rgb(255 255 255 / .5); }
.gd-wmwarn { position: absolute; left: 6%; right: 6%; bottom: 12%; padding: .6em; border-radius: 10px; background: rgb(15 118 110 / .92); color: #fff; font-weight: 700; text-align: center; line-height: 1.35; pointer-events: none; }
.gd-glow { position: relative; z-index: 1; outline: 3px solid #f59e0b; outline-offset: 2px; border-radius: 12px; animation: gd-glow 1.2s ease-in-out infinite; cursor: pointer; }
@keyframes gd-glow { 0%, 100% { box-shadow: 0 0 0 0 rgb(245 158 11 / .7); } 50% { box-shadow: 0 0 0 9px rgb(245 158 11 / 0); } }
.gd-hand { position: absolute; z-index: 2; font-size: 2.6em; pointer-events: none; transform: translate(-30%, 0); animation: gd-hand 1.2s ease-in-out infinite; filter: drop-shadow(0 2px 3px rgb(0 0 0 / .35)); }
@keyframes gd-hand { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.gd-hand.down { animation-name: gd-hand-down; }
@keyframes gd-hand-down { 0%, 100% { translate: 0 0; } 50% { translate: 0 6px; } }
@media (prefers-reduced-motion: reduce) { .gd-glow, .gd-hand, .gd-spin { animation: none; } }

.gd-caption { margin-top: .8rem; }
.gd-stepno { margin: 0; color: var(--muted); font-size: .85em; font-weight: 700; }
.gd-say { margin: .25rem 0 .4rem; font-size: 1.3em; font-weight: 700; line-height: 1.4; }
.gd-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .3rem 0; }
.gd-chips span { background: var(--bg); border: 1px solid var(--border); border-radius: 999px; padding: .25rem .7rem; font-size: .9em; font-weight: 600; }
.gd-hint { margin: .3rem 0 0; color: var(--muted); font-size: .95em; }
.gd-hint.ok { color: var(--ok); font-weight: 700; }
.gd-hint.nudge { animation: gd-nudge .4s; color: var(--warn); font-weight: 700; }
@keyframes gd-nudge { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.gd-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: .5rem; margin: .8rem 0 2rem; }
.gd-nav button { min-height: 3.2rem; font-size: 1.02em; }
.gd-finish { text-align: center; display: grid; gap: .6rem; }
.gd-big { font-size: 1.8em; font-weight: 800; margin: .3rem 0 0; }

/* ---- BaZi and Zi Wei: help for beginners -------------------------------------------------------- */
.intro > summary { font-weight: 700; cursor: pointer; }
.intro-steps { padding-left: 1.3rem; margin: .8rem 0 .4rem; }
.intro-steps li { margin: .55rem 0; line-height: 1.5; }
.intro-steps small { display: block; color: var(--muted); }
.el-cycle, .el-legend { display: flex; flex-wrap: wrap; gap: .25rem .5rem; align-items: center; font-weight: 700; margin: .35rem 0; }
.el-legend { font-size: .9rem; margin: 0 0 .6rem; }
.sum-p .sum-about { font-size: .7rem; margin-top: -.1rem; }
.sum-p .sum-el { font-size: .85rem; letter-spacing: .1em; }
.sum-legend { text-align: center; margin: .5rem 0 0; }
details.tech > summary { cursor: pointer; list-style: none; }
details.tech > summary h2 { display: inline; }
details.tech > summary::after { content: ' ⌄'; color: var(--muted); }
details.tech[open] > summary::after { content: ' ⌃'; }
.zw-en { display: block; font-size: .62rem; font-weight: 600; color: var(--muted); line-height: 1.1; margin-bottom: .1rem; }
.glance { list-style: none; padding: 0; margin: .4rem 0 .6rem; }
.glance li { display: flex; gap: .65rem; padding: .5rem 0; border-bottom: 1px solid var(--border); }
.glance li > span { font-size: 1.35rem; line-height: 1.3; }
.glance small { color: var(--muted); font-weight: 600; }
.glance p { margin: .1rem 0 0; line-height: 1.45; }

/* ---- Tarot ----------------------------------------------------------------------------------------- */
.theme-tarot { --accent: #312e81; --accent-text: #fff; --gold: #b7791f; }
@media (prefers-color-scheme: dark) { .theme-tarot { --accent: #a5b4fc; --accent-text: #11103a; --gold: #f6c453; } }
.theme-tarot .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); background: radial-gradient(circle at 80% 0%, rgb(246 196 83 / .35), transparent 45%), linear-gradient(160deg, #3730a3, #1e1b4b); color: #fff; }
.theme-tarot .balance .muted, .theme-tarot .balance .eyebrow, .theme-tarot .balance .back { color: rgb(255 255 255 / .85); }
.tile.tarot { background: linear-gradient(160deg, #3730a3, #1e1b4b); color: #fff; border-color: #312e81; }
.tile.tarot small { color: rgb(255 255 255 / .95); }
/* A card: a back and a face that flip. Reversed faces are upside down. */
.tc { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; perspective: 800px; font: inherit; color: inherit; }
.tc-in { position: relative; display: block; aspect-ratio: 7 / 12; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .3, 1); }
.tc.up .tc-in { transform: rotateY(180deg); }
.tc-back, .tc-face { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; box-shadow: 0 3px 10px rgb(0 0 0 / .25); }
.tc-back { display: grid; place-items: center; border: 3px solid #f6c453; background: radial-gradient(circle, rgb(246 196 83 / .35) 0 18%, transparent 19%), repeating-linear-gradient(45deg, #312e81 0 6px, #3730a3 6px 12px); }
.tc-back span { font-size: 1.6rem; filter: drop-shadow(0 0 4px rgb(246 196 83 / .8)); }
.tc-face { transform: rotateY(180deg); background: #fff; }
.tc-face img, .tr-detail img, .tr-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
img.rev { transform: rotate(180deg); }
.tc-label { display: block; margin-top: .3rem; font-size: .72rem; font-weight: 600; text-align: center; line-height: 1.2; color: var(--muted); }
.tc.small { width: 2.8rem; display: inline-block; cursor: inherit; }
.tc.small .tc-back, .tc.small .tc-face { border-radius: 3px; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .tc-in { transition: none; } }
.tr-daily { display: grid; grid-template-columns: 6.5rem 1fr; gap: 1rem; align-items: start; }
.tr-daily h2 { margin-top: 0; }
.tr-daily p { margin: .25rem 0; }
.tr-spreads { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.tr-spreadpick { position: relative; display: flex; flex-direction: column; gap: .15rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--card); }
.tr-spreadpick input { position: absolute; opacity: 0; pointer-events: none; }
.tr-spreadpick:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.tr-spreadpick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.tr-spreadpick > span { font-size: 1.3rem; }
.tr-spreadpick small { color: var(--muted); line-height: 1.3; }
.tr-label { font-weight: 700; margin: 1rem 0 .4rem; }
.tr-go { width: 100%; margin-top: .4rem; }
/* The deck, shuffling. */
.tr-deck { position: relative; height: 0; transition: height .3s; pointer-events: none; }
.tr-deck:not(.shuffling) span { display: none; }
.tr-deck.shuffling { height: 7.5rem; margin: .5rem 0; }
.tr-deck span { position: absolute; left: 50%; top: .3rem; width: 4rem; aspect-ratio: 7 / 12; margin-left: -2rem; border-radius: 6px; border: 2px solid #f6c453; background: repeating-linear-gradient(45deg, #312e81 0 5px, #3730a3 5px 10px); opacity: 0; }
.tr-deck.shuffling span { opacity: 1; animation: tr-shuffle .55s ease-in-out infinite alternate; }
.tr-deck.shuffling span:nth-child(2) { animation-delay: .18s; animation-direction: alternate-reverse; }
.tr-deck.shuffling span:nth-child(3) { animation-delay: .36s; }
@keyframes tr-shuffle { from { transform: translateX(-2.2rem) rotate(-8deg); } to { transform: translateX(2.2rem) rotate(8deg); } }
@media (prefers-reduced-motion: reduce) { .tr-deck.shuffling span { animation: none; } }
.tr-q { font-style: italic; margin: .2rem 0 .8rem; }
.tr-spread { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: .9rem .6rem; align-items: start; justify-items: center; margin: .5rem 0; }
.tr-slot { width: 100%; max-width: 9rem; }
.tr-spread.s-one .tr-slot { max-width: 10rem; }
.tr-spread.s-celtic { gap: .6rem .45rem; }
.tr-slot.cross { position: relative; z-index: 2; align-self: center; }
.tr-slot.cross .tc { transform: rotate(90deg) scale(.82); }
.tr-slot.cross .tc-label { display: none; }
.tr-lines { list-style: none; padding: 0; margin: 0; }
.tr-line { display: flex; gap: .7rem; padding: .65rem 0; border-bottom: 1px solid var(--border); }
.tr-line:last-child { border-bottom: 0; }
.tr-line p { margin: .25rem 0 0; line-height: 1.45; }
.tr-line small { color: var(--muted); }
.tr-line.hidden { opacity: .55; }
.tr-n { display: inline-grid; place-items: center; flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-size: .8rem; font-weight: 700; }
.tr-rev { font-size: .8rem; font-weight: 700; color: var(--gold); }
.tr-filter { margin-top: .75rem; }
.tr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.4rem, 1fr)); gap: .7rem; }
.tr-thumb { display: flex; flex-direction: column; gap: .2rem; padding: 0; border: 0; background: none; font: inherit; color: var(--text); text-align: left; cursor: pointer; }
.tr-thumb img { aspect-ratio: 7 / 12; border-radius: 6px; box-shadow: 0 2px 6px rgb(0 0 0 / .2); }
.tr-thumb b { font-size: .82rem; line-height: 1.2; margin-top: .2rem; }
.tr-thumb small { font-size: .72rem; color: var(--muted); line-height: 1.25; }
.tr-dialog { width: min(26rem, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: 16px; background: var(--card); color: var(--text); }
.tr-dialog::backdrop { background: rgb(10 8 40 / .7); }
.tr-detail { padding: 1.1rem; }
.tr-detail img { width: 45%; height: auto; margin: 0 auto .6rem; border-radius: 8px; box-shadow: 0 4px 14px rgb(0 0 0 / .3); }
.tr-detail > h2 { display: block; text-align: center; margin: .2rem 0; }
.tr-detail > .hint { text-align: center; }
.tr-detail button { width: 100%; margin-top: .6rem; }
.tr-mean { padding: .6rem .75rem; border-radius: 10px; margin: .5rem 0; border: 1px solid var(--border); }
.tr-mean.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); }
.tr-mean h3 { margin: 0 0 .25rem; font-size: .95rem; }
.tr-mean h3 small { font-weight: 400; color: var(--muted); }
.tr-mean p { margin: 0; line-height: 1.45; }
.tr-learn p, .tr-learn li { line-height: 1.5; }
.tr-suits { list-style: none; padding: 0; margin: .3rem 0 .6rem; }
.tr-suits li { display: flex; gap: .7rem; align-items: flex-start; padding: .4rem 0; }
.tr-suits li > span { font-size: 1.4rem; }
.tr-suits small { color: var(--muted); }
.tr-foot { margin: 1rem .25rem 2rem; }
.tr-entry > summary { cursor: pointer; list-style: none; }
.tr-entry > summary small { color: var(--muted); margin-left: .3rem; }
.tr-mini { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .4rem; }
.tr-note { padding: .5rem .7rem; border-radius: 10px; background: var(--bg); }
.tr-center { text-align: center; }

/* ---- Job Tracker ----------------------------------------------------------------------------- */
.theme-jobs { --accent: #c2410c; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-jobs { --accent: #fb923c; --accent-text: #2a1204; } }
.tile.jobs { background: #c2410c; color: #fff; border-color: #c2410c; }
.tile.jobs small { color: rgb(255 255 255 / .95); }
.theme-jobs main { padding-bottom: 6rem; }
.jb-count { display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.2rem; padding: 0 .3rem; margin-left: .2rem; border-radius: 999px; background: var(--bad); color: #fff; font-size: .7rem; font-weight: 700; vertical-align: .1em; }
.jb-count[hidden] { display: none; }

.jb-tools { padding-bottom: .75rem; }
.jb-search { width: 100%; font: inherit; padding: .65rem .8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); }
.jb-filters { display: flex; gap: .4rem; overflow-x: auto; margin: .7rem -1rem 0; padding: 0 1rem .15rem; scrollbar-width: none; }
.jb-filters::-webkit-scrollbar { display: none; }
.jb-chip { flex: none; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 999px; padding: .4rem .75rem; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.jb-chip span { color: var(--muted); font-weight: 500; margin-left: .15rem; }
.jb-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.jb-chip[aria-pressed="true"] span { color: inherit; opacity: .8; }

.jb-nudge { display: flex; gap: .5rem; align-items: center; width: 100%; text-align: left; margin: 0 0 1rem; padding: .75rem .9rem; border: 0; border-radius: 14px; background: var(--warn-bg); color: var(--warn); font: inherit; font-size: .92rem; cursor: pointer; }
.jb-nudge[hidden] { display: none; }

.jb-list-card { padding-top: .35rem; padding-bottom: .35rem; }
.jb-list { list-style: none; margin: 0 -.5rem; padding: 0; }
.jb-row { display: flex; gap: .8rem; align-items: flex-start; padding: .75rem .5rem; border-radius: 12px; cursor: pointer; }
.jb-row + .jb-row { border-top: 1px solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.jb-row:hover, .jb-row:focus-visible { background: var(--bg); outline: none; }
.jb-row.closed { opacity: .65; }
.jb-badge { flex: none; display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 800; font-size: 1.1rem; }
.jb-main { flex: 1; min-width: 0; }
.jb-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.jb-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-sub { color: var(--muted); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: .05rem; }
.jb-meta { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.jb-next-line { color: var(--text); }
.jb-late { color: var(--bad); font-weight: 600; }
.jb-warn { color: var(--warn); font-weight: 600; }
.jb-quick { display: flex; gap: .4rem; margin-top: .5rem; }

.jb-pill { flex: none; font-size: .72rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.jb-pill.st-applied { background: color-mix(in srgb, #2563eb 14%, transparent); color: #2563eb; }
.jb-pill.st-interview { background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.jb-pill.st-offer, .jb-pill.st-accepted { background: var(--ok-bg); color: var(--ok); }
.jb-pill.st-wishlist { background: var(--warn-bg); color: var(--warn); }
.jb-pill.st-rejected { background: var(--bad-bg); color: var(--bad); }
@media (prefers-color-scheme: dark) {
  .jb-pill.st-applied { color: #93c5fd; }
  .jb-pill.st-interview { color: #c4b5fd; }
}

.jb-empty { text-align: center; padding: 1.5rem .5rem; }
.jb-empty-icon { font-size: 2.4rem; margin: 0 0 .25rem; }
.jb-empty .actions { justify-content: center; }

.jb-date { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 2.6rem; height: 2.8rem; border-radius: 12px; background: var(--bg); color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .03em; line-height: 1.05; }
.jb-date b { font-size: 1.1rem; color: var(--text); letter-spacing: 0; }
.jb-date.now { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.jb-date.now b { color: var(--accent); }
.jb-date.late { background: var(--bad-bg); color: var(--bad); }
.jb-date.late b { color: var(--bad); }

.jb-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: 1rem; }
.jb-tile { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: .9rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.jb-tile b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.jb-tile span { color: var(--muted); font-size: .82rem; }
.jb-funnel { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .6rem; }
.jb-funnel li { display: grid; grid-template-columns: 5.2rem 1fr auto; gap: .6rem; align-items: center; }
.jb-f-label { font-size: .9rem; }
.jb-f-track { height: .7rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.jb-f-bar { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.jb-f-n { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3.4rem; text-align: right; }
.jb-f-n small { color: var(--muted); font-weight: 500; }
.jb-foot { text-align: center; margin: 1rem 1rem 0; }

.jb-fab { position: fixed; right: max(1rem, calc(50vw - 15rem)); bottom: calc(1.1rem + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; gap: .35rem; padding: .85rem 1.25rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 700; box-shadow: 0 6px 20px rgb(0 0 0 / .22); cursor: pointer; }
.jb-fab span { font-size: 1.15rem; line-height: 1; }
.jb-fab[hidden] { display: none; }

.jb-sheet { width: min(34rem, 100vw); max-width: 100vw; max-height: 100dvh; margin: auto auto 0; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: var(--card); color: var(--text); }
.jb-sheet::backdrop { background: rgb(0 0 0 / .45); }
@media (min-width: 40rem) { .jb-sheet { margin: auto; border-radius: 20px; max-height: calc(100dvh - 3rem); } }
.jb-sheet form { display: flex; flex-direction: column; max-height: inherit; }
.jb-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); }
.jb-sheet-head h2 { margin: 0; font-size: 1rem; }
.text-btn.strong { font-weight: 800; }
.jb-sheet-body { overflow-y: auto; padding: 0 1rem calc(1.25rem + env(safe-area-inset-bottom)); }
.jb-sheet .field textarea { width: 100%; font: inherit; padding: .65rem .75rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; }
.jb-two { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.jb-two .field input { font-size: 1rem; min-width: 0; }
.jb-stage-pick { display: flex; flex-wrap: wrap; gap: .4rem; }
.jb-stage { border: 1px solid var(--border); background: var(--bg); color: var(--text); border-radius: 999px; padding: .4rem .7rem; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.jb-stage i { font-style: normal; }
.jb-stage[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.jb-next { margin-top: 1rem; padding: .25rem .8rem .8rem; border-radius: 14px; background: color-mix(in srgb, var(--accent) 7%, transparent); }
.jb-next-title { margin: .6rem 0 0; font-weight: 700; font-size: .9rem; }
.jb-link-row { display: flex; gap: .5rem; align-items: center; }
.jb-link-row input { flex: 1; min-width: 0; }
.jb-link-row .btn { flex: none; }
.jb-link-row .btn[hidden] { display: none; }
.jb-history { margin-top: 1.25rem; }
.jb-history ol { list-style: none; margin: .5rem 0 0; padding: 0 0 0 .4rem; border-left: 2px solid var(--border); }
.jb-history li { position: relative; display: flex; justify-content: space-between; gap: .5rem; padding: .3rem 0 .3rem .9rem; font-size: .92rem; }
.jb-history small { color: var(--muted); }
.jb-dot { position: absolute; left: -.42rem; top: .62rem; width: .6rem; height: .6rem; border-radius: 50%; background: var(--muted); }
.jb-dot.st-applied { background: #2563eb; }
.jb-dot.st-interview { background: #7c3aed; }
.jb-dot.st-offer, .jb-dot.st-accepted { background: var(--ok); }
.jb-dot.st-rejected { background: var(--bad); }
.jb-dot.st-wishlist { background: var(--warn); }
.jb-link-row a { padding: .6rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-weight: 600; text-decoration: none; }
.theme-jobs .tabs button { font-size: .95rem; }
.jb-cal { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.jb-cal[hidden] { display: none; }
.jb-cal > * { flex: 1 1 8rem; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.jb-cal-g { padding: .4rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font-size: .9rem; font-weight: 600; text-decoration: none; }
.jb-cal-btn { flex: none; align-self: center; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--accent); cursor: pointer; }

.jb-practice { background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 12%, var(--card)), var(--card) 70%); }
.jb-practice-head { display: flex; justify-content: space-between; gap: .5rem; font-size: .82rem; color: var(--muted); font-weight: 600; }
.jb-progress { height: .35rem; margin: .5rem 0 0; border-radius: 999px; background: var(--bg); overflow: hidden; }
.jb-progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.jb-practice-q { font-size: 1.3rem; font-weight: 700; line-height: 1.3; margin: 1rem 0 .3rem; }
.jb-practice-btns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.jb-practice-btns .primary { margin-left: auto; }
.jb-practice-btns [aria-pressed="true"] { color: var(--ok); border-color: var(--ok); }
.jb-tip { margin: .6rem 0 0; padding: .65rem .8rem; border-radius: 12px; background: var(--bg); font-size: .92rem; line-height: 1.45; }
.jb-tip[hidden] { display: none; }

.jb-star-list { list-style: none; margin: .75rem 0 0; padding: 0; display: grid; gap: .6rem; }
.jb-star-list li { display: flex; gap: .7rem; align-items: flex-start; }
.jb-star-l { flex: none; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 10px; background: var(--accent); color: var(--accent-text); }
.jb-star-list div { display: flex; flex-direction: column; font-size: .92rem; }
.jb-star-list span { color: var(--muted); }

.jb-qlist { margin: 0 -.5rem; }
.jb-q + .jb-q { border-top: 1px solid var(--border); }
.jb-q summary { display: flex; gap: .7rem; align-items: flex-start; padding: .8rem .5rem; cursor: pointer; list-style: none; border-radius: 12px; }
.jb-q summary::-webkit-details-marker { display: none; }
.jb-q summary:hover { background: var(--bg); }
.jb-q-tick { flex: none; display: grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-top: .1rem; border: 1.5px solid var(--border); border-radius: 50%; font-size: .75rem; font-weight: 800; }
.jb-q.done .jb-q-tick { background: var(--ok); border-color: var(--ok); color: #fff; }
.jb-q-text { flex: 1; font-weight: 600; line-height: 1.35; }
.jb-q.done .jb-q-text { color: var(--muted); }
.jb-q-has { flex: none; color: var(--accent); font-size: .9rem; }
.jb-q-body { padding: 0 .5rem .9rem 2.55rem; }
.jb-q-body .field textarea { width: 100%; font: inherit; font-size: .95rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); resize: vertical; }
.jb-q-actions { display: flex; justify-content: space-between; align-items: center; }
.jb-q-actions .check-row { margin-top: .5rem; }
.danger-text { color: var(--bad); }
.jb-practice-cat { margin: .9rem 0 0; font-size: .82rem; color: var(--muted); font-weight: 600; }
.jb-practice-cat + .jb-practice-q { margin-top: .2rem; }
/* Job Tracker: prep */
.jb-add-q { display: flex; gap: .5rem; margin-top: .75rem; }
.jb-add-q input { flex: 1; min-width: 0; font: inherit; padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.jb-sec-prog { color: var(--muted); font-size: .8rem; }
.jb-pre { white-space: pre-wrap; margin: .25rem 0 .5rem; }
.jb-tip p:last-child { margin-bottom: 0; }
.muted-text { color: var(--muted); }
.jb-bank > summary { display: flex; flex-direction: column; gap: .2rem; padding: .25rem 1.6rem .25rem 0; cursor: pointer; list-style: none; position: relative; }
.jb-bank > summary::-webkit-details-marker { display: none; }
.jb-bank > summary::after { content: '›'; position: absolute; right: 0; top: .1rem; color: var(--muted); font-size: 1.4rem; transition: transform .15s; }
.jb-bank[open] > summary::after { transform: rotate(90deg); }
.jb-bank-title { font-weight: 700; font-size: 1.05rem; }
.jb-bank-sub { color: var(--muted); font-size: .85rem; }
.jb-bank .jb-search { margin-top: .9rem; }
.jb-bank-group { margin-top: .5rem; border-top: 1px solid var(--border); }
.jb-bank-group > summary { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; padding: .75rem 0; font-weight: 700; cursor: pointer; list-style: none; }
.jb-bank-group > summary::-webkit-details-marker { display: none; }
.jb-bank-group > summary small { color: var(--muted); font-weight: 500; }
.jb-bq { display: flex; gap: .5rem; align-items: flex-start; padding: .15rem 0; }
.jb-bq details { flex: 1; min-width: 0; }
.jb-bq summary { padding: .55rem 0; cursor: pointer; list-style: none; line-height: 1.35; }
.jb-bq summary::-webkit-details-marker { display: none; }
.jb-bq.on summary { font-weight: 600; }
.jb-bq .jb-tip { margin: 0 0 .5rem; }
.jb-fav { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.jb-fav[aria-pressed="true"] { color: #f59e0b; }
.jb-fav:active { background: var(--bg); }
.jb-star { margin-top: 1rem; border-top: 1px solid var(--border); padding-top: .75rem; }
.jb-star summary { color: var(--accent); font-weight: 600; font-size: .9rem; cursor: pointer; }

/* ---- Lists ------------------------------------------------------------------------------------ */
.theme-lists { --accent: #15803d; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-lists { --accent: #4ade80; --accent-text: #052e16; } }
.tile.lists { background: #15803d; color: #fff; border-color: #15803d; }
.tile.lists small { color: rgb(255 255 255 / .95); }
.theme-lists main { padding-bottom: 6rem; }

.ls-head .big { font-size: 1.9rem; line-height: 1.2; padding: 0 2.5rem; overflow-wrap: anywhere; }
.ls-more { position: absolute; right: .6rem; top: calc(.45rem + env(safe-area-inset-top)); display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 50%; background: none; color: inherit; cursor: pointer; }
.ls-more:active { background: rgb(255 255 255 / .18); }
.ls-more[hidden] { display: none; }
.ls-progress { max-width: 14rem; height: 6px; margin: .7rem auto 0; border-radius: 999px; background: rgb(255 255 255 / .28); overflow: hidden; }
.ls-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: currentColor; transition: width .25s ease; }
.ls-progress[hidden] { display: none; }

.ls-home-card { padding: .35rem 1rem; }
.ls-lists { list-style: none; margin: 0 -.5rem; padding: 0; }
.ls-list-row { display: flex; align-items: center; gap: .8rem; padding: .75rem .5rem; border-radius: 12px; cursor: pointer; color: inherit; text-decoration: none; }
.ls-list-row + .ls-list-row { border-top: 1px solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.ls-list-row:hover, .ls-list-row:focus-visible { background: var(--bg); outline: none; }
.ls-emoji-badge { flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 13%, transparent); font-size: 1.4rem; }
.ls-list-main { flex: 1; min-width: 0; }
.ls-list-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ls-list-sub { display: flex; align-items: center; gap: .55rem; margin-top: .2rem; color: var(--muted); font-size: .86rem; }
.ls-list-sub.complete { color: var(--accent); font-weight: 600; }
.ls-mini-bar { flex: 0 0 3.5rem; height: 4px; border-radius: 999px; background: var(--border); overflow: hidden; }
.ls-mini-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.ls-chev { flex: none; color: var(--muted); font-size: 1.3rem; line-height: 1; }

.ls-empty { padding: 1rem 0 .75rem; text-align: center; }
.ls-empty[hidden] { display: none; }
.ls-empty-title { margin: 0; font-weight: 700; font-size: 1.1rem; }
.ls-templates { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: .5rem; text-align: center; }
.ls-template { display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .7rem .4rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.ls-template b { font-size: 1.5rem; line-height: 1.1; font-weight: 400; }
.ls-template[aria-checked="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); box-shadow: inset 0 0 0 1px var(--accent); }
.ls-foot { text-align: center; }

.ls-emojis { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6rem, 1fr)); gap: .35rem; }
.ls-emojis button { aspect-ratio: 1; border: 1px solid transparent; border-radius: 10px; background: var(--bg); font-size: 1.3rem; cursor: pointer; padding: 0; }
.ls-emojis button[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }

.ls-menu { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.ls-menu button { text-align: left; padding: .8rem .9rem; border: 0; background: var(--card); color: var(--text); font: inherit; cursor: pointer; }
.ls-menu button + button { border-top: 1px solid var(--border); }
.ls-menu button:active { background: var(--bg); }
.ls-menu button.danger { color: var(--bad); font-weight: 600; }

.ls-add { display: flex; gap: .5rem; padding: .5rem; position: sticky; top: .5rem; z-index: 2; box-shadow: 0 4px 14px rgb(0 0 0 / .06); }
.ls-add input { flex: 1; min-width: 0; font: inherit; padding: .65rem .75rem; border: 0; background: none; color: var(--text); outline: none; }
.ls-add-btn { flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-text); cursor: pointer; }

.ls-items-card { padding: .25rem .5rem; }
.ls-items-card:has(.ls-items:empty):has(.ls-all-done[hidden]) { display: none; }
.ls-items { list-style: none; margin: 0; padding: 0; }
.ls-item { display: flex; align-items: center; gap: .35rem; min-height: 3rem; background: var(--card); border-radius: 10px; }
.ls-item + .ls-item { border-top: 1px solid var(--border); }
.ls-check { flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); }
.ls-check i { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 2px solid var(--muted); border-radius: 50%; transition: background .15s, border-color .15s; }
.ls-check i svg { opacity: 0; }
.ls-item.done .ls-check i { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.ls-item.done .ls-check i svg { opacity: 1; }
.ls-text { flex: 1; min-width: 0; padding: .6rem 0; overflow-wrap: anywhere; cursor: text; }
.ls-item.done .ls-text { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.ls-edit { flex: 1; min-width: 0; font: inherit; padding: .5rem .6rem; border: 1px solid var(--accent); border-radius: 8px; background: var(--bg); color: var(--text); outline: none; }
.ls-del { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%; background: none; color: var(--bad); cursor: pointer; }
.ls-handle { flex: none; display: grid; place-items: center; width: 2.5rem; height: 2.75rem; color: var(--muted); opacity: .55; cursor: grab; touch-action: none; }
.ls-item.dragging { position: relative; z-index: 3; box-shadow: 0 8px 24px rgb(0 0 0 / .18); border-top-color: transparent; }
.ls-item.dragging .ls-handle { cursor: grabbing; opacity: 1; }
.ls-item.dragging + .ls-item { border-top-color: transparent; }
.ls-item.pop { animation: ls-pop .35s ease; }
@keyframes ls-pop { from { background: color-mix(in srgb, var(--accent) 18%, var(--card)); } to { background: var(--card); } }
.ls-all-done { margin: 0; padding: 1rem .5rem; text-align: center; color: var(--muted); }
.ls-all-done[hidden] { display: none; }

.ls-done { padding: .75rem .5rem .25rem; }
.ls-done[hidden] { display: none; }
.ls-done summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: 0 .5rem .5rem; color: var(--muted); font-weight: 700; font-size: .9rem; list-style: none; }
.ls-done summary::-webkit-details-marker { display: none; }
.ls-done summary > span:first-child::before { content: '▸'; display: inline-block; margin-right: .35rem; transition: transform .15s; }
.ls-done[open] summary > span:first-child::before { transform: rotate(90deg); }
details.card.ls-done[open] summary { margin-bottom: 0; }
.ls-done-actions { display: flex; gap: .9rem; }
.ls-done-actions .text-btn { font-size: .9rem; }
.ls-done-actions [hidden] { display: none; }

.ls-preview { list-style: none; margin: 0 0 .5rem; padding: 0; max-height: 50vh; overflow-y: auto; }
.ls-preview li { padding: .45rem 0; border-top: 1px solid var(--border); }
.ls-preview li.done { color: var(--muted); text-decoration: line-through; }

.ls-fab { position: fixed; right: max(1rem, calc(50vw - 15rem)); bottom: calc(1.1rem + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; gap: .35rem; padding: .85rem 1.25rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 700; box-shadow: 0 6px 20px rgb(0 0 0 / .22); cursor: pointer; }
.ls-fab span { font-size: 1.15rem; line-height: 1; }
.ls-fab[hidden] { display: none; }

.ls-undo { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 1rem; width: max-content; max-width: calc(100% - 2rem); padding: .55rem .6rem .55rem 1rem; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgb(0 0 0 / .22); }
.ls-undo[hidden] { display: none; }
.ls-undo button { border: 0; background: none; color: inherit; font: inherit; font-weight: 800; padding: .35rem .5rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.theme-lists .toast, .theme-lists .ls-undo { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }

/* ---- Spending --------------------------------------------------------------------------------- */
.theme-spend { --accent: #be123c; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-spend { --accent: #fb7185; --accent-text: #3b0712; } }
.tile.spend { background: #be123c; color: #fff; border-color: #be123c; }
.tile.spend small { color: rgb(255 255 255 / .95); }
.theme-spend main { padding-bottom: 6rem; }
.theme-spend .toast, .theme-spend .ls-undo { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }

.sp-month-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: -.25rem 0 .75rem; }
.sp-month-nav[hidden] { display: none; }
.sp-arrow { width: 2.6rem; height: 2.6rem; border: 1px solid var(--border); border-radius: 50%; background: var(--card); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.sp-arrow:disabled { opacity: .35; cursor: default; }
.sp-month-label { flex: 1; border: 0; background: none; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }

.sp-big-line { font-size: .95rem; color: var(--muted); }
.sp-big-line strong { font-size: 1.35rem; color: var(--text); font-variant-numeric: tabular-nums; }
.sp-meter { position: relative; height: 12px; margin: .7rem 0 .35rem; border-radius: 999px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--border); }
.sp-meter i { display: block; height: 100%; border-radius: inherit; background: var(--ok); min-width: 4px; transition: width .3s ease; }
.sp-meter.warn i { background: #d97706; }
.sp-meter.bad i { background: var(--bad); }
.sp-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--text); border-radius: 2px; }
.sp-meter-key { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--muted); }
.sp-status { margin: .75rem 0 0; padding: .65rem .8rem; border-radius: 10px; font-size: .92rem; }
.sp-status.ok { background: var(--ok-bg); color: var(--ok); }
.sp-status.warn { background: var(--warn-bg); color: var(--warn); }
.sp-status.bad { background: var(--bad-bg); color: var(--bad); }
.sp-compare { margin: .6rem 0 0; font-size: .88rem; color: var(--muted); }
.sp-set { margin-top: .75rem; }

.sp-legend { display: flex; flex-wrap: wrap; gap: .4rem 1rem; font-size: .8rem; color: var(--muted); margin: .1rem 0 .3rem; }
.sp-legend span { display: inline-flex; align-items: center; gap: .35rem; }
.sp-key-line { display: inline-block; width: 16px; height: 2px; border-radius: 2px; background: var(--accent); }
.sp-key-dash { display: inline-block; width: 16px; border-top: 2px dashed var(--muted); }
.sp-chart { position: relative; touch-action: pan-y; }
.sp-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.sp-axis { stroke: var(--border); stroke-width: 1; }
.sp-budget-line { stroke: var(--border); stroke-width: 1; }
.sp-pace-line { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; opacity: .8; }
.sp-area { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.sp-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sp-dot { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.sp-tick { fill: var(--muted); font-size: 10px; }
.sp-cross line { stroke: var(--muted); stroke-width: 1; }
.sp-cross circle { fill: var(--accent); stroke: var(--card); stroke-width: 2; }
.sp-hit { fill: transparent; cursor: crosshair; }
.sp-tip { position: absolute; top: 0; padding: .35rem .55rem; border-radius: 8px; background: var(--text); color: var(--bg); font-size: .8rem; white-space: nowrap; pointer-events: none; box-shadow: 0 4px 12px rgb(0 0 0 / .2); }
.sp-tip span { opacity: .8; }

.sp-cats { list-style: none; margin: .25rem 0 0; padding: 0; }
.sp-cat-row { display: block; width: 100%; padding: .55rem 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sp-cats li + li .sp-cat-row { border-top: 1px solid var(--border); }
.sp-cat-top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; font-size: .95rem; }
.sp-cat-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-cat-amt small { color: var(--muted); font-weight: 500; margin-left: .2rem; }
.sp-cat-note { margin-left: .45rem; font-size: .78rem; font-weight: 700; }
.sp-cat-note.bad { color: var(--bad); }
.sp-cat-note.warn { color: var(--warn); }
.sp-bar { display: block; height: 6px; margin-top: .4rem; border-radius: 999px; background: var(--bg); overflow: hidden; }
.sp-bar i { display: block; height: 100%; min-width: 3px; border-radius: inherit; background: var(--accent); }
.sp-bar.warn i { background: #d97706; }
.sp-bar.bad i { background: var(--bad); }

.sp-rows { list-style: none; margin: 0; padding: 0; }
.sp-row { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sp-rows li + li .sp-row { border-top: 1px solid var(--border); }
.sp-emoji { flex: none; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 12px; background: color-mix(in srgb, var(--accent) 11%, transparent); font-size: 1.2rem; }
.sp-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sp-row-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row-main small { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row-amt { flex: none; font-weight: 700; font-variant-numeric: tabular-nums; }

.sp-tools { padding-bottom: .75rem; }
.sp-history-total { margin: 0 .25rem .6rem; color: var(--muted); font-size: .9rem; }
.sp-history-total b { color: var(--text); }
.sp-day { padding: .6rem 1rem .2rem; margin-bottom: .75rem; }
.sp-day-head { display: flex; justify-content: space-between; font-size: .85rem; font-weight: 700; color: var(--muted); padding-bottom: .15rem; }
.sp-empty { text-align: center; }
.sp-empty[hidden] { display: none; }
.sp-empty-title { margin: .25rem 0 0; font-weight: 700; font-size: 1.1rem; }

.sp-money-field { display: flex; align-items: center; gap: .35rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); padding: 0 .8rem; }
.sp-money-field > span { color: var(--muted); font-weight: 700; }
.sp-money-field input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.25rem; font-weight: 700; padding: .6rem 0; outline: none; font-variant-numeric: tabular-nums; }
.sp-money-field:focus-within { border-color: var(--accent); }
.sp-money-field.small { width: 7.5rem; padding: 0 .6rem; border-radius: 10px; }
.sp-money-field.small input { font-size: 1rem; padding: .45rem 0; text-align: right; }
.sp-small { margin-top: .4rem; font-size: .82rem; }
.field select { width: 100%; }
.sp-catbudgets #cat-budgets { margin-top: .5rem; }
.sp-cb-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .35rem 0; }
.sp-cb-row + .sp-cb-row { border-top: 1px solid var(--border); }

.sp-repeats { list-style: none; margin: 0; padding: 0; }
.sp-repeats li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; }
.sp-repeats li + li { border-top: 1px solid var(--border); }
.sp-none { color: var(--muted); font-size: .9rem; }
.text-btn.danger { color: var(--bad); }

.sp-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.sp-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .3rem .3rem .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .9rem; }
.sp-chip button { width: 1.6rem; height: 1.6rem; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.sp-newcat { display: flex; gap: .5rem; margin-top: .75rem; }
.sp-newcat input { min-width: 0; font: inherit; padding: .5rem .65rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.sp-newcat #cat-emoji { width: 3.2rem; flex: none; text-align: center; }
.sp-newcat #cat-name { flex: 1; }

.sp-amount { display: flex; align-items: baseline; justify-content: center; gap: .25rem; margin: 1.1rem 0 .5rem; }
.sp-amount span { font-size: 1.8rem; font-weight: 700; color: var(--muted); }
.sp-amount input { width: 9ch; border: 0; border-bottom: 2px solid var(--border); background: none; color: var(--text); font: inherit; font-size: 2.6rem; font-weight: 800; text-align: center; padding: 0 0 .1rem; outline: none; font-variant-numeric: tabular-nums; }
.sp-amount input:focus { border-bottom-color: var(--accent); }
.sp-cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); gap: .4rem; margin-top: .75rem; }
.sp-cat-pick { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem .2rem; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--text); font: inherit; font-size: .78rem; font-weight: 600; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-cat-pick b { font-size: 1.35rem; font-weight: 400; line-height: 1.2; }
.sp-cat-pick[aria-checked="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.sp-check { display: flex; align-items: center; gap: .55rem; margin-top: 1rem; font-size: .95rem; cursor: pointer; }
.sp-check input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.sp-check small { color: var(--muted); }
.sp-pace-key { display: inline-block; width: 2px; height: .8rem; margin: 0 .1rem 0 .15rem; vertical-align: -.1rem; background: var(--text); border-radius: 2px; }

/* ---- Loading ---------------------------------------------------------------------------------- */
/* Until the app has drawn itself (shared/pwa.js adds .ready to <body>), a skeleton stands in
   for the page. If that never happens, the page shows anyway after 6 seconds. */
.boot { display: none; }
body:not(.ready) .boot { display: block; max-width: 560px; margin: 0 auto; padding: 1rem; animation: boot-in .2s .12s both, boot-gone 0s 6s forwards; }
body:not(.ready) main:not(.hub), body:not(.ready) .jb-fab, body:not(.ready) .ls-fab { visibility: hidden; animation: boot-show 0s 6s forwards; }
@keyframes boot-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes boot-show { to { visibility: visible; } }
@keyframes boot-gone { to { visibility: hidden; height: 0; padding: 0; overflow: hidden; } }
.boot-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.1rem 1rem; margin-bottom: 1rem; }
.boot-card i { display: block; height: .8rem; margin: .7rem 0; border-radius: 6px; }
.boot-card i:first-child { width: 45%; height: 1rem; margin-top: 0; }
.boot-card i.w80 { width: 80%; }
.boot-card i.w60 { width: 60%; }
.boot-card i:last-child { margin-bottom: 0; }
.boot-card i, body:not(.ready) .balance .big, body:not(.ready) .balance .muted:not(:empty) {
  background: linear-gradient(90deg, var(--skel) 0 40%, var(--skel-hi) 50%, var(--skel) 60% 100%) 0 0 / 300% 100%;
  animation: boot-shimmer 1.3s linear infinite;
}
body:not(.ready) .boot-card i { --skel: var(--border); --skel-hi: color-mix(in srgb, var(--border) 40%, var(--card)); }
body:not(.ready) .balance .big, body:not(.ready) .balance .muted:not(:empty) {
  --skel: rgb(255 255 255 / .22); --skel-hi: rgb(255 255 255 / .38);
  color: transparent !important; width: fit-content; margin-left: auto; margin-right: auto; border-radius: 8px;
}
@keyframes boot-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .boot-card i, body:not(.ready) .balance .big, body:not(.ready) .balance .muted { animation: none !important; } }

/* Pictures still on their way get a soft placeholder instead of a blank gap. */
.gd-shot img, .tc-face img, .tr-detail img, .tr-thumb img { background: color-mix(in srgb, var(--border) 60%, transparent); }

/* ---- Storage notices (shared/pwa.js) ---------------------------------------------------------- */
.store-note-wrap { max-width: 560px; margin: 0 auto; padding: 1rem 1rem 0; }
.store-note { background: var(--card); border: 1px solid var(--border); border-left: 4px solid var(--accent, #0f766e); border-radius: 14px; padding: .9rem 1rem; color: var(--text); font-size: .92rem; }
.hub .store-note { margin: 0 0 1.25rem; }
.store-note.warn { border-left-color: var(--warn); }
.store-note.bad { border-left-color: var(--bad); background: var(--bad-bg); }
.store-note-title { margin: 0 0 .3rem; font-weight: 700; font-size: 1rem; }
.store-note-body p { margin: 0 0 .4rem; }
.store-note-body ol { margin: .3rem 0 .4rem; padding-left: 1.25rem; }
.store-note-body li { margin: .2rem 0; }
.store-note-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; margin-top: .6rem; }
.store-note-actions:empty { display: none; }
.store-note-close { margin-left: auto; }
.store-note-status { margin: .6rem 0 0; font-size: .88rem; color: var(--muted); }
.store-note-status.ok { color: var(--ok); }
.store-note-status.bad { color: var(--bad); }
.sp-keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin: .5rem 0 .25rem; }
.sp-keypad[hidden] { display: none; }
.sp-keypad button { height: 2.9rem; border: 0; border-radius: 12px; background: var(--bg); color: var(--text); font: inherit; font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; cursor: pointer; display: grid; place-items: center; touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; }
.sp-keypad button:active { background: var(--border); }
.sp-amount input[readonly] { border-bottom-color: var(--accent); caret-color: transparent; }

/* ---- Version and updates (shared/pwa.js) ------------------------------------------------------ */
.hub-foot { max-width: 560px; margin: 1.5rem auto 0; padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.hub-foot .text-btn { font-size: inherit; color: var(--accent, #0f766e); }
.hub-foot-status { margin: .35rem 0 0; min-height: 1.2em; }
.update-bar { position: fixed; left: 50%; top: calc(.75rem + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 20; display: flex; align-items: center; gap: 1rem; width: max-content; max-width: calc(100% - 2rem); padding: .55rem .6rem .55rem 1rem; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: 0 6px 20px rgb(0 0 0 / .25); font-size: .92rem; }
.update-bar button { border: 0; border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-weight: 700; padding: .35rem .75rem; cursor: pointer; }
.backup-when { margin: .25rem 0 0; font-size: .9rem; font-weight: 600; color: var(--muted); }
.backup-when.due { color: var(--warn); }
.backup-when.due::before { content: '⚠ '; }
.sp-amt-hint { text-align: center; margin: 0 0 .5rem; }

/* ---- Palm Reading ------------------------------------------------------------------------------ */
.theme-palm { --accent: #92400e; --accent-text: #ffffff; --skin: #f5dcc6; --skin-edge: #c99a78; --crease: rgb(120 70 40 / .28); }
@media (prefers-color-scheme: dark) { .theme-palm { --accent: #fbbf24; --accent-text: #2a1600; --skin: #5a4434; --skin-edge: #8d6a51; --crease: rgb(255 230 200 / .25); } }
.theme-palm .balance { background: radial-gradient(circle at 85% 0%, rgb(251 191 36 / .35), transparent 50%), linear-gradient(160deg, #b45309, #78350f); color: #fff; }
.tile.palm { background: linear-gradient(160deg, #b45309, #78350f); color: #fff; border-color: #92400e; }
.tile.palm small { color: rgb(255 255 255 / .95); }

.pl-hand { display: block; }
.pl-hand.large { width: min(15rem, 70%); margin: 0 auto; }
.pl-hand.small { width: 100%; max-width: 6.5rem; margin: 0 auto; }
.pl-hand.tiny { width: 2.6rem; }
.pl-skin > * { fill: var(--skin); stroke: var(--skin-edge); stroke-width: 2; }
.pl-line { fill: none; stroke: var(--crease); stroke-width: 3; stroke-linecap: round; }
.pl-line.on { stroke: var(--accent); stroke-width: 4.5; }

.pl-progress { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin: 0 0 .75rem; }
.pl-progress i { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .25s ease; }
.pl-step-count { margin: 0 0 .2rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.pl-figure { margin: .5rem 0; }
.pl-spot { margin: .25rem 0 .9rem; color: var(--text); }
.pl-opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; }
.pl-opts-3 { grid-template-columns: repeat(3, 1fr); }
.pl-opt { display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: .6rem .4rem; border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; text-align: center; cursor: pointer; }
.pl-opt[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.pl-opt-label { font-weight: 700; font-size: .9rem; line-height: 1.25; }
.pl-opt small { color: var(--muted); font-size: .78rem; line-height: 1.3; }
.pl-opt-emoji { font-size: 2.2rem; line-height: 1.2; }
.pl-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; }
.pl-nav .secondary { padding: .55rem 1rem; }
.pl-finish { display: block; margin: .75rem auto 0; }

.pl-photo { padding: .75rem 1rem; }
.pl-photo-empty p { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); }
.pl-photo-btn { display: inline-flex; align-items: center; gap: .3rem; padding: .5rem .9rem; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-weight: 600; font-size: .92rem; cursor: pointer; }
.pl-photo-view { text-align: center; }
.pl-photo-view img { display: block; max-width: 100%; max-height: 16rem; margin: 0 auto .4rem; border-radius: 12px; }

.pl-reading-head { display: flex; gap: 1rem; align-items: center; }
.pl-reading-head .pl-figure { flex: 0 0 6.5rem; margin: 0; }
.pl-reading-head .pl-hand { width: 100%; }
.pl-reading-icon { margin: 0; font-size: 2rem; line-height: 1; }
.pl-reading h2 { display: block; margin: .2rem 0 .4rem; font-size: 1.4rem; }
.pl-reading h3, .pl-saved h3, .pl-learn h3 { margin: 1.1rem 0 .3rem; font-size: 1rem; }
.pl-reading p, .pl-saved p { margin: .35rem 0; }
.pl-intro { font-style: italic; color: var(--muted); }
.pl-note { margin-top: 1rem !important; }
.pl-keywords { display: flex; flex-wrap: wrap; gap: .3rem; margin: .3rem 0 !important; }
.pl-keywords span { padding: .15rem .55rem; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-size: .8rem; font-weight: 700; }

.pl-howto { margin: .5rem 0; padding-left: 1.2rem; }
.pl-howto li { margin: .35rem 0; }
.pl-learn-el { margin: .7rem 0; }
.pl-learn > summary, .pl-saved > summary { display: flex; align-items: center; gap: .75rem; list-style: none; cursor: pointer; }
.pl-learn > summary::-webkit-details-marker, .pl-saved > summary::-webkit-details-marker { display: none; }
.pl-learn > summary small, .pl-saved > summary small { display: block; color: var(--muted); font-size: .85rem; }
.pl-learn-mini { flex: none; }
.pl-learn-list { margin: 0; padding-left: 1.1rem; }
.pl-learn-list li { margin: .35rem 0; }
.pl-saved-icon { font-size: 1.8rem; }
.pl-saved-main { flex: 1; }
.theme-palm .balance { padding-top: calc(3.3rem + env(safe-area-inset-top)); }
.jb-find-row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .7rem; }
.jb-find-row .jb-filters { flex: 1 1 100%; min-width: 0; margin-top: 0; }
.jb-find-min { flex: none; font: inherit; font-size: .88rem; padding: .4rem .5rem; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); }
.jb-find-status { margin: 0 .25rem .75rem; color: var(--muted); font-size: .88rem; }
.jb-find-row-item { cursor: default; }
.jb-find-row-item:hover { background: none; }
.jb-new { flex: none; font-size: .7rem; font-weight: 800; padding: .1rem .45rem; border-radius: 999px; background: var(--accent); color: var(--accent-text); }
.jb-skills { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .4rem; }
.jb-skills span { font-size: .75rem; padding: .1rem .45rem; border-radius: 6px; background: var(--bg); color: var(--muted); }
.jb-quick a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ---- Bus ---------------------------------------------------------------------------------------- */
.theme-bus { --accent: #0e7490; --accent-text: #ffffff; }
@media (prefers-color-scheme: dark) { .theme-bus { --accent: #22d3ee; --accent-text: #062a33; } }
.tile.bus { background: #0e7490; color: #fff; border-color: #0e7490; }
.tile.bus small { color: rgb(255 255 255 / .95); }

.bs-find { padding-bottom: .6rem; }
.bs-find-row { display: flex; gap: .5rem; }
.bs-find-row .jb-search { flex: 1; min-width: 0; }
.bs-near { flex: none; padding: .6rem .8rem; }
.bs-find-status { margin: .6rem .1rem 0; color: var(--muted); font-size: .88rem; }
.bs-results { list-style: none; margin: .3rem 0 0; padding: 0; }
.bs-results:empty { display: none; }
.bs-result { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .6rem .1rem; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.bs-result > span:first-child { flex: 1; min-width: 0; }
.bs-result b { display: block; }
.bs-result small { color: var(--muted); font-size: .85rem; }
.bs-dist { flex: none; color: var(--accent); font-weight: 700; font-size: .88rem; }

.bs-section { display: block; margin: 1.25rem .25rem .6rem; font-size: 1rem; }
.bs-stop { padding: .85rem 1rem .6rem; }
.bs-stop-head { display: flex; align-items: flex-start; gap: .5rem; }
.bs-stop-name { flex: 1; min-width: 0; }
.bs-stop-name b { display: block; font-size: 1.05rem; }
.bs-stop-name small { color: var(--muted); font-size: .85rem; }
.bs-star { flex: none; width: 2.75rem; height: 2.75rem; margin: -.5rem -.6rem 0 0; border: 0; background: none; color: var(--accent); font-size: 1.5rem; cursor: pointer; }
.bs-services { list-style: none; margin: .5rem 0 0; padding: 0; }
.bs-service { display: grid; grid-template-columns: 3.6rem 1fr; grid-template-rows: auto auto; column-gap: .6rem; align-items: center; padding: .55rem 0; border-top: 1px solid var(--border); }
.bs-no { grid-row: 1 / 3; justify-self: start; min-width: 3.2rem; padding: .3rem .4rem; border-radius: 8px; background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 1.05rem; text-align: center; font-variant-numeric: tabular-nums; }
.bs-dest { color: var(--muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bs-times { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.bs-time { display: flex; align-items: baseline; gap: .15rem; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.bs-time b { font-size: 1.25rem; }
.bs-time small { color: var(--muted); font-size: .75rem; }
.bs-time em { flex-basis: 100%; font-style: normal; color: var(--muted); font-size: .68rem; margin-top: -.15rem; }
.bs-time.sched b::before { content: '~'; color: var(--muted); font-weight: 400; }
.bs-time.none { color: var(--muted); }
.bs-load { display: inline-block; width: .55rem; height: .55rem; margin-left: .2rem; border-radius: 50%; background: var(--border); align-self: center; }
.bs-load.ok { background: #16a34a; }
.bs-load.warn { background: #f59e0b; }
.bs-load.bad { background: #dc2626; }
.bs-msg { margin: .6rem 0 .2rem; color: var(--muted); font-size: .92rem; }
.bs-msg.bad, .bs-stop-foot .bad { color: var(--bad); }
.bs-stop-foot { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; margin-top: .4rem; color: var(--muted); font-size: .78rem; }
.bs-stop-foot .text-btn { font-size: .85rem; }
.bs-empty p { margin: .2rem 0; }
.bs-settings summary { font-weight: 700; }
.bs-credit { margin-top: .9rem; font-size: .8rem; }
