/* Thirty, trading journal by AK Trades. Styles, version 2.1.
   Apple-style: system font, grouped surfaces, quiet color, light and dark.
   Brand: deep green #0E3B28, action green #127A4B, signal green #2BD88B
   (gains, dark only), loss red #B8433A (real losses only), cream #F6F1E7. */

/* ---------- tokens: light ---------- */
:root {
  --bg: #F4F3EF;
  --card: #FFFFFF;
  --card-2: #FFFFFF;                 /* sheet */
  --raised: #F7F6F2;                 /* rows inside a card */
  --fill: rgba(116, 116, 108, .12);  /* inputs, segmented track */
  --fill-2: rgba(116, 116, 108, .08);
  --sep: rgba(40, 44, 40, .10);
  --sep-strong: rgba(40, 44, 40, .16);
  --text: #121513;
  --text-2: #5C615D;
  --text-3: #8C908C;
  --brand: #0E3B28;
  --accent: #127A4B;
  --accent-hover: #0F6A41;
  --accent-text: #0F6E44;
  --accent-tint: rgba(18, 122, 75, .10);
  --on-accent: #FFFFFF;
  --gain: #127A4B;
  --gain-tint: rgba(18, 122, 75, .10);
  --loss: #B8433A;
  --loss-text: #A63A31;
  --loss-tint: rgba(184, 67, 58, .09);
  --warn: #9A6514;
  --warn-tint: rgba(176, 120, 30, .12);
  --cream: #F6F1E7;
  --focus: #127A4B;
  --bar: rgba(244, 243, 239, .78);
  --scrim: rgba(18, 21, 19, .32);
  --shadow-card: 0 0 0 .5px rgba(0, 0, 0, .05), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-float: 0 0 0 .5px rgba(0, 0, 0, .06), 0 10px 30px rgba(0, 0, 0, .12);
  --sel-seg: #FFFFFF;
  --sel-seg-shadow: 0 0 0 .5px rgba(0, 0, 0, .04), 0 2px 6px rgba(0, 0, 0, .10);

  --r-card: 22px;
  --r-row: 14px;
  --r-ctl: 12px;

  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-drawer: cubic-bezier(.32, .72, 0, 1);

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
  color-scheme: light;
}

/* ---------- tokens: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0E0C; --card: #141A17; --card-2: #171E1A; --raised: #1C231F;
    --fill: rgba(220, 235, 226, .10); --fill-2: rgba(220, 235, 226, .06);
    --sep: rgba(220, 235, 226, .09); --sep-strong: rgba(220, 235, 226, .15);
    --text: #F4F2EC; --text-2: #A2A8A3; --text-3: #6E756F;
    --accent: #127A4B; --accent-hover: #158A55; --accent-text: #2BD88B; --accent-tint: rgba(43, 216, 139, .12); --on-accent: #FFFFFF;
    --gain: #2BD88B; --gain-tint: rgba(43, 216, 139, .12);
    --loss: #B8433A; --loss-text: #E2756A; --loss-tint: rgba(184, 67, 58, .18);
    --warn: #D9A85A; --warn-tint: rgba(217, 168, 90, .14);
    --focus: #2BD88B;
    --bar: rgba(10, 14, 12, .76); --scrim: rgba(0, 0, 0, .55);
    --shadow-card: 0 0 0 .5px rgba(220, 235, 226, .07);
    --shadow-float: 0 0 0 .5px rgba(220, 235, 226, .10), 0 18px 48px rgba(0, 0, 0, .55);
    --sel-seg: #2C3530; --sel-seg-shadow: 0 0 0 .5px rgba(255, 255, 255, .06), 0 2px 6px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0E0C; --card: #141A17; --card-2: #171E1A; --raised: #1C231F;
  --fill: rgba(220, 235, 226, .10); --fill-2: rgba(220, 235, 226, .06);
  --sep: rgba(220, 235, 226, .09); --sep-strong: rgba(220, 235, 226, .15);
  --text: #F4F2EC; --text-2: #A2A8A3; --text-3: #6E756F;
  --accent: #127A4B; --accent-hover: #158A55; --accent-text: #2BD88B; --accent-tint: rgba(43, 216, 139, .12); --on-accent: #FFFFFF;
  --gain: #2BD88B; --gain-tint: rgba(43, 216, 139, .12);
  --loss: #B8433A; --loss-text: #E2756A; --loss-tint: rgba(184, 67, 58, .18);
  --warn: #D9A85A; --warn-tint: rgba(217, 168, 90, .14);
  --focus: #2BD88B;
  --bar: rgba(10, 14, 12, .76); --scrim: rgba(0, 0, 0, .55);
  --shadow-card: 0 0 0 .5px rgba(220, 235, 226, .07);
  --shadow-float: 0 0 0 .5px rgba(220, 235, 226, .10), 0 18px 48px rgba(0, 0, 0, .55);
  --sel-seg: #2C3530; --sel-seg-shadow: 0 0 0 .5px rgba(255, 255, 255, .06), 0 2px 6px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
html.sheet-open { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 15px/1.47 var(--font); letter-spacing: -.008em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 200ms ease;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent-text); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* numbers: system font with tabular figures, tighter as they grow */
.num { font-variant-numeric: tabular-nums; }
.num-xxl { font-size: 46px; line-height: 1; font-weight: 700; letter-spacing: -.035em; }
.num-xl { font-size: 38px; line-height: 1.02; font-weight: 700; letter-spacing: -.03em; }
.num-lg { font-size: 28px; line-height: 1.05; font-weight: 700; letter-spacing: -.025em; }
.pos { color: var(--gain); }
.neg { color: var(--loss-text); }
.na { color: var(--text-3); }
.warn-text { color: var(--warn); }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.mt { margin-top: 14px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--bar);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: 0 .5px 0 transparent; transition: box-shadow 150ms ease;
}
.topbar.is-scrolled { box-shadow: 0 .5px 0 var(--sep-strong); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark { width: 30px; height: 30px; flex: none; display: block; border-radius: 8px; }
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.1; letter-spacing: -.02em; }
.brand-sub { font-size: 12px; color: var(--text-2); line-height: 1.3; margin-top: 2px; letter-spacing: 0; }
.topbar .brand-sub { display: none; }
.top-clock { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); white-space: nowrap; }
.top-clock .num { color: var(--text); font-weight: 600; }

