/* Cloudapt look, matching the cloudapt-dashboard (Cloudapt-LLC/cloudapt-dashboard, public/styles.css):
   the same brand colours, light/dark tokens, fonts and header. Keep the two in step by hand.
   No inline styles anywhere: the Content-Security-Policy blocks them. */
:root {
  /* Cloudapt brand: logo blue #00AEEF and logo gray #6D6F71 (accent darkened for readable text). */
  --brand: #00AEEF; --brand-gray: #6D6F71;
  --bg: #f3f6f9; --surface: #ffffff; --line: #dde4ea; --fg: #2b2d2f; --muted: #5f6366;
  --accent: #007dad; --accent-soft: #e0f4fc; --on-accent: #ffffff;
  --good: #1f8a4c; --warn: #b7791f; --crit: #c2412d; --good-soft: #e5f4ea; --warn-soft: #fbf1df; --crit-soft: #fbe7e3;
  --font-display: "Quicksand Variable", "Quicksand", "Archivo Variable", "Archivo", system-ui, sans-serif;
  --font-body: "Archivo Variable", "Archivo", system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", "JetBrains Mono", ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101417; --surface: #181d21; --line: #2a3137; --fg: #e6e9ec; --muted: #a0a6ab;
    --accent: #33c1f5; --accent-soft: #0f2e3b; --on-accent: #101417;
    --good: #4cc27e; --warn: #e0a84a; --crit: #ef7a64; --good-soft: #15301f; --warn-soft: #33270f; --crit-soft: #3a1c16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101417; --surface: #181d21; --line: #2a3137; --fg: #e6e9ec; --muted: #a0a6ab;
  --accent: #33c1f5; --accent-soft: #0f2e3b; --on-accent: #101417;
  --good: #4cc27e; --warn: #e0a84a; --crit: #ef7a64; --good-soft: #15301f; --warn-soft: #33270f; --crit-soft: #3a1c16;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 20px 20px 48px; }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }
footer a { color: inherit; }
/* Privacy Policy and Terms: a comfortable reading width. */
.legal { max-width: 760px; margin: 0 auto; font-size: 15px; line-height: 1.6; }
.legal li { margin-bottom: 6px; }

/* Header: same as the dashboard's sticky bar, with "Threshold" after the Cloudapt logo. */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 3px solid var(--brand); }
.topbar .bar { max-width: 1100px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--brand-gray); text-decoration: none; border-radius: 4px; }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand img { height: 34px; width: auto; display: block; }
/* Each logo is in the page twice; show the one for the current colour scheme. */
.logo-dark { display: none !important; }
@media screen and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-dark { display: block !important; }
  :root:not([data-theme="light"]) .brand-name { color: var(--fg); }
}
@media screen {
  :root[data-theme="dark"] .logo-light { display: none !important; }
  :root[data-theme="dark"] .logo-dark { display: block !important; }
  :root[data-theme="dark"] .brand-name { color: var(--fg); }
}
.brand .divider { width: 1px; height: 24px; background: var(--line); }
.spacer { flex: 1; }
.tabs { display: flex; gap: 2px; flex-wrap: wrap; }
.tabs a { color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.tabs a:hover, .tabs a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.who { color: var(--muted); font-size: 13px; }
@media (max-width: 520px) {
  .tabs { order: 9; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs a { flex: none; padding: 5px 6px; font-size: 12.5px; }
}

h1 { font-family: var(--font-display); font-size: 24px; font-weight: 700; margin: 4px 0 8px; text-wrap: balance; }
h2 { font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 28px 0 12px; }
h2.first { margin-top: 0; }
h3 { font-family: var(--font-display); font-size: 14px; font-weight: 600; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.hint { margin: 8px 0 0; font-size: 13px; }
.spaced { margin-top: 16px; }
.eyebrow { text-transform: uppercase; letter-spacing: .07em; font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; min-width: 0; }
.narrow { max-width: 420px; margin: 40px auto; }

/* Separate borders so the rounded corners show. On narrow screens a wide table scrolls sideways on its own. */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
@media (max-width: 760px) { table { display: block; overflow-x: auto; } }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A share shown after its count (62 42%), in a fixed width so the counts above and below line up. */
.share { display: inline-block; min-width: 3.5em; margin-left: 8px; color: var(--muted); font-size: 12px; }
tfoot th, tfoot td { border-top: 1px solid var(--line); font-weight: 600; }
tfoot th { font-size: inherit; text-transform: none; letter-spacing: 0; color: inherit; }
@media (max-width: 520px) { .wide-only { display: none; } }
.nowrap { white-space: nowrap; }
.detail { font-family: var(--font-mono); font-size: 11.5px; max-width: 360px; word-break: break-word; }
.actions { text-align: right; white-space: nowrap; }
.unit-link { display: inline-block; min-width: 64px; padding: 5px 12px; border: 1px solid var(--accent); border-radius: 6px; font-weight: 700; text-align: center; text-decoration: none; }
.unit-link:hover, .unit-link:focus-visible { background: var(--accent); color: var(--on-accent); }

label { display: grid; gap: 4px; margin: 0 0 14px; font-size: 12px; font-weight: 600; color: var(--muted); }
input, select, textarea { font: inherit; font-size: 14px; font-weight: 400; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg); width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input.filter { margin: 12px 0; max-width: 320px; font-size: 13px; padding: 6px 10px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 12px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px 12px; margin: 0 0 16px; min-width: 0; }
legend { font-size: 12px; font-weight: 600; color: var(--muted); padding: 0 4px; }
label.check { display: flex; gap: 8px; align-items: baseline; font-size: 14px; font-weight: 400; color: var(--fg); margin: 8px 0 0; }
label.check input { width: auto; margin: 0; flex: none; accent-color: var(--accent); }

button, .button { display: inline-block; font: inherit; font-weight: 600; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 6px; padding: 7px 14px; text-decoration: none; }
button:hover, .button:hover { border-color: var(--accent); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
button.link { border: 0; background: none; padding: 0; color: var(--accent); font-weight: 400; text-decoration: underline; }
button:disabled { opacity: .6; cursor: progress; }
button[disabled] { cursor: not-allowed; }
form.inline { display: inline; }
/* Sign in with Google / Microsoft */
.sso-buttons { display: grid; gap: 8px; margin: 16px 0 8px; }
.button.sso { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.sso-icon { width: 18px; height: 18px; flex: none; }
.sso-name { display: inline-flex; align-items: center; gap: 8px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 12px 0 16px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 16px 0; }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.error { background: var(--crit-soft); color: var(--crit); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }
.alert.ok { background: var(--good-soft); color: var(--good); }
.notice { margin: 16px 0; padding: 10px 14px; border: 1px dashed var(--accent); border-radius: 8px; color: var(--muted); font-size: 13px; }

/* Status pills, as on the dashboard: coloured dot + label. */
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.vacant { color: var(--good); background: var(--good-soft); }
.badge.occupied { color: var(--accent); background: var(--accent-soft); }
.badge.pending { color: var(--warn); background: var(--warn-soft); }
.badge.bad { color: var(--crit); background: var(--crit-soft); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

/* WiFi details and the printable welcome card. */
.welcome { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: 10px; padding: 28px 32px; max-width: 560px; margin: 0 auto 16px; }
.welcome .card-logo { height: 30px; width: auto; display: block; margin-bottom: 16px; }
.wifi dt { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-top: 16px; }
.wifi dd { margin: 4px 0 0; }
.mono { font-family: var(--font-mono); font-size: 1.3rem; }
.mono.big { font-size: 1.8rem; letter-spacing: .04em; word-break: break-all; }

@media print {
  :root { --bg: #fff; --surface: #fff; --fg: #000; --muted: #444; --line: #bbb; }
  .no-print { display: none !important; }
  main { padding: 0; }
  .welcome { margin-top: 0; }
}

/* Shown while a page loads its data, and for pages that don't exist. */
.loading { color: var(--muted); padding: 24px 0; }
