/* Focus Bonnetjes — huisstijl: navy #273346, accent zacht beige/rust */

:root {
  --navy: #273346;
  --navy-deep: #1c2533;
  --navy-soft: #3a4a64;
  --accent: #c9a26a;
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #273346;
  --muted: #6b7686;
  --border: #e4e0d8;
  --success: #2f7a4a;
  --danger: #b3261e;
  --shadow: 0 2px 8px rgba(39, 51, 70, 0.06);
  --radius: 14px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

/* Lucide-style stroke iconen — defaults zodat we 'm niet elke keer hoeven uit te schrijven */
.icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  flex-direction: column;
}

/* Topbar */
.topbar {
  background: var(--navy);
  color: white;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.12);
}
.topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.2px;
  min-width: 0;
}
.topbar-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(201, 162, 106, 0.18);
  flex-shrink: 0;
}
.version-tag {
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.topbar-account {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(201, 162, 106, 0.18);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: uppercase;
  line-height: 1;
  user-select: none;
}
.icon-btn {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  padding: 7px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover,
.icon-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: white;
  outline: none;
}
.icon-btn:active {
  background: rgba(255, 255, 255, 0.14);
}

/* App container */
.app {
  flex: 1;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 18px 40px;
}

.view { animation: fadeIn 0.2s ease; }
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero (login screen) */
.hero {
  text-align: center;
  margin: 32px 0 28px;
}
.hero h1 {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

/* Login: "verkeerd account"-melding + resetlink */
.login-hint {
  background: #fff8e1;
  border: 1px solid #f0c674;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.45;
  color: #6b4f00;
  margin-bottom: 18px;
}
.login-hint[hidden] { display: none; }
.login-hint p { margin: 0 0 6px; }
.login-hint p:last-child { margin-bottom: 0; }
.login-hint-title { font-weight: 600; }
.login-hint-email { font-weight: 600; word-break: break-all; }
.login-hint strong { font-weight: 600; }

.link-reset {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  font-family: inherit;
  text-decoration: underline;
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.link-reset:hover, .link-reset:focus-visible { color: var(--navy); outline: none; }
.link-reset:disabled { opacity: 0.55; cursor: not-allowed; }

/* Jaarwissel-banner (hergebruikt .login-hint kleurpalet) */
.year-banner { margin: 0 0 14px; }
.year-banner .btn { width: auto; margin-top: 8px; }
.year-banner[hidden] { display: none; }

/* Offline-wachtrij banner */
.queue-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: var(--navy);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.queue-banner:active { transform: scale(0.99); }
.queue-banner .icon { color: var(--accent); }
.queue-banner[hidden] { display: none; }

/* Maandstatus-kaart */
.month-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 6px 0 16px;
  overflow: hidden;
}
.month-card[hidden] { display: none; }
.month-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
.month-card summary::-webkit-details-marker { display: none; }
.month-card-left { display: inline-flex; align-items: center; gap: 8px; }
.month-card-info { color: var(--muted); font-size: 13px; text-align: right; }
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e2a33c;
  flex-shrink: 0;
}
.status-dot[hidden] { display: none; }
.month-card-body {
  padding: 4px 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.month-card-body .btn { width: auto; align-self: flex-start; }
.month-cats { display: flex; flex-direction: column; gap: 4px; padding-top: 8px; }
.month-cat {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--text);
}
.month-cat span { color: var(--muted); }
.month-flag { font-size: 13px; border-radius: 8px; padding: 8px 10px; }
.month-flag.warn { background: #fff8e1; border: 1px solid #f0c674; color: #6b4f00; }
.month-flag.ok { background: #edf6ef; border: 1px solid #bcdcc6; color: var(--success); }
.month-unscanned {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 3px;
}

/* Pagina-badge op de preview (multi-foto-bon) */
.page-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: white;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 999px;
}
.page-badge[hidden] { display: none; }

/* Duplicaat-waarschuwing in het formulier */
.dup-warning { align-items: flex-start; }
.dup-warning-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.dup-warning-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dup-warning-actions .btn { width: auto; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius);
  border: none;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.04s ease, background 0.15s ease;
  width: 100%;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-large {
  padding: 16px 22px;
  font-size: 17px;
  border-radius: var(--radius-lg);
}

.btn-primary {
  background: var(--navy);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--navy-soft); }

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.btn-secondary:hover:not(:disabled) { background: #fafaf7; }

.btn-icon {
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
  border-radius: 10px;
  width: auto;
}
.btn.icon-text { display: inline-flex; align-items: center; gap: 6px; }
.btn.btn-icon-only { padding: 8px; aspect-ratio: 1; min-width: 36px; justify-content: center; }

.crop-toolbar {
  display: flex;
  gap: 8px;
  margin: -8px 0 14px;
  flex-wrap: wrap;
}
.crop-toolbar[hidden] { display: none; }

.crop-editor {
  margin: -6px 0 18px;
  padding: 10px;
  border: 1px solid rgba(39, 51, 70, 0.16);
  border-radius: 8px;
  background: white;
}
.crop-editor[hidden] { display: none; }
.crop-canvas-wrap {
  display: flex;
  justify-content: center;
  overflow: auto;
  border-radius: 6px;
  background: #111923;
  touch-action: none;
}
#crop-canvas {
  display: block;
  max-width: 100%;
  touch-action: none;
  cursor: grab;
}
#crop-canvas:active {
  cursor: grabbing;
}
.crop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

