:root {
  --bg: #04050c;
  --text: #e8ebf7;
  --muted: #8a92b4;
  --dim: #565d80;
  --line: rgba(255, 255, 255, 0.075);
  --line-2: rgba(255, 255, 255, 0.14);
  --mint: #2ef2a0;
  --teal: #19e6d4;
  --violet: #8b6cff;
  --pink: #ff4d8d;
  --amber: #ffc857;
  --red: #ff5c7a;
  --blue: #5aa9ff;
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Heiti TC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "ss01" 1;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
code, .mono { font-family: var(--mono); }

/* ------------------------------------------------------------- backdrop */

.aurora { position: fixed; inset: -25vmax; z-index: -3; pointer-events: none; filter: blur(90px) saturate(150%); opacity: 0.5; }
.aurora span { position: absolute; width: 62vmax; height: 62vmax; border-radius: 50%; mix-blend-mode: screen; will-change: transform; animation: drift 32s ease-in-out infinite alternate; }
.aurora span:nth-child(1) { background: radial-gradient(circle at 35% 35%, #00f5d4 0%, rgba(0, 245, 212, 0) 62%); top: 2%; left: 4%; }
.aurora span:nth-child(2) { background: radial-gradient(circle, #6d4dff 0%, rgba(109, 77, 255, 0) 62%); top: 18%; right: -4%; animation-duration: 38s; animation-delay: -12s; }
.aurora span:nth-child(3) { background: radial-gradient(circle, #ff2f7d 0%, rgba(255, 47, 125, 0) 60%); bottom: -16%; left: 28%; animation-duration: 46s; animation-delay: -20s; opacity: 0.7; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  50% { transform: translate3d(9vmax, -7vmax, 0) scale(1.18) rotate(35deg); }
  100% { transform: translate3d(-7vmax, 6vmax, 0) scale(0.92) rotate(-25deg); }
}
.grain {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
}
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.55)); }

/* ------------------------------------------------------------- top bar */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 28px;
  background: linear-gradient(180deg, rgba(4, 5, 12, 0.86), rgba(4, 5, 12, 0.55));
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--violet), var(--pink), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: streak var(--streak, 6s) linear infinite;
  opacity: 0.9;
}
@keyframes streak { from { background-position: -60% 0; } to { background-position: 160% 0; } }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { width: 38px; height: 38px; flex: none; filter: drop-shadow(0 0 14px rgba(25, 230, 212, 0.45)); }
.brand-name { font-weight: 800; letter-spacing: 0.24em; font-size: 15px; background: linear-gradient(90deg, #fff, #b9c4ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub { color: var(--muted); font-size: 11.5px; letter-spacing: 0.08em; }
.status-strip { display: flex; align-items: center; gap: 10px; flex: 1; flex-wrap: wrap; justify-content: center; }
.actions { display: flex; gap: 8px; align-items: center; }

.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04);
  font-size: 12.5px; white-space: nowrap;
}
.badge i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 0 currentColor; }
.badge b { font-weight: 700; letter-spacing: 0.04em; }
.badge small { color: var(--muted); letter-spacing: 0.14em; font-size: 10.5px; }
.badge.paper { color: var(--blue); border-color: rgba(90, 169, 255, 0.4); background: rgba(90, 169, 255, 0.08); }
.badge.paper i { background: var(--blue); animation: ping 2.4s infinite; }
.badge.live { color: var(--mint); border-color: rgba(46, 242, 160, 0.55); background: rgba(46, 242, 160, 0.1); box-shadow: 0 0 24px -6px rgba(46, 242, 160, 0.6); }
.badge.live i { background: var(--mint); animation: ping 1.2s infinite; }
.badge.phase { color: var(--text); }
.badge.phase.running i { background: var(--mint); animation: ping 2s infinite; color: var(--mint); }
.badge.phase.busy i { background: var(--amber); animation: ping 1s infinite; color: var(--amber); }
.badge.phase.down i { background: var(--red); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.conn i { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); transition: background 0.3s; }
.conn.ok i { background: var(--mint); }
.conn.bad i { background: var(--red); }
.conn.blink i { box-shadow: 0 0 10px var(--mint); }
.clock { font-family: var(--mono); color: var(--muted); font-size: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.05); color: var(--text);
  transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.25); }
