/* NEPSIM V1 — styles */
:root {
  --bg: #0b0f14; --panel: #121821; --panel2: #18202b; --line: #233041; --text: #e7edf4; --muted: #8a99ab;
  --accent: #2dd4bf; --accent2: #0ea5a0; --up: #22c55e; --down: #f05252; --warn: #f59e0b; --info: #60a5fa;
  --radius: 14px; --shadow: 0 8px 30px rgba(0,0,0,.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root.light { --bg: #f4f6f9; --panel: #ffffff; --panel2: #f0f3f7; --line: #dde3ea; --text: #111827; --muted: #5f6b7a; --shadow: 0 6px 20px rgba(15,23,42,.08); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11px; } .mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; } .center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; } .wrap { flex-wrap: wrap; } .grow { flex: 1; } .between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.hide { display: none !important; }
.show-m { display: none !important; }

/* layout */
#app { display: flex; min-height: 100vh; }
.sidenav { width: 210px; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; letter-spacing: .5px; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), #6366f1); display: grid; place-items: center; color: #041014; font-weight: 900; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; letter-spacing: 0; }
.navbtn { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--muted); text-align: left; }
.navbtn:hover { background: var(--panel2); color: var(--text); }
.navbtn.active { background: rgba(45,212,191,.12); color: var(--accent); font-weight: 600; }
.navbtn svg { width: 19px; height: 19px; flex: none; }
.sidenav .spacer { flex: 1; }
main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding: 10px 18px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.clock { display: flex; flex-direction: column; line-height: 1.15; }
.clock b { font-size: 18px; font-variant-numeric: tabular-nums; }
.phase { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--panel2); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; }
.phase.open { background: rgba(34,197,94,.15); color: var(--up); } .phase.closed { background: rgba(245,158,11,.15); color: var(--warn); } .phase.over { background: rgba(96,165,250,.15); color: var(--info); }
.progress { height: 4px; background: var(--panel2); border-radius: 4px; overflow: hidden; width: 120px; }
.progress > i { display: block; height: 100%; background: var(--accent); }
.controls { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nw { margin-left: auto; text-align: right; line-height: 1.15; }
.nw b { font-size: 18px; }
#view { padding: 18px; max-width: 1280px; width: 100%; margin: 0 auto; }
.bottomnav { display: none; }

/* components */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0 0 12px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card h3 .muted { font-weight: 400; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.kpi .lbl { color: var(--muted); font-size: 12px; display: flex; gap: 6px; align-items: center; }
.kpi .val { font-size: 21px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; margin-top: 2px; }
.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #031512; border-color: var(--accent); }
.btn.buy { background: var(--up); color: #03140a; border-color: var(--up); }
.btn.sell { background: var(--down); color: #fff; border-color: var(--down); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.25); }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
input[type=text], input[type=number], input[type=password], select, textarea { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; outline: none; width: 100%; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[type=range] { accent-color: var(--accent); width: 100%; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--line); text-align: left; font-variant-numeric: tabular-nums; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); cursor: default; }
th.sortable { cursor: pointer; }
tbody tr:hover { background: var(--panel2); }
tr.click { cursor: pointer; }
.tablewrap { overflow: auto; max-height: 70vh; border-radius: 10px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; background: var(--panel2); font-size: 12px; color: var(--muted); border: 1px solid var(--line); }
.chip.warn { color: var(--warn); border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.1); }
.chip.bad { color: var(--down); border-color: rgba(240,82,82,.4); background: rgba(240,82,82,.1); }
.chip.good { color: var(--up); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.1); }
.chip.info { color: var(--info); border-color: rgba(96,165,250,.4); background: rgba(96,165,250,.1); }
.sym { font-weight: 700; letter-spacing: .3px; }
.sector { font-size: 11.5px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 26px 10px; }
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow: auto; }
.msg { padding: 9px 11px; border-radius: 10px; background: var(--panel2); font-size: 13.5px; border-left: 3px solid var(--line); line-height: 1.4; }
.msg.warn { border-left-color: var(--warn); } .msg.trade { border-left-color: var(--accent); } .msg.coach { border-left-color: #a78bfa; background: rgba(167,139,250,.08); } .msg.info { border-left-color: var(--info); }
.msg .when { font-size: 11px; color: var(--muted); }
.chart { width: 100%; height: 360px; }
.chart.sm { height: 220px; } .chart.xs { height: 160px; }
.spark { width: 90px; height: 28px; }
.bar { height: 8px; border-radius: 6px; background: var(--panel2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--panel); padding: 8px 14px; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--accent); border-color: var(--accent); }
.hero { padding: 28px; border-radius: 20px; background: radial-gradient(1200px 300px at 10% -20%, rgba(45,212,191,.25), transparent), radial-gradient(800px 300px at 100% 0%, rgba(99,102,241,.25), transparent), var(--panel); border: 1px solid var(--line); }
.hero h1 { margin: 0 0 6px; font-size: 30px; }
.lesson h2 { margin-top: 0; } .lesson p { line-height: 1.6; } .lesson li { line-height: 1.6; margin-bottom: 4px; }
.callout { padding: 12px 14px; border-radius: 12px; background: rgba(45,212,191,.08); border: 1px solid rgba(45,212,191,.35); font-size: 14px; line-height: 1.55; }
.callout.warn { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.35); }
.opt { display: block; width: 100%; text-align: left; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); cursor: pointer; margin-bottom: 8px; font-weight: 600; }
.opt.right { border-color: var(--up); background: rgba(34,197,94,.12); } .opt.wrong { border-color: var(--down); background: rgba(240,82,82,.12); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv > :nth-child(odd) { color: var(--muted); } .kv > :nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.ticket .sidebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px; }
.ticket .sidebtns button { padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-weight: 700; cursor: pointer; color: var(--muted); }
.ticket .sidebtns button.onB { background: var(--up); color: #03140a; border-color: var(--up); }
.ticket .sidebtns button.onS { background: var(--down); color: #fff; border-color: var(--down); }
.preview { background: var(--panel2); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.star { cursor: pointer; color: var(--muted); border: 0; background: transparent; font-size: 17px; padding: 0 4px; }
.star.on { color: #fbbf24; }
.pill-list { display: flex; gap: 6px; flex-wrap: wrap; }

/* modal & toast */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
#modal.show { display: flex; }
#modal .box { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; max-width: 560px; width: 100%; max-height: 88vh; overflow: auto; padding: 20px; box-shadow: var(--shadow); }
#modal .box.wide { max-width: 860px; }
#modal h2 { margin: 0 0 10px; font-size: 19px; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 12px; box-shadow: var(--shadow); font-size: 13.5px; animation: pop .2s ease; }
.toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--down); } .toast.coach { border-left-color: #a78bfa; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* candle diagram */
.candle-diagram { display: flex; gap: 40px; justify-content: center; padding: 10px; flex-wrap: wrap; }

/* responsive */
@media (max-width: 1000px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidenav { display: none; }
  .bottomnav { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: var(--panel); border-top: 1px solid var(--line); z-index: 30; padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottomnav button { flex: 1; border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; padding: 6px 0; cursor: pointer; }
  .bottomnav button.active { color: var(--accent); }
  .bottomnav svg { width: 21px; height: 21px; }
  #view { padding: 12px 12px 90px; }
  .topbar { padding: 8px 12px; gap: 8px; }
  .g2, .g3 { grid-template-columns: 1fr; } .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .span2 { grid-column: auto; }
  .chart { height: 300px; }
  .hide-m { display: none !important; }
  .show-m { display: inline-flex !important; }
  .nw b { font-size: 15px; }
  .progress { width: 70px; }
  #toasts { left: 12px; right: 12px; bottom: 76px; max-width: none; }
}
