/* Welcome Apps admin. Phone first: tabs along the bottom on a phone, along the top on a wider screen. Light and dark. */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --ink: #111827; --muted: #6b7280; --line: #e5e7eb; --field: #f3f4f6;
  --accent: #4f46e5; --accent-ink: #ffffff; --good: #15803d; --good-bg: #dcfce7; --warn: #b45309; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2; --info: #1d4ed8; --info-bg: #dbeafe; --quiet-bg: #f3f4f6;
  --radius: 14px; --shadow: 0 1px 2px rgba(17, 24, 39, .06), 0 1px 8px rgba(17, 24, 39, .04);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --surface: #151b26; --ink: #e5e7eb; --muted: #9ca3af; --line: #263041; --field: #1d2533;
    --accent: #818cf8; --accent-ink: #0b0f17; --good: #4ade80; --good-bg: #12301e; --warn: #fbbf24; --warn-bg: #352712;
    --bad: #f87171; --bad-bg: #3a1717; --info: #93c5fd; --info-bg: #172a46; --quiet-bg: #1d2533; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
h1 { font-size: 24px; margin: 4px 0 12px; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 13px; margin: 16px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }

.test-band { background: #b45309; color: #fff; text-align: center; font-size: 12px; font-weight: 700; padding: 4px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; }
.brand b { color: var(--accent); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: #fff; font-weight: 800;
  background: linear-gradient(135deg, #f97316, #ec4899 55%, #6366f1); }
.signout { margin-left: auto; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: 11px; position: relative; }
.tabs a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.is-on { color: var(--accent); }
.tabs .dot { position: absolute; top: 6px; right: calc(50% - 16px); width: 9px; height: 9px; border-radius: 50%; background: var(--bad); }
@media (min-width: 820px) {
  body { padding-bottom: 24px; }
  .tabs { position: static; border: 0; background: none; padding: 0; gap: 4px; margin-left: 12px; }
  .tabs a { flex: none; flex-direction: row; gap: 6px; padding: 8px 12px; border-radius: 10px; font-size: 14px; }
  .tabs a svg { width: 18px; height: 18px; }
  .tabs a.is-on { background: var(--field); }
  .tabs .dot { top: 6px; right: 4px; }
}

.view { max-width: 980px; margin: 0 auto; padding: 16px; outline: none; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); padding: 16px; margin-bottom: 14px; }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--field); border-radius: 12px; padding: 10px 12px; text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 12.5px; }
.stat.is-warn b { color: var(--warn); }
.stat.is-bad b { color: var(--bad); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.item { display: flex; gap: 10px; align-items: center; padding: 11px 2px; color: inherit; text-decoration: none; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { color: var(--muted); }
.empty { color: var(--muted); padding: 14px 0; text-align: center; }

.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--quiet-bg); color: var(--muted); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; }
.check small { display: block; color: var(--muted); }
.search { margin-bottom: 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips button { flex: none; }

button, .button { font: inherit; font-weight: 600; border-radius: 10px; padding: 10px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.ghost-danger { color: var(--bad); }
button.chip { min-height: 34px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
button.chip.is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.link { background: none; border: 0; color: var(--accent); padding: 6px 4px; min-height: 0; }
button:disabled { opacity: .5; cursor: default; }
.buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.buttons.end { justify-content: flex-end; }
.wide { width: 100%; }

.notice { padding: 10px 12px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: 14px; margin: 8px 0; }
.notice.bad { background: var(--bad-bg); color: var(--bad); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.good { background: var(--good-bg); color: var(--good); }
.notice:empty { display: none; }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 20px; letter-spacing: .06em; background: var(--field); border-radius: 10px; padding: 12px; text-align: center; overflow-wrap: anywhere; user-select: all; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }
.codes span { background: var(--field); border-radius: 8px; padding: 8px; text-align: center; }

.auth { max-width: 420px; margin: 8vh auto 0; }
.auth .brand { justify-content: center; margin-bottom: 18px; font-size: 18px; }
.steps { display: flex; gap: 6px; margin-bottom: 14px; }
.steps i { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps i.is-on { background: var(--accent); }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }

.sheet { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); background: var(--surface); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.sheet::backdrop { background: rgba(15, 23, 42, .45); }
.sheet > div { padding: 18px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }
@media (min-width: 820px) { .toast { bottom: 24px; } }
.log-line { padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.log-line:first-child { border-top: 0; }
.log-line .when { color: var(--muted); font-size: 12px; }
.back { display: inline-flex; gap: 4px; margin-bottom: 6px; text-decoration: none; font-weight: 600; }
.msg-text { white-space: pre-wrap; background: var(--field); border-radius: 10px; padding: 10px 12px; margin: 6px 0; }
.danger-zone { border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
@media (prefers-reduced-motion: no-preference) { .card { animation: rise .18s ease-out; } @keyframes rise { from { opacity: 0; transform: translateY(4px); } } }
.offscreen { position: fixed; left: -9999px; opacity: 0; }
.gap { height: 8px; }
.mt { margin-top: 12px; }
.link-text { margin-top: 8px; overflow-wrap: anywhere; }
.codebox.small { font-size: 13px; letter-spacing: 0; text-align: left; }
