/* ============================================================
   Trading Journal — world-class design system
   ============================================================ */
@font-face {
  font-family: "Inter";
  src: url("/fonts/InterVariable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}
:root {
  --bg: #080a0e;
  --bg-elev: #0e1117;
  --panel: #12161d;
  --panel-2: #171c25;
  --panel-3: #1d232e;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);
  --text: #eaf0f7;
  --muted: #8a97a9;
  --faint: #5c6675;
  --accent: #5b8cff;
  --accent-2: #7b6cff;
  --accent-soft: rgba(91, 140, 255, .14);
  --green: #2fd07b;
  --green-soft: rgba(47, 208, 123, .14);
  --red: #ff5d5d;
  --red-soft: rgba(255, 93, 93, .14);
  --amber: #f5b544;
  --shadow: 0 8px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, .5);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  margin: 0; color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.55;
  background:
    radial-gradient(900px 500px at 78% -8%, rgba(91, 140, 255, .10), transparent 60%),
    radial-gradient(700px 500px at 0% 0%, rgba(123, 108, 255, .07), transparent 55%),
    var(--bg);
  background-attachment: fixed;
}
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 20px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #2a323f; background-clip: padding-box; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--red); margin-top: 8px; font-size: 13px; }
.ok { color: var(--green); }
a { color: var(--accent); text-decoration: none; }

/* Typography */
h1 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 12px; margin: 0 0 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-weight: 600; }
label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; font-weight: 500; }

/* Panels */
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent), var(--panel);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}

/* Form controls */
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 9px 12px; width: 100%; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 54px; }
select { cursor: pointer; }

button {
  width: auto; cursor: pointer; font-weight: 600; padding: 10px 18px; border: 1px solid transparent;
  background: linear-gradient(180deg, var(--accent), #4f7ef0); color: #fff;
  box-shadow: 0 4px 14px rgba(91, 140, 255, .3);
}
button:hover { filter: brightness(1.07); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.secondary { background: var(--panel-2); border-color: var(--border-strong); color: var(--text); box-shadow: none; font-weight: 500; }
button.secondary:hover { background: var(--panel-3); filter: none; }
button.danger { background: transparent; border-color: rgba(255, 93, 93, .4); color: var(--red); box-shadow: none; font-weight: 500; }
button.danger:hover { background: var(--red-soft); filter: none; }
button:disabled { opacity: .45; cursor: default; transform: none; filter: none; box-shadow: none; }

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); margin: 0; font-size: 13px; cursor: pointer; }
.toggle input { width: auto; }
input[type="checkbox"] { width: auto; accent-color: var(--accent); }

/* Login */
#login {
  max-width: 380px; margin: 14vh auto; padding: 32px; text-align: left;
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), transparent), var(--panel);
  border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
}
#login h2 { font-size: 20px; color: var(--text); text-transform: none; letter-spacing: -.01em; margin-bottom: 4px; }

/* App shell */
#app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent), rgba(14, 17, 23, .8);
  backdrop-filter: blur(12px); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh;
}
.brand {
  font-size: 18px; font-weight: 800; letter-spacing: -.02em; padding: 20px 20px 18px; display: flex; align-items: center; gap: 10px;
}
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 4px 14px rgba(91, 140, 255, .4);
}
.brand span { background: linear-gradient(90deg, #fff, #b9c6ff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
#nav { display: flex; flex-direction: column; padding: 8px 12px; gap: 3px; flex: 1; }
#nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--muted);
  cursor: pointer; font-size: 14px; font-weight: 500; transition: background .14s, color .14s;
}
#nav a svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
#nav a:hover { background: var(--panel-2); color: var(--text); }
#nav a.active { background: var(--accent-soft); color: #cfe0ff; }
#nav a.active svg { opacity: 1; }
/* Desktop: the "More" toggle is hidden and the overflow group flattens into the column. */
#nav a.nav-more-toggle { display: none; }
.nav-overflow { display: contents; }
/* Section headers that group the (many) nav items. */
.nav-group-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--faint); font-weight: 700; padding: 15px 12px 6px; user-select: none; }
.nav-primary-title { padding-top: 2px; }
.side-foot { padding: 14px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.content { flex: 1; min-width: 0; padding: 26px 40px; max-width: 1760px; animation: fade .25s ease; }
.view { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 20px; }

/* Stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat {
  position: relative; overflow: hidden; padding: 16px 18px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent), var(--panel);
  border: 1px solid var(--border); transition: transform .16s, border-color .16s;
}
.stat:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.stat::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); opacity: .5; }
.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value.pos { color: var(--green); } .stat .value.neg { color: var(--red); }

/* Pills & chips */
.pill { display: inline-flex; align-items: center; font-size: 12px; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); font-weight: 500; }
.pill.high, .pill.pass, .pill.win { color: var(--green); border-color: rgba(47, 208, 123, .35); background: var(--green-soft); }
.pill.medium, .pill.unclear { color: var(--amber); border-color: rgba(245, 181, 68, .35); background: rgba(245, 181, 68, .12); }
.pill.low, .pill.fail, .pill.loss, .pill.skip { color: var(--red); border-color: rgba(255, 93, 93, .35); background: var(--red-soft); }
.chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; font-size: 12px; }

