/* Atoms Guest WiFi — console styles.
   Layout borrowed from MSP partner portals: a dark grouped sidebar and a top bar
   with global search, a light content area with KPI rings and dense tables.
   Light theme by default; data-theme="dark" switches the content area. */
:root {
  --sb-bg: #0b1220; --sb-bg-2: #121b2e; --sb-line: #1f2a44; --sb-text: #c9d3e6; --sb-muted: #7f8cab; --sb-active: #2f7bff;
  --bg: #f2f4f8; --panel: #ffffff; --panel-2: #f6f8fb; --line: #e1e6ef;
  --text: #0b1220; --muted: #5b6577; --accent: #1f6bff; --accent-2: #3d82ff;
  --good: #1fa463; --warn: #e08a00; --bad: #d64545; --info: #2aa7c9;
  --radius: 10px; --shadow: 0 6px 20px rgba(11,18,32,.06);
  --top-h: 56px; --sb-w: 248px;
}
:root[data-theme="dark"] {
  --bg: #0f1627; --panel: #141d31; --panel-2: #1a2440; --line: #263252;
  --text: #e8edf7; --muted: #9aa6bd; --accent: #2f7bff; --accent-2: #5b9bff;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 600; } h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
code { background: var(--panel-2); padding: 1px 6px; border-radius: 5px; font-size: 12px; border: 1px solid var(--line); }

/* Shell: fixed dark sidebar + top bar */
.shell { display: grid; grid-template-columns: var(--sb-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--sb-bg); color: var(--sb-text); padding: 0 0 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; height: var(--top-h); border-bottom: 1px solid var(--sb-line); color: #fff; font-weight: 700; font-size: 15px; }
.brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--sb-active); box-shadow: 0 0 0 4px rgba(47,123,255,.22); }
.nav { padding: 10px 10px; }
.nav .group { font-size: 11px; color: var(--sb-muted); text-transform: uppercase; letter-spacing: .06em; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: var(--sb-text); font-weight: 500; }
.nav a:hover { background: var(--sb-bg-2); text-decoration: none; }
.nav a.active { background: var(--sb-bg-2); color: #fff; box-shadow: inset 3px 0 0 var(--sb-active); }
.nav a .ic { width: 16px; text-align: center; opacity: .8; font-size: 13px; }
.sidebar .spacer { flex: 1; }
.sidebar .foot { padding: 10px 18px 0; border-top: 1px solid var(--sb-line); font-size: 12px; color: var(--sb-muted); }
.sidebar .foot .row { margin-top: 8px; }
.sidebar .foot .btn { background: var(--sb-bg-2); border-color: var(--sb-line); color: var(--sb-text); }

.content { min-width: 0; }
.topbar { height: var(--top-h); background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input { width: 100%; padding: 8px 12px 8px 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); }
.topbar .search .glass { position: absolute; left: 11px; top: 8px; color: var(--muted); }
.topbar .results { position: absolute; top: 40px; left: 0; right: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); z-index: 30; max-height: 320px; overflow: auto; }
.topbar .results a { display: flex; justify-content: space-between; padding: 8px 12px; color: var(--text); border-bottom: 1px solid var(--line); }
.topbar .results a:hover { background: var(--panel-2); text-decoration: none; }
.topbar .results a:last-child { border-bottom: 0; }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.main { padding: 22px 24px 60px; max-width: 1280px; }
.crumbs { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.crumbs a { color: var(--muted); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav .group { width: 100%; padding-top: 8px; }
  .main { padding: 16px 14px 60px; }
  .topbar { padding: 0 14px; }
}

/* Cards, KPI row, rings */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.card.tight { padding: 10px 14px; }
.card .card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; }
.kpi .t { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; grid-column: 1 / -1; }
.kpi .legend { font-size: 12px; display: grid; gap: 4px; }
.kpi .legend span { display: flex; justify-content: space-between; gap: 8px; }
.kpi .legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.ring { width: 84px; height: 84px; }
.ring text { font-weight: 700; fill: var(--text); font-size: 18px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .n { font-size: 24px; font-weight: 700; } .stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.right { margin-left: auto; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel-2); }
td.wrap { white-space: normal; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input[type=text] { max-width: 280px; }

/* Forms and buttons */
label.field { display: block; margin: 10px 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], input[type=color], select, textarea {
  width: 100%; padding: 8px 10px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text);
}
input[type=color] { padding: 3px; height: 36px; }
textarea { min-height: 64px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.check { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--bad); border-color: rgba(214,69,69,.4); }
.btn.sm { padding: 5px 9px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.good { color: var(--good); border-color: rgba(31,164,99,.4); background: rgba(31,164,99,.08); }
.badge.warn { color: var(--warn); border-color: rgba(224,138,0,.4); background: rgba(224,138,0,.08); }
.badge.bad { color: var(--bad); border-color: rgba(214,69,69,.4); background: rgba(214,69,69,.08); }
.badge.info { color: var(--info); border-color: rgba(42,167,201,.4); background: rgba(42,167,201,.08); }
.badge.accent { color: var(--accent); border-color: rgba(47,123,255,.4); background: rgba(47,123,255,.08); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 13px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; font-size: 13px; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }
.notice { padding: 9px 12px; border-radius: 7px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 12px; font-size: 13px; }
.notice.bad { border-color: rgba(214,69,69,.5); color: var(--bad); }
.notice.good { border-color: rgba(31,164,99,.5); color: var(--good); }
.notice.warn { border-color: rgba(224,138,0,.5); }
.banner { background: linear-gradient(90deg, var(--accent), #1a4fc0); color: #fff; padding: 10px 16px; border-radius: 8px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; font-size: 13px; }
.banner a { color: #fff; text-decoration: underline; }
.center { max-width: 420px; margin: 8vh auto; }
.center .card { padding: 28px; box-shadow: var(--shadow); }
.center .brand { color: var(--text); padding: 0 0 16px; height: auto; border: 0; }
.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; border: 1px solid var(--line); }
.qr img { display: block; width: 180px; height: 180px; }
.toast { position: fixed; right: 20px; bottom: 20px; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow); max-width: 360px; z-index: 50; font-size: 13px; }
.toast.bad { border-left-color: var(--bad); }

/* Kebab menus */
.kebab { position: relative; display: inline-block; }
.kebab > button { border: 1px solid transparent; background: transparent; cursor: pointer; padding: 2px 8px; border-radius: 6px; font-size: 18px; line-height: 1; color: var(--muted); }
.kebab > button:hover { background: var(--panel-2); border-color: var(--line); }
.kebab .menu { position: absolute; right: 0; top: 26px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 160px; z-index: 25; display: none; }
.kebab.open .menu { display: block; }
.kebab .menu a, .kebab .menu button { display: block; width: 100%; text-align: left; padding: 8px 12px; background: none; border: 0; color: var(--text); cursor: pointer; font-size: 13px; }
.kebab .menu a:hover, .kebab .menu button:hover { background: var(--panel-2); text-decoration: none; }
.kebab .menu .danger { color: var(--bad); }

/* License card */
.license-hero { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: center; }
.license-hero .ring { width: 120px; height: 120px; }
.license-hero .ring text { font-size: 22px; }
.features { list-style: none; padding: 0; margin: 6px 0 0; display: grid; gap: 4px; font-size: 13px; }
.features li::before { content: "✓"; color: var(--good); margin-right: 8px; font-weight: 700; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* Typography upgrade (Inter via Google Fonts; falls back to system fonts) */
body { font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; letter-spacing: -.005em; }
h1 { letter-spacing: -.02em; }

/* Icons in nav and buttons */
.nav a .ic { width: 18px; height: 18px; display: inline-flex; opacity: .85; }
.nav a.active .ic { opacity: 1; color: var(--sb-active); }
.btn svg { width: 15px; height: 15px; }
.brand svg { flex: none; }

/* Loading bar during navigation */
.loading-bar { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #8fc0ff, var(--accent)); background-size: 200% 100%; animation: slide 1s linear infinite; z-index: 100; display: none; }
body.loading .loading-bar { display: block; }
@keyframes slide { to { background-position: -200% 0; } }

/* Charts */
.chart { width: 100%; }
.chart svg { display: block; }
.chart .pt circle { transition: r .12s; } .chart .pt:hover circle { r: 5.5; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-bottom: 6px; color: var(--muted); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.chart-legend strong { color: var(--text); margin-left: 4px; }
.chart-empty { padding: 28px 0; text-align: center; }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 1fr 48px; grid-template-areas: "label value" "track track"; gap: 4px 10px; align-items: center; font-size: 13px; }
.bar-label { grid-area: label; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { grid-area: track; }
.bar-value { grid-area: value; }
.bar-track { height: 10px; background: var(--panel-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; border-radius: 6px; }
.bar-value { text-align: right; font-weight: 600; }
.seg-legend { font-size: 12px; display: grid; gap: 4px; }
.seg-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* KPI tiles without rings */
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tile .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.tile .d { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tile .d.up { color: var(--good); } .tile .d.down { color: var(--bad); }

/* Empty states */
.empty { text-align: center; padding: 34px 20px; }
.empty .empty-ic { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--accent); }
.empty .empty-ic svg { width: 24px; height: 24px; }

/* Export center */
.export { display: grid; grid-template-columns: 1.4fr .9fr .9fr 1.2fr auto; gap: 10px; align-items: end; }
.export select, .export input { width: 100%; min-width: 0; }
@media (max-width: 1100px) { .export { grid-template-columns: 1fr 1fr 1fr; } }
@media (max-width: 760px) { .export { grid-template-columns: 1fr 1fr; } }
.export .btn { height: 38px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg a, .seg button { padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--panel); border: 0; cursor: pointer; }
.seg a.active, .seg button.active { background: var(--accent); color: #fff; }
.seg a:hover { text-decoration: none; }
tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--panel-2) 45%, transparent); }
th { position: sticky; top: 0; z-index: 1; }
