/* ============================================================
   Checkly — ontwerp-tokens
   Thema: "labelbonnetjes" — elke actie is een getrapt ticketje
   dat je afscheurt. Papierachtige achtergrond, diepgroen accent.
   ============================================================ */
:root {
  --papier: #F5F2EA;
  --papier-donker: #EAE5D8;
  --inkt: #23211C;
  --inkt-zacht: #6F6A5C;
  --lijn: #DAD3C0;
  --wit: #FFFDF9;

  --accent: #1F6F5C;
  --accent-donker: #164F42;
  --accent-zacht: #DCEBE6;

  --succes: #3FA66B;
  --succes-zacht: #DFF3E7;
  --gevaar: #D9503F;
  --gevaar-zacht: #FBE4E0;

  --font-display: "Fraunces", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --straal: 14px;
  --schaduw: 0 2px 10px rgba(35, 33, 28, 0.08);
}

* { box-sizing: border-box; }

/* Robuuste fix: zorgt dat het hidden-attribuut ALTIJD wint van eigen
   display-regels (zoals .modal { display: flex } en .koppel-form { display: flex }).
   Zonder deze regel blijven elementen met een eigen 'display' zichtbaar,
   ook als ze via JavaScript op hidden = true gezet worden. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--papier);
  color: var(--inkt);
  font-family: var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

h1, h2 { font-family: var(--font-display); margin: 0; }

button, input { font-family: inherit; }

a { color: var(--accent); }

/* ---------- layout ---------- */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--papier);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 14px;
  gap: 12px;
  position: sticky;
  top: 0;
  background: var(--papier);
  z-index: 5;
  border-bottom: 1px solid var(--lijn);
}
.topbar-merk { display: flex; align-items: center; gap: 8px; }
.topbar-merk h1 { font-size: 1.3rem; color: var(--accent-donker); }
.topbar-gebruiker { display: flex; align-items: center; gap: 10px; }
.gebruiker-naam { font-size: 0.85rem; color: var(--inkt-zacht); }

.topbar--detail { justify-content: flex-start; }
.topbar-titel {
  flex: 1;
  font-size: 1.15rem;
  font-family: var(--font-display);
  font-weight: 600;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  cursor: text;
}

.btn-icoon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--wit);
  color: var(--accent-donker);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  text-decoration: none;
  box-shadow: var(--schaduw);
  cursor: pointer;
}

.content { flex: 1; padding: 14px 14px 100px; }

/* ---------- logo ---------- */
.logo-blok { text-align: center; margin-bottom: 22px; }
.logo-vinkje {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent);
  color: var(--wit);
  font-size: 1.6rem;
  margin-bottom: 10px;
}
.logo-vinkje--klein { width: 30px; height: 30px; border-radius: 9px; font-size: 1rem; margin-bottom: 0; }
.logo-blok h1 { font-size: 1.7rem; color: var(--accent-donker); }
.logo-onderschrift { color: var(--inkt-zacht); font-size: 0.9rem; margin-top: 4px; }

/* ---------- auth ---------- */
.auth-scherm { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-kaart { width: 100%; max-width: 380px; }
.auth-form { display: flex; flex-direction: column; gap: 6px; }
.auth-form label { font-size: 0.8rem; color: var(--inkt-zacht); margin-top: 10px; }
.auth-form input {
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--lijn);
  background: var(--wit);
  font-size: 1rem;
  color: var(--inkt);
}
.auth-form input:focus, .modal input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-wissel { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--inkt-zacht); }

.scheiding { display: flex; align-items: center; gap: 10px; margin: 18px 0; color: var(--inkt-zacht); font-size: 0.8rem; }
.scheiding::before, .scheiding::after { content: ""; flex: 1; height: 1px; background: var(--lijn); }

/* ---------- knoppen ---------- */
.btn {
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}
.btn--primary { background: var(--accent); color: var(--wit); margin-top: 16px; }
.btn--primary:active { background: var(--accent-donker); }
.btn--ghost { background: transparent; color: var(--inkt-zacht); border: 1px solid var(--lijn); }
.btn--google { background: var(--wit); color: var(--inkt); border: 1px solid var(--lijn); margin-top: 4px; }
.auth-google-uitleg { text-align: center; font-size: 0.78rem; color: var(--inkt-zacht); margin-top: 8px; line-height: 1.4; }
.btn--klein { width: auto; padding: 10px 16px; margin-top: 0; }