.main { width: 100%; max-width: 1180px; margin: 0 auto; min-width: 0; padding: 0 16px calc(var(--tabbar-h) + 36px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
  padding: 4px 6px calc(4px + env(safe-area-inset-bottom));
  background: var(--bar);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: 0 -.5px 0 var(--sep-strong);
}
.tab {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 54px; color: var(--text-3); font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  transition: color 150ms ease;
}
.tab-ic { display: grid; place-items: center; width: 52px; height: 28px; transition: transform 120ms var(--ease-out); }
.tab:active .tab-ic { transform: scale(.96); }
.tab[aria-current="page"] { color: var(--accent-text); }
.tab-add { display: grid; place-items: center; }
.add-btn {
  width: 50px; height: 50px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--accent); color: var(--on-accent);
  box-shadow: 0 6px 16px rgba(18, 122, 75, .32), inset 0 1px 0 rgba(255, 255, 255, .16);
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.add-btn:active { transform: scale(.96); }

@media (min-width: 960px) {
  .app { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; gap: 22px;
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    padding: 26px 14px 20px; background: var(--bar); box-shadow: .5px 0 0 var(--sep-strong);
  }
  .topbar, .tabbar { display: none; }
  .main { padding: 40px 40px 64px; }
}
.side-brand { padding: 0 6px; }
.side-brand .brand-mark { width: 36px; height: 36px; border-radius: 10px; }
.side-brand .brand-sub { white-space: nowrap; }
.nav { display: grid; gap: 2px; }
.nav-item {
  appearance: none; border: 0; background: none; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 10px; border-radius: 10px;
  color: var(--text); font-size: 15px; font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease;
}
.nav-item svg { color: var(--accent-text); }
.nav-item[aria-current="page"] { background: var(--fill); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 14px; padding: 0 6px; }
.side-clock { display: grid; gap: 2px; padding: 14px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-card); }
.side-clock .label { font-size: 12px; color: var(--text-2); }
.side-clock .num { font-size: 24px; font-weight: 700; letter-spacing: -.025em; }
.side-status { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); }
.side-legal { font-size: 11.5px; line-height: 1.45; color: var(--text-3); }
@media (hover: hover) and (pointer: fine) {
  .nav-item:not([aria-current]):hover { background: var(--fill-2); }
  .tab:hover { color: var(--text); }
  .add-btn:hover { background: var(--accent-hover); }
}

/* ---------- page ---------- */
.page-head { margin: 10px 4px 18px; }
.page-title { font-weight: 700; font-size: 34px; line-height: 1.08; letter-spacing: -.026em; }
.page-sub { margin-top: 4px; font-size: 15px; color: var(--text-2); }
@media (min-width: 960px) { .page-head { margin: 0 4px 24px; } .page-title { font-size: 38px; } }

/* two column layout: one stack on phones (cards ordered by .o1 to .o4), two stacks from 1080px */
.cols { display: flex; flex-direction: column; gap: 14px; }
.col { display: contents; }
.o1 { order: 1; } .o2 { order: 2; } .o3 { order: 3; } .o4 { order: 4; }
@media (min-width: 1080px) {
  .cols { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 18px; align-items: start; }
  .col { display: grid; gap: 18px; min-width: 0; }
}
@media (min-width: 720px) and (max-width: 959px) { .main { max-width: 760px; } }

.card { background: var(--card); border-radius: var(--r-card); padding: 18px; box-shadow: var(--shadow-card); min-width: 0; }
@media (min-width: 720px) { .card { padding: 22px; } }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; min-height: 28px; }
.card-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); letter-spacing: -.004em; }
.card-note { margin-top: 8px; font-size: 14.5px; color: var(--text-2); }
.card-fine { margin-top: 14px; font-size: 12.5px; line-height: 1.45; color: var(--text-3); letter-spacing: 0; }
.card-head .card-fine { margin: 0; }

.banners { display: grid; gap: 8px; margin-bottom: 14px; }
.banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 10px 10px 16px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-card);
  font-size: 14px; line-height: 1.4; color: var(--text-2);
}
.banner > span:first-child { flex: 1 1 auto; min-width: 0; }
.banner > .btn, .banner-actions { flex: none; }
.banner strong { color: var(--text); font-weight: 600; }
.banner.warn { background: var(--warn-tint); box-shadow: none; color: var(--text); }
.banner-actions { display: flex; gap: 8px; }

