:root {
  color-scheme: light;
  --navy: #101f29;
  --navy-strong: #0b1720;
  --navy-line: #2a3b46;
  --teal: #0b7768;
  --teal-dark: #075c4f;
  --mint: #73e5c9;
  --bg: #eff4f4;
  --panel: #ffffff;
  --text: #152a33;
  --subtle: #52666d;
  --border: #dce6e5;
  --soft: #f1f6f5;
  --error: #962c38;
  --error-bg: #fff2f3;
  --warn: #7b530a;
  --warn-bg: #fff4db;
  --radius: 13px;
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #23a68e; outline-offset: 3px; }
.sr-only, .skip-link:not(:focus) { clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; position: absolute; white-space: nowrap; }
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 10; background: white; padding: 10px 15px; border-radius: 8px; color: var(--teal-dark); }

.brand { display: inline-flex; align-items: center; gap: 12px; color: #f2faf9; }
.brand-name { font-size: 1.4rem; font-weight: 730; letter-spacing: .055em; }
.brand-mark { position: relative; flex: 0 0 40px; display: block; width: 40px; height: 40px; border-radius: 11px; background: var(--mint); color: var(--navy-strong); }
.brand-mark::before { content: ""; position: absolute; width: 15px; height: 15px; left: 11px; top: 12px; transform: skew(-25deg); border-left: 4px solid currentColor; border-top: 4px solid currentColor; }
.brand-mark::after { content: ""; position: absolute; width: 12px; height: 4px; left: 16px; top: 23px; background: currentColor; transform: skew(-25deg); }

.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--subtle); }
.boot .brand-mark { flex: 0 0 40px; }
.boot strong { color: var(--text); letter-spacing: .055em; }
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(310px, 0.92fr) minmax(420px, 1.08fr); }
.login-brand { background: var(--navy); color: white; position: relative; display: flex; flex-direction: column; padding: clamp(36px, 6vw, 92px); min-height: 100%; overflow: hidden; }
.login-wordmark { position: relative; z-index: 1; margin: auto 0; padding: 84px 0 108px; max-width: 525px; }
.eyebrow { font-weight: 700; font-size: .74rem; letter-spacing: .14em; color: var(--mint); }
.login-wordmark h2 { margin: 13px 0 16px; font-size: clamp(2.7rem, 5vw, 4.8rem); font-weight: 680; line-height: 1.04; letter-spacing: -.06em; max-width: 490px; }
.login-wordmark p:last-child { color: #bfd2d8; max-width: 360px; }
.login-pattern { position: absolute; width: 460px; height: 270px; right: -70px; bottom: -70px; opacity: .28; transform: rotate(-18deg); background: repeating-linear-gradient(90deg, transparent 0 54px, #69d4bd 54px 55px), repeating-linear-gradient(0deg, transparent 0 54px, #69d4bd 54px 55px); mask-image: radial-gradient(ellipse at center, black 8%, transparent 68%); pointer-events: none; }
.login-body { display: grid; align-content: center; justify-items: center; padding: clamp(24px, 6vw, 112px); background: var(--panel); }
.login-form { width: min(100%, 420px); }
.login-form h1 { font-size: clamp(1.8rem, 3vw, 2.5rem); letter-spacing: -.04em; line-height: 1.15; }
.login-form > p:not(.form-error) { color: var(--subtle); margin: -3px 0 8px; }
.form { display: grid; gap: 16px; }
.form label { display: grid; gap: 7px; font-size: .92rem; font-weight: 620; }
.form input, .form select, .search input { min-width: 0; padding: 10px 12px; border: 1px solid #cbd8d8; background: var(--panel); color: var(--text); border-radius: 8px; }
.form input, .form select { width: 100%; }
.form select { appearance: auto; }
.form .label-note, .field-help { color: var(--subtle); font-size: .83rem; font-weight: 450; }
.form .field-help { margin-top: -10px; }
.form-error { color: var(--error); background: var(--error-bg); border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 17px; border: 1px solid transparent; border-radius: 8px; font-weight: 650; white-space: nowrap; }
.primary { background: var(--teal-dark); color: #ffffff; }
.primary:hover:not(:disabled) { background: #064a40; }
.secondary { background: var(--panel); color: var(--text); border-color: var(--border); }
.secondary:hover:not(:disabled) { background: var(--soft); }

.app { min-height: 100vh; display: grid; grid-template-columns: 238px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; min-height: 530px; align-self: start; display: flex; flex-direction: column; padding: 25px 18px 18px; gap: 28px; background: var(--navy); color: #dce9ec; }
.sidebar .brand { padding-inline: 6px; }
.tenant { display: grid; gap: 6px; padding-inline: 6px; }
.tenant label { color: #aabdc4; font-size: .78rem; }
.tenant select, .tenant-static { background: #192c37; color: #edf9f6; padding: 8px 10px; border: 1px solid #3c505a; border-radius: 8px; min-width: 0; min-height: 40px; font-size: .91rem; width: 100%; }
.tenant select { color-scheme: dark; }
.navigation { display: flex; flex-direction: column; gap: 4px; }
.navigation button { background: transparent; border: 0; border-radius: 8px; color: #c1d1d8; width: 100%; min-height: 45px; display: flex; gap: 12px; align-items: center; text-align: left; padding: 8px 12px; font-size: .93rem; font-weight: 560; }
.navigation button:hover { background: #1b3440; color: #ffffff; }
.navigation button[aria-current] { background: #1d3d42; color: var(--mint); font-weight: 670; }
.nav-icon { display: inline-flex; position: relative; flex: 0 0 17px; width: 17px; height: 17px; color: inherit; }
.nav-icon.tiles { display: block; background: linear-gradient(currentColor, currentColor) top left / 7px 7px, linear-gradient(currentColor, currentColor) top right / 7px 7px, linear-gradient(currentColor, currentColor) bottom left / 7px 7px, linear-gradient(currentColor, currentColor) bottom right / 7px 7px; background-repeat: no-repeat; border-radius: 2px; }
.nav-icon.devices::before, .nav-icon.devices::after { content: ""; position: absolute; left: 0; right: 0; height: 7px; border: 1.5px solid; border-radius: 3px; top: 1px; }
.nav-icon.devices::after { top: 10px; }
.nav-icon.layers::before, .nav-icon.layers::after { content: ""; position: absolute; width: 11px; height: 11px; transform: rotate(45deg); border: 1.5px solid; top: 0; left: 3px; border-radius: 2px; }
.nav-icon.layers::after { top: 4px; border-top-color: transparent; border-left-color: transparent; }
.nav-icon.users::before { content: ""; position: absolute; top: 0; left: 5px; width: 8px; height: 8px; border: 1.5px solid; border-radius: 50%; }
.nav-icon.users::after { content: ""; position: absolute; left: 1px; right: 0; bottom: 0; height: 8px; border: 1.5px solid; border-radius: 8px 8px 3px 3px; }
.nav-icon.exit::before { content: ""; position: absolute; inset: 0 6px 0 0; border: 1.5px solid; border-right: 0; border-radius: 3px 0 0 3px; }
.nav-icon.exit::after { content: "→"; position: absolute; top: -8px; left: 5px; font-size: 1.35rem; }
.sidebar-account { margin-top: auto; border-top: 1px solid var(--navy-line); padding: 16px 3px 0; display: grid; grid-template-columns: 34px minmax(0, 1fr) 36px; gap: 9px; align-items: center; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 9px; background: #26524e; color: #d3fff4; font-size: .8rem; font-weight: 700; }
.sidebar-account strong, .sidebar-account div > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account strong { font-size: .87rem; }
.sidebar-account div > span { color: #abc0c7; font-size: .73rem; }
.logout-button { width: 36px; height: 38px; display: grid; place-items: center; color: #c4d6dc; background: none; border: 0; border-radius: 8px; }
.logout-button:hover { color: #fff; background: #23434e; }

.main { min-width: 0; width: 100%; max-width: 1480px; margin-inline: auto; padding: 27px clamp(19px, 3.1vw, 49px) 42px; }
.topbar, .dashboard-head, .section-head, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.topbar { margin-bottom: 22px; border-bottom: 1px solid #d5e0e0; padding-bottom: 20px; }
.overline { color: var(--teal-dark); font-size: .7rem; font-weight: 760; letter-spacing: .12em; overflow-wrap: anywhere; text-transform: uppercase; }
.topbar h1 { font-size: clamp(1.6rem, 2.5vw, 2.22rem); line-height: 1.14; margin-top: 3px; letter-spacing: -.036em; }
.dashboard-head { align-items: flex-start; margin-bottom: 15px; }
.dashboard-head h2, .section-head h2 { font-size: 1.12rem; line-height: 1.3; font-weight: 700; letter-spacing: -.018em; }
.dashboard-head p, .section-head p { color: var(--subtle); font-size: .86rem; margin-top: 3px; }
.status { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border-radius: 99px; min-height: 28px; font-weight: 650; white-space: nowrap; font-size: .76rem; background: #edf1f1; color: #4f646a; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { color: #0a5f50; background: #def4ec; }
.status.warn { color: var(--warn); background: var(--warn-bg); }
.status.bad { color: var(--error); background: var(--error-bg); }
.stat-grid, .lower-grid { display: grid; gap: 15px; }
.stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.stat-card, .panel { border: 1px solid var(--border); background: var(--panel); border-radius: var(--radius); box-shadow: 0 2px 6px #17374306; }
.stat-card { min-width: 0; padding: clamp(12px, 1.55vw, 19px); display: grid; gap: 4px; min-height: 124px; align-content: center; }
.stat-card > span { color: var(--subtle); font-size: .88rem; font-weight: 620; }
.stat-card > strong { font-size: clamp(1.35rem, 2.3vw, 2.08rem); line-height: 1.15; font-variant-numeric: tabular-nums; letter-spacing: -.045em; overflow-wrap: anywhere; }
.stat-card > small { color: var(--subtle); font-size: .77rem; }
.panel { min-width: 0; }
.section-head { min-width: 0; padding: 16px 19px; border-bottom: 1px solid #ebf0ef; }
.traffic-card { margin-bottom: 16px; }
.traffic-card .section-head { border-bottom: 0; }
.segment { display: inline-flex; padding: 3px; gap: 2px; background: #edf4f3; border-radius: 9px; }
.segment button { border: 1px solid transparent; background: transparent; color: var(--subtle); border-radius: 7px; font-size: .77rem; min-height: 33px; padding: 4px 10px; font-weight: 620; }
.segment button[aria-pressed="true"] { border-color: #d6e4e2; background: var(--panel); color: var(--teal-dark); box-shadow: 0 1px 4px #21453710; }
.chart-area { position: relative; margin: 0 15px 11px; min-height: 214px; }
#traffic-chart { display: block; width: 100%; height: 222px; outline-offset: 1px; }
.chart-tooltip { position: absolute; z-index: 1; max-width: 190px; pointer-events: none; color: white; background: var(--navy); border: 1px solid #344954; border-radius: 7px; padding: 7px 9px; font-size: .75rem; white-space: nowrap; }
.empty { min-height: 106px; display: grid; justify-items: center; align-content: center; text-align: center; gap: 4px; padding: 18px; color: var(--subtle); }
.empty strong { color: var(--text); font-weight: 650; }
.empty p { font-size: .85rem; max-width: 360px; }
.chart-empty { min-height: 205px; border-radius: 9px; background: radial-gradient(ellipse, #e9f4f1 0, var(--panel) 73%); }
.empty-mark { display: block; height: 25px; width: 32px; color: #4b9b8c; margin-bottom: 6px; background: linear-gradient(currentColor, currentColor) left bottom / 6px 10px, linear-gradient(currentColor, currentColor) center bottom / 6px 18px, linear-gradient(currentColor, currentColor) right bottom / 6px 25px; background-repeat: no-repeat; border-radius: 3px; opacity: .65; }
.lower-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
.table-wrap { width: 100%; overflow-x: auto; }
.table-wrap:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; text-align: left; }
th { color: var(--subtle); font-size: .77rem; font-weight: 650; background: #f7f9f9; }
td, th { padding: 10px 14px; border-bottom: 1px solid #edf1f1; }
td:first-child, th:first-child { padding-left: 19px; }
td:last-child, th:last-child { padding-right: 19px; }
tbody tr:last-child td { border-bottom: 0; }
.numeric { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.address { white-space: nowrap; font: .81rem/1.5 ui-monospace, Consolas, monospace; }
.row-button { font-size: .83rem; white-space: nowrap; padding: 5px 11px; min-height: 36px; }
.alert-list { margin: 0; padding: 0; list-style: none; }
.alert-list li { padding: 11px 17px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; border-bottom: 1px solid #edf1f1; }
.alert-list li:last-child { border-bottom: none; }
.alert-time { display: block; color: var(--subtle); margin-top: 4px; font-size: .79rem; }
.alert-list strong { font-size: .88rem; font-weight: 620; overflow-wrap: anywhere; }
.alert-list .status { align-self: start; }
.search input { max-width: 220px; font-size: .86rem; min-height: 42px; }
.notice { margin: -7px 0 14px; background: #e1f5ed; color: #095b4d; border-radius: 8px; padding: 10px 13px; font-size: .88rem; }
.notice.bad { color: var(--error); background: var(--error-bg); }
.scope-empty { min-height: 210px; }
.dir-meta { display: block; color: var(--subtle); font-size: .75rem; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); width: min(480px, calc(100vw - 28px)); border-radius: 15px; box-shadow: 0 24px 72px #0a141b55; padding: 20px; }
.dialog::backdrop { background: #0a1722aa; }
.dialog-head { align-items: start; }
.dialog-head h2 { font-size: 1.3rem; letter-spacing: -.025em; }
.dialog-head p { color: var(--subtle); font-size: .85rem; margin-top: 3px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { background: var(--soft); color: var(--text); border-radius: 7px; border: 0; width: 44px; height: 44px; flex: 0 0 44px; font-size: 1.5rem; line-height: 1; }

@media (max-width: 1080px) {
  .app { grid-template-columns: 202px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .stat-grid { gap: 9px; }
  .lower-grid { grid-template-columns: 1fr; }
}
@media (max-width: 830px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { grid-template-columns: 0.86fr 1.14fr; }
  .login-brand { padding: 29px; }
  .login-wordmark h2 { font-size: clamp(2rem, 5vw, 3rem); }
}
@media (max-width: 660px) {
  .app, .login { display: block; }
  .login-brand { padding: 23px; }
  .login-wordmark { padding: 30px 0 12px; }
  .login-wordmark h2 { font-size: 2.3rem; max-width: 320px; }
  .login-wordmark p:last-child { display: none; }
  .login-body { padding: 25px 22px 42px; }
  .sidebar { position: static; height: auto; min-height: 0; padding: 15px 14px 9px; display: grid; grid-template-columns: minmax(130px, 1fr) 45px; gap: 12px 8px; }
  .sidebar .brand-mark { width: 35px; height: 35px; flex-basis: 35px; }
  .sidebar .brand-mark::before { left: 9px; top: 9px; }
  .sidebar .brand-mark::after { left: 14px; top: 20px; }
  .sidebar .brand-name { font-size: 1.2rem; }
  .tenant, .navigation { grid-column: 1 / -1; }
  .tenant { gap: 3px; }
  .navigation { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 1px; }
  .navigation button { justify-content: center; padding: 8px 4px; gap: 5px; font-size: .75rem; }
  .navigation .nav-icon { display: none; }
  .sidebar-account { grid-row: 1; grid-column: 2; display: block; margin: 0; padding: 0; border: 0; }
  .sidebar-account .avatar, .sidebar-account > div { display: none; }
  .logout-button { width: 44px; height: 40px; }
  .main { padding: 18px 13px 29px; }
  .topbar { padding-bottom: 13px; margin-bottom: 15px; }
  .stat-card { min-height: 102px; }
  .section-head { padding: 12px 13px; }
  .section-head h2, .dashboard-head h2 { font-size: 1rem; }
  .section-head p, .dashboard-head p { font-size: .78rem; }
  .segment button { padding-inline: 6px; }
  .chart-area { margin-inline: 6px; }
  .directory .section-head { flex-wrap: wrap; }
  .search, .search input { width: 100%; max-width: none; }
  .topbar .button { padding-inline: 8px; font-size: .82rem; }
}
@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color .14s ease, color .14s ease; }
}
.chart-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px; }
.range select { max-width: 100%; min-height: 36px; border: 1px solid var(--border); border-radius: 7px; padding: 5px 6px; color: var(--text); background: var(--panel); font-size: .77rem; }
.chart-tooltip { top: 4px; right: 9px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.directory-pages { display: flex; justify-content: flex-end; gap: 10px; padding: 11px 13px; border-top: 1px solid var(--border); }
@media (max-width: 480px) {
  .chart-controls { justify-content: flex-start; }
  .traffic-card .section-head { flex-wrap: wrap; }
}

.system-panel { margin-top: 16px; }
.system-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; margin: 0; padding: 14px 19px; }
.system-grid > div { min-width: 0; padding: 8px 10px; background: var(--soft); border-radius: 7px; }
.system-grid dt { color: var(--subtle); font-size: .78rem; }
.system-grid dd { margin: 2px 0 0; color: var(--text); font-size: .91rem; font-weight: 650; overflow-wrap: anywhere; }
@media (max-width: 880px) { .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
