/* aarryantrades app shell — "Terminal" direction (Linear × TradingView).
   Dark, sharp, neon only on actions, gold for money, red for losses. */
:root {
  color-scheme: dark;
  --bg: #07080A;
  --surface: #0E1013;
  --surface-2: #14171B;
  --surface-3: #1B1F24;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --text: #EDEEF0;
  --text-2: #9AA0A8;
  --text-3: #7B828B;
  --neon: #C8FF3D;
  --neon-dim: rgba(200, 255, 61, 0.12);
  --gold: #E3B341;
  --loss: #FF5A4E;
  --loss-dim: rgba(255, 90, 78, 0.12);
  --win: #5BD69B;
  --sans: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums;
}
a { color: var(--neon); }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; text-wrap: balance; }
p { margin: 0; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.gold { color: var(--gold); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(7, 8, 10, 0.88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar .in { max-width: 1280px; margin: 0 auto; padding: 12px max(16px, 2vw); display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
.tabs { display: flex; flex-wrap: wrap; gap: 2px; flex: 1 1 auto; }
.tabs a { color: var(--text-2); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.tabs a:hover { color: var(--text); background: var(--surface-2); }
.tabs a[aria-current="page"] { color: var(--neon); background: var(--neon-dim); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 999px; padding: 3px; }
.seg button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font: 500 12px var(--sans); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* ---------- Layout ---------- */
.main { max-width: 1280px; margin: 0 auto; padding: 28px max(16px, 2vw) 80px; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; }
.page-head h1 { font-size: 30px; font-weight: 600; }
.page-head p { color: var(--text-2); }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card h2 { font-size: 16px; font-weight: 600; }
.card .sub { color: var(--text-3); font-size: 13px; }
.kpi { gap: 6px; }
.kpi .label { color: var(--text-3); font-size: 13px; }
.kpi .val { font-family: var(--mono); font-size: 26px; line-height: 1.1; }
.kpi .hint { color: var(--text-3); font-size: 12px; }
.banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 12px 16px; border-radius: var(--r); border: 1px solid rgba(227, 179, 65, 0.35); background: rgba(227, 179, 65, 0.07); color: var(--text); font-size: 14px; }

/* ---------- Buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: 500 14px var(--sans); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: var(--neon); color: #07080A; border-color: var(--neon); font-weight: 600; }
.btn.primary:hover { background: #D7FF6E; }
.btn.danger { color: var(--loss); border-color: rgba(255, 90, 78, 0.35); background: transparent; }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label, .field .lbl { font-size: 12px; color: var(--text-2); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); font: 14px var(--sans);
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--neon); }
.field .hint { font-size: 12px; color: var(--text-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; cursor: pointer; user-select: none; }
.chip input { accent-color: var(--neon); }
.chip:has(input:checked) { border-color: rgba(200, 255, 61, 0.45); color: var(--neon); background: var(--neon-dim); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg { font-size: 13px; color: var(--text-2); }
.msg.ok { color: var(--win); }
.msg.err { color: var(--loss); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--text-3); font-weight: 500; font-size: 12px; background: var(--surface); position: sticky; top: 0; }
td.num, th.num { text-align: right; font-family: var(--mono); }
tr:hover td { background: rgba(255, 255, 255, 0.015); }
.tag { display: inline-flex; padding: 2px 8px; border-radius: 6px; font-size: 12px; background: var(--surface-3); color: var(--text-2); }
.tag.buy { color: var(--win); background: rgba(91, 214, 155, 0.1); }
.tag.sell { color: var(--loss); background: var(--loss-dim); }

/* ---------- Meters & bars ---------- */
.meter { height: 8px; border-radius: 8px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 8px; background: var(--neon); }
.meter > span.warn { background: var(--gold); }
.meter > span.bad { background: var(--loss); }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.pill.ok { background: rgba(91, 214, 155, 0.12); color: var(--win); }
.pill.warn { background: rgba(227, 179, 65, 0.14); color: var(--gold); }
.pill.bad { background: var(--loss-dim); color: var(--loss); }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row .track { position: relative; height: 10px; background: var(--surface-3); border-radius: 6px; }
.bar-row .track span { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.bar-row .track .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--line-2); }
.bar-row .v { text-align: right; font-family: var(--mono); }
.chart svg { width: 100%; height: auto; display: block; }

/* ---------- Coach ---------- */
.coach-hero { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; padding: 22px; border-radius: 16px; border: 1px solid rgba(200, 255, 61, 0.22); background: radial-gradient(500px 220px at 85% 0%, rgba(200, 255, 61, 0.09), transparent 70%), var(--surface); }
.score-ring { position: relative; width: 120px; height: 120px; flex: 0 0 auto; }
.score-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.score-ring .n { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--mono); font-size: 32px; }
.fix { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; padding: 14px; border-radius: 10px; background: var(--surface-2); }
.fix .n { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--neon); color: #07080A; font-weight: 700; font-family: var(--mono); }
.finding { display: flex; flex-direction: column; gap: 6px; padding: 14px 0; border-top: 1px solid var(--line); }
.finding:first-child { border-top: 0; padding-top: 0; }
.finding h3 { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ai-report { white-space: pre-wrap; line-height: 1.65; color: var(--text); background: var(--surface-2); border-radius: 10px; padding: 16px; font-size: 14.5px; }

/* ---------- Dialog-ish panel ---------- */
.panel { border: 1px solid rgba(200, 255, 61, 0.25); }
.empty { text-align: center; padding: 40px 16px; color: var(--text-2); display: flex; flex-direction: column; gap: 12px; align-items: center; }
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--r); padding: 28px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; color: var(--text-2); }
.drop.over { border-color: var(--neon); background: var(--neon-dim); }

.foot { max-width: 1280px; margin: 0 auto; padding: 0 max(16px, 2vw) 40px; color: var(--text-3); font-size: 12px; }

@media (max-width: 640px) {
  .page-head h1 { font-size: 24px; }
  .kpi .val { font-size: 22px; }
  .bar-row { grid-template-columns: 80px minmax(0, 1fr) 72px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