.page-foot { margin-top: 28px; padding: 16px 4px 0; display: grid; gap: 4px; font-size: 12px; color: var(--text-3); }
@media (min-width: 960px) { .page-foot { display: none; } }

/* ---------- controls ---------- */
.btn {
  appearance: none; border: 0; cursor: pointer; text-decoration: none; position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--r-ctl);
  background: var(--fill); color: var(--text);
  font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap;
  transition: transform 120ms var(--ease-out), background-color 150ms ease, opacity 150ms ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-tinted { background: var(--accent-tint); color: var(--accent-text); }
.btn-plain { background: transparent; color: var(--accent-text); padding: 0 10px; }
.btn-danger { color: var(--loss-text); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.btn-sm::after { content: ""; position: absolute; inset: -5px -2px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.icon-btn {
  appearance: none; border: 0; cursor: pointer; flex: none;
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); color: var(--text);
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.icon-btn::after { content: ""; position: absolute; inset: -2px; }
.icon-btn { position: relative; }
.icon-btn:active { transform: scale(.96); }
.icon-btn:disabled { opacity: .3; cursor: not-allowed; transform: none; }
.link-btn {
  appearance: none; border: 0; background: none; cursor: pointer; min-height: 44px; padding: 0 2px; margin: -8px -2px;
  color: var(--accent-text); font-size: 14px; font-weight: 500;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: var(--sep-strong); }
  .btn-primary:hover { background: var(--accent-hover); }
  .btn-tinted:hover { background: var(--gain-tint); filter: brightness(.97); }
  .btn-plain:hover { background: var(--fill-2); }
  .icon-btn:hover:not(:disabled) { background: var(--sep-strong); }
  .link-btn:hover { text-decoration: underline; }
}

.chip {
  display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 10px; border-radius: 999px;
  background: var(--fill); color: var(--text-2); font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1; letter-spacing: 0;
}
.chip svg { flex: none; }
.chip-ok { background: var(--gain-tint); color: var(--accent-text); }
.chip-bad { background: var(--loss-tint); color: var(--loss-text); }
.chip-demo { background: transparent; box-shadow: inset 0 0 0 1px var(--sep-strong); }
.flag { display: inline-flex; align-items: flex-start; gap: 8px; padding: 7px 11px; border-radius: 10px; font-size: 13px; line-height: 1.4; font-weight: 500; }
.flag.red { background: var(--loss-tint); color: var(--loss-text); }
.flag.amber { background: var(--warn-tint); color: var(--warn); }
.flag .dot { margin-top: 6px; }
.flag.red .dot { background: var(--loss-text); }
.flag.amber .dot { background: var(--warn); }
.chips, .flags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; font-weight: 600; color: var(--text-3); padding: 2px 7px; border-radius: 6px; background: var(--fill-2); letter-spacing: 0; }

.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.dot.ok { background: var(--gain); }
.dot.bad { background: var(--loss); }
.dot.warn { background: var(--warn); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field > span em, .field-label em { font-style: normal; font-weight: 400; color: var(--text-3); }
.field.full { grid-column: 1 / -1; }
input[type=text], input[type=date], input[type=time], input[type=url], select, textarea {
  width: 100%; min-width: 0; min-height: 46px; padding: 11px 13px; border: 0; border-radius: var(--r-ctl);
  background: var(--fill); color: var(--text);
  font: 400 16px/1.3 var(--font); transition: box-shadow 150ms ease, background-color 150ms ease;
}
input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; }
input[inputmode=decimal] { font-variant-numeric: tabular-nums; }
textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238C908C' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
}
input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 2px var(--focus); background-color: var(--card); }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.ticker-input { text-transform: uppercase; font-weight: 700 !important; letter-spacing: .02em; }
.ticker-input::placeholder { font-weight: 400; }
.input-lg { min-height: 58px !important; font-size: 26px !important; font-weight: 600 !important; letter-spacing: -.02em !important; }
.fgrid { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fgrid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-error { color: var(--loss-text); font-size: 14px; }
.form-error:empty { display: none; }
.hint-line { font-size: 13px; color: var(--text-2); }
.hint-line strong { color: var(--text); font-weight: 600; }

/* segmented control (iOS): track is a fill, the selected segment is a raised card */
.seg { display: flex; padding: 2px; border-radius: 11px; background: var(--fill); }
.seg label { flex: 1 1 0; min-width: 0; cursor: pointer; position: relative; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 36px; padding: 0 8px;
  border-radius: 9px; color: var(--text); font-size: 14px; font-weight: 500; line-height: 1.2; user-select: none;
  transition: background-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), transform 120ms var(--ease-out);
}
.seg label:active span { transform: scale(.96); }
.seg input:checked + span { background: var(--sel-seg); box-shadow: var(--sel-seg-shadow); font-weight: 600; }
.seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.seg-yn input[value="yes"]:checked + span { color: var(--accent-text); }
.seg-yn input[value="no"]:checked + span { color: var(--loss-text); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { position: relative; cursor: pointer; }
.pills input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.pills span {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--fill); color: var(--text); font-size: 14px; font-weight: 500; user-select: none;
  transition: background-color 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}
