/* WNS Console — admin dashboard design system.
   Modern light SaaS (Linear/Stripe-like). Hand-written, no framework, no CDN. */

:root {
  --bg: #F6F8FB;
  --surface: #FFFFFF;
  --card: #FFFFFF;
  --fg: #0F172A;
  --fg-soft: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --border: #E7EBF0;
  --border-strong: #D8DEE7;
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-soft: #EFF4FF;
  --on-primary: #FFFFFF;
  --success: #16A34A;
  --success-soft: #ECFDF3;
  --warning: #B45309;
  --warning-soft: #FEF6E7;
  --danger: #DC2626;
  --danger-soft: #FEF2F2;
  --ring: rgba(37, 99, 235, .35);
  --row-hover: #F8FAFC;

  --sidebar-bg: #FFFFFF;
  --sidebar-fg: #475569;
  --sidebar-active-bg: #EFF4FF;
  --sidebar-active-fg: #1D4ED8;

  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --r-sm: 6px;
  --r: 9px;
  --r-lg: 12px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .04);
  --sidebar-w: 248px;
}

/* The dashboard is a deliberately light "SaaS claro" design (per product
   decision), so it does NOT follow the OS prefers-color-scheme dark setting —
   it always renders light. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: light; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; letter-spacing: -0.01em; color: var(--fg); }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
p { margin: 0 0 .8em; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
code, .mono, td.mono { font-family: var(--font-mono); font-size: 12.5px; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 1px; border-radius: var(--r-sm); }
svg { flex-shrink: 0; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky; top: 0; align-self: start; height: 100vh; overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 15px; color: var(--fg);
  letter-spacing: -0.01em; padding: 6px 10px 20px;
}
.sidebar .brand .brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #7C3AED);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 13px; font-weight: 800;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); font-weight: 600; padding: 14px 10px 6px;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  color: var(--sidebar-fg); padding: 8px 10px; border-radius: var(--r);
  font-weight: 500; font-size: 13.5px;
  transition: background .12s ease, color .12s ease;
}
.sidebar nav a svg { width: 18px; height: 18px; opacity: .8; }
.sidebar nav a:hover { background: var(--row-hover); color: var(--fg); text-decoration: none; }
.sidebar nav a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active-fg); font-weight: 600; }
.sidebar nav a.active svg { opacity: 1; }

.main-column { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  height: 60px; padding: 0 28px;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.topbar-admin { color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; gap: 7px; }
.topbar-admin::before {
  content: ""; width: 26px; height: 26px; border-radius: var(--r-pill);
  background: var(--primary-soft); color: var(--primary);
  display: inline-block;
}
.topbar-logout { margin: 0; }
.content { padding: 28px; max-width: 1180px; width: 100%; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; display: flex; align-items: center; gap: 14px;
    padding: 10px 16px; overflow-x: auto;
  }
  .sidebar .brand { padding: 0; }
  .sidebar .nav-label { display: none; }
  .sidebar nav { flex-direction: row; gap: 4px; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
}

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm); padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 14px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.page-head h1 { margin: 0; }
.page-actions { display: flex; align-items: center; gap: 8px; }
.inline-form { display: inline; }
.muted { color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font: inherit; font-weight: 550; font-size: 13px; line-height: 1;
  padding: 9px 15px; min-height: 38px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--fg-soft);
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: background .12s ease, border-color .12s ease, box-shadow .12s ease, transform .04s ease;
}
.btn:hover { background: var(--row-hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); box-shadow: 0 1px 2px rgba(37,99,235,.25); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(.94); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--row-hover); color: var(--fg); }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; line-height: 1.5;
  background: var(--row-hover); color: var(--muted); border: 1px solid var(--border);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge-ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 22%, transparent); }
.badge-warn { background: var(--warning-soft); color: var(--warning); border-color: color-mix(in srgb, var(--warning) 22%, transparent); }
.badge-off { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 22%, transparent); }
.badge-neutral { background: var(--row-hover); color: var(--muted); }
.badge-neutral::before { display: none; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table thead th {
  position: sticky; top: 0; background: var(--surface); text-align: left;
  font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--faint); padding: 11px 16px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--fg-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background .1s ease; }
.table tbody tr:hover { background: var(--row-hover); }
.table td .mono { color: var(--fg); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-empty { padding: 40px 28px; text-align: center; color: var(--muted); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 550; color: var(--fg-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 14px; padding: 9px 12px; min-height: 40px;
  color: var(--fg); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--r);
  transition: border-color .12s ease, box-shadow .12s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring);
}
/* Checkboxes/radios must not inherit the full-width text-input sizing. */
.field input[type="checkbox"], .field input[type="radio"],
.check-line input[type="checkbox"], .check-line input[type="radio"] {
  width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0;
  flex: 0 0 auto; accent-color: var(--primary); cursor: pointer; vertical-align: middle;
}
.check-line {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 500; font-size: 13.5px; color: var(--fg-soft); cursor: pointer;
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
/* Standalone hint (outside a .field wrapper), e.g. the Network add-row notes. */
.hint { font-size: 12px; color: var(--muted); }
/* Inline "Add …" disclosures on the Network interfaces/DHCP tables. */
.add-row { margin-top: 14px; }
.add-row > summary { cursor: pointer; display: inline-flex; width: fit-content; }
.add-row[open] > summary { margin-bottom: 4px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 5px; }
.field.has-error input, .field.has-error select { border-color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
fieldset { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px; margin: 0 0 18px; }
fieldset legend { font-size: 12px; font-weight: 600; padding: 0 7px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.form-actions { display: flex; gap: 10px; margin-top: 10px; }
.hidden { display: none !important; }
/* The Opera Cloud / OXI fieldsets are toggled via the `hidden` attribute (only
   the selected integration type is shown). Guarantee it beats any display rule. */
[hidden] { display: none !important; }

/* ---------- Flash ---------- */
.flash { padding: 11px 15px; border-radius: var(--r); margin-bottom: 18px; font-size: 13px; border: 1px solid transparent; }
.flash-ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.flash-err { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- Tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tabs a, .tab { padding: 10px 14px; color: var(--muted); font-weight: 550; font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--fg); text-decoration: none; }
.tabs a.active, .tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Second-level nav inside a group (Red / Accesos / Actividad). */
.subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin: -12px 0 22px; }
.subtabs a { padding: 5px 12px; color: var(--muted); font-weight: 550; font-size: 12.5px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--card); white-space: nowrap; }
.subtabs a:hover { color: var(--fg); text-decoration: none; border-color: var(--muted); }
.subtabs a.active { color: #fff; background: var(--primary); border-color: var(--primary); }

/* Router actions panel (Network section). */
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.action-row .inline-form { margin: 0; }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.stat .stat-label { color: var(--muted); font-size: 12.5px; font-weight: 550; }
.stat .stat-value { font-size: 32px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--fg); }
.stat .stat-sub { color: var(--faint); font-size: 12px; margin-top: 3px; }

/* ---------- Login ---------- */
.login-body { background:
  radial-gradient(1200px 600px at 50% -10%, var(--primary-soft), transparent 60%), var(--bg); }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 400px; box-shadow: var(--shadow-md); border-radius: var(--r-lg); }
