/* pik — shared styles. Every color is a token; light on :root, dark below. */
:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #efece5;
  --border: #8f877a;          /* 3.4:1 on bg — UI borders */
  --hairline: #e1ddd4;
  --text: #1e1c19;
  --text-2: #4f4a43;          /* 7.9:1 */
  --muted: #69635a;           /* 5.6:1 */
  --accent: #c2410c;          /* 5.2:1 with white */
  --accent-ink: #ffffff;
  --accent-soft: #fde8dc;
  --accent-text: #a63a0d;     /* 6.3:1 on bg */
  --ok: #1f6f43;   --ok-soft: #dcf0e3;
  --warn: #8a5300; --warn-soft: #fbeccc;
  --bad: #b42318;  --bad-soft: #fde4e1;
  --focus: #1d4ed8;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --grid: #e4e0d7;
  --shadow: 0 1px 2px rgba(30, 28, 25, .06), 0 8px 24px rgba(30, 28, 25, .06);
  --radius: 14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #161514; --surface: #201f1d; --surface-2: #2a2926;
    --border: #807a70; --hairline: #34322e;
    --text: #f0eee9; --text-2: #cfcbc2; --muted: #aaa49a;
    --accent: #ff8a5c; --accent-ink: #1b1209; --accent-soft: #3d2418; --accent-text: #ff9e78;
    --ok: #6fd39a; --ok-soft: #173325; --warn: #f2bd5a; --warn-soft: #3a2c10; --bad: #ff8b80; --bad-soft: #401c19;
    --focus: #8ab4ff; --series-1: #3987e5; --series-2: #d95926; --grid: #2f2d2a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #161514; --surface: #201f1d; --surface-2: #2a2926;
  --border: #807a70; --hairline: #34322e;
  --text: #f0eee9; --text-2: #cfcbc2; --muted: #aaa49a;
  --accent: #ff8a5c; --accent-ink: #1b1209; --accent-soft: #3d2418; --accent-text: #ff9e78;
  --ok: #6fd39a; --ok-soft: #173325; --warn: #f2bd5a; --warn-soft: #3a2c10; --bad: #ff8b80; --bad-soft: #401c19;
  --focus: #8ab4ff; --series-1: #3987e5; --series-2: #d95926; --grid: #2f2d2a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--font); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }

/* ---------- header / footer ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 14px max(20px, env(safe-area-inset-left)); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 750; font-size: 20px; letter-spacing: -0.02em; }
.brand img { width: 32px; height: 32px; border-radius: 8px; display: block; }
.top .spacer { flex: 1; }
.foot { margin-top: auto; padding: 18px 20px max(22px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: center; }
.foot a { color: var(--muted); }
.foot .dot { opacity: .6; }

/* ---------- theme switcher ---------- */
.theme { display: inline-flex; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 999px; padding: 3px; gap: 2px; }
.theme button { appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: 28px; }
.theme button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.theme .lbl { display: none; }
@media (min-width: 640px) { .theme .lbl { display: inline; } }

