/* Guest Wi-Fi codes - staff UI.
   Cisco palette: Midnight #07182D, Medium Blue #0A60FF, Cisco Blue #02C8FF, white.
   Brand rules: surfaces mostly Midnight/White, cards white; the only gradient is
   the blue ramp 90deg #0A60FF -> #02C8FF. Magenta/orange appear ONLY inside the
   official full gradient, never as flat fills or text, so warnings use amber
   #FFB020 (Midnight text) and errors #D93636. Text is only White or Midnight
   (muted = a Midnight tint, #A9B7CB on dark). #0049CC = pressed state. */

:root {
  --midnight: #07182D;
  --midnight-2: #0E2747;
  --blue: #0A60FF;
  --blue-dark: #0049CC;
  --cyan: #02C8FF;
  --ramp: linear-gradient(90deg, #0A60FF, #02C8FF);
  --amber: #FFB020;
  --amber-soft: #FFF4DC;
  --red: #D93636;
  --red-soft: #FBE9E9;
  --white: #FFFFFF;
  --canvas: #EDF1F7;
  --line: #D3DCE8;
  --line-strong: #A9B7CB;
  --soft: #F6F8FB;
  --tint: #E6EFFF;
  --muted: rgba(7, 24, 45, .68);
  --muted-dark: #A9B7CB;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 1px 2px rgba(7, 24, 45, .06), 0 8px 24px rgba(7, 24, 45, .08);
  --shadow-lg: 0 2px 4px rgba(7, 24, 45, .08), 0 18px 40px rgba(7, 24, 45, .14);
  --tap: 56px;
  --font: "Inter", -apple-system, system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, "Roboto Mono", Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 18px/1.45 var(--font);
  color: var(--midnight);
  background: var(--canvas);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
h1 { font-size: 30px; font-weight: 750; }
h2 { font-size: 22px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 700; }
p { margin: 0; }
.ic { width: 1.3em; height: 1.3em; flex: none; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); letter-spacing: .02em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 8px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--midnight);
  color: var(--white);
  padding: calc(10px + var(--safe-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 14px;
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: var(--ramp);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-height: var(--tap); min-width: 0; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--ramp);
  display: grid; place-items: center; flex: none; color: var(--white);
}
.brand-mark .ic { width: 26px; height: 26px; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 19px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 15px; color: var(--muted-dark); }
.topbar .spacer { flex: 1; }
.who { display: flex; align-items: center; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
  border-radius: 999px; background: rgba(255,255,255,.1); font-size: 16px; font-weight: 600; white-space: nowrap;
}
.chip .ic { width: 20px; height: 20px; }
.topbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); min-width: var(--tap); padding: 0 16px; border-radius: 14px;
  border: 1.5px solid rgba(255,255,255,.35); background: transparent; color: var(--white);
  font: 600 17px var(--font); text-decoration: none; cursor: pointer;
}
.topbtn:active { background: rgba(255,255,255,.14); }
.topbtn.admin { background: var(--blue); border-color: var(--blue); }
.who form { margin: 0; }

/* ---------- Banners ---------- */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; font-weight: 700; font-size: 18px;
  border-bottom: 1px solid rgba(7,24,45,.12);
}
.banner .ic { width: 26px; height: 26px; }
.banner.low { background: var(--amber); color: var(--midnight); }
.banner.empty { background: var(--red); color: var(--white); }
.banner + .banner { margin-top: 0; }

/* ---------- Page ---------- */
main.page {
  max-width: 1120px; margin: 0 auto;
  padding: 26px max(18px, env(safe-area-inset-right)) calc(40px + var(--safe-bottom)) max(18px, env(safe-area-inset-left));
}
.pagehead { display: flex; align-items: center; gap: 14px; margin: 0 0 22px; flex-wrap: wrap; }
.pagehead h1 { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.backlink {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); padding: 0 18px 0 10px;
  border-radius: 14px; background: var(--white); border: 1.5px solid var(--line); text-decoration: none;
  font-weight: 650; box-shadow: var(--shadow);
}
.backlink .ic { width: 24px; height: 24px; }