.login-title { text-align: center; margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .btn-primary { width: 100%; margin-top: 6px; }

/* ---------- Health widget ---------- */
.health-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.health-row .label { width: 92px; color: var(--muted); font-weight: 550; }

/* ---------- KPI cards (Nomadix-Cloud style) ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
  margin: 0 0 20px;
}
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 16px 15px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent, var(--primary));
  opacity: .9;
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--border-strong); }
.kpi-top { display: flex; align-items: center; gap: 10px; }
.kpi-icon {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: var(--accent-soft, var(--primary-soft));
  color: var(--accent, var(--primary));
}
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.kpi-value { font-size: 27px; font-weight: 680; line-height: 1.05; color: var(--fg); font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.kpi--primary { --accent: var(--primary); --accent-soft: var(--primary-soft); }
.kpi--success { --accent: var(--success); --accent-soft: var(--success-soft); }
.kpi--warning { --accent: var(--warning); --accent-soft: var(--warning-soft); }
.kpi--danger  { --accent: var(--danger);  --accent-soft: var(--danger-soft); }
.kpi--muted   { --accent: var(--faint);   --accent-soft: #F1F5F9; }
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(22, 163, 74, .5);
  animation: livepulse 2s infinite;
}
@keyframes livepulse {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, .5); }
  70% { box-shadow: 0 0 0 6px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ---------- Topbar user menu ---------- */
.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 5px 10px 5px 5px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--card);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { border-color: var(--border-strong); }
.user-menu[open] > summary { box-shadow: 0 0 0 3px var(--ring); border-color: var(--primary); }
.user-avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.user-name { font-size: 13.5px; font-weight: 550; color: var(--fg-soft); }
.user-caret { width: 16px; height: 16px; color: var(--muted); transition: transform .15s ease; }
.user-menu[open] .user-caret { transform: rotate(180deg); }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); padding: 6px; z-index: 50;
}
.user-menu-panel form { margin: 0; }
.user-menu-panel a, .user-menu-panel button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--r-sm); font-size: 13.5px;
  color: var(--fg-soft); background: none; border: none; cursor: pointer; text-decoration: none; font: inherit;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--row-hover); color: var(--fg); }
