:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  background: #080d17;
  color: #eef3fb;
  --bg: #080d17;
  --sidebar: #0b1220;
  --panel: #101a2a;
  --panel-raised: #142035;
  --line: #223149;
  --line-soft: #1b293d;
  --text: #eef3fb;
  --muted: #91a0b6;
  --muted-2: #6f819a;
  --accent: #76a8ff;
  --accent-strong: #5689e8;
  --cyan: #76d7d0;
  --green: #70d4ab;
  --amber: #e8be74;
  --red: #ff939c;
  --radius: 15px;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: #a9c7ff; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.15; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: clamp(22px, 2.2vw, 28px); line-height: 1.2; letter-spacing: -.025em; }
h3 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
h4 { margin: 20px 0 10px; font-size: 13px; font-weight: 650; color: #c7d2e1; }
code { color: #c4d6ff; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; width: 252px; flex-direction: column; padding: 25px 15px 16px; border-right: 1px solid #172338; background: linear-gradient(180deg, #0d1524 0%, #0a101c 100%); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 9px 28px; color: var(--text); }
.brand:hover { color: white; }
.brand-mark { display: grid; width: 38px; height: 38px; place-items: center; border: 1px solid #4777b9; border-radius: 13px; background: linear-gradient(145deg, #234875, #142541); color: #c8e7ff; font-family: Georgia, serif; font-size: 23px; box-shadow: 0 5px 20px #0b192e; }
.brand strong, .brand small, .user-chip strong, .user-chip small { display: block; }
.brand strong { font-size: 16px; letter-spacing: .04em; }
.brand small { margin-top: 3px; color: #8092aa; font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.side-nav { display: flex; flex: 1; flex-direction: column; gap: 4px; }
.nav-caption { margin: 7px 10px 7px; color: #8294ac; font-size: 11px; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; }
.nav-admin-caption { margin-top: 23px; }
.side-link { display: flex; min-height: 42px; align-items: center; gap: 12px; padding: 9px 11px; border: 1px solid transparent; border-radius: 10px; color: #a7b4c7; font-size: 13px; font-weight: 550; transition: background .16s ease, color .16s ease, border-color .16s ease; }
.side-link:hover { background: #121f31; color: #eef3fb; }
.side-link[aria-current="page"] { border-color: #294264; background: linear-gradient(90deg, #1b3451, #132236); color: #cfe1ff; box-shadow: inset 2px 0 #80b1ff; }
.nav-glyph { display: inline-grid; width: 20px; place-items: center; color: #8ba5c6; font-size: 17px; }
.sidebar-bottom { padding: 15px 5px 2px; border-top: 1px solid var(--line-soft); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 5px 12px; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #203654; color: #b7d4ff; font-family: Georgia, serif; }
.user-chip strong { overflow: hidden; max-width: 150px; color: #dbe6f3; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.user-chip small { margin-top: 3px; color: var(--muted-2); font-size: 11px; }
.logout-button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #9cacbf; text-align: left; }
.logout-button:hover { border-color: var(--line); background: #121b2a; color: white; }
.logout-button span:first-child { font-size: 16px; transform: rotate(90deg); }
.main-content { width: min(calc(100% - 252px), 1600px); min-height: 100vh; margin-left: 252px; padding: 30px clamp(22px, 4vw, 58px) 28px; }
.page-topbar { display: flex; min-height: 62px; align-items: center; justify-content: space-between; gap: 22px; margin-bottom: 24px; }
.heading-wrap { display: flex; align-items: center; gap: 14px; }
.eyebrow { margin: 0 0 7px; color: #7f9abb; font-size: 9px; font-weight: 750; letter-spacing: .17em; }
.topbar-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.live-dot, .system-point { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px #70d4ab7a; }
.topbar-divider { width: 1px; height: 13px; margin: 0 2px; background: var(--line); }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--text); }
.menu-toggle { display: none; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 20; border: 0; border-radius: 0; background: #0009; }

.filter-bar, .form-toolbar { display: flex; min-height: 62px; flex-wrap: wrap; align-items: center; gap: 9px; margin: 0 0 22px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 13px; background: #0e1725; box-shadow: 0 10px 30px #03081230; }
.filter-title { display: flex; align-items: center; gap: 8px; margin: 0 9px 0 3px; color: #d2deee; font-size: 12px; font-weight: 650; }
.filter-icon { color: var(--cyan); font-size: 19px; transform: rotate(-30deg); }
input, select, textarea { min-height: 38px; padding: 8px 10px; border: 1px solid #2b3b53; border-radius: 9px; background: #111e30; color: var(--text); }
input:hover, select:hover, textarea:hover { border-color: #435c7b; }
input::placeholder, textarea::placeholder { color: #6f8198; }
input[type="date"] { min-width: 142px; color-scheme: dark; }
.revision-input { width: 146px; }
.date-separator { color: #75869d; }
.primary-button, .secondary-button, .danger-button, .small-button { display: inline-flex; min-height: 38px; align-items: center; justify-content: center; gap: 7px; padding: 8px 13px; border: 1px solid #4e7dc1; border-radius: 9px; background: linear-gradient(180deg, #3973bd, #2b5a9b); color: white; font-size: 12px; font-weight: 650; transition: filter .15s, transform .15s; }
.primary-button:hover, .secondary-button:hover, .danger-button:hover, .small-button:hover { filter: brightness(1.13); }
.primary-button:active, .secondary-button:active, .danger-button:active, .small-button:active { transform: translateY(1px); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled, .small-button:disabled { cursor: wait; opacity: .58; }
.secondary-button { border-color: #304867; background: #18263a; color: #c7d7eb; }
.danger-button { border-color: #783c4b; background: #482534; color: #ffccd1; }
.small-button { min-height: 31px; padding: 6px 10px; font-size: 11px; }
.inline-error, .inline-success, .message { min-height: 1.25em; margin: -10px 0 18px; color: var(--red); font-size: 12px; }
.inline-success { color: var(--green); }
.dashboard-view { display: block; animation: enter .2s ease-out; }
.dashboard-view[hidden] { display: none; }
@keyframes enter { from { opacity: .72; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
.intro-row { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 2px 0 18px; }
.intro-row .eyebrow { margin-bottom: 6px; }
.section-subtitle { margin: 7px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.period-chip, .status-pill { display: inline-flex; min-height: 27px; align-items: center; padding: 5px 10px; border: 1px solid #273b57; border-radius: 999px; background: #111d2d; color: #aabbd0; font-size: 11px; white-space: nowrap; }
.status-pill { gap: 7px; }
.status-pill::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-healthy { border-color: #285b4e; background: #10291f; color: var(--green); }
.status-warning { border-color: #5c4b2d; background: #292216; color: var(--amber); }
.status-unknown { color: #8fa0b5; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi-card { min-width: 0; padding: 16px 17px 15px; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(150deg, #131e2e, #101827); box-shadow: 0 10px 28px #03081220; }
.kpi-highlight { border-color: #2d5077; background: linear-gradient(150deg, #172b42, #111c2d); }
.kpi-label { display: flex; min-height: 25px; align-items: center; gap: 8px; color: #acbbce; font-size: 12px; font-weight: 600; line-height: 1.4; }
.kpi-icon { color: #87b7f7; font-size: 14px; }
.kpi-value { margin: 10px 0 3px; overflow-wrap: anywhere; color: #f3f7fc; font-size: clamp(23px, 2.4vw, 32px); font-weight: 720; letter-spacing: -.04em; line-height: 1.1; }
.kpi-foot { margin: 8px 0 0; color: #91a2b9; font-size: 11px; line-height: 1.45; }
.compact-kpis { margin-bottom: 14px; }
.compact-kpis .kpi-value { font-size: 25px; }
.overview-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin-top: 14px; }
.surface { min-width: 0; margin-top: 13px; padding: 17px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(150deg, #111b2a, #0f1724); box-shadow: 0 12px 32px #0308121c; }
.overview-lower .surface { margin-top: 0; }
.surface-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.surface-heading .eyebrow { margin-bottom: 5px; }
.surface-icon { display: grid; width: 26px; height: 26px; place-items: center; border: 1px solid #314767; border-radius: 50%; color: var(--cyan); font-size: 12px; }
.body-copy { max-width: 620px; margin: 13px 0 15px; color: #aab8ca; font-size: 13px; line-height: 1.65; }
.text-link { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 650; }
.system-summary { display: grid; gap: 10px; margin: 14px 0; }
.system-summary > div { display: grid; grid-template-columns: 8px minmax(90px, 1fr) auto; align-items: center; gap: 8px; color: #a5b3c6; font-size: 12px; }
.system-summary strong { color: #dbe5f1; font-size: 12px; font-weight: 600; }
.system-summary strong.state-bad { color: var(--red); }
.source-note { display: flex; gap: 9px; margin: 14px 0 0; padding: 11px 13px; border: 1px solid #24354b; border-radius: 10px; background: #0d1725; color: #9aabc0; font-size: 11px; line-height: 1.55; }
.source-note > span:first-child { color: var(--cyan); font-size: 13px; }
.result-meta { margin: 0 0 12px; color: #9aabc0; font-size: 11px; line-height: 1.5; }
.help-hint { color: #9aabc0; font-size: 11px; cursor: help; white-space: nowrap; }
.table-title { margin: 20px 0 7px; color: #b6c6da; font-size: 13px; }
.stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 8px; }
.stats-card { min-width: 0; padding: 11px 12px; border: 1px solid #23344b; border-radius: 10px; background: #0c1522; }
.stats-card h4 { margin: 0 0 8px; color: #a8b9ce; font-size: 11px; line-height: 1.45; }
.stats-card .stats-value { margin: 0; overflow-wrap: anywhere; color: #e7eff9; font-size: 18px; font-weight: 700; letter-spacing: -.025em; }
.stats-card .detail { margin-top: 6px; color: #9aaac0; font-size: 10px; line-height: 1.45; }
.table-wrap { width: 100%; margin-top: 9px; overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 10px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table-wrap th, .table-wrap td { padding: 9px 10px; border-bottom: 1px solid #1c2a3c; text-align: left; vertical-align: top; }
.table-wrap th { color: #aabbd0; font-size: 10px; font-weight: 700; letter-spacing: .025em; white-space: nowrap; }
.table-wrap td { color: #c3cfdd; overflow-wrap: anywhere; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: #142033; }
.chart { overflow-x: auto; }
.chart svg { display: block; width: 100%; min-width: 500px; height: auto; }
.chart-bar { fill: #69a4f2; }
.chart-value, .chart-day { fill: #aebfd4; font: 11px system-ui, sans-serif; }
.chart-day { font-size: 10px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.two-column > div { min-width: 0; }
.bot-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 2px 0 10px; }
.bot-toolbar label { color: #a7b8cc; font-size: 11px; }
.bot-toolbar select { min-width: 105px; }
.bot-toolbar .muted { margin-left: auto; }
.telemetry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.telemetry-card { margin: 0; padding: 15px; }
.telemetry-value { margin: 9px 0 6px; color: #e4edfa; font-size: 19px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.detail, .muted { color: #9aabc0; font-size: 11px; line-height: 1.55; }
.app-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 35px; padding-top: 14px; border-top: 1px solid #172438; color: #8194ac; font-size: 10px; }

.account-panel { display: grid; gap: 13px; max-width: 960px; }
.account-panel form, .form-panel { display: grid; gap: 11px; padding: 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.account-panel form h2, .form-panel h2 { margin: 0; font-size: 15px; }
.account-panel label, .form-panel label { display: grid; gap: 6px; color: #a9b8ca; font-size: 11px; }
.account-panel input, .account-panel select, .form-panel input, .form-panel textarea { width: 100%; }
.account-actions { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0c1522; }
.account-actions label { display: grid; gap: 6px; color: #a9b8ca; font-size: 11px; }
.account-actions button { justify-self: start; }
.account-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.account-list li { display: grid; grid-template-columns: minmax(180px, 1fr) 130px auto; align-items: center; gap: 9px; padding: 11px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0c1522; }
.account-list select { width: 100%; }

.login-page { display: grid; min-height: 100vh; place-items: center; padding: 22px; background: radial-gradient(ellipse at 50% 0%, #183252 0%, #0b1220 48%, #080d17 100%); }
.login-card { width: min(100%, 410px); padding: 26px; border: 1px solid #2a3d58; border-radius: 17px; background: #0f1928ed; box-shadow: 0 24px 80px #0006; }
.login-card h1 { font-size: 23px; }
.login-card form { display: grid; gap: 11px; margin-top: 20px; }
.login-card label { display: grid; gap: 6px; color: #acbcd0; font-size: 11px; }
.login-card input { width: 100%; }
#login-error { min-height: 1.2em; margin: 0; color: var(--red); }
#factor-step { display: grid; gap: 10px; margin-top: 18px; }
#factor-step[hidden] { display: none !important; }
#totp-qr { width: 200px; height: 200px; padding: 8px; border-radius: 10px; background: white; }
#recovery-codes { padding: 13px; border: 1px solid #2c4260; border-radius: 10px; color: #d5e5fb; white-space: pre-wrap; overflow-wrap: anywhere; }
.account-shell { width: min(100%, 1050px); margin: 0 auto; padding: 28px 22px 55px; }
.account-shell .page-topbar { margin-bottom: 20px; }
.account-page-content { width: min(100%, 1020px); }
.team-page { width: min(100%, 1120px); }
.team-add-form { display: grid; gap: 8px; margin: 0 0 16px; padding: 15px; border: 1px solid #2b4260; border-radius: 13px; background: linear-gradient(140deg, #14233a, #101a29); }
.team-add-form label { color: #c7d7e9; font-size: 12px; font-weight: 650; }
.team-add-controls { display: flex; align-items: center; gap: 9px; }
.team-add-controls textarea { min-width: 0; min-height: 74px; max-height: 180px; flex: 1; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; }
.team-add-controls .primary-button { align-self: center; }
.team-add-form .detail { margin: 0; }
.team-list-surface { margin-top: 10px; }
.team-member-list { display: grid; gap: 7px; }
.team-member-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 10px; background: #0c1522; }
.team-member-identity { display: grid; min-width: 0; gap: 3px; }
.team-member-id { color: #e1ebf8; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.team-description-button { justify-self: start; max-width: 100%; overflow: hidden; padding: 2px 0; border: 0; background: transparent; color: #b2c9e5; text-align: left; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.team-description-button:hover { color: #d3e5ff; text-decoration: underline; }
.description-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.description-editor input { width: min(100%, 300px); min-height: 32px; padding: 5px 8px; font-size: 11px; }
.description-editor .inline-error { flex-basis: 100%; margin: 0; }
.text-button { min-height: 32px; padding: 5px 8px; border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.history-surface { margin-top: 13px; }
.history-surface summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style-position: inside; color: #d1deed; }
.history-surface summary span:first-child { display: inline-grid; gap: 4px; }
.history-surface summary small { color: #9aabc0; font-size: 11px; font-weight: 400; }
.notice { margin: 12px 0; padding: 11px 13px; border: 1px solid #315d4c; border-radius: 10px; background: #10271f; color: #b4e6ca; font-size: 12px; line-height: 1.5; }
.notice[hidden] { display: none; }
.confirm-dialog { width: min(92vw, 530px); max-height: 82vh; overflow: auto; padding: 20px; border: 1px solid #385171; border-radius: 15px; background: #101a2a; color: var(--text); box-shadow: 0 25px 80px #0009; }
.confirm-dialog::backdrop { background: #030812b8; backdrop-filter: blur(4px); }
.confirm-dialog p { color: #9fb0c5; font-size: 12px; line-height: 1.55; }
.roster-preview-list { display: grid; max-height: 230px; gap: 4px; overflow: auto; padding-left: 22px; color: #c4d3e4; font-family: ui-monospace, monospace; font-size: 11px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 18px; }

@media (max-width: 1100px) {
  .sidebar { width: 224px; }
  .main-content { width: calc(100% - 224px); margin-left: 224px; padding-right: 26px; padding-left: 26px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .sidebar { width: 260px; transform: translateX(-105%); transition: transform .2s ease; box-shadow: 16px 0 40px #0005; }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop:not([hidden]) { display: block; }
  .main-content { width: 100%; margin-left: 0; padding: 22px clamp(15px, 4vw, 30px) 25px; }
  .menu-toggle { display: grid; }
  .topbar-status { font-size: 9px; }
  .overview-lower { grid-template-columns: 1fr; }
  .telemetry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .main-content { padding: 17px 12px 22px; }
  .page-topbar { align-items: start; margin-bottom: 16px; }
  .topbar-status { align-items: end; flex-direction: column; gap: 4px; padding-top: 4px; text-align: right; white-space: normal; }
  .topbar-divider { display: none; }
  h1 { font-size: 24px; }
  .filter-bar { align-items: stretch; gap: 7px; padding: 9px; }
  .filter-title { width: 100%; margin: 0 2px 2px; }
  .filter-bar input[type="date"] { min-width: 0; width: calc(50% - 10px); flex: 1; }
  .filter-bar select { width: 100%; }
  .revision-input { width: calc(50% - 5px); flex: 1; }
  .filter-bar .primary-button { width: 100%; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi-card { padding: 12px; }
  .kpi-label { font-size: 11px; }
  .kpi-value { margin-top: 8px; font-size: 22px; }
  .kpi-foot { font-size: 10px; }
  .surface { padding: 13px 12px; border-radius: 12px; }
  .surface-heading { align-items: start; }
  .surface-heading h3 { font-size: 14px; }
  .stats-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-card { padding: 9px; }
  .stats-card h4 { font-size: 10px; }
  .stats-card .stats-value { font-size: 15px; }
  .stats-card .detail { font-size: 10px; }
  .two-column { grid-template-columns: 1fr; gap: 6px; }
  .telemetry-grid { grid-template-columns: 1fr; }
  .bot-toolbar { align-items: stretch; }
  .bot-toolbar label { width: 100%; }
  .bot-toolbar select, .bot-toolbar button { flex: 1; }
  .bot-toolbar .muted { width: 100%; margin-left: 0; }
  .team-add-controls { align-items: stretch; flex-direction: column; }
  .team-add-controls textarea { width: 100%; min-height: 86px; flex: none; }
  .team-add-controls .primary-button { align-self: stretch; }
  .team-member-row { align-items: stretch; flex-direction: column; }
  .team-member-row > button { align-self: end; }
  .description-editor input { width: 100%; }
  .account-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .account-list li select { grid-column: 1; }
  .account-list li button { grid-column: 2; grid-row: 2; }
  .account-shell { padding: 17px 12px 40px; }
  .app-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
