:root {
  --bg: #070b12;
  --bg-2: #0a101a;
  --panel: #0d1522;
  --panel-2: #101a2b;
  --line: #1b2a3f;
  --line-soft: #152235;
  --text: #e7eefc;
  --muted: #8a9bb5;
  --faint: #5d6f8c;
  --up: #ff4d5e;
  --up-soft: rgba(255, 77, 94, 0.14);
  --down: #16c784;
  --down-soft: rgba(22, 199, 132, 0.14);
  --accent: #3dd6c4;
  --accent-2: #4c9aff;
  --warn: #f5b942;
  --risk: #ff5a5f;
  --safe: #2ed47a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
  --radius: 14px;
  --mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 112px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 600px at 10% -10%, rgba(61, 214, 196, 0.08), transparent 60%),
    radial-gradient(900px 520px at 90% 0%, rgba(76, 154, 255, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--accent); text-decoration: none; }
button, input, select { font-family: inherit; font-size: 14px; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
em { font-style: normal; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 500; margin-left: 6px; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px max(18px, env(safe-area-inset-left)) 10px max(18px, env(safe-area-inset-right));
  background: rgba(7, 11, 18, 0.82);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px;
  background: linear-gradient(145deg, rgba(61, 214, 196, .22), rgba(76, 154, 255, .22));
  border: 1px solid rgba(61, 214, 196, .35);
  display: grid; place-items: center; box-shadow: 0 0 22px rgba(61, 214, 196, .18);
}
.brand-mark span { font-family: var(--mono); font-weight: 800; font-size: 19px; color: var(--accent); }
.brand-text h1 { font-size: 16px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; }
.brand-text p { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; white-space: nowrap; }
.top-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.meta-item { font-size: 11.5px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.meta-item.timer { color: var(--accent); }
.badge { font-size: 10.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.badge-demo { color: var(--warn); border-color: rgba(245, 185, 66, .45); background: rgba(245, 185, 66, .1); }
.badge-live { color: var(--safe); border-color: rgba(46, 212, 122, .45); background: rgba(46, 212, 122, .1); }
.badge-warn { color: var(--risk); border-color: rgba(255, 90, 95, .45); background: rgba(255, 90, 95, .1); }
.ghost-btn {
  background: rgba(255, 255, 255, .02); border: 1px solid var(--line);
  color: var(--muted); padding: 6px 11px; border-radius: 9px; font-size: 11.5px;
  transition: .18s; white-space: nowrap;
}
.ghost-btn:hover { color: var(--text); border-color: #2b4563; background: rgba(76, 154, 255, .08); }
.primary-btn {
  background: linear-gradient(135deg, rgba(61, 214, 196, .95), rgba(76, 154, 255, .95));
  color: #041018; border: 0; font-weight: 700; padding: 10px 14px; border-radius: 10px; width: 100%;
}
.primary-btn:hover { filter: brightness(1.06); }
.link-btn { background: none; border: 0; color: var(--accent); font-size: 11.5px; padding: 0; }

/* ---------------------------------------------------------- section nav */
.section-nav {
  position: sticky; top: 59px; z-index: 35;
  display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none;
  padding: 7px max(14px, env(safe-area-inset-left));
  background: rgba(7, 11, 18, .9); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a {
  flex: 0 0 auto; padding: 5px 11px; border-radius: 8px;
  font-size: 12px; color: var(--muted); border: 1px solid transparent;
}
.section-nav a:hover { color: var(--text); background: rgba(76, 154, 255, .08); border-color: var(--line); }

/* --------------------------------------------------------------- layout */
.wrap { max-width: 1480px; margin: 0 auto; padding: 0 18px; }
.section { padding: 26px 0 8px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; letter-spacing: .01em; }
.section-head .sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; max-width: 820px; }
.head-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 10px; white-space: nowrap; background: rgba(255, 255, 255, .015);
}
.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 55%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: 0 1px 0 rgba(255, 255, 255, .02) inset;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-head h3 { font-size: 13.5px; font-weight: 650; }
.hint { font-size: 10.5px; color: var(--faint); }
.fineprint { font-size: 10.5px; color: var(--faint); line-height: 1.6; }

/* --------------------------------------------------------------- banner */
.banner {
  margin: 12px auto 0; max-width: 1480px; padding: 9px 14px;
  border-radius: 10px; font-size: 12px; display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid rgba(245, 185, 66, .32); background: rgba(245, 185, 66, .08); color: #f0d494;
}
.banner-alert { border-color: rgba(255, 90, 95, .35); background: rgba(255, 90, 95, .08); color: #ffb7b9; }
.banner b { color: #fff; }

/* ------------------------------------------------------------ overview */
.index-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-bottom: 10px; }
.index-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
}
.index-card .nm { font-size: 11px; color: var(--muted); }
.index-card .pv { font-family: var(--mono); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.index-card .ch { font-size: 11px; font-family: var(--mono); }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--muted) !important; }

.metric-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; margin-bottom: 14px; }
.metric-card {
  background: rgba(255, 255, 255, .015); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px 11px; min-width: 0;
}
.metric-card .lb { font-size: 10px; color: var(--faint); white-space: nowrap; }
.metric-card .vl { font-family: var(--mono); font-size: 15px; font-weight: 650; margin-top: 2px; white-space: nowrap; }
.metric-card .sb { font-size: 10px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.macro-layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(300px, .85fr); gap: 12px; margin-bottom: 12px; }
.macro-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
.macro-card {
  position: relative; background: rgba(255, 255, 255, .015); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 9px 10px 5px; overflow: hidden; min-width: 0;
}
.macro-card .top { display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.macro-card .nm { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.macro-card .th { font-size: 9px; color: var(--faint); font-family: var(--mono); }
.macro-card .pv { font-family: var(--mono); font-size: 19px; font-weight: 700; margin-top: 2px; }
.macro-card .ch { font-size: 10.5px; font-family: var(--mono); }
.macro-card canvas { width: 100%; height: 34px; display: block; margin-top: 3px; }
.macro-card .threshold { position: absolute; right: 8px; top: 7px; font-size: 8.5px; color: var(--faint); }

.gauge-wrap { display: flex; gap: 14px; align-items: center; }
.gauge {
  --score: 0; --zone-color: var(--warn);
  width: 132px; height: 132px; flex: 0 0 132px; border-radius: 50%;
  background: conic-gradient(var(--zone-color) calc(var(--score) * 1%), #172235 0);
  display: grid; place-items: center; position: relative;
  transition: background .8s ease;
  box-shadow: 0 0 32px rgba(245, 185, 66, .1);
}
.gauge::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line-soft); }
.gauge-inner { position: relative; z-index: 2; text-align: center; }
.gauge-inner strong { display: block; font-family: var(--mono); font-size: 30px; line-height: 1; letter-spacing: -.04em; }
.gauge-inner span { font-size: 11px; color: var(--zone-color); font-weight: 650; }
.gauge-side { min-width: 0; }
.gauge-constraint { font-size: 11.5px; color: var(--muted); line-height: 1.6; margin-bottom: 8px; }
.zone-legend { font-size: 10px; color: var(--faint); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 2px; }
.dot.risk { background: var(--risk); } .dot.warn { background: var(--warn); } .dot.safe { background: var(--safe); }

.global-panel { margin-bottom: 4px; }
.global-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 9px; }
.global-card {
  background: rgba(255, 255, 255, .015); border: 1px solid var(--line-soft);
  border-radius: 11px; padding: 9px 10px 4px; min-width: 0;
}
.global-card .hd { display: flex; justify-content: space-between; gap: 5px; align-items: center; }
.global-card .nm { font-size: 11px; color: var(--muted); white-space: nowrap; }
.global-card .rg { font-size: 8.5px; color: var(--faint); border: 1px solid var(--line); padding: 0 4px; border-radius: 4px; }
.global-card .pv { font-family: var(--mono); font-size: 17px; font-weight: 700; margin-top: 2px; }
.global-card .ch { font-family: var(--mono); font-size: 10.5px; }
.global-card .hint { display: block; margin-top: 1px; font-size: 9.5px; }
.global-card canvas { width: 100%; height: 36px; margin-top: 2px; display: block; }
.linkage-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 11px; }
.linkage {
  font-size: 10.5px; line-height: 1.5; padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--line); color: var(--muted); background: rgba(255, 255, 255, .015);
  max-width: 100%;
}
.linkage.up { border-color: rgba(255, 77, 94, .3); color: #ffb0b7; background: rgba(255, 77, 94, .06); }
.linkage.down { border-color: rgba(22, 199, 132, .3); color: #8ee8c2; background: rgba(22, 199, 132, .06); }
.linkage.warn { border-color: rgba(245, 185, 66, .3); color: #f3d28e; background: rgba(245, 185, 66, .06); }

/* ---------------------------------------------------------- stock cards */
.stock-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.stock-card {
  position: relative; background: linear-gradient(180deg, rgba(255, 255, 255, .02), transparent 60%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px;
  display: flex; flex-direction: column; gap: 8px; min-width: 0; cursor: pointer;
  transition: border-color .18s, transform .18s, box-shadow .18s;
}
.stock-card:hover { border-color: #2a4a6d; transform: translateY(-2px); box-shadow: var(--shadow); }
.stock-card.active { border-color: rgba(61, 214, 196, .5); box-shadow: 0 0 0 1px rgba(61, 214, 196, .18), var(--shadow); }
.sc-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.sc-name { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sc-code { font-size: 10px; color: var(--faint); font-family: var(--mono); }
.sc-price { text-align: right; }
.sc-price .pv { font-family: var(--mono); font-size: 21px; font-weight: 750; line-height: 1.1; }
.sc-price .ch { font-family: var(--mono); font-size: 11px; }
.sc-mini { width: 100%; height: 74px; display: block; }
.sc-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tag {
  font-size: 9.5px; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line);
  color: var(--muted); background: rgba(255, 255, 255, .015); white-space: nowrap;
}
.tag.up { color: #ff9aa4; border-color: rgba(255, 77, 94, .3); background: rgba(255, 77, 94, .07); }
.tag.down { color: #7fe0b4; border-color: rgba(22, 199, 132, .3); background: rgba(22, 199, 132, .07); }
.tag.warn { color: #f0cd86; border-color: rgba(245, 185, 66, .3); background: rgba(245, 185, 66, .07); }
.tag.accent { color: #88f0e3; border-color: rgba(61, 214, 196, .3); background: rgba(61, 214, 196, .07); }
.sc-grid-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; font-size: 9.5px; color: var(--faint); }
.sc-grid-row b { display: block; color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 600; }
.sc-foot { display: flex; justify-content: space-between; gap: 8px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 7px; font-size: 10px; color: var(--faint); }
.sc-signal { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; font-size: 10.5px; }
.light { width: 7px; height: 7px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.light.red { background: var(--risk); color: var(--risk); }
.light.yellow { background: var(--warn); color: var(--warn); }
.light.green { background: var(--safe); color: var(--safe); }
.light.gray { background: #7b8aa0; color: #7b8aa0; }

/* --------------------------------------------------------------- detail */
.stock-tabs { display: flex; gap: 5px; flex-wrap: wrap; }
.stock-tabs button {
  border: 1px solid var(--line); background: rgba(255, 255, 255, .015); color: var(--muted);
  padding: 5px 9px; border-radius: 8px; font-size: 11px;
}
.stock-tabs button.active { color: var(--accent); border-color: rgba(61, 214, 196, .45); background: rgba(61, 214, 196, .08); }

.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
.chart-panel { padding: 10px 12px 8px; }
.chart-toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; }
.chip {
  background: rgba(255, 255, 255, .015); border: 1px solid var(--line); color: var(--faint);
  border-radius: 7px; padding: 4px 9px; font-size: 10.5px; transition: .15s;
}
.chip:hover { color: var(--muted); }
.chip.active { color: var(--accent); border-color: rgba(61, 214, 196, .45); background: rgba(61, 214, 196, .08); }
.chart-legend { margin-left: auto; font-size: 9.5px; color: var(--faint); display: flex; gap: 8px; align-items: center; }
.sq { width: 8px; height: 8px; display: inline-block; border-radius: 2px; margin-right: 3px; }
.sq.up { background: var(--up); } .sq.down { background: var(--down); }
.sq.dd { background: rgba(255, 77, 94, .3); } .sq.rp { background: rgba(22, 199, 132, .3); }
.chart-scroll { position: relative; }
#klineCanvas { display: block; width: 100%; touch-action: pan-y; }
.chart-foot { font-size: 10px; color: var(--faint); margin-top: 4px; min-height: 15px; }

.factor-panel { padding: 12px; overflow: hidden; }
.fp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.fp-head h3 { font-size: 15px; }
.fp-price { font-family: var(--mono); font-size: 20px; font-weight: 750; }
.fp-chg { font-family: var(--mono); font-size: 11px; }
.factor-block { border-top: 1px solid var(--line-soft); padding-top: 8px; margin-top: 8px; }
.factor-block .fb-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 5px; }
.factor-block .fb-head h4 { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.fb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px 8px; }
.fb-grid div { font-size: 9.5px; color: var(--faint); }
.fb-grid b { display: block; font-family: var(--mono); font-size: 11.5px; color: var(--text); font-weight: 600; }
.fb-text { font-size: 10.5px; color: var(--muted); line-height: 1.55; margin-top: 4px; }
.fb-text.warn { color: #e9c479; }
.bar-track { height: 4px; border-radius: 999px; background: #172235; overflow: hidden; margin-top: 4px; }
.bar-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.detail-subgrid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 12px; margin-top: 12px; }
.sub-canvas { display: block; width: 100%; height: 190px; touch-action: none; }
.sub-canvas.tall { height: 230px; }
.ts-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ts-tag { font-size: 10px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.ts-tag.red { color: #ff9aa4; border-color: rgba(255, 90, 95, .35); }
.ts-tag.yellow { color: #f0cd86; border-color: rgba(245, 185, 66, .35); }
.ts-tag.green { color: #83e7b8; border-color: rgba(46, 212, 122, .35); }

/* -------------------------------------------------------------- breadth */
.breadth-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.breadth-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bm { background: rgba(255, 255, 255, .015); border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 10px; }
.bm .lb { font-size: 9.5px; color: var(--faint); }
.bm .vl { font-family: var(--mono); font-size: 18px; font-weight: 700; margin-top: 1px; }
.bm .sb { font-size: 9px; color: var(--muted); }
.formula { font-size: 10px; color: var(--faint); line-height: 1.7; margin-top: 10px; padding-top: 8px; border-top: 1px dashed var(--line); }
.score-bars { display: flex; flex-direction: column; gap: 8px; }
.score-row { display: grid; grid-template-columns: 92px 1fr 74px; gap: 8px; align-items: center; font-size: 10px; }
.score-row .nm { color: var(--muted); }
.score-row .track { height: 6px; background: #172235; border-radius: 999px; overflow: hidden; }
.score-row .track i { display: block; height: 100%; background: linear-gradient(90deg, var(--risk), var(--warn) 55%, var(--safe)); border-radius: 999px; transition: width .8s; }
.score-row .val { text-align: right; color: var(--faint); font-family: var(--mono); }
.score-row .val b { color: var(--text); font-weight: 600; }
.event-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-height: 190px; overflow: auto; }
.event {
  border: 1px solid var(--line-soft); border-left: 2px solid var(--line); border-radius: 7px;
  padding: 6px 8px; font-size: 10px; color: var(--muted); background: rgba(255, 255, 255, .01);
}
.event.up { border-left-color: var(--up); } .event.down { border-left-color: var(--down); } .event.warn { border-left-color: var(--warn); }
.event b { color: var(--text); font-size: 10.5px; font-weight: 600; }
.event .meta { font-size: 9px; color: var(--faint); margin-top: 2px; }

/* ------------------------------------------------------------- portfolio */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 11px; min-width: 920px; }
.data-table th {
  text-align: left; font-weight: 500; color: var(--faint); font-size: 10px;
  padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; letter-spacing: .03em;
}
.data-table td { padding: 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:hover { background: rgba(76, 154, 255, .035); }
.data-table .mono { font-size: 11.5px; }
.data-table .nm-cell { font-weight: 600; white-space: nowrap; }
.data-table .nm-cell span { font-family: var(--mono); font-size: 9.5px; color: var(--faint); font-weight: 400; display: block; }
.data-table input[type="number"] {
  width: 74px; background: #0a1320; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 6px; font-family: var(--mono); font-size: 11px;
}
.grid-note { font-size: 10px; color: var(--faint); margin-top: 8px; line-height: 1.6; }
.portfolio-layout { display: grid; grid-template-columns: 380px 1fr; gap: 12px; margin-top: 12px; }
.t-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.t-form label { font-size: 10px; color: var(--faint); display: flex; flex-direction: column; gap: 3px; }
.t-form label:nth-child(1) { grid-column: span 2; }
.t-form select, .t-form input {
  background: #0a1320; border: 1px solid var(--line); border-radius: 7px; padding: 7px 8px;
  font-family: var(--mono); font-size: 12px; width: 100%;
}
.t-form input:focus, .t-form select:focus { outline: none; border-color: rgba(61, 214, 196, .5); }
.t-preview { grid-column: span 2; font-size: 10.5px; color: var(--muted); background: rgba(61, 214, 196, .05); border: 1px dashed rgba(61, 214, 196, .25); border-radius: 8px; padding: 7px 9px; font-family: var(--mono); line-height: 1.7; }
.t-form .primary-btn { grid-column: span 2; }
.ledger-list { display: flex; flex-direction: column; gap: 7px; max-height: 330px; overflow: auto; }
.ledger-item { border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 9px; font-size: 10.5px; color: var(--muted); display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.ledger-item b { color: var(--text); font-size: 11px; }
.ledger-item .flow { font-family: var(--mono); }
.ledger-item .fineprint { grid-column: span 2; }

/* --------------------------------------------------------------- signals */
.signal-table td { font-size: 10.5px; }
.signal-cell { display: flex; align-items: flex-start; gap: 6px; min-width: 150px; }
.signal-cell .light { margin-top: 4px; flex: 0 0 7px; }
.cond-list { display: flex; flex-direction: column; gap: 2px; min-width: 320px; }
.cond { font-size: 9.5px; color: var(--muted); line-height: 1.5; }
.cond.pos::before { content: "＋ "; color: var(--up); }
.cond.neg::before { content: "－ "; color: var(--down); }
.cond-note { font-size: 9px; color: var(--faint); margin-top: 3px; }

/* ------------------------------------------------------------ timeshare */
.ts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.ts-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 7px; }
.ts-card.red { border-color: rgba(255, 90, 95, .3); }
.ts-card.yellow { border-color: rgba(245, 185, 66, .28); }
.ts-card.green { border-color: rgba(46, 212, 122, .3); }
.ts-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ts-head b { font-size: 13px; }
.ts-read { font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.ts-observe { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 8px; background: rgba(255, 255, 255, .015); border-radius: 8px; padding: 7px 9px; }
.ts-observe div { font-size: 9px; color: var(--faint); }
.ts-observe b { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text); font-weight: 600; }
.ts-constraint { font-size: 9.5px; color: var(--faint); line-height: 1.6; }
.ts-constraint li { margin-bottom: 1px; }

/* ---------------------------------------------------------------- briefs */
.brief-layout { display: grid; grid-template-columns: 340px 1fr; gap: 12px; }
.brief-list { display: flex; flex-direction: column; gap: 7px; max-height: 620px; overflow: auto; }
.brief-item { border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px 10px; cursor: pointer; transition: .15s; }
.brief-item:hover { border-color: #2a4a6d; background: rgba(76, 154, 255, .04); }
.brief-item.active { border-color: rgba(61, 214, 196, .45); background: rgba(61, 214, 196, .06); }
.brief-item .dt { font-family: var(--mono); font-size: 10px; color: var(--faint); display: flex; justify-content: space-between; }
.brief-item .ttl { font-size: 11.5px; font-weight: 600; margin-top: 2px; }
.brief-item .sub { font-size: 9.5px; color: var(--faint); margin-top: 2px; }
.brief-detail { max-height: 640px; overflow: auto; padding-right: 4px; }
.brief-title { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.brief-meta { font-size: 10px; color: var(--faint); font-family: var(--mono); margin-bottom: 10px; }
.brief-section { border-top: 1px solid var(--line-soft); padding-top: 10px; margin-top: 10px; }
.brief-section h4 { font-size: 12px; color: var(--accent); margin-bottom: 6px; }
.brief-p { font-size: 11px; color: var(--muted); line-height: 1.75; margin-bottom: 6px; }
.brief-ul { margin: 0 0 6px; padding-left: 16px; }
.brief-ul li { font-size: 10.5px; color: var(--muted); line-height: 1.7; }
.scenario { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 7px; background: rgba(255, 255, 255, .012); }
.scenario.up { border-left: 3px solid var(--up); }
.scenario.range { border-left: 3px solid var(--warn); }
.scenario.down { border-left: 3px solid var(--down); }
.scenario .sh { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scenario .sh b { font-size: 11px; }
.scenario .w { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.scenario p { font-size: 10px; color: var(--muted); line-height: 1.65; margin: 3px 0; }
.scenario .sw { font-size: 9.5px; color: var(--faint); }
.scenario .sw b { color: var(--muted); font-weight: 500; }
.stock-note { border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; margin-bottom: 7px; }
.stock-note .sn-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 11px; }
.stock-note .sn-head b { font-size: 11.5px; }
.stock-note ul { margin: 4px 0 0; padding-left: 15px; }
.stock-note li { font-size: 9.5px; color: var(--muted); line-height: 1.65; }

/* ------------------------------------------------------------------ logs */
.log-list { display: flex; flex-direction: column; max-height: 360px; overflow: auto; }
.log-item { display: grid; grid-template-columns: 118px 54px 1fr; gap: 8px; padding: 6px 2px; border-bottom: 1px solid var(--line-soft); font-size: 10.5px; align-items: start; }
.log-item .t { font-family: var(--mono); font-size: 9.5px; color: var(--faint); }
.log-item .lv { font-size: 9px; border-radius: 4px; padding: 1px 5px; text-align: center; border: 1px solid var(--line); color: var(--faint); }
.log-item .lv.warn { color: #f0cd86; border-color: rgba(245, 185, 66, .35); }
.log-item .lv.error { color: #ff9aa4; border-color: rgba(255, 90, 95, .35); }
.log-item .m { color: var(--muted); line-height: 1.6; }

/* ---------------------------------------------------------------- modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 6, 12, .72); backdrop-filter: blur(6px); }
.modal-body {
  position: relative; z-index: 2; width: min(760px, 100%); max-height: 86vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
  box-shadow: var(--shadow); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.985); opacity: .5; } to { transform: none; opacity: 1; } }
.modal-close { position: absolute; right: 10px; top: 8px; background: none; border: 0; color: var(--faint); font-size: 24px; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal h3 { font-size: 17px; margin-bottom: 3px; padding-right: 24px; }
.modal .m-sub { font-size: 10.5px; color: var(--faint); margin-bottom: 12px; }
.stage-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.stage-facts div { background: rgba(255, 255, 255, .015); border: 1px solid var(--line-soft); border-radius: 8px; padding: 7px 9px; font-size: 9.5px; color: var(--faint); }
.stage-facts b { display: block; font-family: var(--mono); font-size: 13px; color: var(--text); margin-top: 2px; }
.modal p { font-size: 11px; color: var(--muted); line-height: 1.75; }
.rule-table { width: 100%; border-collapse: collapse; font-size: 10px; margin-top: 8px; }
.rule-table th, .rule-table td { border: 1px solid var(--line); padding: 5px 7px; text-align: left; color: var(--muted); vertical-align: top; }
.rule-table th { color: var(--faint); font-weight: 500; background: rgba(255, 255, 255, .02); }
pre.code { background: #080f1a; border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px; overflow: auto; font-family: var(--mono); font-size: 9.5px; color: #9fb6d4; line-height: 1.6; }

/* ----------------------------------------------------------------- toast */
.toast-wrap { position: fixed; right: 14px; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 90; display: flex; flex-direction: column; gap: 7px; max-width: min(360px, calc(100vw - 28px)); }
.toast {
  background: rgba(13, 21, 34, .96); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 9px; padding: 9px 11px; font-size: 11px; color: var(--muted); box-shadow: var(--shadow);
  animation: toastIn .22s ease;
}
.toast.warn { border-left-color: var(--warn); }
.toast.risk { border-left-color: var(--risk); }
.toast b { display: block; color: var(--text); margin-bottom: 2px; font-size: 11.5px; }
@keyframes toastIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------ animations */
.flash-up { animation: flashUp .9s ease; }
.flash-down { animation: flashDown .9s ease; }
@keyframes flashUp { 0% { color: var(--up); text-shadow: 0 0 12px rgba(255, 77, 94, .55); } 100% { text-shadow: none; } }
@keyframes flashDown { 0% { color: var(--down); text-shadow: 0 0 12px rgba(22, 199, 132, .55); } 100% { text-shadow: none; } }
.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* -------------------------------------------------------------- footer */
.disclaimer { margin-top: 30px; border-top: 1px solid var(--line); background: rgba(10, 16, 26, .75); padding: 18px 0 calc(26px + env(safe-area-inset-bottom)); }
.disclaimer strong { font-size: 11.5px; color: #e9c479; letter-spacing: .02em; }
.disclaimer p { font-size: 10.5px; color: var(--faint); line-height: 1.8; margin-top: 5px; }
.disclaimer b { color: #ffb0b7; }

/* -------------------------------------------------------------- mobile */
@media (max-width: 1180px) {
  .stock-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .global-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .macro-layout { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .breadth-layout { grid-template-columns: 1fr; }
  .portfolio-layout { grid-template-columns: 1fr; }
  .brief-layout { grid-template-columns: 1fr; }
  .brief-list { max-height: 280px; }
  .detail-subgrid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  html { scroll-padding-top: 104px; }
  .wrap { padding: 0 12px; }
  .topbar { padding: 8px 12px; gap: 8px; flex-wrap: wrap; }
  .brand-mark { width: 32px; height: 32px; flex-basis: 32px; border-radius: 9px; }
  .brand-text h1 { font-size: 14px; }
  .brand-text p { display: none; }
  .top-meta { gap: 6px; }
  .meta-item { font-size: 10px; }
  .section-nav { top: 96px; padding: 6px 10px; }
  .section-nav a { font-size: 11px; padding: 4px 8px; }
  .section { padding: 20px 0 6px; }
  .section-head h2 { font-size: 16px; }
  .section-head .sub { font-size: 10.5px; }
  .index-strip { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .index-card .pv { font-size: 16px; }
  .index-card:last-child { grid-column: span 2; }
  .metric-strip { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .macro-grid { grid-template-columns: repeat(2, 1fr); }
  .global-grid { grid-template-columns: repeat(2, 1fr); }
  .global-card .pv { font-size: 15px; }
  .stock-grid { grid-template-columns: 1fr; gap: 9px; }
  .stock-card { padding: 11px; }
  .sc-mini { height: 66px; }
  .ts-grid { grid-template-columns: 1fr; }
  .gauge-wrap { flex-direction: row; gap: 10px; }
  .gauge { width: 112px; height: 112px; flex-basis: 112px; }
  .gauge-inner strong { font-size: 26px; }
  .chart-legend { display: none; }
  .chart-toolbar { gap: 5px; }
  .chip { padding: 4px 8px; font-size: 10px; }
  .stock-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .stock-tabs button { flex: 0 0 auto; }
  .breadth-metrics { grid-template-columns: repeat(2, 1fr); }
  .data-table { min-width: 780px; }
  .log-item { grid-template-columns: 96px 44px 1fr; gap: 6px; }
  .toast-wrap { left: 12px; right: 12px; max-width: none; }
  .modal { padding: 10px; }
  .modal-body { padding: 16px; max-height: 90vh; }
  .stage-facts { grid-template-columns: repeat(2, 1fr); }
  .macro-card .pv { font-size: 16px; }
  .section-nav { top: 95px; }
  .ts-observe { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 380px) {
  .top-meta .meta-item.timer { display: none; }
  .gauge-wrap { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}
