/* ─── FONTS ──────────────────────────────────────────────────── */
@font-face {
  font-family: 'Norwester';
  src: url('norwester.otf') format('opentype');
  font-weight: normal;
  font-display: swap;
}

/* ─── DESIGN TOKENS ──────────────────────────────────────────── */
:root {
  color-scheme: light;
  --red:        #E10816;
  --red-dark:   #B00612;
  --red-light:  rgba(225, 8, 22, 0.10);
  --black:      #111111;
  --white:      #FFFFFF;
  --bg:         #F4F4F8;
  --page-bg:    #1A1A2D;
  --surface:    #FFFFFF;
  --border:     #E2E2E2;
  --muted:      #777777;
  --success:    #1A8A3C;
  --warning:    #C47A00;
  --font-display: 'Norwester', 'Arial Black', sans-serif;
  --font-body:    'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   16px;
  --r-full: 9999px;
}

/* ─── RESET ──────────────────────────────────────────────────── */
#ddt-root *, #ddt-root *::before, #ddt-root *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
#ddt-root p, #ddt-root h1, #ddt-root h2, #ddt-root h3,
#ddt-root h4, #ddt-root h5, #ddt-root h6,
#ddt-root ul, #ddt-root ol, #ddt-root li,
#ddt-root figure, #ddt-root blockquote {
  margin: 0;
  padding: 0;
}
#ddt-root ul, #ddt-root ol { list-style: none; }
#ddt-root button { cursor: pointer; }
#ddt-root button:focus, #ddt-root button:focus-visible { outline: none; }
#ddt-root input:not([type="checkbox"]):not([type="radio"]), #ddt-root textarea, #ddt-root select { appearance: none; }

#ddt-root {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--black);
}

/* ─── SCREENS ────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; flex-direction: column; }
.screen.active { display: flex; max-width: 800px !important; margin-left: auto !important; margin-right: auto !important; }

/* ─── HEADER ─────────────────────────────────────────────────── */
.app-header {
  background: var(--red);
  color: #fff;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
  user-select: none;
  overflow: hidden;
}
.app-header > * {
  position: relative;
  z-index: 1;
}
.app-header {
  display: flex;
  align-items: center;
  padding: 0;
}
.app-header::before {
  content: '';
  position: absolute;
  top: -40px;
  right: 40px;
  width: 80px;
  height: 140px;
  background: rgba(255, 255, 255, 0.07);
  transform: rotate(-12deg);
  pointer-events: none;
}
.app-header::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 120px;
  background: linear-gradient(to right, transparent, rgba(0, 0, 0, 0.10));
  pointer-events: none;
}
.header-inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 100%;
  position: relative;
  z-index: 1;
}

.back-btn {
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 4px 0;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  transition: opacity .15s;
}
.back-btn:active { opacity: .5; }

.header-title {
  flex: 1;
  text-align: center;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1px;
  color: #fff;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.header-logo {
  height: 38px;
  width: 38px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
  position: relative;
  z-index: 1;
}