.pills label::after { content: ""; position: absolute; inset: -4px 0; }
.pills span em { font-style: normal; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--text-3); }
.pills label:active span { transform: scale(.96); }
.pills input:checked + span { background: var(--text); color: var(--bg); }
.pills input:checked + span em { color: inherit; opacity: .7; }
.pills input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* iOS switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 56px; padding: 8px 14px; border-radius: var(--r-row); background: var(--fill-2); cursor: pointer; }
.switch-row strong { display: block; font-size: 15px; font-weight: 600; }
.switch-row small { display: block; font-size: 12.5px; color: var(--text-2); }
.switch { -webkit-appearance: none; appearance: none; position: relative; flex: none; width: 51px; height: 31px; margin: 0; border-radius: 999px; background: var(--sep-strong); cursor: pointer; transition: background-color 200ms ease; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #FFF; box-shadow: 0 2px 6px rgba(0, 0, 0, .22); transition: transform 240ms var(--ease-out); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus { box-shadow: none; }
.switch:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* range */
.range-row { display: flex; align-items: center; gap: 14px; }
.range-val { min-width: 56px; text-align: right; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.range-val small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 44px; margin: 0; background: transparent; cursor: pointer; --p: 44%; }
input[type=range]:focus { outline: none; box-shadow: none; background: transparent; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 99px; background: linear-gradient(to right, var(--accent) var(--p), var(--fill) var(--p)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -12px; border-radius: 50%; background: #FFF; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 3px 8px rgba(0, 0, 0, .18); transition: transform 120ms var(--ease-out); }
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.06); }
input[type=range]:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus); outline-offset: 2px; }
input[type=range]::-moz-range-track { height: 4px; border-radius: 99px; background: var(--fill); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--accent); }
input[type=range]::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: #FFF; box-shadow: 0 3px 8px rgba(0, 0, 0, .18); }