.user-menu-panel svg { width: 16px; height: 16px; flex: none; color: var(--muted); }

/* ---------- Account page ---------- */
.account-id { display: flex; align-items: center; gap: 14px; }
.account-avatar { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 20px; }
.account-name { font-weight: 650; font-size: 16px; color: var(--fg); }

/* ---------- Gateway control groups ---------- */
.gw-group { margin-bottom: 18px; }
.gw-group:last-child { margin-bottom: 0; }
.gw-group-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); margin-bottom: 8px; }
.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.action-row .inline-form { margin: 0; }
.action-row .btn { display: inline-flex; align-items: center; gap: 6px; }
.action-row .btn svg { width: 15px; height: 15px; flex: none; }

/* ---------- Portal editor + live preview ---------- */
.portal-editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .portal-editor { grid-template-columns: 1fr; } }
.pe-side { position: sticky; top: 76px; }
.portal-preview { border: 1px solid var(--border); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-md); background: #fff; }
.pp-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 9px 14px; border-bottom: 1px solid var(--border); background: #FCFDFE; }
.pp-screen { padding: 26px 18px; min-height: 400px; display: flex; align-items: center; justify-content: center; background: #2563EB; background-size: cover; background-position: center; }
.pp-card { background: #fff; border-radius: 14px; padding: 22px 18px; width: 100%; max-width: 260px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,.18); }
.pp-logo { font-weight: 700; font-size: 17px; margin-bottom: 12px; color: #111; }
.pp-logo img { max-height: 44px; max-width: 170px; }
.pp-title { margin: 0 0 6px; font-size: 16px; }
.pp-text { font-size: 12px; color: #555; margin: 0 0 14px; line-height: 1.45; }
.pp-tabs { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; flex-wrap: wrap; }
.pp-tab { font-size: 11px; padding: 5px 10px; border-radius: 999px; background: #EEF2F7; color: #333; }
.pp-btn { width: 100%; border: none; border-radius: 8px; padding: 10px; color: #fff; font-weight: 600; font-size: 13px; }
.pp-footer { font-size: 10.5px; color: #888; margin-top: 12px; }

/* ---------- Table identity cell (avatar + name) ---------- */
.cell-id { display: flex; align-items: center; gap: 9px; }
.mini-avatar { width: 26px; height: 26px; flex: none; border-radius: 7px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 600; font-size: 12px; }

/* ---------- Empty states ---------- */
.empty-state { text-align: center; padding: 34px 16px; }
.empty-icon { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); color: var(--primary); margin-bottom: 10px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty-title { font-weight: 600; font-size: 14px; color: var(--fg-soft); }
.empty-text { font-size: 12.5px; color: var(--muted); margin: 4px auto 12px; max-width: 46ch; line-height: 1.5; }

/* ---------- Property identity header ---------- */
.prop-head { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; }
.prop-avatar { width: 44px; height: 44px; flex: none; border-radius: 12px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.prop-head-text h1 { margin: 0; line-height: 1.15; }
.prop-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.prop-meta code { font-size: 12.5px; color: var(--muted); }
.prop-head-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.prop-head-row .prop-head { margin: 0; }

/* ---------- Auth-by-hour stacked chart ---------- */
.authchart { display: flex; align-items: flex-end; gap: 2px; height: 130px; padding: 8px 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); }
.acol { flex: 1 1 0; min-width: 4px; min-height: 3px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 3px 3px 0 0; overflow: hidden; background: #EEF2F7; }
.acol-fail { background: var(--danger); }
.acol-ok { background: var(--success); }
.chart-legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart-axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--faint); margin-top: 4px; }

/* ---------- Bar chart (live traffic, top consumers) ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 160px) 1fr 78px; align-items: center; gap: 12px; }
.bar-label { font-size: 13px; color: var(--fg-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 22px; border-radius: 6px; background: #EEF2F7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--primary), #60A5FA); transition: width .5s ease; min-width: 2px; }
.bar-value { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.chart-empty { color: var(--faint); font-size: 13px; padding: 8px 0; }

/* Sparkline / area chart svg */
.spark { width: 100%; height: 120px; display: block; }
.spark .area { fill: url(#sparkgrad); }
.spark .line { fill: none; stroke: var(--primary); stroke-width: 2; }

/* ---------- Front desk ---------- */
.fd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .badge code { font-size: 12px; }

/* ---------- Choice cards (radio-as-cards, e.g. integration type) ---------- */
.choice-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin: 2px 0 8px; }
.choice-card {
  position: relative; display: flex; gap: 12px; align-items: flex-start;
  padding: 14px; border: 1.5px solid var(--border); border-radius: var(--r-lg);
  background: var(--card); cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.choice-card:hover { border-color: var(--border-strong); }
.choice-card input { position: absolute; inset: 12px 12px auto auto; width: 16px; height: 16px; accent-color: var(--primary); }
.choice-card .cc-icon { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); }
.choice-card .cc-icon svg { width: 20px; height: 20px; }
.choice-card .cc-body { display: block; padding-right: 22px; }
.choice-card .cc-title { display: block; font-weight: 600; font-size: 14px; color: var(--fg); }
.choice-card .cc-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.45; }
.choice-card:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--ring); }
.choice-card:has(input:checked) .cc-icon { background: var(--primary); color: #fff; }
.choice-card:has(input:focus-visible) { box-shadow: 0 0 0 3px var(--ring); }
.choice-card.is-disabled { opacity: .55; cursor: not-allowed; background: #FAFBFC; }
.choice-card.is-disabled:hover { border-color: var(--border); }

/* SSID inline edit popover */
.ssid-edit { position: relative; display: inline-block; }
.ssid-edit > summary { list-style: none; display: inline-flex; cursor: pointer; }
.ssid-edit > summary::-webkit-details-marker { display: none; }
.ssid-form {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 270px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md); padding: 14px; text-align: left;
}
.ssid-form .field { margin-bottom: 10px; }
.ssid-form .form-actions { margin-top: 6px; }

/* ---------- Config steps (PMS wizard feel) ---------- */
.wizard-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.wizard-steps .wstep {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px 9px 10px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r-pill); font-size: 13px; font-weight: 550; color: var(--muted);
}
.wizard-steps .wstep .n {
  width: 22px; height: 22px; flex: none;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--muted); color: #fff; font-size: 12px; font-weight: 700;
}
.wizard-steps .wstep.is-active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.wizard-steps .wstep.is-active .n { background: var(--primary); }

.step-card {
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 0; margin: 0 0 16px; background: var(--card); overflow: hidden;
}
.step-card > .step-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border); background: #FCFDFE;
}
.step-card > .step-head .n {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
}
.step-card > .step-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; color: var(--fg); }
.step-card > .step-head .step-hint { margin: 1px 0 0; font-size: 12px; color: var(--muted); }
.step-card > .step-body { padding: 16px 18px; }
.test-result { font-size: 12.5px; margin-left: 10px; }
.test-result.ok { color: var(--success); }
.test-result.err { color: var(--danger); }

