/* ============================================================
   SCREENS — log flow, detail, analyse, settings, share, onboarding.
   ============================================================ */

/* ---------------- Overlay / modal ---------------- */
/* Overlays are visible by default — never gate visibility on an animation
   (capture/background tabs pause animations and would leave them hidden). */
.scrim {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in oklab, var(--bg) 40%, #000 55%);
  backdrop-filter: blur(3px);
  display: flex; align-items: stretch; justify-content: flex-end;
}
.sheet {
  width: min(520px, 100%); height: 100%; background: var(--panel);
  border-left: var(--hair) solid var(--border); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
}
@media (prefers-reduced-motion: no-preference) {
  .sheet { animation: slideIn .26s cubic-bezier(.2,.8,.2,1); }
}
@keyframes slideIn { from { transform: translateX(28px); } to { transform: none; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: var(--hair) solid var(--border); }
.sheet-head h2 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.sheet-body { flex: 1; overflow-y: auto; padding: 22px; }
.sheet-body img { max-width: 100%; }
.sheet-foot { padding: 16px 22px; border-top: var(--hair) solid var(--border); display: flex; gap: 10px; align-items: center; }
.iconbtn { width: 30px; height: 30px; border-radius: var(--radius); border: var(--hair) solid var(--border); background: var(--panel-2); color: var(--muted); display: grid; place-items: center; cursor: pointer; transition: all .12s; }
.iconbtn:hover { color: var(--ink); border-color: var(--muted); }

/* steps */
.steps { display: flex; gap: 6px; padding: 0 22px 16px; }
.step-dot { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background .2s; }
.step-dot.done { background: var(--clay); }
.step-dot.cur { background: color-mix(in oklab, var(--clay) 60%, var(--border)); }

.field-label { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; display: block; }
.seg { display: grid; gap: 8px; }
.seg.two { grid-template-columns: 1fr 1fr; }
.seg.three { grid-template-columns: repeat(3, 1fr); }
.optbtn {
  padding: 15px; border-radius: var(--radius); border: var(--hair) solid var(--border);
  background: var(--panel-2); color: var(--ink-2); cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all .12s; display: flex; flex-direction: column; align-items: center; gap: 4px; font-family: var(--font-sans);
}
.optbtn .om { font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-weight: 500; }
.optbtn:hover { border-color: var(--muted); color: var(--ink); }
.optbtn.sel { border-color: var(--clay); background: var(--clay-bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--clay); }
.optbtn.sel.long { border-color: var(--long); box-shadow: inset 0 0 0 1px var(--long); background: var(--long-soft); }
.optbtn.sel.short { border-color: var(--short); box-shadow: inset 0 0 0 1px var(--short); background: var(--short-soft); }

/* pnl input */
.pnl-input { display: flex; align-items: center; gap: 10px; border: var(--hair) solid var(--border); border-radius: var(--radius); background: var(--inset); padding: 0 14px; transition: border-color .12s; }
.pnl-input:focus-within { border-color: var(--clay); }
.pnl-sign { display: flex; gap: 4px; }
.pnl-sign button { width: 34px; height: 34px; border-radius: var(--radius); border: var(--hair) solid var(--border); background: var(--panel-2); color: var(--muted); font-family: var(--font-mono); font-size: 18px; cursor: pointer; }
.pnl-sign button.on.plus { color: var(--long); border-color: var(--long); background: var(--long-soft); }
.pnl-sign button.on.minus { color: var(--short); border-color: var(--short); background: var(--short-soft); }
.pnl-input input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); font-family: var(--font-mono); font-size: 22px; font-weight: 600; padding: 14px 0; }
.pnl-input .cur { font-family: var(--font-mono); font-size: 18px; color: var(--muted); }