.card {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px; border: 1px solid rgba(7,24,45,.05);
}
.card + .card, .stack > * + * { margin-top: 18px; }
.card-title { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-title .ic { color: var(--blue); }
.grid2 { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.grid2 > .card + .card { margin-top: 0; }

/* ---------- Flash ---------- */
.flash {
  display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--radius-sm);
  margin-bottom: 20px; font-weight: 600; background: var(--white); box-shadow: var(--shadow);
  border-left: 8px solid var(--blue);
}
.flash .ic { width: 26px; height: 26px; margin-top: 1px; }
.flash.ok { border-left-color: var(--blue); }
.flash.ok .ic { color: var(--blue); }
.flash.error { border-left-color: var(--red); }
.flash.error .ic { color: var(--red); }
.flash.warn { border-left-color: var(--amber); }
.flash.warn .ic { color: var(--midnight); }

/* ---------- Buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 0 24px; border-radius: 16px; border: 2px solid transparent;
  font: 700 19px var(--font); text-decoration: none; cursor: pointer; user-select: none;
  background: var(--blue); color: var(--white); transition: transform .06s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(.98); }
.btn .ic { width: 24px; height: 24px; }
.btn.block { width: 100%; }
.btn.xl { min-height: 76px; font-size: 22px; border-radius: 20px; padding: 0 30px; }
.btn.secondary { background: var(--white); color: var(--midnight); border-color: var(--line-strong); }
.btn.dark { background: var(--midnight); color: var(--white); }
.btn.ghost { background: transparent; color: var(--midnight); border-color: var(--line-strong); }
.btn.danger { background: var(--white); color: var(--midnight); border-color: var(--red); }
.btn[disabled], .btn.disabled { background: #E2E7EF; color: rgba(7,24,45,.45); border-color: #E2E7EF; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.small { min-height: 56px; font-size: 17px; padding: 0 16px; border-radius: 12px; }

.field { display: block; font-weight: 650; margin-bottom: 16px; }
.field > span { display: block; margin-bottom: 8px; }
.input, select.input {
  display: block; width: 100%; min-height: var(--tap); padding: 12px 16px; border-radius: 14px;
  border: 2px solid var(--line-strong); background: var(--white); color: var(--midnight);
  font: 500 20px var(--font); appearance: none; -webkit-appearance: none;
}
select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2307182D' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 22px; padding-right: 48px;
}
.input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 4px rgba(10,96,255,.18); }
.input.big { min-height: 72px; font-size: 26px; padding: 14px 20px; border-radius: 18px; }
input[type=file].input { font-size: 17px; padding: 14px; }
.hint { font-size: 16px; color: var(--muted); font-weight: 400; margin-top: 6px; }
.row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.row > .grow { flex: 1 1 260px; }

/* Search bar */
.searchbar { position: relative; display: flex; gap: 12px; }
.searchbar .input { padding-left: 58px; }
.searchbar .lead { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--blue); pointer-events: none; }
.searchbar .lead .ic { width: 28px; height: 28px; }
.searchbar .btn { min-height: 72px; border-radius: 18px; }

/* ---------- Home ---------- */
.hello { margin-bottom: 22px; }
.hello h1 { font-size: 32px; }
.hello p { color: var(--muted); margin-top: 6px; font-size: 19px; }
.actions { display: grid; gap: 20px; grid-template-columns: 1fr; }
@media (min-width: 700px) and (orientation: portrait) { .action { min-height: 230px; } .action strong { font-size: 34px; } }
@media (min-width: 1000px) and (orientation: landscape) { .actions { grid-template-columns: repeat(3, 1fr); } }
.action {
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 22px;
  min-height: 150px; padding: 28px 30px; border-radius: 26px; text-decoration: none;
  box-shadow: var(--shadow-lg); transition: transform .08s ease;
}
.action:active { transform: scale(.985); }
.action .aicon {
  width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; flex: none;
  background: rgba(255,255,255,.16);
}
.action .aicon .ic { width: 48px; height: 48px; stroke-width: 1.7; }
.action .atext { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }
.action strong { font-size: 30px; font-weight: 780; letter-spacing: -0.015em; }
.action span { font-size: 19px; }
.action .go { width: 34px; height: 34px; opacity: .8; }
.action.primary { background: var(--blue); color: var(--white); }
.action.primary::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--ramp); }
.action.night { background: var(--midnight); color: var(--white); }
.action.night::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: var(--ramp); }
.action.night .aicon { background: var(--ramp); }
.action.light { background: var(--white); color: var(--midnight); border: 2px solid var(--line); }
.action.light .aicon { background: var(--tint); color: var(--blue); }
@media (min-width: 1000px) and (orientation: landscape) {
  .action { flex-direction: column; align-items: flex-start; min-height: 330px; padding: 32px; }
  .action .go { position: absolute; right: 26px; top: 30px; }
  .action .atext { margin-top: auto; flex: 0 0 auto; }
}

