/* Tiltrav — styles */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #e2e5ea;
  --text: #0f172a;
  --muted: #667085;
  --accent: #2f5bea;
  --accent-ink: #ffffff;
  --pos: #0b8a5c;
  --pos-bg: #e5f6ee;
  --neg: #d0353f;
  --neg-bg: #fdecee;
  --warn: #a96300;
  --warn-bg: #fff3da;
  --info-bg: #ecf0ff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --radius: 16px;
  --nav-h: 64px;
  /* market colours */
  --m-OPT: #3f6df6;
  --m-EQ_INTRA: #8b5cf6;
  --m-EQ_SWING: #0e9f8e;
  --m-COMMODITY: #c98a0c;
  --m-CRYPTO: #ef7d17;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f15; --surface: #111821; --surface-2: #18212c; --border: #222d3a; --text: #e7edf4; --muted: #8a97a8;
    --accent: #6f90ff; --accent-ink: #0a0f15; --pos: #34c58b; --pos-bg: rgba(52, 197, 139, .13); --neg: #f2697a;
    --neg-bg: rgba(242, 105, 122, .13); --warn: #f0b343; --warn-bg: rgba(240, 179, 67, .13); --info-bg: rgba(111, 144, 255, .13);
    --shadow: none; --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
    --m-OPT: #6f90ff; --m-EQ_INTRA: #a78bfa; --m-EQ_SWING: #2dd4bf; --m-COMMODITY: #e6b23a; --m-CRYPTO: #fb9a3c;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f15; --surface: #111821; --surface-2: #18212c; --border: #222d3a; --text: #e7edf4; --muted: #8a97a8;
  --accent: #6f90ff; --accent-ink: #0a0f15; --pos: #34c58b; --pos-bg: rgba(52, 197, 139, .13); --neg: #f2697a;
  --neg-bg: rgba(242, 105, 122, .13); --warn: #f0b343; --warn-bg: rgba(240, 179, 67, .13); --info-bg: rgba(111, 144, 255, .13);
  --shadow: none; --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  --m-OPT: #6f90ff; --m-EQ_INTRA: #a78bfa; --m-EQ_SWING: #2dd4bf; --m-COMMODITY: #e6b23a; --m-CRYPTO: #fb9a3c;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 15px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--neg); min-height: 1em; margin: 0; }
.link { color: var(--accent); font-weight: 600; }

/* ---------- market badges ---------- */
.mbadge {
  --c: var(--accent);
  flex: none; display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 15%, transparent);
  color: var(--c); font-weight: 800; font-size: 15px; line-height: 1;
}
.mbadge.xs { width: 20px; height: 20px; border-radius: 6px; font-size: 11px; }
.mbadge.lg { width: 44px; height: 44px; border-radius: 13px; font-size: 19px; }
.m-OPT { --c: var(--m-OPT); }
.m-EQ_INTRA { --c: var(--m-EQ_INTRA); }
.m-EQ_SWING { --c: var(--m-EQ_SWING); }
.m-COMMODITY { --c: var(--m-COMMODITY); }
.m-CRYPTO { --c: var(--m-CRYPTO); }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.main { padding-bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); }
.top {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  -webkit-backdrop-filter: saturate(1.5) blur(14px);
}
.top h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-left { display: flex; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.view { padding: 4px 16px 16px; max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; justify-content: space-around;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
}
.nav .brand, .nav .nav-add { display: none; }
.nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted);
}
.nav a.active { color: var(--accent); }
.nav svg, .icon-btn svg, .fab svg, .btn svg, .stepper svg, .nav-add svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.btn svg { width: 18px; height: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 17px; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #9b5cf6));
  color: #fff; font-weight: 800;
}
.brand.big { font-size: 22px; justify-content: center; }
.brand.big .brand-mark { width: 46px; height: 46px; border-radius: 13px; font-size: 23px; }

.fab {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); z-index: 25;
  width: 58px; height: 58px; border-radius: 19px; border: 0;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent);
  transition: transform .12s;
}
.fab:active { transform: scale(.94); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }
body[data-route="trade"] .fab, body[data-route="settings"] .fab, body[data-route="journal"] .fab { display: none; }

@media (max-width: 899px) {
  body[data-route="trade"] .nav { display: none; }
  body[data-route="trade"] .main { padding-bottom: 24px; }
}

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; width: 228px; height: auto; flex-direction: column; justify-content: flex-start; gap: 2px;
    padding: 20px 12px; border-top: 0; border-right: 1px solid var(--border); background: var(--surface);
  }
  .nav .brand { display: flex; padding: 0 10px 20px; }
  .nav a { flex: 0; flex-direction: row; justify-content: flex-start; gap: 12px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; }
  .nav a:hover { background: var(--surface-2); }
  .nav a.active { background: var(--info-bg); }
  .nav .nav-add {
    display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 11px 14px; border: 0; border-radius: 12px;
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
  }
  .main { margin-left: 228px; padding-bottom: 40px; }
  .top { padding: 18px 28px 12px; }
  .view { padding: 4px 28px 28px; }
  .fab { display: none; }
}

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); font-weight: 650; white-space: nowrap;
  transition: background .12s, transform .08s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.primary.danger { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--neg); }
.btn.armed { background: var(--neg); border-color: var(--neg); color: #fff; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.tiny { min-height: 28px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; margin-top: 4px; background: var(--surface-2); border-color: transparent; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
  border: 0; background: transparent; color: var(--text);
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn.small { width: 32px; height: 32px; color: var(--muted); }
.icon-btn.small svg { width: 16px; height: 16px; }
.icon-btn.armed { color: var(--neg); width: auto; padding: 0 8px; font-size: 13px; font-weight: 600; }

input, select, textarea {
  width: 100%; min-height: 46px; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
  font-size: 16px; /* no iOS zoom */
  outline: none; transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
label, .field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); min-width: 0; }
label > input, label > select, label > textarea, label .input-suffix { color: var(--text); font-weight: 450; }
.hint { font-weight: 450; font-size: 12px; }
.input-suffix { position: relative; display: block; }
.input-suffix i { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); }
.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.grid-form .wide { grid-column: 1 / -1; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.row-2 > [hidden] + *, .row-2 > *:only-child { grid-column: 1 / -1; }
@media (max-width: 520px) { .row-3 { grid-template-columns: 1fr 1fr; } .row-3 > :last-child { grid-column: 1 / -1; } }
@media (min-width: 700px) { .row-2.prices { grid-template-columns: repeat(4, 1fr); } }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border-radius: 12px; flex: none; }
.seg-full { display: flex; }
.seg-full .seg-btn { flex: 1; }
.seg-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 13px; border: 0; border-radius: 9px; background: transparent;
  font-size: 13.5px; font-weight: 650; color: var(--muted); white-space: nowrap;
}
.seg-btn input { position: absolute; opacity: 0; pointer-events: none; }
.seg-btn.on, .seg-btn:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.seg-btn:has(input:focus-visible) { outline: 2px solid var(--accent); }
.seg-btn.solo { background: var(--surface-2); border-radius: 12px; min-height: 44px; flex: none; }
.seg-btn.solo.on.bad { color: var(--neg); background: var(--neg-bg); box-shadow: none; }

/* market chips */
.mchips { display: flex; gap: 8px; }
.mchip {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  min-height: 38px; padding: 0 12px 0 9px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font-size: 13.5px; font-weight: 650; color: var(--muted);
}
.mchip:first-child:not(:has(.mbadge)) { padding-left: 14px; }
.mchip em { font-style: normal; font-size: 11.5px; color: var(--muted); background: var(--surface-2); border-radius: 99px; padding: 1px 7px; }
.mchip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.mchip.on em { background: color-mix(in srgb, var(--bg) 20%, transparent); color: var(--bg); }
.mchip.on .mbadge { background: color-mix(in srgb, var(--c) 30%, var(--bg)); }

/* trade form: market picker */
.market-pick { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.mtile {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 12px 4px 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface);
  color: var(--muted); font-size: 12px; font-weight: 650; text-align: center; line-height: 1.2; cursor: pointer;
  transition: border-color .12s, background .12s, transform .08s;
}
.mtile:active { transform: scale(.97); }
.mtile input { position: absolute; opacity: 0; pointer-events: none; }
.mtile:has(input:checked) { color: var(--text); border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 8%, var(--surface)); }
.mtile:has(.m-OPT) { --c: var(--m-OPT); }
.mtile:has(.m-EQ_INTRA) { --c: var(--m-EQ_INTRA); }
.mtile:has(.m-EQ_SWING) { --c: var(--m-EQ_SWING); }
.mtile:has(.m-COMMODITY) { --c: var(--m-COMMODITY); }
.mtile:has(.m-CRYPTO) { --c: var(--m-CRYPTO); }
.mtile:has(input:focus-visible) { outline: 2px solid var(--accent); }
@media (max-width: 520px) { .mtile { font-size: 11px; padding: 10px 2px 8px; } .mtile .mbadge { width: 30px; height: 30px; } }

/* symbol quick picks */
.sym-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.sym {
  min-height: 36px; padding: 0 13px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 650; font-size: 13.5px; color: var(--text);
}
.sym.on { background: var(--text); color: var(--bg); border-color: var(--text); }

#sym-input { min-height: 40px; font-size: 15px; background: var(--surface-2); border-color: transparent; }
#sym-input:focus { background: var(--surface); border-color: var(--accent); }

/* stock watchlist */
.lbl-row { display: flex; align-items: baseline; justify-content: space-between; }
.lbl-row .link { background: none; border: 0; padding: 0; }
.sym.add { display: inline-flex; align-items: center; gap: 4px; border-style: dashed; color: var(--accent); background: transparent; }
.sym.add svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.sym.removable { display: inline-flex; align-items: center; gap: 6px; }
.sym.removable span { font-size: 16px; line-height: 1; color: var(--muted); }
.sym.removable:hover { border-color: var(--neg); color: var(--neg); }
.sym.removable:hover span { color: var(--neg); }
.sym-add { display: inline-flex; align-items: center; gap: 6px; flex: 1 1 220px; max-width: 360px; }
.sym-add input { min-height: 36px; padding: 6px 11px; font-size: 15px; text-transform: uppercase; }
.sym-add input::placeholder { text-transform: none; }
.sym-add .btn { min-height: 36px; padding: 0 14px; }
.chip-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* side */
.side-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.side {
  position: relative; display: flex; align-items: center; justify-content: center; min-height: 50px;
  border-radius: 13px; border: 1.5px solid var(--border); background: var(--surface);
  font-size: 15px; font-weight: 750; color: var(--muted); cursor: pointer; transition: all .12s;
}
.side input { position: absolute; opacity: 0; pointer-events: none; }
.side.buy:has(input:checked) { background: var(--pos); border-color: var(--pos); color: #fff; }
.side.sell:has(input:checked) { background: var(--neg); border-color: var(--neg); color: #fff; }
.side:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-pick:has(.side.sell[hidden]) { grid-template-columns: 1fr; }

/* lots stepper */
.stepper { display: grid; grid-template-columns: 46px 1fr 46px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); }
.stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.stepper button { border: 0; background: var(--surface-2); color: var(--text); display: grid; place-items: center; }
.stepper button:active { background: var(--border); }
.stepper svg { width: 18px; height: 18px; stroke-width: 2.4; }
.stepper input { border: 0; border-radius: 0; text-align: center; font-weight: 700; font-size: 18px; box-shadow: none !important; min-height: 44px; }

.chip-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { position: relative; flex-direction: row; }
.pick input { position: absolute; opacity: 0; }
.pick span {
  display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text); cursor: pointer; background: var(--surface);
}
.pick input:checked + span { background: var(--neg-bg); border-color: var(--neg); color: var(--neg); }
.pick input:focus-visible + span { outline: 2px solid var(--accent); }