/* settings rows: label left, value right, like iOS Settings */
.form-list { border-radius: var(--r-row); background: var(--fill-2); overflow: hidden; }
.frow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 6px 8px 6px 14px; position: relative; cursor: text; }
.frow + .frow::before { content: ""; position: absolute; top: 0; left: 14px; right: 0; height: .5px; background: var(--sep-strong); }
.frow-l { font-size: 15px; font-weight: 500; min-width: 0; }
.frow-l small { display: block; font-size: 12.5px; font-weight: 400; color: var(--text-2); line-height: 1.35; }
.frow-in { display: flex; align-items: center; gap: 6px; flex: none; color: var(--text-2); font-size: 14px; }
.frow-in input { width: 92px; min-height: 38px; padding: 7px 10px; text-align: right; background: transparent; font-weight: 600; color: var(--text); }
.frow-in input[type=date] { width: 148px; }
.frow-in input[type=date], .frow-in input[type=time] { padding-right: 6px; }
.frow-in input[type=time] { width: 120px; }
.frow-in input:focus { background: var(--card); }
.unit { min-width: 0; }
.group-title { margin: 20px 4px 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* checklist rows */
.steps { display: grid; gap: 8px; }
.check {
  position: relative; display: flex; align-items: flex-start; gap: 14px; min-height: 60px; padding: 13px 14px;
  border-radius: var(--r-row); background: var(--fill-2); cursor: pointer;
  transition: background-color 150ms ease, transform 120ms var(--ease-out);
}
.check:active { transform: scale(.985); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.check-box {
  flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: inset 0 0 0 1.5px var(--text-3); transition: background-color 150ms ease, box-shadow 150ms ease;
}
.check-box::after { content: ""; width: 6px; height: 11px; border: solid #FFF; border-width: 0 2.2px 2.2px 0; transform: translateY(-1px) rotate(45deg) scale(.5); opacity: 0; transition: opacity 150ms ease, transform 200ms var(--ease-out); }
.check input:checked + .check-box { background: var(--accent); box-shadow: none; }
.check input:checked + .check-box::after { opacity: 1; transform: translateY(-1px) rotate(45deg) scale(1); }
.check input:focus-visible + .check-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.check.is-on .check-text strong { color: var(--text); }
.check.is-on { background: var(--accent-tint); }
.check-text strong { display: block; font-size: 15px; font-weight: 600; }
.check-text small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.or { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); padding: 2px 4px; }
.or::before, .or::after { content: ""; flex: 1; height: .5px; background: var(--sep-strong); }

/* meters */
.meter { position: relative; height: 6px; border-radius: 99px; background: var(--fill); }
.meter > i { position: absolute; left: 0; top: 0; bottom: 0; max-width: 100%; border-radius: 99px; background: var(--accent); transition: width 400ms var(--ease-out); }
.meter > b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 2px; background: var(--text); opacity: .55; }
.meter-target.is-under > i { background: var(--warn); }

/* ---------- Today ---------- */
.status-top { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wpill { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 12px; border-radius: 999px; background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; }
.wpill .num { color: var(--text); }
.wpill.is-live { background: var(--accent); color: #FFF; }
.wpill.is-live .num { color: #FFF; }
.wpill.is-live .dot { width: 7px; height: 7px; background: #FFF; animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.status-title { font-size: 28px; font-weight: 700; letter-spacing: -.025em; line-height: 1.12; }
.status-title.is-stop { color: var(--loss-text); }
.status-title.is-live { color: var(--accent-text); }
.status-sub { margin-top: 6px; font-size: 15px; color: var(--text-2); max-width: 46ch; }
.limits { display: grid; gap: 14px; margin-top: 20px; }
@media (min-width: 560px) { .limits { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; } }
.limit-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.limit-label { font-size: 13.5px; color: var(--text-2); }
.limit-val { font-size: 15px; font-weight: 600; white-space: nowrap; }
.limit-val .of { color: var(--text-3); font-size: 12.5px; font-weight: 500; }
.limit .meter > i { background: var(--text-3); }
.limit.is-near .meter > i, .limit.is-full .meter > i { background: var(--warn); }
.limit.is-hit .meter > i { background: var(--loss); }
.limit.is-hit .limit-val { color: var(--loss-text); }
.focus { margin-top: 20px; padding: 14px 16px; border-radius: var(--r-row); background: var(--brand); color: var(--cream); }
.focus .label { color: rgba(246, 241, 231, .7); font-size: 12.5px; }
.focus p { margin-top: 3px; font-size: 15px; font-weight: 500; line-height: 1.4; }

.calc-res { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-top: 18px; padding-bottom: 14px; box-shadow: 0 .5px 0 var(--sep-strong); }
.calc-side { display: grid; justify-items: end; gap: 1px; text-align: right; }
.calc-side .num { font-size: 17px; font-weight: 600; }
.rows { display: grid; }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 11px 0; box-shadow: 0 .5px 0 var(--sep); font-size: 14.5px; }
.row:last-child { box-shadow: none; }
.row > span:first-child { color: var(--text-2); }
.row > .num { font-weight: 600; }
.pre-note { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--loss-tint); color: var(--loss-text); font-size: 14px; font-weight: 500; }
.pre-note.is-soft { background: var(--warn-tint); color: var(--warn); }
.orows { display: grid; gap: 8px; }
.orow { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 14px; border-radius: var(--r-row); background: var(--fill-2); }
.orow-hit { position: absolute; inset: 0; border: 0; background: none; border-radius: inherit; cursor: pointer; }
.orow-main { position: relative; pointer-events: none; min-width: 0; }
.orow .btn { position: relative; z-index: 1; }
.orow strong { font-weight: 700; font-size: 16px; }
.orow small { display: block; font-size: 13px; color: var(--text-2); }

/* ---------- Journal ---------- */
.jview-toggle { margin-bottom: 14px; }
.journal { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.journal[data-view="list"] .j-cal { display: none; }
.journal[data-view="calendar"] .j-list { display: none; }
@media (min-width: 1180px) {
  .jview-toggle { display: none; }
  .journal { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: 18px; align-items: start; }
  .journal .j-cal, .journal .j-list { display: block !important; }
  .j-cal { position: sticky; top: 24px; }
  .cal-daylist { display: none; }
}
.day-filter { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 12px; font-size: 14px; font-weight: 600; }
.tlist { display: grid; gap: 18px; }
.dgroup-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0 4px 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.dgroup-rows { display: grid; gap: 8px; }
.trow {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
  padding: 13px 14px; border-radius: var(--r-row); background: var(--fill-2);
  transition: transform 120ms var(--ease-out), background-color 150ms ease;
}
.trow:has(.trow-hit:active) { transform: scale(.985); }
.trow-hit { position: absolute; inset: 0; z-index: 1; border: 0; border-radius: inherit; background: none; cursor: pointer; }
.trow > :not(.trow-hit) { position: relative; pointer-events: none; }
.trow > .trow-close { pointer-events: auto; z-index: 2; justify-self: end; }
.trow-main { display: flex; flex-direction: column; min-width: 0; }
.trow-ticker { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; letter-spacing: 0; }
.trow-meta { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-res { display: flex; flex-direction: column; align-items: flex-end; text-align: right; }
.trow-r { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.trow-usd { font-size: 12.5px; color: var(--text-2); }
.trow-status { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; color: var(--text-2); }
.trow-status span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow-status:last-child { grid-column: 1 / -1; }
@media (hover: hover) and (pointer: fine) { .trow:hover, .orow:hover { background: var(--fill); } }
.empty-line { padding: 18px 4px; color: var(--text-2); font-size: 14px; }

.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.cal-title { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.cal-grid { display: grid; gap: 6px; grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr)); }
.cal-wd { padding-bottom: 2px; text-align: center; font-size: 12px; font-weight: 600; color: var(--text-3); }
.cday {
  appearance: none; border: 0; position: relative; min-height: 58px; padding: 7px 7px 6px; border-radius: 12px;
  display: flex; flex-direction: column; justify-content: space-between; text-align: left;
  background: var(--fill-2); color: var(--text-2); cursor: pointer;
  transition: transform 120ms var(--ease-out), background-color 150ms ease, box-shadow 150ms ease;
}
button.cday { background: var(--fill); }
button.cday:active { transform: scale(.96); }
.cday.is-empty { background: transparent; box-shadow: inset 0 0 0 .5px var(--sep-strong); cursor: default; }
.cday.is-future { opacity: .4; }
.cday.is-pad { visibility: hidden; }
.cday-n { font-size: 12px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cday .dot { position: absolute; top: 8px; right: 8px; width: 6px; height: 6px; }
.cday-r { align-self: flex-end; font-size: 12.5px; font-weight: 700; letter-spacing: -.02em; }
.cday-r.na { font-size: 11.5px; font-weight: 500; letter-spacing: 0; }
.cday.is-today .cday-n { display: inline-grid; place-items: center; width: 20px; height: 20px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--loss); color: #FFF; }
.cday.is-sel { box-shadow: inset 0 0 0 2px var(--text); }
@media (hover: hover) and (pointer: fine) { button.cday:not(.is-sel):hover { background: var(--sep-strong); } }
.cal-legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-sum { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.cal-sum > div { padding: 10px 12px; border-radius: 12px; background: var(--fill-2); }
.cal-sum strong { display: block; margin-top: 2px; font-size: 17px; font-weight: 700; }
.cal-daylist { margin-top: 18px; }

/* ---------- Insights ---------- */
.coach { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.coach li { display: grid; grid-template-columns: 4px minmax(0, 1fr); gap: 12px; padding: 12px 14px 12px 12px; border-radius: var(--r-row); background: var(--fill-2); }
.coach-mark { display: block; border-radius: 4px; background: var(--text-3); }
.coach strong { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; }
.coach p { margin-top: 2px; font-size: 14.5px; color: var(--text-2); line-height: 1.45; }
.coach .tone-bad .coach-mark { background: var(--warn); }
.coach .tone-warn .coach-mark { background: var(--warn); opacity: .45; }
.coach .tone-good .coach-mark { background: var(--gain); }
.coach .tone-info .coach-mark { background: var(--text-3); }

.hero-num { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.hero-num > .num:last-child { font-size: 17px; font-weight: 600; }
.hero-num .muted { font-weight: 500; }
.chart { position: relative; margin-top: 18px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.chart-plot { position: relative; height: 170px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .zero { stroke: var(--sep-strong); }
.chart.up .curve { stroke: var(--gain); }
.chart.down .curve { stroke: var(--loss); }
.chart.up .fill-stop { stop-color: var(--gain); }
.chart.down .fill-stop { stop-color: var(--loss); }
@media (min-width: 1180px) { .chart-plot { height: 210px; } }
.chart-x { position: absolute; top: 0; bottom: 0; width: 1px; margin-left: -.5px; background: var(--sep-strong); opacity: 0; pointer-events: none; }
.chart-dot { position: absolute; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--text); box-shadow: 0 0 0 3px var(--card); opacity: 0; pointer-events: none; }
.chart-tip { position: absolute; top: 0; transform: translate(-50%, 16px); padding: 6px 10px; border-radius: 10px; background: var(--card-2); box-shadow: var(--shadow-float); font-size: 12.5px; font-weight: 600; white-space: nowrap; opacity: 0; pointer-events: none; }
.chart.is-scrub .chart-x, .chart.is-scrub .chart-dot, .chart.is-scrub .chart-tip { opacity: 1; }
.chart-legend { display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.chart-legend strong { color: var(--text); font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
@media (min-width: 560px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 12px; }
.stat { padding: 11px 12px; border-radius: 12px; background: var(--fill-2); min-width: 0; }
.stat .label { font-size: 12px; }
.stat strong { display: block; margin-top: 3px; font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ch { display: flex; align-items: center; gap: 18px; }
.ring-wrap { position: relative; width: 100px; height: 100px; flex: none; }
.ring { width: 100%; height: 100%; display: block; }
.ring-track { fill: none; stroke: var(--fill); stroke-width: 7; }
.ring-fill { fill: none; stroke: var(--accent); stroke-width: 7; stroke-linecap: round; transition: stroke-dashoffset 600ms var(--ease-out); }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label .num { font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ring-label small { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.ch-side { flex: 1; min-width: 0; display: grid; gap: 6px; }
.ch-side .card-fine { margin-top: 2px; }
.sizeup { margin-top: 18px; padding: 16px; border-radius: 16px; background: var(--fill-2); }
.sizeup.is-allowed { background: var(--brand); color: var(--cream); }
.sizeup.is-allowed .label, .sizeup.is-allowed .card-fine, .sizeup.is-allowed .conds li { color: rgba(246, 241, 231, .78); }
.sizeup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.sizeup-ans { font-size: 24px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; }
.conds { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.conds li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.conds li.ok { color: var(--text); }
.cond-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--text-3); }
.conds li.ok .cond-ic { background: var(--gain-tint); color: var(--accent-text); }
.cond-v { font-size: 13px; font-weight: 600; white-space: nowrap; }

.week-nav { display: flex; align-items: center; gap: 12px; }
.week-label { flex: 1; min-width: 0; text-align: center; line-height: 1.3; }
.week-label strong { display: block; font-size: 15px; font-weight: 700; }
.week-label small { font-size: 12.5px; color: var(--text-2); }
.rv { padding-top: 14px; margin-top: 14px; box-shadow: 0 -.5px 0 var(--sep-strong); }
.rv h3 { margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.rv ul { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14.5px; }
.rv li::marker { color: var(--text-3); }
.change { margin-top: 14px; padding: 14px 16px; border-radius: var(--r-row); background: var(--brand); color: var(--cream); }
.change .label { color: rgba(246, 241, 231, .7); font-size: 12.5px; }
.change p { margin-top: 3px; font-size: 15px; font-weight: 500; line-height: 1.4; }
.checkin { margin-top: 18px; }
.rv-more { margin-top: 14px; }
.rv-more > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; color: var(--accent-text); font-size: 14px; font-weight: 600; }
.rv-more > summary::-webkit-details-marker { display: none; }
.rv-more > summary span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-more > summary svg { flex: none; transform: rotate(-90deg); transition: transform 200ms var(--ease-out); }
.rv-more[open] > summary svg { transform: none; }

/* ---------- Settings ---------- */
.howto { margin: 14px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.howto li { padding: 12px 14px; border-radius: 12px; background: var(--fill-2); font-size: 14px; color: var(--text-2); }
.howto strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 2px; }
.about { display: flex; align-items: center; gap: 14px; }
.about img { width: 52px; height: 52px; border-radius: 12px; }
.about strong { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.about span { font-size: 13.5px; color: var(--text-2); }
.legal { margin-top: 14px; padding: 12px 14px; border-radius: 12px; background: var(--fill-2); font-size: 13px; color: var(--text-2); }

.empty { padding: 26px 22px; }
.empty-title { font-size: 24px; font-weight: 700; letter-spacing: -.022em; }

/* ---------- sheet ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 50; background: var(--scrim);
  opacity: 0; visibility: hidden;
  transition: opacity 220ms var(--ease-out), visibility 0s linear 220ms;
}
.scrim.open { opacity: 1; visibility: visible; transition: opacity 280ms var(--ease-out), visibility 0s; }
.sheet {
  position: fixed; z-index: 51; left: 0; right: 0; bottom: 0;
  max-height: calc(100vh - 12px); max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
  display: flex; flex-direction: column; outline: none;
  background: var(--card-2); border-radius: 26px 26px 0 0; box-shadow: var(--shadow-float);
  transform: translate3d(0, 100%, 0); visibility: hidden;
  transition: transform 220ms var(--ease-out), visibility 0s linear 220ms;
  container-type: inline-size;
}
.sheet.open { transform: translate3d(0, 0, 0); visibility: visible; transition: transform 300ms var(--ease-drawer), visibility 0s; }
.sheet.dragging { transition: none !important; cursor: grabbing; user-select: none; -webkit-user-select: none; }
@media (min-width: 960px) {
  .sheet { left: auto; top: 10px; bottom: 10px; right: 10px; width: min(540px, calc(100vw - 20px)); max-height: none; border-radius: 26px; transform: translate3d(calc(100% + 20px), 0, 0); }
  .sheet.open { transform: translate3d(0, 0, 0); }
  .sheet-handle { visibility: hidden; height: 0 !important; margin: 0 !important; }
}
.sheet-grab { flex: none; padding: 8px 20px 0; touch-action: none; cursor: grab; }
.sheet-handle { width: 36px; height: 5px; margin: 0 auto 10px; border-radius: 99px; background: var(--sep-strong); }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.sheet-title { font-size: 26px; font-weight: 700; line-height: 1.12; letter-spacing: -.025em; }
.sheet-sub { margin-top: 3px; font-size: 13.5px; color: var(--text-2); }
.sheet-sub .link-btn { font-size: 13px; }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 0 20px 22px; }
.sheet-foot { flex: none; display: grid; gap: 10px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom)); background: var(--card-2); box-shadow: 0 -.5px 0 var(--sep-strong); border-radius: 0 0 inherit inherit; }
.foot-row { display: flex; gap: 8px; }
.foot-row .btn { flex: 1; }
@media (min-width: 960px) { .sheet-grab { padding: 24px 24px 0; } .sheet-body { padding-left: 24px; padding-right: 24px; } .sheet-foot { padding: 16px 24px 20px; border-radius: 0 0 26px 26px; } }

.form { display: grid; }
.fsec { display: grid; gap: 16px; padding: 18px 0; box-shadow: 0 -.5px 0 var(--sep); }
.live + .fsec, .live + div + .fsec { box-shadow: none; }
.live { position: sticky; top: 0; z-index: 3; margin: 0 -20px; padding: 2px 20px 12px; background: var(--card-2); box-shadow: 0 .5px 0 var(--sep); }
@media (min-width: 960px) { .live { margin: 0 -24px; padding-left: 24px; padding-right: 24px; } }
.live-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.live-cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--fill-2); }
.live-cell .label { font-size: 12px; }
.live-cell strong { font-size: 17px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.live-flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.live-hint { font-size: 13px; color: var(--text-3); }
.live-note { margin-top: 8px; font-size: 13px; color: var(--text-2); }
.fgrid-4 { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@container (min-width: 470px) { .fgrid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.more { border-radius: 16px; background: var(--fill-2); margin-top: 4px; }
.more > summary { list-style: none; display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 0 16px; cursor: pointer; border-radius: 16px; }
.more > summary::-webkit-details-marker { display: none; }
.more-title { font-size: 15px; font-weight: 600; }
.more-sub { margin-right: auto; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.more > summary svg { flex: none; color: var(--text-3); transition: transform 200ms var(--ease-out); }
.more[open] > summary svg { transform: rotate(180deg); }
.more-body { display: grid; gap: 16px; padding: 4px 16px 18px; }
.more-body h3 { font-size: 13px; font-weight: 700; margin-bottom: -6px; padding-top: 4px; }
.more input[type=text], .more input[type=date], .more input[type=time], .more input[type=url], .more select, .more textarea { background: var(--fill); }
.more input:focus, .more textarea:focus { background: var(--card); }

.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.facts > div { padding: 10px 12px; border-radius: 12px; background: var(--fill-2); min-width: 0; }
.facts .label { font-size: 12px; }
.facts .num { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dt-top { display: grid; gap: 14px; padding-bottom: 18px; }
.dt-res { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 14px; }
.dt-usd { font-size: 15px; font-weight: 600; color: var(--text-2); }
.kvgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5px; overflow: hidden; border-radius: 16px; background: var(--sep); }
@container (min-width: 470px) { .kvgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kvgrid > div { padding: 11px 14px; background: var(--card-2); min-width: 0; }
.kv-l { display: block; font-size: 12px; color: var(--text-2); }
.kv-v { display: block; margin-top: 1px; font-size: 14.5px; font-weight: 600; overflow-wrap: anywhere; }
.dt-sec { padding-top: 14px; margin-top: 14px; box-shadow: 0 -.5px 0 var(--sep); }
.dt-sec h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.dt-sec p { font-size: 14.5px; overflow-wrap: anywhere; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 70; left: 50%; bottom: calc(var(--tabbar-h) + 22px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 32px); min-height: 44px; padding: 6px 8px 6px 16px;
  border-radius: 16px; background: var(--card-2); box-shadow: var(--shadow-float);
  font-size: 14px; font-weight: 500; opacity: 0; transform: translate(-50%, 8px); pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; transition-duration: 220ms; }
.toast > span { padding: 6px 8px 6px 0; }
.toast-btn { appearance: none; border: 0; cursor: pointer; min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--accent-tint); color: var(--accent-text); font-weight: 600; font-size: 14px; }
.toast-btn:active { transform: scale(.96); }
html.sheet-open .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .toast { bottom: 28px; left: calc(50% + 126px); } html.sheet-open .toast { left: 50%; bottom: 28px; } }

/* ---------- accessibility preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet, .sheet.open { transform: none; opacity: 0; transition: opacity 200ms ease, visibility 0s linear 200ms; }
  .sheet.open { opacity: 1; transition: opacity 200ms ease, visibility 0s; }
  .btn:active, .icon-btn:active, .add-btn:active, .seg label:active span, .pills label:active span,
  .check:active, button.cday:active, .tab:active .tab-ic, .toast-btn:active { transform: none; opacity: .8; }
  .trow:has(.trow-hit:active) { transform: none; }
  .toast, .toast.show { transform: translate(-50%, 0); }
  .wpill.is-live .dot { animation: none; }
  .more > summary svg, .check-box::after, .switch::after, .meter > i, .ring-fill { transition: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar, .tabbar, .sidebar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --sep: rgba(40, 44, 40, .3); --sep-strong: rgba(40, 44, 40, .45); --text-2: #3E423F; --text-3: #5C615D; }
  .card, .trow, .check { box-shadow: inset 0 0 0 1px var(--sep-strong); }
  .topbar, .tabbar { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- 2.2: appearance toggle, market card, live charts ---------- */
.top-right { display: flex; align-items: center; gap: 10px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-top .brand { min-width: 0; }
.theme-btn { width: 40px; height: 40px; background: var(--fill); color: var(--text); }
.o5 { order: 5; }
.fgrid-calc { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .fgrid-calc { grid-template-columns: 1.15fr repeat(3, minmax(0, 1fr)); } }

.mkt-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mkt { position: relative; height: 132px; border-radius: var(--r-row); background: var(--fill-2); overflow: hidden; min-width: 0; }
.mkt-hit { position: absolute; inset: 0; z-index: 2; width: 100%; border: 0; border-radius: inherit; background: transparent; cursor: pointer; transition: background-color 150ms ease, transform 120ms var(--ease-out); }
.mkt-hit:active { background: var(--fill); }
.mkt:has(.mkt-hit:active) { transform: scale(.98); }
.mkt { transition: transform 120ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .mkt-hit:hover { background: var(--fill-2); } }

.tv-slot { position: relative; width: 100%; min-width: 0; overflow: hidden; }
.tv-mini { height: 100%; }
.tv-big { height: 360px; border-radius: var(--r-row); background: var(--fill-2); }
@media (min-width: 720px) { .tv-big { height: 440px; } }
.chart-sheet .tv-big { height: min(62vh, 560px); }
.tv-slot .tradingview-widget-container, .tv-slot .tradingview-widget-container__widget { width: 100%; height: 100%; }
.tv-slot iframe { display: block; border: 0; color-scheme: light; } /* matches the widget page, so the dark theme does not paint the frame white */
.tv-off { display: grid; place-items: center; height: 100%; min-height: 100px; padding: 16px; text-align: center; font-size: 13.5px; line-height: 1.4; color: var(--text-2); }
.tv-block { display: grid; gap: 10px; min-width: 0; }
.tv-note { font-size: 12px; color: var(--text-3); }
.seg-tf span { min-height: 34px; font-size: 13.5px; }
.chart-more { margin-top: 14px; }
.chart-more .more-body { padding-top: 0; }
.fsec .chart-more { margin-top: 0; }
.dt-sec .tv-block { margin-top: 6px; }

/* phones: 44px touch targets */
@media (pointer: coarse) {
  .icon-btn, .theme-btn { width: 44px; height: 44px; }
  .seg span { min-height: 40px; }
  .seg-tf span { min-height: 40px; }
  .btn-sm { min-height: 40px; }
  .pills span { min-height: 40px; }
  .frow-in input { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { .mkt, .mkt:has(.mkt-hit:active) { transform: none; } }
.side-top .side-brand .brand-sub { white-space: normal; }
.side-top .theme-btn { flex: none; }
