@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@500;600;700&family=IBM+Plex+Mono:wght@400;500;600&family=Barlow:wght@400;500;600&display=swap');

:root {
  --paper: #f2efe6;
  --paper-deep: #e8e3d4;
  --ink: #1c1a16;
  --ink-soft: #58534a;
  --line: #cfc8b4;
  --press-red: #c22a2a;
  --press-red-deep: #971f1f;
  --ok-green: #3d6b4f;
  --white: #fffdf8;
  --radius: 2px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Barlow', sans-serif;
  min-height: 100vh;
  background-image:
    linear-gradient(var(--paper) 0%, var(--paper) 100%);
}

/* Registration mark - the signature element */
.regmark {
  display: inline-block;
  width: 1em;
  height: 1em;
  position: relative;
  vertical-align: middle;
}
.regmark::before, .regmark::after {
  content: "";
  position: absolute;
  background: currentColor;
}
.regmark::before { top: 0; left: 50%; width: 1px; height: 100%; transform: translateX(-50%); }
.regmark::after { top: 50%; left: 0; width: 100%; height: 1px; transform: translateY(-50%); }
.regmark-circle {
  position: absolute;
  top: 50%; left: 50%;
  width: 0.55em; height: 0.55em;
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.topbar {
  border-bottom: 2px solid var(--ink);
  background: var(--white);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  min-height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-logo { height: 68px; width: auto; display: block; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--ink-soft);
}

.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  margin-left: 32px;
}
.topnav a {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
}
.topnav a:hover { background: var(--paper); color: var(--ink); }
.topnav a.active { color: var(--press-red); }
.role-tag {
  border: 1px solid var(--ink);
  padding: 3px 8px;
  border-radius: var(--radius);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 11px;
}
.topbar-right a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.topbar-right a:hover { border-bottom-color: var(--ink-soft); }

.wrap {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 40px clamp(16px, 4vw, 32px) 80px;
}

.page-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 6px;
}
.page-head .regmark { color: var(--press-red); font-size: 26px; }
h1 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.01em;
  margin: 0;
  text-transform: uppercase;
}
.subtitle {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 32px;
  padding-left: 40px;
}

/* Flash messages */
.flash-stack { margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border-left: 3px solid var(--ink);
}
.flash-error { background: #fbe9e7; border-left-color: var(--press-red); color: var(--press-red-deep); }
.flash-success { background: #e8f0e9; border-left-color: var(--ok-green); color: var(--ok-green); }

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}

/* Forms */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}
input[type=text], input[type=number], input[type=password], textarea {
  font-family: 'Barlow', sans-serif;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
}
input:focus, textarea:focus {
  outline: 2px solid var(--press-red);
  outline-offset: 1px;
  background: var(--white);
}
textarea { resize: vertical; min-height: 60px; font-size: 15px; }

.btn {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--white);
  padding: 12px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, color 0.12s;
}
.btn:hover { background: var(--press-red); border-color: var(--press-red); }
.btn-outline {
  background: transparent;
  color: var(--ink);
}
.btn-outline:hover { background: var(--ink); color: var(--white); }
.btn-danger { border-color: var(--press-red-deep); }
.btn-danger:hover { background: var(--press-red-deep); border-color: var(--press-red-deep); }
.btn-row { margin-top: 24px; }

/* Table (overzicht) */
.facet-card { margin-bottom: 20px; padding: 20px 24px; }
.facet-form {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: end;
}
.facet-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}
.facet-field select {
  font-family: 'Barlow', sans-serif;
  font-size: 15px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2358534a' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink);
  appearance: none;
  cursor: pointer;
}
.facet-field select:focus { outline: 2px solid var(--press-red); outline-offset: 1px; background-color: var(--white); }
.facet-reset { justify-content: flex-end; min-width: 0; }

.stats-row { margin-bottom: 18px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 220px;
  display: flex;
}
.search-box input {
  width: 100%;
}
.stats {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  gap: 18px;
}
.stats strong { color: var(--ink); }

.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
thead th {
  text-align: left;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: var(--paper-deep);
  padding: 0;
  border-bottom: 2px solid var(--ink);
}
.sort-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
th.num .sort-link { justify-content: flex-end; }
.sort-link:hover { color: var(--ink); background: rgba(28,26,22,0.04); }
.sort-link.active { color: var(--press-red); }
.sort-arrow { font-size: 11px; }
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
td[data-label="Ingevoerd"] {
  font-size: 11.5px;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--paper); }
