@font-face { font-family: Inter; font-style: normal; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-400.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-500.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-600.woff2") format("woff2"); }
@font-face { font-family: Inter; font-style: normal; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-700.woff2") format("woff2"); }
:root, html[data-theme="dark"] {
  --ink: #e8eef6;
  --muted: #93a0b3;
  --line: #2a3342;
  --bg: #0e1218;
  --card: #171d27;
  --side: #12171f;
  --accent: #3dd68c;
  --accent-strong: #8cf0bf;
  --accent-soft: rgba(61, 214, 140, 0.14);
  --green: #3dd68c;
  --green-soft: rgba(61, 214, 140, 0.14);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, 0.14);
  --amber: #f5c16c;
  --amber-soft: rgba(245, 193, 108, 0.14);
  --info: #7eb6ff;
  --info-soft: rgba(126, 182, 255, 0.14);
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  --radius: 16px;
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
html[data-theme="light"] {
  --ink: #1c2430;
  --muted: #667085;
  --line: #e6eaf0;
  --bg: #f4f6f8;
  --card: #ffffff;
  --side: #ffffff;
  --accent: #128a4e;
  --accent-strong: #0c6b3c;
  --accent-soft: #e7f6ee;
  --green: #157347;
  --green-soft: #e7f6ee;
  --red: #b42318;
  --red-soft: #fdeceb;
  --amber: #9a6700;
  --amber-soft: #fff6de;
  --info: #175cd3;
  --info-soft: #e8f1ff;
  --shadow: 0 1px 2px rgba(22, 32, 51, 0.04), 0 10px 28px rgba(22, 32, 51, 0.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 16px;
}
a { color: var(--accent); }
h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; line-height: 1.25; }
h1 { font-size: 1.85rem; margin: 0 0 0.35rem; }
h2 { font-size: 1.15rem; margin: 0 0 0.55rem; }
h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
p { margin: 0.35rem 0; }

.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.shell.solo { grid-template-columns: minmax(0, 1fr); }
.side {
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 1.25rem 0.9rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; gap: 0.7rem; align-items: center; margin: 0 0.45rem 1rem; }
.mark {
  width: 2.3rem; height: 2.3rem; border-radius: 12px;
  background: var(--accent); color: white;
  display: grid; place-items: center; font-weight: 700;
}
.brand-text { display: grid; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { font-weight: 500; color: var(--muted); letter-spacing: 0; }
.nav { display: grid; gap: 0.2rem; }
.side a, .side button.linkish {
  color: var(--ink);
  text-decoration: none;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.side a.active { background: var(--accent); color: #06210f; }
.side a:hover, .side button.linkish:hover { background: var(--accent-soft); color: var(--accent-strong); }
.side .grow { flex: 1; }
.side form { margin: 0; }
.side button.linkish {
  background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; font: inherit;
}
.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.85rem 1.4rem;
  position: sticky;
  top: 0;
  z-index: 4;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 0.95rem; font-weight: 650; }
.burger {
  display: none;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.main { padding: 1.6rem 1.6rem 3rem; max-width: 1120px; width: 100%; min-width: 0; }
.langs { margin-left: auto; display: flex; gap: 0.25rem; background: var(--bg); border-radius: 999px; padding: 0.2rem; }
.langs a { color: var(--muted); text-decoration: none; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.85rem; }
.langs a.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(22, 32, 51, 0.08); }

.card, .narrow, form.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.narrow { max-width: 440px; margin: 8vh auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); gap: 0.8rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.05rem; box-shadow: var(--shadow); }
.kpi span { display: block; color: var(--muted); font-size: 0.82rem; }
.kpi strong { display: block; margin-top: 0.35rem; font-size: 1.45rem; letter-spacing: -0.03em; }
.fields { display: grid; gap: 0.85rem; }
label { display: grid; gap: 0.35rem; font-size: 0.92rem; font-weight: 600; }
label.inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.7rem;
  text-align: left;
  font-weight: 550;
}
input:not(.nav-toggle), select, textarea {
  font: inherit;
  font-weight: 450;
  color: var(--ink);
  background: var(--card);
  border: 1px solid #d5dbe3;
  border-radius: 12px;
  padding: 0.62rem 0.75rem;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input:not(.nav-toggle):focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}
input[type="checkbox"]:not(.nav-toggle),
input[type="radio"] {
  width: auto;
  max-width: none;
  height: 1.05rem;
  margin: 0.15rem 0 0;
  padding: 0;
  flex: none;
  accent-color: var(--accent);
  border: 0;
  background: transparent;
  box-shadow: none;
}
label.inline input[type="checkbox"]:not(.nav-toggle) {
  appearance: none;
  -webkit-appearance: none;
  width: 2.5rem;
  height: 1.4rem;
  margin: 0;
  border-radius: 999px;
  background: #d5dbe3;
  position: relative;
  cursor: pointer;
}
label.inline input[type="checkbox"]:not(.nav-toggle)::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(22, 32, 51, 0.2);
  transition: transform 0.15s ease;
}
label.inline input[type="checkbox"]:not(.nav-toggle):checked { background: var(--accent); }
label.inline input[type="checkbox"]:not(.nav-toggle):checked::after { transform: translateX(1.05rem); }
input.nav-toggle {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
  pointer-events: none;
}
input[type="file"] { padding: 0.35rem 0; border: 0; background: transparent; }
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 14px;
}
legend { padding: 0 0.3rem; }
code { overflow-wrap: anywhere; }
textarea { min-height: 5.5rem; resize: vertical; }
button, .button {
  background: var(--accent);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 0.65rem 1.05rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: background 0.15s ease, transform 0.15s ease;
}
button:hover, .button:hover { background: var(--accent-strong); }
button.secondary, a.secondary { background: var(--card); color: var(--ink); border: 1px solid #d5dbe3; }
button.secondary:hover, a.secondary:hover { background: var(--bg); }
button.danger { background: var(--red); }
button.danger:hover { background: #912018; }
.actions { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; }
.flash { background: var(--amber-soft); border: 1px solid #f0e0b0; padding: 0.75rem 0.95rem; border-radius: 14px; margin-bottom: 1rem; }
.flash.bad, .error { background: var(--red-soft); border: 1px solid #f3c7c3; border-radius: 14px; padding: 0.7rem 0.9rem; }
.muted { color: var(--muted); font-weight: 450; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 650;
  background: #eef1f5;
  color: #3d4756;
}
.badge.online { background: var(--green-soft); color: var(--green); }
.badge.offline { background: var(--red-soft); color: var(--red); }
.badge.unknown { background: #eef1f5; color: #5c6778; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: transparent; }
th, td { text-align: left; padding: 0.7rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 0.92rem; }
th { color: var(--muted); font-size: 0.78rem; font-weight: 650; letter-spacing: 0.02em; }
tr.row-bad td { background: var(--red-soft); }
pre.conf {
  white-space: pre-wrap;
  word-break: break-word;
  background: #161b22;
  color: #e8eef7;
  padding: 1rem;
  border-radius: 14px;
  overflow: auto;
  font-size: 0.82rem;
}
.qr { background: white; padding: 0.7rem; border-radius: 16px; border: 1px solid var(--line); width: min(320px, 100%); height: auto; display: block; }
.qr-card { display: grid; justify-items: start; gap: 0.8rem; }
.warning { background: var(--amber-soft); border-left: 4px solid var(--amber); padding: 0.75rem 0.95rem; border-radius: 12px; }
.split { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 1rem; }
.section { margin-top: 1.25rem; }
.page-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1rem; }
.impersonation {
  background: var(--accent-soft);
  color: var(--ink);
  padding: 0.7rem 0.9rem;
  border-radius: 14px;
  margin-bottom: 0.9rem;
  display: flex;
  gap: 0.8rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}
.impersonation form { margin: 0; }
ol.steps { padding-left: 1.2rem; }
ol.steps li { margin: 0.4rem 0; }
.icon { width: 1.15rem; height: 1.15rem; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.chart { color: var(--accent); margin: 0.2rem 0 0.8rem; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { fill: var(--muted); font-size: 16px; font-family: inherit; }
.device-card, .empty {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.device-card { display: flex; flex-direction: column; gap: 0.25rem; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.device-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(22, 32, 51, 0.08); }
.device-top { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; }
.platform {
  width: 2.6rem; height: 2.6rem; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.platform .icon { width: 1.3rem; height: 1.3rem; }
.empty { text-align: left; padding: 2rem 1.4rem; border-style: dashed; }
.rank { display: flex; justify-content: space-between; gap: 0.8rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.rank:last-child { border-bottom: 0; }
.health { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: 0.7rem; }
.health div { background: var(--bg); border-radius: 14px; padding: 0.75rem 0.85rem; }
.health span { display: block; color: var(--muted); font-size: 0.78rem; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .burger { display: inline-flex; }
  .side { display: none; position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-toggle:checked ~ .shell .side { display: flex; }
  .split, .two { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 1rem 0.85rem 2.4rem; }
  .topbar { padding: 0.7rem 0.85rem; }
  table { min-width: 36rem; }
  .device-actions .button, .device-actions button { width: 100%; }
}
@media (max-width: 380px) {
  h1 { font-size: 1.45rem; }
  .langs a { padding: 0.25rem 0.45rem; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eef2f7;
    --muted: #a8b0bd;
    --line: #2a3140;
    --bg: #10141b;
    --card: #181d27;
    --accent: #8aa2ff;
    --accent-strong: #b3c2ff;
    --accent-soft: #243056;
    --green: #8ee0b2;
    --green-soft: #163526;
    --red: #ffb4ab;
    --red-soft: #3b201e;
    --amber: #f5d48a;
    --amber-soft: #3a3018;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
  input:not(.nav-toggle), select, textarea { border-color: #3a4354; }
  button.secondary, a.secondary { background: transparent; color: var(--ink); border-color: #3a4354; }
  pre.conf { background: #0c0f14; }
  .qr { background: white; }
  label.inline input[type="checkbox"]:not(.nav-toggle) { background: #3a4354; }
  label.inline input[type="checkbox"]:not(.nav-toggle):checked { background: var(--accent); }
  .langs { background: #10141b; }
  .langs a.on { background: #243044; }
}

.gauges { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 0.8rem; margin: 0.6rem 0 1rem; }
.gauge { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 9.5rem; display: grid; place-items: center; }
.gauge svg { width: 8.5rem; height: 8.5rem; transform: rotate(-90deg); }
.gauge .track { fill: none; stroke: var(--line); stroke-width: 10; }
.gauge .value { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; }
.gauge div { position: absolute; text-align: center; }
.gauge strong { display: block; font-size: 1.35rem; }
.gauge span, .gauge small { display: block; color: var(--muted); font-size: 0.78rem; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.4rem 0 0.8rem; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; color: var(--muted); text-decoration: none; background: var(--card); }
.chip.on { background: var(--accent); color: #06210f; border-color: transparent; }
.callout { border-radius: 12px; padding: 0.75rem 0.9rem; margin: 0.6rem 0; border: 1px solid transparent; }
.callout.danger { background: var(--red-soft); color: var(--red); }
.callout.warning { background: var(--amber-soft); color: var(--amber); }
.callout.info { background: var(--info-soft); color: var(--info); }
.tip { display: inline-grid; place-items: center; width: 1.1rem; height: 1.1rem; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; cursor: help; }
button.danger { background: var(--red); color: white; border: 0; border-radius: 12px; padding: 0.55rem 0.9rem; cursor: pointer; }
.badge.online { background: var(--green-soft); color: var(--green); }
.badge.offline, .badge.unknown { background: var(--amber-soft); color: var(--amber); }
@media (max-width: 390px) {
  .gauges, .kpis { grid-template-columns: 1fr 1fr; }
  .main { padding-left: 0.7rem; padding-right: 0.7rem; }
}