.offline-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot-online  { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dot-offline { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }

/* ─── DESKTOP NAV BAR ─────────────────────────────────────────── */
.nav-bar {
  background: var(--black);
  border-bottom: 3px solid var(--red);
  position: sticky;
  top: 60px;
  z-index: 99;
}
.nav-bar-inner {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 0;
}
.nav-tab-btn, .nav-bar a {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
  padding: 11px 14px;
  text-transform: uppercase;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  background: none;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.nav-tab-btn:hover, .nav-bar a:hover { color: #fff; }
.nav-tab-btn.active, .nav-bar a.active { color: #fff; border-bottom-color: var(--red); }
.nav-back-btn {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  border: none;
  background: none;
  cursor: pointer;
  padding: 8px 0;
  transition: color .15s;
}
.nav-back-btn:hover { color: #fff; }
.nav-bar .nav-spacer { flex: 1; }
.nav-bar .nav-status {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1.5px;
  color: rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── DESKTOP vs MOBIEL ──────────────────────────────────────── */
@media (min-width: 641px) {
  #app-nav-bar { display: block; }
  .tab-bar { display: none !important; }
  .content { padding-bottom: 24px; }
}
@media (max-width: 640px) {
  #app-nav-bar { display: none; }
}

/* ─── CONTENT ────────────────────────────────────────────────── */
.content {
  flex: 1;
  padding: 16px 16px 90px;
  overflow-y: auto;
  background: var(--bg);
}

/* ─── TAB BAR ────────────────────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  display: flex;
  background: var(--surface);
  z-index: 100;
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.07);
  padding: 4px 6px env(safe-area-inset-bottom, 4px);
  gap: 2px;
}
.tab-btn {
  flex: 1;
  padding: 7px 4px 6px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  transition: color .15s, background .15s;
}
.tab-btn.active {
  color: var(--red);
  background: var(--red-light);
}
.tab-btn .ti {
  font-size: 21px;
  line-height: 1;
  display: block;
  transition: transform .15s;
}
.tab-btn.active .ti {
  transform: scale(1.08);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── SECTIETITEL ────────────────────────────────────────────── */
.section-title {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 1.5px;
  color: var(--black);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--red), transparent);
  border-radius: 2px;
}

/* ─── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1;
  width: 100%;
  padding: 0 20px;
  height: 48px;
  border: none;
  border-radius: var(--r-full);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  font-weight: normal;
  cursor: pointer;
  text-align: center;
  text-transform: uppercase;
  transition: transform .1s, box-shadow .15s, background .15s;
}
.btn + .btn { margin-top: 10px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(225, 8, 22, 0.25);
}
.btn-primary:hover:not(:disabled)  { background: var(--red-dark); }
.btn-primary:active:not(:disabled) { background: var(--red-dark); box-shadow: none; }

.btn-secondary {
  background: #fff;
  color: var(--red);
  border: 2px solid var(--red);
}
.btn-secondary:hover:not(:disabled) { background: var(--red-light); }
.btn-secondary:active { background: var(--red-light); }

.btn-danger {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-danger:active { background: #f0f0f0; }

.btn-dark {
  background: var(--black);
  color: #fff;
}
.btn-dark:hover:not(:disabled) { background: #2a2a2a; }

.btn-save {
  background: var(--red);
  color: #fff;
  font-size: 14px;
  height: 52px;
  line-height: 52px;
  border-radius: var(--r-full);
  letter-spacing: 2px;
  box-shadow: 0 6px 20px rgba(225, 8, 22, 0.3);
}
.btn-save:hover:not(:disabled) { background: var(--red-dark); }

.btn-sm {
  height: 36px;
  line-height: 36px;
  font-size: 11px;
  letter-spacing: 1.5px;
  width: auto;
  display: inline-block;
  padding: 0 16px;
}

/* ─── INPUTS (gescoopt op #ddt-root) ────────────────────────── */
#ddt-root input[type="text"],
#ddt-root input[type="number"],
#ddt-root input[type="date"],
#ddt-root textarea,
#ddt-root select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 15px;
  font-family: var(--font-body);
  background: #fff;
  color: var(--black);
  transition: border-color .15s, box-shadow .15s;
}
#ddt-root input::placeholder,
#ddt-root textarea::placeholder { color: var(--muted); }
#ddt-root input:focus,
#ddt-root textarea:focus,
#ddt-root select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(225, 8, 22, 0.12);
}
#ddt-root textarea { min-height: 120px; resize: vertical; }
#ddt-root .form-group { margin-bottom: 16px; }
#ddt-root label {
  display: block;
  font-family: var(--font-display);
  font-weight: normal;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
#ddt-root .error-msg { color: #e03535; font-size: 13px; margin-top: 4px; }
#ddt-root select { color: var(--black); }
#ddt-root select option { background: var(--surface); color: var(--black); }

/* ─── MELDINGEN ──────────────────────────────────────────────── */
.warning-box {
  background: rgba(196, 122, 0, 0.08);
  border: 1px solid rgba(196, 122, 0, 0.25);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--warning);
  margin-bottom: 10px;
}
.success-box {
  background: rgba(26, 138, 60, 0.08);
  border: 1px solid rgba(26, 138, 60, 0.25);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--success);
  margin-bottom: 10px;
}
.info-box {
  background: var(--red-light);
  border: 1px solid rgba(225, 8, 22, 0.2);
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--red);
  margin-bottom: 10px;
}
.readonly-banner {
  background: var(--red-light);
  border-left: 4px solid var(--red);
  padding: 10px 16px;
  font-size: 13px;
  color: var(--red);
}

/* ─── UTILITIES ──────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 13px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.locked {
  background: var(--bg) !important;
  color: var(--muted) !important;
  cursor: not-allowed;
  border-color: var(--border) !important;
}

/* ─── PORTAAL ────────────────────────────────────────────────── */
.portaal-welkom {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  color: var(--muted);
  text-align: center;
  margin: 24px 0 20px;
  text-transform: uppercase;
}
.portaal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.portaal-tegel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
  text-decoration: none;
  color: var(--black);
  transition: box-shadow .15s, border-color .15s, transform .1s;
  min-height: 160px;
  gap: 8px;
}
.portaal-tegel:hover {
  border-color: var(--red);
  box-shadow: 0 4px 20px rgba(225, 8, 22, 0.12);
  transform: translateY(-2px);
}
.portaal-tegel:active { transform: translateY(0); }
.portaal-tegel-icon { font-size: 44px; line-height: 1; }
.portaal-tegel-naam {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}
.portaal-tegel-sub { font-size: 13px; color: var(--muted); }