td.mono, th.num { font-family: 'IBM Plex Mono', monospace; }
td.num { font-family: 'IBM Plex Mono', monospace; font-weight: 600; text-align: right; }
th.num { text-align: right; }
.locatie-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  background: var(--paper-deep);
  padding: 2px 7px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.btn-sm { padding: 6px 12px; font-size: 11px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:hover { background: var(--ink); border-color: var(--ink); }

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Reserveren pop-up (native <dialog>) */
.reserveer-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 28px;
  width: 100%;
  max-width: 360px;
  background: var(--white);
  box-shadow: 0 12px 32px rgba(28,26,22,0.18);
}
.reserveer-dialog::backdrop {
  background: rgba(28,26,22,0.45);
}
.reserveer-dialog h3 {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 22px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0 0 4px;
}
.reserveer-dialog .dialog-subtitle {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  margin: 0 0 20px;
}
.reserveer-dialog .field { margin-bottom: 16px; }
.reserveer-dialog .field label {
  display: block;
  margin-bottom: 6px;
}
.reserveer-dialog .field input { width: 100%; }
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.badge {
  display: inline-block;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
  padding: 3px 9px;
  border-radius: var(--radius);
}
.badge-red { background: #fbe9e7; color: var(--press-red-deep); }
.badge-green { background: #e8f0e9; color: var(--ok-green); }

/* Detail row: reserveringen + reserveerformulier per partij */
tr.detail-row td {
  padding: 10px 14px 14px;
  background: #fdf1f0;
  border-bottom: 2px solid #f3d9d6;
}
tr.detail-row:hover { background: #fdf1f0; }

.reservering-lijst {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.reservering-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 10px;
}
.reservering-item strong { color: var(--ink); font-family: 'Barlow', sans-serif; font-weight: 600; }
.gereserveerd-label {
  color: var(--press-red);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.reserveer-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.reserveer-form input[type=text] { width: 160px; max-width: 100%; padding: 8px 10px; font-size: 14px; }
.reserveer-form input[type=number] { width: 110px; max-width: 100%; padding: 8px 10px; font-size: 14px; }
.reserveer-hint {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  color: var(--ink-soft);
  margin: 0;
}
.reserveer-hint.reserveer-vol { color: var(--press-red); }

/* Admin paneel */
.admin-checkbox-field { justify-content: flex-end; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Barlow', sans-serif;
  text-transform: none;
  letter-spacing: normal;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.checkbox-label input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--press-red); }

.admin-actions { display: flex; align-items: flex-start; gap: 8px; }
.wachtwoord-reset { position: relative; }
.wachtwoord-reset summary { list-style: none; cursor: pointer; }
.wachtwoord-reset summary::-webkit-details-marker { display: none; }
.wachtwoord-form {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10;
  display: flex;
  gap: 6px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: 0 4px 14px rgba(28,26,22,0.12);
  max-width: min(260px, 90vw);
}
.wachtwoord-form input {
  width: 160px;
  max-width: 100%;
  padding: 8px 10px;
  font-size: 13px;
}

/* Order zoeken pagina */
.ordernummer-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--press-red);
}
.order-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.order-result-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 600;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.order-nummer { color: var(--press-red); }
.order-result-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-top: 4px;
}
.order-result-meta strong { color: var(--ink); font-family: 'Barlow', sans-serif; font-weight: 600; }
.order-result-action {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.order-result-action .amt {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 16px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-soft);
}
.empty-state .regmark { color: var(--line); font-size: 40px; margin-bottom: 12px; }

.recent-list { margin-top: 36px; }
.recent-list h2 {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 14px;
}
.recent-item {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14.5px;
}
.recent-item:last-child { border-bottom: none; }
.recent-item .amt { font-family: 'IBM Plex Mono', monospace; color: var(--ink-soft); }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  padding: 20px;
}
.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 44px 40px;
  width: 100%;
  max-width: 360px;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.login-logo { width: 100%; max-width: 300px; height: auto; display: block; }
.login-sub {
  text-align: center;
  color: var(--ink-soft);
  font-size: 13.5px;
  margin: 0 0 30px;
}
.login-card .field { margin-bottom: 18px; }
.login-card .btn { width: 100%; justify-content: center; }

form { margin: 0; }

@media (max-width: 900px) {
  .facet-form { gap: 14px; }
  .facet-field { min-width: 130px; flex: 1 1 130px; }
}

@media (max-width: 640px) {
  .field-grid { grid-template-columns: 1fr; }
  .wrap { padding: 24px 16px 60px; }
  .topbar { padding: 10px 16px; }
  .brand-logo { height: 50px; }
  .topnav { margin-left: 0; order: 3; width: 100%; flex-wrap: wrap; }
  .topbar-right { order: 2; }
  .facet-form { flex-direction: column; align-items: stretch; }
  .facet-field { min-width: 0; flex: 0 0 auto; }
  .facet-field select { width: 100%; }
  .facet-reset { align-items: stretch; }
  .stats-row { flex-wrap: wrap; gap: 10px 18px; }
  .order-result-action { width: 100%; justify-content: space-between; }

  /* Tabellen worden op mobiel gestapelde kaarten i.p.v. iets om zijwaarts
     doorheen te scrollen - elke rij een blokje met label + waarde. */
  .table-scroll { overflow-x: visible; }
  table { min-width: 0; border: none; background: transparent; }
  thead { display: none; }
  tbody, tr, td { display: block; width: 100%; }

  tbody > tr {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 4px 14px;
    margin-bottom: 10px;
  }

  /* Hoofdrijen met een eigen detail-rij (reserveringen/volgeboekt-melding)
     worden er visueel aan vastgeplakt tot één kaart. Rijen zonder detail-rij
     (niks gereserveerd, nog gewoon beschikbaar) blijven een losse volledige
     kaart via de generieke regel hierboven. */
  table.table-with-details tbody > tr.has-detail {
    border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-bottom: 0;
  }
  table.table-with-details tbody > tr.detail-row {
    background: var(--paper);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    margin-bottom: 14px;
    padding: 0;
  }

  tbody > tr:not(.detail-row) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--line);
    text-align: right;
    font-size: 14.5px;
  }
  tbody > tr:not(.detail-row) td:last-child { border-bottom: none; }
  tbody > tr:not(.detail-row) td[data-label]::before {
    content: attr(data-label);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    text-align: left;
    flex-shrink: 0;
  }
  tbody > tr:not(.detail-row) td.row-actions,
  tbody > tr:not(.detail-row) td.admin-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  tbody > tr.detail-row td { padding: 12px 14px 16px; border: none; }
}
