:root {
  --bg: #0A0C10;
  --panel: #12151B;
  --panel-head: #161A21;
  --border: #1F242C;
  --border-light: #2A303A;
  --amber: #E8A33D;
  --amber-dim: #8A6526;
  --text: #E7E9EC;
  --text-dim: #7B8494;
  --text-faint: #4A5261;
  --up: #3ED07C;
  --down: #FF5C5C;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  display: flex; flex-direction: column; gap: 12px;
  width: 280px; padding: 28px; border-radius: 8px;
  background: var(--panel); border: 1px solid var(--border-light);
}
.login-title { font-weight: 700; letter-spacing: 0.14em; color: var(--amber); text-align: center; margin-bottom: 8px; }
.login-error { color: var(--down); font-size: 12px; text-align: center; }
.login-card input {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 10px; border-radius: 6px; font-family: var(--mono); font-size: 13px; outline: none;
}
.login-card input:focus { border-color: var(--amber-dim); }
.login-card button {
  background: var(--amber); color: #1A1200; border: none; border-radius: 6px;
  padding: 10px; font-weight: 700; font-size: 13px; cursor: pointer;
}

/* ---------- app shell ---------- */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: var(--panel-head); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: 0.12em; font-size: 13px; }
.brand .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); }
.divider { width: 1px; height: 20px; background: var(--border); }
.readout { display: flex; align-items: baseline; gap: 8px; font-family: var(--mono); }
.readout .sym { color: var(--amber); font-weight: 700; font-size: 15px; }
.readout .price { font-weight: 700; font-size: 17px; }
.readout .chg { font-size: 12px; }
.readout.empty { color: var(--text-faint); font-family: var(--mono); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { color: var(--text-faint); font-family: var(--mono); font-size: 11px; }
.logout-link { color: var(--text-faint); font-size: 11px; text-decoration: none; }
.logout-link:hover { color: var(--text); }

.up { color: var(--up); }
.down { color: var(--down); }

.grid {
  flex: 1; min-height: 0; display: grid; gap: 8px; padding: 8px;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: 1fr 1fr;
}
.cell-4 { grid-column: span 4; min-height: 0; }
.cell-8 { grid-column: span 8; min-height: 0; }

.panel { display: flex; flex-direction: column; height: 100%; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; background: var(--panel-head); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.panel-title { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.panel-badge { font-size: 10px; padding: 1px 6px; border-radius: 4px; background: #1B2028; color: var(--text-dim); font-family: var(--mono); }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; }

table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11px; }
th { text-align: left; color: var(--text-faint); font-weight: normal; padding: 4px 8px; }
td { padding: 6px 8px; border-top: 1px solid var(--border); }
tr.row { cursor: pointer; }
tr.row:hover { background: #171B22; }
tr.row.selected { background: #1B1608; }
.sym-cell { font-weight: 700; }
.num-right { text-align: right; }

.empty-state { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-faint); padding: 24px; text-align: center; font-size: 12px; }
.empty-state svg { opacity: 0.5; }

.alert-card { margin: 6px; padding: 8px; border-radius: 4px; background: var(--panel-head); border-left: 2px solid var(--amber-dim); font-family: var(--mono); cursor: pointer; }
.alert-card .row1 { display: flex; justify-content: space-between; }
.alert-card .sym { color: var(--amber); font-weight: 700; font-size: 12px; }
.alert-card .time { color: var(--text-faint); font-size: 10px; }
.alert-card .tag { color: var(--text-dim); font-size: 10px; margin: 3px 0; }
.alert-card .raw { color: var(--text); font-size: 10.5px; white-space: pre-wrap; }

.news-item { padding: 8px 12px; border-top: 1px solid var(--border); display: flex; gap: 8px; font-size: 12px; }
.news-item:first-child { border-top: none; }
.news-time { flex-shrink: 0; color: var(--text-faint); font-family: var(--mono); font-size: 10px; }

.quote-body { padding: 12px; font-family: var(--mono); }
.quote-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 14px; }
.quote-head .sym { color: var(--amber); font-weight: 700; font-size: 20px; }
.quote-head .price { font-weight: 700; font-size: 24px; }
.quote-grid { display: grid; grid-template-columns: 1fr 1fr; row-gap: 10px; font-size: 12px; }
.quote-label { color: var(--text-faint); font-size: 10px; }

#chart-canvas-wrap { width: 100%; height: 100%; padding: 8px; }
canvas { width: 100%; height: 100%; display: block; }
