:root {
  --bg: #f4f6fb;
  --bg-soft: #eef2f9;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f1f5f9;
  --line: rgba(15, 23, 42, 0.1);
  --line-strong: rgba(15, 23, 42, 0.18);
  --text: #0f172a;
  --muted: #5b6b82;
  --muted-2: #7b8aa0;
  --accent: #2563eb;
  --accent-2: #0284c7;
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.1);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.09);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --purple: #7c3aed;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.12);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 18% -10%, rgba(59, 130, 246, 0.14), transparent 60%),
    radial-gradient(900px 460px at 100% 0%, rgba(56, 189, 248, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 20px; font-weight: 650; letter-spacing: 0.2px; }
h2 { font-size: 14px; font-weight: 650; letter-spacing: 0.2px; }
h3 { font-size: 13px; font-weight: 650; letter-spacing: 0.2px; }

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.eyebrow {
  display: block;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* ============================================================ layout */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 228px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  background: linear-gradient(180deg, rgba(13, 19, 31, 0.98), rgba(8, 12, 20, 0.98));
  border-right: 1px solid var(--line);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 20px; }
.logo {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 14px; letter-spacing: 0.3px; }
.brand-text span { font-size: 8.5px; letter-spacing: 1.6px; color: var(--muted-2); }

.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 17px; height: 17px; fill: currentColor; opacity: 0.85; }
.nav-item:hover { background: rgba(148, 163, 184, 0.08); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.2), rgba(59, 130, 246, 0.04));
  color: #dbeafe;
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-foot { margin-top: auto; padding: 14px 10px 2px; border-top: 1px solid var(--line); }
.mode-line { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); display: inline-block; flex: none; }
.dot.live { background: var(--green); box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.12); }
.dot.bad { background: var(--red); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.12); }
.side-note { margin: 8px 0 12px; font-size: 10.5px; color: var(--muted-2); letter-spacing: 0.4px; }
.link-btn {
  border: 0; background: none; padding: 0;
  color: var(--muted); font-size: 12px;
}
.link-btn:hover { color: var(--accent-2); text-decoration: underline; }

