:root {
  --canvas: #f5f7f8; --surface: #ffffff; --line: #e1e7ec; --line-strong: #cbd5dd;
  --text: #14233a; --muted: #5b6b7e; --navy: #0f2745; --teal: #0b8a8f; --teal-strong: #086a6e; --teal-soft: #e3f4f4;
  --ok: #1b7a4b; --ok-bg: #e5f5ec; --warn: #8a5a00; --warn-bg: #fdf1d6; --bad: #a32424; --bad-bg: #fbe7e7;
  --neutral: #4a5a6d; --neutral-bg: #eaeef2;
  --radius: 10px; --shadow: 0 1px 2px rgba(15, 39, 69, .06);
  --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --sidebar: 252px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--canvas); color: var(--text); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
a { color: var(--teal-strong); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #2fc4c9; outline-offset: 2px; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--navy); color: #fff; padding: 8px 14px; z-index: 100; border-radius: 0 0 8px 0; }
.skip-link:focus { left: 0; }
h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 1.2rem 0 .4rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: block; padding: 2px 8px; }
.brand img { height: 34px; width: auto; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--canvas); }
.nav a[aria-current="page"] { background: var(--teal-soft); color: var(--teal-strong); font-weight: 600; box-shadow: inset 3px 0 0 var(--teal); }
.sidebar-foot { margin-top: auto; font-size: .78rem; color: var(--muted); padding: 0 8px; }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar .spacer { flex: 1; }
.menu-button { display: none; }
.user-chip { font-size: .9rem; color: var(--muted); }
main { padding: 26px 28px 56px; max-width: 1280px; width: 100%; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; min-height: 38px; }
.btn:hover { background: var(--canvas); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-strong); }
.btn-danger { color: var(--bad); border-color: #e3b4b4; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-small { padding: 4px 10px; min-height: 30px; font-size: .85rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.panel > header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel > header h2 { margin: 0; }
.panel-body { padding: 16px 18px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 9px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .unit { color: var(--muted); padding-left: 4px; }
.empty { padding: 28px 18px; color: var(--muted); text-align: center; }

.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--neutral-bg); color: var(--neutral); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-online { background: var(--ok-bg); color: var(--ok); }
.chip-offline { background: var(--bad-bg); color: var(--bad); }
.chip-unknown, .chip-not-configured, .chip-inactive { background: var(--neutral-bg); color: var(--neutral); }
.chip-planned { background: var(--warn-bg); color: var(--warn); }

.summary { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 14px 18px; align-items: center; }
.summary dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; }
.summary div { min-width: 120px; }
.selector { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], textarea {
  font: inherit; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--text); min-height: 38px; max-width: 100%; }
textarea { width: 100%; min-height: 80px; }
label { font-weight: 600; font-size: .9rem; }
.field { margin-bottom: 14px; display: grid; gap: 4px; max-width: 520px; }
.field .help, .help { color: var(--muted); font-size: .82rem; font-weight: 400; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--bad); font-size: .85rem; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--surface); }
.alert-success { background: var(--ok-bg); border-color: #b7e0c8; color: var(--ok); }
.alert-error { background: var(--bad-bg); border-color: #e9bcbc; color: var(--bad); }
.alert-info { background: var(--teal-soft); border-color: #b9e0e0; }

.status-pair { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.status-pair .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 6px; }
.chart { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; }
.chart-dot { fill: var(--surface); stroke: var(--teal); stroke-width: 1.6; }
.chart-axis { stroke: var(--line-strong); stroke-width: 1; }
.chart-text { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.group-title { padding: 8px 18px; background: #fafbfc; border-bottom: 1px solid var(--line); font-size: .8rem; font-weight: 600; color: var(--navy); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.inline-form { display: inline; }
.access-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.scrim { display: none; }

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: 0 8px 28px rgba(15, 39, 69, .08); }
.auth-card .brand { padding: 0 0 18px; }
.auth-card .brand img { height: 38px; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .menu-button { display: inline-flex; }
  .sidebar { position: fixed; z-index: 50; inset: 0 auto 0 0; width: min(84vw, 300px); transform: translateX(-102%); transition: transform .18s ease; box-shadow: 8px 0 30px rgba(15, 39, 69, .2); }
  .sidebar { visibility: hidden; }
  .drawer-open .sidebar { transform: none; visibility: visible; }
  .drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(15, 39, 69, .4); }
  .topbar { padding: 10px 16px; }
  main { padding: 18px 16px 48px; }
  .table th, .table td { padding: 9px 12px; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
