/* Auth-gate UI — compact, dependency-free stylesheet. */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #101828;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2f5bff;
  --accent-dark: #1d43d8;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --error: #b42318;
  --error-bg: #fef3f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #121a2e;
    --surface-2: #0f1626;
    --text: #e6eaf2;
    --muted: #98a2b3;
    --line: #243049;
    --accent: #6d8dff;
    --accent-dark: #8aa3ff;
    --ok: #75e0a7;
    --ok-bg: #0d2a1e;
    --warn: #fdb022;
    --warn-bg: #2a1f07;
    --error: #fda29b;
    --error-bg: #2a1210;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}
pre { margin: 0; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; letter-spacing: -.01em; }
p { margin: 0 0 .75rem; }

/* layout */
.topbar {
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav a { color: var(--text); font-size: .92rem; }
.nav a:hover { color: var(--accent); }
.who {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: .88rem;
}
.inline { display: inline; margin: 0; }
.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 28px 20px 56px; flex: 1; }
.footer {
  text-align: center;
  color: var(--muted);
  font-size: .8rem;
  padding: 18px;
  border-top: 1px solid var(--line);
}

/* cards & grids */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.card.subtle { background: var(--surface-2); box-shadow: none; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.grid-2 .card { margin-bottom: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin-bottom: .25rem; }
.hero { max-width: 680px; margin: 6vh auto; text-align: center; }
.hero h1 { font-size: 2.2rem; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

/* tiles */
.tile {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform .12s ease, border-color .12s ease;
}
.tile:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); }
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tile-title { font-weight: 650; }
.tile-arrow { color: var(--accent); }
.tile-text { color: var(--muted); font-size: .9rem; margin: 8px 0 14px; }
.tile-path { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; color: var(--muted); }

/* typography helpers */
.lead { color: var(--muted); font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 380px; }
.sep { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; font-weight: 550; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field textarea, .field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-weight: 400;
}
.field input:focus, .field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 90px; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
.fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 0; }
.fieldset legend { padding: 0 6px; font-size: .85rem; color: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .92rem; font-weight: 400; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.35rem !important;
  letter-spacing: .18em;
  text-align: center;
  text-transform: uppercase;
}
.row { display: flex; align-items: center; }
.row.gap { gap: 10px; }
.row.wrap { flex-wrap: wrap; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .92rem;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border-color: var(--line); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: var(--error-bg); color: var(--error); border-color: color-mix(in srgb, var(--error) 30%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--error) 14%, var(--surface)); }
.btn-sm { padding: 6px 11px; font-size: .84rem; border-radius: 8px; }
.btn-block { width: 100%; }

/* alerts & badges */
.alert {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: .9rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-info { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.alert-error { background: var(--error-bg); color: var(--error); border-color: color-mix(in srgb, var(--error) 25%, transparent); }
.alert-warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .01em;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.badge-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge-error { background: var(--error-bg); color: var(--error); border-color: transparent; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -6px; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .8rem; }

/* lists, chips, tabs */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.list li:last-child { border-bottom: 0; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  font-family: inherit;
  background: var(--surface);
  cursor: pointer;
}
.chip:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 22px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs a { padding: 6px 11px; border-radius: 8px; color: var(--muted); font-size: .88rem; }
.tabs a:hover { background: var(--surface); color: var(--text); text-decoration: none; }

/* quotes, code, details */
.quote {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}
.quote p { margin: 0; white-space: pre-wrap; }
.quote-label { color: var(--muted); font-size: .78rem; margin-bottom: 6px; }
.callout {
  background: var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: 12px;
  padding: 18px;
  text-align: center;
  margin-bottom: 18px;
}
.callout-label { color: var(--muted); font-size: .8rem; margin-bottom: 8px; }
.code-big {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--accent);
  margin-bottom: 8px;
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 7px 16px; font-size: .9rem; margin: 0 0 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.details { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; background: var(--surface-2); }
.details summary { cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; }
.details[open] summary { margin-bottom: 12px; }
.mail-body {
  white-space: pre-wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  font-size: .85rem;
  overflow-x: auto;
}

/* module ordering (drag & drop) */
tr[draggable="true"] { cursor: grab; }
tr.dragging { opacity: .45; }
tr.drag-over { outline: 2px dashed var(--accent); outline-offset: -2px; }
.sort-cell { white-space: nowrap; }
.sort-value { font-variant-numeric: tabular-nums; color: var(--muted); }
.drag-handle { color: var(--muted); cursor: grab; margin-right: 6px; user-select: none; }
.sort-buttons { display: inline-flex; gap: 2px; margin-left: 6px; }
.sort-buttons .btn { padding: 2px 6px; min-width: 26px; }

/* onboarding steps */
.steps { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.step { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: .9rem; }
.step span {
  flex: 0 0 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
}

@media (max-width: 560px) {
  .container { padding: 20px 14px 40px; }
  .card { padding: 18px; }
  .who { display: none; }
  .clamp { max-width: 200px; }
  .code-big { font-size: 1.5rem; letter-spacing: .16em; }
}