/* Capture buttons */
.capture-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 36px 0 16px;
}

/* Preview */
.preview {
  position: relative;
  background: var(--navy-deep);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  overflow: hidden;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  display: block;
}
.preview-pdf {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 40px 20px;
  color: white;
  font-size: 14px;
  text-align: center;
  word-break: break-all;
}
.preview-clear {
  position: absolute;
  top: 10px;
  right: 10px;
}

/* OCR status */
.ocr-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 15px;
  margin-bottom: 16px;
}
.ocr-status[hidden] { display: none; }

/* Spinner */
.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(39, 51, 70, 0.15);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 16px; height: 16px; border-width: 2px; }
.btn-primary .spinner {
  border-color: rgba(255,255,255,0.3);
  border-top-color: white;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Form */
.form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: none;
  padding: 0;
  margin: 0;
}
.field label, .field legend {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  padding: 0;
}
.field input[type="text"],
.field input[type="number"],
.field input[type="date"],
.field input[type="password"],
.field select {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 16px; /* 16px voorkomt zoom-in op iOS */
  font-family: inherit;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.field input:focus, .field select:focus {
  border-color: var(--navy);
}
.field select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%236b7686' d='M6 8L0 0h12z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.row { display: flex; gap: 12px; }
.row .grow { flex: 1; }

/* Segmented control */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--card);
  padding: 4px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.segmented-grid {
  /* 4 rijen × 2 kolommen voor 8 categorieën */
  grid-auto-rows: 1fr;
}
.segmented label {
  display: block;
  padding: 0;
  cursor: pointer;
}
.segmented input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label span {
  display: block;
  text-align: center;
  padding: 10px 8px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  transition: all 0.15s ease;
}
.segmented input[type="radio"]:checked + span {
  background: var(--navy);
  color: white;
}

/* Done view */
.view#view-done {
  text-align: center;
  padding-top: 40px;
}
.done-icon {
  width: 72px;
  height: 72px;
  background: var(--success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
#view-done h2 { margin: 0 0 8px; font-size: 22px; }
#view-done .btn { margin-top: 28px; }

/* Date warning banner */
.warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #fff8e1;
  border: 1px solid #f0c674;
  border-radius: 10px;
  font-size: 14px;
  color: #6b4f00;
  margin-top: -4px;
}
.warning[hidden] { display: none; }
.warning-icon { color: #b3261e; margin-top: 1px; }

/* Inbox view */
.inbox-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 18px;
}
.inbox-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
}
.inbox-account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}
.inbox-account-row strong {
  color: var(--text);
  font-weight: 500;
}
.inbox-account-row .link {
  background: none;
  border: none;
  color: var(--navy);
  font-size: 13px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  padding: 4px 8px;
}

.inbox-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 30px 18px;
  color: var(--muted);
}
.inbox-status[hidden] { display: none; }
.inbox-empty[hidden] { display: none; }
.inbox-empty { padding: 40px 0; }

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.mail-card-from {
  font-weight: 500;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.mail-card-mailbox {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}
.mail-card-subject {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--text);
  line-height: 1.3;
}
.mail-card-attachments {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.mail-attachment-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s ease;
}
.mail-attachment-btn:hover { background: #ece9e0; }
.mail-attachment-btn:active { transform: scale(0.99); }
.mail-attachment-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-attachment-size {
  font-size: 12px;
  color: var(--muted);
}

.mail-skip-btn {
  display: block;
  margin-top: 10px;
  padding: 6px 10px;
  background: transparent;
  color: var(--muted);
  border: none;
  border-top: 1px dashed var(--border);
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  border-radius: 0;
  padding-top: 10px;
}
.mail-skip-btn:hover {
  color: var(--danger);
}
.mail-skip-btn-confirm {
  color: var(--danger) !important;
  font-weight: 500;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--navy-deep);
  font-size: 12px;
  font-weight: 600;
  border-radius: 10px;
  padding: 2px 8px;
  margin-left: 4px;
  min-width: 22px;
}
.badge[hidden] { display: none; }

/* Helpers */
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--navy-deep);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
  max-width: 90vw;
  z-index: 100;
  animation: toastIn 0.2s ease;
  display: flex;
  align-items: center;
  gap: 14px;
}
.toast.error { background: var(--danger); }
.toast-action {
  background: transparent;
  color: var(--accent);
  border: none;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  text-decoration: underline;
}
.toast-action:hover { color: white; }
@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