/* ---------- Multi-tenant console helpers ---------- */
.page-sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 0; max-width: 70ch; }
.field-actions { grid-column: 1 / -1; display: flex; align-items: flex-end; }
.form-inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 18px; }
.form-inline .field { margin-bottom: 12px; min-width: 200px; }
.col-actions { text-align: right; white-space: nowrap; }
.col-actions .inline { display: inline-block; margin-left: 6px; }
.small { font-size: 12px; }
.muted.small, .small.muted { color: var(--muted); }

/* ---------- Live bandwidth gauges (superadmin overview) ---------- */
.gauge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.gauge-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--card); box-shadow: var(--shadow-sm); padding: 16px 16px 14px; text-align: center; }
.gauge-title { font-size: 13px; font-weight: 600; color: var(--fg); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gauge-wrap { position: relative; width: 160px; max-width: 100%; margin: 0 auto; }
.gauge { display: block; width: 100%; height: auto; }
.gauge-track { stroke: var(--border); }
.gauge-fill { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset .7s cubic-bezier(.22,.61,.36,1), stroke .4s ease; }
.gauge-fill.load-low { stroke: var(--success); }
.gauge-fill.load-med { stroke: #F59E0B; }
.gauge-fill.load-high { stroke: var(--danger); }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 2px; }
.gauge-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1; color: var(--fg); font-variant-numeric: tabular-nums; }
.gauge-value .unit { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.gauge-dir { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.gauge-up { margin-top: 10px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.gauge-up .up { color: var(--fg); font-weight: 600; }
.gauge-up .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 5px; vertical-align: middle; }
.gauge-muted .gauge-fill { stroke: var(--border); }
.gauge-muted .gauge-value, .gauge-muted .gauge-up .up { color: var(--faint); }
.gauge-muted .gauge-up .dot { background: var(--faint); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