/* sticky save bar */
.savebar {
  position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 15;
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
.savebar-info { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.savebar .btn { min-width: 140px; }
@media (min-width: 900px) { .savebar { bottom: 16px; } }

/* ---------- cards & kpis ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-sub { margin: -6px 0 8px; }
details.card > summary { cursor: pointer; list-style: none; margin: 0; }
details.card > summary::after { content: '›'; color: var(--muted); font-size: 22px; line-height: 1; transform: rotate(90deg); transition: transform .15s; }
details.card[open] > summary { margin-bottom: 12px; }
details.card[open] > summary::after { transform: rotate(-90deg); }
details.card > summary::-webkit-details-marker { display: none; }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 13px 14px; min-width: 0; box-shadow: var(--shadow);
}
.kpis.flat .kpi { border: 0; box-shadow: none; background: var(--surface-2); border-radius: 12px; }
.kpi-label { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 23px; font-weight: 750; margin-top: 3px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-value.pair { font-size: 17px; line-height: 1.35; white-space: normal; padding-top: 4px; }
.kpi-of { font-size: 15px; font-weight: 600; color: var(--muted); }
.kpi-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
@media (min-width: 700px) {
  .kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpis-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.preview .kpi-value { font-size: 18px; }

.bar { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--pos); border-radius: 99px; transition: width .3s; }
.bar.bar-warn span { background: var(--warn); }
.bar.bar-neg span { background: var(--neg); }

.banner { display: flex; gap: 12px; border-radius: var(--radius); padding: 15px 17px; border: 1px solid; }
.banner-title { font-weight: 800; font-size: 17px; margin-bottom: 3px; }
.banner.go { background: var(--pos-bg); border-color: color-mix(in srgb, var(--pos) 30%, transparent); }
.banner.go .banner-title { color: var(--pos); }
.banner.stop { background: var(--neg-bg); border-color: color-mix(in srgb, var(--neg) 45%, transparent); }
.banner.stop .banner-title { color: var(--neg); text-transform: uppercase; letter-spacing: .03em; }
.banner ul { margin: 4px 0 6px; padding-left: 18px; }
.date-line { font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: -6px; }

.check { padding: 9px 12px; border-radius: 10px; font-size: 13.5px; margin-top: 6px; }
.check.ok { background: var(--pos-bg); }
.check.bad { background: var(--neg-bg); }
.check.bad b:first-child { color: var(--neg); }
.check.warn { background: var(--warn-bg); }
.check.info { background: var(--info-bg); }
.check.big-check { font-size: 15px; padding: 12px 14px; }
.checks { margin-top: 6px; }
.calc-form { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); margin-top: 12px; }
.calc-out { margin-top: 10px; }
.calc-actions { display: flex; gap: 8px; margin-top: 12px; }

/* market cards (today) */
.market-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.market-card {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: var(--surface-2); border: 0; text-align: left; color: var(--text);
}
.market-card:hover { filter: brightness(.98); }
.mc-text { flex: 1; min-width: 0; }
.mc-label { font-weight: 700; }
.mc-sub { font-size: 12.5px; }
.mc-amt { font-weight: 800; font-size: 16px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list.card { padding: 0 14px; }
.trade-row {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: start;
  padding: 13px 0; border-top: 1px solid var(--border);
}
.list > .trade-row:first-child { border-top: 0; }
.trade-row:hover .tr-title { color: var(--accent); }
.tr-main { min-width: 0; }
.tr-title { font-weight: 700; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; }
.tr-sub { font-size: 13px; margin-top: 1px; }
.tr-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.amt { font-weight: 750; white-space: nowrap; }
.clean-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.clean-dot.ok { background: var(--pos); }
.clean-dot.no { background: var(--neg); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chips:empty { display: none; }
.chip {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: middle; line-height: 18px;
}
.chip.bad { background: var(--neg-bg); color: var(--neg); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.okc { background: var(--pos-bg); color: var(--pos); }
.chip.mistake { background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--neg) 40%, transparent); color: var(--neg); }
.chip.open { background: var(--info-bg); color: var(--accent); }
.chip.hold { background: color-mix(in srgb, var(--m-COMMODITY) 15%, transparent); color: var(--m-COMMODITY); }
.chip.short { background: var(--surface-2); color: var(--text); }
.mood { font-size: 20px; line-height: 34px; text-align: center; }
.mood i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.day-row { grid-template-columns: 34px 1fr auto; }
.note-preview { font-size: 13.5px; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.filters { display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; gap: 8px; align-items: center; }
.filter-row select { width: auto; flex: 0 0 auto; }
.filter-row input { flex: 1; min-width: 0; }
.scroll-x { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.scroll-x::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .scroll-x { margin: 0 -28px; padding: 2px 28px; } }
.summary-bar { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--muted); padding: 0 2px; }
.day-group { display: flex; flex-direction: column; gap: 6px; }
.day-head { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 2px; }
.day-head .day-net { margin-left: auto; font-weight: 750; }
.day-head a:hover { color: var(--accent); }
.day-mood { font-size: 15px; }

/* ---------- forms ---------- */
.tform { display: flex; flex-direction: column; gap: 12px; }
.form-card { display: flex; flex-direction: column; gap: 14px; }
.form-actions { display: flex; justify-content: space-between; gap: 10px; }
.form-actions .btn.primary { flex: 1; max-width: 320px; margin-left: auto; }
.form-extra { padding-top: 4px; border-top: 1px solid var(--border); justify-content: space-between; }
.adv summary { cursor: pointer; font-size: 13.5px; font-weight: 650; color: var(--muted); padding: 4px 0; }
.adv .row-2 { margin-top: 10px; }
.adv p { margin: 8px 0 0; }
.preview .card-head { margin-bottom: 10px; }

.journal-cta { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.journal-cta:hover { border-color: var(--accent); }
.jc-title { font-weight: 750; font-size: 16px; margin-bottom: 2px; }
.jc-moods { display: flex; gap: 4px; font-size: 22px; }
.moods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mood-btn { position: relative; }
.mood-btn input { position: absolute; opacity: 0; }
.mood-btn span {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 0; border-radius: 12px;
  border: 1.5px solid var(--border); font-size: 26px; cursor: pointer; background: var(--surface);
}
.mood-btn small { font-size: 12px; font-weight: 650; color: var(--muted); }
.mood-btn input:checked + span { border-color: var(--accent); background: var(--info-bg); }
.mood-btn input:focus-visible + span { outline: 2px solid var(--accent); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 6px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 9px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.tbl td .mbadge { vertical-align: -5px; margin-right: 4px; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; white-space: nowrap; }
.mini-bar { height: 4px; border-radius: 9px; background: var(--surface-2); margin-top: 6px; overflow: hidden; max-width: 170px; }
.mini-bar span { display: block; height: 100%; background: var(--muted); }
.mini-bar.pos span { background: var(--pos); }
.mini-bar.neg span { background: var(--neg); }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-2 > .card { min-width: 0; } }

.insight-card { background: linear-gradient(135deg, var(--info-bg), var(--surface) 60%); }
.insights { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }

/* ---------- charts ---------- */
.chart { position: relative; width: 100%; }
.chart-svg { display: block; touch-action: pan-y; }
.chart-empty { padding: 30px; text-align: center; color: var(--muted); }
.c-grid { stroke: var(--border); stroke-width: 1; }
.c-zero { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.c-axis { fill: var(--muted); font-size: 11px; }
.c-pos { fill: var(--pos); }
.c-neg { fill: var(--neg); }
.c-line { stroke-width: 2.2; stroke-linejoin: round; }
.c-line-pos { stroke: var(--pos); }
.c-line-neg { stroke: var(--neg); }
.c-area-pos { fill: var(--pos); opacity: .1; }
.c-area-neg { fill: var(--neg); opacity: .1; }
.c-dot { fill: var(--surface); stroke: var(--muted); stroke-width: 1.2; }
.c-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 2; }
.chart-tip {
  position: absolute; top: -8px; pointer-events: none; white-space: nowrap;
  background: var(--text); color: var(--bg); font-size: 12.5px; padding: 5px 9px; border-radius: 8px;
}
.chart-tip span { opacity: .75; font-size: 11.5px; }

/* ---------- gate (login) ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.gate-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.gate-card form { display: flex; flex-direction: column; gap: 10px; }
.pin-dots { display: flex; justify-content: center; gap: 18px; margin: 8px 0 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--muted); transition: background .1s, border-color .1s, transform .1s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; justify-items: center; }
.keypad button {
  width: 74px; height: 74px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); font-size: 27px; font-weight: 500; transition: background .08s, transform .08s;
}
.keypad button.kp-del { border-color: transparent; background: transparent; font-size: 22px; }
.keypad button:active { background: var(--surface-2); transform: scale(.94); }

/* ---------- misc ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty h3 { color: var(--text); margin-bottom: 6px; }
.empty p { margin: 0 0 16px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 0; color: var(--muted); }
.loading.boot { min-height: 100vh; }
.spinner { width: 20px; height: 20px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sync { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.sync-ok { background: var(--pos); }
.sync-busy { background: var(--warn); animation: pulse 1s infinite; }
.sync-err { background: var(--neg); }
@keyframes pulse { 50% { opacity: .3; } }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(var(--nav-h) + 90px + env(safe-area-inset-bottom));
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 14px; font-weight: 650; font-size: 14px;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow-lg);
  animation: toastIn .18s ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }
.toast.error { background: var(--neg); color: #fff; }
@media (min-width: 900px) { .toast { bottom: 28px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* =================== v3: tabs, quick log, journal, calendar =================== */

/* section tabs (Analyse, Settings) */
.tabbar {
  display: flex; gap: 6px; padding: 4px; margin: 0 -2px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  overflow-x: auto; scrollbar-width: none; position: sticky; top: calc(58px + env(safe-area-inset-top)); z-index: 12;
  box-shadow: var(--shadow);
}
.tabbar::-webkit-scrollbar { display: none; }
.tab {
  flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 42px; padding: 0 14px; border-radius: 12px; color: var(--muted); font-weight: 650; font-size: 14px; white-space: nowrap;
  transition: background .12s, color .12s;
}
.tab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.on { background: var(--text); color: var(--bg); }
@media (max-width: 520px) { .tab { flex-direction: column; gap: 2px; font-size: 11.5px; padding: 6px 10px; min-height: 52px; } }
@media (min-width: 900px) { .tabbar { top: 66px; } }
.afilters { display: flex; flex-direction: column; gap: 8px; }

/* quick log card */
.quick-log { display: flex; flex-direction: column; gap: 12px; }
.ql-main { display: flex; gap: 10px; flex-wrap: wrap; }
.btn.big { min-height: 52px; font-size: 16px; flex: 1 1 220px; border-radius: 14px; }
.btn.big svg { width: 20px; height: 20px; stroke-width: 2.4; }
.ql-main .btn.ghost { flex: 0 1 auto; }
.ql-picks { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qpick {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 11px 0 6px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); font-weight: 650; font-size: 13px; color: var(--text);
}
.qpick:hover { border-color: var(--accent); }
.calc-wrap { border-top: 1px solid var(--border); padding-top: 12px; }

/* journal editor */
.journal-card textarea { margin-top: 10px; }
.journal-card .moods { gap: 8px; }
.jstatus { min-height: 1em; }
.tr-note { font-size: 13px; color: var(--muted); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-style: italic; }
.jbit { font-size: 13.5px; margin-top: 5px; line-height: 1.4; }
.jbit span { display: inline-block; min-width: 50px; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-right: 6px; }
.chip.emo { background: var(--info-bg); color: var(--accent); }
.chip.emo.bad-emo { background: var(--warn-bg); color: var(--warn); }

/* trade form v3 */
.market-pills { display: flex; gap: 8px; }
.mpill {
  position: relative; display: inline-flex; align-items: center; gap: 8px; flex: none;
  min-height: 44px; padding: 0 14px 0 9px; border-radius: 13px; border: 1.5px solid var(--border); background: var(--surface);
  font-weight: 650; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; transition: all .12s;
}
.mpill input { position: absolute; opacity: 0; pointer-events: none; }
.mpill:has(input:checked) { color: var(--text); border-color: var(--c); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.mpill:has(.m-OPT) { --c: var(--m-OPT); }
.mpill:has(.m-EQ_INTRA) { --c: var(--m-EQ_INTRA); }
.mpill:has(.m-EQ_SWING) { --c: var(--m-EQ_SWING); }
.mpill:has(.m-COMMODITY) { --c: var(--m-COMMODITY); }
.mpill:has(.m-CRYPTO) { --c: var(--m-CRYPTO); }
.mpill:has(input:focus-visible) { outline: 2px solid var(--accent); }
.form-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: -2px; }
.form-sec-head h2 { font-size: 16px; }
.date-chip { width: auto; min-height: 36px; padding: 4px 10px; font-size: 14px; border-radius: 10px; background: var(--surface-2); border-color: transparent; }
.hold-col { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.hold-col .seg { width: 100%; }
.side-pick .side { min-height: 46px; }
.prices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.prices > [hidden] { display: none !important; }
@media (max-width: 560px) { .prices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.exit-input input { border-style: dashed; }
.exit-input input:not(:placeholder-shown) { border-style: solid; }
.live { border-radius: 14px; background: var(--surface-2); padding: 12px; }
.live-empty { color: var(--muted); font-size: 13.5px; }
.live-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px 14px; }
.lstat { display: flex; flex-direction: column; min-width: 0; }
.lstat span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.lstat b { font-size: 18px; font-weight: 750; white-space: nowrap; }
.lstat small { font-size: 12px; color: var(--muted); }
.live-flags { margin-top: 6px; }
.live .check { margin-top: 8px; }
.emo-pick.good input:checked + span { background: var(--info-bg); border-color: var(--accent); color: var(--accent); }
.emo-pick.bad input:checked + span { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }

/* calendar */
.cal-head { display: grid; grid-template-columns: 40px 1fr auto 40px; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-title h2 { font-size: 18px; }
.cal-total { font-weight: 800; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, .8fr); gap: 5px; }
.cal-dow { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; text-align: center; padding-bottom: 2px; }
.cal-cell {
  min-height: 74px; border-radius: 10px; padding: 6px 7px; display: flex; flex-direction: column; gap: 1px;
  background: var(--surface); border: 1px solid var(--border); min-width: 0; overflow: hidden;
}
.cal-cell.empty { border: 0; background: transparent; }
.cal-cell.future { opacity: .45; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-cell:not(.empty):hover { border-color: var(--accent); }
.cal-d { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; justify-content: space-between; }
.cal-d i { font-style: normal; }
.cal-net { font-weight: 800; font-size: 14px; margin-top: auto; white-space: nowrap; }
.cal-n { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-week { display: flex; align-items: center; justify-content: flex-end; font-weight: 750; font-size: 13px; padding-right: 4px; }
.cal-foot { margin: 12px 0 0; }
@media (max-width: 560px) {
  .cal-grid { gap: 3px; grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .cal-dow:nth-child(8), .cal-week { display: none; }
  .cal-cell { min-height: 54px; padding: 4px; border-radius: 8px; }
  .cal-net { font-size: 11px; }
  .cal-n { display: none; }
  .cal-d i { display: none; }
}

/* journal review */
.jday { padding-bottom: 6px; }
.jday-head { display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: center; }
.jday-mood { font-size: 24px; text-align: center; }
.jday-mood i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.jday-date { font-weight: 750; }
.jday-net { font-weight: 800; font-size: 16px; }
.jday-note { margin: 12px 0 4px; padding: 10px 14px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 10px 10px 0; white-space: pre-wrap; font-size: 14px; }
.jday .list { margin-top: 6px; }
.day-nav { display: flex; justify-content: space-between; }
.day-nav .btn svg { width: 16px; height: 16px; }

/* settings */
.sform { display: flex; flex-direction: column; gap: 14px; }
.settings-bar .btn.ghost { min-width: 0; }
.settings-bar .savebar-info b { color: var(--warn); }
.ledger-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.ltype { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ltype-opt {
  position: relative; display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 13px; background: var(--surface); cursor: pointer; color: var(--text); transition: all .12s;
}
.ltype-opt input { position: absolute; opacity: 0; pointer-events: none; }
.ltype-opt:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.ltype-opt:has(input:focus-visible) { outline: 2px solid var(--accent); }
.ltype-opt.pos, .ltype-ic.pos { --c: var(--pos); }
.ltype-opt.neg, .ltype-ic.neg { --c: var(--neg); }
.ltype-opt.warn, .ltype-ic.warn { --c: var(--warn); }
.ltype-ic {
  flex: none; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-weight: 800; font-size: 16px;
}
.ltype-txt { display: flex; flex-direction: column; min-width: 0; }
.ltype-txt b { font-size: 14px; }
.ltype-txt small { font-size: 12px; color: var(--muted); font-weight: 450; line-height: 1.3; }
.ledger-fields { display: grid; grid-template-columns: 1.1fr 1fr 1.6fr auto; gap: 12px; align-items: end; }
.ledger-fields .btn { min-width: 110px; min-height: 46px; }
.rupee-input { position: relative; display: block; }
.rupee-input i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-weight: 650; }
.rupee-input input { padding-left: 30px; font-weight: 700; font-size: 17px; }
@media (max-width: 700px) {
  .ltype { grid-template-columns: 1fr; }
  .ltype-opt { padding: 9px 12px; }
  .ledger-fields { grid-template-columns: 1fr 1fr; }
  .ledger-fields .amt-field, .ledger-fields label:nth-child(3), .ledger-fields .btn { grid-column: 1 / -1; }
}
.ledger-row { display: grid; grid-template-columns: 32px 1fr auto 32px; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--border); }
.list > .ledger-row:first-child { border-top: 0; padding-top: 2px; }
.lr-main { min-width: 0; }
.lr-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lr-amt { font-weight: 750; white-space: nowrap; }
.small-empty { padding: 16px; }
.map-rows { display: flex; flex-direction: column; gap: 8px; }
.map-row { display: grid; grid-template-columns: 1fr 1fr 32px; gap: 8px; align-items: center; }
.map-row input { min-height: 40px; padding: 8px 11px; font-size: 15px; }
.map-row input:first-child { font-weight: 650; text-transform: uppercase; }
.add-row { margin-top: 8px; min-height: 38px; color: var(--accent); }
.add-row svg { width: 16px; height: 16px; }
.btn.tiny svg { width: 14px; height: 14px; }
.btn.tiny { gap: 4px; }
@media (max-width: 899px) {
  body[data-route="settings"] .savebar { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); }
}
.mpill, .side, .pick, .mood-btn, .seg-btn { flex-direction: row; }
@media (max-width: 560px) { .side-row { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .tab { flex: 1 1 0; min-width: 0; padding: 6px 2px; } .tab span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; } }
.nav .nav-add.active { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
/* 2-column KPI grids: a lone last card spans the full row instead of leaving a hole */
@media (max-width: 699px) { .kpis > .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 700px) {
  .ltype { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ltype-opt { flex-direction: column; gap: 6px; padding: 10px 6px; text-align: center; }
  .ltype-txt small { display: none; }
  .ltype-txt b { font-size: 13px; }
  .card-head > .muted.small { text-align: right; }
}
@media (max-width: 420px) { .card-head:has(> .muted.small) { flex-wrap: wrap; } }
@media (max-width: 700px) { .ledger-fields { grid-template-columns: 1fr; } }

/* =================== settings v4: row design =================== */
.sgrid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) { .sgrid { grid-template-columns: 1fr 1fr; } .sgroup.wide { grid-column: 1 / -1; } }
.sgroup { padding: 0; overflow: hidden; }
.sg-head { display: flex; gap: 12px; align-items: flex-start; padding: 16px 16px 12px; }
.sg-head h2 { font-size: 15.5px; }
.sg-head p { margin: 2px 0 0; font-size: 13px; color: var(--muted); line-height: 1.4; }
.sg-ic {
  flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--info-bg); color: var(--accent);
}
.sg-ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.srows { display: flex; flex-direction: column; }
.sgroup > .srow, .srows > .srow { border-top: 1px solid var(--border); }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; }
.srow.stack { flex-direction: column; align-items: stretch; gap: 8px; }
.srow-text { min-width: 0; flex: 1; }
.srow-label { font-weight: 650; font-size: 14.5px; }
.srow-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.srow-live { font-size: 12.5px; font-weight: 650; color: var(--accent); margin-top: 4px; }
.srow-live:empty { display: none; }
.srow-ctl { flex: none; display: flex; align-items: center; }
.srow-ctl.wide { width: 100%; }
.srow.invalid .nfield, .srow.invalid .nstep { box-shadow: 0 0 0 2px var(--neg); border-radius: 12px; }
.sblock { padding: 2px 16px 16px; }

/* number field with optional prefix / % suffix */
.nfield { position: relative; display: block; width: 104px; }
.nfield input { text-align: right; font-weight: 700; padding-right: 12px; min-height: 42px; }
.nfield.has-suf input { padding-right: 28px; }
.nfield.has-pre input { padding-left: 34px; }
.nfield i { position: absolute; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-weight: 650; font-size: 14px; pointer-events: none; }
.nfield i.pre { left: 11px; }
.nfield i.suf { right: 11px; }
.nfield.solo { width: 130px; }
.nstep { display: inline-grid; grid-template-columns: 38px 104px 38px; align-items: center; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.nstep:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.nstep button { height: 42px; border: 0; background: var(--surface-2); color: var(--text); display: grid; place-items: center; }
.nstep button:active { background: var(--border); }
.nstep button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.nstep .nfield { width: 104px; }
.nstep .nfield input { border: 0; border-radius: 0; text-align: center; box-shadow: none !important; padding-left: 8px; padding-right: 8px; }
.nstep .nfield.has-suf input { padding-right: 24px; }
.nstep .nfield.has-pre input { padding-left: 30px; }
@media (max-width: 480px) {
  .srow { flex-wrap: wrap; }
  .srow:not(.stack) .srow-ctl { margin-left: auto; }
}

.pill-stat { display: inline-block; padding: 6px 12px; border-radius: 99px; background: var(--surface-2); font-weight: 650; font-size: 13px; }
.sym.risky { border-color: color-mix(in srgb, var(--warn) 50%, transparent); color: var(--warn); }
.map-headrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 0 2px; }
.map-headrow span { padding-left: 2px; }
.map-editor { max-width: 520px; }
.settings-bar .btn.primary:disabled { opacity: .45; cursor: default; }
.sform:not(.dirty) .settings-bar { display: none; }
.sform.dirty .settings-bar { animation: toastIn .18s ease-out; }
.settings-bar .savebar-info b { color: var(--warn); }
.reset-line { display: flex; justify-content: center; }
.small-btn { min-height: 36px; font-size: 13px; color: var(--muted); }

/* journal card v2 */
.journal-card { display: flex; flex-direction: column; gap: 10px; }
.jc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.jc-head h2 { font-size: 16px; }
.jstatus { font-size: 12.5px; font-weight: 650; color: var(--pos); padding: 4px 10px; border-radius: 99px; background: var(--pos-bg); }
.jstatus:empty { display: none; }
.jstatus.busy { color: var(--muted); background: var(--surface-2); }
.jlabel { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 650; color: var(--muted); margin-top: 4px; }
.jmoods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.jmood {
  --c: var(--accent);
  position: relative; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 8px 10px; border-radius: 14px; border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; color: var(--muted); font-weight: 650; transition: all .12s;
}
.jmood[data-m="1"] { --c: var(--neg); }
.jmood[data-m="2"] { --c: var(--warn); }
.jmood[data-m="3"] { --c: var(--pos); }
.jmood[data-m="4"] { --c: var(--accent); }
.jmood input { position: absolute; opacity: 0; pointer-events: none; }
.jmood-e { font-size: 24px; line-height: 1; filter: grayscale(.5); opacity: .8; transition: all .12s; }
.jmood-t { font-size: 14px; }
.jmood:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--border)); }
.jmood:hover .jmood-e { filter: none; opacity: 1; }
.jmood:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface)); color: var(--text); }
.jmood:has(input:checked) .jmood-e { filter: none; opacity: 1; transform: scale(1.12); }
.jmood:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.jprompts { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.jprompt {
  min-height: 30px; padding: 0 10px; border-radius: 99px; border: 1px dashed var(--border); background: transparent;
  font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.jprompt:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.journal-card .jnote { min-height: 96px; line-height: 1.55; resize: none; overflow: hidden; }
@media (max-width: 560px) {
  .jmood { flex-direction: column; gap: 4px; min-height: 66px; padding: 8px 4px; }
  .jmood-t { font-size: 12px; }
}

/* =================== Today v4 =================== */
.hero { --sc: var(--pos); display: flex; flex-direction: column; gap: 16px; padding: 18px; position: relative; overflow: hidden; }
.hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--sc); }
.hero.warn { --sc: var(--warn); }
.hero.stop { --sc: var(--neg); border-color: color-mix(in srgb, var(--neg) 45%, var(--border)); background: linear-gradient(180deg, var(--neg-bg), var(--surface) 55%); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.hero-greet { font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.hero-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.sess { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 650; color: var(--muted); padding: 5px 10px; border-radius: 99px; background: var(--surface-2); }
.sess i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .6; }
.sess.open { color: var(--text); }
.sess.open i { background: var(--pos); opacity: 1; box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 25%, transparent); }
.status-pill { font-size: 12.5px; font-weight: 750; padding: 5px 12px; border-radius: 99px; color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, transparent); }
.hero .status-pill.go { --sc: var(--pos); }
.hero .status-pill.warn { --sc: var(--warn); }
.hero .status-pill.stop { --sc: var(--neg); text-transform: uppercase; letter-spacing: .04em; }
.hp-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hp-value { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 2px 0; }
.hp-sub { font-size: 13.5px; }
.hero-stop { padding: 12px 14px; border-radius: 12px; background: var(--neg-bg); color: var(--text); font-size: 14px; }
.hero-stop b { color: var(--neg); }
.hero-meters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.meter { background: var(--surface-2); border-radius: 12px; padding: 11px 12px; min-width: 0; }
.m-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.m-val { font-size: 19px; font-weight: 750; margin-top: 2px; white-space: nowrap; }
.m-val span { font-size: 13px; font-weight: 600; color: var(--muted); }
.m-sub { font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter .bar { margin-top: 7px; background: var(--border); }
.tdots { display: flex; gap: 5px; margin-top: 9px; }
.tdots i { width: 100%; max-width: 34px; height: 6px; border-radius: 99px; background: var(--border); }
.tdots i.on { background: var(--accent); }
.tdots i.over { background: var(--neg); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn.big { flex: 1 1 240px; }
.hero .ql-picks { margin-top: -4px; }
@media (max-width: 760px) {
  .hero-meters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hp-value { font-size: 38px; }
  .hero-pills { justify-content: flex-start; }
}

/* two-column body */
.today-grid { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
.tg-main, .tg-side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (min-width: 1100px) {
  .today-grid { grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); }
  .tg-side { position: sticky; top: 76px; }
}
@media (min-width: 1100px) { body[data-route="today"] .view { max-width: 1240px; } }

.empty-today { display: flex; align-items: center; gap: 14px; }
.empty-today h2 { font-size: 15px; }
.empty-today p { margin: 3px 0 0; }
.et-ic { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--muted); }
.et-ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* checklist */
.checklist-card { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); }
.checklist-card.complete { border-color: color-mix(in srgb, var(--pos) 40%, var(--border)); }
.ck-count { font-size: 12.5px; font-weight: 750; padding: 3px 10px; border-radius: 99px; background: var(--warn-bg); color: var(--warn); }
.checklist-card.complete .ck-count { background: var(--pos-bg); color: var(--pos); }
.ck-items { display: flex; flex-direction: column; gap: 2px; }
.ck-item { position: relative; display: flex; flex-direction: row; align-items: center; gap: 12px; padding: 9px 4px; border-radius: 10px; cursor: pointer; color: var(--text); font-weight: 500; font-size: 14.5px; }
.ck-item:hover { background: var(--surface-2); }
.ck-item input { position: absolute; opacity: 0; pointer-events: none; }
.ck-box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--border); display: grid; place-items: center; transition: all .12s; }
.ck-item input:checked + .ck-box { background: var(--pos); border-color: var(--pos); }
.ck-item input:checked + .ck-box::after { content: ''; width: 6px; height: 11px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) translate(-1px, -1px); }
.ck-item input:checked ~ .ck-text { color: var(--muted); text-decoration: line-through; }
.ck-item input:focus-visible + .ck-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.ck-edit { display: inline-block; margin-top: 8px; }
.checklist-card.complete .ck-edit { margin-top: 0; }