.main { margin-left: 228px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: rgba(7, 10, 16, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 130px; }
.topbar-title .eyebrow { margin-bottom: 0; }
.topbar-stats { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.05);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.chip strong { color: var(--text); font-weight: 600; }

.content { padding: 22px 24px 56px; width: 100%; max-width: 1620px; margin: 0 auto; }
.view { display: none; animation: fade 0.18s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ============================================================ panels */
.panel {
  background: linear-gradient(180deg, rgba(17, 25, 39, 0.92), rgba(12, 18, 29, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
  min-width: 0;
}
.panel.flat { background: rgba(11, 16, 26, 0.6); box-shadow: none; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.panel-head.mt { margin-top: 18px; }
.panel-head .sub { display: block; margin-top: 2px; font-size: 11px; color: var(--muted-2); }
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 11px;
  font-family: var(--mono);
  white-space: nowrap;
}

.grid-charts { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; }
.grid-pos { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; }
.grid-half { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-news { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(300px, 1fr); gap: 16px; }
.grid-research { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr); gap: 16px; }
.side-col { min-width: 0; }

/* ============================================================ KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  position: relative;
  padding: 14px 15px;
  background: linear-gradient(180deg, rgba(17, 25, 39, 0.92), rgba(11, 16, 26, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.35), transparent);
  opacity: 0.5;
}
.kpi .label { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.kpi .value { margin-top: 6px; font-size: 23px; font-weight: 650; letter-spacing: -0.3px; font-variant-numeric: tabular-nums; }
.kpi .value.sm { font-size: 18px; }
.kpi .foot { margin-top: 4px; font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; }
.kpi .spark { position: absolute; right: 12px; top: 16px; width: 54px; height: 22px; opacity: 0.7; }

.pos { color: var(--green); }
.neg { color: var(--red); }
.neutral { color: var(--muted); }
.amber { color: var(--amber); }

/* ============================================================ charts */
.chart { width: 100%; height: 292px; }
#daily-chart { height: 292px; }
.trade-chart { height: 430px; margin: 2px 0 4px; }
.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 8px;
  flex-wrap: wrap;
}
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.chart-legend span::before {
  content: "";
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 2px;
  margin-right: 5px;
  background: var(--c, var(--muted));
}

/* ============================================================ buttons/forms */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: rgba(148, 163, 184, 0.07);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: rgba(148, 163, 184, 0.13); border-color: rgba(148, 163, 184, 0.3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { height: 30px; padding: 0 11px; font-size: 12px; }
.btn.block { width: 100%; height: 40px; margin-top: 4px; }
.btn.primary { background: linear-gradient(180deg, #2f7df6, #2563eb); border-color: #3b82f6; color: #fff; }
.btn.primary:hover { background: linear-gradient(180deg, #3b8bfa, #2a6ef0); }
.btn.danger { background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.35); color: #fca5a5; }
.btn.danger:hover { background: rgba(239, 68, 68, 0.2); }
.btn.ghost { background: transparent; }
.btn.warn { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.35); color: #fcd34d; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.icon-btn:hover { color: var(--text); background: rgba(148, 163, 184, 0.12); }
.icon-btn svg { width: 17px; height: 17px; fill: currentColor; }

input, select, textarea {
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(7, 11, 18, 0.65);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: rgba(59, 130, 246, 0.55);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
select { padding-right: 26px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 14px) 13px, calc(100% - 9px) 13px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea { height: auto; padding: 9px 10px; resize: vertical; line-height: 1.55; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.filters.inline { margin-bottom: 0; }
.filters input { width: 200px; }
.list-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; align-items: center; gap: 8px; }

.seg { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: rgba(7, 11, 18, 0.55); }
.seg button {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-family: var(--mono);
}
.seg button.active { background: rgba(59, 130, 246, 0.18); color: #bfdbfe; }

/* ============================================================ tables */
.table-wrap { width: 100%; overflow: auto; border-radius: 9px; border: 1px solid var(--line); }
.table-wrap.table-tall { max-height: 440px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap; }
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 11px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted-2);
  background: #0d1521;
  border-bottom: 1px solid var(--line);
}
table.data tbody td { padding: 9px 11px; border-bottom: 1px solid rgba(148, 163, 184, 0.06); color: #cbd5e1; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: rgba(59, 130, 246, 0.045); }
table.data.clickable tbody tr { cursor: pointer; }
table.data .num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
table.data .empty { padding: 26px 12px; text-align: center; color: var(--muted-2); }
table.data .sym { font-weight: 600; color: var(--text); letter-spacing: 0.2px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.07);
  color: var(--muted);
}
.tag.long { color: #86efac; background: var(--green-soft); border-color: rgba(34, 197, 94, 0.25); }
.tag.short { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, 0.25); }
.tag.open { color: #93c5fd; background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.25); }
.tag.closed { color: #cbd5e1; background: rgba(148, 163, 184, 0.09); }
.tag.pending { color: #fcd34d; background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.25); }
.tag.error, .tag.rejected { color: #fca5a5; background: var(--red-soft); border-color: rgba(239, 68, 68, 0.25); }
.tag.new { color: #93c5fd; background: rgba(59, 130, 246, 0.12); border-color: rgba(59, 130, 246, 0.25); }

.mini-table { font-size: 11.5px; }
.mini-table .row { display: grid; grid-template-columns: 1.1fr 1fr 0.9fr 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.06); color: #cbd5e1; }
.mini-table .row.head { color: var(--muted-2); font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; }
.mini-table .row span:last-child { text-align: right; }
.mini-table .empty { color: var(--muted-2); padding: 8px 0; }

/* ============================================================ risk */
.risk-panel { display: flex; flex-direction: column; gap: 13px; }
.risk-row .top { display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; margin-bottom: 5px; }
.risk-row .top span:first-child { color: var(--muted); }
.risk-row .top span:last-child { font-family: var(--mono); color: var(--text); }
.meter { height: 6px; border-radius: 4px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, #3b82f6, #38bdf8); transition: width 0.4s; }
.meter > i.warn { background: linear-gradient(90deg, #f59e0b, #f97316); }
.meter > i.bad { background: linear-gradient(90deg, #ef4444, #dc2626); }
.risk-state { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px; background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.2); color: #86efac; font-size: 12px; }
.risk-state.halted { background: var(--red-soft); border-color: rgba(239, 68, 68, 0.25); color: #fca5a5; }
.risk-state.paused { background: var(--amber-soft); border-color: rgba(245, 158, 11, 0.25); color: #fcd34d; }
.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.risk-stat { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7, 11, 18, 0.4); }
.risk-stat .k { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.5px; }
.risk-stat .v { font-size: 14px; font-family: var(--mono); margin-top: 2px; }

/* ============================================================ news */
.news-mini { display: flex; flex-direction: column; }
.news-mini .item { padding: 9px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.07); }
.news-mini .item:last-child { border-bottom: 0; }
.news-mini .title { font-size: 12.5px; color: #dbeafe; line-height: 1.45; display: block; }
.news-mini .meta { margin-top: 3px; font-size: 10.5px; color: var(--muted-2); display: flex; gap: 8px; flex-wrap: wrap; }

.news-list { display: flex; flex-direction: column; gap: 10px; max-height: 780px; overflow: auto; padding-right: 4px; }
.news-card {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 14, 23, 0.55);
}
.news-card.hot { border-color: rgba(245, 158, 11, 0.28); background: linear-gradient(180deg, rgba(245, 158, 11, 0.06), rgba(9, 14, 23, 0.55)); }
.news-card .head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.news-card .title { font-size: 13.5px; color: #e2e8f0; font-weight: 550; line-height: 1.45; }
.news-card .title:hover { color: #bfdbfe; }
.news-card .summary { margin-top: 6px; font-size: 12px; color: var(--muted); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .foot { margin-top: 9px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 10.5px; color: var(--muted-2); }
.impact { display: inline-flex; align-items: center; gap: 6px; }
.impact .bar { width: 52px; height: 4px; border-radius: 2px; background: rgba(148, 163, 184, 0.12); overflow: hidden; }
.impact .bar i { display: block; height: 100%; background: linear-gradient(90deg, #64748b, #f59e0b); }
.sentiment-bull { color: var(--green); }
.sentiment-bear { color: var(--red); }
.sentiment-neutral { color: var(--muted); }

.earnings-list, .earnings-mini { display: flex; flex-direction: column; gap: 8px; max-height: 700px; overflow: auto; }
.earning {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 14, 23, 0.45);
  font-size: 12px;
}
.earning .date { color: var(--muted); font-family: var(--mono); font-size: 11px; }
.earning .sym { font-weight: 600; }
.earning .hour { font-size: 10px; color: var(--amber); }
.hint { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: rgba(59, 130, 246, 0.06); border: 1px solid rgba(59, 130, 246, 0.14); font-size: 11.5px; color: #93c5fd; line-height: 1.55; }

/* ============================================================ research */
.markdown { font-size: 13px; line-height: 1.72; color: #cbd5e1; max-height: 900px; overflow: auto; padding-right: 6px; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { color: var(--text); margin: 20px 0 8px; }
.markdown h1 { font-size: 20px; }
.markdown h2 { font-size: 16px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.markdown h3 { font-size: 14px; }
.markdown h4 { font-size: 13px; }
.markdown p { margin: 6px 0; }
.markdown ul, .markdown ol { margin: 6px 0; padding-left: 20px; }
.markdown li { margin: 3px 0; }
.markdown code { font-family: var(--mono); font-size: 12px; padding: 1px 5px; border-radius: 4px; background: rgba(148, 163, 184, 0.12); }
.markdown pre { padding: 12px; background: #080d15; border: 1px solid var(--line); border-radius: 8px; overflow: auto; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { margin: 10px 0; padding: 8px 12px; border-left: 2px solid var(--accent); background: rgba(59, 130, 246, 0.06); color: var(--muted); }
.markdown table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 12px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; }
.markdown th { background: rgba(148, 163, 184, 0.06); }
.markdown strong { color: var(--text); }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

.theses { display: flex; flex-direction: column; gap: 9px; max-height: 460px; overflow: auto; }
.thesis { padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: rgba(9, 14, 23, 0.5); }
.thesis .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thesis .sym { font-weight: 600; }
.thesis .text { margin-top: 6px; font-size: 12px; color: #cbd5e1; line-height: 1.55; }
.thesis .meta { margin-top: 6px; font-size: 10.5px; color: var(--muted-2); display: flex; gap: 10px; flex-wrap: wrap; }
.conviction { height: 4px; border-radius: 2px; background: rgba(148, 163, 184, 0.12); width: 70px; overflow: hidden; }
.conviction i { display: block; height: 100%; background: linear-gradient(90deg, #3b82f6, #a78bfa); }

.upload-form { display: flex; flex-direction: column; gap: 8px; }
.upload-form input[type="file"] { height: auto; padding: 7px 9px; font-size: 11.5px; }
.history { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.history .item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 9px; border-radius: 7px; border: 1px solid transparent; font-size: 12px; cursor: pointer; }
.history .item:hover { background: rgba(148, 163, 184, 0.07); border-color: var(--line); }
.history .item.active { background: rgba(59, 130, 246, 0.1); border-color: rgba(59, 130, 246, 0.25); }
.history .date { color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; white-space: nowrap; }
.research-mini .excerpt { font-size: 12.5px; color: var(--muted); line-height: 1.65; white-space: pre-wrap; max-height: 220px; overflow: hidden; position: relative; }
.research-mini .excerpt::after { content: ""; position: absolute; inset: auto 0 0 0; height: 50px; background: linear-gradient(transparent, #0e141f); }
.research-mini .meta { font-size: 10.5px; color: var(--muted-2); margin-bottom: 8px; }

/* ============================================================ system */
.config-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; font-size: 12px; }
.config-list .kv { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(148, 163, 184, 0.06); }
.config-list .k { color: var(--muted); }
.config-list .v { font-family: var(--mono); color: var(--text); text-align: right; }
.logs {
  margin: 0;
  padding: 12px;
  max-height: 420px;
  overflow: auto;
  background: #070b12;
  border: 1px solid var(--line);
  border-radius: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.55;
  color: #9fb0c7;
  white-space: pre-wrap;
  word-break: break-all;
}
.logs.short { max-height: 260px; }

.prog { display: flex; align-items: center; gap: 7px; min-width: 100px; }
.prog .meter { flex: 1; min-width: 48px; }
.prog span { font-family: var(--mono); font-size: 10px; color: var(--muted); }

.context-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.context-box {
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 11, 18, 0.45);
  min-width: 0;
}
.context-box.wide { grid-column: 1 / -1; }
.context-box .k { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.5px; }
.context-box .v { margin-top: 3px; font-size: 13px; font-family: var(--mono); word-break: break-word; }

.wrap-cell {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  max-width: 340px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

/* ============================================================ timeline */
.timeline { display: flex; flex-direction: column; max-height: 330px; overflow: auto; padding-left: 4px; }
.tl-item { position: relative; padding: 0 0 13px 18px; border-left: 1px solid var(--line); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-item::before {
  content: "";
  position: absolute;
  left: -4px; top: 5px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted-2);
}
.tl-item.hot::before { background: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.13); }
.tl-item.exit::before { background: var(--accent-2); }
.tl-time { font-size: 10px; color: var(--muted-2); font-family: var(--mono); }
.tl-body { font-size: 12px; color: #cbd5e1; }
.tl-body strong { color: var(--text); font-weight: 600; }
.tl-payload { margin-top: 3px; font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); white-space: pre-wrap; word-break: break-all; }

/* ============================================================ modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 28px 20px;
  background: rgba(3, 6, 12, 0.72);
  backdrop-filter: blur(5px);
  overflow: auto;
}
.modal {
  width: min(1120px, 100%);
  background: linear-gradient(180deg, #101826, #0a101a);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  animation: pop 0.16s ease;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.995); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 20px; }
.modal-tags { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.modal-actions { display: flex; gap: 8px; align-items: center; }
.modal-body { padding: 18px 20px 24px; }
.detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 6px;
}
.stat { padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(7, 11, 18, 0.45); }
.stat .k { font-size: 10px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.5px; }
.stat .v { margin-top: 4px; font-size: 15px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat .s { margin-top: 2px; font-size: 10px; color: var(--muted-2); }

.replay-bar { display: flex; align-items: center; gap: 12px; margin: 8px 0 16px; }
.replay-bar input[type="range"] { flex: 1; height: 4px; padding: 0; border: 0; background: transparent; accent-color: var(--accent); }
.replay-bar span { font-size: 10.5px; color: var(--muted); min-width: 150px; text-align: right; }

.notes-row { display: flex; gap: 8px; margin-top: 8px; }
.notes-row input { flex: 1; }
#tm-notes { width: 100%; }
#tm-signal .reasons { margin: 0; padding-left: 17px; font-size: 12px; color: #cbd5e1; }
#tm-signal .reasons li { margin: 3px 0; }
#tm-signal .subblock { margin-top: 10px; }
#tm-signal .subblock h4 { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 5px; }
details.raw { margin-top: 8px; }
details.raw summary { cursor: pointer; font-size: 11px; color: var(--muted); }
details.raw pre { margin: 6px 0 0; padding: 10px; background: #070b12; border: 1px solid var(--line); border-radius: 7px; font-size: 10px; max-height: 220px; overflow: auto; color: #9fb0c7; }

/* ============================================================ toast */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  min-width: 220px;
  max-width: 420px;
  padding: 10px 14px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #131c2b;
  box-shadow: var(--shadow);
  font-size: 12.5px;
  color: var(--text);
  animation: pop 0.15s ease;
}
.toast.ok { border-color: rgba(34, 197, 94, 0.35); }
.toast.err { border-color: rgba(239, 68, 68, 0.4); }

/* ============================================================ login */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}
.login-shell { width: min(400px, 100%); }
.login-card {
  padding: 30px 28px 24px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(17, 25, 39, 0.96), rgba(9, 14, 23, 0.96));
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 26px; }
.login-brand div { display: flex; flex-direction: column; line-height: 1.3; }
.login-brand strong { font-size: 13px; }
.login-brand span { font-size: 8px; letter-spacing: 1.6px; color: var(--muted-2); }
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card > .muted { font-size: 12px; }
.login-form { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.login-form label { font-size: 11.5px; color: var(--muted); }
.login-form input { height: 40px; }
.alert {
  margin-top: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  background: var(--red-soft);
  color: #fca5a5;
  font-size: 12px;
  line-height: 1.5;
}
.login-foot { margin-top: 18px; font-size: 10.5px; color: var(--muted-2); text-align: center; }
.login-note { margin-top: 14px; text-align: center; font-size: 10.5px; color: var(--muted-2); line-height: 1.5; }

/* ============================================================ war room */
.war-room {
  position: relative;
  height: calc(100vh - 106px);
  min-height: 700px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1.95fr) minmax(0, 0.95fr);
  gap: 10px;
  overflow: hidden;
  isolation: isolate;
}
.war-room::before {
  content: "";
  position: absolute;
  inset: -36px -24px;
  z-index: 0;
  background-image:
    linear-gradient(rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(56, 189, 248, 0.035) 1px, transparent 1px),
    radial-gradient(760px 380px at 15% 0%, rgba(37, 99, 235, 0.14), transparent 65%),
    radial-gradient(620px 320px at 92% 4%, rgba(167, 139, 250, 0.1), transparent 62%);
  background-size: 42px 42px, 42px 42px, auto, auto;
  opacity: 0.9;
  mask-image: radial-gradient(1200px 720px at 50% 30%, #000 45%, transparent 100%);
  pointer-events: none;
}
.war-room::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
  pointer-events: none;
}
.war-room > * { position: relative; z-index: 1; }
.war-room:not(.active) { display: none; }
.war-room.active { display: grid; }
body.view-bots .content { padding-bottom: 10px; }

.wr-top { display: flex; align-items: flex-start; gap: 18px; padding: 2px 4px 0; }
.wr-headline { min-width: 0; flex: 1; }
.wr-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 1.8px;
  color: #7dd3fc;
}
.wr-beacon {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12), 0 0 16px rgba(34, 197, 94, 0.55);
  animation: wrBeacon 2.4s ease-out infinite;
}
@keyframes wrBeacon {
  0%, 100% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1), 0 0 10px rgba(34, 197, 94, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.03), 0 0 20px rgba(34, 197, 94, 0.65); }
}
.wr-headline h2 {
  margin-top: 5px;
  font-size: clamp(18px, 1.45vw, 24px);
  letter-spacing: 0.2px;
  background: linear-gradient(92deg, #f1f5f9 20%, #93c5fd 70%, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.wr-headline p { margin-top: 3px; font-size: 11px; color: var(--muted-2); letter-spacing: 0.2px; }
.wr-orch-stats { display: grid; grid-template-columns: repeat(4, minmax(96px, auto)); gap: 8px; flex: none; }
.wr-stat {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(13, 21, 34, 0.82), rgba(7, 11, 18, 0.7));
  min-width: 0;
}
.wr-stat .k { font-size: 9px; letter-spacing: 0.7px; text-transform: uppercase; color: var(--muted-2); white-space: nowrap; }
.wr-stat .v { margin-top: 2px; font-family: var(--mono); font-size: 14px; white-space: nowrap; }
.wr-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.wr-brief-source {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--muted-2);
  white-space: nowrap;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.04);
}
.wr-brief-source.llm { color: #c4b5fd; border-color: rgba(167, 139, 250, 0.32); }

.wr-pipeline {
  display: flex;
  gap: 10px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12, 19, 31, 0.9), rgba(7, 11, 18, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}
.wr-stage { position: relative; flex: 1; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 1px 3px; }
.wr-stage::after {
  content: "";
  position: absolute;
  right: -8px;
  top: 50%;
  width: 13px;
  height: 1px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.32), rgba(148, 163, 184, 0.05));
}
.wr-stage:last-child::after { display: none; }
.wr-node {
  width: 30px;
  height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(148, 163, 184, 0.05);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}
.wr-stage-copy { min-width: 0; line-height: 1.25; }
.wr-stage-copy strong { display: block; font-size: 11px; font-weight: 600; letter-spacing: 0.2px; }
.wr-stage-copy span {
  display: block;
  margin-top: 1px;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wr-stage.state-ok .wr-node { color: #86efac; border-color: rgba(34, 197, 94, 0.45); background: rgba(34, 197, 94, 0.1); box-shadow: 0 0 16px rgba(34, 197, 94, 0.1); }
.wr-stage.state-active .wr-node { color: #bae6fd; border-color: rgba(56, 189, 248, 0.7); background: rgba(56, 189, 248, 0.16); box-shadow: 0 0 22px rgba(56, 189, 248, 0.3); animation: wrNode 2.2s ease-in-out infinite; }
.wr-stage.state-alert .wr-node { color: #fca5a5; border-color: rgba(239, 68, 68, 0.55); background: rgba(239, 68, 68, 0.14); box-shadow: 0 0 18px rgba(239, 68, 68, 0.15); }
.wr-stage.state-watch .wr-node, .wr-stage.state-wait .wr-node { color: #fcd34d; border-color: rgba(245, 158, 11, 0.4); background: rgba(245, 158, 11, 0.1); }
@keyframes wrNode {
  0%, 100% { box-shadow: 0 0 16px rgba(56, 189, 248, 0.18); }
  50% { box-shadow: 0 0 26px rgba(56, 189, 248, 0.45); }
}

.wr-bots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; min-height: 0; }
.wr-loading {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-size: 12px;
  border: 1px dashed var(--line);
  border-radius: 13px;
}
.wr-bot {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 12px 13px 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    radial-gradient(320px 160px at 50% -20%, rgba(56, 189, 248, 0.08), transparent 70%),
    linear-gradient(180deg, rgba(15, 23, 37, 0.96), rgba(8, 13, 21, 0.97));
  overflow: hidden;
  animation: wrIn 0.32s ease both;
}
.wr-bot:nth-child(2) { animation-delay: 0.03s; }
.wr-bot:nth-child(3) { animation-delay: 0.06s; }
.wr-bot:nth-child(4) { animation-delay: 0.09s; }
.wr-bot:nth-child(5) { animation-delay: 0.12s; }
.wr-bots.ready .wr-bot { animation: none; }
@keyframes wrIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.wr-bot::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent 5%, var(--ac) 50%, transparent 95%);
  opacity: 0.8;
}
.wr-bot::after {
  content: "";
  position: absolute;
  right: -50px;
  bottom: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--ac), transparent 66%);
  opacity: 0.06;
  pointer-events: none;
}
.wr-bot.status-alert { border-color: rgba(239, 68, 68, 0.42); box-shadow: inset 0 0 50px rgba(239, 68, 68, 0.055); }
.wr-bot.status-watch { border-color: rgba(245, 158, 11, 0.32); }
.wr-bot-top { display: flex; align-items: flex-start; gap: 9px; }
.wr-avatar-wrap {
  position: relative;
  width: 46px;
  height: 52px;
  flex: none;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 0 12px var(--ac));
}
.wr-avatar {
  width: 44px;
  height: 50px;
  display: grid;
  place-items: center;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: linear-gradient(165deg, var(--ac) 0%, rgba(9, 14, 23, 0.98) 76%);
  color: #f8fafc;
  position: relative;
}
.wr-avatar::after {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
  background: linear-gradient(180deg, rgba(9, 14, 23, 0.55), rgba(7, 11, 18, 0.95));
}
.wr-avatar svg { position: relative; z-index: 1; width: 20px; height: 20px; fill: currentColor; filter: drop-shadow(0 0 6px var(--ac)); }
.wr-bot-id { min-width: 0; flex: 1; padding-top: 1px; }
.wr-bot-id .code { font-family: var(--mono); font-size: 8.5px; letter-spacing: 1.2px; color: var(--muted-2); }
.wr-bot-id h3 { font-size: 13.5px; font-weight: 650; letter-spacing: 0.2px; white-space: nowrap; }
.wr-bot-id .role { display: block; margin-top: 1px; font-size: 9.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.06);
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
  flex: none;
}
.wr-status i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.wr-bot.status-online .wr-status { color: #86efac; border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); }
.wr-bot.status-active .wr-status { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.1); }
.wr-bot.status-watch .wr-status { color: #fcd34d; border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.08); }
.wr-bot.status-alert .wr-status { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.wr-bot.status-standby .wr-status { color: var(--muted); }
.wr-bot.status-active .wr-status i { animation: wrBeacon 1.6s infinite; }

.wr-task {
  margin-top: 9px;
  padding: 7px 9px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.5);
}
.wr-task span { display: block; font-size: 8.5px; letter-spacing: 0.7px; text-transform: uppercase; color: var(--muted-2); }
.wr-task strong { display: block; margin-top: 1px; font-size: 10.5px; font-weight: 550; color: #cbd5e1; line-height: 1.35; }
.wr-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.wr-metric {
  min-width: 0;
  padding: 6px 7px;
  border: 1px solid rgba(148, 163, 184, 0.08);
  border-radius: 7px;
  background: rgba(7, 11, 18, 0.42);
}
.wr-metric .k { font-size: 8.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-metric .v { margin-top: 1px; font-family: var(--mono); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-metric .h { margin-top: 1px; font-size: 8px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-narr {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  padding: 7px 9px 7px 11px;
  border: 1px solid rgba(56, 189, 248, 0.13);
  border-radius: 8px;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.06), rgba(7, 11, 18, 0.25));
  overflow: auto;
}
.wr-narr::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--ac), transparent);
}
.wr-narr-tag {
  display: inline-block;
  margin-bottom: 2px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.9px;
  color: var(--muted-2);
}
.wr-narr p { font-size: 10.3px; line-height: 1.55; color: #cbd5e1; }
.wr-mini-feed { flex: none; margin-top: 7px; padding-top: 6px; border-top: 1px solid rgba(148, 163, 184, 0.07); display: flex; flex-direction: column; gap: 3px; }
.wr-mini-item { display: flex; gap: 6px; align-items: baseline; min-width: 0; font-size: 9px; color: var(--muted); }
.wr-mini-item time { flex: none; font-family: var(--mono); font-size: 8px; color: var(--muted-2); }
.wr-mini-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-mini-empty { font-size: 9px; color: var(--muted-2); }

/* ---------------------------------------------- telemetry ticker */
.wr-ticker {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 24px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.78);
  overflow: hidden;
}
.wr-ticker-label {
  flex: none;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1.4px;
  color: #7dd3fc;
}
.wr-ticker-mask {
  flex: 1;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 5%, #000 95%, transparent);
}
.wr-ticker-track {
  display: inline-block;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--muted);
  animation: wrTicker 46s linear infinite;
  will-change: transform;
}
.wr-ticker:hover .wr-ticker-track { animation-play-state: paused; }
.wr-ticker-track b { color: #cbd5e1; font-weight: 500; }
.wr-ticker-track span { margin-right: 26px; }
.wr-ticker-track i { font-style: normal; color: #6ee7b7; }
@keyframes wrTicker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------------------------------------------- arena */
.wr-arena {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr) 348px;
  grid-template-areas: "crew core side";
  gap: 12px;
  min-height: 0;
}
.wr-crew { grid-area: crew; display: flex; flex-direction: column; gap: 6px; min-height: 0; overflow: auto; padding-right: 2px; scrollbar-width: thin; }
.wr-crew .wr-loading { flex: 1; border: 1px dashed var(--line); border-radius: 12px; display: grid; place-items: center; color: var(--muted-2); font-size: 11px; }
.wr-crew-item {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  grid-template-areas:
    "avatar id status"
    "narr narr narr"
    "foot foot foot";
  gap: 3px 7px;
  width: 100%;
  padding: 5px 8px 5px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(14, 22, 36, 0.92), rgba(8, 13, 21, 0.94));
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}
.wr-crew-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--ac), transparent 85%);
  opacity: 0.85;
}
.wr-crew-item:hover { transform: translateX(2px); border-color: rgba(148, 163, 184, 0.28); }
.wr-crew-item.selected { border-color: var(--ac); background: radial-gradient(240px 90px at 0% 0%, rgba(56, 189, 248, 0.1), transparent 70%), linear-gradient(180deg, rgba(14, 22, 36, 0.95), rgba(8, 13, 21, 0.96)); }
.wr-crew-item.status-alert { border-color: rgba(239, 68, 68, 0.4); }
.wr-crew-item.status-watch { border-color: rgba(245, 158, 11, 0.3); }
.wr-crew-item.status-online .wr-status { color: #86efac; border-color: rgba(34, 197, 94, 0.3); background: rgba(34, 197, 94, 0.08); }
.wr-crew-item.status-active .wr-status { color: #7dd3fc; border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.1); }
.wr-crew-item.status-watch .wr-status { color: #fcd34d; border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.08); }
.wr-crew-item.status-alert .wr-status { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.wr-crew-item.status-standby .wr-status { color: var(--muted); }
.wr-crew-item.status-active .wr-status i { animation: wrBeacon 1.6s infinite; }
.wr-crew-item:focus-visible { outline: 1px solid var(--ac); outline-offset: 1px; }
.wr-crew-item .wr-avatar-wrap { grid-area: avatar; width: 30px; height: 33px; }
.wr-crew-item .wr-avatar { width: 29px; height: 32px; }
.wr-crew-item .wr-avatar svg { width: 13px; height: 13px; }
.wr-crew-id { grid-area: id; min-width: 0; padding-top: 1px; align-self: center; }
.wr-crew-id .code { display: block; font-family: var(--mono); font-size: 7.5px; letter-spacing: 1px; color: var(--muted-2); }
.wr-crew-id h3 { font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.wr-crew-item .wr-status { grid-area: status; align-self: center; height: 16px; padding: 0 6px; font-size: 8px; }
.wr-crew-item .wr-status i { width: 5px; height: 5px; }
.wr-crew-narr { grid-area: narr; min-width: 0; }
.wr-crew-narr .wr-narr-tag { display: block; margin-bottom: 0; font-size: 7px; line-height: 1.1; }
.wr-crew-narr p {
  font-size: 8.8px;
  line-height: 1.3;
  color: #b9c5d6;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wr-crew-foot { grid-area: foot; display: flex; align-items: center; gap: 6px; min-width: 0; }
.wr-crew-foot .m { font-family: var(--mono); font-size: 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-crew-foot .m + .m { margin-left: auto; color: #cbd5e1; }
.eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 8px; flex: none; }
.eq i { width: 2px; height: 100%; border-radius: 1px; background: var(--ac, #38bdf8); animation: wrEq 1.1s ease-in-out infinite; transform-origin: bottom; }
.eq i:nth-child(2) { animation-delay: 0.18s; }
.eq i:nth-child(3) { animation-delay: 0.36s; }
.eq i:nth-child(4) { animation-delay: 0.1s; }
.status-active .eq i { animation-duration: 0.55s; }
.status-watch .eq i { animation-duration: 1.6s; }
.status-standby .eq i { animation-duration: 2.4s; opacity: 0.45; }
.status-alert .eq i { background: var(--red); animation-duration: 0.4s; }
@keyframes wrEq {
  0%, 100% { transform: scaleY(0.28); }
  50% { transform: scaleY(1); }
}

/* ---------------------------------------------- collaboration core */
.wr-core {
  grid-area: core;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background:
    radial-gradient(520px 280px at 50% 55%, rgba(37, 99, 235, 0.12), transparent 72%),
    linear-gradient(180deg, rgba(10, 17, 29, 0.96), rgba(6, 10, 18, 0.98));
  overflow: hidden;
}
.wr-core::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, rgba(148, 163, 184, 0.028) 0 1px, transparent 1px 3px);
  pointer-events: none;
}
.wr-core-top {
  position: relative;
  z-index: 2;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  background: linear-gradient(180deg, rgba(13, 21, 34, 0.9), rgba(10, 17, 29, 0.55));
}
.wr-core-title { display: flex; align-items: center; gap: 9px; min-width: 0; flex: none; }
.wr-core-title h3 { font-size: 12px; white-space: nowrap; }
.wr-core-sub { font-family: var(--mono); font-size: 8px; letter-spacing: 0.8px; color: var(--muted-2); white-space: nowrap; }
.wr-mode-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: rgba(7, 11, 18, 0.66); flex: none; }
.wr-mode-switch button {
  height: 18px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 8.5px;
  letter-spacing: 0.4px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}
.wr-mode-switch button:hover { color: #e2e8f0; }
.wr-mode-switch button.active { background: rgba(56, 189, 248, 0.16); color: #bae6fd; box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.28); }
.wr-live { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-size: 8px; letter-spacing: 1.2px; color: #86efac; }
.wr-live i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(34, 197, 94, 0.8); animation: wrBeacon 2s infinite; }
.wr-core-metrics { display: flex; align-items: baseline; gap: 13px; flex: none; }
.wr-cm { display: inline-flex; align-items: baseline; gap: 4px; font-size: 8.5px; color: var(--muted-2); white-space: nowrap; }
.wr-cm b { font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: #e2e8f0; }
.wr-canvas-wrap { position: relative; z-index: 1; flex: 1; min-height: 0; }
#wr-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wr-core-corner {
  position: absolute;
  top: 8px;
  font-family: var(--mono);
  font-size: 7.5px;
  letter-spacing: 1.3px;
  color: rgba(148, 163, 184, 0.55);
  pointer-events: none;
  white-space: nowrap;
}
.wr-core-corner.tl { left: 12px; }
.wr-core-corner.tr { right: 12px; color: #86efac; }
.wr-core-corner.tr.warn { color: #fcd34d; }
.wr-core-corner.tr.danger { color: #fca5a5; }
.wr-core-legend { position: absolute; left: 12px; bottom: 8px; display: flex; align-items: center; gap: 11px; font-size: 8.5px; color: var(--muted-2); pointer-events: none; }
.wr-core-legend span { display: inline-flex; align-items: center; gap: 4px; }
.wr-core-legend i { width: 5px; height: 5px; border-radius: 50%; background: var(--c); box-shadow: 0 0 7px var(--c); }
.wr-core-hint { position: absolute; right: 12px; bottom: 8px; font-size: 8px; color: rgba(148, 163, 184, 0.55); pointer-events: none; }

/* ---------------------------------------------- side panels */
.wr-side { grid-area: side; display: grid; grid-template-rows: minmax(0, 0.82fr) minmax(0, 1.18fr); gap: 12px; min-height: 0; }
.wr-side-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(12, 19, 31, 0.94), rgba(8, 13, 21, 0.96));
}
.wr-side-panel .wr-panel-head { margin-bottom: 6px; }
.wr-observe-list, .wr-stack-list { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 2px; }
.wr-observe-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) 62px; align-items: center; gap: 8px; }
.wr-observe-row .k { font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-observe-row .bar { height: 3px; border-radius: 2px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.wr-observe-row .bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #0ea5e9, #38bdf8); box-shadow: 0 0 8px rgba(56, 189, 248, 0.5); }
.wr-observe-row.warn .bar i { background: linear-gradient(90deg, #f59e0b, #f97316); box-shadow: 0 0 8px rgba(245, 158, 11, 0.45); }
.wr-observe-row.neg .bar i { background: linear-gradient(90deg, #ef4444, #dc2626); box-shadow: 0 0 8px rgba(239, 68, 68, 0.45); }
.wr-observe-row .v { text-align: right; font-family: var(--mono); font-size: 9.5px; color: #cbd5e1; white-space: nowrap; }
.wr-stack-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.09);
  border-radius: 8px;
  background: rgba(7, 11, 18, 0.55);
}
.wr-stack-item .sym { font-size: 10px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-stack-item .sym small { margin-left: 5px; font-family: var(--mono); font-size: 8px; font-weight: 400; color: var(--muted-2); }
.wr-stack-item .score { font-family: var(--mono); font-size: 10px; color: #fcd34d; }
.wr-stack-item .meta { grid-column: 1 / -1; font-size: 8.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wr-stack-item .bar { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(148, 163, 184, 0.1); overflow: hidden; }
.wr-stack-item .bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #f59e0b, #f97316); }
.wr-stack-item.executed .bar i { background: linear-gradient(90deg, #16a34a, #22c55e); }
.wr-stack-item.rejected { opacity: 0.72; }
.wr-stack-item.rejected .bar i { background: linear-gradient(90deg, #dc2626, #ef4444); }
.wr-stack-empty { padding: 10px 4px; font-size: 9.5px; color: var(--muted-2); }

.wr-bottom { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(330px, 1fr); gap: 12px; min-height: 0; }
.wr-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(13, 20, 32, 0.94), rgba(8, 13, 21, 0.95));
}
.wr-panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 7px; flex: none; }
.wr-panel-head h3 { font-size: 12px; }
.wr-panel-head .sub { display: block; margin-top: 1px; font-size: 9.5px; color: var(--muted-2); }
.wr-feed { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; padding-right: 3px; }
.wr-event {
  display: grid;
  grid-template-columns: 9px 58px 76px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 5px 4px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.055);
  font-size: 10.5px;
}
.wr-event:last-child { border-bottom: 0; }
.wr-event .wr-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted-2); align-self: center; }
.wr-event.tone-pos .wr-dot { background: var(--green); box-shadow: 0 0 8px rgba(34, 197, 94, 0.5); }
.wr-event.tone-warn .wr-dot { background: var(--amber); box-shadow: 0 0 8px rgba(245, 158, 11, 0.5); }
.wr-event.tone-danger .wr-dot { background: var(--red); box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
.wr-event.tone-info .wr-dot { background: var(--accent-2); box-shadow: 0 0 8px rgba(56, 189, 248, 0.4); }
.wr-event time { font-family: var(--mono); font-size: 9px; color: var(--muted-2); white-space: nowrap; }
.wr-event .who { font-size: 9px; color: var(--muted-2); white-space: nowrap; }
.wr-event .text { color: #cbd5e1; line-height: 1.4; overflow-wrap: anywhere; }
.wr-event.fresh { animation: wrFresh 1.4s ease; }
@keyframes wrFresh { from { background: rgba(56, 189, 248, 0.12); } to { background: transparent; } }

.wr-guard-state {
  flex: none;
  height: 21px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid rgba(34, 197, 94, 0.3);
  background: rgba(34, 197, 94, 0.08);
  color: #86efac;
  font-size: 9.5px;
  white-space: nowrap;
}
.wr-guard-state.state-halt { color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); background: rgba(239, 68, 68, 0.1); }
.wr-guard-state.state-paused { color: #fcd34d; border-color: rgba(245, 158, 11, 0.32); background: rgba(245, 158, 11, 0.08); }
.wr-gauges { display: flex; flex-direction: column; gap: 7px; flex: none; }
.wr-gauge .top { display: flex; justify-content: space-between; font-size: 9.5px; color: var(--muted); margin-bottom: 3px; }
.wr-gauge .top span:last-child { font-family: var(--mono); color: var(--text); }
.wr-gauge .meter { height: 5px; }
.wr-alerts { flex: 1; min-height: 0; margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(148, 163, 184, 0.07); display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.wr-alert {
  display: flex;
  gap: 7px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(148, 163, 184, 0.045);
  font-size: 10px;
  line-height: 1.45;
  color: #cbd5e1;
}
.wr-alert::before { content: ""; flex: none; width: 5px; height: 5px; margin-top: 5px; border-radius: 50%; background: currentColor; }
.wr-alert.danger { color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); background: rgba(239, 68, 68, 0.07); }
.wr-alert.warn { color: #fcd34d; border-color: rgba(245, 158, 11, 0.28); background: rgba(245, 158, 11, 0.06); }
.wr-alert.info { color: #93c5fd; border-color: rgba(59, 130, 246, 0.24); background: rgba(59, 130, 246, 0.06); }

body.bigscreen .sidebar { display: none; }
body.bigscreen .main { margin-left: 0; }
body.bigscreen .content { max-width: none; padding: 12px 16px; }
body.bigscreen .war-room { height: calc(100vh - 84px); }
body.bigscreen .topbar { padding: 8px 16px; }
body.bigscreen .topbar-title .eyebrow { display: none; }
body.bigscreen .topbar-title h1 { font-size: 16px; }

/* ============================================================ responsive */
@media (max-width: 1500px) {
  .war-room { height: auto; min-height: 0; grid-template-rows: auto auto auto auto auto; overflow: visible; }
  .wr-top { flex-wrap: wrap; }
  .wr-orch-stats { order: 3; width: 100%; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wr-arena { grid-template-columns: 264px minmax(0, 1fr) 300px; gap: 10px; }
  .wr-core { min-height: 430px; }
  .wr-bottom { grid-template-columns: minmax(0, 1fr); }
  .wr-feed { max-height: 340px; }
}
@media (max-width: 1420px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .grid-charts, .grid-pos, .grid-news, .grid-research { grid-template-columns: minmax(0, 1fr); }
  .grid-half { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .context-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wr-pipeline { flex-wrap: wrap; }
  .wr-pipeline .wr-stage { flex: 1 1 28%; }
  .wr-pipeline .wr-stage::after { display: none; }
  .wr-arena { grid-template-columns: minmax(0, 1fr); grid-template-areas: "crew" "core" "side"; }
  .wr-crew { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding: 0 0 5px; }
  .wr-crew::-webkit-scrollbar { height: 4px; }
  .wr-crew::-webkit-scrollbar-thumb { border: 0; background: rgba(148, 163, 184, 0.3); }
  .wr-crew-item { flex: none; width: 252px; }
  .wr-core { min-height: 400px; }
  .wr-side { grid-template-rows: auto auto; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wr-observe-list, .wr-stack-list { max-height: 220px; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; width: 244px; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .main { margin-left: 0; }
  .menu-btn { display: grid; }
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .topbar-title { flex: 1; min-width: 90px; }
  .topbar-stats { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .topbar-actions { order: 2; }
  .content { padding: 16px 14px 48px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi .value { font-size: 20px; }
  .grid-pos { grid-template-columns: minmax(0, 1fr); }
  .chart, #daily-chart { height: 230px; }
  .trade-chart { height: 320px; }
  .modal-backdrop { padding: 0; }
  .modal { border-radius: 0; min-height: 100vh; }
  .detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-list { grid-template-columns: 1fr; }
  .filters input { width: 100%; }
  .filters select { flex: 1; min-width: 120px; }
  .topbar-actions .btn { height: 28px; padding: 0 9px; font-size: 11.5px; }
  .wrap-cell { max-width: 240px; }
  .wr-orch-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wr-actions { width: 100%; justify-content: flex-end; }
  .wr-brief-source { margin-right: auto; }
  .wr-headline h2 { font-size: 19px; }
  .wr-event { grid-template-columns: 9px 50px minmax(0, 1fr); }
  .wr-event .who { display: none; }
  .wr-crew-item { width: 224px; }
  .wr-core { min-height: 360px; }
  .wr-core-top { flex-wrap: wrap; row-gap: 4px; }
  .wr-core-metrics { width: 100%; justify-content: flex-end; gap: 9px; }
  .wr-side { grid-template-columns: minmax(0, 1fr); }
  .wr-core-hint { display: none; }
}
@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 9px; }
  .context-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 18px; }
  .panel { padding: 13px; }
  .replay-bar { flex-wrap: wrap; }
  .replay-bar input[type="range"] { order: 3; width: 100%; flex: auto; }
  .replay-bar span { text-align: left; }
  .chart-toolbar { align-items: flex-start; flex-direction: column; }
  .wr-pipeline { gap: 8px; }
  .wr-pipeline .wr-stage { flex: 1 1 44%; }
  .wr-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .wr-actions .btn { height: 28px; padding: 0 9px; font-size: 11px; }
  .wr-brief-source { display: none; }
  .wr-arena { gap: 8px; }
  .wr-crew-item { width: 208px; }
  .wr-core-sub { display: none; }
  .wr-core-metrics { flex-wrap: wrap; justify-content: flex-end; row-gap: 2px; }
  .wr-observe-row { grid-template-columns: 62px minmax(0, 1fr) 54px; gap: 6px; }
  .wr-ticker { padding: 0 9px; }
  .wr-ticker-label { font-size: 7px; }
}