/* ---------- flash ---------- */
.flash-stack { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50; width: min(92%, 420px); }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 0.9rem; box-shadow: var(--schaduw); }
.flash--error { background: var(--gevaar-zacht); color: #8A2E22; }
.flash--success { background: var(--succes-zacht); color: #1F6B41; }

/* ---------- ticket-stack (lijsten & acties) ---------- */
.ticket-stack { display: flex; flex-direction: column; gap: 10px; }

.laad-tekst, .lege-staat { text-align: center; color: var(--inkt-zacht); margin-top: 40px; }
.lege-staat-titel { font-family: var(--font-display); font-size: 1.1rem; color: var(--inkt); margin-bottom: 6px; }
.lege-staat-tekst { font-size: 0.9rem; max-width: 300px; margin: 0 auto; line-height: 1.5; }

.ticket {
  position: relative;
  overflow: hidden;
  border-radius: var(--straal);
  background: var(--wit);
  box-shadow: var(--schaduw);
  touch-action: pan-y;
  user-select: none;
}

.ticket-achtergrond {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0 22px;
  opacity: 0;
}
.ticket-achtergrond--gereed { background: var(--succes); color: var(--wit); justify-content: flex-start; }
.ticket-achtergrond--verwijder { background: var(--gevaar); color: var(--wit); justify-content: flex-end; }

.ticket-voorgrond {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--wit);
  border-radius: var(--straal);
  will-change: transform;
}
/* geperforeerde rand — het "afscheur"-signatuurelement */
.ticket-voorgrond::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background-image: radial-gradient(circle, var(--papier) 1.6px, transparent 1.7px);
  background-size: 4px 9px;
  background-repeat: repeat-y;
  background-position: center;
}

.ticket-vinkbol {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--lijn);
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  font-size: 0.9rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ticket--gereed .ticket-vinkbol { background: var(--succes); border-color: var(--succes); color: var(--wit); }

.ticket-tekst {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.98rem;
  line-height: 1.4;
  word-break: break-word;
}
.ticket--gereed .ticket-tekst { color: var(--inkt-zacht); text-decoration: line-through; }

.ticket-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--inkt-zacht);
  margin-top: 3px;
}

.ticket-grip {
  flex-shrink: 0;
  color: var(--lijn);
  font-size: 1.1rem;
  padding: 4px;
  cursor: grab;
  letter-spacing: -2px;
}

.ticket--lijst-item { cursor: pointer; }
.ticket-inhoud { flex: 1; min-width: 0; }
.ticket-naam { font-family: var(--font-display); font-size: 1.05rem; font-weight: 600; }

.ticket-badge {
  flex-shrink: 0;
  background: var(--accent-zacht);
  color: var(--accent-donker);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 4px 10px;
}
.ticket-badge--leeg { background: var(--papier-donker); color: var(--inkt-zacht); }
.ticket-badge--succes { background: var(--succes-zacht); color: #1F6B41; }
.ticket-badge--gevaar { background: var(--gevaar-zacht); color: #8A2E22; }

.beheer-acties { display: flex; gap: 8px; padding: 0 18px 16px; }
.beheer-acties .btn { width: auto; margin-top: 0; padding: 9px 14px; font-size: 0.85rem; }
.beheer-zelf { padding: 0 18px 14px; display: block; font-size: 0.82rem; color: var(--inkt-zacht); font-style: italic; }
.btn--gevaar { background: transparent; color: var(--gevaar); border: 1px solid var(--gevaar-zacht); }

.ticket.sleep-actief { box-shadow: 0 8px 20px rgba(35,33,28,0.18); z-index: 10; }
.ticket.wordt-verwijderd { transition: transform 0.25s ease, opacity 0.25s ease, max-height 0.25s ease, margin 0.25s ease; }

/* ---------- fab ---------- */
.fab {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(calc(-50% + 190px));
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--wit);
  font-size: 1.8rem;
  line-height: 1;
  border: none;
  box-shadow: 0 6px 16px rgba(31, 111, 92, 0.4);
  cursor: pointer;
  z-index: 20;
}
.fab:active { background: var(--accent-donker); }

@media (max-width: 520px) {
  .fab { transform: none; right: 20px; left: auto; }
}

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0;
  background: rgba(35, 33, 28, 0.45);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 40;
}
.modal[hidden] { display: none; }
.modal-kaart {
  background: var(--papier);
  width: 100%; max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -6px 24px rgba(0,0,0,0.18);
}
.modal-kaart h2 { font-size: 1.2rem; margin-bottom: 14px; }
.modal-kaart input[type="text"], .modal-kaart input[type="email"] {
  width: 100%;
  padding: 13px 14px;
  border-radius: 10px;
  border: 1px solid var(--lijn);
  background: var(--wit);
  font-size: 1rem;
}
.modal-knoppen { display: flex; gap: 10px; margin-top: 16px; }
.modal-knoppen .btn { margin-top: 0; }
.modal-uitleg { font-size: 0.85rem; color: var(--inkt-zacht); margin: 0 0 12px; line-height: 1.4; }
.modal-kaart form .modal-uitleg { margin: 10px 0 0; }

.koppel-form { display: flex; gap: 8px; margin-top: 6px; }
.koppel-form input { flex: 1; }

.gekoppelde-lijst { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.gekoppelde-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--wit); border-radius: 10px; padding: 10px 12px;
  font-size: 0.9rem;
}
.gekoppelde-item span.rol { font-size: 0.75rem; color: var(--inkt-zacht); }
.gekoppelde-item button {
  background: none; border: none; color: var(--gevaar); cursor: pointer; font-size: 0.85rem;
}

@media (min-width: 600px) {
  body { background: var(--papier-donker); }
  .app-shell { box-shadow: 0 0 0 1px var(--lijn); min-height: 100vh; }
}