/* week strip */
.wk { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.wk-day { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 2px; border-radius: 11px; background: var(--surface-2); min-width: 0; border: 1.5px solid transparent; }
.wk-day:hover { border-color: var(--accent); }
.wk-day.today { border-color: var(--accent); }
.wk-day.future { opacity: .45; }
.wk-dow { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; }
.wk-mood { font-size: 15px; min-height: 20px; }
.wk-net { font-size: 12.5px; font-weight: 750; white-space: nowrap; }

/* account rows */
.acct-rows { display: flex; flex-direction: column; }
.acct-rows > div { display: flex; justify-content: space-between; align-items: baseline; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; }
.acct-rows > div:first-child { border-top: 0; padding-top: 0; }
.acct-rows span { color: var(--muted); }
.acct-rows small { font-size: 12px; font-weight: 600; }

#size-card.flash { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent); transition: box-shadow .3s; }
@media (max-width: 1099px) { .only-wide { display: none; } }
@media (min-width: 1100px) { .only-narrow { display: none; } }
.hero-top { flex-wrap: nowrap; }
.hero-top .status-pill { flex: none; }
.hero-pills { justify-content: flex-start; margin-top: -8px; }
.hero-actions .btn.big { flex: 1 1 auto; }
.m-sub { white-space: normal; }
.qopt { font-weight: 800; font-size: 12px; padding: 1px 6px; border-radius: 6px; }
.qopt.ce { color: var(--pos); background: var(--pos-bg); }
.qopt.pe { color: var(--neg); background: var(--neg-bg); }
.hp-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.verdict { font-size: 15px; font-weight: 800; padding: 7px 14px; border-radius: 12px; white-space: nowrap; letter-spacing: .01em; cursor: help; }
.verdict.ok { color: var(--pos); background: var(--pos-bg); }
.verdict.stop { color: #fff; background: var(--neg); text-transform: uppercase; letter-spacing: .06em; box-shadow: 0 0 0 4px var(--neg-bg); animation: pulse-stop 1.6s ease-in-out infinite; }
@keyframes pulse-stop { 50% { box-shadow: 0 0 0 8px transparent; } }

/* position size check v2 */
.sc-markets { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 13px; }
.sc-mk { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 650; min-width: 0; }
.sc-mk span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.sc-mk.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.sc-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.sc-syms .sym { min-height: 34px; }
.sc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sc-side .seg-btn { min-height: 40px; }
.sc-side .seg-btn.on.buy { background: var(--pos); color: #fff; box-shadow: none; }
.sc-side .seg-btn.on.sell { background: var(--neg); color: #fff; box-shadow: none; }
.sc-lots { grid-template-columns: 40px 1fr 40px; }
.sc-lots input { min-height: 40px; font-size: 16px; }
.sc-lothint { margin-top: -6px; text-align: right; }
.sc-prices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lbl-u { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.utog { display: inline-flex; background: var(--surface-2); border-radius: 7px; padding: 2px; }
.utog button { border: 0; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 750; padding: 2px 8px; border-radius: 5px; min-height: 22px; }
.utog button.on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.conv { font-size: 12px; font-weight: 650; color: var(--accent); min-height: 1.2em; }
.sc-empty { font-size: 13.5px; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-radius: 12px; }
.sc-verdict { font-weight: 800; font-size: 15px; padding: 10px 14px; border-radius: 12px; }
.sc-verdict.ok { color: var(--pos); background: var(--pos-bg); }
.sc-verdict.warn { color: var(--warn); background: var(--warn-bg); }
.sc-verdict.bad { color: var(--neg); background: var(--neg-bg); }
.sc-stats { margin-top: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px; background: var(--surface-2); border-radius: 12px; }
.sc-stats .lstat b { font-size: 16px; }
.calc-actions .btn svg { width: 16px; height: 16px; }
@media (max-width: 420px) {
  .sc-prices { grid-template-columns: 1fr 1fr; }
  .sc-prices label:first-child { grid-column: 1 / -1; }
  .sc-stats { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .tg-side .sc-prices { grid-template-columns: 1fr 1fr; }
  .tg-side .sc-prices label:first-child { grid-column: 1 / -1; }
  .tg-side .sc-stats { grid-template-columns: 1fr 1fr; }
}

/* =================== Planner =================== */
body[data-route="plan"] .view { max-width: 1240px; }
body[data-route="plan"] .fab { display: none; }
.pl-check .checklist-card .ck-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 4px 12px; }
.planner { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: start; }
@media (min-width: 1000px) {
  .planner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
  .pl-right { position: sticky; top: 76px; }
}
.pl-left, .pl-right { display: flex; flex-direction: column; gap: 16px; padding: 18px; }
.pl-sec { display: flex; flex-direction: column; gap: 8px; }
.pl-cap { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pl-cap span { text-transform: none; letter-spacing: 0; font-weight: 600; }
.pl-syms { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 13px; overflow-x: auto; scrollbar-width: none; }
.pl-sym { flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); }
.pl-sym b { font-size: 14px; }
.pl-sym small { font-size: 11.5px; font-variant-numeric: tabular-nums; opacity: .8; }
.pl-sym.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
.pl-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pl-two .sc-side .seg-btn { min-height: 44px; font-size: 15px; }
.pl-two .sc-lots button, .pl-two .sc-lots input { min-height: 44px; }
.pl-two .sc-lots input { font-size: 18px; font-weight: 750; }
.pl-explain { margin: -6px 0 0; font-size: 13px; color: var(--muted); }
.pl-prices { display: flex; flex-direction: column; gap: 14px; padding-top: 16px; border-top: 1px solid var(--border); }
.pl-prow { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; }
.pl-plabel { display: flex; flex-direction: column; padding-top: 8px; }
.pl-plabel b { font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pl-plabel small { font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.neg { background: var(--neg); }
.dot.pos { background: var(--pos); }
.pl-in { position: relative; display: flex; align-items: center; }
.pl-in > i { position: absolute; left: 14px; font-style: normal; color: var(--muted); font-weight: 650; pointer-events: none; }
.pl-in input { padding-left: 34px; padding-right: 74px; font-size: 18px; font-weight: 700; min-height: 50px; }
.pl-in .utog { position: absolute; right: 8px; }
.pl-prow:first-child .pl-in input { padding-right: 14px; }
.pl-inwrap { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.pl-under { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pl-delta { font-size: 12.5px; font-weight: 700; margin-right: 4px; }
.pl-delta:empty { display: none; }
.pchip { min-height: 28px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pchip:hover { border-color: var(--accent); color: var(--accent); }
.pl-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.switch { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch span { width: 40px; height: 24px; border-radius: 99px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 480px) { .pl-prow { grid-template-columns: 1fr; gap: 6px; } .pl-plabel { flex-direction: row; align-items: baseline; gap: 8px; padding-top: 0; } }

.pl-empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.pl-empty h2 { color: var(--text); font-size: 17px; margin: 12px 0 6px; }
.pl-empty p { margin: 0; font-size: 14px; }
.pl-empty-ic { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--info-bg); color: var(--accent); }
.pl-empty-ic svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sc-verdict { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.sc-verdict .muted { font-weight: 600; }
.pl-outs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pl-out { border-radius: 14px; padding: 14px 16px; }
.pl-out.neg { background: var(--neg-bg); }
.pl-out.pos { background: var(--pos-bg); }
.pl-out.empty { background: var(--surface-2); }
.po-t { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.po-v { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0; font-variant-numeric: tabular-nums; }
.pl-out.neg .po-v, .pl-out.neg .po-p { color: var(--neg); }
.pl-out.pos .po-v, .pl-out.pos .po-p { color: var(--pos); }
.po-p { font-weight: 700; font-size: 13.5px; }
.po-s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pl-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pl-grid > div { padding: 13px 14px; border-top: 1px solid var(--border); border-left: 1px solid var(--border); margin: -1px 0 0 -1px; }
.pg-l { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pg-v { font-size: 21px; font-weight: 800; margin-top: 2px; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.pg-s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.badge { font-size: 11px; font-weight: 750; padding: 2px 8px; border-radius: 6px; letter-spacing: .02em; }
.badge.ok { background: var(--pos-bg); color: var(--pos); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--neg-bg); color: var(--neg); }
.wr-bar { display: flex; gap: 3px; margin-top: 7px; }
.wr-bar i { flex: 1; height: 5px; border-radius: 99px; background: var(--border); }
.wr-bar i.on { background: var(--accent); }
.pl-test, .pl-tips { display: flex; flex-direction: column; gap: 8px; }
.pt-head { display: flex; justify-content: space-between; align-items: baseline; }
.pt-track { position: relative; height: 10px; border-radius: 99px; background: var(--surface-2); margin: 26px 0 0; }
.pt-red, .pt-green { position: absolute; top: 0; bottom: 0; }
.pt-red { background: var(--neg); border-radius: 99px 0 0 99px; }
.pt-green { background: var(--pos); border-radius: 0 99px 99px 0; }
.pt-mark { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1.5px; background: var(--text); border-radius: 2px; }
.pt-mark span { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11.5px; font-weight: 700; color: var(--text); }
.pt-ends { display: flex; justify-content: space-between; font-size: 12px; font-weight: 650; color: var(--muted); }
#pt-range { width: 100%; min-height: 0; padding: 0; border: 0; background: transparent; accent-color: var(--accent); box-shadow: none; }
.pt-res { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 15px; }
.pt-res b { font-size: 18px; }
.tip { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 11px; font-size: 13.5px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 9%, var(--surface)); }
.tip.ok { --c: var(--pos); }
.tip.info { --c: var(--accent); }
.tip.warn { --c: var(--warn); }
.tip.bad { --c: var(--neg); }
.tip .btn.tiny { flex: none; margin: 0; background: var(--surface); border-color: var(--border); }
.pl-charges summary { cursor: pointer; display: flex; justify-content: space-between; font-weight: 650; font-size: 14px; }
.pl-charges summary b { color: var(--accent); }
.pl-charges p { margin: 8px 0 0; }
.pl-right .calc-actions .btn.big { flex: 1; }
.pl-mini { display: none; }
@media (max-width: 999px) {
  .pl-mini:not(:empty) {
    display: flex; position: sticky; bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); z-index: 15;
    gap: 12px; align-items: center; justify-content: space-between; padding: 10px 14px; margin-top: 12px;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); font-weight: 800; font-size: 14px;
  }
  .sc-verdict.mini { padding: 4px 10px; font-size: 12.5px; }
}
@media (max-width: 480px) { .po-v { font-size: 24px; } .pg-v { font-size: 18px; } }
.btn svg { flex: none; }

/* scroll fixes: hidden checkboxes/radios must never take layout width; tall right column scrolls normally */
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; padding: 0; }
.switch { position: relative; }
.switch input { width: 1px; height: 1px; }
html, body { overflow-x: clip; } /* clip, not hidden: position: sticky keeps working for the planner bar and save bar */
@media (min-width: 1000px) { .pl-right { position: static; } }
.pt-track { overflow: visible; }
.pt-red, .pt-green { max-width: 100%; }
.pl-test { overflow: hidden; padding-top: 2px; }
.pl-bad { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; background: var(--surface-2); }
.pl-bad-row { display: flex; justify-content: space-between; font-size: 15px; }
.pl-bad-row span { color: var(--muted); }
.pl-bad p { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }
.pl-bad-fix { display: flex; gap: 8px; flex-wrap: wrap; }
.pl-bad-fix .btn.tiny { min-height: 34px; padding: 0 12px; background: var(--surface); border-color: var(--border); }
.pl-actions { margin-top: -4px; }

/* hero action bar v2 */
.hero-bar { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; padding-top: 4px; }
.hb-btns { display: flex; gap: 8px; flex: none; }
.hb-btns .btn { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 11px; }
.hb-btns .btn svg { width: 17px; height: 17px; stroke-width: 2.2; }
.hb-quick { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; }
.hb-label { font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; padding-left: 16px; border-left: 1px solid var(--border); }
.hb-groups { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.hb-groups::-webkit-scrollbar { display: none; }
.qgroup { display: inline-flex; align-items: center; flex: none; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.qname { font-size: 12.5px; font-weight: 750; padding: 0 9px 0 11px; color: var(--text); }
.qbtn { border: 0; border-left: 1px solid var(--border); background: transparent; min-height: 34px; padding: 0 10px; font-size: 12px; font-weight: 800; letter-spacing: .02em; }
.qbtn.ce { color: var(--pos); }
.qbtn.pe { color: var(--neg); }
.qbtn.ce:hover { background: var(--pos-bg); }
.qbtn.pe:hover { background: var(--neg-bg); }
.qbtn:active { transform: scale(.95); }
@media (max-width: 760px) {
  .hero-bar { flex-direction: column; align-items: stretch; }
  .hb-btns .hb-log { flex: 1; }
  .hb-label { border-left: 0; padding-left: 0; }
  .hb-quick { flex-direction: column; align-items: stretch; gap: 6px; }
}
@media (max-width: 760px) {
  .hb-btns { width: 100%; }
  .hb-btns .hb-log { flex: 1 1 0; min-width: 0; }
  .hb-btns .hb-plan { flex: none; }
}

/* Today rows: pairs side by side on wide screens */
.today-rows { display: flex; flex-direction: column; gap: 14px; }
.tr-pair { display: grid; grid-template-columns: 1fr; gap: 14px; align-items: stretch; }
@media (min-width: 900px) { .tr-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.tr-pair > .card { min-width: 0; }
.tr-pair > .empty-today { align-self: stretch; }

/* simple trade rows (Today) */
.slist { display: flex; flex-direction: column; margin: 0 -8px; }
.srow-t { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; }
.srow-t + .srow-t { border-top: 1px solid var(--border); border-radius: 0 0 12px 12px; }
.srow-t:hover { background: var(--surface-2); }
.srow-t .mbadge.xs { width: 22px; height: 22px; }
.st-main { min-width: 0; }
.st-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-name span { font-weight: 500; font-size: 13px; color: var(--muted); }
.st-sub { font-size: 13px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.st-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.st-right b { font-size: 16px; font-weight: 800; white-space: nowrap; }
.st-right small { font-size: 12.5px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.st-right i { font-style: normal; font-weight: 800; }
.st-right i.ok { color: var(--pos); }
.st-right i.no { color: var(--neg); }
.st-right .btn.tiny { margin-top: 2px; min-height: 26px; padding: 0 10px; }

/* =================== Trades v2 =================== */
body[data-route="trades"] .view { max-width: 1240px; }
.tbar { display: flex; flex-direction: column; gap: 10px; }
.tbar-row { display: flex; gap: 8px; align-items: center; }
.tsearch { position: relative; flex: 1; min-width: 0; }
.tsearch svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; }
.tsearch input { padding-left: 38px; }
.tbar select { width: auto; flex: none; }
.tbar-filters { flex-wrap: nowrap; }
.tfilter { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; font-weight: 650; color: var(--muted); }
.tfilter.on { color: var(--neg); border-color: var(--neg); background: var(--neg-bg); }
.tfilter.clear { color: var(--accent); }
.tfilter svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
@media (max-width: 640px) { .tbar-row:first-child { flex-wrap: wrap; } .tbar-row:first-child .tsearch { flex-basis: 100%; } .tbar-row:first-child select { flex: 1; } }

.tsums { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.tsum { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; min-width: 0; box-shadow: var(--shadow); }
.tsum span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.tsum b { font-size: 21px; font-weight: 800; margin-top: 2px; white-space: nowrap; letter-spacing: -.01em; }
.tsum small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .tsums { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tsums > :first-child { grid-column: 1 / -1; } }

.ttable { padding: 6px 8px; }
.trow {
  display: grid; grid-template-columns: 22px minmax(170px, 2.2fr) 0.9fr 1.6fr 0.9fr 1.1fr 0.7fr 92px;
  gap: 12px; align-items: center; padding: 10px 10px; border-radius: 10px; font-size: 14px; font-variant-numeric: tabular-nums;
}
a.trow:hover { background: var(--surface-2); }
.trow .r { text-align: right; justify-self: end; }
.trow .c { justify-self: center; }
.thead { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.tc-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tn { font-weight: 700; white-space: nowrap; }
.tn em { font-style: normal; font-weight: 800; font-size: 12.5px; }
.ttag { font-size: 11.5px; font-weight: 650; color: var(--m-COMMODITY); background: color-mix(in srgb, var(--m-COMMODITY) 13%, transparent); padding: 1px 7px; border-radius: 6px; white-space: nowrap; }
.tdate { font-size: 12px; color: var(--muted); }
.tc-size, .tc-px, .tc-sl { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-px { color: var(--text); }
.tc-net { display: flex; flex-direction: column; align-items: flex-end; }
.tc-net b { font-weight: 800; font-size: 15px; white-space: nowrap; }
.tc-net small { font-size: 11px; color: var(--muted); }
.tc-r { font-weight: 650; font-size: 13px; }
.tc-rule { display: flex; align-items: center; gap: 6px; }
.rule { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px; border-radius: 8px; font-weight: 800; font-size: 13px; position: relative; }
.rule.ok { color: var(--pos); background: var(--pos-bg); }
.rule.no { color: var(--neg); background: var(--neg-bg); cursor: help; }
.rule.open { color: var(--accent); background: var(--info-bg); font-size: 11px; font-weight: 700; }
.rule sup { font-size: 9.5px; margin-left: 1px; }
.tclose { margin: 0; min-height: 26px; padding: 0 9px; }
.tday { display: flex; align-items: center; gap: 10px; padding: 14px 10px 6px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 700; color: var(--muted); }
.thead + .tday { border-top: 0; margin-top: 0; }
.tday:hover .tday-date { color: var(--accent); }
.tday-date { color: var(--text); }
.tday-mood { font-size: 15px; }
.tday-x { color: var(--neg); font-weight: 800; }
.tday-net { margin-left: auto; font-weight: 800; font-size: 14px; }

/* phone: two-line rows */
@media (max-width: 760px) {
  .thead { display: none; }
  .ttable { padding: 4px 6px; }
  .trow {
    grid-template-columns: 22px 1fr auto; grid-template-areas: 'b name net' 'b px rule';
    gap: 2px 12px; padding: 10px 6px;
  }
  .trow > .mbadge { grid-area: b; align-self: start; margin-top: 2px; }
  .tc-name { grid-area: name; }
  .tc-size, .tc-sl, .tc-r { display: none; }
  .tc-px { grid-area: px; font-size: 13px; color: var(--muted); }
  .tc-net { grid-area: net; }
  .tc-rule { grid-area: rule; justify-self: end; }
  .tc-name::after { content: attr(data-size); }
}
.tday.trow { padding: 14px 10px 6px; border-radius: 0; }
.tday-info { grid-column: 1 / 6; display: flex; align-items: center; gap: 10px; }
.tday .tday-net { grid-column: 6; margin-left: 0; }
@media (max-width: 760px) {
  .tday.trow { display: flex; }
  .tday .tday-net { margin-left: auto; }
}
@media (min-width: 761px) { .tday.trow { display: grid; } }
@media (max-width: 900px) {
  .tsums { display: flex; overflow-x: auto; scrollbar-width: none; gap: 8px; margin: 0 -16px; padding: 0 16px; }
  .tsums::-webkit-scrollbar { display: none; }
  .tsums > .tsum { flex: 0 0 auto; min-width: 128px; padding: 10px 12px; }
  .tsums > :first-child { grid-column: auto; }
  .tsum b { font-size: 18px; }
}
.m-only { display: none; }
@media (max-width: 760px) { .m-only { display: inline; } }
/* trades table: + target + charges columns */
.trow { grid-template-columns: 22px minmax(160px, 2fr) 0.8fr 1.5fr 0.8fr 0.8fr 0.8fr 1fr 0.7fr 84px; }
.tc-tg { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-ch { color: var(--muted); font-size: 13px; white-space: nowrap; }
.tday-info { grid-column: 1 / 7; }
.tday .tday-ch { grid-column: 7; font-size: 12px; font-weight: 600; color: var(--muted); }
.tday .tday-net { grid-column: 8; }
@media (max-width: 1100px) and (min-width: 761px) {
  .trow { grid-template-columns: 22px minmax(140px, 2fr) 0.8fr 1.5fr 0.8fr 0.8fr 0.8fr 1fr 64px; }
  .tc-r, .thead > span:nth-child(9) { display: none; }
  .tday .tday-net { grid-column: 8; }
}
@media (max-width: 760px) { .tc-tg, .tc-ch, .tday-ch { display: none; } }

/* =================== Trades table v3 (simpler) =================== */
.trow { grid-template-columns: 22px minmax(170px, 2.2fr) 0.8fr 1.5fr 1.5fr 0.8fr 1.1fr 150px; gap: 14px; }
.tc-plan { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.tc-plan .sep { color: var(--muted); }
.tc-px .neg, .tc-px .pos { font-weight: 600; }
.tc-net small { font-size: 12px; font-weight: 650; }
.tc-rule { justify-self: start; display: flex; gap: 6px; align-items: center; min-width: 0; }
.rule { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px; border-radius: 8px; font-weight: 750; font-size: 11.5px; letter-spacing: .02em; white-space: nowrap; min-width: 0; }
.rule em { font-style: normal; opacity: .75; }
.rule.ok { color: var(--pos); background: var(--pos-bg); }
.rule.no { color: var(--neg); background: var(--neg-bg); }
.rule.open { color: var(--accent); background: var(--info-bg); }
/* day band */
.tband { display: flex; align-items: center; gap: 10px; margin: 10px -8px 2px; padding: 9px 18px; background: var(--surface-2); font-size: 13px; font-weight: 700; color: var(--muted); }
.thead + .tband { margin-top: 0; }
.tband:hover .tb-date { color: var(--accent); }
.tb-date { color: var(--text); }
.tb-mood { font-size: 15px; }
.tb-n { font-weight: 600; }
.tb-net { margin-left: auto; font-weight: 600; }
.tb-net b { font-weight: 800; margin-left: 4px; }
.ttable { padding: 0 8px 6px; overflow: hidden; }
.ttable .thead { padding-top: 12px; }
.ttable a.trow + a.trow { border-top: 1px solid var(--border); border-radius: 0; }
@media (max-width: 1100px) and (min-width: 761px) {
  .trow { grid-template-columns: 22px minmax(140px, 2fr) 0.8fr 1.4fr 1.4fr 1fr 120px; }
  .tc-ch, .thead > span:nth-child(6) { display: none; }
}
@media (max-width: 760px) {
  .tc-plan, .tc-ch { display: none; }
  .tband { margin: 8px -6px 0; padding: 8px 14px; }
  .tc-net small { display: none; }
}
.period-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.period-row > .scroll-x { flex: 0 1 auto; min-width: 0; }
.custom-range { display: flex; gap: 8px; align-items: center; }
.custom-range label { flex-direction: row; align-items: center; gap: 6px; font-size: 12.5px; }
.custom-range input { min-height: 40px; padding: 6px 10px; font-size: 14px; width: auto; }
@media (max-width: 640px) { .custom-range { width: 100%; } .custom-range label { flex: 1; } .custom-range input { flex: 1; min-width: 0; } }

/* =================== Analyse overview: report card =================== */
.rc-hero { display: grid; grid-template-columns: 1fr 1.2fr; gap: 28px; padding: 22px; position: relative; overflow: hidden; }
.rc-hero::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--pos); }
.rc-hero.down::before { background: var(--neg); }
.rc-cap { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.rc-net { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 8px; }
.rc-verdict { margin: 0 0 10px; font-size: 16px; font-weight: 600; line-height: 1.45; }
.rc-meta { font-size: 13px; color: var(--muted); }
.rc-cmp { display: flex; flex-direction: column; gap: 12px; justify-content: center; padding-left: 24px; border-left: 1px solid var(--border); }
.cmp-row { display: grid; grid-template-columns: 130px 1fr 96px; gap: 12px; align-items: center; }
.cmp-l b { display: block; font-size: 14px; }
.cmp-l small { font-size: 12px; color: var(--muted); }
.cmp-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.cmp-fill { display: block; height: 100%; border-radius: 99px; }
.cmp-fill.pos { background: var(--pos); }
.cmp-fill.neg { background: var(--neg); }
.cmp-v { font-weight: 800; font-size: 16px; text-align: right; white-space: nowrap; }
.cmp-note { font-size: 13.5px; color: var(--muted); }
@media (max-width: 900px) {
  .rc-hero { grid-template-columns: 1fr; gap: 18px; padding: 18px; }
  .rc-cmp { padding-left: 0; border-left: 0; padding-top: 16px; border-top: 1px solid var(--border); }
  .rc-net { font-size: 36px; }
  .cmp-row { grid-template-columns: 96px 1fr 84px; }
}

.rc-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .rc-cols { grid-template-columns: 1fr; } }
.rc-col { --c: var(--accent); border-top: 3px solid var(--c); }
.rc-col.good { --c: var(--pos); }
.rc-col.bad { --c: var(--neg); }
.rc-col.fix { --c: var(--accent); }
.rc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rc-ic { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); font-weight: 800; }
.rc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rc-item { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.rc-item:first-child { border-top: 0; padding-top: 2px; }
.rc-item b { display: block; font-size: 14px; font-weight: 700; }
.rc-item small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.4; }
.rc-v { font-weight: 800; font-size: 14px; white-space: nowrap; }
.rc-col.fix .rc-item b::before { content: counter(fix) '. '; color: var(--accent); }
.rc-col.fix .rc-list { counter-reset: fix; }
.rc-col.fix .rc-item { counter-increment: fix; }
.rc-col.fix .rc-v { font-size: 12.5px; font-weight: 700; }

.hc-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .hc-grid { grid-template-columns: 1fr 1fr; } }
.hc { --c: var(--muted); padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--c); min-width: 0; }
.hc.good { --c: var(--pos); }
.hc.mid { --c: var(--warn); }
.hc.bad { --c: var(--neg); }
.hc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hc-top span { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.hc-top em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); padding: 2px 8px; border-radius: 99px; }
.hc b { display: block; font-size: 20px; font-weight: 800; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* =================== Calendar v2 =================== */
.cal-card { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.cal-head2 { display: flex; align-items: center; gap: 6px; }
.cal-head2 h2 { font-size: 20px; min-width: 170px; text-align: center; }
.cal-today { margin: 0 0 0 auto; }
.cal-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cs { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.cs span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cs b { display: block; font-size: 18px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs b span { font-size: 12px; text-transform: none; letter-spacing: 0; }
.cs b.warnc { color: var(--warn); }
.cs small { font-size: 12px; color: var(--muted); }
@media (max-width: 900px) { .cal-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.cal-grid2 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(0, 1fr); gap: 6px; }
.cdow { font-size: 11px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; text-align: center; padding-bottom: 2px; }
.cdow.wkend { opacity: .6; }
.cd {
  --k: 0; position: relative; min-height: 88px; border-radius: 12px; padding: 8px 9px; display: flex; flex-direction: column; gap: 2px;
  background: var(--surface-2); border: 1.5px solid transparent; min-width: 0; overflow: hidden; color: var(--text);
}
.cd.empty { background: transparent; }
.cd.wkend:not(.up):not(.down) { opacity: .55; }
.cd.future { opacity: .35; }
.cd.up { background: color-mix(in srgb, var(--pos) calc(var(--k) * 34%), var(--surface-2)); }
.cd.down { background: color-mix(in srgb, var(--neg) calc(var(--k) * 34%), var(--surface-2)); }
.cd.today { border-color: var(--accent); }
a.cd:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.cd-top { display: flex; align-items: center; gap: 4px; }
.cd-num { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cd.up .cd-num, .cd.down .cd-num { color: var(--text); }
.cd-mood { font-size: 13px; margin-left: auto; }
.cd-x { color: var(--neg); font-size: 10px; margin-left: auto; }
.cd-mood + .cd-x { margin-left: 2px; }
.cd-net { margin-top: auto; font-size: 15px; font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
.cd.up .cd-net { color: var(--pos); }
.cd.down .cd-net { color: var(--neg); }
.cd-meta { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; padding: 0 6px; border-radius: 12px; background: color-mix(in srgb, var(--surface-2) 50%, transparent); min-width: 0; }
.cw b { font-size: 14px; font-weight: 800; white-space: nowrap; }
.cw small { font-size: 11px; color: var(--muted); white-space: nowrap; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 12px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 14px; height: 10px; border-radius: 3px; display: inline-block; }
.lg.up { background: color-mix(in srgb, var(--pos) 34%, var(--surface-2)); }
.lg.down { background: color-mix(in srgb, var(--neg) 34%, var(--surface-2)); }
.lg-x { color: var(--neg); font-style: normal; font-size: 10px; }
@media (max-width: 760px) {
  .cal-card { padding: 14px; }
  .cal-grid2 { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
  .cdow:nth-child(8), .cw { display: none; }
  .cd { min-height: 58px; padding: 5px; border-radius: 9px; }
  .cd-net { font-size: 11px; }
  .cd-meta, .cd-mood { display: none; }
  .cal-head2 h2 { min-width: 0; font-size: 17px; }
}
.cal-stats { grid-template-columns: 2fr repeat(5, minmax(0, 1fr)); }
.cs-main { padding: 12px 16px; display: flex; flex-direction: column; justify-content: center; }
.cs-main b { font-size: 30px; letter-spacing: -.02em; margin-top: 4px; }
.cs-main.pos { background: color-mix(in srgb, var(--pos) 13%, var(--surface-2)); }
.cs-main.neg { background: color-mix(in srgb, var(--neg) 13%, var(--surface-2)); }
@media (max-width: 900px) {
  .cal-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cs-main { grid-column: 1 / -1; }
  .cs-main b { font-size: 26px; }
}
/* calendar ROI */
.cd-net { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.cd-roi { font-style: normal; font-size: 11px; font-weight: 700; opacity: .85; }
.cw-roi { font-size: 11.5px; font-weight: 750; white-space: nowrap; }
.cs-main b { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.cs-roi { font-size: 15px !important; font-weight: 750; letter-spacing: 0 !important; text-transform: none !important; color: inherit !important; opacity: .9; }
@media (max-width: 760px) { .cd-roi { display: none; } }
.cal-stats { grid-template-columns: repeat(5, minmax(0, 1fr)) 2fr; }
@media (max-width: 900px) {
  .cal-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .cs-main { order: -1; grid-column: 1 / -1; }
}

/* capital growth */
.cg-card { display: flex; flex-direction: column; gap: 14px; }
.cg-card .card-head { margin-bottom: 0; }
.cg-card .card-head > div { display: flex; flex-direction: column; gap: 2px; }
.cg-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .cg-stats { grid-template-columns: 1fr 1fr; } }
.cg-stat { background: var(--surface-2); border-radius: 12px; padding: 10px 14px; min-width: 0; }
.cg-stat span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cg-stat b { display: block; font-size: 20px; font-weight: 800; margin-top: 2px; white-space: nowrap; }
.cg-stat small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.c-line-acc { stroke: var(--accent); stroke-width: 2.6; }
.c-line-muted { stroke: var(--muted); stroke-width: 1.6; opacity: .8; }
.c-area-acc { fill: var(--accent); opacity: .08; }
.c-hdot { fill: var(--surface); stroke-width: 2.5; }
.c-hdot.c-line-acc { stroke: var(--accent); }
.c-hdot.c-line-muted { stroke: var(--muted); }
.chart-tip.multi { white-space: nowrap; line-height: 1.5; padding: 8px 10px; }
.chart-tip.multi div { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.chart-tip.multi div b { margin-left: auto; padding-left: 10px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--muted); }
.sw.c-line-acc { background: var(--accent); }
.sw.dashed { background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); }
.chart-tip .tip-g { border-top: 1px solid color-mix(in srgb, var(--bg) 30%, transparent); margin-top: 3px; padding-top: 3px; }
.cg-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--muted); align-items: center; }
.cg-legend span { display: inline-flex; align-items: center; gap: 7px; }

/* spacing: Analyse tab content was stacked with no gaps */
#atab { display: flex; flex-direction: column; gap: 16px; }
.view { gap: 16px; }
.grid-2, .rc-cols, .tr-pair, .today-rows, .tg-main, .tg-side { gap: 16px; }
.afilters { gap: 10px; }
.rc-hero, .cg-card { padding: 22px; }
@media (max-width: 760px) { .view, #atab { gap: 12px; } .rc-hero, .cg-card { padding: 16px; } }

/* =================== Overview v3: honest analysis =================== */
.rc-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; padding-top: 10px; border-top: 1px dashed var(--border); font-size: 13px; font-weight: 650; color: var(--muted); }
.rc-total b { font-size: 15px; font-weight: 800; }
.early { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.early b { color: var(--text); font-weight: 650; }

.edges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .edges { grid-template-columns: 1fr; } }
.edge { --c: var(--muted); padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border-top: 3px solid var(--c); }
.edge.good { --c: var(--pos); }
.edge.mid { --c: var(--warn); }
.edge.bad { --c: var(--neg); }
.edge-top { display: flex; justify-content: space-between; align-items: center; }
.edge-top span { font-size: 12px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.edge-top em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); padding: 2px 9px; border-radius: 99px; }
.edge b { display: block; font-size: 24px; font-weight: 800; margin-top: 6px; letter-spacing: -.01em; }
.edge small { display: block; font-size: 12.5px; color: var(--muted); }
.edge p { margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; }

.trend-note { margin: -4px 0 10px; font-size: 13.5px; font-weight: 600; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); }
.trend-note.good { color: var(--pos); background: var(--pos-bg); }
.trend-note.bad { color: var(--neg); background: var(--neg-bg); }
.tbl.trend td { vertical-align: middle; }
.tbl.trend i { font-style: normal; font-weight: 800; margin-left: 4px; font-size: 12px; }
.tr-up { color: var(--pos); }
.tr-down { color: var(--neg); }
.tr-eq { color: var(--muted); }
.cbar { display: inline-block; width: 48px; height: 6px; border-radius: 99px; background: var(--surface-2); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.cbar span { display: block; height: 100%; border-radius: 99px; }
.cbar .pos { background: var(--pos); }
.cbar .mid { background: var(--warn); }
.cbar .neg { background: var(--neg); }

.al { display: flex; flex-direction: column; }
.al-row { display: grid; grid-template-columns: 1fr 80px 70px 100px; gap: 10px; align-items: center; padding: 11px 0; border-top: 1px solid var(--border); }
.al-row:first-child { border-top: 0; }
.al-l b { display: block; font-size: 14px; }
.al-l small { font-size: 12px; color: var(--muted); }
.al-n, .al-w { font-size: 13px; color: var(--muted); text-align: right; }
.al-v { font-weight: 800; text-align: right; white-space: nowrap; }

.lsz { display: flex; flex-direction: column; gap: 4px; }
.lsz-row { display: grid; grid-template-columns: 150px 1fr 30px 90px; gap: 12px; align-items: center; padding: 7px 0; }
.lsz-l b { display: block; font-size: 13.5px; }
.lsz-l small { font-size: 12px; color: var(--muted); }
.lsz-bar { height: 10px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.lsz-bar span { display: block; height: 100%; border-radius: 99px; min-width: 2px; }
.lsz-bar .ok { background: var(--pos); }
.lsz-bar .mid { background: var(--warn); }
.lsz-bar .bad { background: var(--neg); }
.lsz-n { font-weight: 800; text-align: right; }
.lsz-v { font-size: 13px; font-weight: 700; text-align: right; white-space: nowrap; }
@media (max-width: 520px) {
  .lsz-row { grid-template-columns: 1fr 26px 80px; }
  .lsz-bar { grid-column: 1 / -1; order: 3; }
  .al-row { grid-template-columns: 1fr auto auto; }
  .al-n { display: none; }
}
.rc-item.bad:has(.rc-v.pos) b { color: var(--warn); }
/* grid children must be allowed to shrink, so wide tables scroll inside their card instead of stretching it */
.grid-2 > *, .rc-cols > *, .tr-pair > *, .edges > * { min-width: 0; }
.tbl.trend { min-width: 440px; }
@media (max-width: 520px) { .tbl.trend .cbar { display: none; } }
.hero-bar > *, .hb-quick { min-width: 0; max-width: 100%; }
.cg-stats.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1000px) { .cg-stats.five { grid-template-columns: 1fr 1fr; } .cg-stats.five > :first-child { grid-column: 1 / -1; } }
.cg-stat small { white-space: normal; }

/* =================== v5: review round (planner guard, trades table, detail page, analyse links) =================== */
.pchip.over { color: var(--neg); border-style: dashed; background: transparent; }
.pl-out.empty.bad { background: var(--neg-bg); }
.pl-out.empty.bad .po-s { color: var(--neg); font-weight: 650; }
.n-only { display: none; }
@media (max-width: 760px) { .w-only { display: none; } .n-only { display: inline; } }

/* trades: sortable headers, quiet clean mark, wrapped filters, focus bar */
.th-sort { display: inline-flex; align-items: center; gap: 3px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; min-width: 0; }
.th-sort i { font-style: normal; opacity: .4; font-size: 11px; }
.th-sort:hover { color: var(--text); }
.th-sort.on { color: var(--text); }
.th-sort.on i { opacity: 1; color: var(--accent); }
.rule.okq { color: var(--muted); background: transparent; padding: 0 4px; font-size: 14px; opacity: .6; }
a.trow:hover .rule.okq { opacity: 1; color: var(--pos); }
@media (min-width: 900px) { .tbar-filters { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; } }
.focus-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 12px; background: var(--info-bg); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 14px; }
.fb-cap { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.focus-bar b { font-weight: 750; }
.focus-bar .icon-btn { margin-left: auto; }

/* chip groups on day and journal rows */
.chips { gap: 4px 12px; }
.chipgrp { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.chipgrp i { font-style: normal; font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-right: 2px; }

/* today */
.tr-pair > :only-child { grid-column: 1 / -1; }
.wk-disc { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.wk-disc b { font-size: 15px; color: var(--text); }
.wk-disc b.pos { color: var(--pos); }
.wk-disc b.neg { color: var(--neg); }
.wk-disc i { font-style: normal; font-weight: 800; }

/* trade detail */
.td-hero { display: flex; flex-direction: column; gap: 16px; padding: 20px; }
.td-top { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.td-title { flex: 1; min-width: 200px; }
.td-title h2 { font-size: 20px; }
.td-when { font-size: 13px; margin-top: 2px; }
.td-title .chips { margin-top: 8px; }
.td-verdict { font-size: 13.5px; font-weight: 800; padding: 7px 14px; border-radius: 12px; white-space: nowrap; }
.td-verdict.ok { color: var(--pos); background: var(--pos-bg); }
.td-verdict.bad { color: var(--neg); background: var(--neg-bg); }
.td-verdict.open { color: var(--accent); background: var(--info-bg); }
.td-net { font-size: 40px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.td-sub { font-size: 13.5px; color: var(--muted); margin-top: 4px; }
.td-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.td-stat { background: var(--surface-2); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.td-stat > span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.td-stat b { display: block; font-size: 17px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-stat small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
@media (max-width: 640px) { .td-stats { grid-template-columns: 1fr 1fr; } .td-net { font-size: 34px; } .td-hero { padding: 16px; } }
.td-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.td-jrow { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.45; }
.td-jrow div { white-space: pre-wrap; }
.td-jrow:first-child { border-top: 0; padding-top: 0; }
.td-jrow span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 3px; }
.td-actions { flex-wrap: wrap; }
.td-actions .btn { min-width: 0; }
.td-spacer { flex: 1; }
body[data-route="detail"] .fab { display: none; }
@media (max-width: 899px) { body[data-route="detail"] .savebar { bottom: calc(var(--nav-h) + 10px + env(safe-area-inset-bottom)); } }

/* form: after-the-trade group */
.jgroup { border: 1px dashed var(--border); border-radius: 14px; padding: 0 14px; }
.jgroup summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px; min-height: 46px; flex-wrap: wrap; }
.jgroup summary::-webkit-details-marker { display: none; }
.jgroup summary::before { content: '›'; color: var(--muted); font-size: 20px; line-height: 1; transition: transform .15s; }
.jgroup[open] summary::before { transform: rotate(90deg); }
.jgroup summary b { font-size: 14px; }
.jgroup-body { display: flex; flex-direction: column; gap: 14px; padding: 4px 0 14px; }

/* analyse: every number opens its trades */
.rlink { cursor: pointer; }
tr.rlink:hover td { background: var(--surface-2); }
tr.rlink td:first-child::after { content: ' ›'; color: var(--accent); opacity: 0; }
tr.rlink:hover td:first-child::after { opacity: 1; }
tr.early td { opacity: .55; }
.tbl-note { margin: 8px 0 0; }
li.rc-item.rlink:hover b { color: var(--accent); }
.cmp-row.rlink:hover .cmp-l b, .lsz-row.rlink:hover b, .al-row.rlink:hover b { color: var(--accent); }
.edge.rlink:hover { outline: 1.5px solid var(--accent); }
.cmp-note .link { cursor: pointer; }
/* overview: leaks and fixes side by side, what works below them */
.rc-col.bad { order: 1; }
.rc-col.fix { order: 2; }
.rc-col.good { order: 3; }
@media (min-width: 1001px) {
  .rc-cols { grid-template-columns: 1fr 1fr; }
  .rc-col.good { grid-column: 1 / -1; }
  .rc-col.good .rc-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
  .rc-col.good .rc-item:nth-child(-n+2) { border-top: 0; }
}

/* checklist fold */
.checklist-card.folded .ck-items, .checklist-card.folded .ck-edit { display: none; }
.ck-head-r { display: flex; align-items: center; gap: 12px; }
.ck-toggle { border: 0; background: none; padding: 0; cursor: pointer; }
.pl-out.empty.bad .po-v { color: var(--neg); opacity: .6; }
.keys { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--muted); align-items: center; justify-content: flex-end; }
kbd { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: 600 12px/18px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: center; margin-right: 2px; }
.keys { max-width: 250px; }

/* =================== Journal tab v2: timeline + habit + lessons =================== */
.jl { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 1000px) {
  .jl { grid-template-columns: minmax(0, 1.75fr) minmax(290px, 1fr); grid-template-rows: max-content 1fr; grid-template-areas: 'main side' 'main lessons'; }
  .jl-main { grid-area: main; }
  .jl-side { grid-area: side; }
  .jl-lessons { grid-area: lessons; }
}
@media (max-width: 999px) { .jl-side { order: -1; } }
.jl-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jl-month { font-size: 11.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 12px 6px 4px; }
.jl-main > .jl-month:first-child { padding-top: 2px; }

.je { --mc: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.je[data-m="1"] { --mc: var(--neg); }
.je[data-m="2"] { --mc: var(--warn); }
.je[data-m="3"] { --mc: var(--pos); }
.je[data-m="4"] { --mc: var(--accent); }
.je-head { display: grid; grid-template-columns: 40px auto minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.je-head:hover .je-date b { color: var(--accent); }
.je-mood { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; line-height: 1; background: color-mix(in srgb, var(--mc) 14%, var(--surface-2)); }
.je-mood:empty::after { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--border); }
.je-date { white-space: nowrap; }
.je-date b { font-size: 15px; display: block; }
.je-date small { display: block; font-size: 11px; color: var(--accent); font-weight: 700; margin-top: -1px; }
.je-meta { font-size: 13px; color: var(--muted); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.je-net { font-weight: 800; font-size: 16px; white-space: nowrap; text-align: right; }
.je-note { margin: 12px 0 0; padding: 10px 14px; border-left: 3px solid var(--mc); background: var(--surface-2); border-radius: 0 12px 12px 0; white-space: pre-wrap; font-size: 14.5px; line-height: 1.5; }
.je-trades { display: flex; flex-direction: column; margin-top: 8px; }
.je.slim { padding: 6px 10px; background: color-mix(in srgb, var(--surface) 55%, transparent); box-shadow: none; border-color: transparent; }
.je.slim:hover { background: var(--surface-2); }
.je.slim .je-head { grid-template-columns: 28px auto minmax(0, 1fr) auto; gap: 10px; }
.je.slim .je-mood { width: 28px; height: 28px; border-radius: 8px; font-size: 16px; }
.je.slim .je-date b { font-size: 13.5px; }
.je.slim .je-net { font-size: 14px; }
.je.slim + .je.slim { margin-top: -4px; }

.jt { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--border); border-radius: 0; }
.jt:hover .jt-title { color: var(--accent); }
.jt .mbadge.xs { margin-top: 1px; }
.jt-main { min-width: 0; }
.jt-title { font-weight: 700; font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.jt-sub { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.jt-x { font-style: normal; color: var(--neg); font-weight: 800; }
.jt-line { font-size: 13.5px; margin-top: 4px; line-height: 1.45; color: var(--muted); }
.jt-line span { font-size: 10.5px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 6px; }
.jt-line.lesson { color: var(--text); }
.jt-line.lesson span { color: var(--accent); }
.jt .chips { margin-top: 5px; }
.jt-right { text-align: right; }
.jt-right b { display: block; font-size: 15px; font-weight: 800; white-space: nowrap; }
.jt-right small { font-size: 12px; color: var(--muted); }

.jl-cov { display: flex; flex-direction: column; gap: 6px; }
.jl-cov-l { font-size: 14px; }
.jl-cov-l b { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.jl-moods { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 14px 0 4px; }
.jl-mood { --mc: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 2px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--surface); font-size: 11.5px; color: var(--muted); cursor: pointer; }
.jl-mood[data-m="1"] { --mc: var(--neg); }
.jl-mood[data-m="2"] { --mc: var(--warn); }
.jl-mood[data-m="3"] { --mc: var(--pos); }
.jl-mood[data-m="4"] { --mc: var(--accent); }
.jl-mood em { font-style: normal; font-size: 20px; line-height: 1.2; filter: grayscale(.4); }
.jl-mood b { color: var(--text); font-size: 15px; }
.jl-mood:hover { border-color: color-mix(in srgb, var(--mc) 55%, var(--border)); }
.jl-mood:hover em, .jl-mood.on em { filter: none; }
.jl-mood.on { border-color: var(--mc); background: color-mix(in srgb, var(--mc) 12%, var(--surface)); color: var(--text); }
.jl-strip-l { display: flex; justify-content: space-between; margin-top: 12px; }
.jl-strip { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
.jl-cell { --mc: var(--border); width: 14px; height: 14px; border-radius: 4px; background: var(--mc); display: block; }
.jl-cell[data-m="1"] { --mc: var(--neg); }
.jl-cell[data-m="2"] { --mc: var(--warn); }
.jl-cell[data-m="3"] { --mc: var(--pos); }
.jl-cell[data-m="4"] { --mc: var(--accent); }
.jl-cell:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.jl-stats { display: flex; flex-direction: column; gap: 5px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.jl-stats b { color: var(--text); font-weight: 750; }

.jl-llist { display: flex; flex-direction: column; }
.jl-lesson { display: block; padding: 10px 0; border-top: 1px solid var(--border); }
.jl-llist > .jl-lesson:first-child { border-top: 0; padding-top: 0; }
.jl-lesson:hover p { color: var(--accent); }
.jl-sym { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 13.5px; }
.jl-sym small { font-weight: 600; color: var(--muted); white-space: nowrap; }
.jl-sym small i { font-style: normal; font-weight: 700; }
.jl-lesson p { margin: 3px 0 0; font-size: 13.5px; line-height: 1.45; }
.jl-lessons > .btn.tiny { margin-top: 10px; }
.jl-nudge { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: var(--info-bg); font-size: 13px; line-height: 1.4; }
.jl-nudge .btn.tiny { flex: none; margin: 0; background: var(--surface); }
@media (max-width: 520px) {
  .je-head { grid-template-columns: 34px auto minmax(0, 1fr) auto; gap: 8px; }
  .je-mood { width: 34px; height: 34px; font-size: 19px; }
  .je { padding: 12px 12px; }
}

/* =================== back button: a real button that names where it goes =================== */
.top-left { grid-column: 1; }
.top h1 { grid-column: 2; }
.top-actions { grid-column: 3; margin-left: 8px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 2px; height: 38px; padding: 0 13px 0 8px; margin-right: 10px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-weight: 650; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); }
.back-btn:active { transform: scale(.97); }
@media (max-width: 520px) {
  .back-btn { width: 38px; padding: 0; justify-content: center; margin-right: 8px; }
  .back-btn span { display: none; }
}

/* =================== Analyse: Results + Improve =================== */
.rc-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-content: center; }
.rk { background: var(--surface-2); border-radius: 12px; padding: 11px 13px; min-width: 0; }
.rk > span { font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rk b { display: block; font-size: 20px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.rk small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.rc-bridge { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 8px 12px; border-radius: 10px; background: var(--neg-bg); color: var(--neg); font-weight: 650; font-size: 13.5px; transition: filter .12s; }
.rc-bridge.ok { background: var(--pos-bg); color: var(--pos); }
.rc-bridge:hover { filter: brightness(1.12); }
.rc-verdict.big { font-size: 21px; font-weight: 700; line-height: 1.35; margin: 6px 0 10px; letter-spacing: -.01em; }
.rc-ok { margin: 8px 0 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.grid-2 > :only-child { grid-column: 1 / -1; }

/* =================== sidebar theme switch =================== */
.nav-theme { display: none; }
@media (min-width: 900px) {
  .nav-theme { display: flex; gap: 2px; margin-top: auto; padding: 3px; border-radius: 12px; background: var(--surface-2); }
  .nav-theme button {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; padding: 6px 2px; border: 0; border-radius: 9px;
    background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; transition: background .12s, color .12s;
  }
  .nav-theme button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .nav-theme button:hover { color: var(--text); }
  .nav-theme button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow), 0 0 0 1px var(--border); }
}

/* =================== review round 2 =================== */
.hero .status-pill.closed { --sc: var(--muted); }
.hero-pills { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.sync-hint { font-size: 11.5px; font-weight: 650; color: var(--muted); animation: pulse 1s infinite; }
.rc-total.luck span small { display: block; font-size: 11.5px; font-weight: 500; }
.rc-total.luck:hover span { color: var(--accent); }
.rc-total.strong { border-top: 1px solid var(--border); color: var(--text); }
tr.na td { opacity: .55; }
.trow { grid-template-columns: 22px minmax(170px, 2.2fr) 0.8fr 1.5fr 1.5fr 0.8fr 1.1fr 196px; }
.tc-rule { flex-wrap: wrap; gap: 4px; }
.rule.more { padding: 0 7px; }
@media (max-width: 1100px) and (min-width: 761px) { .trow { grid-template-columns: 22px minmax(140px, 2fr) 0.8fr 1.4fr 1.4fr 1fr 150px; } }
.td-nudge { display: block; margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--info-bg); color: var(--accent); font-size: 13.5px; font-weight: 650; line-height: 1.4; }
.td-nudge:hover { filter: brightness(1.1); }
.rk-vs { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 7px; text-transform: uppercase; letter-spacing: .05em; vertical-align: 2px; }