/* ---------- Search results ---------- */
.results { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.result {
  display: flex; align-items: center; gap: 16px; min-height: 84px; padding: 14px 18px;
  background: var(--white); border-radius: 18px; text-decoration: none; box-shadow: var(--shadow);
  border: 1.5px solid transparent;
}
.result:active { border-color: var(--blue); }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--tint); color: var(--midnight); font-weight: 800; font-size: 19px; letter-spacing: .02em;
}
.result .rtext { flex: 1; min-width: 0; }
.result .rname, .result .remail { display: block; }
.result .rname { font-weight: 700; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result .remail { color: var(--muted); font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result > .ic { width: 26px; height: 26px; color: var(--line-strong); }
.count-note { margin-top: 14px; color: var(--muted); font-size: 17px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .ic { width: 52px; height: 52px; color: var(--line-strong); margin-bottom: 10px; }

/* Tier badges */
.tier {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px;
  font-weight: 750; font-size: 16px; white-space: nowrap; border: 2px solid var(--midnight);
}
.tier .ic { width: 18px; height: 18px; }
.tier.vip { background: var(--midnight); color: var(--white); border-color: var(--midnight); }
.tier.vip .ic { color: var(--cyan); }
.tier.std { background: var(--white); color: var(--midnight); border-color: var(--blue); }
.tier.unknown { background: var(--amber); color: var(--midnight); border-color: var(--amber); }

/* ---------- Guest page ---------- */
.guesthead { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.guesthead .avatar { width: 72px; height: 72px; font-size: 26px; background: var(--ramp); color: var(--white); }
.guesthead .gtext { flex: 1; min-width: 220px; }
.guesthead h1 { font-size: 30px; word-break: break-word; }
.guesthead .gmail { color: var(--muted); font-size: 18px; margin-top: 4px; word-break: break-all; }
.guesthead .gmeta { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--tint); font-weight: 650; font-size: 16px; }
.pill .ic { width: 18px; height: 18px; color: var(--blue); }

.allow { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.allow .big { font-size: 40px; font-weight: 800; letter-spacing: -0.02em; }
.allow .big small { font-size: 22px; font-weight: 650; color: var(--muted); }
.dots { display: flex; gap: 8px; flex-wrap: wrap; }
.dot { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-strong); background: var(--white); }
.dot.on { border-color: transparent; background: var(--ramp); }
.allow .label { color: var(--muted); font-weight: 600; }

.devices { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 4px; }
@media (min-width: 1000px) { .devices { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.devices form { margin: 0; }
.devbtn {
  width: 100%; min-height: 120px; border-radius: 20px; border: 2px solid var(--blue); background: var(--white);
  color: var(--midnight); font: 750 21px var(--font); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; cursor: pointer; box-shadow: var(--shadow); transition: transform .06s ease;
}
.devbtn .ic { width: 40px; height: 40px; color: var(--blue); stroke-width: 1.7; }
.devbtn:active { transform: scale(.97); background: var(--tint); }
.devbtn[disabled] { border-color: #E2E7EF; background: #F1F4F8; color: rgba(7,24,45,.42); box-shadow: none; cursor: not-allowed; }
.devbtn[disabled] .ic { color: rgba(7,24,45,.3); }
.reason {
  margin-top: 14px; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 14px;
  background: var(--amber-soft); border: 2px solid var(--amber); font-weight: 700;
}
.reason .ic { color: var(--midnight); }
.reason.hard { background: var(--red-soft); border-color: var(--red); }

/* History */
.histhint { margin: -8px 0 8px; }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.history li:first-child { border-top: 0; }
.history .hcode { font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .06em; min-width: 140px; }
.history .hmeta { flex: 1; min-width: 200px; color: var(--muted); font-size: 16px; }
.history .hmeta b { color: var(--midnight); font-weight: 650; }
.history .ic { width: 22px; height: 22px; vertical-align: -4px; }

/* ---------- Walk-up ---------- */
.walkstatus { text-align: center; padding: 32px 24px; }
.walkstatus .count { font-size: 64px; font-weight: 850; letter-spacing: -0.03em; line-height: 1; }
.walkstatus .count small { font-size: 28px; color: var(--muted); font-weight: 650; }
.walkstatus .dots { justify-content: center; margin: 18px 0 8px; }
.walkstatus .email { font-weight: 650; word-break: break-all; margin-bottom: 18px; }
.walkstatus form { margin-top: 22px; }
.blockbox { display: flex; gap: 16px; align-items: flex-start; padding: 22px; border-radius: var(--radius); background: var(--white); box-shadow: var(--shadow); border: 3px solid var(--red); }
.blockbox .ic { width: 40px; height: 40px; color: var(--red); }
.blockbox h2 { margin-bottom: 8px; }
.blockbox .btn { margin-top: 16px; }

/* ---------- Code display (full-screen) ---------- */
body.display { background: var(--midnight); color: var(--white); overflow: hidden; }
.codescreen {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  padding: calc(18px + var(--safe-top)) max(22px, env(safe-area-inset-right)) calc(20px + var(--safe-bottom)) max(22px, env(safe-area-inset-left));
}
.codescreen .ctop { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.codescreen .ctag { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: inline-flex; align-items: center; gap: 10px; font-size: clamp(18px, 2.6vmin, 26px); font-weight: 650; }
.codescreen .ctag .ic { width: 1.4em; height: 1.4em; color: var(--cyan); }
.codescreen .cmid { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vmin; text-align: center; }
.codescreen .clabel { font-size: clamp(18px, 3vmin, 30px); font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-dark); }
.code {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0 .45em;
  font-family: var(--mono); font-weight: 750; line-height: 1.04; letter-spacing: .04em;
  font-variant-numeric: tabular-nums slashed-zero; color: var(--white);
}
.code.len-s { font-size: min(19vw, 30vh); }
.code.len-m { font-size: min(11.5vw, 20vh); }
.code.len-l { font-size: min(8vw, 13vh); }
.code.len-xl { font-size: min(5.2vw, 8vh); }
@media (orientation: portrait) {
  /* groups wrap onto separate lines, so each can be much bigger */
  .code.len-s { font-size: min(24vw, 20vh); }
  .code.len-m { font-size: min(20vw, 14vh); }
  .code.len-l { font-size: min(13vw, 9vh); }
  .code.len-xl { font-size: min(8vw, 6vh); }
}
.codescreen .cinfo { font-size: clamp(20px, 3.4vmin, 34px); font-weight: 700; display: inline-flex; align-items: center; gap: .4em; }
.codescreen .cinfo .ic { color: var(--cyan); width: 1.2em; height: 1.2em; }
.codescreen .cname { font-size: clamp(18px, 2.8vmin, 28px); color: var(--muted-dark); }
.codescreen .crule { width: min(70vw, 520px); height: 6px; border-radius: 6px; background: var(--ramp); margin: 1vmin auto; }
.codescreen .cbottom { display: flex; align-items: center; gap: 18px; justify-content: space-between; flex-wrap: wrap; }
.countdown { flex: 1; min-width: 220px; }
.countdown .ctext { font-size: 18px; color: var(--muted-dark); margin-bottom: 8px; }
.countdown .track { height: 8px; border-radius: 8px; background: rgba(255,255,255,.16); overflow: hidden; }
.countdown .bar { height: 100%; width: 100%; background: var(--ramp); transform-origin: left center; }
.btn.done { background: var(--white); color: var(--midnight); min-height: 72px; min-width: 200px; font-size: 22px; border-radius: 20px; }

/* ---------- QR ---------- */
.qrwrap { display: flex; flex-direction: column; align-items: center; gap: 22px; text-align: center; }
.qrframe { background: var(--white); padding: 22px; border-radius: 28px; box-shadow: var(--shadow-lg); border: 6px solid transparent; background-clip: padding-box; position: relative; }
.qrframe::before { content: ""; position: absolute; inset: -6px; border-radius: 30px; background: var(--ramp); z-index: -1; }
.qrframe img { display: block; width: min(76vw, 62vh, 620px); height: auto; image-rendering: pixelated; border-radius: 10px; }
.qrcaption { font-size: clamp(22px, 3.6vmin, 36px); font-weight: 750; }

/* ---------- Login ---------- */
body.login { background: var(--midnight); color: var(--white); }
.loginwrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-top)) 18px calc(24px + var(--safe-bottom)); position: relative; overflow: hidden; }
.loginwrap::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--ramp); pointer-events: none; }
.loginbox { position: relative; width: 100%; max-width: 620px; }
.loginbrand { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.loginbrand .brand-mark { width: 64px; height: 64px; border-radius: 18px; }
.loginbrand .brand-mark .ic { width: 38px; height: 38px; }
.loginbrand h1 { font-size: 28px; color: var(--white); }
.loginbrand p { color: var(--muted-dark); margin-top: 4px; }
.loginbox .card { color: var(--midnight); }
.names { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 18px; border: 0; padding: 0; }
.names legend { font-weight: 650; margin-bottom: 10px; padding: 0; }
.namechip { position: relative; }
.namechip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.namechip span {
  display: flex; align-items: center; justify-content: center; min-height: 64px; padding: 8px 12px; border-radius: 16px;
  border: 2px solid var(--line-strong); font-weight: 700; font-size: 20px; text-align: center; background: var(--white);
}
.namechip input:checked + span { border-color: var(--blue); background: var(--blue); color: var(--white); box-shadow: 0 6px 16px rgba(10,96,255,.35); }
.namechip input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: 2px; }
.pin { letter-spacing: .4em; text-align: center; font-size: 30px; font-family: var(--mono); }
details.adminlogin { margin-top: 18px; }
details.adminlogin summary {
  list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 10px;
  justify-content: center; font-weight: 650; color: var(--white);
}
details.adminlogin summary::-webkit-details-marker { display: none; }
details.adminlogin[open] summary { margin-bottom: 12px; }

/* ---------- Admin ---------- */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat { background: var(--white); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border-top: 6px solid var(--blue); }
.stat.low { border-top-color: var(--amber); }
.stat.empty { border-top-color: var(--red); }
.stat .sname { font-weight: 700; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.stat .snum { font-size: 46px; font-weight: 850; letter-spacing: -0.03em; margin: 6px 0 2px; }
.stat .ssub { color: var(--muted); font-size: 16px; }
.stat .reason { margin-top: 12px; font-size: 16px; align-items: flex-start; }
.stat .meter + .ssub { margin-top: 8px; }
.meter { height: 10px; border-radius: 10px; background: #E2E7EF; overflow: hidden; margin-top: 14px; }
.meter > i { display: block; height: 100%; background: var(--ramp); border-radius: 10px; }
/* meter widths in 5% steps (no inline styles: CSP) */
.meter > i.w0 { width: 0%; } .meter > i.w5 { width: 5%; } .meter > i.w10 { width: 10%; } .meter > i.w15 { width: 15%; } .meter > i.w20 { width: 20%; } .meter > i.w25 { width: 25%; } .meter > i.w30 { width: 30%; } .meter > i.w35 { width: 35%; } .meter > i.w40 { width: 40%; } .meter > i.w45 { width: 45%; } .meter > i.w50 { width: 50%; } .meter > i.w55 { width: 55%; } .meter > i.w60 { width: 60%; } .meter > i.w65 { width: 65%; } .meter > i.w70 { width: 70%; } .meter > i.w75 { width: 75%; } .meter > i.w80 { width: 80%; } .meter > i.w85 { width: 85%; } .meter > i.w90 { width: 90%; } .meter > i.w95 { width: 95%; } .meter > i.w100 { width: 100%; }
.flag { font-size: 14px; font-weight: 800; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.flag.low { background: var(--amber); color: var(--midnight); }
.flag.empty { background: var(--red); color: var(--white); }
.flag.ok { background: var(--tint); color: var(--midnight); }
.tiles { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 22px; }
.tile {
  display: flex; align-items: center; gap: 16px; min-height: 92px; padding: 18px 20px; border-radius: 20px;
  background: var(--white); text-decoration: none; box-shadow: var(--shadow); border: 1.5px solid transparent; font-weight: 700; font-size: 19px;
}
.tile .ticon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--tint); color: var(--blue); flex: none; }
.tile .ticon .ic { width: 28px; height: 28px; }
.tile small { display: block; font-weight: 400; color: var(--muted); font-size: 15px; margin-top: 2px; }
.tile:active { border-color: var(--blue); }
.tile.accent .ticon { background: var(--ramp); color: var(--white); }

table.data { width: 100%; border-collapse: collapse; font-size: 17px; }
table.data th, table.data td { text-align: left; padding: 12px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--soft); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.hl td { background: var(--amber-soft); }
table.data tr.hl.zero td { background: var(--red-soft); }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -8px; padding: 0 8px; }
.status-on { font-weight: 700; color: var(--midnight); }
.status-off { font-weight: 700; color: var(--muted); }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form .input { width: 150px; min-height: 56px; font-size: 18px; padding: 8px 12px; }
.issues { margin: 10px 0 0; padding-left: 22px; }
.issues li { margin: 4px 0; }
.summary { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.summary .pill { font-size: 17px; }
.preview { max-width: 280px; border-radius: 12px; border: 1px solid var(--line); display: block; margin-top: 10px; background: var(--white); }

/* ---------- Errors ---------- */
.errorbox { text-align: center; padding: 50px 24px; }
.errorbox .ic { width: 64px; height: 64px; color: var(--red); margin-bottom: 12px; }
.errorbox h1 { margin-bottom: 10px; }
.errorbox .btn { margin-top: 22px; }

/* ---------- Phone tweaks ---------- */
@media (max-width: 600px) {
  body { font-size: 18px; }
  h1, .hello h1 { font-size: 26px; }
  .brand-text span { display: none; }
  .chip { display: none; }
  .topbtn span { display: none; }
  .topbtn { padding: 0 12px; }
  .action { min-height: 120px; padding: 22px; gap: 16px; border-radius: 22px; }
  .action .aicon { width: 64px; height: 64px; border-radius: 18px; }
  .action .aicon .ic { width: 38px; height: 38px; }
  .action strong { font-size: 24px; }
  .action span { font-size: 18px; }
  .card { padding: 18px; }
  table.data th, table.data td { padding: 10px 8px; }
  table.data td { font-size: 16px; }
  table.data th { font-size: 13px; letter-spacing: .02em; }
  table.data .iso, table.data .hide-sm { display: none; }
  /* devices table: one stacked block per device instead of sideways scrolling */
  table.devtable thead { display: none; }
  table.devtable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.devtable td { border: 0; padding: 0; }
  table.devtable td:nth-child(1) { grid-column: 1; }
  table.devtable td:nth-child(2) { grid-column: 1; color: var(--muted); }
  table.devtable td:nth-child(2)::before { content: "Last seen "; }
  table.devtable td:nth-child(3) { grid-column: 1; }
  table.devtable td:nth-child(4) { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .searchbar { flex-direction: column; }
  .devbtn { min-height: 104px; }
  .codescreen .cbottom { flex-direction: column-reverse; align-items: stretch; }
  .btn.done { width: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- Gates, network & devices, profiles ---------- */
.gatebox { display: flex; gap: 16px; align-items: flex-start; color: var(--midnight); border-top: 6px solid var(--amber); margin-bottom: 18px; }
.gatebox > .ic { width: 44px; height: 44px; color: var(--midnight); }
.gatebox h2 { margin-bottom: 8px; }
.seg { display: flex; gap: 0; border: 2px solid var(--line-strong); border-radius: 14px; overflow: hidden; width: 100%; max-width: 320px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.seg span { display: flex; align-items: center; justify-content: center; min-height: var(--tap); font-weight: 700; background: var(--white); color: var(--midnight); cursor: pointer; }
.seg input:checked + span { background: var(--midnight); color: var(--white); }
.seg input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }
.ipline { margin: 6px 0 12px; overflow-wrap: anywhere; }
.thisdev { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.thisdev p { display: flex; gap: 8px; align-items: flex-start; }
.thisdev p .ic { margin-top: 2px; }

.card > form + form, .card form + .field { margin-top: 14px; }
textarea.input { min-height: 120px; padding: 12px 14px; font: 18px/1.4 var(--mono); resize: vertical; width: 100%; }
table.data tr.revoked td { opacity: .55; }
.items { display: flex; flex-direction: column; gap: 10px; }
.item { border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--white); }
.item.off { background: var(--soft); }
.item.add { margin-top: 12px; border-style: dashed; }
.item > summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 10px 16px; cursor: pointer; }
.item > summary::-webkit-details-marker { display: none; }
.item > summary .iname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.item > summary .iname b { display: flex; align-items: center; gap: 8px; }
.item > summary small { color: var(--muted); font-size: 16px; overflow-wrap: anywhere; }
.item[open] > summary { border-bottom: 1px solid var(--line); }
.item > form, .item > .itemactions { padding: 14px 16px; }
.itemactions { display: flex; gap: 10px; flex-wrap: wrap; padding-top: 0 !important; }
.itemactions form { flex: 1; min-width: 160px; }
.card-title .status-on, .card-title .status-off { margin-left: auto; }
