/* CME Strategy Bot · Liquid Glass (dark first, light variant) */
:root {
  --ground: #05070B;
  --glass: rgba(28, 33, 44, 0.52);
  --glass-strong: rgba(24, 28, 38, 0.82);
  --glass-border: rgba(255, 255, 255, 0.11);
  --glass-hi: rgba(255, 255, 255, 0.10);
  --inset: rgba(255, 255, 255, 0.045);
  --inset-border: rgba(255, 255, 255, 0.07);
  --text: #F3F6FA;
  --text-2: #C9D1DC;
  --label: #A6B0BE;
  --muted: #8A95A5;
  --up: #5BDE7A;
  --down: #FF8A80;
  --warn: #FFC65C;
  --danger: #D92D20;
  --info: #8CC8FF;
  --action: #0A6FE0;
  --action-border: #3D8FF0;
  --pill: rgba(255, 255, 255, 0.08);
  --pill-border: rgba(255, 255, 255, 0.10);
  --btn: rgba(255, 255, 255, 0.09);
  --btn-hover: rgba(255, 255, 255, 0.15);
  --btn-border: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.08);
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.40);
  --field: radial-gradient(1100px 640px at 8% -10%, rgba(10, 132, 255, 0.30), transparent 60%),
           radial-gradient(900px 620px at 95% 6%, rgba(94, 92, 230, 0.26), transparent 62%),
           radial-gradient(1100px 720px at 55% 110%, rgba(48, 209, 88, 0.13), transparent 60%);
  --r: 24px;
  --r-sm: 16px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --ground: #EEF2F7;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.90);
  --glass-border: rgba(15, 23, 42, 0.08);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --inset: rgba(15, 23, 42, 0.035);
  --inset-border: rgba(15, 23, 42, 0.06);
  --text: #0E1420;
  --text-2: #2D3747;
  --label: #5B6676;
  --muted: #7A8494;
  --up: #12893A;
  --down: #C9372C;
  --warn: #A86500;
  --info: #0A5FC2;
  --pill: rgba(15, 23, 42, 0.05);
  --pill-border: rgba(15, 23, 42, 0.08);
  --btn: rgba(255, 255, 255, 0.7);
  --btn-hover: rgba(255, 255, 255, 0.95);
  --btn-border: rgba(15, 23, 42, 0.12);
  --line: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --field: radial-gradient(1100px 640px at 8% -10%, rgba(10, 132, 255, 0.18), transparent 60%),
           radial-gradient(900px 620px at 95% 6%, rgba(94, 92, 230, 0.14), transparent 62%),
           radial-gradient(1100px 720px at 55% 110%, rgba(48, 209, 88, 0.10), transparent 60%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); font-size: 14px; line-height: 1.45;
  background: var(--field), var(--ground); background-attachment: fixed;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14.5px; font-weight: 650; }
button { font: inherit; }
input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--action-border); outline-offset: 2px; }
::selection { background: rgba(10, 111, 224, 0.4); }

