/* Cubet ID portal: self-contained (strict CSP, no external fonts). */
/* Brand: Cubet: teal (#00a6a8 / #3ebfc1), deep teal sidebar, light background, as the guest portal. */
@font-face {
  font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/static/bricolage.woff2") format("woff2");
}
:root {
  color-scheme: light;
  --bg: #ecf4f4;
  --surface: #ffffff;
  --surface-2: #f5fafa;
  --sidebar: #0d4f4f;
  --sidebar-text: #e6f5f5;
  --sidebar-muted: #9cc9ca;
  --sidebar-active: #0a4040;
  --text: #091b1b;
  --muted: #606f70;
  --line: #d0dcdc;
  --accent: #00a6a8;
  --accent-2: #3ebfc1;
  --accent-soft: rgba(62, 191, 193, .16);
  --on-accent: #ffffff;
  --primary: #0d4f4f;
  --ok: #2f8f4e; --ok-soft: rgba(47, 143, 78, .12);
  --warn: #b7791f; --warn-soft: rgba(183, 121, 31, .12);
  --bad: #c53030; --bad-soft: rgba(197, 48, 48, .10);
  --off: #909898; --off-soft: #eef2f2;
  --shadow: 0 1px 2px rgba(9, 27, 27, .08), 0 8px 24px rgba(9, 27, 27, .06);
  --radius: 8px;
  --focus: 0 0 0 3px rgba(62, 191, 193, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, monospace; font-size: .88em; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.sidebar { border-right: 1px solid var(--line); background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 6px 12px 24px; color: var(--text); }
.brand .logo { display: block; width: 150px; height: auto; }
.brand:hover { text-decoration: none; }
.brand small { display: block; font-weight: 400; font-size: .74rem; color: var(--accent); letter-spacing: .14em; text-transform: uppercase; }
.nav-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .09em; color: var(--sidebar-muted); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px; color: var(--sidebar-text); font-weight: 300; }
.nav a:hover { background: var(--sidebar-active); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--sidebar-active); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding: 14px 6px 0; display: flex; align-items: center; gap: 10px; }
.side-foot .who { flex: 1; min-width: 0; }
.side-foot .who b { display: block; color: var(--text); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-foot .who span { font-size: .75rem; color: var(--sidebar-muted); }
.icon-btn { background: transparent; border: 0; color: var(--sidebar-muted); padding: 7px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { color: var(--text); background: var(--sidebar-active); }

.main { min-width: 0; padding: 28px 36px 56px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h1 { font-size: 1.55rem; line-height: 1.2; margin: 0; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 72ch; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; margin-bottom: 8px; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card h2 { font-size: 1rem; margin: 0 0 14px; letter-spacing: -.01em; }
.card.flush { padding: 0; overflow: hidden; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 14px; color: var(--text); }
.stat:hover { text-decoration: none; border-color: var(--accent-2); }
.stat .ic { width: 40px; height: 40px; border-radius: 6px; display: grid; place-items: center; }
.stat b { display: block; font-size: 1.45rem; line-height: 1.1; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .82rem; }
.ic.indigo { background: var(--accent-soft); color: var(--accent); }
.ic.green { background: var(--ok-soft); color: var(--ok); }
.ic.amber { background: var(--warn-soft); color: var(--warn); }
.ic.slate { background: var(--off-soft); color: var(--off); }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: var(--surface); align-items: center; }
.search { position: relative; flex: 1 1 260px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 36px; }
.toolbar select { flex: 0 1 190px; }
.result-count { color: var(--muted); font-size: .85rem; margin-left: auto; }

/* ---------- form controls ---------- */
input, select {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 9px 12px; min-height: 40px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent-2); box-shadow: var(--focus); background: var(--surface); }
label { display: flex; flex-direction: column; gap: 6px; font-size: .84rem; font-weight: 600; color: var(--text); margin-bottom: 16px; }
label .hint { font-weight: 400; color: var(--muted); font-size: .8rem; }
/* Help text sits under its field, so labels and fields line up across grid columns. */
label > .hint { order: 1; margin-top: -2px; }
.form-section > :last-child, .form-grid > label:last-child { margin-bottom: 0; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 600;
  padding: 9px 16px; min-height: 40px; border-radius: 6px; border: 1px solid var(--primary); cursor: pointer;
  background: var(--primary); color: var(--on-accent); transition: filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn:focus-visible { box-shadow: var(--focus); outline: none; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn.block { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-section { padding: 22px; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section h3 { margin: 0 0 4px; font-size: .95rem; }
.form-section > p { margin: 0 0 16px; color: var(--muted); font-size: .85rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; background: var(--surface-2); border-top: 1px solid var(--line); }

/* ---------- table ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
table.list td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr { position: relative; transition: background .12s; }
table.list tbody tr:hover { background: var(--surface-2); }
table.list tbody tr:last-child td { border-bottom: 0; }
.row-link { color: var(--text); font-weight: 600; }
.row-link::after { content: ""; position: absolute; inset: 0; } /* whole row clickable */
.row-link:hover { text-decoration: none; color: var(--accent); }
.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .sub { color: var(--muted); font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px !important; }

/* ---------- avatars, chips, badges ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .8rem; flex: none; letter-spacing: .02em; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; border-radius: 10px; }
.tone-0 { background: #3a3a33; color: #d9d8c6; } .tone-1 { background: #2f3a2c; color: #c9dcc0; }
.tone-2 { background: #3d3526; color: #e3d2a8; } .tone-3 { background: #3b2c2c; color: #e2c3c0; }
.tone-4 { background: #2b3638; color: #c2d6d8; } .tone-5 { background: #33303b; color: #d3cde0; }
.tone-6 { background: #3d3029; color: #e4c9b4; } .tone-7 { background: #333333; color: #d5d5d5; }
.chip { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--off-soft); color: var(--text); font-size: .8rem; white-space: nowrap; }
.team { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 4px; background: var(--accent-soft); color: var(--text); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.team small { font-weight: 500; opacity: .75; }
.team-none { background: transparent; color: var(--muted); font-weight: 500; padding-left: 0; }
.team-it { background: #e3ecfb; color: #2a4f8f; } .team-management { background: #efe6f7; color: #5b3a7a; }
.team-finance { background: #fbf0dc; color: #7a5212; } .team-hr { background: #fbe6ea; color: #8a2e43; }
.team-businessdev { background: #fdebdc; color: #8a4513; } .team-software { background: #dcf3f3; color: #0d5f60; }
.team-qa { background: #e4f4e4; color: #2d6a2d; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .78rem; font-weight: 600; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.active { background: var(--ok-soft); color: var(--ok); }
.pill.locked { background: var(--warn-soft); color: var(--warn); }
.pill.disabled { background: var(--off-soft); color: var(--off); }

/* ---------- profile / facts ---------- */
.profile { display: flex; align-items: center; gap: 18px; }
.profile h1 { margin: 0; font-size: 1.5rem; letter-spacing: -.02em; }
.profile .meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); margin-top: 6px; font-size: .88rem; align-items: center; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 22px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; margin-bottom: 3px; }
.facts dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.action { padding: 16px 0; border-bottom: 1px solid var(--line); }
.action:first-of-type { padding-top: 0; }
.action:last-child { border-bottom: 0; padding-bottom: 0; }
.action h3 { margin: 0 0 4px; font-size: .92rem; }
.action p { margin: 0 0 12px; color: var(--muted); font-size: .84rem; }
.inline { display: flex; gap: 10px; align-items: center; }
.inline select { flex: 1; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 12px 1fr; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline li::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); margin-top: 6px; box-shadow: 0 0 0 4px var(--accent-soft); }
.timeline li:not(:last-child)::after { content: ""; position: absolute; left: 4.5px; top: 22px; bottom: 0; width: 1px; background: var(--line); }
.timeline b { text-transform: capitalize; }
.timeline .when { color: var(--muted); font-size: .8rem; }

/* ---------- notices ---------- */
.alert, .notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 6px; margin: 0 0 16px; font-size: .9rem; }
.alert { background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 25%, transparent); }
.notice { background: var(--ok-soft); color: var(--ok); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.muted { color: var(--muted); } .small { font-size: .84rem; }
.rules { margin: 4px 0 18px; padding: 0; list-style: none; color: var(--muted); font-size: .84rem; }
.rules li { padding-left: 20px; position: relative; margin-bottom: 4px; }
.rules li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 700; }

/* ---------- secret / one-time password ---------- */
.secret-box { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px dashed var(--accent-2); border-radius: 6px; margin: 6px 0 18px; }
.secret-box code { font-size: 1.25rem; letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.success-mark { width: 52px; height: 52px; border-radius: 8px; display: grid; place-items: center; background: var(--ok-soft); color: var(--ok); margin-bottom: 14px; }
.success-mark svg.i { width: 26px; height: 26px; }

/* ---------- auth pages ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1000px 520px at 15% -10%, rgba(137, 136, 123, .14), transparent 60%),
              linear-gradient(180deg, #1c1d1d, #161717); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 34px 30px; }
.auth-card .brand { color: var(--text); padding: 0 0 26px; }
.auth-card .brand .logo { width: 200px; }
.auth-card h1 { font-size: 1.4rem; margin: 0 0 6px; letter-spacing: -.02em; }
.auth-card p.lead { color: var(--muted); margin: 0 0 24px; }
.auth-foot { text-align: center; color: var(--muted); font-size: .78rem; margin-top: 22px; }
.narrow { max-width: 560px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px 16px; gap: 6px; }
  .brand { padding: 0 8px 0 0; }
  .nav-label { display: none; }
  .nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .nav a span { display: none; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 0; }
  .side-foot .who { display: none; }
  .main { padding: 20px 16px 40px; }
  .hide-sm { display: none; }
  .form-grid, .facts { grid-template-columns: 1fr; }
}

/* ---------- two-factor ---------- */
img.qr { display: block; border-radius: 12px; background: #fff; padding: 8px; border: 1px solid var(--line); }
ul.codes { list-style: none; padding: 0; margin: 14px 0 20px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
ul.codes li { background: var(--surface-2); border: 1px dashed var(--line); border-radius: 8px; padding: 8px 12px; text-align: center; }
ul.codes code { font-size: 1rem; letter-spacing: .05em; user-select: all; }
ol.small { padding-left: 18px; color: var(--muted); }
textarea { font: inherit; font-family: ui-monospace, "JetBrains Mono", monospace; font-size: .85rem; color: var(--text); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; resize: vertical; outline: none; }
textarea:focus { border-color: var(--accent-2); box-shadow: var(--focus); background: var(--surface); }
.facts .wide { grid-column: 1 / -1; }

/* Wi-Fi pages */
.pill { background: var(--off-soft); color: var(--off); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
td.bad { color: var(--bad); }
table.list td .sub { color: var(--muted); font-size: .78rem; margin-top: 2px; }
table.list td input:not([type=checkbox]), table.list td select { width: 100%; min-width: 90px; }
table.list td input.narrow-input { width: 80px; min-width: 64px; }
details summary { cursor: pointer; font-weight: 600; }
pre { overflow-x: auto; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bad { color: var(--bad); }
label.check { flex-direction: row; align-items: center; gap: 8px; margin: 0; font-weight: 500; cursor: pointer; }
label.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label.check { border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; }
.checks label.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.checks label.check small { color: var(--muted); font-weight: 400; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { font-size: .84rem; font-weight: 600; margin-bottom: 8px; padding: 0; }
.rule-row { display: grid; grid-template-columns: minmax(180px, 1.2fr) minmax(170px, 1fr) minmax(260px, 2.4fr) auto; gap: 0 18px; align-items: start; padding: 18px 24px 2px; border-top: 1px solid var(--line); }
.rule-row.new { background: var(--bg); }
.rule-fixed { display: grid; grid-template-columns: 110px 1fr; gap: 0 12px; }
.rule-row .remove { margin-top: 30px; }
.rule-row:has(select option[value=fixed]:checked) .rule-teams,
.rule-row:has(select option[value=allowlist]:checked) .rule-fixed,
.rule-row:has(select option[value=machine-cert]:checked) .rule-teams { display: none; }
.rule-cert { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.rule-row:not(:has(select option[value=machine-cert]:checked)) .rule-cert { display: none; }
@media (max-width: 900px) { .rule-row { grid-template-columns: 1fr; } .rule-row .remove { margin: 0 0 16px; } }
legend .hint { font-weight: 400; color: var(--muted); font-size: .8rem; margin-left: 6px; }
.breakglass { margin-top: 1.25rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.breakglass summary { font-weight: 500; color: var(--muted); font-size: .9rem; }
.breakglass form { margin-top: .75rem; }

/* Password choice: generated (default) or typed by the admin; no script needed. */
.pw-choice { border: 0; padding: 0; margin: 0 0 4px; display: grid; gap: 10px; }
.pw-choice label.check .hint { margin-left: 4px; }
.pw-manual { display: none; margin-top: 6px; }
.pw-choice:has(input[value="manual"]:checked) .pw-manual { display: grid; }
.pw-manual p.hint { margin: -6px 0 0; color: var(--muted); font-size: .8rem; }
.action .pw-choice { margin-bottom: 12px; }
.pw-choice input[type="radio"] { min-height: 0; padding: 0; }
.pw-choice label.check .hint { order: 0; margin-top: 0; }