/* upload zone */
.drop { border: 1.5px dashed var(--border); border-radius: var(--radius-lg); background: var(--inset); padding: 30px; text-align: center; color: var(--muted); cursor: pointer; transition: all .14s; }
.drop:hover { border-color: var(--clay); color: var(--ink); background: var(--clay-bg); }
.drop .ph {
  background-image: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in oklab, var(--muted) 18%, transparent) 10px 11px);
  border-radius: var(--radius); height: 120px; display: grid; place-items: center; margin-bottom: 14px; border: var(--hair) solid var(--border);
}
.drop .ph .lab { font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.shot-preview { position: relative; border-radius: var(--radius-lg); overflow: hidden; border: var(--hair) solid var(--border); }
.shot-preview .bar { background-image: repeating-linear-gradient(135deg, var(--inset) 0 14px, var(--panel-2) 14px 28px); height: 170px; display:grid; place-items:center; }
.shot-preview .rm { position: absolute; top: 8px; right: 8px; }

/* multi-screenshot grid (log trade) */
.shot-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot-thumb { position: relative; border-radius: var(--radius); overflow: hidden; border: var(--hair) solid var(--border); aspect-ratio: 16 / 10; background: var(--inset); }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot-thumb .bar { width: 100%; height: 100%; background-image: repeating-linear-gradient(135deg, var(--inset) 0 10px, var(--panel-2) 10px 20px); }
.shot-rm { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 4px; border: 0; background: #000000aa; color: #fff; display: grid; place-items: center; cursor: pointer; }
.shot-add { aspect-ratio: 16 / 10; border: 1.5px dashed var(--border); border-radius: var(--radius); background: var(--inset); color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-family: var(--font-sans); transition: all .12s; }
.shot-add:hover { border-color: var(--clay); color: var(--ink); background: var(--clay-bg); }

/* screenshot gallery (trade detail) */
.detail-shots { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.detail-shot-item { border-radius: var(--radius-lg); overflow: hidden; border: var(--hair) solid var(--border); display: block; aspect-ratio: 16 / 10; }
.detail-shot-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* counter */
.confcount { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.confcount .big { font-family: var(--font-mono); font-size: 28px; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.confcount .warnflag { font-family: var(--font-mono); font-size: 11px; color: var(--warn); background: var(--warn-soft); padding: 4px 9px; border-radius: 3px; }
.conf-grid { display: flex; flex-wrap: wrap; gap: 8px; }

textarea.note {
  width: 100%; border: var(--hair) solid var(--border); border-radius: var(--radius); background: var(--inset);
  color: var(--ink); font-family: var(--font-sans); font-size: 14px; line-height: 1.55; padding: 14px; resize: vertical; min-height: 130px; outline: none;
}
textarea.note:focus { border-color: var(--clay); }

/* ---------------- Trade detail ---------------- */
.detail-pnl { font-family: var(--font-mono); font-size: 40px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.detail-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: var(--hair) solid var(--border-2); }
.detail-row:last-child { border-bottom: 0; }
.detail-k { font-family: var(--font-mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.detail-v { font-size: 14px; font-weight: 600; }
.detail-shot { background-image: repeating-linear-gradient(135deg, var(--inset) 0 16px, var(--panel-2) 16px 32px); height: 200px; border-radius: var(--radius-lg); border: var(--hair) solid var(--border); display:grid; place-items:center; }
.detail-note { background: var(--inset); border-left: 2px solid var(--clay); border-radius: 0 var(--radius) var(--radius) 0; padding: 14px 16px; font-size: 14px; line-height: 1.6; color: var(--ink-2); font-style: italic; }

/* ---------------- Analyse ---------------- */
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.an-grid .span2 { grid-column: span 2; }
.ring-wrap { display: flex; align-items: center; gap: 26px; }
.ring-wrap svg { flex: 0 0 128px; width: 128px; height: 128px; }
.ring-legend { font-size: 13px; color: var(--muted); line-height: 1.6; }
.ring-legend b { color: var(--ink); font-weight: 700; }
.legend-row { display: flex; gap: 16px; justify-content: center; margin-top: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.legend-row .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; transform: translateY(0); }

.bar-row { display: grid; grid-template-columns: 54px 1fr 96px; align-items: center; gap: 12px; padding: 9px 0; }
.bar-row .lab { font-family: var(--font-mono); font-size: 13px; color: var(--ink-2); }
.bar-track { height: 26px; background: var(--inset); border-radius: 3px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 3px; display: flex; align-items: center; transition: width .5s cubic-bezier(.2,.8,.2,1); }
.bar-row .val { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); text-align: right; }

.combo { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: var(--hair) solid var(--border-2); }
.combo:last-child { border: 0; }
.combo-rank { font-family: var(--font-mono); font-size: 12px; color: var(--clay); width: 22px; font-weight: 600; }
.combo-names { flex: 1; display: flex; flex-wrap: wrap; gap: 4px; }
.combo-wr { font-family: var(--font-mono); font-size: 18px; font-weight: 600; }
.combo-n { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

.freq-row { display: grid; grid-template-columns: 132px 1fr 70px; align-items: center; gap: 12px; padding: 7px 0; }
.freq-row .lab { font-family: var(--font-mono); font-size: 12.5px; }
.freq-track { height: 8px; background: var(--inset); border-radius: 99px; overflow: hidden; }
.freq-fill { height: 100%; background: var(--clay); border-radius: 99px; transition: width .5s; }
.freq-row .val { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); text-align: right; }

/* equity */
.eq-wrap { position: relative; }
.eq-legend { display: flex; gap: 18px; justify-content: center; margin-top: 12px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); }

/* ---------------- Settings ---------------- */
.set-list { display: flex; flex-direction: column; }
.set-conf { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: var(--hair) solid var(--border-2); }
.set-conf { border-radius: var(--radius); transition: opacity .12s, box-shadow .12s, background .12s; }
.set-conf.dragging { opacity: .35; background: var(--inset); box-shadow: var(--shadow-pop); }
.set-conf .grip { display: grid; place-items: center; width: 24px; height: 30px; color: var(--faint); cursor: grab; touch-action: none; flex-shrink: 0; }
.set-conf .grip:hover { color: var(--muted); }
.set-conf .grip:active { cursor: grabbing; }
.set-conf .nm { flex: 1; font-family: var(--font-mono); font-size: 13.5px; }
.set-conf .nm-edit { flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 13.5px; color: var(--ink); background: none; border: 0; border-bottom: 1px solid transparent; padding: 3px 0; outline: none; transition: border-color .12s; }
.set-conf .nm-edit:hover { border-bottom-color: var(--border); }
.set-conf .nm-edit:focus { border-bottom-color: var(--clay); }
.set-conf .uses { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.addconf { display: flex; gap: 8px; margin-top: 14px; }
.addconf input { flex: 1; border: var(--hair) solid var(--border); border-radius: var(--radius); background: var(--inset); color: var(--ink); padding: 10px 12px; font-family: var(--font-mono); font-size: 13px; outline: none; }
.addconf input:focus { border-color: var(--clay); }
.set-section { display: grid; gap: 18px; }
.kv { display: flex; justify-content: space-between; align-items: center; padding: 13px 0; border-bottom: var(--hair) solid var(--border-2); }
.kv:last-child { border: 0; }
.kv .k { font-size: 13.5px; font-weight: 600; }
.kv .kdesc { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------------- Share card ---------------- */
.share-scrim { position: fixed; inset: 0; z-index: 70; background: #000a; backdrop-filter: blur(4px); display: grid; place-items: center; padding: 24px; }
.share-card {
  width: 440px; border-radius: 14px; overflow: hidden; position: relative;
  background: linear-gradient(150deg, #221c14, #14110b 70%);
  border: 1px solid #3a3122; box-shadow: 0 30px 80px -20px #000c;
}
.share-card .sc-grid { position:absolute; inset:0; background-image: linear-gradient(#ffffff06 1px, transparent 1px), linear-gradient(90deg, #ffffff06 1px, transparent 1px); background-size: 26px 26px; }
.sc-pad { position: relative; padding: 28px; color: #efe9da; }
.sc-head { display: flex; align-items: center; justify-content: space-between; }
.sc-mark { display: flex; align-items: center; gap: 9px; }
.sc-mark .m { width: 24px; height: 24px; border-radius: 6px; background: var(--clay); display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; color: #fff; font-size: 13px; }
.sc-meta { font-family: var(--font-mono); font-size: 11px; color: #b8ac95; letter-spacing: .04em; }
.sc-wr { font-family: var(--font-mono); font-size: 64px; font-weight: 600; letter-spacing: -.03em; line-height: 1; color: var(--long); }
.sc-combo-names { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.sc-chip { font-family: var(--font-mono); font-size: 11.5px; padding: 3px 8px; border-radius: 3px; background: #ffffff10; color: #d8cdb6; }
.sc-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid #ffffff14; }
.sc-stat .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: #b8ac95; white-space: nowrap; }
.sc-stat .v { font-family: var(--font-mono); font-size: 22px; font-weight: 600; margin-top: 4px; }
.sc-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ---------------- Onboarding ---------------- */
.onb { position: fixed; inset: 0; z-index: 80; background: var(--bg); display: grid; place-items: center; padding: 24px; }
.onb-card { width: min(540px, 100%); }
.onb-kicker { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.onb-q { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; margin: 0 0 6px; }
.onb-sub { color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.onb-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 28px; }
.onb-steps { display: flex; gap: 5px; }
.onb-steps .d { width: 22px; height: 3px; border-radius: 2px; background: var(--border); }
.onb-steps .d.on { background: var(--clay); }
.onb-steps .d.done { background: color-mix(in oklab, var(--clay) 55%, var(--border)); }

/* responsive: collapse rail */
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .an-grid { grid-template-columns: 1fr; }
  .an-grid .span2 { grid-column: span 1; }
  .strip { grid-template-columns: repeat(2, 1fr); }
}