/* ---------- controls ---------- */
.btn { appearance: none; border: 1px solid transparent; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 650; padding: 12px 18px; border-radius: 12px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; text-decoration: none; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.subtle { background: var(--surface-2); color: var(--text); border-color: var(--hairline); }
.btn.danger { background: var(--bad); color: var(--surface); }
.btn.sm { padding: 6px 12px; min-height: 34px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-height: 48px; width: 100%;
}
input::placeholder { color: var(--muted); }
label { font-weight: 600; display: block; margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.msg { border-radius: 10px; padding: 10px 14px; margin: 0 0 14px; font-size: 15px; }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.warn { background: var(--warn-soft); color: var(--warn); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 14px; font-weight: 600; padding: 8px 6px; border-radius: 9px; cursor: pointer; min-height: 38px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- screen (computer) ---------- */
body.screen { overflow: hidden; }
.stage { flex: 1; display: grid; place-items: center; padding: 8px 24px 0; }
.hero { display: grid; grid-template-columns: auto minmax(280px, 520px); gap: clamp(28px, 6vw, 88px); align-items: center; }
.qr-tile { background: #ffffff; border-radius: 28px; padding: clamp(16px, 2.2vw, 28px); box-shadow: var(--shadow); border: 1px solid var(--hairline); position: relative; }
.qr-tile svg { display: block; width: clamp(240px, 38vmin, 460px); height: auto; }
.qr-tile .qr-wait { width: clamp(240px, 38vmin, 460px); aspect-ratio: 1; display: grid; place-items: center; color: #5a554d; font-size: 15px; }
.kicker { text-transform: uppercase; letter-spacing: .14em; font-size: 13px; font-weight: 700; color: var(--accent-text); margin-bottom: 14px; }
.hero h1 { font-size: clamp(34px, 4.6vw, 64px); font-weight: 800; letter-spacing: -0.035em; margin-bottom: 18px; }
.hero .lede { font-size: clamp(17px, 1.5vw, 21px); color: var(--text-2); max-width: 30em; }
.code-row { margin: 26px 0 22px; display: flex; flex-direction: column; gap: 6px; }
.code-row .small { font-size: 15px; color: var(--muted); }
.code { font-family: var(--mono); font-weight: 700; font-size: clamp(30px, 3.4vw, 46px); letter-spacing: .12em; color: var(--text); }
.status { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; padding: 8px 14px 8px 12px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.status .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.status.live { background: var(--ok-soft); color: var(--ok); }
.status.live .pulse { background: var(--ok); }
.status.wait .pulse { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.fs-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 22px; }
.tip { font-size: 14px; color: var(--muted); margin-top: 14px; max-width: 34em; }
kbd { font-family: var(--mono); font-size: .9em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; background: var(--surface); color: var(--text); }
@media (max-width: 860px) {
  body.screen { overflow: auto; }
  .hero { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .hero .lede, .tip { margin-left: auto; margin-right: auto; }
  .fs-row { justify-content: center; }
}

.opening { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 40; text-align: center; padding: 24px; }
.opening .big { font-size: clamp(28px, 4vw, 54px); font-weight: 800; letter-spacing: -0.03em; }
.opening .host { font-family: var(--mono); color: var(--accent-text); }
.player { position: fixed; inset: 0; background: #000; z-index: 30; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player .bar { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; opacity: 0; transition: opacity .25s; z-index: 2; }
.player:hover .bar, .player .bar:focus-within, .player.show-bar .bar { opacity: 1; }
.player .bar .btn { background: rgba(20, 20, 20, .78); color: #fff; border-color: rgba(255, 255, 255, .25); }
.player .note { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); background: rgba(20, 20, 20, .85); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; max-width: min(92vw, 640px); text-align: center; z-index: 2; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; z-index: 60; box-shadow: var(--shadow); max-width: min(92vw, 560px); text-align: center; }

/* ---------- remote (phone) ---------- */
.phone { width: 100%; max-width: 520px; margin: 0 auto; padding: 4px 16px 0; }
.phone h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px; }
.conn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-weight: 600; margin-bottom: 18px; font-size: 15px; }
.conn .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.conn.live { background: var(--ok-soft); color: var(--ok); } .conn.live .pulse { background: var(--ok); }
.conn.away { background: var(--warn-soft); color: var(--warn); } .conn.away .pulse { background: var(--warn); }
.conn.gone { background: var(--bad-soft); color: var(--bad); } .conn.gone .pulse { background: var(--bad); }
.url-input { font-size: 18px !important; min-height: 56px !important; }
.send { min-height: 56px; font-size: 18px; margin-top: 12px; }
.help { font-size: 14px; color: var(--muted); margin: 8px 2px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; border: 1px solid var(--hairline); background: var(--surface); color: var(--text); font: inherit; font-size: 14px; padding: 8px 12px; border-radius: 999px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 38px; }
.section-h { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; }
.code-input { font-family: var(--mono); font-size: 28px !important; letter-spacing: .2em; text-align: center; text-transform: uppercase; min-height: 64px !important; }
.gap-top { margin-top: 26px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }

/* ---------- legal / simple pages ---------- */
.narrow { width: 100%; max-width: 760px; margin: 0 auto; padding: 8px 20px 24px; }
.narrow h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; }
.narrow h2 { font-size: 21px; margin-top: 1.8em; }
.narrow li { margin-bottom: .4em; }
.narrow table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 0 0 1em; }
.narrow th, .narrow td { text-align: left; border-bottom: 1px solid var(--hairline); padding: 8px 6px; vertical-align: top; }
.effective { color: var(--muted); font-size: 15px; }
.cl-entry { border-left: 3px solid var(--accent); padding-left: 16px; margin-bottom: 26px; }

/* ---------- admin ---------- */
.admin-wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 20px 20px; }
.auth-box { max-width: 420px; margin: 6vh auto 0; }
.auth-box h1 { font-size: 26px; }
.qr-mfa { background: #ffffff; padding: 14px; border-radius: 12px; display: inline-block; border: 1px solid #dddddd; }
.qr-mfa svg { display: block; width: 200px; height: 200px; }
.secret { font-family: var(--mono); font-size: 14px; word-break: break-all; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; font-family: var(--mono); font-size: 16px; background: var(--surface-2); padding: 14px; border-radius: 10px; margin-bottom: 14px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin: 4px 0 20px; overflow-x: auto; }
.tabs button { appearance: none; background: none; border: 0; border-bottom: 3px solid transparent; color: var(--text-2); font: inherit; font-weight: 650; padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--hairline); border-radius: 12px; padding: 14px 16px; }
.tile .k { font-size: 13px; color: var(--muted); font-weight: 600; }
.tile .v { font-size: 30px; font-weight: 750; letter-spacing: -0.02em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 13px; color: var(--text-2); }
.tile.alert { border-color: var(--bad); background: var(--bad-soft); }
.tile.alert .v, .tile.alert .k, .tile.alert .s { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 16px; }
.card h2 { font-size: 17px; margin-bottom: 12px; }
.chart-wrap { position: relative; }
.chart-wrap canvas { width: 100%; height: 260px; display: block; }
.legend { display: flex; gap: 18px; font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.legend .l1 i { background: var(--series-1); } .legend .l2 i { background: var(--series-2); }
.tooltip { position: absolute; pointer-events: none; background: var(--surface); color: var(--text); border: 1px solid var(--hairline); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 10px; font-size: 13px; white-space: nowrap; z-index: 5; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; color: var(--muted); font-weight: 650; font-size: 13px; padding: 8px; border-bottom: 1px solid var(--hairline); white-space: nowrap; }
table.data td { padding: 8px; border-bottom: 1px solid var(--hairline); vertical-align: top; font-variant-numeric: tabular-nums; }
table.data td.n, table.data th.n { text-align: right; }
table.data tr.fail td { background: var(--bad-soft); color: var(--bad); }
.table-scroll { overflow-x: auto; }
.bars li { list-style: none; display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; }
.bars { margin: 0; padding: 0; }
.bars .bar { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: var(--series-1); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; align-items: end; }
.filters > div { flex: 1 1 180px; }
.filters label { font-size: 13px; }
.filters input, .filters select { min-height: 40px; padding: 8px 10px; }
.ua { color: var(--muted); font-size: 12px; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 15px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }

/* ---------- phone: scan-first flow ---------- */
.gap-sm { margin-top: 10px; }
body.no-scroll { overflow: hidden; }
.scanner { position: fixed; inset: 0; background: #000; z-index: 80; }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; left: 50%; top: 46%; width: min(72vw, 340px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 24px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); border: 3px solid #ffffff; }
.scan-top { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 16px; right: 16px; text-align: center; color: #ffffff; font-weight: 650; font-size: 17px; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.scan-bottom { position: absolute; bottom: max(28px, env(safe-area-inset-bottom)); left: 0; right: 0; display: flex; justify-content: center; }
.scan-bottom .btn { background: rgba(20, 20, 20, .8); color: #ffffff; border-color: rgba(255, 255, 255, .35); min-width: 140px; }
.phone-link { display: none; margin: 0 0 18px; }
@media (max-width: 860px) { .phone-link { display: block; } }

/* ---------- admin on phones ---------- */
.top .btn { white-space: nowrap; }
@media (max-width: 640px) {
  .admin-wrap { padding: 0 12px 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tile { padding: 10px 12px; }
  .tile .v { font-size: 24px; }
  .tile .k, .tile .s { font-size: 12px; }
  .card { padding: 14px; }
  .chart-wrap canvas { height: 200px; }
  .tabs button { padding: 10px 10px; }
  /* activity tables become stacked entries */
  #latest thead, #logTable thead { display: none; }
  #latest tbody, #logTable tbody { display: block; }
  #latest tr, #logTable tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 8px; border-bottom: 1px solid var(--hairline); border-radius: 8px; }
  #latest td, #logTable td { border: 0; padding: 0; background: transparent !important; min-width: 0; overflow-wrap: anywhere; }
  #latest tr.fail, #logTable tr.fail { background: var(--bad-soft); }
  #latest td:nth-child(1), #logTable td:nth-child(1) { grid-column: 2; grid-row: 1; font-size: 12px; color: var(--muted); white-space: nowrap; }
  #latest td:nth-child(2), #logTable td:nth-child(2) { grid-column: 1; grid-row: 1; font-weight: 700; }
  #latest td:nth-child(3), #logTable td:nth-child(4) { grid-column: 1 / -1; font-size: 13px; }
  #latest td:nth-child(4) { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
  #logTable td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; font-size: 12px; color: var(--muted); }
  #logTable td:nth-child(5) { grid-column: 1; font-size: 12px; }
  #logTable td:nth-child(5) .chip { min-height: 28px; padding: 3px 10px; font-size: 12px; }
  #logTable td:nth-child(6) { grid-column: 1 / -1; max-width: none; }
  #latest tr.fail td, #logTable tr.fail td { color: var(--bad); }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
}

/* ---------- sign-in (Tooly SSO first) ---------- */
.sso-btn { min-height: 56px; font-size: 18px; gap: 10px; }
.sso-btn img { border-radius: 6px; background: #ffffff; }
.center { text-align: center; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; margin: 18px 0 16px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }
.local-form label { font-size: 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--accent); }
.link-btn { appearance: none; background: none; border: 0; color: var(--accent-text); font: inherit; text-decoration: underline; cursor: pointer; padding: 4px; }
.bg-banner { background: var(--bad); color: var(--surface); padding: 10px 20px; font-size: 14px; text-align: center; padding-top: max(10px, env(safe-area-inset-top)); }
.bg-banner + .top { padding-top: 14px; }

/* ---------- account + admin additions ---------- */
.narrow-wrap { max-width: 820px; }
.page-h { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 16px; }
.card h3 { font-size: 15px; margin: 0 0 10px; }
.small { font-size: 13px; font-weight: 500; }
.danger-zone { border-color: var(--bad); }
code { font-family: var(--mono); font-size: .92em; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
ul.plain { margin: 6px 0 0; padding-left: 18px; }
ul.cov { list-style: none; margin: 0; padding: 0; }
ul.cov li { padding: 8px 0; border-bottom: 1px solid var(--hairline); font-weight: 600; }
ul.cov li.ok { color: var(--ok); }
ul.cov li.bad { color: var(--bad); }
ul.cov li.sub { font-weight: 400; color: var(--text-2); padding-left: 18px; font-size: 14px; }
.warn-card { border-color: var(--bad); }
td.actions { white-space: nowrap; }
td.actions .btn { margin: 2px 4px 2px 0; }
.btn.danger { background: var(--bad); color: var(--surface); }
@media (max-width: 640px) {
  table.users thead { display: none; }
  table.users tr { display: grid; grid-template-columns: 1fr; padding: 10px 4px; border-bottom: 1px solid var(--hairline); }
  table.users td { border: 0; padding: 2px 4px; }
  td.actions { white-space: normal; }
  .top { flex-wrap: wrap; }
}

/* ---------- admin email settings ---------- */
.span2 { grid-column: 1 / -1; }
.grid2.tight { gap: 0 16px; margin-bottom: 0; }
fieldset.svc { border: 1px solid var(--hairline); border-radius: 12px; padding: 12px 16px 4px; margin: 0 0 16px; }
fieldset.svc legend { font-weight: 700; padding: 0 6px; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.test-mail { border-top: 1px solid var(--hairline); padding-top: 16px; }

/* ---------- identity: who is signed in ---------- */
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 12px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.identity-line .avatar { width: 40px; height: 40px; font-size: 15px; }
.idmenu { position: relative; }
.id-chip { appearance: none; display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 3px; font: inherit; font-size: 14px; cursor: pointer; min-height: 38px; max-width: 260px; }
.id-chip .id-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.id-tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.id-tag.bad { background: var(--bad-soft); color: var(--bad); }
.id-pop { position: absolute; right: 0; top: calc(100% + 6px); width: 290px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; z-index: 50; }
.id-head { display: flex; gap: 12px; align-items: center; padding: 8px 8px 12px; border-bottom: 1px solid var(--hairline); margin-bottom: 6px; }
.id-who { display: flex; flex-direction: column; min-width: 0; }
.id-who > * { overflow: hidden; text-overflow: ellipsis; }
.id-item { display: block; width: 100%; text-align: left; appearance: none; background: none; border: 0; font: inherit; color: var(--text); padding: 9px 10px; border-radius: 9px; text-decoration: none; cursor: pointer; }
.id-item:hover, .id-item:focus-visible { background: var(--surface-2); }
.identity-line { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface-2); border-radius: 12px; margin-bottom: 16px; font-size: 15px; }
.welcome-banner { background: var(--ok-soft); color: var(--ok); padding: 6px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 14px; font-size: 14px; }
.welcome-banner .identity-line { background: transparent; margin: 0; padding: 4px 0; }
.welcome-banner a { color: var(--ok); font-weight: 600; }
.ref code { font-size: 14px; }
@media (max-width: 640px) { .id-chip .id-name, .id-chip .id-tag { display: none; } .id-chip { padding: 3px; } }
