/* QIYP Dashboard — full redesign components (loads after dashboard.css) */

/* ---------- topbar additions ---------- */
.cmdk { display: flex; align-items: center; gap: 9px; font-family: var(--mono); font-size: 12px; color: var(--mut);
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 7px 12px; cursor: pointer; transition: color .15s, border-color .15s; }
.cmdk:hover { color: var(--fg); border-color: var(--line); }
.cmdk kbd { font-family: var(--mono); font-size: 11px; background: var(--panel); border: 1px solid var(--line2); border-radius: 5px; padding: 1px 6px; color: var(--faint); }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg2); color: var(--mut);
  cursor: pointer; display: grid; place-items: center; transition: color .15s, border-color .15s; }
.icon-btn:hover { color: var(--fg); border-color: var(--line); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- greeting ---------- */
.greeting { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.greeting h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.025em; }
.greeting h1 .accent { color: var(--acc); }
.greeting .sub { color: var(--mut); font-size: 14px; margin-top: 6px; max-width: 54ch; }
.greeting .scan { font-family: var(--mono); font-size: 11.5px; color: var(--faint); text-align: right; line-height: 1.7; }
.greeting .scan b { color: var(--mut); font-weight: 600; }
.greeting .scan .analysts { display: inline-flex; align-items: center; gap: 5px; }
.greeting .scan .analysts::before { content:""; width: 7px; height: 7px; border-radius: 50%; background: var(--up); }

/* ---------- defenses strip (inside regime) ---------- */
.defenses { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line2); }
.defenses .lbl { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); margin-right: 4px; }
.def { font-family: var(--mono); font-size: 11.5px; color: var(--mut); display: flex; align-items: center; gap: 6px; }
.def::before { content:"✓"; color: var(--up); font-size: 11px; }
.def + .def { padding-left: 10px; border-left: 1px solid var(--line2); }
.def-count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--up); }

/* ---------- KPI row ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 720px) { .kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: var(--panel); border: 1px solid var(--line2); border-radius: 13px; padding: 18px 20px; box-shadow: var(--shadow); }
.kpi .k { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.kpi .v { font-family: var(--mono); font-size: 34px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }
.kpi .s { font-size: 12px; color: var(--mut); margin-top: 4px; }
.kpi .verdmix { display: flex; gap: 5px; margin-top: 10px; }
.kpi .vm { font-family: var(--mono); font-size: 10px; font-weight: 600; padding: 3px 7px; border-radius: 5px; }
.vm.take { color: var(--up); background: color-mix(in oklch, var(--up) 14%, transparent); }
.vm.pass { color: var(--down); background: color-mix(in oklch, var(--down) 14%, transparent); }
.vm.skip { color: var(--warn); background: color-mix(in oklch, var(--warn) 14%, transparent); }
.heatbar { height: 6px; border-radius: 999px; background: var(--bg2); margin-top: 12px; overflow: hidden; }
.heatbar i { display: block; height: 100%; background: linear-gradient(90deg, var(--up), var(--warn)); border-radius: 999px; }

/* ---------- layout columns ---------- */
.cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 22px; margin-top: 22px; align-items: start; }
@media (max-width: 920px) { .cols { grid-template-columns: 1fr; } }
.col { display: grid; gap: 22px; }

