:root {
  color-scheme: dark;
  --bg: #101722;
  --sidebar: #111b28;
  --surface: #172332;
  --edge: #2a3b4d;
  --text: #edf4fb;
  --muted: #a4b5c7;
  --accent: #5ae0bc;
  --warn: #f9c37b;
  --red: #ff8e93;
  --mono: ui-monospace, "IBM Plex Mono", Consolas, monospace;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, select, input { font: inherit; color: var(--text); }
button, select, input {
  border: 1px solid var(--edge);
  border-radius: .5rem;
  background-color: #132030;
  min-height: 2.55rem;
}
button { padding: .55rem .85rem; cursor: pointer; white-space: nowrap; }
button:hover, select:hover { border-color: #648098; }
button:disabled { cursor: default; opacity: .52; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
select {
  appearance: none;
  padding: .48rem 1.9rem .48rem .65rem;
  max-width: 16rem;
  background-image: linear-gradient(45deg, transparent 50%, #adc1d2 50%), linear-gradient(135deg, #adc1d2 50%, transparent 50%);
  background-position: calc(100% - 13px) 52%, calc(100% - 9px) 52%;
  background-size: 4px 4px;
  background-repeat: no-repeat;
}
input { width: 100%; padding: .55rem .7rem; }
label { display: grid; gap: .28rem; color: var(--muted); font-size: .875rem; }
.muted { color: var(--muted); }
.positive { color: var(--accent); }
.negative, .error-text { color: var(--red); }
.eyebrow { color: #82cbbf; font-size: .77rem; font-weight: 700; letter-spacing: .12em; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 760; font-size: 1.24rem; letter-spacing: -.045em; }
.brand-mark { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; background: var(--accent); color: #0b2c29; font-weight: 900; font-style: italic; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(22rem, 1fr) minmax(23rem, .8fr); }
.login-context {
  padding: clamp(2rem, 6vw, 7rem);
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 3rem;
  background: radial-gradient(ellipse at 0% 95%, #1b4e4c, transparent 65%), linear-gradient(145deg, #1a2e42, #111d2b);
}
.login-context h1 { font-size: clamp(3rem, 6.5vw, 6.5rem); line-height: .98; letter-spacing: -.075em; margin: 1rem 0 1.3rem; }
.login-context p:not(.eyebrow) { max-width: 32rem; color: #bdcddd; line-height: 1.55; }
.login-foot { color: var(--muted); font-size: .875rem; display: flex; align-items: center; gap: .55rem; }
.status-dot, .state i { background: currentColor; border-radius: 50%; height: .48rem; width: .48rem; display: inline-block; flex: none; }
.login-panel { display: grid; place-items: center; padding: 2rem; }
.login-panel form { width: min(100%, 24rem); display: grid; gap: 1.1rem; }
.login-panel h2 { font-size: 1.65rem; margin-bottom: .45rem; letter-spacing: -.03em; }
.primary { background: var(--accent); color: #102922; border-color: transparent; font-weight: 750; }
.error-text { font-size: .875rem; line-height: 1.45; min-height: 1.2rem; }
.shell { display: grid; grid-template-columns: 13rem minmax(0, 1fr); align-items: start; }
.sidebar { height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 1.45rem .85rem .9rem; background: var(--sidebar); border-right: 1px solid var(--edge); }
.sidebar .brand { padding-left: .55rem; margin-bottom: 2.25rem; }
.sidebar nav { display: grid; gap: .4rem; }
.sidebar nav a { display: flex; gap: .7rem; align-items: center; color: var(--muted); padding: .65rem .6rem; border-radius: .5rem; font-size: .875rem; }
.sidebar nav a span { font-size: 1.1rem; width: 1rem; text-align: center; }
.sidebar nav a.active, .sidebar nav a:hover { background: #203649; color: #e2fff7; }
.sidebar nav a.active span { color: var(--accent); }
.sidebar-bottom { margin-top: auto; display: flex; align-items: center; gap: .48rem; padding-top: .8rem; border-top: 1px solid var(--edge); }
.sidebar-bottom strong { display: block; font-size: .8rem; }
.sidebar-bottom small { color: var(--muted); font-size: .74rem; }
.sidebar-bottom button { margin-left: auto; padding: .2rem .43rem; min-height: 1.85rem; font-size: .8rem; }
.avatar { display: grid; place-items: center; width: 1.85rem; height: 1.85rem; border-radius: 50%; background: #263e50; color: #c5ebf3; font-weight: 700; flex: none; }
main { min-width: 0; }
.topbar { padding: .8rem clamp(1.15rem, 2.6vw, 2.8rem); min-height: 4rem; border-bottom: 1px solid var(--edge); display: flex; align-items: center; justify-content: space-between; gap: 1rem; background: #121d2a; }
.market-label { font-weight: 700; white-space: nowrap; }
.market-label span { margin-left: .55rem; color: var(--muted); font-size: .875rem; font-weight: 500; }
.header-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .45rem .9rem; font-size: .875rem; }
.header-latency { display: inline-flex; align-items: baseline; gap: .4rem; white-space: nowrap; color: var(--muted); }
.header-latency strong { color: var(--text); font-variant-numeric: tabular-nums; }
.presence { color: var(--muted); border-left: 1px solid var(--edge); padding-left: .9rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.state { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); white-space: nowrap; }
.state.live { color: var(--accent); }
.state.stale { color: var(--warn); }
.state.offline { color: var(--red); }
.workspace { max-width: 110rem; margin-inline: auto; padding: 1.75rem clamp(1.15rem, 2.6vw, 2.8rem) 1rem; }
.section { margin-top: 2.65rem; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 1rem; }
.hero { flex-wrap: wrap; }
.hero h1 { font-size: clamp(2rem, 3vw, 3rem); letter-spacing: -.055em; margin: .15rem 0; line-height: 1.1; }
.section-heading h2 { font-size: 1.6rem; letter-spacing: -.035em; margin-bottom: .25rem; }
.section-heading p { font-size: .875rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: .55rem; }
.toolbar select { font-size: .875rem; }
.notice { border: 1px solid #645238; background: #2f2923; color: #ffdaa8; border-radius: .55rem; padding: .75rem .9rem; margin-bottom: .95rem; font-size: .875rem; }
.danger { border-color: #ad5157; background: #a43e4b; color: #fff; font-weight: 650; }
.danger:hover { border-color: #ffadb1; }
.danger.outline { background: #38242e; color: #ffb7bd; font-size: .875rem; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; margin-bottom: .85rem; }
.kpis.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { min-width: 0; border: 1px solid var(--edge); border-radius: .8rem; background: var(--surface); }
.kpi { padding: 1rem 1.05rem; display: flex; flex-direction: column; gap: .42rem; }
.kpi > span, .meter-heading { color: var(--muted); font-size: .875rem; }
.kpi strong { font-size: clamp(1.08rem, 1.65vw, 1.65rem); font-weight: 680; letter-spacing: -.05em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: .77rem; }
.featured { background: linear-gradient(120deg, #1a393c, #182d38 72%); border-color: #36635f; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.grid.wide { grid-template-columns: minmax(0, 1.65fr) minmax(16.5rem, 1fr); }
.chart, .details { padding: 1rem 1.05rem; }
.card header { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: .55rem; }
.card header :is(h2, h3) { font-size: 1.02rem; letter-spacing: -.015em; }
.card header p { font-size: .83rem; color: var(--muted); margin-top: .22rem; }
.chart { position: relative; }
.chart canvas { display: block; width: 100%; height: 12.6rem; }
.legend { display: flex; flex-wrap: wrap; gap: .32rem .8rem; min-height: 1.3rem; margin-bottom: .45rem; }
.legend button { display: inline-flex; align-items: center; gap: .35rem; min-height: 1.65rem; font-size: .78rem; padding: .13rem .3rem; border-color: transparent; color: #c8d5e2; background: transparent; }
.legend button[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.legend i { width: .6rem; height: .6rem; border-radius: .2rem; background: var(--line); }
.chart-empty { position: absolute; left: 0; right: 0; text-align: center; bottom: 6.7rem; color: var(--muted); font-size: .875rem; pointer-events: none; }
.chart-readout { display: block; color: var(--muted); min-height: 1.7rem; padding-top: .2rem; font: .76rem/1.4 var(--mono); }
.details dl > div, .meter-heading { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.details dl > div { border-bottom: 1px solid var(--edge); padding: .59rem 0; }
.details dt { color: var(--muted); font-size: .875rem; }
.details dd { font-family: var(--mono); text-align: right; font-size: .91rem; }
.details .position-value { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: .25rem .5rem; }
.position-side { color: var(--muted); background: #233449; border-radius: .3rem; padding: .14rem .42rem; font: 650 .78rem/1.3 Inter, "Segoe UI", system-ui, sans-serif; }
.position-side.positive { color: var(--accent); background: #203e3b; }
.position-side.negative { color: var(--red); background: #412d3b; }
.meter-heading { margin-top: .95rem; }
.meter-heading strong { color: var(--text); }
progress { width: 100%; height: .62rem; appearance: none; border: 0; margin-top: .45rem; overflow: hidden; border-radius: 999px; background: #0e1927; }
progress::-webkit-progress-bar { background: #0e1927; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }
.standalone { margin-top: .85rem; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: right; font-variant-numeric: tabular-nums; }
td, th { padding: .53rem .38rem; border-bottom: 1px solid var(--edge); font-size: .85rem; }
th { color: var(--muted); font-weight: 650; white-space: nowrap; }
td:first-child, th:first-child { text-align: left; }
.logs { max-height: 24rem; }
.logs table { text-align: left; }
.logs th { position: sticky; top: 0; background: var(--surface); }
.logs td:first-child { white-space: nowrap; color: var(--muted); }
.logs td:nth-child(2) { width: 5rem; font-family: var(--mono); }
.logs td:last-child { width: 100%; overflow-wrap: anywhere; }
.logs summary { cursor: pointer; }
.logs pre { white-space: pre-wrap; font-size: .8rem; color: var(--muted); }
.log-header { align-items: center; }
.log-header button { font-size: .875rem; }
footer { margin-top: 1.6rem; font-size: .8rem; }
dialog { max-width: min(30rem, 95vw); padding: 1.35rem; border: 1px solid var(--edge); border-radius: 1rem; background: var(--surface); color: var(--text); }
dialog::backdrop { background: #060b12c9; }
dialog form { display: grid; gap: .75rem; }
dialog p { font-size: .91rem; line-height: 1.45; }
.dialog-actions { display: flex; justify-content: end; gap: .55rem; }
@media (max-width: 1050px) {
  .shell { grid-template-columns: 11rem minmax(0, 1fr); }
  .grid.wide { grid-template-columns: minmax(0, 1.3fr) minmax(13rem, 1fr); }
}
@media (max-width: 780px) {
  .shell, .login-layout { display: block; }
  .sidebar { height: auto; position: static; }
  .sidebar .brand { margin-bottom: .7rem; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar-bottom { margin-top: .5rem; }
  .grid, .grid.wide { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-context { padding: 2rem; }
}
