/* Platform pages (launcher, login, account, admin). Mobile first, system fonts, no external resources. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #111827;
  --muted: #5b6474;
  --line: #dde1e7;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #b42318;
  --ok: #15803d;
  --notice: #eef4ff;
  --radius: 12px;
  --tap: 44px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b22;
    --text: #e8eaee;
    --muted: #a2a9b6;
    --line: #2b303b;
    --accent: #5b8cff;
    --accent-text: #0b1020;
    --danger: #ff7a6b;
    --ok: #4ade80;
    --notice: #1a2338;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.75rem 0 .75rem; }
p { margin: 0 0 1rem; }
main { padding: 16px; max-width: 960px; margin: 0 auto; }
main.narrow { max-width: 420px; padding-top: 10vh; }

/* Header */
.bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 1;
}
.bar .who { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.bar form { margin: 0; }

/* Forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
label { display: block; font-weight: 600; margin: 0 0 4px; }
.field { margin: 0 0 14px; }
input[type=text], input[type=password], input[type=number], select {
  width: 100%; min-height: var(--tap); padding: 8px 12px; font: inherit; color: inherit;
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
}
input:focus-visible, button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; min-height: var(--tap); }
.check input { width: 22px; height: 22px; margin: 1px 0 0; flex: none; }
.hint { color: var(--muted); font-size: .9rem; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 8px 16px; font: inherit; font-weight: 600; text-decoration: none;
  color: var(--accent-text); background: var(--accent); border: 1px solid var(--accent); border-radius: 8px; cursor: pointer;
}
button.secondary, .btn.secondary { color: var(--text); background: var(--surface); border-color: var(--line); }
button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 8px; min-height: var(--tap); font-weight: 600; }
button.wide { width: 100%; }
button svg, .btn svg { width: 20px; height: 20px; flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.actions form { margin: 0; }
.or { text-align: center; color: var(--muted); margin: 16px 0; }

/* Messages */
.msg { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; background: var(--notice); }
.msg.error { color: var(--danger); border: 1px solid currentColor; background: transparent; }
.msg.ok { color: var(--ok); border: 1px solid currentColor; background: transparent; }
.hidden { display: none !important; }

/* Launcher tiles */
.tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.tile a {
  display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%;
  padding: 16px 12px; text-align: center; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tile img { width: 56px; height: 56px; object-fit: contain; }
.tile .name { font-weight: 600; overflow-wrap: anywhere; }
.tile .desc { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }
.empty { color: var(--muted); }

/* Lists and tables */
.list { list-style: none; padding: 0; margin: 0; }
.list > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; }
.list .title { font-weight: 600; overflow-wrap: anywhere; }
.list .meta { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: .8rem; padding: 0 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.tag.on { color: var(--ok); border-color: currentColor; }
.tag.off { color: var(--danger); border-color: currentColor; }
.codes { font: 1.05rem/1.8 ui-monospace, SFMono-Regular, Consolas, monospace; padding-left: 2em; }
.codes li { white-space: nowrap; }
@media (min-width: 480px) { .codes { columns: 2; } }
.secret { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.qr { background: #fff; padding: 12px; border-radius: 8px; width: min(260px, 100%); }
.qr svg { display: block; width: 100%; height: auto; }
details > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; }

/* Number + unit pair (admin invites) */
.row { display: flex; gap: 8px; }
.row input { flex: 1; min-width: 0; }
.row select { flex: 0 0 8em; width: auto; }
