/* JG Securities — dark trading-desk theme */
:root {
  --bg: #060a13;
  --bg-2: #0a1120;
  --panel: rgba(16, 25, 43, 0.78);
  --panel-solid: #101a2c;
  --panel-2: #142036;
  --border: rgba(130, 160, 210, 0.13);
  --border-strong: rgba(130, 160, 210, 0.24);
  --text: #e7eef9;
  --muted: #8796b0;
  --faint: #56637c;
  --gain: #16c784;
  --gain-soft: rgba(22, 199, 132, 0.14);
  --loss: #f0465a;
  --loss-soft: rgba(240, 70, 90, 0.14);
  --gold: #f4b740;
  --gold-soft: rgba(244, 183, 64, 0.14);
  --blue: #4c8dff;
  --violet: #9b7bff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.6);
  --sidebar: 232px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 20px; margin-bottom: 6px; }
h3 { font-size: 14px; font-weight: 600; color: var(--text); }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.r { text-align: right; }
.mt { margin-top: 14px; }
.w100 { width: 100%; }
.grow { flex: 1; }
.upper { text-transform: uppercase; }
.wrap { white-space: normal; word-break: break-all; max-width: 520px; }
.gain { color: var(--gain); }
.loss { color: var(--loss); }
.plain { list-style: none; padding: 0; }

