:root {
  --bg: #fbfbfd;
  --fg: #1d1d1f;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --card: #ffffff;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --yes: #30a46c;
  --no: #e5484d;
  --maybe: #f5a524;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --fg: #f5f5f7;
    --muted: #86868b;
    --line: #2c2c2e;
    --card: #1c1c1e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.hero {
  text-align: center;
  padding: 64px 0 48px;
}

.eyebrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0 0 16px;
}

.display {
  font-size: clamp(40px, 8vw, 64px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 20px;
}

.lead {
  font-size: 20px;
  color: var(--muted);
  margin: 0 auto 16px;
  max-width: 480px;
}

.hint {
  font-size: 14px;
  color: var(--muted);
  margin: 32px auto 0;
  max-width: 440px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.card.wide {
  max-width: none;
  margin-left: -16px;
  margin-right: -16px;
  padding: 24px 16px;
  overflow-x: auto;
}

.card h2 {
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 24px 0 8px;
}
.card h2:first-child { margin-top: 0; }
.card p { margin: 0 0 8px; }

.link, a.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.link:hover { text-decoration: underline; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
  font-weight: 500;
}
.link-btn:hover { text-decoration: underline; }

/* Form */
.form-card { padding-top: 24px; }

.radio-group {
  display: grid;
  gap: 12px;
  margin: 16px 0 24px;
}

.radio {
  display: block;
  padding: 16px 20px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--card);
}
.radio:hover { border-color: var(--muted); }
.radio.selected {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
}
.radio input { display: none; }
.radio-label {
  display: block;
  font-weight: 600;
  font-size: 17px;
}
.radio-sub {
  display: block;
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.field { margin: 16px 0; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }

.checkbox {
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--fg) !important;
  font-size: 17px !important;
  margin-bottom: 12px !important;
  cursor: pointer;
}
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.text-input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  transition: border-color 0.15s;
}
.text-input:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.text-input { resize: vertical; min-height: 80px; }

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 980px;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--accent-hover); }

/* Chips */
.chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 980px;
  font-size: 13px;
  font-weight: 500;
}
.chip-yes     { background: rgba(48, 164, 108, 0.15); color: var(--yes); }
.chip-no      { background: rgba(229, 72, 77, 0.15);  color: var(--no); }
.chip-maybe   { background: rgba(245, 165, 36, 0.15); color: var(--maybe); }
.chip-pending { background: var(--line); color: var(--muted); }

.status-line {
  margin-top: 20px;
  display: inline-flex;
  gap: 12px;
  align-items: center;
}

/* Admin table */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table .muted { color: var(--muted); }
.table .small { font-size: 12px; }
.table .comment { max-width: 200px; }
.row-yes td:first-child { font-weight: 600; }

/* ===== Admin UI ===== */
.page.admin { max-width: 1200px; }

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 48px 0 16px;
  gap: 16px;
  flex-wrap: wrap;
}
.admin-header .eyebrow { margin-bottom: 8px; }
.display-sm {
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.admin-badges { display: flex; gap: 8px; flex-wrap: wrap; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.stat {
  background: var(--card);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.stat-num {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 6px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-title {
  font-size: 18px !important;
  font-weight: 600 !important;
  text-transform: none !important;
  letter-spacing: -0.01em !important;
  color: var(--fg) !important;
  margin: 0 0 12px !important;
}

.hidden { display: none; }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 8px;
}

.btn-secondary {
  display: inline-block;
  padding: 12px 20px;
  background: var(--card);
  color: var(--fg);
  border: 1.5px solid var(--line);
  border-radius: 980px;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-secondary:hover { border-color: var(--muted); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.1s;
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }
.btn-mini.danger:hover { border-color: var(--no); color: var(--no); }

form.inline { display: inline; }

.mini-chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 500;
}
.mini-chip.ok { background: rgba(48, 164, 108, 0.15); color: var(--yes); }
.mini-chip.err { background: rgba(229, 72, 77, 0.15); color: var(--no); }
.mini-chip.muted { background: var(--line); color: var(--muted); }

.actions { white-space: nowrap; }
.actions > * { margin-right: 4px; }

.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.flash {
  padding: 12px 16px;
  border-radius: 12px;
  margin: 12px 0;
  font-size: 14px;
}
.flash-success { background: rgba(48, 164, 108, 0.15); color: var(--yes); }
.flash-error   { background: rgba(229, 72, 77, 0.15);  color: var(--no); }
.flash-info    { background: var(--line); color: var(--fg); }

.sms-preview {
  background: color-mix(in srgb, var(--accent) 6%, var(--card));
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 12px 0;
}

.preview-meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

.enter-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
}
.enter-form input { flex: 1; min-width: 200px; }
.enter-form button { white-space: nowrap; }
.error-text { color: var(--no); font-size: 14px; margin: 8px 0; }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
