:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --line: #e2e6ec;
  --text: #16191f;
  --muted: #646c7a;
  --accent: #6d28d9;
  --accent-ink: #ffffff;
  --brand: #7c3aed;
  --ok: #10794a;
  --warn: #9a6207;
  --err: #c92a3a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 20, 28, 0.05), 0 8px 24px rgba(16, 20, 28, 0.07);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }
code.url { display: inline-block; margin-top: 4px; word-break: break-all; }
h1 { font-size: 1.6rem; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 1rem; margin: 0 0 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
p { margin: 0 0 12px; }

/* ------------------------------------------------------------------ public */

body.public {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 16px 64px;
}

/* The lockup, recoloured for light backgrounds (see public/logo-light.png). */
.brandmark {
  width: 220px;
  height: auto;
  margin-bottom: 28px;
}

.card {
  width: 100%;
  max-width: 660px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px;
  box-shadow: var(--shadow);
}
.card.narrow { max-width: 400px; }
.card.center { text-align: center; }
.card h1 { margin-bottom: 8px; }
.intro { color: var(--muted); margin-bottom: 26px; }
.intro p { margin: 0 0 12px; font-size: 0.94rem; line-height: 1.6; }
.intro p:last-child { margin-bottom: 0; }
.tick { font-size: 3rem; margin-bottom: 8px; }
.logo { font-size: 1.1em; }
.fineprint { color: var(--muted); font-size: 0.82rem; margin-top: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ------------------------------------------------------------------ fields */

.field { margin-bottom: 22px; }
.field label, .inline-label {
  display: block;
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 6px;
}
.field .emoji { font-size: 1.05em; }
.req { color: var(--err); margin-left: 2px; }
.hint { color: var(--muted); font-size: 0.83rem; margin: 0 0 8px; }
.err { color: var(--err); font-size: 0.85rem; margin: 6px 0 0; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); }

input[type="text"], input[type="email"], input[type="tel"], input[type="url"],
input[type="password"], input[type="number"], input[type="date"], input[type="search"],
input[type="file"], select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.22);
}
input[type="file"] { padding: 9px 12px; }
input[type="file"]::file-selector-button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 12px; margin-right: 12px; cursor: pointer; font: inherit;
}

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; cursor: pointer; font-weight: 400 !important; margin: 0 !important;
}
.choice:has(input:checked) { border-color: var(--accent); background: rgba(109, 40, 217, 0.08); }

.rating { display: flex; flex-wrap: wrap; gap: 6px; }
.pip { cursor: pointer; }
.pip input { position: absolute; opacity: 0; width: 0; height: 0; }
.pip span {
  display: grid; place-items: center; width: 42px; height: 42px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  font-variant-numeric: tabular-nums;
}
.pip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.22); }

.check { display: flex; align-items: center; gap: 9px; margin-bottom: 18px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.check span { font-size: 0.93rem; }

/* ----------------------------------------------------------------- buttons */

button, .ghost {
  font: inherit;
  font-weight: 600;
  border-radius: 9px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
}
button:hover:not(:disabled), .ghost:hover { background: var(--surface-2); text-decoration: none; }
button.primary:hover:not(:disabled) { background: #5b21b6; border-color: #5b21b6; }
button.danger:hover:not(:disabled) { background: #a81f2d; border-color: #a81f2d; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { background: var(--err); border-color: var(--err); color: #fff; }
button.danger-outline { background: transparent; border-color: rgba(239, 95, 107, 0.5); color: var(--err); }
button.lg, .ghost.lg { padding: 13px 24px; font-size: 1rem; width: 100%; }
button.sm, .ghost.sm { padding: 5px 11px; font-size: 0.82rem; font-weight: 500; }
button.full { width: 100%; margin-bottom: 8px; }
button.icon { padding: 3px 9px; background: transparent; border-color: transparent; color: var(--muted); }
button.icon:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.ghost { display: inline-block; background: transparent; color: var(--muted); }
.inline { display: inline-flex; gap: 8px; align-items: center; }
.stack { margin-bottom: 8px; }
.actions { display: flex; gap: 10px; align-items: center; }

/* ------------------------------------------------------------------- admin */

.topbar {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-icon { width: 26px; height: 26px; border-radius: 7px; display: block; }
.topbar nav { display: flex; gap: 6px; flex-wrap: wrap; margin-right: auto; }
.topbar nav a { color: var(--muted); padding: 7px 12px; border-radius: 8px; font-size: 0.92rem; }
.topbar nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar nav a.on { background: var(--surface-2); color: var(--text); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 28px 24px 72px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .links { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 0.88rem; margin-bottom: 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}
.cols { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.rows { max-width: 720px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.narrow-field { max-width: 140px; }
.mb { margin-bottom: 18px; }

.toolbar { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs a { color: var(--muted); padding: 7px 13px; border-radius: 8px; font-size: 0.9rem; }
.tabs a:hover { background: var(--surface); text-decoration: none; }
.tabs a.on { background: var(--surface); color: var(--text); }
.tabs .count { color: var(--muted); font-size: 0.82em; margin-left: 3px; }
.search { display: flex; gap: 8px; align-items: center; }
.search input { width: 260px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.grid th {
  text-align: left; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 600; padding: 0 12px 10px;
}
table.grid td { padding: 13px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.grid.tight td { padding: 7px 12px; font-size: 0.87rem; }
table.grid tr.dim { opacity: 0.5; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; color: var(--text); }
.muted { color: var(--muted); }
.sm { font-size: 0.85rem; }
.empty { color: var(--muted); padding: 40px 0; text-align: center; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; text-transform: capitalize; }
.pill.pending { background: #fdf3e0; color: var(--warn); }
.pill.approved { background: #e3f6ec; color: var(--ok); }
.pill.rejected { background: #fdeaec; color: var(--err); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; background: var(--surface-2); color: var(--muted); font-weight: 500; }
.tag.env { background: #efe8fd; color: var(--accent); }
.tag.saved { background: #e3f6ec; color: var(--ok); }
.tag.unset { background: var(--surface-2); }

.flash { padding: 12px 16px; border-radius: 9px; margin-bottom: 18px; font-size: 0.92rem; border: 1px solid transparent; }
.flash.ok { background: #e8f8ef; border-color: #b7e6ca; color: #0d5f3a; }
.flash.err { background: #fdeef0; border-color: #f4c2c8; color: #9c1f2c; }
.flash.warn { background: #fdf5e6; border-color: #f0dbae; color: #7a4d06; }
.flash ul { margin: 8px 0 0; padding-left: 20px; }
.flash li { margin-bottom: 4px; }

dl.answers { margin: 0; }
dl.answers dt { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 16px; }
dl.answers dt:first-child { margin-top: 0; }
dl.answers dd { margin: 4px 0 0; word-break: break-word; }
a.file { display: block; padding: 2px 0; }
.retired { margin-top: 24px; color: var(--muted); }
.retired summary { cursor: pointer; font-size: 0.85rem; }

.steps { margin: 0 0 16px; padding-left: 20px; color: var(--muted); font-size: 0.92rem; }
.steps li { margin-bottom: 8px; }
.steps strong, .steps code { color: var(--text); }

@media (max-width: 860px) {
  .brandmark { width: 175px; margin-bottom: 20px; }
  .cols, .row2 { grid-template-columns: 1fr; }
  .card { padding: 24px; }
  .wrap { padding: 20px 16px 56px; }
  .search input { width: 100%; }
  table.grid { display: block; overflow-x: auto; }
}