/* ---------- animated background ---------- */
.bg-grid, .bg-glow { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-grid {
  background-image:
    linear-gradient(rgba(120, 150, 200, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 150, 200, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
  animation: grid-pan 40s linear infinite;
}
.bg-glow {
  background:
    radial-gradient(600px 380px at 85% -5%, rgba(22, 199, 132, 0.13), transparent 70%),
    radial-gradient(520px 360px at 10% 5%, rgba(76, 141, 255, 0.12), transparent 70%),
    radial-gradient(500px 400px at 50% 110%, rgba(244, 183, 64, 0.06), transparent 70%);
  animation: glow-drift 18s ease-in-out infinite alternate;
}
@keyframes grid-pan { to { background-position: 44px 44px, 44px 44px; } }
@keyframes glow-drift { to { transform: translate3d(0, 14px, 0) scale(1.04); } }

/* ---------- layout ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar); z-index: 20;
  background: linear-gradient(180deg, rgba(10, 17, 32, 0.96), rgba(6, 10, 19, 0.96));
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 14px;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 16px; padding: 4px 8px 22px; }
.brand:hover { text-decoration: none; }
.brand strong { color: var(--gold); font-weight: 800; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--muted); font-weight: 500; position: relative; transition: color .2s, background .2s;
}
.sidebar nav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.sidebar nav a.active { color: var(--text); background: linear-gradient(90deg, var(--gain-soft), transparent); }
.sidebar nav a.active::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--gain); box-shadow: 0 0 12px var(--gain); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mkt-box { border: 1px solid var(--border); border-radius: 12px; padding: 4px; background: rgba(255, 255, 255, .02); }
.mkt-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border-radius: 9px; }
.mkt-row + .mkt-row { border-top: 1px solid var(--border); border-radius: 0 0 9px 9px; }
.mkt-row b { display: block; font-size: 12px; color: var(--text); font-weight: 600; }
.mkt-row span { display: block; font-size: 11px; color: var(--muted); line-height: 1.35; }
.mkt-row i, .mkt-mini i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; margin-top: 4px; }
.mkt-mini i { margin-top: 0; }
[data-mkt].open i { background: var(--gain); animation: pulse 2s infinite; }
[data-mkt].open span { color: var(--gain); }
[data-mkt].closed i { background: var(--loss); opacity: .85; }
[data-mkt].stale i { background: var(--gold); }
[data-mkt].stale span { color: var(--gold); }
.mkt-mini { display: none; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }

.clock-btn { background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); cursor: pointer; padding: 3px 8px; display: inline-flex; align-items: baseline; gap: 8px; font-size: 12px; transition: border-color .2s, color .2s; }
.clock-btn:hover { border-color: var(--border-strong); color: var(--text); }
.clock-btn small { color: var(--faint); font-size: 11px; }
.bell-wrap { position: relative; }
.bell { position: relative; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; transition: color .2s, border-color .2s; }
.bell:hover, .bell[aria-expanded="true"] { color: var(--text); border-color: var(--border-strong); }
.bell svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell.ring svg { animation: ring 1s ease-in-out 2; transform-origin: 50% 10%; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 20% { transform: rotate(14deg); } 40% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } 80% { transform: rotate(-4deg); } }
.badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--loss); color: #fff; font: 700 10px/17px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--bg); }
.bell-panel { position: absolute; right: 0; top: 42px; width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: 0 24px 60px -20px #000; padding: 12px; z-index: 30; animation: pop .2s ease-out; }
.bell-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.alerts li.unread { border-color: rgba(244, 183, 64, .35); }
.pnl-box { height: 300px; }

.shell { margin-left: var(--sidebar); position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 46px; display: flex; align-items: center; gap: 16px;
  background: rgba(6, 10, 19, 0.82); border-bottom: 1px solid var(--border); backdrop-filter: blur(12px); padding-right: 20px;
}
.ticker { flex: 1; overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 4%, #000 96%, transparent); }
.ticker-track { display: inline-flex; gap: 34px; white-space: nowrap; padding-left: 20px; font-size: 12.5px; will-change: transform; }
.ticker-track.run { animation: ticker var(--ticker-dur, 40s) linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.tick { display: inline-flex; gap: 8px; align-items: baseline; }
.tick b { font-weight: 600; color: var(--text); }
.tick .mono { color: var(--muted); }
@keyframes ticker { to { transform: translateX(-50%); } }
.topbar-right { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); transition: background .3s; }
.live-dot.on { background: var(--gain); animation: pulse 2s infinite; }
.live-dot.err { background: var(--loss); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(22, 199, 132, .55); } 70% { box-shadow: 0 0 0 8px rgba(22, 199, 132, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 199, 132, 0); } }

.content { padding: 24px 28px 40px; max-width: 1480px; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.foot { padding: 16px 28px 26px; font-size: 11.5px; margin-top: auto; }

/* ---------- cards ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); backdrop-filter: blur(8px);
  animation: rise .55s cubic-bezier(.2, .8, .2, 1) both;
}
.card + .card, .grid-2 + .card, .card + .grid-2, .grid-2 + .grid-2, .kpis + .grid-2, .toolbar + .card, .card + section { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-2.tight { gap: 10px; margin-top: 10px; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.grid-2 > :nth-child(2) { animation-delay: .08s; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  transform: translateX(-100%); animation: shine 5s ease-in-out infinite;
}
.kpi:nth-child(2) { animation-delay: .05s; } .kpi:nth-child(3) { animation-delay: .1s; } .kpi:nth-child(4) { animation-delay: .15s; } .kpi:nth-child(5) { animation-delay: .2s; }
.kpi:nth-child(2)::after { animation-delay: 1s; } .kpi:nth-child(3)::after { animation-delay: 2s; } .kpi:nth-child(4)::after { animation-delay: 3s; } .kpi:nth-child(5)::after { animation-delay: 4s; }
@keyframes shine { 0%, 60% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.kpi-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi-value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--muted); min-height: 18px; }
.small-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.small-kpis .kpi-value { font-size: 20px; }
.currency-row { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- charts ---------- */
.chart-box { position: relative; height: 260px; }
.chart-box.donut { height: 260px; }
.chart-box.tall { height: 380px; }
.chart-box.short { height: 170px; }
.empty { color: var(--muted); text-align: center; padding: 30px 12px; margin: 0; }
.chart-box .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th.r { text-align: right; }
.tbl td { padding: 10px; border-bottom: 1px solid rgba(130, 160, 210, 0.07); white-space: nowrap; }
.tbl td.r { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.tbl.dense td { padding: 6px 10px; font-size: 12px; }
.tbl tr.closed td { opacity: .62; }
.asset-cell { display: flex; align-items: center; gap: 10px; }
.asset-cell small { display: block; color: var(--muted); font-size: 11.5px; }
.avatar { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 11px; background: var(--panel-2); border: 1px solid var(--border); color: var(--gold); flex: none; }
.avatar.crypto { color: var(--violet); }
.avatar.realestate { color: var(--blue); }

/* ---------- tags / pills ---------- */
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); }
.tag.gain { background: var(--gain-soft); color: var(--gain); border-color: transparent; }
.tag.loss { background: var(--loss-soft); color: var(--loss); border-color: transparent; }
.tag.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.chg { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-weight: 600; font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.chg.gain { background: var(--gain-soft); }
.chg.loss { background: var(--loss-soft); }

/* ---------- buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--panel-2); color: var(--text);
  font: 600 13px var(--font); cursor: pointer; transition: transform .12s, background .2s, border-color .2s, box-shadow .2s; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: rgba(160, 190, 240, 0.4); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, #18d08b, #0fa56d); border-color: transparent; color: #04140d; box-shadow: 0 6px 20px -8px rgba(22, 199, 132, .7); }
.btn.primary:hover { box-shadow: 0 8px 26px -6px rgba(22, 199, 132, .8); }
.btn.ghost { background: transparent; }
.btn.danger, .btn.ghost.danger { color: var(--loss); }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.link { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; text-decoration: underline; }

input, select, textarea {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: rgba(6, 10, 19, 0.6); color: var(--text); font: 14px var(--font); transition: border-color .2s, box-shadow .2s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gain); box-shadow: 0 0 0 3px var(--gain-soft); }
input[type="date"] { color-scheme: dark; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; }
.otp { font-family: var(--mono); font-size: 22px; letter-spacing: .4em; text-align: center; height: 50px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { width: auto; min-width: 160px; }
.inline-form select { width: auto; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.toolbar-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.toolbar-form select { min-width: 260px; }
.quick-ranges { display: flex; gap: 4px; }
.quick-ranges button { height: 38px; padding: 0 10px; background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 8px; cursor: pointer; font: 600 12px var(--font); }
.quick-ranges button:hover { color: var(--text); border-color: var(--border-strong); }
.quick-ranges.sm button { height: 28px; padding: 0 9px; font-size: 11.5px; }
.quick-ranges button.active { color: var(--text); background: var(--panel-2); border-color: var(--border-strong); }
.value-head { display: flex; align-items: baseline; gap: 10px; margin: -4px 0 8px; min-height: 20px; }
.value-head .mono { font-weight: 600; font-size: 13px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.tabs a { padding: 7px 16px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 13px; transition: all .2s; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }

.flash { padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 13px; border: 1px solid var(--border); background: var(--panel-2); animation: rise .4s both; }
.flash.success { border-color: rgba(22, 199, 132, .35); background: var(--gain-soft); color: #9af0c9; }
.flash.error { border-color: rgba(240, 70, 90, .35); background: var(--loss-soft); color: #ffb3bd; }
.flash.info { border-color: rgba(76, 141, 255, .35); background: rgba(76, 141, 255, .12); color: #b9d0ff; }

/* ---------- dialog ---------- */
.dialog { border: 1px solid var(--border-strong); border-radius: 16px; padding: 0; background: var(--panel-solid); color: var(--text); width: min(640px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px #000; }
.dialog::backdrop { background: rgba(2, 5, 12, 0.7); backdrop-filter: blur(4px); }
.dialog[open] { animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
.dialog .form { padding: 18px 20px; }
.dialog-head, .dialog-foot { display: flex; align-items: center; gap: 8px; }
.dialog-head { justify-content: space-between; }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(8px); } }

/* ---------- tracker cards ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.tcard { position: relative; overflow: hidden; padding: 16px 16px 14px; }
.tcard:nth-child(3n+2) { animation-delay: .06s; } .tcard:nth-child(3n) { animation-delay: .12s; }
.tcard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tcard-sym { font-size: 18px; font-weight: 700; }
.tcard-name { color: var(--muted); font-size: 12px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcard-price { font-family: var(--mono); font-size: 26px; font-weight: 600; margin: 8px 0 2px; letter-spacing: -0.02em; transition: color .4s; border-radius: 6px; display: inline-block; padding: 0 4px; margin-left: -4px; }
.flash-up { animation: flash-up 1.2s ease-out; }
.flash-down { animation: flash-down 1.2s ease-out; }
@keyframes flash-up { 0% { background: rgba(22, 199, 132, .35); color: var(--gain); } 100% { background: transparent; } }
@keyframes flash-down { 0% { background: rgba(240, 70, 90, .35); color: var(--loss); } 100% { background: transparent; } }
.spark { width: 100%; height: 56px; display: block; margin: 8px 0 10px; }
.spark path.line { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-dasharray: var(--len, 1000); stroke-dashoffset: var(--len, 1000); animation: draw 1.4s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.metrics > div { background: var(--panel-solid); padding: 7px 9px; }
.metrics span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.metrics b { font-family: var(--mono); font-weight: 500; font-size: 13px; }
.sr-bar { margin: 12px 0 4px; }
.sr-labels { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.sr-labels b { font-family: var(--mono); font-weight: 600; }
.sr-track { position: relative; height: 6px; border-radius: 6px; background: linear-gradient(90deg, var(--gain), #6d7a92 50%, var(--loss)); margin: 6px 0; opacity: .85; }
.sr-dot { position: absolute; top: 50%; width: 12px; height: 12px; border-radius: 50%; background: #fff; transform: translate(-50%, -50%); box-shadow: 0 0 0 3px rgba(255, 255, 255, .15), 0 0 12px rgba(255, 255, 255, .5); transition: left .8s cubic-bezier(.2, .8, .2, 1); }
.rsi-meter { position: relative; height: 4px; border-radius: 4px; margin-top: 5px; background: linear-gradient(90deg, var(--gain) 0 30%, #3a4659 30% 70%, var(--loss) 70%); }
.rsi-meter i { position: absolute; top: -3px; width: 2px; height: 10px; background: #fff; border-radius: 2px; transition: left .8s; }
.tcard-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; gap: 8px; flex-wrap: wrap; }
.tags { display: flex; gap: 5px; flex-wrap: wrap; }
.bias { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 9px; border-radius: 6px; }
.bias.Bullish { background: var(--gain-soft); color: var(--gain); }
.bias.Bearish { background: var(--loss-soft); color: var(--loss); }
.bias.Neutral { background: var(--gold-soft); color: var(--gold); }
.tcard .menu { display: flex; gap: 2px; }
.warmup { font-size: 11.5px; color: var(--gold); margin-top: 6px; }
.intro p { margin: 0; color: var(--muted); }
.re-status { text-transform: capitalize; }

/* ---------- alerts ---------- */
.alerts { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alerts li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); font-size: 12.5px; }
.alerts li .tag { flex: none; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
details summary { cursor: pointer; color: var(--muted); }

/* ---------- auth ---------- */
body.auth { display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-chart { position: fixed; left: 0; right: 0; bottom: 0; width: 100%; height: 42vh; z-index: 0; opacity: .7; }
.auth-line { fill: none; stroke: var(--gain); stroke-width: 2.5; stroke-dasharray: 2600; stroke-dashoffset: 2600; animation: draw 3.2s ease-out .2s forwards; filter: drop-shadow(0 0 8px rgba(22, 199, 132, .6)); }
.auth-area { opacity: 0; animation: fade 1.5s ease 1.6s forwards; }
@keyframes fade { to { opacity: 1; } }
.auth-wrap { position: relative; z-index: 1; width: min(420px, 100%); }
.auth-card { background: rgba(14, 22, 38, 0.86); border: 1px solid var(--border-strong); border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px -20px #000; backdrop-filter: blur(14px); animation: rise .6s both; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand strong { display: block; font-size: 18px; }
.auth-brand span { color: var(--muted); font-size: 12.5px; }
.auth-card h2 { margin-bottom: 4px; }
.auth-card p.muted { margin-top: 0; }
.auth-foot { text-align: center; font-size: 12px; margin-top: 14px; }
.qr-box { display: flex; justify-content: center; margin: 14px 0 8px; }
.qr-box #qr { background: #fff; padding: 12px; border-radius: 12px; }
.qr-box #qr img, .qr-box #qr canvas { display: block; }
.secret { font-size: 15px; letter-spacing: .08em; color: var(--gold); word-break: break-all; }
.message-card { max-width: 520px; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  .sidebar { top: auto; width: 100%; height: 62px; flex-direction: row; padding: 0 6px; border-right: 0; border-top: 1px solid var(--border); }
  .brand, .sidebar-foot { display: none; }
  .mkt-mini { display: inline-flex; }
  .sidebar nav { flex-direction: row; width: 100%; justify-content: space-around; }
  .sidebar nav a { flex-direction: column; gap: 3px; font-size: 10.5px; padding: 8px 6px; }
  .sidebar nav a.active::before { left: 20%; right: 20%; top: -1px; bottom: auto; width: auto; height: 3px; }
  .shell { padding-bottom: 70px; }
  .content { padding: 18px 16px 30px; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpis, .small-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
  .toolbar-form select { min-width: 0; width: 100%; }
  .toolbar-form label { flex: 1 1 140px; }
  .foot { padding: 12px 16px 80px; }
}
@media (max-width: 480px) {
  .kpi-value { font-size: 19px; }
  .inline-form input { min-width: 0; flex: 1; }
  .clock-btn small { display: none; }
  .mkt-mini { font-size: 0; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .spark path.line, .auth-line { stroke-dashoffset: 0; }
  .auth-area { opacity: 1; }
}
.tbl td.tags-cell { white-space: normal; min-width: 200px; }

.sr-src { display: flex; justify-content: space-between; gap: 12px; font-size: 10.5px; color: var(--faint); line-height: 1.3; }
.sr-src span:last-child { text-align: right; }
.sr-labels span[title] { cursor: help; }

/* ---------- AI chat ---------- */
.chat { position: fixed; right: 22px; bottom: 22px; z-index: 40; }
.chat-fab { width: 54px; height: 54px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center; color: #04140d;
  background: linear-gradient(135deg, #18d08b, #0fa56d 55%, #f4b740); box-shadow: 0 12px 30px -8px rgba(22, 199, 132, .7); transition: transform .2s; animation: fab-glow 3s ease-in-out infinite; }
.chat-fab:hover { transform: translateY(-2px) scale(1.04); }
.chat-fab svg { width: 24px; height: 24px; fill: currentColor; }
@keyframes fab-glow { 0%, 100% { box-shadow: 0 12px 30px -8px rgba(22, 199, 132, .7); } 50% { box-shadow: 0 12px 36px -4px rgba(244, 183, 64, .6); } }
.chat.open .chat-fab { display: none; }
.chat-panel { width: min(400px, calc(100vw - 24px)); height: min(600px, calc(100vh - 110px)); display: flex; flex-direction: column;
  background: var(--panel-solid); border: 1px solid var(--border-strong); border-radius: 18px; box-shadow: 0 30px 80px -20px #000; overflow: hidden; animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); background: linear-gradient(90deg, var(--gain-soft), transparent); }
.chat-title { display: flex; gap: 10px; align-items: center; }
.chat-title b { display: block; font-size: 14px; }
.chat-title small { color: var(--muted); font-size: 11px; }
.chat-avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold); font-size: 16px; }
.chat-actions { display: flex; gap: 2px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: 9px 12px; border-radius: 14px; font-size: 13.5px; line-height: 1.5; word-wrap: break-word; animation: rise .3s both; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(22, 199, 132, .22), rgba(22, 199, 132, .12)); border: 1px solid rgba(22, 199, 132, .25); border-bottom-right-radius: 4px; }
.msg.model { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.error { align-self: flex-start; background: var(--loss-soft); border: 1px solid rgba(240, 70, 90, .3); color: #ffc2ca; }
.msg p { margin: 0 0 6px; } .msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 4px 0 6px; padding-left: 18px; }
.msg li { margin: 2px 0; }
.msg code { font-family: var(--mono); font-size: 12px; }
.msg strong { color: #fff; }
.msg h4 { margin: 6px 0 4px; font-size: 13px; color: var(--gold); }
.msg .meta { display: block; margin-top: 4px; font-size: 10.5px; color: var(--faint); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.chat-suggest button { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); border-radius: 999px; padding: 5px 10px; font: 12px var(--font); cursor: pointer; }
.chat-suggest button:hover { color: var(--text); border-color: var(--gain); }
.chat-form { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-form textarea { resize: none; max-height: 120px; min-height: 38px; padding: 9px 12px; line-height: 1.4; }
.chat-form .btn { height: 38px; width: 42px; padding: 0; font-size: 15px; }
.chat-empty { color: var(--muted); font-size: 13px; text-align: center; margin: auto 10px; }
@media (max-width: 900px) {
  .chat { right: 12px; bottom: 76px; }
  .chat.open { left: 8px; right: 8px; }
  .chat-panel { width: 100%; height: calc(100vh - 150px); }
}

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.settings-grid fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 0; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.settings-grid legend { padding: 0 6px; font-weight: 600; font-size: 12.5px; color: var(--text); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.form label.check, .form label.switch { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.check input, .switch input { width: 16px; height: 16px; accent-color: var(--gain); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { width: 38px; height: 22px; border-radius: 22px; background: var(--panel-2); border: 1px solid var(--border-strong); position: relative; transition: background .2s; flex: none; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform .2s, background .2s; }
.switch input:checked + span { background: var(--gain-soft); border-color: var(--gain); }
.switch input:checked + span::after { transform: translateX(16px); background: var(--gain); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--gain-soft); }
.pair { display: flex; gap: 6px; }
.pair input { width: 80px; flex: none; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.smtp-only.off { display: none; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: 1fr; } }

/* ---------- level editor ---------- */
.lvl-btn { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 12px; padding: 0 4px; }
.lvl-btn:hover { color: var(--gold); }
.tag.manual { background: var(--gold-soft); color: var(--gold); border-color: transparent; font-size: 9.5px; padding: 0 6px; margin-left: 4px; vertical-align: 1px; }
.auto-hint { font-size: 11.5px; color: var(--muted); margin-top: -6px; }