.btn:active { transform: scale(0.97); }
.btn.small { padding: 6px 10px; font-size: 12.5px; }
.btn.warn { color: var(--amber); border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.08); }
.btn.go { color: var(--mint); border-color: rgba(46, 242, 160, 0.45); background: rgba(46, 242, 160, 0.08); }
.btn.danger { color: var(--red); border-color: rgba(255, 92, 122, 0.45); background: rgba(255, 92, 122, 0.08); }
.btn.danger:hover { box-shadow: 0 0 24px -6px rgba(255, 92, 122, 0.7); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* ------------------------------------------------------------- banners */

.banners { max-width: 1640px; margin: 14px auto 0; padding: 0 28px; display: grid; gap: 10px; }
.banner {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px;
  border: 1px solid; backdrop-filter: blur(14px); animation: rise 0.5s cubic-bezier(0.2, 0.9, 0.2, 1);
}
.banner .b-icon { flex: none; width: 22px; height: 22px; }
.banner .b-icon svg { display: block; width: 100%; height: 100%; }
.banner.red .b-icon { color: var(--red); }
.banner.amber .b-icon { color: var(--amber); }
.banner.blue .b-icon { color: var(--blue); }
.banner .b-icon.spin svg { animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.banner .b-text { flex: 1; }
.banner .b-text b { display: block; margin-bottom: 2px; }
.banner.red { border-color: rgba(255, 92, 122, 0.5); background: linear-gradient(90deg, rgba(255, 92, 122, 0.16), rgba(255, 92, 122, 0.04)); }
.banner.amber { border-color: rgba(255, 200, 87, 0.45); background: linear-gradient(90deg, rgba(255, 200, 87, 0.14), rgba(255, 200, 87, 0.03)); }
.banner.blue { border-color: rgba(90, 169, 255, 0.35); background: linear-gradient(90deg, rgba(90, 169, 255, 0.12), rgba(90, 169, 255, 0.02)); }
.banner .x { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 18px; }
@keyframes rise { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- layout + cards */

.layout { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; max-width: 1640px; margin: 0 auto; padding: 18px 28px 40px; }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; }
.span-6 { grid-column: span 6; } .span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; }

.card {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px 20px;
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: rise 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(25, 230, 212, 0.4), transparent 28%, transparent 72%, rgba(139, 108, 255, 0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; opacity: 0.55; transition: opacity 0.3s;
}
.card:hover::before { opacity: 1; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; min-height: 28px; }
.card-head h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.12em; color: #cfd5f3; text-transform: uppercase; }
.card-head h2 em { font-style: normal; color: var(--dim); font-weight: 600; margin-left: 6px; letter-spacing: 0.1em; font-size: 11px; }
.card-head .hint { color: var(--dim); font-size: 12px; margin-left: auto; text-align: right; }
.pill { margin-left: auto; padding: 3px 10px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line-2); color: var(--muted); background: rgba(255, 255, 255, 0.04); white-space: nowrap; }
.pill.ok { color: var(--mint); border-color: rgba(46, 242, 160, 0.4); background: rgba(46, 242, 160, 0.08); }
.pill.bad { color: var(--red); border-color: rgba(255, 92, 122, 0.45); background: rgba(255, 92, 122, 0.09); }
.pill.warn { color: var(--amber); border-color: rgba(255, 200, 87, 0.45); background: rgba(255, 200, 87, 0.08); }

.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); gap: 2px; }
.seg button { border: 0; background: none; padding: 4px 10px; border-radius: 9px; cursor: pointer; color: var(--muted); font-size: 12px; white-space: nowrap; transition: background 0.2s, color 0.2s; }
.seg button.on { background: rgba(255, 255, 255, 0.1); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.card-head .seg { margin-left: auto; }

.pos { color: var(--mint); }
.neg { color: var(--red); }
.amber { color: var(--amber); }
.muted { color: var(--muted); }
.empty { color: var(--dim); text-align: center; padding: 28px 10px; font-size: 13px; }
.empty b { display: block; color: var(--muted); font-weight: 600; margin-bottom: 4px; font-size: 14px; }

/* ------------------------------------------------------------- hero */

.hero { display: flex; flex-direction: column; }
.hero-value {
  font-size: clamp(44px, 5.2vw, 72px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.02;
  background: linear-gradient(100deg, #fff 0%, #c8fff0 40%, #2ef2a0 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 30px rgba(46, 242, 160, 0.25));
}
.hero-value.neg { background-image: linear-gradient(100deg, #fff 0%, #ffd0da 40%, #ff5c7a 100%); filter: drop-shadow(0 0 30px rgba(255, 92, 122, 0.25)); }
.hero-meta { display: flex; gap: 26px; margin: 14px 0 6px; flex-wrap: wrap; }
.hero-meta label { display: block; color: var(--dim); font-size: 11.5px; letter-spacing: 0.08em; }
.hero-meta span { font-size: 18px; font-weight: 700; }
.hero .chart { flex: 1; min-height: 190px; margin-top: 8px; }
.hero-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.hero-foot .legend { margin: 0; }
.hero-foot .seg { margin-left: auto; }
.hero-value.flash { animation: flash 1.4s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes flash { 0% { filter: drop-shadow(0 0 0 rgba(46, 242, 160, 0)); transform: scale(1); } 25% { filter: drop-shadow(0 0 42px rgba(46, 242, 160, 0.9)); transform: scale(1.025); } 100% { filter: drop-shadow(0 0 30px rgba(46, 242, 160, 0.25)); transform: scale(1); } }

/* ------------------------------------------------------------- charts */

.chart { position: relative; width: 100%; height: 190px; }
.chart.small { height: 150px; }
.chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.chart .axis text { fill: var(--dim); font-size: 10.5px; font-family: var(--mono); }
.chart .grid line { stroke: rgba(255, 255, 255, 0.05); }
.chart .zero { stroke: rgba(255, 255, 255, 0.22); stroke-dasharray: 3 4; }
.chart .cross { stroke: rgba(255, 255, 255, 0.35); }
.tip {
  position: absolute; pointer-events: none; z-index: 5; opacity: 0; transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  padding: 8px 10px; border-radius: 12px; font-size: 12px; white-space: nowrap;
  background: rgba(10, 12, 26, 0.92); border: 1px solid var(--line-2); box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.8);
  max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.tip.on { opacity: 1; transform: none; }
.tip b { display: block; font-weight: 600; white-space: normal; }
.tip .row { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

/* ------------------------------------------------------------- radar */

.radar-card { display: flex; flex-direction: column; }
.radar-wrap { position: relative; flex: 1; min-height: 380px; }
#radar { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; }
.radar-legend { position: absolute; left: 0; bottom: 0; display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.radar-legend div { display: flex; align-items: center; gap: 8px; }
.radar-legend i { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.radar-legend b { color: var(--text); font-weight: 600; min-width: 34px; display: inline-block; text-align: right; }
.radar-stats { position: absolute; right: 0; bottom: 0; text-align: right; font-size: 12px; color: var(--muted); }
.radar-stats strong { display: block; font-size: 26px; color: var(--text); font-weight: 800; letter-spacing: -0.02em; }

/* ------------------------------------------------------------- KPI tiles */

.kpis { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 14px; }
.kpi {
  position: relative; padding: 14px 16px; border-radius: 18px; overflow: hidden; min-width: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: rise 0.6s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.kpi::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 2px; background: var(--c, var(--teal)); opacity: 0.7; box-shadow: 0 0 14px var(--c, var(--teal)); }
.kpi label { color: var(--muted); font-size: 11.5px; letter-spacing: 0.06em; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 22px; font-weight: 750; letter-spacing: -0.01em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------------------------------------- feeds */

.feed { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; max-height: 420px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.15) transparent; }
.feed::-webkit-scrollbar, .console::-webkit-scrollbar, .table-wrap::-webkit-scrollbar { width: 6px; height: 6px; }
.feed::-webkit-scrollbar-thumb, .console::-webkit-scrollbar-thumb, .table-wrap::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 6px; }
.item {
  padding: 11px 13px; border-radius: 14px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025); transition: background 0.2s, border-color 0.2s;
}
.item:hover { background: rgba(255, 255, 255, 0.05); border-color: var(--line-2); }
.item.fresh { animation: slide 0.7s cubic-bezier(0.2, 0.9, 0.2, 1); }
@keyframes slide { 0% { opacity: 0; transform: translateX(-14px) scale(0.98); background: rgba(46, 242, 160, 0.14); } 100% { opacity: 1; transform: none; } }
.item-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.item-title a:hover { text-decoration: underline; text-decoration-color: rgba(255, 255, 255, 0.3); }
.ago { color: var(--dim); font-size: 11.5px; white-space: nowrap; font-family: var(--mono); }
.item-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.item-meta b { font-weight: 700; }
.item-legs { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.leg { font-size: 11.5px; padding: 2px 8px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg.yes { color: #9fe8ff; }
.leg.no { color: #ffb8c8; }
.chip { --c: var(--teal); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 8px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); white-space: nowrap; letter-spacing: 0.04em; }

/* ------------------------------------------------------------- tables */

.table-wrap { overflow: auto; max-height: 420px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 600; color: var(--dim); font-size: 11.5px; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(8, 10, 22, 0.92); backdrop-filter: blur(8px); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); vertical-align: middle; }
tr { transition: background 0.2s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.035); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.title { max-width: 0; width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.title a:hover { text-decoration: underline; }
.edgebar { display: inline-block; width: 64px; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.06); margin-left: 8px; vertical-align: middle; overflow: hidden; }
.edgebar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--red), var(--amber), var(--mint)); }

/* ------------------------------------------------------------- histogram */

.hist { display: grid; gap: 16px; }
.hist-row h4 { margin: 0 0 20px; font-size: 12px; font-weight: 600; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.hist-row h4 .meta { margin-left: auto; color: var(--dim); font-weight: 500; white-space: nowrap; }
.bars { display: grid; grid-template-columns: repeat(10, 1fr); grid-template-rows: 100%; gap: 5px; align-items: end; height: 74px; }
.bar { position: relative; border-radius: 6px 6px 3px 3px; min-height: 3px; background: var(--bc); opacity: 0.85; transition: height 0.8s cubic-bezier(0.2, 0.9, 0.2, 1); box-shadow: 0 0 16px -4px var(--bc); }
.bar:hover { opacity: 1; }
.bar span { position: absolute; top: -16px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.bins { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 6px; }
.bins span { text-align: center; font-size: 9.5px; color: var(--dim); font-family: var(--mono); white-space: nowrap; }

/* ------------------------------------------------------------- risk */

.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.gauge { text-align: center; }
.gauge svg { width: 100%; max-width: 120px; aspect-ratio: 1; display: block; margin: 0 auto; }
.gauge .track { stroke: rgba(255, 255, 255, 0.07); }
.gauge .arc { transition: stroke-dashoffset 1s cubic-bezier(0.2, 0.9, 0.2, 1), stroke 0.4s; filter: drop-shadow(0 0 6px currentColor); }
.gauge .gv { font-size: 19px; font-weight: 800; fill: var(--text); }
.gauge .gs { font-size: 9.5px; fill: var(--dim); font-family: var(--mono); }
.gauge label { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.limits { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 14px; font-size: 12.5px; }
.limits div { display: flex; justify-content: space-between; color: var(--muted); border-bottom: 1px dashed rgba(255, 255, 255, 0.06); padding-bottom: 5px; }
.limits b { color: var(--text); font-weight: 600; }
.skips { margin-top: 14px; display: grid; gap: 6px; }
.skips h4 { margin: 0 0 2px; font-size: 11.5px; color: var(--dim); letter-spacing: 0.06em; font-weight: 600; }
.skip { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.skip .sk-bar { flex: 1; height: 5px; border-radius: 4px; background: rgba(255, 255, 255, 0.05); overflow: hidden; }
.skip .sk-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--violet), var(--teal)); border-radius: 4px; }
.skip .sk-name { width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skip b { font-family: var(--mono); color: var(--text); font-weight: 500; min-width: 48px; text-align: right; }
.risk-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ------------------------------------------------------------- engine */

.engine-card { display: flex; flex-direction: column; }
.engine-card .chart { flex: 1 1 150px; }
.engine-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.eg { padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); min-width: 0; }
.eg label { display: block; color: var(--dim); font-size: 11px; letter-spacing: 0.05em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eg .v { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eg .s { color: var(--dim); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--dim); }
.dot.ok { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.dot.bad { background: var(--red); box-shadow: 0 0 8px var(--red); }

/* ------------------------------------------------------------- go-live */

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.checklist li { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 14px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); }
.checklist .ic { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; }
.checklist .ok .ic { background: rgba(46, 242, 160, 0.13); color: var(--mint); }
.checklist .no .ic { background: rgba(255, 92, 122, 0.12); color: var(--red); }
.checklist .info .ic { background: rgba(90, 169, 255, 0.12); color: var(--blue); }
.checklist code { font-size: 12.5px; color: #dfe4ff; }
.checklist .desc { color: var(--muted); font-size: 12px; }
.checklist .det { color: var(--dim); font-size: 12px; font-family: var(--mono); }
.howto { margin-top: 14px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); }
.howto summary { cursor: pointer; padding: 12px 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::after { content: "＋"; margin-left: auto; color: var(--muted); transition: transform 0.25s; }
.howto[open] summary::after { transform: rotate(45deg); }
.howto ol { margin: 0; padding: 0 16px 14px 34px; color: #c9cfee; display: grid; gap: 10px; font-size: 13px; }
.howto li::marker { color: var(--teal); font-weight: 700; }
.envline { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 7px 10px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: #d8fff0; overflow-x: auto; }
.envline span { flex: 1; white-space: nowrap; }
.envline button { border: 0; background: rgba(255, 255, 255, 0.08); border-radius: 7px; padding: 3px 8px; cursor: pointer; color: var(--muted); font-size: 11px; font-family: var(--font); }
.envline button:hover { color: var(--text); }
.note { color: var(--muted); font-size: 12px; margin: 10px 2px 0; }

/* ------------------------------------------------------------- console */

.console {
  height: 300px; overflow-y: auto; padding: 12px 14px; border-radius: 14px;
  background: rgba(0, 0, 0, 0.45); border: 1px solid var(--line);
  font: 12px/1.65 var(--mono); color: #b9c1e6;
}
.console .ln { white-space: pre-wrap; word-break: break-word; }
.console .t { color: var(--dim); margin-right: 8px; }
.console .lv { display: inline-block; width: 52px; font-weight: 700; }
.console .INFO .lv { color: var(--teal); }
.console .WARNING .lv { color: var(--amber); }
.console .ERROR .lv, .console .CRITICAL .lv { color: var(--red); }
.console .ERROR, .console .CRITICAL { color: #ffc2cd; }
.console .nm { color: var(--violet); margin-right: 6px; }
.console .hl { color: var(--mint); }
.console.f-trade .ln:not(.trade), .console.f-warn .ln.INFO { display: none; }

/* ------------------------------------------------------------- modal + toast */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(2, 3, 8, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade 0.2s; }
.modal.hidden { display: none; }
.modal-box { width: min(460px, calc(100vw - 32px)); padding: 24px; border-radius: 22px; background: linear-gradient(180deg, rgba(30, 33, 58, 0.95), rgba(14, 16, 32, 0.95)); border: 1px solid var(--line-2); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9); animation: rise 0.3s; }
.modal-box h3 { margin: 0 0 8px; font-size: 18px; }
.modal-box p { color: var(--muted); margin: 0 0 14px; }
.modal-box input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); outline: none; font-family: var(--mono); letter-spacing: 0.1em; }
.modal-box input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 60; padding: 11px 18px; border-radius: 14px; background: rgba(14, 16, 32, 0.95); border: 1px solid var(--line-2); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.9); transition: opacity 0.25s, transform 0.25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(46, 242, 160, 0.55); box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.9), 0 0 30px -8px rgba(46, 242, 160, 0.6); }
.toast.bad { border-color: rgba(255, 92, 122, 0.6); }

.foot { max-width: 1640px; margin: 0 auto; padding: 0 28px 36px; color: var(--dim); font-size: 12px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

/* ------------------------------------------------------------- login */

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); padding: 34px 30px 28px; text-align: center; }
.login-card .logo { width: 64px; height: 64px; margin: 0 auto 14px; display: block; }
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: 0.3em; font-weight: 800; padding-left: 0.3em; }
.login-card p { color: var(--muted); margin: 6px 0 24px; font-size: 13px; }
.login-card form { display: grid; gap: 12px; }
.login-card input { padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); outline: none; text-align: center; letter-spacing: 0.12em; transition: border-color 0.2s, box-shadow 0.2s; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(25, 230, 212, 0.15); }
.login-card .btn { justify-content: center; padding: 12px; font-weight: 700; background: linear-gradient(90deg, rgba(25, 230, 212, 0.25), rgba(139, 108, 255, 0.25)); border-color: rgba(255, 255, 255, 0.2); }
.login-card .err { min-height: 20px; color: var(--red); font-size: 13px; }
.shake { animation: shake 0.4s; }
@keyframes shake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .engine-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1080px) {
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .status-strip { justify-content: flex-start; }
}
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; padding: 12px 16px; gap: 10px; }
  .status-strip { order: 3; width: 100%; }
  .actions { margin-left: auto; }
  .layout, .banners, .foot { padding-left: 14px; padding-right: 14px; }
  .layout { gap: 14px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .radar-wrap { min-height: 400px; }
  .card-head h2 em, .card-head .hint { display: none; }
  .hide-sm { display: none; }
  .gauges { grid-template-columns: repeat(3, 1fr); }
  .limits { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
