:root {
  --ink: #12121F;
  --accent: #A9AEF2;
  --accent-mid: #7F86E8;
  --accent-dim: #4B52C9;
  --accent-btn: #5F66D8;
  --mist: #5C5C73;
  --line: #CDCDDA;
  --line-soft: #EEEEF4;
  --paper: #F7F7FA;
  --amber-bg: #F3EAC8;
  --amber-fg: #5E4A0E;
  --amber-bg-2: #F6E9CF;
  --amber-fg-2: #7A4A0A;
  --green-bg: #E6F4EC;
  --green-fg: #17573A;
  --red-bg: #F6DDD3;
  --red-fg: #7A2F12;
  --lavender-bg: #E4E6FB;
  --lavender-fg: #2B2F8F;
  --tabbar-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* alleen "main" scrolt; voorkomt het iOS-stuiteffect dat de layout rafelig laat lijken */
  background: var(--paper);
  color: var(--ink);
  font-family: 'Manrope', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent-btn); outline-offset: 2px; }

.shell {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  position: relative;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #EEF0FF 0%, #E8EAFB 30%, #EFF0FB 62%, #F3F4FA 100%);
  overflow: hidden;
}

/* ---- gedeelde gradient-achtergrond met blur-cirkels, zoals in elk mockup-board ---- */
.app-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
  pointer-events: none;
}
.blob { position: absolute; border-radius: 50%; }
.blob-1 { top: -90px; left: -70px; width: 240px; height: 240px; background: var(--accent); filter: blur(70px); opacity: 0.55; }
.blob-2 { top: 140px; right: -90px; width: 280px; height: 280px; background: var(--accent-mid); filter: blur(85px); opacity: 0.4; }
.blob-3 { bottom: -110px; left: 30px; width: 260px; height: 260px; background: var(--accent-dim); filter: blur(90px); opacity: 0.28; }

.topbar {
  position: relative;
  z-index: 5;
  min-height: 60px; /* niet "height": anders drukt de safe-area-top-padding de inhoud plat achter de notch/dynamic island */
  flex-shrink: 0;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--line-soft);
}

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

.brand-mark {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 1.5px;
}
.brand-mark span { background: var(--ink); border-radius: 1.5px; }
.brand-mark span.a { grid-column: 1 / 3; grid-row: 1 / 2; }
.brand-mark span.b { grid-column: 3 / 4; grid-row: 1 / 3; }
.brand-mark span.c { grid-column: 1 / 2; grid-row: 2 / 4; }
.brand-mark span.d { grid-column: 2 / 3; grid-row: 2 / 3; background: var(--accent-mid); }
.brand-mark span.e { grid-column: 2 / 4; grid-row: 3 / 4; }

.brand-word { display: flex; flex-direction: column; gap: 2px; }
.brand-word-top { font-weight: 700; font-size: 19px; line-height: 1; letter-spacing: -0.03em; }
.brand-word-bottom { display: flex; align-items: center; gap: 5px; height: 12px; font-size: 11px; font-weight: 500; }
.brand-divider { width: 2px; height: 12px; background: var(--ink); display: inline-block; }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.screen-title {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}
.icon-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 999px;
  background: transparent;
  color: var(--mist);
}

main {
  flex: 1;
  position: relative;
  z-index: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
}

.tab {
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 20px 16px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* alleen Uploaden staat verticaal gecentreerd (altijd kort); Documenten blijft gewoon bovenaan
   beginnen, want dat kan een lange, scrollende lijst worden. */
#tab-upload {
  margin-top: auto;
  margin-bottom: auto;
}

#view-app {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.view[hidden], .tab[hidden], .tabbar[hidden], .view-auth[hidden], .view-laadscherm[hidden], .topbar[hidden] { display: none !important; }

.screen-head { display: flex; flex-direction: column; gap: 4px; }
.screen-head-row { display: flex; align-items: center; gap: 10px; }
.screen-ico { width: 28px; height: 28px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }

h1 {
  margin: 0;
  font-weight: 800;
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.muted { color: var(--mist); font-size: 14px; line-height: 1.5; margin: 0; }

form { display: flex; flex-direction: column; gap: 16px; }

label { font-size: 14px; font-weight: 600; display: block; margin-bottom: 8px; }

input[type="text"], input[type="tel"] {
  height: 48px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 16px;
  background: #FFFFFF;
  color: var(--ink);
  font-family: inherit;
}
.code-input { letter-spacing: 0.3em; }

button[type="submit"], .btn-primary {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
}
button[type="submit"]:disabled { opacity: 0.5; cursor: default; }

.link-btn {
  border: 0;
  background: transparent;
  color: var(--accent-dim);
  font-size: 14px;
  font-weight: 600;
  text-decoration: underline;
  padding: 10px 0;
  text-align: left;
  min-height: 40px;
}

.error { background: var(--red-bg); color: var(--red-fg); border-radius: 8px; padding: 12px 14px; font-size: 14px; margin: 0; }
.success { background: var(--lavender-bg); color: var(--lavender-fg); border-radius: 12px; padding: 14px 16px; font-size: 14px; margin: 0; }
.info-box { background: var(--amber-bg-2); color: var(--amber-fg-2); border-radius: 12px; padding: 14px 16px; font-size: 14px; line-height: 1.5; margin: 0; }
.push-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.push-card #push-tekst { flex: 1; }

/* ---- glasachtige kaarten, zoals elke sectie in het mockup ---- */
.glass-card {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 8px 24px rgba(31,31,74,0.08);
  border-radius: 16px;
  padding: 18px 16px;
}

.pickrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.pickbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 104px;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.pickbtn-dark { background: var(--ink); color: #FFFFFF; }
.pickbtn-light { border: 1.5px dashed var(--accent); background: #F1F2FD; color: var(--ink); }

.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label { font-size: 14px; font-weight: 600; }

.pillgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.pill-opt {
  min-height: 48px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  border: 1.5px solid var(--line);
  background: #FFFFFF;
  color: var(--ink);
}
.pill-opt.is-selected { border: 1.5px solid var(--ink); background: var(--ink); color: #FFFFFF; }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- horizontaal scrollende filterchips, geen zichtbare scrollbar ---- */
.hs { scrollbar-width: none; }
.hs::-webkit-scrollbar { display: none; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
.filter-pill {
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #FFFFFF;
  color: var(--ink);
}
.filter-pill.is-active { border: 1px solid var(--ink); background: var(--ink); color: #FFFFFF; }

#doc-list { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }

.doc-card {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 8px 24px rgba(31,31,74,0.08);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.doc-title { font-size: 15px; font-weight: 600; }
.doc-sub { font-size: 12px; color: var(--mist); }
.doc-amount { font-size: 15px; font-weight: 700; white-space: nowrap; }

.doc-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.doc-bottom-left { display: flex; align-items: center; gap: 8px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-verkoop { background: var(--lavender-bg); color: var(--lavender-fg); }
.badge-inkoop { background: #E7E7EF; color: #2A2A3D; }
.badge-bon { background: #DDF0EE; color: #0F4F4A; }
.badge-bankafschrift { background: var(--amber-bg-2); color: var(--amber-fg-2); }

.status { display: inline-block; padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; }
.status-verwerkt { background: var(--green-bg); color: var(--green-fg); }
.status-behandeling { background: var(--amber-bg); color: var(--amber-fg); }
.status-info { background: var(--red-bg); color: var(--red-fg); }

/* ---- zwevende pil-tabbalk, met glas-highlight achter het actieve icoon ---- */
.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: calc(100% - 32px);
  max-width: 448px;
  height: var(--tabbar-h);
  box-sizing: border-box;
  padding: 0 6px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: 0 8px 24px rgba(31,31,74,0.1);
  z-index: 10;
}

.tabbtn {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mist);
}
.tabbtn.is-active { color: var(--ink); font-weight: 700; }
.tab-ico { display: flex; align-items: center; justify-content: center; width: 54px; height: 30px; border-radius: 999px; }
.tabbtn.is-active .tab-ico { background: var(--lavender-bg); }

/* ---- inlogflow (LoginMobiel-ontwerp): eigen volledige-schermoverlay ---- */
.view-auth {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  background: linear-gradient(180deg, #EEF0FF 0%, #E8EAFB 30%, #EFF0FB 62%, #F3F4FA 100%);
  overflow: hidden;
}

.auth-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  box-sizing: border-box;
  padding: calc(44px + env(safe-area-inset-top)) 24px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
}

.auth-spacer { flex-grow: 1; }

.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 28px; }
.brand-mark.lg { width: 32px; height: 32px; gap: 2px; }
.brand-mark.lg span { border-radius: 2px; }
.auth-wordmark { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.auth-wordmark-top { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.auth-wordmark-bottom { display: flex; align-items: center; gap: 6px; height: 14px; font-size: 12px; font-weight: 500; color: var(--mist); }
.auth-divider { width: 2px; height: 14px; background: var(--ink); display: inline-block; }

/* ---- kort welkom-terug-schermpje (zie view-laadscherm in index.html) ---- */
.view-laadscherm {
  position: fixed;
  inset: 0;
  z-index: 24;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #EEF0FF 0%, #E8EAFB 30%, #EFF0FB 62%, #F3F4FA 100%);
  overflow: hidden;
}
.laad-inner { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.laad-spinner {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 3px solid rgba(18, 18, 31, 0.1);
  border-top-color: var(--accent-btn);
  animation: laad-spin 0.8s linear infinite;
  margin-bottom: 14px;
}
.laad-tekst { margin: 0; font-size: 13px; font-weight: 500; color: var(--mist); letter-spacing: 0.01em; }
@keyframes laad-spin { to { transform: rotate(360deg); } }

.auth-header { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; margin-bottom: 24px; }
.auth-header h1 { margin: 0; }
.auth-lead { margin: 0; max-width: 300px; font-size: 14px; line-height: 1.5; color: var(--mist); }

.auth-step { width: 100%; }
.link-btn-center { align-self: center; text-align: center; }
.link-btn-muted { color: var(--mist); text-decoration: none; margin-top: 4px; }

.auth-footer { margin: 0; font-size: 13px; color: var(--mist); text-align: center; line-height: 1.5; }
.auth-footer a { color: var(--accent-dim); text-decoration: underline; }

/* ---- Overzicht: kerncijfers, maandgrafiek, laatst geüpload (zie tab-overzicht) ---- */
.btn-shortcut {
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 600;
}

.kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.kpi-card {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 8px 24px rgba(31,31,74,0.08);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kpi-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mist);
}
.kpi-value { font-weight: 700; font-size: 22px; line-height: 1.15; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--mist); }

.maand-card, .recent-card { display: flex; flex-direction: column; gap: 16px; }
.maand-head, .recent-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.maand-head h2, .recent-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.maand-legend { display: flex; gap: 12px; font-size: 12px; color: var(--mist); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend-omzet { background: var(--ink); }
.legend-kosten { background: var(--accent); }

.maand-chart { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; }
.maand-col { display: flex; flex-direction: column; gap: 8px; }
.maand-bars { display: flex; gap: 4px; align-items: flex-end; justify-content: center; height: 150px; }
.maand-bar-wrap { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; width: 34px; height: 100%; }
.maand-bar-wrap span { font-size: 10px; }
.maand-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 2px; }
.maand-bar-omzet { background: var(--ink); }
.maand-bar-kosten { background: var(--accent); }
.maand-naam { text-align: center; font-size: 12px; font-weight: 500; border-top: 1px solid var(--line-soft); padding-top: 8px; }

.recent-head .link-btn { padding: 0 4px; }

/* ---- Meer-tab: menu met items (voorlopig allemaal 'Binnenkort') en voettekst ---- */
.meer-list { padding: 4px 16px; display: flex; flex-direction: column; }
.meer-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 64px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: transparent;
  color: var(--ink);
  text-align: left;
  width: 100%;
  font: inherit;
}
.meer-item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.meer-item-label { display: flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; }
.meer-item-sub { font-size: 13px; color: var(--mist); }
.meer-badge { font-size: 11px; font-weight: 600; color: var(--mist); background: var(--line-soft); border-radius: 999px; padding: 2px 8px; }
.meer-footer { padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.meer-footer-naam { font-size: 15px; font-weight: 600; }

/* ---- Belasting & Rapportage (sub-schermen vanuit Meer) ---- */
.sub-terug { padding: 0; align-self: flex-start; }
.fijn { font-size: 12px; }

.dark-card {
  background: var(--ink);
  border-radius: 16px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dark-card-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #C9CCF7;
}
.dark-card-value { font-weight: 700; font-size: 30px; line-height: 1.1; letter-spacing: -0.02em; color: #FFFFFF; }
.dark-card-sub { font-size: 13px; font-weight: 600; color: #FFFFFF; }

#belasting-kwartalen { display: flex; flex-direction: column; gap: 12px; }
.kwartaal-card { display: flex; flex-direction: column; gap: 14px; }
.kwartaal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kwartaal-badges { display: flex; align-items: center; gap: 6px; }
.kern-badge {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mist);
}
.status-lavender { background: var(--lavender-bg); color: var(--lavender-fg); }
.status-grijs { background: var(--line-soft); color: var(--ink); }
.kwartaal-balance { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kwartaal-balance-bedrag { font-weight: 700; font-size: 26px; line-height: 1.1; letter-spacing: -0.02em; }
.kwartaal-balance-label { font-size: 13px; font-weight: 600; }
.kwartaal-detail { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 12px; font-size: 13px; }
.kwartaal-detail-row { display: flex; justify-content: space-between; gap: 8px; }
.kwartaal-detail-row span:first-child { color: var(--mist); }
.kwartaal-detail-row span:last-child { font-weight: 500; }

.wv-card { padding: 4px 16px 10px; display: flex; flex-direction: column; }
.wv-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line-soft); }
.wv-row-header { padding: 16px 0 4px; border-bottom: 0; }
.wv-row-header .wv-label { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mist); }
.wv-label { font-size: 14px; }
.wv-value { font-size: 14px; font-weight: 500; }
.wv-row-total { border-bottom: 0; }
.wv-row-total .wv-label, .wv-row-total .wv-value { font-weight: 700; }
.wv-row-resultaat { border-bottom: 0; margin-top: 6px; border-top: 2px solid var(--ink); }
.wv-row-resultaat .wv-label, .wv-row-resultaat .wv-value { font-size: 15px; font-weight: 800; }
.wv-row-resultaat.is-negatief .wv-value { color: var(--red-fg); }

/* ---- korte bevestiging (toast), verschijnt even en verdwijnt vanzelf weer ---- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 72px);
  transform: translate(-50%, -8px);
  max-width: calc(100% - 48px);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--green-bg);
  color: var(--green-fg);
  border: 1px solid rgba(23,87,58,0.15);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(31,31,74,0.16);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
