:root {
  --bg: #0b0c0e;
  --surface: #141518;
  --surface-2: #1c1e22;
  --line: #25272c;
  --ink: #ecebe7;
  --muted: #8d8f96;
  --faint: #5e6168;
  --accent: #dcbb84;
  --accent-ink: #1a1408;
  --ok: #93c4ad;
  --danger: #e08b7f;
  --radius: 18px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(var(--safe-top) + 28px) 18px calc(var(--safe-bottom) + 112px);
  outline: none;
}

a { color: inherit; }
p { margin: 0; }
h1, h2 { margin: 0; font-weight: 600; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button, textarea, input { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ type */

.page-head { margin: 4px 4px 22px; }
.page-head h1 { font-size: 34px; line-height: 1.1; letter-spacing: -0.025em; }

.kicker {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.lead {
  margin: 0 4px 26px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.5;
  color: #cfcdc7;
}

.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 14px; margin-top: 10px; }
.small { font-size: 13px; }
.hint a { color: var(--muted); text-underline-offset: 3px; }
.body { color: #d6d4cf; }
.spaced { margin-bottom: 12px; }

/* ------------------------------------------------------------ cards */

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  margin-bottom: 12px;
}

.card h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 14px;
}
.h-ref { text-transform: none; letter-spacing: 0; font-weight: 500; }

.group {
  font-size: 14px;
  color: var(--accent);
  margin: 14px 0 8px;
}
.group:first-of-type { margin-top: 0; }

.points li {
  display: flex;
  gap: 12px;
  padding: 7px 0;
  line-height: 1.4;
}
.num {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  margin-top: 0;
}

.quote {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
  letter-spacing: -0.005em;
}

.refs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ref {
  display: inline-block;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgb(220 187 132 / 0.09);
}
.lead .ref { font-family: var(--sans); vertical-align: 2px; }
.h-ref .ref { padding: 1px 7px; font-size: 12px; }

/* fold */
.fold summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.fold summary::-webkit-details-marker { display: none; }
.fold summary h2 { margin: 0; }
.fold summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 1.7px solid var(--muted);
  border-bottom: 1.7px solid var(--muted);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 0.2s;
}
.fold[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.fold[open] summary { margin-bottom: 14px; }

.rows li { padding: 12px 0; border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; padding-top: 0; }
.row-title { font-weight: 600; }
.row-text { color: #cfcdc7; margin-top: 2px; }
.rows .refs { margin-top: 8px; }

/* person */
.person {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.facts { margin-top: 10px; color: #cfcdc7; }
.facts li { padding: 2px 0; }
.card .button { margin-top: 16px; }

.link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-decoration: none;
  font-size: 18px;
}
.chev { width: 20px; height: 20px; color: var(--muted); flex: none; }

.card-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
}
.card-link > span { display: flex; align-items: baseline; gap: 10px; }
.big-num {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.notice {
  display: block;
  text-align: center;
  font-size: 14px;
  color: var(--accent);
  text-decoration: none;
  padding: 14px;
  border: 1px dashed rgb(220 187 132 / 0.35);
  border-radius: var(--radius);
}

/* ------------------------------------------------------------ controls */

.button {
  display: block;
  width: 100%;
  text-align: center;
  border: 0;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 600;
  font-size: 16px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
}
.button:active { transform: scale(0.98); opacity: 0.85; }
.button.ghost { background: var(--surface-2); color: var(--ink); }
.button.danger { color: var(--danger); }

.stack { display: grid; gap: 8px; margin-top: 16px; }
.stack .button { margin: 0; }

textarea {
  display: block;
  width: 100%;
  resize: none;
  min-height: 84px;
  max-height: 50vh;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  line-height: 1.45;
  font-size: 17px; /* >= 16px prevents iOS zoom */
  outline: none;
  transition: border-color 0.15s;
}
textarea:focus { border-color: rgb(220 187 132 / 0.5); }
textarea::placeholder { color: var(--faint); }

.compose { display: grid; gap: 10px; margin-bottom: 26px; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.segmented button {
  border: 0;
  background: none;
  padding: 9px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
}
.segmented button span { font-variant-numeric: tabular-nums; opacity: 0.7; margin-left: 4px; }
.segmented button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); }

/* list of requests */
.bitten { display: grid; gap: 8px; }
.bitte {
  display: flex;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
}
.bitte:active { background: var(--surface-2); }
.dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  border: 1.7px solid var(--accent);
}
.check { flex: none; width: 22px; height: 22px; color: var(--ok); stroke-width: 2.2; margin-left: -6px; }
.bitte-body { display: grid; gap: 6px; min-width: 0; }
.bitte-text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.bitte.answered .bitte-text { color: #bdbbb5; }
.bitte-comment {
  font-family: var(--serif);
  color: var(--ok);
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.bitte-meta { font-size: 13px; color: var(--muted); }

.empty {
  color: var(--muted);
  text-align: center;
  padding: 36px 24px;
  line-height: 1.5;
}

/* settings */
.status { margin-top: 12px; font-size: 14px; color: var(--accent); }
.steps {
  margin-top: 18px;
  counter-reset: s;
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
}
.steps li { display: flex; gap: 10px; }
.steps li::before {
  counter-increment: s;
  content: counter(s);
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 12px;
  display: grid;
  place-items: center;
  margin-top: 1px;
}
.steps strong { color: var(--ink); font-weight: 500; }

.pairs li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.pairs li:first-child { border-top: 0; padding-top: 0; }
.pairs strong { font-weight: 500; }
.pairs span { color: var(--muted); text-align: right; }
.pair-link {
  flex: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  text-decoration: none;
}
.pairs .pdf {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent);
  background: rgb(220 187 132 / 0.09);
}

/* ------------------------------------------------------------ tab bar */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px calc(var(--safe-bottom) + 8px);
  background: rgb(11 12 14 / 0.78);
  backdrop-filter: saturate(160%) blur(20px);
  -webkit-backdrop-filter: saturate(160%) blur(20px);
  border-top: 1px solid var(--line);
  z-index: 10;
}
.tabbar a {
  flex: 1;
  max-width: 140px;
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 6px 0 2px;
  text-decoration: none;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}
.tabbar svg { width: 26px; height: 26px; }
.tabbar a[aria-current] { color: var(--accent); }

/* ------------------------------------------------------------ sheet */

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: var(--surface);
  color: var(--ink);
  overflow-y: auto;
}
.sheet::backdrop { background: rgb(0 0 0 / 0.6); }
.sheet[open] { animation: rise 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }

.sheet-body {
  display: grid;
  gap: 18px;
  padding: 18px 18px calc(var(--safe-bottom) + 20px);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; }
.sheet-head .kicker { margin: 0; }
.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.icon-button svg { width: 18px; height: 18px; }

.field { display: grid; gap: 8px; }
.field > span { font-size: 13px; color: var(--muted); }
.field textarea { background: var(--bg); }
.field[hidden] { display: none; }

.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-weight: 500;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background 0.2s;
}
.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.2s;
}
.switch input:checked + .switch-track { background: var(--ok); border-color: var(--ok); }
.switch input:checked + .switch-track::after { transform: translateX(20px); background: #0f1a15; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.sheet-actions { display: grid; gap: 8px; }

/* ------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 92px);
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 20;
  white-space: nowrap;
  max-width: calc(100vw - 32px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
