/* WiFi Doorman: one look for every screen. Calm, UniFi-like; light and dark. */
:root {
  --bg: #F3F5F8; --card: #FFFFFF; --line: #E2E6EB; --line-soft: #EDF0F3;
  --text: #16202C; --text-2: #4A5562; --muted: #5A6574; --faint: #8A94A3;
  --accent: #0062E6; --accent-text: #0057CC; --accent-soft: #E8F1FF; --accent-ink: #0F3D80;
  --good: #127A45; --good-dot: #1A9A5A; --good-soft: #E6F4EC; --good-ink: #0F5E36;
  --warn: #B4540A; --warn-dot: #D97706; --warn-soft: #FDF0E4; --warn-ink: #8A3F06;
  --bad: #C52A2A; --bad-dot: #D93A2B; --bad-soft: #FDECEA; --bad-ink: #9A1F14;
  --chip: #F0F2F5; --input: #CBD2DA; --switch-off: #B8C0CA; --shadow: 0 1px 2px rgba(22,32,44,.08);
  --on-accent: #FFFFFF; --modal: #FFFFFF; --modal-edge: transparent;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1116; --card: #171B22; --line: #262C35; --line-soft: #1F242C;
    --text: #E8ECF1; --text-2: #B6BEC9; --muted: #9AA3AF; --faint: #6B7480;
    --accent: #2F7FF0; --accent-text: #74AEFF; --accent-soft: #14243D; --accent-ink: #C4DCFF;
    --good: #4CC488; --good-dot: #3DBA7A; --good-soft: #12291E; --good-ink: #9BE3BC;
    --warn: #F0A54A; --warn-dot: #F59E0B; --warn-soft: #2E2112; --warn-ink: #F6C88B;
    --bad: #FF7A70; --bad-dot: #F05A4E; --bad-soft: #331716; --bad-ink: #FFB8B1;
    --chip: #222831; --input: #3A424D; --switch-off: #4A535F; --shadow: none;
    --modal: #1F252E; --modal-edge: #343C47;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.45 "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- page frames ------------------------------------------------------------ */
.phone { min-height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--bg); }
@media (min-width: 600px) { .phone { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }
.top { position: sticky; top: 0; z-index: 5; background: var(--card); border-bottom: 1px solid var(--line);
       padding: calc(10px + env(safe-area-inset-top)) 16px 12px; display: flex; flex-direction: column; gap: 10px; }
.top-row { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.top h1 { font-size: 20px; font-weight: 700; letter-spacing: -.3px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .sub { font-size: 13px; color: var(--muted); }
.body { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.body.with-tabs { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.iconbtn { width: 44px; height: 44px; margin: -2px; border: 0; background: none; border-radius: 12px; display: inline-flex;
           align-items: center; justify-content: center; cursor: pointer; color: var(--text); flex: none; text-decoration: none; }
.iconbtn:hover { background: var(--chip); }

.tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: var(--card); border-top: 1px solid var(--line);
          padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.phone .tabbar { max-width: 560px; margin: 0 auto; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; text-decoration: none; color: var(--muted);
       font-size: 12px; font-weight: 600; position: relative; border: 0; background: none; cursor: pointer; }
.tab[aria-current="page"] { color: var(--accent); }
.tab .badge { position: absolute; top: 1px; left: calc(50% + 6px); }

/* --- building blocks ------------------------------------------------------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.pad { padding: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 13px; } .tiny { font-size: 12px; }
.text2 { color: var(--text-2); }
.bold { font-weight: 600; } .mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.section-title { margin: 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.h2 { font-size: 18px; font-weight: 700; }
.lead { font-size: 15px; color: var(--text-2); line-height: 1.5; }

.list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; padding: 13px 14px; border-top: 1px solid var(--line-soft); min-height: 52px;
        width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; color: inherit; text-decoration: none; }
.item:first-child { border-top: 0; }
button.item, a.item { cursor: pointer; }
button.item:hover, a.item:hover { background: var(--bg); }
.item .t { font-size: 15px; font-weight: 600; }
.item .s { font-size: 13px; color: var(--muted); }
.chev { color: var(--faint); flex: none; }

.btn { height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--input); background: var(--card); color: var(--text);
       font-size: 15px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
       text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: none; color: var(--accent-text); padding: 0 6px; }
.btn.small { height: 36px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.btn.block { width: 100%; height: 50px; border-radius: 12px; font-size: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.btns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 4px; }
.pill.good { background: var(--good-soft); color: var(--good-ink); } .pill.good .dot { background: var(--good-dot); }
.pill.warn { background: var(--warn-soft); color: var(--warn-ink); } .pill.warn .dot { background: var(--warn-dot); }
.pill.bad { background: var(--bad-soft); color: var(--bad-ink); } .pill.bad .dot { background: var(--bad-dot); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); } .pill.info .dot { background: var(--accent); }
.pill.grey { background: var(--chip); color: var(--text-2); } .pill.grey .dot { background: var(--faint); }
.pill.sm { padding: 3px 9px; font-size: 12px; }
.badge { min-width: 18px; height: 18px; border-radius: 9px; background: var(--bad-dot); color: #FFF; font-size: 11px; font-weight: 700;
         display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; }

.banner { display: flex; align-items: flex-start; gap: 10px; border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; text-decoration: none; }
.banner svg { flex: none; margin-top: 1px; }
.banner.info { background: var(--accent-soft); color: var(--accent-ink); }
.banner.good { background: var(--good-soft); color: var(--good-ink); }
.banner.warn { background: var(--warn-soft); color: var(--warn-ink); }
.banner.bad { background: var(--bad-soft); color: var(--bad-ink); }
.banner.grey { background: var(--chip); color: var(--text-2); }
.banner .act { margin-left: auto; font-weight: 700; color: inherit; white-space: nowrap; background: none; border: 0; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 2px; }

.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 3px; background: var(--switch-off); cursor: pointer; flex: none;
          display: flex; justify-content: flex-start; transition: background .15s; }
.switch::after { content: ""; width: 26px; height: 26px; border-radius: 13px; background: #FFF; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch[aria-checked="true"] { background: var(--accent); justify-content: flex-end; }
.switch:disabled { opacity: .5; cursor: default; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--chip); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { height: 36px; border: 0; border-radius: 8px; background: none; font-size: 14px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgba(22,32,44,.14); }
.seg .n { font-weight: 500; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding: 2px; }
.chip { flex: none; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--input); background: var(--card); color: var(--text-2);
        font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.chip .x { width: 22px; height: 22px; border-radius: 11px; border: 0; background: none; cursor: pointer; color: var(--muted); margin-right: -6px; }
.tag { display: inline-flex; align-items: center; height: 32px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--chip); font-size: 14px; gap: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 14px; font-weight: 600; }
.input { height: 46px; width: 100%; border: 1px solid var(--input); border-radius: 10px; padding: 0 12px; font-size: 16px; background: var(--card); color: var(--text); }
.input.bad { border: 2px solid var(--bad); }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search .input { padding-left: 38px; height: 44px; font-size: 15px; }

.avatar { width: 44px; height: 44px; border-radius: 12px; background: var(--chip); color: var(--text-2); display: flex; align-items: center; justify-content: center; flex: none; }
.avatar.sm { width: 36px; height: 36px; border-radius: 18px; font-size: 13px; font-weight: 700; }
.statusdot { width: 10px; height: 10px; border-radius: 5px; flex: none; }

.device { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.device .name { font-size: 16px; font-weight: 600; }
.done { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-radius: 10px; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.done.good { background: var(--good-soft); color: var(--good-ink); } .done.grey { background: var(--chip); color: var(--text-2); }

.check { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--input); background: var(--card); display: flex; align-items: center; justify-content: center; flex: none; cursor: pointer; padding: 0; }
.check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #FFF; }
.check[aria-checked="false"] svg { visibility: hidden; }

.empty { text-align: center; padding: 28px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { color: var(--faint); }
.skeleton { background: linear-gradient(90deg, var(--chip), var(--line-soft), var(--chip)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 12px; }
@keyframes sk { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 20; background: var(--text); color: var(--bg);
         padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: calc(100% - 32px); }

dialog.modal { border: 1px solid var(--modal-edge); border-radius: 18px; padding: 0; width: min(420px, calc(100% - 32px)); background: var(--modal); color: var(--text);
                box-shadow: 0 24px 70px rgba(0,0,0,.45); animation: pop .16s ease-out; }
dialog.modal::backdrop { background: rgba(6,9,14,.55); backdrop-filter: blur(6px) saturate(.8); -webkit-backdrop-filter: blur(6px) saturate(.8); animation: fade .16s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { dialog.modal, dialog.modal::backdrop { animation: none; } }
dialog.modal .m { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
dialog.modal h2 { font-size: 18px; font-weight: 700; }
dialog.modal .acts { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }

.steps { display: flex; flex-direction: column; gap: 14px; }
.step { display: flex; gap: 12px; align-items: flex-start; }
.step .n { width: 26px; height: 26px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-text); font-size: 13px; font-weight: 700;
           display: flex; align-items: center; justify-content: center; flex: none; }
.step .n.solid { width: 32px; height: 32px; border-radius: 16px; background: var(--accent); color: #FFF; font-size: 15px; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--chip); padding: 1px 6px; border-radius: 5px; }

.plan { border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: 16px; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.plan[aria-pressed="true"] { border: 2px solid var(--accent); padding: 15px; box-shadow: 0 2px 8px rgba(0,98,230,.12); }
.plan .price { font-size: 30px; font-weight: 700; letter-spacing: -.5px; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 2px solid var(--switch-off); display: flex; align-items: center; justify-content: center; flex: none; }
[aria-pressed="true"] .radio { border-color: var(--accent); }
[aria-pressed="true"] .radio::after { content: ""; width: 12px; height: 12px; border-radius: 6px; background: var(--accent); }

.footer-bar { position: sticky; bottom: 0; background: var(--card); border-top: 1px solid var(--line); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }

/* --- installer shell ------------------------------------------------------------- */
.shell { min-height: 100dvh; display: flex; }
.side { width: 248px; flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 2px;
        position: sticky; top: 0; height: 100dvh; overflow: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.nav { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 9px; color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.nav:hover { background: var(--bg); }
.nav[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.side .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 28px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
.main-inner { width: 100%; max-width: 1100px; display: flex; flex-direction: column; gap: 20px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--accent-text); }
.crumbs svg { color: var(--faint); }
.page-title { font-size: 26px; font-weight: 700; letter-spacing: -.4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tile { padding: 16px; display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; }
.tile .v { font-size: 28px; font-weight: 700; }
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; padding: 10px 12px; }
table.t td { padding: 12px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
table.t td:first-child, table.t th:first-child { padding-left: 18px; }
table.t td:last-child, table.t th:last-child { padding-right: 18px; text-align: right; }
.mobile-only { display: none; }
@media (max-width: 899px) {
  .side { display: none; }
  .main { padding: calc(14px + env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); gap: 16px; }
  .mobile-only { display: revert; }
  .iconbtn.mobile-only { display: inline-flex; }
  .desktop-only { display: none !important; }
  .page-title { font-size: 22px; }
}
@media (min-width: 900px) { .shell .tabbar { display: none; } }

/* --- sign-in / welcome ----------------------------------------------------- */
.hero { padding: calc(48px + env(safe-area-inset-top)) 24px 28px; display: flex; flex-direction: column; gap: 28px; flex: 1; max-width: 460px; margin: 0 auto; width: 100%; }
.logo { display: flex; align-items: center; gap: 12px; }
.logo .mark { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #FFF; display: flex; align-items: center; justify-content: center; }
.logo .name { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.big { font-size: 32px; line-height: 1.15; font-weight: 700; letter-spacing: -.6px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