/* ---------- signal book ---------- */
.sigbook { display: flex; flex-direction: column; }
.sb-row { border-bottom: 1px solid var(--line2); }
.sb-row:last-child { border-bottom: 0; }
.sb-main { display: grid; grid-template-columns: 92px 64px 1fr auto; gap: 16px; align-items: center; padding: 16px 22px; cursor: pointer; transition: background .12s; }
.sb-main:hover { background: var(--bg2); }
.verd { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-align: center; padding: 6px 0; border-radius: 7px; }
.verd.take { color: var(--up); background: color-mix(in oklch, var(--up) 15%, transparent); }
.verd.pass { color: var(--down); background: color-mix(in oklch, var(--down) 14%, transparent); }
.verd.skip { color: var(--warn); background: color-mix(in oklch, var(--warn) 15%, transparent); }
.sb-tk { font-family: var(--mono); font-size: 17px; font-weight: 600; }
.sb-mid .conv-line { display: flex; align-items: center; gap: 9px; }
.sb-mid .conv-track { width: 80px; height: 5px; border-radius: 999px; background: var(--bg2); overflow: hidden; }
.sb-mid .conv-track i { display: block; height: 100%; background: var(--acc); border-radius: 999px; }
.sb-mid .conv-num { font-family: var(--mono); font-size: 12px; color: var(--mut); }
.sb-mid .desc { font-size: 13px; color: var(--mut); margin-top: 4px; }
.sb-ev { font-family: var(--mono); font-size: 15px; font-weight: 600; text-align: right; }
.sb-ev .chev { color: var(--faint); font-size: 12px; margin-left: 10px; transition: transform .18s; display: inline-block; }
.sb-row.open .chev { transform: rotate(90deg); }
.sb-detail { max-height: 0; overflow: hidden; transition: max-height .25s ease; background: var(--bg2); }
.sb-row.open .sb-detail { max-height: 320px; }
.sb-detail-inner { padding: 4px 22px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(96px,1fr)); gap: 1px; background: var(--line2); border-radius: 9px; margin: 0 22px 18px; overflow: hidden; }
.sb-lvl { background: var(--panel); padding: 11px 13px; }
.sb-lvl .k { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.sb-lvl .v { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 3px; }
.sb-thesis { padding: 0 22px 20px; font-size: 13.5px; color: var(--mut); line-height: 1.5; }
.sb-thesis b { color: var(--fg); font-weight: 600; }

/* ---------- track record stats ---------- */
.tstats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line2); border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; }
.tstat { background: var(--panel); padding: 16px 18px; }
.tstat .k { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.tstat .v { font-family: var(--mono); font-size: 24px; font-weight: 600; margin-top: 5px; }
.tstat .s { font-size: 11.5px; color: var(--mut); margin-top: 3px; }

/* ---------- equity curve ---------- */
.equity-wrap { padding: 18px 22px 22px; }
.equity-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.equity-head .lbl { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--faint); }
.equity-head .val { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--up); }
.equity svg { width: 100%; height: 130px; display: block; }
.equity .eq-area { fill: var(--acc-dim); stroke: none; }
.equity .eq-line { fill: none; stroke: var(--acc); stroke-width: 2; stroke-linejoin: round; }
.equity .eq-zero { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }

/* ---------- data tables ---------- */
.dtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.dtable th { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint);
  text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line2); font-weight: 500; white-space: nowrap; }
.dtable td { padding: 13px 10px; border-bottom: 1px solid var(--line2); font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.dtable tr:last-child td { border-bottom: 0; }
.dtable tbody tr:hover { background: var(--bg2); }
.dtable .tk { font-weight: 600; }
.dtable .num { text-align: right; }
.dtable .win { color: var(--up); } .dtable .loss { color: var(--down); }
.outcome { font-family: var(--mono); font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 5px; }
.outcome.win { color: var(--up); background: color-mix(in oklch, var(--up) 14%, transparent); }
.outcome.loss { color: var(--down); background: color-mix(in oklch, var(--down) 14%, transparent); }
.tbl-scroll { overflow-x: auto; }
.dtable tr.trade-row td { border-bottom: 0; padding-bottom: 8px; }
.dtable tr.thesis-row td { border-bottom: 1px solid var(--line2); padding: 0 10px 14px; font-family: var(--font); font-size: 12px; color: var(--mut); line-height: 1.45; white-space: normal; }
.dtable tr.thesis-row .th-lead { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-right: 8px; }
.tag-pill { font-family: var(--mono); font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 5px; color: var(--mut); background: var(--bg2); border: 1px solid var(--line2); }

/* ---------- positions ---------- */
.pos-list { display: flex; flex-direction: column; }
.pos { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: flex-start; padding: 16px 22px; border-bottom: 1px solid var(--line2); }
.pos-thesis { font-size: 12px; color: var(--mut); margin-top: 7px; line-height: 1.45; max-width: 52ch; }
.pos-thesis b { color: var(--fg); font-weight: 600; }
.pos:last-child { border-bottom: 0; }
.pos .pt { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.pos .pmeta { font-size: 12px; color: var(--mut); margin-top: 2px; }
.pos .ppl { font-family: var(--mono); font-size: 15px; font-weight: 600; text-align: right; }
.pos .pday { font-family: var(--mono); font-size: 11px; color: var(--faint); text-align: right; }

/* ---------- command palette ---------- */
.palette-scrim { position: fixed; inset: 0; z-index: 60; background: oklch(0.1 0.005 95 / 0.55); backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; }
.palette-scrim.show { display: flex; }
.palette { width: min(560px, 92vw); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 24px 70px oklch(0.1 0.01 95 / 0.5); }
.palette input { width: 100%; border: 0; background: transparent; color: var(--fg); font-family: var(--font); font-size: 16px;
  padding: 18px 20px; outline: none; border-bottom: 1px solid var(--line2); }
.palette input::placeholder { color: var(--faint); }
.palette .results { max-height: 320px; overflow-y: auto; padding: 8px; }
.pal-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 9px; cursor: pointer; font-size: 14px; }
.pal-item .pi-ic { font-family: var(--mono); font-size: 12px; color: var(--faint); width: 18px; text-align: center; }
.pal-item .pi-tag { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--faint); }
.pal-item.sel, .pal-item:hover { background: var(--bg2); }
.pal-item.sel .pi-ic { color: var(--acc); }