.glass {
  background: var(--glass); backdrop-filter: blur(30px) saturate(170%); -webkit-backdrop-filter: blur(30px) saturate(170%);
  border: 1px solid var(--glass-border); box-shadow: inset 0 1px 0 var(--glass-hi), var(--shadow); border-radius: var(--r);
}
.inset { background: var(--inset); border: 1px solid var(--inset-border); border-radius: var(--r-sm); }
.label { font-size: 12px; font-weight: 500; color: var(--label); letter-spacing: .01em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .dn { color: var(--down); } .warn { color: var(--warn); } .info { color: var(--info); }
.row { display: flex; align-items: center; gap: 12px; }
.col { display: flex; flex-direction: column; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.small { font-size: 12.5px; }
.big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.mid { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.sep { height: 1px; background: var(--line); margin: 4px 0; }
.hide { display: none !important; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12.5px;
  font-weight: 600; white-space: nowrap; background: var(--pill); border: 1px solid var(--pill-border); color: var(--text-2); }
.pill.ok { color: var(--up); } .pill.bad { color: var(--down); } .pill.w { color: var(--warn); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: 13.5px; cursor: pointer; border: 1px solid var(--btn-border); background: var(--btn); color: var(--text);
  white-space: nowrap; transition: background .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn.primary { background: var(--action); border-color: var(--action-border); color: #fff; }
.btn.primary:hover { background: #1A7CEB; }
.btn.danger { background: rgba(255, 69, 58, 0.18); border-color: rgba(255, 120, 110, 0.60); color: #FFB0A8; }
:root[data-theme="light"] .btn.danger { color: #B42318; }
.btn.danger:hover { background: rgba(255, 69, 58, 0.28); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn svg { width: 16px; height: 16px; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.t-buy { background: rgba(48, 209, 88, 0.18); color: var(--up); }
.t-sell { background: rgba(255, 69, 58, 0.18); color: var(--down); }
.t-hold { background: var(--pill); color: var(--text-2); }
.t-warn { background: rgba(255, 198, 92, 0.16); color: var(--warn); }
.t-info { background: rgba(10, 132, 255, 0.16); color: var(--info); }
.kbd { font-size: 11px; font-weight: 600; color: var(--text-2); border: 1px solid var(--btn-border); border-radius: 6px; padding: 1px 6px; }

/* segmented */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--inset); border: 1px solid var(--inset-border); }
.seg button { min-height: 32px; padding: 0 14px; border-radius: 999px; border: 0; font-size: 13px; font-weight: 600; cursor: pointer; background: transparent; color: var(--label); }
.seg button.on { background: rgba(255, 255, 255, 0.18); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.18); }
:root[data-theme="light"] .seg button.on { background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .15); }
.seg button.live.on { background: rgba(255, 69, 58, 0.35); }

/* switch */
.sw { width: 46px; height: 28px; border-radius: 999px; border: 0; padding: 3px; display: inline-flex; align-items: center; cursor: pointer;
  background: rgba(120, 120, 128, 0.32); transition: background .18s; flex: none; }
.sw .knob { width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); transition: transform .18s; }
.sw.on { background: #30D158; }
.sw.on .knob { transform: translateX(18px); }
.sw:disabled { opacity: .45; cursor: not-allowed; }

/* layout */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 20px; padding: 20px; min-height: 100vh; max-width: 1680px; margin: 0 auto; }
aside.side { position: sticky; top: 20px; height: calc(100vh - 40px); padding: 18px 12px; display: flex; flex-direction: column; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(140deg, #3D9BFF, #5E5CE6 60%, #30D158); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 6px 16px rgba(10, 132, 255, .35); }
.brand-logo svg { width: 22px; height: 22px; stroke: #fff; }
.brand b { display: block; font-size: 15px; font-weight: 700; }
.nav { display: flex; align-items: center; gap: 12px; min-height: 38px; padding: 0 12px; border-radius: 12px; color: var(--text-2); font-weight: 500; font-size: 14px; text-decoration: none !important; }
.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.nav.on { background: rgba(255, 255, 255, 0.13); color: var(--text); font-weight: 600; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10); }
:root[data-theme="light"] .nav.on { background: rgba(255, 255, 255, .85); }
.nav .pill { margin-left: auto; min-height: 22px; padding: 0 8px; font-size: 11.5px; }
.grp { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 16px 12px 6px; }
.side-foot { margin-top: auto; padding: 12px 8px 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12.5px; background: rgba(255, 255, 255, .12); }

main.page { min-width: 0; display: flex; flex-direction: column; gap: 20px; padding-bottom: 40px; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; position: sticky; top: 20px; z-index: 20; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 4px 4px 0; }
.crumb { font-size: 12.5px; color: var(--label); margin-bottom: 2px; }
.crumb a { color: var(--label); }

.grid { display: grid; gap: 20px; }
.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)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-main2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.card { padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card.tight { padding: 16px; gap: 8px; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.kpi-gauge { flex-direction: row; align-items: center; gap: 14px; }
.kpi-gauge > div:first-child { width: 120px; flex: none; }
/* tables */
.tbl-wrap { overflow-x: auto; margin: 0 -6px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--label); padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: rgba(255, 255, 255, .035); }
.tbl .r { text-align: right; }

/* products */
.prod { padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--text); text-decoration: none !important; min-width: 0; transition: transform .15s; }
.prod:hover { transform: translateY(-2px); }
.prod .px { font-size: 21px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.spark { width: 100%; height: 38px; display: block; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12px; font-weight: 500; color: var(--label); }
.inp { min-height: 42px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--btn-border); background: var(--inset); color: var(--text); outline: none; width: 100%; }
.inp:focus { border-color: var(--action-border); box-shadow: 0 0 0 3px rgba(10, 111, 224, .25); }
select.inp { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--label) 50%), linear-gradient(135deg, var(--label) 50%, transparent 50%);
  background-position: calc(100% - 18px) 18px, calc(100% - 13px) 18px; background-size: 5px 5px; background-repeat: no-repeat; }
select.inp option { background: #1b2030; color: #F3F6FA; }
.inp.sm { min-height: 34px; padding: 0 10px; border-radius: 10px; }
.hint { font-size: 12px; color: var(--muted); }
.err { color: var(--down); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }

/* checks (why panel) */
.check { padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.check .r1 { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.check .rule { font-weight: 600; font-size: 13.5px; }
.check .val { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feed-item:last-child { border-bottom: 0; }
.feed-ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--inset); }
.feed-ic svg { width: 15px; height: 15px; }

/* gauge */
.gauge { position: relative; width: 100%; max-width: 300px; margin: 0 auto; }
.gauge svg { width: 100%; height: auto; display: block; overflow: visible; }
.gauge .gv { text-align: center; margin-top: 4px; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--inset); border: 1px solid var(--inset-border); overflow-x: auto; align-self: flex-start; max-width: 100%; }
.tabs button { border: 0; background: transparent; color: var(--label); font-weight: 600; font-size: 13px; min-height: 34px; padding: 0 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.tabs button.on { background: rgba(255, 255, 255, .16); color: var(--text); }
:root[data-theme="light"] .tabs button.on { background: #fff; }

/* modal + toast */
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 14px; background: var(--glass-strong); animation: pop .18s; }
.modal.wide { width: min(760px, 100%); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 12px 16px; background: var(--glass-strong); font-size: 13.5px; animation: pop .18s; }
.toast.bad { border-color: rgba(255, 120, 110, .6); }
.toast.ok { border-color: rgba(91, 222, 122, .5); }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98) } }

.banner { padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; border-radius: var(--r-sm); }
.banner.danger { background: rgba(217, 45, 32, .22); border: 1px solid rgba(255, 120, 110, .55); }
.banner.warn { background: rgba(255, 198, 92, .12); border: 1px solid rgba(255, 198, 92, .4); }
.banner.info { background: rgba(10, 132, 255, .12); border: 1px solid rgba(61, 155, 255, .4); }

.chart { width: 100%; height: 340px; position: relative; }
.chart.sm { height: 220px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--label); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.bar { height: 8px; border-radius: 999px; background: var(--inset); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; }
.stack { display: flex; height: 14px; border-radius: 999px; overflow: hidden; background: var(--inset); }
.stack > i { display: block; height: 100%; }
.empty { padding: 26px; text-align: center; color: var(--muted); }
.skeleton { background: linear-gradient(90deg, var(--inset), rgba(255, 255, 255, .08), var(--inset)); background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 12px; }
@keyframes sh { to { background-position: -200% 0 } }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg) } }
.strat-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.strat-card .nm { font-weight: 650; font-size: 15px; }
.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-stats > div { padding: 8px 10px; }
.mini-stats b { display: block; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(420px, 100%); padding: 32px; display: flex; flex-direction: column; gap: 16px; }

/* bottom nav (phone) */
.bnav { display: none; }
.menu-btn { display: none; }

@media (max-width: 1280px) {
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-main2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 90px; gap: 12px; }
  aside.side { display: none; position: fixed; z-index: 90; left: 12px; top: 12px; bottom: 12px; height: auto; width: 270px; background: var(--glass-strong); }
  aside.side.open { display: flex; }
  .menu-btn { display: inline-flex; }
  .topbar { top: 8px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  main.page { gap: 14px; }
  .card { padding: 16px; }
  h1 { font-size: 24px; }
  .kpi .v { font-size: 21px; }
  .kpi-gauge { grid-column: span 2; }
  .hide-sm { display: none !important; }
  .bnav { display: flex; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 80; padding: 6px; justify-content: space-around; }
  .bnav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--label); padding: 6px 8px; border-radius: 14px; flex: 1; text-decoration: none !important; }
  .bnav a.on { color: var(--text); background: rgba(255, 255, 255, .12); }
  .bnav svg { width: 20px; height: 20px; }
  .chart { height: 260px; }
  .mini-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .g4, .g6 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 18px; }
}

.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
