:root {
  color-scheme: dark;
  --bg: #07111d;
  --surface: #0c1a2a;
  --surface-raised: #10243a;
  --line: rgba(176, 205, 232, .16);
  --text: #edf6ff;
  --muted: #9aafc3;
  --accent: #77c7c8;
  --ok: #57c58b;
  --warn: #f1bb62;
  --bad: #ec7279;
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
a { color: inherit; text-decoration: none; }

.layout { min-height: 100vh; display: grid; grid-template-columns: 254px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; flex-direction: column; height: 100vh; min-height: 0; padding: 24px 16px; overflow: hidden; border-right: 1px solid var(--line); background: #081624; }
.brand { display: block; margin-bottom: 18px; padding: 0 8px 17px; border-bottom: 1px solid var(--line); }
.brand-name { display: block; letter-spacing: .06em; font-size: 1.15rem; font-weight: 800; }
.brand-name strong { color: var(--accent); }
.brand-subtitle { display: block; margin-top: 6px; color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
.sidebar nav { min-height: 0; padding-right: 4px; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: rgba(154, 175, 195, .38) transparent; }
.nav-label { display: block; margin: 0 10px 15px; color: #b9cedd; font-size: .74rem; font-weight: 800; letter-spacing: .07em; }
.nav-group + .nav-group { margin-top: 13px; padding-top: 13px; border-top: 1px solid rgba(176, 205, 232, .12); }
.nav-group-label { display: block; margin: 0 10px 8px; color: #9de1e1; font-size: .74rem; font-weight: 800; letter-spacing: .055em; line-height: 1.3; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; min-height: 35px; padding: 7px 10px 7px 13px; margin: 2px 0; border: 1px solid transparent; border-radius: 7px; color: #d7e6f0; font-size: .88rem; font-weight: 600; line-height: 1.25; }
.nav-link::before { content: ""; width: 2px; height: 17px; flex: 0 0 auto; margin-right: 10px; border-radius: 2px; background: rgba(176, 205, 232, .32); }
.nav-link:hover { background: rgba(119, 199, 200, .08); border-color: rgba(119, 199, 200, .15); color: #fff; }
.nav-link.active { background: rgba(119, 199, 200, .14); border-color: rgba(119, 199, 200, .26); box-shadow: inset 3px 0 0 var(--accent); color: #fff; font-weight: 750; }
.nav-link.active::before { background: var(--accent); }
.nav-link:focus-visible, .mobile-nav-link:focus-visible { color: white; outline: 2px solid var(--accent); outline-offset: 2px; }
.sidebar-footer { flex: 0 0 auto; margin-top: 16px; padding: 12px 10px 0; border-top: 1px solid var(--line); }
.session-user { display: block; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: .82rem; white-space: nowrap; }
.logout { width: 100%; margin-top: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: transparent; }
.logout-error { margin: 10px 0 0; color: #ffb3b7; font-size: .78rem; line-height: 1.35; }
.mobile-logout-error { display: none; }

.main { padding: 34px clamp(20px, 4vw, 58px) 52px; width: 100%; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.3rem); letter-spacing: -.035em; }
.subtitle { max-width: 720px; margin: 9px 0 0; color: var(--muted); line-height: 1.5; }
.read-only { padding: 9px 12px; border: 1px solid rgba(119, 199, 200, .35); border-radius: 999px; color: #b9e9e9; font-size: .8rem; white-space: nowrap; }

.connection-strip { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; margin-bottom: 24px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(12, 26, 42, .76); }
.connection-state { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--muted); }
.state-live .dot, .state-healthy .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(87, 197, 139, .12); }
.state-stale .dot, .state-unknown .dot { background: var(--warn); }
.state-offline .dot, .state-error .dot { background: var(--bad); }
.strip-detail { color: var(--muted); font-size: .85rem; }
.strip-detail strong { color: var(--text); font-weight: 650; }

.notice { margin: 0 0 22px; padding: 12px 15px; border-left: 3px solid var(--warn); border-radius: 0 9px 9px 0; background: rgba(241, 187, 98, .08); color: #eadbbd; line-height: 1.45; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric, .panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metric { min-height: 118px; padding: 17px; }
.metric-label { display: block; min-height: 2.2em; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.metric-value { display: block; margin-top: 13px; font-size: 1.5rem; font-weight: 760; letter-spacing: -.025em; }
.metric-detail { display: block; margin-top: 5px; color: var(--muted); font-size: .78rem; }
.content-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel { overflow: hidden; }
.panel.wide { grid-column: 1 / -1; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 17px 18px; border-bottom: 1px solid var(--line); }
h2 { margin: 0; font-size: 1rem; }
.panel-hint { color: var(--muted); font-size: .78rem; }
.list { margin: 0; padding: 0; list-style: none; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid rgba(176, 205, 232, .1); }
.list-row:last-child { border-bottom: 0; }
.row-title { min-width: 0; font-weight: 650; overflow-wrap: anywhere; }
.row-detail { margin-top: 3px; color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.status { padding: 5px 8px; border-radius: 999px; font-size: .75rem; font-weight: 750; white-space: nowrap; background: rgba(154, 175, 195, .14); color: #d4e2ed; }
.status.healthy { background: rgba(87, 197, 139, .14); color: #a7ecc5; }
.status.stale, .status.unknown { background: rgba(241, 187, 98, .14); color: #f5d493; }
.status.offline, .status.error, .status.not-ready { background: rgba(236, 114, 121, .14); color: #ffb3b7; }
.metric-value.healthy { color: #a7ecc5; }
.metric-value.stale { color: #f5d493; }
.metric-value.offline { color: #ffb3b7; }
.empty { padding: 24px 18px; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 580px; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 13px 18px; border-bottom: 1px solid rgba(176, 205, 232, .1); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
td { overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
.mobile-header, .mobile-navigation-menu, .mobile-nav { display: none; }

.environment-badge { padding: 9px 12px; border: 1px solid rgba(119, 199, 200, .48); border-radius: 999px; color: #b9e9e9; background: rgba(119, 199, 200, .08); font-size: .8rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.stream-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.stream-card .panel-heading { align-items: center; }
.stream-statuses { display: inline-flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.source-state { color: var(--muted); font-size: .73rem; white-space: nowrap; }
.stream-card > p { margin: 0; padding: 18px; color: var(--muted); line-height: 1.45; }
.stream-card > .stream-state-message { padding-top: 12px; border-top: 1px solid rgba(176, 205, 232, .1); font-size: .8rem; }
.stream-details { display: grid; grid-template-columns: minmax(150px, .9fr) minmax(0, 1.3fr); margin: 0; }
.stream-details dt, .stream-details dd { margin: 0; padding: 10px 18px; border-bottom: 1px solid rgba(176, 205, 232, .1); font-size: .82rem; overflow-wrap: anywhere; }
.stream-details dt { color: var(--muted); }
.stream-details dd { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.stream-details dd:last-child, .stream-details dt:nth-last-child(2) { border-bottom: 0; }
.symbols-panel { margin-top: 18px; }
.symbols-heading { align-items: flex-start; }
.prices-panel { margin-top: 18px; }
.prices-heading { align-items: flex-start; }
.symbol-controls { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.stream-tabs { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 9px; }
.stream-tab, .pagination button { padding: 7px 10px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: .8rem; font-weight: 700; }
.stream-tab.active { color: #06202a; background: var(--accent); }
.symbol-search { display: grid; gap: 5px; color: var(--muted); font-size: .72rem; font-weight: 700; }
.symbol-search input { width: min(280px, 52vw); padding: 8px 10px; border: 1px solid #29435c; border-radius: 8px; color: var(--text); background: #081624; outline: none; }
.symbol-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(119,199,200,.12); }
.symbols-table { min-width: 1280px; }
.prices-table { min-width: 1510px; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8rem; }
.pagination button { border: 1px solid var(--line); color: var(--text); }
.pagination button:disabled { opacity: .45; cursor: not-allowed; }

.table-actions { display: inline-flex; flex-wrap: wrap; gap: 7px; }
.button { min-height: 32px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: transparent; font-weight: 750; }
.button.primary { border-color: var(--accent); background: var(--accent); color: #06202a; }
.button.danger { border-color: rgba(236, 114, 121, .55); color: #ffb3b7; }
.stacked span { display: block; }
.stacked span + span, .table-subtle { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.action-dialog { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(3, 10, 18, .76); }
.action-dialog[hidden] { display: none; }
.action-dialog-card { width: min(100%, 560px); padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface-raised); box-shadow: 0 26px 80px rgba(0, 0, 0, .45); }
.action-dialog-card h2 { font-size: 1.2rem; }
.action-warning { margin: 16px 0; padding: 11px 12px; border-left: 3px solid var(--warn); border-radius: 0 8px 8px 0; background: rgba(241, 187, 98, .08); color: #eadbbd; line-height: 1.45; }
.action-confirmation { display: grid; gap: 8px; color: var(--muted); font-size: .82rem; font-weight: 700; }
.action-confirmation code { overflow-wrap: anywhere; color: #b9e9e9; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.action-confirmation input { width: 100%; padding: 10px 11px; border: 1px solid #29435c; border-radius: 8px; color: var(--text); background: #081624; outline: none; }
.action-confirmation input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(119,199,200,.12); }
.action-error { margin: 12px 0 0; color: #ffb3b7; font-size: .84rem; }
.action-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.runtime-toolbar { display: flex; justify-content: flex-end; margin: 0 0 18px; }
.runtime-metrics { grid-template-columns: repeat(6, minmax(150px, 1fr)); }
.runtime-service-table { min-width: 920px; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 10%, #17334b 0, var(--bg) 45%); }
.login-card { width: min(100%, 432px); padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: rgba(12, 26, 42, .92); box-shadow: 0 22px 70px rgba(0,0,0,.28); }
.login-card h1 { margin-top: 32px; font-size: 1.75rem; }
.login-card p { color: var(--muted); line-height: 1.45; }
.login-form { display: grid; gap: 16px; margin-top: 26px; }
.login-form label { display: grid; gap: 7px; color: #c5d9e9; font-size: .84rem; font-weight: 650; }
.login-form input { width: 100%; padding: 11px 12px; border: 1px solid #29435c; border-radius: 8px; color: var(--text); background: #081624; outline: none; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(119,199,200,.12); }
.login-form button { padding: 11px 14px; border: 0; border-radius: 8px; background: var(--accent); color: #06202a; font-weight: 800; }
.login-form button:disabled { opacity: .7; cursor: wait; }
.login-error { margin: 0; color: #ffb3b7 !important; font-size: .86rem; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: #081624; }
  .mobile-header .brand { margin: 0; padding: 0; border: 0; }
  .mobile-header .logout { width: auto; margin-top: 0; }
  .mobile-logout-error:not([hidden]) { display: block; margin: 0; padding: 0 20px 12px; background: #081624; }
  .mobile-navigation-menu { display: block; border-bottom: 1px solid var(--line); background: #081624; }
  .mobile-menu-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 20px; color: #e6f3f8; cursor: pointer; font-size: .9rem; font-weight: 750; letter-spacing: .01em; list-style: none; }
  .mobile-menu-summary::-webkit-details-marker { display: none; }
  .mobile-menu-summary::after { content: ""; width: 7px; height: 7px; flex: 0 0 auto; margin-right: 3px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
  .mobile-navigation-menu[open] > .mobile-menu-summary::after { transform: rotate(225deg); }
  .mobile-menu-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
  .mobile-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; padding: 0 20px 18px; border-bottom: 1px solid var(--line); background: #081624; }
  .mobile-nav-group:first-of-type { grid-column: 1 / -1; }
  .mobile-nav-group { min-width: 0; }
  .mobile-nav .nav-group-label { margin: 0 0 8px; font-size: .72rem; }
  .mobile-nav-link { display: block; margin: 3px 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: #d7e6f0; font-size: .88rem; overflow-wrap: anywhere; }
  .mobile-nav-link.active { border-color: rgba(119, 199, 200, .35); background: rgba(119, 199, 200, .13); box-shadow: inset 3px 0 0 var(--accent); color: #fff; font-weight: 750; }
  .main { padding-top: 28px; }
}
@media (max-width: 650px) {
  .main { padding: 24px 16px 38px; }
  .page-header { display: block; }
  .read-only { display: inline-block; margin-top: 15px; }
  .metric-grid, .content-grid { grid-template-columns: 1fr; }
  .panel.wide { grid-column: auto; }
  .connection-strip { display: grid; gap: 9px; }
  .login-card { padding: 26px 22px; }
  .environment-badge { display: inline-block; margin-top: 15px; }
  .stream-card-grid { grid-template-columns: 1fr; }
  .runtime-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .runtime-toolbar { justify-content: flex-start; }
  .symbols-heading, .prices-heading { display: block; }
  .symbol-controls { justify-content: flex-start; margin-top: 14px; }
  .symbol-search { width: 100%; }
  .symbol-search input { width: 100%; }
}