/* ---------- settings modal ---------- */
.modal-scrim { position: fixed; inset: 0; z-index: 60; background: oklch(0.1 0.005 95 / 0.55); backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-scrim.show { display: flex; }
.modal { width: min(520px, 94vw); max-height: 86vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 24px 70px oklch(0.1 0.01 95 / 0.5); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--line2); position: sticky; top: 0; background: var(--panel); }
.modal-head h2 { font-size: 18px; font-weight: 600; }
.modal-body { padding: 8px 24px 24px; }
.set-group { padding: 18px 0; border-bottom: 1px solid var(--line2); }
.set-group:last-child { border-bottom: 0; }
.set-group .sg-title { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--faint); margin-bottom: 14px; }
.set-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 10px 0; }
.set-row .sr-label { font-size: 14px; }
.set-row .sr-desc { font-size: 12px; color: var(--mut); margin-top: 3px; max-width: 40ch; }
.segmented { display: flex; gap: 4px; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 3px; }
.segmented button { font-family: var(--mono); font-size: 11.5px; color: var(--mut); background: transparent; border: 0; padding: 6px 11px; border-radius: 6px; cursor: pointer; }
.segmented button.on { background: var(--acc); color: var(--bg); font-weight: 600; }
.toggle { width: 42px; height: 24px; border-radius: 999px; background: var(--bg2); border: 1px solid var(--line); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.toggle::after { content:""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--mut); transition: transform .15s, background .15s; }
.toggle.on { background: var(--acc-dim); border-color: var(--acc); }
.toggle.on::after { transform: translateX(18px); background: var(--acc); }

/* section spacer */
.gap-row { margin-top: 22px; }

/* ---------- live prices ---------- */
.sb-right { display: flex; align-items: center; gap: 14px; justify-content: flex-end; }
.sb-price {
  font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--fg);
  background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px;
  padding: 5px 9px; min-width: 84px; text-align: right; font-variant-numeric: tabular-nums;
  transition: color .5s ease, border-color .5s ease;
}
.sb-price.na { color: var(--faint); }
.sb-price.flash-up   { color: var(--up);   border-color: color-mix(in oklch, var(--up)   50%, var(--line2)); }
.sb-price.flash-down { color: var(--down); border-color: color-mix(in oklch, var(--down) 50%, var(--line2)); }
@media (max-width: 640px) { .sb-price { min-width: 0; } }

/* current price as the bright anchor in Open Positions */
.pos-now {
  color: var(--fg); font-weight: 600; font-family: var(--mono);
  font-variant-numeric: tabular-nums; transition: color .5s ease;
}
.pos-now.na          { color: var(--faint); }
.pos-now.flash-up    { color: var(--up); }
.pos-now.flash-down  { color: var(--down); }
