/* Dit Ook — zebra: black and white, orange accents. Mobile first. */

:root {
  color-scheme: only light; /* "only": no forced dark mode (Samsung Internet, Chrome's auto-dark) */
  --bg: #fafaf8;
  --surface: #fff;
  --line: #e7e4df;
  --line-strong: #d3cfc8;
  --ink: #111;
  --ink-soft: #34312d;
  --ink-dim: #6d6963;
  --ink-faint: #a8a39b;
  --ink-hover: #2b2b2b;
  --on-ink: #fff;
  --on-ink-soft: #e9e7e3;
  --code-bg: #f1efeb;
  --accent: #ea580c;
  --accent-text: #c2410c; /* the same orange, dark enough for small text on white */
  --accent-wash: #fff4ec;
  --danger: #b42318;
  --ok: #157a3c;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --shadow: 0 1px 2px color-mix(in srgb, var(--ink) 4%, transparent),
    0 12px 32px -16px color-mix(in srgb, var(--ink) 22%, transparent);
}

* { box-sizing: border-box; }

/* Author `display:` rules outrank the UA stylesheet's [hidden] { display: none },
   so state every hidden element wins here once, globally. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.noscript { padding: 2rem; text-align: center; }

#app {
  max-width: 34rem;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem 3rem;
}

.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* ── type ─────────────────────────────────────────────── */

.eyebrow {
  margin: 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.display {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.9rem, 7vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.lede { margin: -0.5rem 0 0; color: var(--ink-dim); }

.prose { color: var(--ink-soft); }
.prose p { margin: 0 0 0.9rem; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose em { color: var(--ink); }
.prose code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.35em;
}

.mono { font-family: var(--mono); }

.signature {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-align: center;
}

/* ── gate ─────────────────────────────────────────────── */

/* Placed from the top rather than centred, so the error line appearing under the button grows
   the card downwards and never moves the fields. */
#screen-gate { padding-top: 18dvh; }

/* ── chrome ───────────────────────────────────────────── */

.topbar {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
  padding-bottom: 0.85rem;
  border-bottom: 1.5px solid var(--ink);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.progress {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent-text);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
}

.segment {
  padding: 0.45rem 0.85rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-dim);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.segment[aria-pressed="true"] { color: var(--on-ink); background: var(--ink); }
.segment:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.link {
  padding: 0.25rem 0;
  font: inherit;
  font-size: 0.8rem;
  color: var(--ink-dim);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 60%, transparent);
  text-underline-offset: 3px;
}

.link:hover { color: var(--ink); }
.link.is-danger:hover { color: var(--danger); text-decoration-color: currentColor; }

/* ── cards & forms ────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field > span,
.field > label,
.chips-field legend {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 0.85rem 0.9rem;
  font: inherit;
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink);
  caret-color: var(--accent);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus-visible {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

input::placeholder { color: var(--ink-faint); }

/* The eye sits inside the password field, which keeps room for it on the right. */
.password { position: relative; }
.password input { padding-right: 3rem; }

.reveal-toggle {
  position: absolute;
  inset: 0 0 0 auto;
  width: 3rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink-dim);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.reveal-toggle:hover { color: var(--ink); }
.reveal-toggle[aria-pressed="true"] { color: var(--accent-text); }
.reveal-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.reveal-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.reveal-toggle .eye-off,
.reveal-toggle[aria-pressed="true"] .eye { display: none; }
.reveal-toggle[aria-pressed="true"] .eye-off { display: block; }

.btn {
  padding: 0.85rem 1rem;
  font: inherit;
  font-weight: 600;
  border: 1.5px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-primary:hover:not(:disabled) { background: var(--ink-hover); }

.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }

.row { display: flex; gap: 0.6rem; }
.row .btn { flex: 1; }

.error { margin: 0; font-size: 0.85rem; color: var(--danger); }

/* ── lock & flash ─────────────────────────────────────── */

.lock {
  padding: 0.9rem 1rem;
  font-size: 0.92rem;
  color: var(--on-ink-soft);
  background: var(--ink);
  border-radius: var(--radius);
}

.lock strong { color: var(--on-ink); }
.lock .mono { color: var(--accent); font-weight: 600; }

.flash {
  padding: 0.85rem 1rem;
  font-size: 0.92rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  animation: rise 0.25s ease;
}

.flash.is-ok {
  color: var(--ok);
  background: color-mix(in srgb, var(--ok) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
}

.flash.is-bad {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

@keyframes rise { from { opacity: 0; transform: translateY(4px); } }

/* ── reveal ───────────────────────────────────────────── */

.reveal { text-align: center; padding-top: 12vh; }

.destination {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.2rem, 9vw, 3.4rem);
  line-height: 1.1;
  color: var(--accent);
  text-wrap: balance;
  animation: reveal 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.reveal .prose { animation: rise 0.6s ease 0.6s both; }

@keyframes reveal {
  from { opacity: 0; filter: blur(14px); transform: scale(0.96); letter-spacing: 0.1em; }
}

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

/* ── wie betaalt wat ──────────────────────────────────── */

.balances {
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.balance {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--line);
}

.balance:first-child { border-top: 0; }
.balance.is-me { background: var(--accent-wash); box-shadow: inset 3px 0 0 var(--accent); }
.balance.is-me .balance-name { color: var(--ink); font-weight: 600; }
.balance-name { color: var(--ink-soft); }
.balance-amount { font-size: 0.95rem; color: var(--ink-dim); }
.balance.is-pos .balance-amount { color: var(--ok); }
.balance.is-neg .balance-amount { color: var(--danger); }

.chips-field { margin: 0; padding: 0; border: 0; min-width: 0; }
.chips-field legend { padding: 0; margin-bottom: 0.4rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.88rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}

.chip input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip:has(input:checked) { color: var(--on-ink); background: var(--ink); border-color: var(--ink); }
.chip:has(input:checked)::before { content: "✓"; font-weight: 700; color: var(--accent); }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.expenses { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }

.expense {
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.expense.is-mine { box-shadow: inset 3px 0 0 var(--accent); }

.expense-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.expense-description { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.expense-amount { white-space: nowrap; }

.expense-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.25rem;
  font-size: 0.82rem;
  color: var(--ink-dim);
}

.expense-when { white-space: nowrap; }
.expense-actions { display: flex; gap: 1rem; margin-top: 0.5rem; }