/* Capture */
.drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.drop:hover, .drop.hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.thumbs img { max-height: 96px; border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--panel-3); border-top-color: var(--accent); border-radius: 50%; animation: sp .7s linear infinite; vertical-align: middle; }
@keyframes sp { to { transform: rotate(360deg); } }
.box { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 8px 0; font-size: 13px; }
.box .sec { color: var(--faint); text-transform: uppercase; font-size: 11px; letter-spacing: .08em; margin-top: 10px; font-weight: 600; }
.box .sec:first-child { margin-top: 0; }
.k { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; }
.check .v { flex-shrink: 0; width: 52px; text-align: center; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; user-select: none; }
thead th { position: sticky; top: 0; }
tr.clickable { cursor: pointer; transition: background .12s; }
tr.clickable:hover td { background: var(--panel-2); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--green); } .neg { color: var(--red); }
.filters { margin-bottom: 14px; flex-wrap: wrap; align-items: center; gap: 10px; }
.filters select, .filters input { width: auto; }
.filters select { min-width: 150px; }

/* Trade list rows */
.trade { border-top: 1px solid var(--border); padding: 13px 0; transition: background .12s; }
.trade:first-child { border-top: none; }
.trade.clickable { cursor: pointer; border-radius: 8px; padding: 13px 10px; margin: 0 -10px; }
.trade.clickable:hover { background: var(--panel-2); }
.trade .head { display: flex; align-items: center; gap: 10px; }
.trade .ticker { font-weight: 700; font-size: 15px; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-grid.with-week { grid-template-columns: repeat(7, 1fr) 0.92fr; }
.cal-week { min-height: 74px; border: 1px dashed var(--border-strong); border-radius: 11px; padding: 8px; background: linear-gradient(180deg, rgba(255,255,255,.02), transparent); display: flex; flex-direction: column; }
.cal-week.empty-week { border-style: solid; border-color: var(--border); opacity: .5; }
.cal-week-lbl { font-size: 10px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cal-week .p { font-weight: 750; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cal-dow { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; text-align: center; padding: 4px; }
.cal-cell { min-height: 74px; border: 1px solid var(--border); border-radius: 11px; padding: 8px; background: var(--panel-2); transition: transform .12s; }
.cal-cell:not(.empty):hover { transform: translateY(-2px); }
.cal-click { cursor: pointer; }
.cal-cell.empty { background: transparent; border: none; }
.cal-cell .d { font-size: 11px; color: var(--faint); font-weight: 600; }
.cal-cell .p { font-weight: 750; margin-top: 6px; font-variant-numeric: tabular-nums; }
.cal-cell.win { background: var(--green-soft); border-color: rgba(47, 208, 123, .35); }
.cal-cell.loss { background: var(--red-soft); border-color: rgba(255, 93, 93, .35); }

/* Tag groups (auto vs manual) */
.tag-group { margin-bottom: 14px; }
.tag-group-title { font-size: 12px; font-weight: 600; color: var(--muted); margin: 4px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }

/* Setups */
.setup-item { border-top: 1px solid var(--border); padding: 14px 0; }
.setup-item:first-child { border-top: none; }

/* Charts */
.equity-svg { width: 100%; height: 150px; display: block; }
.equity-wrap { position: relative; }
.eq-lbl { position: absolute; left: 0; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; background: var(--panel); padding: 0 4px; border-radius: 3px; pointer-events: none; }
.eq-lbl.eq-zero { color: var(--muted); }
.eq-end { position: absolute; right: 2px; font-size: 12px; font-weight: 700; background: var(--panel); padding: 1px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; pointer-events: none; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(4, 6, 10, .72); backdrop-filter: blur(8px); display: flex; align-items: center; justify-content: center; padding: 4vh 3vw; overflow-y: auto; z-index: 40; animation: fade .18s ease; }
/* Full-screen premium trade cockpit */
.modal-card.wide { width: 94vw; max-width: 1500px; height: 92vh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, rgba(255,255,255,.03), transparent); flex-shrink: 0; }
.modal-head .mtitle { font-size: 18px; font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; }
.iconbtn { width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1; display: grid; place-items: center; }
.modal-scroll { flex: 1; overflow-y: auto; padding: 20px 24px; }
.td-left, .td-right { display: flex; flex-direction: column; gap: 14px; }
.tabs { display: flex; gap: 6px; }
.tab { background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 7px 16px; font-size: 13px; font-weight: 500; color: var(--muted); }
.tab.active { background: var(--accent-soft); color: #cfe0ff; border-color: transparent; }
.tabpane { display: flex; flex-direction: column; gap: 14px; }
/* Big chart stage on the right */
.chart-stage { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 260px; display: grid; place-items: center; }
.chart-stage .gallery { margin: 0; justify-content: center; }
.chart-stage .gallery img { max-height: 46vh; }
.modal-card.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; }
.shot-wrap img { cursor: zoom-in; }

/* Image lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.92); display: grid; place-items: center; z-index: 200; cursor: zoom-out; padding: 20px; animation: fade .15s ease; }
.lightbox img { max-width: 98vw; max-height: 96vh; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox .hint { position: fixed; top: 16px; right: 20px; color: var(--muted); font-size: 12px; }

/* Rule book */
.rule-item { border-top: 1px solid var(--border); padding: 13px 0; }
.rule-item:first-child { border-top: none; }
.rule-text { flex: 1; line-height: 1.5; }
.rule-check { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; font-size: 13px; color: var(--text); cursor: pointer; border-bottom: 1px solid var(--border); }
.rule-check:last-child { border-bottom: none; }
.rule-check input { width: auto; margin-top: 2px; }
.chip.clickable { cursor: pointer; } .chip.clickable:hover { border-color: var(--accent); }
/* AI-filled tag highlight */
.ai-filled input { border-color: rgba(91,140,255,.5); box-shadow: 0 0 0 2px var(--accent-soft); }
.ai-filled label::after { content: "AI"; font-size: 9px; font-weight: 700; color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.modal-card { background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent), var(--panel); border: 1px solid var(--border-strong); border-radius: 18px; padding: 24px; width: 100%; max-width: 1060px; box-shadow: var(--shadow-lg); }
.gallery { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.gallery img { max-height: 230px; border-radius: 10px; border: 1px solid var(--border); box-shadow: var(--shadow); }

/* Two-pane trade detail (TradeZella-style) */
.trade-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.td-stat { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.td-stat:last-child { border-bottom: none; }
.td-stat .k { color: var(--muted); }
.td-stat .v { font-weight: 600; font-variant-numeric: tabular-nums; }
.shot-wrap { position: relative; display: inline-block; margin: 4px; }
.shot-wrap img { max-height: 150px; border-radius: 8px; border: 1px solid var(--border); display: block; }
.shot-del { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; padding: 0; border-radius: 50%; background: rgba(0,0,0,.6); border: 1px solid var(--border-strong); color: #fff; font-size: 12px; }
.btn-file { display: inline-block; cursor: pointer; background: var(--panel-3); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 14px; font-size: 13px; font-weight: 500; }
.btn-file:hover { background: var(--panel-2); }
@media (max-width: 760px) { .trade-detail { grid-template-columns: 1fr; } }

/* ============================================================
   World-class layer — typography, motion, a11y, charts, feedback
   ============================================================ */
body { font-feature-settings: "cv11", "ss01", "tnum"; letter-spacing: -.006em; }

/* Accessible focus — keyboard only, never on mouse */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
button:focus-visible, .tab:focus-visible, #nav a:focus-visible { outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Motion — refined, with reduced-motion respect */
@media (prefers-reduced-motion: no-preference) {
  .view > .panel, .stat, .cal-cell:not(.empty), .insight { animation: rise .4s cubic-bezier(.2,.7,.2,1) backwards; }
  .stat-cards .stat:nth-child(2) { animation-delay: .04s; } .stat-cards .stat:nth-child(3) { animation-delay: .08s; }
  .stat-cards .stat:nth-child(4) { animation-delay: .12s; } .stat-cards .stat:nth-child(5) { animation-delay: .16s; }
  .stat-cards .stat:nth-child(6) { animation-delay: .2s; } .stat-cards .stat:nth-child(7) { animation-delay: .24s; }
  .stat-cards .stat:nth-child(8) { animation-delay: .28s; }
  .modal-card { animation: pop .22s cubic-bezier(.2,.8,.2,1); }
  .insight-cards .insight:nth-child(2){animation-delay:.06s} .insight-cards .insight:nth-child(3){animation-delay:.12s} .insight-cards .insight:nth-child(4){animation-delay:.18s}
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* Equity curve draw-in (line path only — has stroke; area path has none) */
.equity-svg path[stroke] { stroke-dasharray: var(--len, 2000); stroke-dashoffset: var(--len, 2000); animation: draw 1.1s ease forwards; }
@media (prefers-reduced-motion: reduce) { .equity-svg path[stroke] { animation: none; stroke-dashoffset: 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Toasts */
.toast-wrap { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--panel); border: 1px solid var(--border-strong); border-left: 3px solid var(--accent); border-radius: 11px; padding: 12px 16px; box-shadow: var(--shadow-lg); font-size: 13px; min-width: 220px; animation: toastIn .3s cubic-bezier(.2,.8,.2,1); }
.toast.ok { border-left-color: var(--green); } .toast.err { border-left-color: var(--red); }
.toast.hide { animation: toastOut .25s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

/* Styled confirm dialog */
.cdialog-back { position: fixed; inset: 0; background: rgba(4,6,10,.6); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; animation: fade .15s ease; }
.cdialog { background: var(--panel); border: 1px solid var(--border-strong); border-radius: 16px; padding: 22px; max-width: 400px; box-shadow: var(--shadow-lg); animation: pop .2s cubic-bezier(.2,.8,.2,1); }
.cdialog h3 { margin: 0 0 8px; font-size: 16px; }
.cdialog p { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.cdialog .row { justify-content: flex-end; }

/* Skeletons */
.skeleton { background: linear-gradient(100deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.sk-card { height: 84px; } .sk-row { height: 40px; margin-bottom: 8px; }

/* Bar charts (reports) */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 84px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .name { color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { position: relative; height: 22px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.bar-track .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.bar-fill { position: absolute; top: 0; bottom: 0; border-radius: 6px; animation: grow .7s cubic-bezier(.2,.8,.2,1); }
.bar-fill.pos { background: linear-gradient(90deg, rgba(47,208,123,.5), var(--green)); }
.bar-fill.neg { background: linear-gradient(90deg, var(--red), rgba(255,93,93,.5)); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
@keyframes grow { from { transform: scaleX(0); } }

/* Insight cards */
.insight-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.insight { background: linear-gradient(180deg, rgba(255,255,255,.02), transparent), var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px; }
.insight .cap { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.insight .big { font-size: 17px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.01em; }
.insight .sub { font-size: 12px; color: var(--muted); }

/* Empty states */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .icon { font-size: 34px; opacity: .5; margin-bottom: 8px; }
.empty-state .cta { margin-top: 14px; }

/* Responsive — refined */
@media (max-width: 820px) {
  #app { flex-direction: column; }
  .sidebar { position: sticky; bottom: 0; top: auto; order: 2; width: 100%; height: auto; flex-direction: column; border-right: none; border-top: 1px solid var(--border); z-index: 30; }
  .brand, .side-foot { display: none; }
  #nav { flex-direction: row; justify-content: space-around; padding: 6px; position: relative; }
  #nav a { flex-direction: column; align-items: center; gap: 3px; font-size: 10px; padding: 6px 8px; }
  #nav a span { display: block; }
  #nav a.nav-more-toggle { display: flex; }
  .nav-overflow { display: none; }
  #nav > .nav-group-title { display: none; }   /* hide the 'Trading' header in the bottom bar */
  #nav.more-open .nav-overflow .nav-group-title { display: block; padding: 12px 16px 3px; font-size: 11px; }
  #nav.more-open .nav-more-toggle { color: var(--text); background: var(--panel-2); }
  #nav.more-open .nav-overflow {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; bottom: 100%; left: 0; right: 0;
    background: var(--panel); border-top: 1px solid var(--border-strong);
    box-shadow: 0 -14px 34px rgba(0, 0, 0, .5); padding: 8px; z-index: 40;
  }
  #nav.more-open .nav-overflow a { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14px; padding: 12px 16px; }
  #nav.more-open .nav-overflow a svg { width: 18px; height: 18px; }
  .content { padding: 16px; order: 1; }
  .stat-cards, .insight-cards { grid-template-columns: repeat(2, 1fr); }
  .grid, .grid-2, .trade-detail { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 96px 1fr 66px; }
  .modal { padding: 0; } .modal-card.wide { width: 100vw; height: 100vh; border-radius: 0; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* ---------- Day View: multi-day feed + mini calendar ---------- */
.dayview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.day-feed { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.day-card { background: linear-gradient(180deg, rgba(255,255,255,.015), transparent), var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color .15s; }
.day-card.open { border-color: var(--border-strong); }
.day-card-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; cursor: pointer; transition: background .15s; }
.day-card-head:hover { background: rgba(255,255,255,.02); }
.day-chevron { color: var(--faint); font-size: 12px; width: 12px; }
.day-date { font-size: 15px; font-weight: 650; }
.day-pnl { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; }
.day-pnl.pos { color: var(--green); } .day-pnl.neg { color: var(--red); }
.day-pnl .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.day-note-btn { padding: 5px 12px; font-size: 12px; }
.day-card-summary { display: grid; grid-template-columns: 340px 1fr; gap: 22px; padding: 4px 18px 18px; align-items: center; }
.day-equity { min-width: 0; }
.day-equity .muted { font-size: 11px; }
.day-flat { display: flex; align-items: center; justify-content: center; height: 120px; font-size: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.day-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 10px; }
.day-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.day-metric .m-label { font-size: 11px; color: var(--muted); }
.day-metric .m-value { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.day-metric .m-value.pos { color: var(--green); } .day-metric .m-value.neg { color: var(--red); }
.day-card-expand { padding: 0 18px 18px; border-top: 1px solid var(--border); }
.day-card-expand table.day-trades { margin-top: 14px; }
.day-journal { margin-top: 14px; display: grid; gap: 10px; }

.day-side { position: sticky; top: 18px; }
.mini-cal-panel { padding: 16px; }
.mini-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.mini-cal-head strong { font-size: 14px; }
.mini-cal-head button { padding: 2px 11px; }
.mini-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mc-dow { text-align: center; font-size: 10px; color: var(--faint); font-weight: 600; padding-bottom: 2px; }
.mc-cell { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; font-size: 12px; border-radius: 6px; color: var(--muted); border: 1px solid transparent; }
.mc-cell.empty { visibility: hidden; }
.mc-cell.win { background: var(--green-soft); color: var(--green); border-color: rgba(47,208,123,.3); cursor: pointer; font-weight: 600; }
.mc-cell.loss { background: var(--red-soft); color: var(--red); border-color: rgba(255,93,93,.3); cursor: pointer; font-weight: 600; }
.mc-cell.win:hover, .mc-cell.loss:hover { filter: brightness(1.25); }
.mini-cal-legend { display: flex; gap: 14px; margin-top: 14px; font-size: 11px; color: var(--muted); }
.mini-cal-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.mini-cal-legend .lg-win { background: var(--green-soft); border: 1px solid rgba(47,208,123,.3); }
.mini-cal-legend .lg-loss { background: var(--red-soft); border: 1px solid rgba(255,93,93,.3); }

@media (max-width: 900px) {
  .dayview-grid { grid-template-columns: 1fr; }
  .day-side { position: static; order: -1; }
  .day-card-summary { grid-template-columns: 1fr; }
  .day-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Trade View: summary stat cards ---------- */
.trade-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 18px; }
.tcard { background: linear-gradient(180deg, rgba(255,255,255,.015), transparent), var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.tcard-label { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tcard-body { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; }
.tcard-main { min-width: 0; }
.tcard-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.tcard-value.pos { color: var(--green); } .tcard-value.neg { color: var(--red); }
.tcard-sub { font-size: 11px; margin-top: 2px; }
.tcard-viz { flex-shrink: 0; display: flex; align-items: center; }
.tcard-viz .spark { width: 150px; height: 46px; display: block; }
.viz-col { width: 150px; }
.seg-bar, .wl-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: var(--panel-3); }
.seg { height: 100%; }
.seg.win, .wl-win { background: var(--green); }
.seg.be { background: var(--faint); }
.seg.loss, .wl-loss { background: var(--red); flex: 1; }
.seg-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }

@media (max-width: 1100px) { .trade-summary { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .trade-summary { grid-template-columns: 1fr; } }

/* ---------- Notebook ---------- */
.notebook-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 18px; align-items: start; }
.nb-side { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; position: sticky; top: 18px; max-height: calc(100vh - 60px); display: flex; flex-direction: column; }
.nb-new { width: 100%; }
.nb-folders { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.nb-folder { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text); }
.nb-folder:hover { background: var(--panel-2); }
.nb-folder.active { background: var(--accent-soft); color: var(--text); }
.nb-count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nb-folder-sep { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); margin: 10px 4px 4px; font-weight: 600; }
.nb-list { overflow-y: auto; border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.nb-note { padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; border: 1px solid transparent; }
.nb-note:hover { background: var(--panel-2); }
.nb-note.active { background: var(--panel-2); border-color: var(--border-strong); }
.nb-note-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-star { color: var(--amber, #e3b341); margin-right: 4px; }
.nb-note-sub { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.nb-note-meta { font-size: 11px; margin-top: 3px; }

.nb-editor { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; min-height: 420px; }
.nb-ed-top { display: flex; align-items: center; gap: 12px; }
.nb-title { flex: 1; font-size: 22px; font-weight: 700; background: transparent; border: none; padding: 4px 0; color: var(--text); }
.nb-title:focus { outline: none; box-shadow: none; }
.nb-meta { font-size: 12px; margin: 6px 0 12px; }
.nb-daylink:empty { display: none; }
.nb-daylink-box { display: flex; align-items: center; gap: 12px; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; cursor: pointer; font-size: 13px; }
.nb-daylink-box:hover { background: var(--panel-3); }
.nb-dl-net { font-weight: 700; font-variant-numeric: tabular-nums; }
.nb-dl-net.pos { color: var(--green); } .nb-dl-net.neg { color: var(--red); }
.nb-dl-open { color: var(--accent); font-size: 12px; font-weight: 600; }
.nb-ed-controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.nb-ctl { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); font-weight: 500; margin: 0; }
.nb-ctl input { width: auto; min-width: 150px; }
.nb-toolbar { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.nb-toolbar button { background: transparent; border: 1px solid transparent; box-shadow: none; padding: 5px 9px; font-size: 13px; color: var(--muted); font-weight: 500; min-width: 30px; }
.nb-toolbar button:hover { background: var(--panel-2); color: var(--text); filter: none; }
.nb-tb-sep { width: 1px; align-self: stretch; background: var(--border); margin: 3px 4px; }
.nb-tpl { width: auto; padding: 5px 8px; font-size: 12px; height: auto; }
.nb-hl-ico { background: rgba(227,179,65,0.3); padding: 0 3px; border-radius: 2px; }
.nb-body { min-height: 320px; font-size: 15px; line-height: 1.7; color: var(--text); outline: none; }
.nb-body:empty::before { content: "Start writing…"; color: var(--faint); }
.nb-body ul, .nb-body ol { padding-left: 22px; margin: 8px 0; }
.nb-body a { color: var(--accent); text-decoration: underline; }
.nb-body h1 { font-size: 24px; font-weight: 700; margin: 14px 0 8px; color: var(--text); text-transform: none; letter-spacing: normal; }
.nb-body h2 { font-size: 19px; font-weight: 650; margin: 12px 0 6px; color: var(--text); text-transform: none; letter-spacing: normal; }
.nb-body p { margin: 6px 0; }

@media (max-width: 900px) {
  .notebook-grid { grid-template-columns: 1fr; }
  .nb-side { position: static; max-height: none; }
}

/* ---------- Session Tape ---------- */
.tape-fab { position: fixed; right: 26px; bottom: 26px; width: 54px; height: 54px; border-radius: 50%; border: none; padding: 0; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 24px rgba(91, 140, 255, .45); cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 45; transition: transform .12s; }
.tape-fab:hover { transform: translateY(-2px) scale(1.04); filter: none; }
.tape-fab svg { width: 22px; height: 22px; }
.tape-pop { position: fixed; right: 26px; bottom: 92px; width: 370px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 14px; z-index: 46; animation: pop .18s cubic-bezier(.2, .8, .2, 1); }
.tape-pop-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.tape-pop textarea, .tape-add-row textarea { width: 100%; resize: vertical; }
.tape-pop-foot, .tape-add-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }

.tape-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.mood-chip { border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--muted); border-radius: 20px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer; box-shadow: none; transition: background .12s, color .12s; }
.mood-chip:hover { filter: none; background: var(--panel-3); color: var(--text); }
.mood-chip.sm { padding: 2px 9px; font-size: 11px; cursor: default; }
.mood-chip.good.on { color: var(--green); background: var(--green-soft); border-color: rgba(47, 208, 123, .4); }
.mood-chip.bad.on { color: var(--red); background: var(--red-soft); border-color: rgba(255, 93, 93, .4); }
.mood-chip.neutral.on { color: var(--text); background: var(--panel-3); border-color: var(--border-strong); }

.tape-intensity { display: flex; align-items: center; gap: 5px; }
.int-lbl { font-size: 11px; color: var(--faint); margin-right: 2px; }
.int-dot { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--border-strong); cursor: pointer; }
.int-dot.on { background: var(--accent); border-color: var(--accent); }

.tape-add-panel { padding: 16px 18px; }
.tape-add-row { display: flex; gap: 10px; align-items: flex-start; }
.tape-add-row textarea { flex: 1; }
.tape-add-row button { flex-shrink: 0; }

.tape-day { padding: 14px 18px; }
.tape-day-head { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.tape-line { display: flex; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.tape-line:first-of-type { border-top: none; }
.tape-time { width: 44px; flex-shrink: 0; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 3px; }
.tape-line.bad .tape-time { color: var(--red); }
.tape-line.good .tape-time { color: var(--green); }
.tape-body { flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.tape-text { font-size: 14px; line-height: 1.5; }
.tape-del { opacity: 0; background: transparent; border: none; color: var(--faint); cursor: pointer; box-shadow: none; padding: 2px 6px; font-size: 12px; flex-shrink: 0; }
.tape-line:hover .tape-del { opacity: 1; }
.tape-del:hover { color: var(--red); filter: none; background: transparent; }
/* Touch devices have no hover — keep the delete control visible so tape notes are deletable on a phone. */
@media (hover: none) { .tape-del { opacity: .6; } }
/* A screenshot whose file is missing/failed: show a labeled placeholder instead of the browser's broken-image glyph. */
img.img-broken { position: relative; min-width: 84px; min-height: 60px; background: var(--panel-2, #1a1d24); border: 1px dashed var(--faint); border-radius: 8px; }
img.img-broken::after { content: "image unavailable"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--faint); padding: 4px; text-align: center; }

@media (max-width: 820px) {
  .tape-fab { bottom: 84px; right: 16px; }
  .tape-pop { bottom: 148px; right: 16px; left: 16px; width: auto; max-width: none; }
}

/* ---------- Missed trades ---------- */
.missed-thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.missed-thumb { height: 92px; width: auto; max-width: 220px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border-strong); cursor: pointer; transition: transform .12s; }
.missed-thumb:hover { transform: scale(1.03); }
.missed-card { padding: 14px 18px; }
.missed-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.missed-date { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.missed-note { font-size: 14px; line-height: 1.55; margin-top: 10px; }
.missed-ai:empty { display: none; }
.missed-ai { margin-top: 12px; }
.verdict-badge { font-size: 11px; font-weight: 700; padding: 2px 10px; border-radius: 20px; border: 1px solid transparent; }
.verdict-badge.good { color: var(--green); background: var(--green-soft); border-color: rgba(47,208,123,.35); }
.verdict-badge.bad { color: var(--red); background: var(--red-soft); border-color: rgba(255,93,93,.35); }
.verdict-badge.neutral { color: var(--muted); background: var(--panel-3); border-color: var(--border-strong); }

/* ---------- Export dialog ---------- */
.export-dialog { max-width: 480px; text-align: left; }
.export-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* ---------- Reviews ---------- */
.rv-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-area { width: 100%; resize: vertical; font-size: 14px; line-height: 1.6; }
.rv-lbl.good { color: var(--green); } .rv-lbl.bad { color: var(--red); }
.rv-area.good { border-left: 3px solid rgba(47, 208, 123, .5); }
.rv-area.bad { border-left: 3px solid rgba(255, 93, 93, .5); }

/* Analyze-my-day (Phase 2) */
.tape-analyze-btn { padding: 5px 12px; font-size: 12px; }
.tape-analysis:empty { display: none; }
.tape-analysis { margin: 4px 0 12px; }
.tape-analyzing { padding: 12px 0; color: var(--muted); font-size: 13px; }
.ta-summary { font-size: 15px; line-height: 1.6; padding: 12px 14px; background: var(--accent-soft); border: 1px solid rgba(91, 140, 255, .25); border-radius: 10px; margin-bottom: 12px; }
.ta-cards { display: grid; gap: 10px; }
.ta-card { background: var(--panel-2); border-left: 3px solid var(--faint); border-radius: 0 10px 10px 0; padding: 10px 14px; }
.ta-card.good { border-left-color: var(--green); }
.ta-card.bad { border-left-color: var(--red); }
.ta-card.neutral { border-left-color: var(--accent); }
.ta-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ta-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.ta-trade { font-size: 11px; font-weight: 700; color: var(--text); background: var(--panel-3); padding: 1px 8px; border-radius: 5px; }
.ta-title { font-weight: 650; font-size: 14px; margin-bottom: 3px; }
.ta-detail { font-size: 13px; color: var(--muted); line-height: 1.55; }
.ta-foot { font-size: 11px; margin-top: 10px; }

/* ---------- Video Diary ---------- */
.vid-kind-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.seg-toggle { display: inline-flex; background: var(--panel-2, #1a1d24); border: 1px solid var(--border, #2a2e37); border-radius: 10px; overflow: hidden; }
.seg-toggle button { background: transparent; border: none; color: var(--muted); padding: 7px 14px; font-size: 13px; cursor: pointer; box-shadow: none; }
.seg-toggle button.on { background: var(--accent, #4f7cff); color: #fff; }
.vid-record-cta { font-size: 15px; padding: 14px 20px; width: 100%; }
.vid-record-cta .muted { color: rgba(255,255,255,.7); font-size: 13px; }
.vid-stage, .vid-review { margin-top: 12px; }
.vid-preview { width: 100%; max-height: 46vh; background: #000; border-radius: 12px; aspect-ratio: 16/10; object-fit: cover; }
.vid-controls { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.vid-timer { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 650; min-width: 52px; }
.vid-star-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--muted); cursor: pointer; }
.vid-storage-note { font-size: 12px; margin-top: 14px; line-height: 1.5; }
.vid-progress { height: 6px; background: var(--panel-2, #1a1d24); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.vid-progress-bar { height: 100%; width: 0; background: var(--accent, #4f7cff); transition: width .2s; }
.vid-filters { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; flex-wrap: wrap; }
.vid-search { flex: 1; min-width: 180px; }
.vid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.vid-card { background: var(--panel, #16181e); border: 1px solid var(--border, #2a2e37); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; position: relative; }
.vid-thumb { position: relative; aspect-ratio: 16/10; background: #000; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.vid-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vid-noposter { font-size: 34px; opacity: .5; }
.vid-thumb .vid-play { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); border-radius: 50%; color: #fff; font-size: 18px; opacity: 0; transition: opacity .15s; }
.vid-thumb:hover .vid-play, .vid-thumb:focus-visible .vid-play { opacity: 1; }
.vid-dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; font-variant-numeric: tabular-nums; }
.vid-body { padding: 10px 12px; flex: 1; }
.vid-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.vid-sub { font-size: 12px; }
.vid-sub .warn { color: var(--amber, #e0a341); }
.vid-note { font-size: 12px; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.vid-badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; }
.vid-badge.trading { background: rgba(79,124,255,.18); color: #8fb0ff; }
.vid-badge.life { background: rgba(90,200,140,.18); color: #7fdba9; }
.vid-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.vid-starbtn, .vid-delbtn { background: rgba(0,0,0,.55); border: none; color: #fff; width: 28px; height: 28px; border-radius: 7px; cursor: pointer; font-size: 14px; box-shadow: none; padding: 0; }
.vid-starbtn.on { color: #ffcf4d; }
.vid-delbtn:hover { color: var(--red, #ff5c5c); }
.vid-player-back .vid-player { max-width: 92vw; max-height: 82vh; border-radius: 12px; background: #000; }
@media (max-width: 700px) { .vid-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }
.linklike { background: none; border: none; color: var(--accent, #5b8cff); padding: 0; box-shadow: none; font-weight: 600; text-decoration: underline; cursor: pointer; width: auto; }
.linklike:hover { filter: brightness(1.15); transform: none; }
.vid-review-bar { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.vid-star-toggle { background: var(--panel-2, #171c25); border: 1px solid var(--border-strong, rgba(255,255,255,.13)); color: var(--muted); box-shadow: none; font-weight: 600; }
.vid-star-toggle.on { color: #ffcf4d; border-color: rgba(255,207,77,.5); background: rgba(255,207,77,.10); }
.vid-star-toggle:hover { filter: none; transform: none; background: var(--panel-3, #1d232e); }
.vid-details-toggle { display: inline-block; margin-top: 12px; font-size: 13px; }

/* ---------- Backtest Lab ---------- */
.bt-capture-head { margin-bottom: 12px; }
.missed-thumb-wrap { position: relative; display: inline-block; }
.missed-thumb-wrap .shot-del { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.6); color: #fff; border: none; width: 20px; height: 20px; border-radius: 5px; font-size: 11px; padding: 0; cursor: pointer; box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bt-scorecards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; margin: 4px 0 18px; }
.bt-score { background: linear-gradient(180deg, rgba(255,255,255,.02), transparent), var(--panel, #12161d); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 12px; padding: 14px; cursor: pointer; transition: border-color .15s, transform .15s; }
.bt-score:hover { transform: translateY(-2px); border-color: var(--border-strong, rgba(255,255,255,.13)); }
.bt-score.on { border-color: var(--accent, #5b8cff); box-shadow: 0 0 0 1px var(--accent, #5b8cff); }
.bt-score-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.bt-score-name { font-weight: 700; font-size: 15px; }
.bt-score-nums { display: flex; gap: 14px; }
.bt-score-nums > div { flex: 1; }
.bt-num { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bt-num.pos { color: var(--green, #2fd07b); } .bt-num.neg { color: var(--red, #ff5d5d); }
.bt-lbl { font-size: 11px; color: var(--muted, #8a97a9); text-transform: uppercase; letter-spacing: .05em; }
.bt-score-conf { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.bt-score-foot { font-size: 11px; margin-top: 8px; }
.bt-conf { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--panel-2, #171c25); color: var(--muted, #8a97a9); }
.bt-conf.hot { background: var(--green-soft, rgba(47,208,123,.14)); color: var(--green, #2fd07b); }
.bt-list { display: flex; flex-direction: column; gap: 12px; }
.bt-item { display: flex; gap: 14px; background: var(--panel, #12161d); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 12px; padding: 12px; }
.bt-thumb { position: relative; width: 170px; flex-shrink: 0; aspect-ratio: 16/10; background: #000; border-radius: 8px; overflow: hidden; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 26px; }
.bt-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bt-multi { position: absolute; right: 5px; bottom: 5px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 5px; }
.bt-body { flex: 1; min-width: 0; }
.bt-item-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bt-strat-sel, .bt-out-sel { width: auto; padding: 5px 9px; font-size: 13px; }
.bt-badge { font-size: 12px; padding: 2px 9px; border-radius: 6px; font-weight: 600; }
.bt-badge.good { background: var(--green-soft, rgba(47,208,123,.14)); color: var(--green, #2fd07b); }
.bt-badge.bad { background: var(--red-soft, rgba(255,93,93,.14)); color: var(--red, #ff5d5d); }
.bt-badge.neutral { background: rgba(245,181,68,.15); color: var(--amber, #f5b544); }
.bt-badge.muted { background: var(--panel-2, #171c25); color: var(--muted, #8a97a9); }
.bt-meta { font-size: 12.5px; margin-bottom: 7px; }
.bt-conf-row { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.bt-read { font-size: 12.5px; line-height: 1.5; margin-bottom: 5px; }
.bt-item-controls { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.bt-item-controls button { padding: 6px 12px; font-size: 13px; }
@media (max-width: 640px) { .bt-item { flex-direction: column; } .bt-thumb { width: 100%; } }

/* ---------- Backups ---------- */
.bk-status-line { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.bk-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.bk-dot.good { background: var(--green, #2fd07b); box-shadow: 0 0 8px var(--green, #2fd07b); }
.bk-dot.bad { background: var(--red, #ff5d5d); box-shadow: 0 0 8px var(--red, #ff5d5d); }
.bk-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.bk-badge { font-size: 12px; padding: 3px 10px; border-radius: 7px; background: var(--panel-2, #171c25); color: var(--muted, #8a97a9); }
.bk-badge.on { background: var(--green-soft, rgba(47,208,123,.14)); color: var(--green, #2fd07b); }
.bk-warn { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; line-height: 1.5; color: var(--amber, #f5b544); background: rgba(245,181,68,.08); border: 1px solid rgba(245,181,68,.2); border-radius: 9px; padding: 10px 12px; }
.bk-warn code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.bk-list { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.bk-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--panel-2, #171c25); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 9px; }
.bk-name { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.bk-restore { padding: 6px 14px; font-size: 13px; }

/* Backtest bulk-read bar */
.bt-readbar { margin: 4px 0 14px; background: linear-gradient(180deg, rgba(91,140,255,.10), transparent), var(--panel-2, #171c25); border: 1px solid var(--accent-soft, rgba(91,140,255,.14)); border-radius: 10px; padding: 12px 14px; }
.bt-read-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; flex-wrap: wrap; }
.bt-read-row button { padding: 7px 14px; font-size: 13px; }
.bt-read-prog { height: 6px; background: var(--panel-3, #1d232e); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.bt-read-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent, #5b8cff), var(--accent-2, #7b6cff)); transition: width .3s; }
.bt-unread { color: var(--amber, #f5b544); }

/* ---------- Playbook Check ---------- */
.pb-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.pb-dates { display: flex; align-items: center; gap: 8px; }
.pb-dates input { width: auto; }
.pb-controls .warn, #pbMeta .warn { color: var(--amber, #f5b544); }
.pb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; margin-top: 16px; }
.pb-card { background: var(--panel, #12161d); border: 1px solid var(--border, rgba(255,255,255,.07)); border-radius: 12px; padding: 14px 16px; }
.pb-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.pb-strat { font-weight: 700; font-size: 15px; }
.pb-cols { display: flex; justify-content: flex-end; gap: 40px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-right: 4px; margin-bottom: 4px; }
.pb-col-b { flex: 0 0 auto; } .pb-col-l { flex: 0 0 auto; }
.pb-stat { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-top: 1px solid var(--border, rgba(255,255,255,.06)); }
.pb-stat-k { font-size: 13px; color: var(--muted); }
.pb-stat-vals { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-weight: 650; }
.pb-bt { color: var(--text); }
.pb-arrow { font-size: 11px; color: var(--faint); font-weight: 400; }
.pb-live.good { color: var(--green, #2fd07b); }
.pb-live.bad { color: var(--red, #ff5d5d); }
.pb-emotions { margin-top: 10px; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pb-emo { background: var(--red-soft, rgba(255,93,93,.14)); color: #ff9d9d; padding: 1px 8px; border-radius: 6px; }
.pb-summary { font-size: 14.5px; line-height: 1.6; margin-bottom: 14px; }
.pb-verdict-item { border-left: 3px solid var(--border-strong); padding: 8px 0 8px 14px; margin-bottom: 12px; }
.pb-verdict-item.good { border-color: var(--green, #2fd07b); }
.pb-verdict-item.bad { border-color: var(--red, #ff5d5d); }
.pb-verdict-item.neutral { border-color: var(--amber, #f5b544); }
.pb-vi-head { margin-bottom: 4px; }
.pb-vi-gap, .pb-vi-cause, .pb-vi-fix { font-size: 13px; line-height: 1.55; margin-top: 3px; }
.pb-vi-cause { color: var(--muted); }
.pb-badge { font-size: 11px; padding: 1px 8px; border-radius: 6px; }
.pb-badge.good { background: var(--green-soft, rgba(47,208,123,.14)); color: var(--green); }
.pb-badge.bad { background: var(--red-soft, rgba(255,93,93,.14)); color: var(--red); }
.pb-badge.neutral { background: rgba(245,181,68,.15); color: var(--amber); }
.pb-badge.muted { background: var(--panel-2); color: var(--muted); }
.pb-focus { margin-top: 10px; font-size: 13.5px; }
.pb-focus ul { margin: 6px 0 0; padding-left: 20px; }

/* Executions table (Time / Price / Qty / Gross — TradeZella-style) */
.exec-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 13px; }
.exec-table th { text-align: right; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); font-weight: 600; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.exec-table th:first-child { text-align: left; }
.exec-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
.exec-table td:first-child { text-align: left; font-weight: 600; }
.exec-table td.num { text-align: right; }
.exec-table tbody tr:last-child td { border-bottom: none; }
