*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --brand:    #84a818;   /* Landt olive green */
  --brand-dk: #6b8a10;   /* darker on hover */
  --accent:   #8b3a1a;   /* terracotta — nav underline on landt.at */
  --green:    #84a818;   /* success = same brand green */
  --red:      #c0392b;
  --bg:       #f0f0f0;   /* light gray page background */
  --card-bg:  #ffffff;
  --text:     #2c2c2c;
  --muted:    #777777;
  --border:   #d0d0d0;
  --radius:   4px;       /* landt.at is very square/minimal */
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Header ── */
header {
  background: #ffffff;
  border-bottom: 3px solid var(--brand);
  padding: 1rem 1rem;
}
.header-inner {
  max-width: 620px;
  margin: 0 auto;
}
.logo {
  display: block;
  /*width: 100%;*/
  margin: auto;
  height: auto;
  object-fit: contain;
}

/* ── Main ── */
main {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2.5rem 1rem 3rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 620px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: .35rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: .4rem;
}

.subtitle {
  color: var(--muted);
  font-size: .91rem;
  line-height: 1.55;
  margin-bottom: 1.75rem;
  margin-top: .6rem;
}

/* ── Form elements ── */
label {
  display: block;
  font-weight: 600;
  font-size: .87rem;
  margin-bottom: .3rem;
  color: var(--text);
}

input[type="text"] {
  width: 100%;
  padding: .6rem .8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
  margin-bottom: 1.5rem;
  background: #fff;
}
input[type="text"]:focus { border-color: var(--brand); }

/* ── Dropzone ── */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  min-height: 155px;
  padding: 1rem;
  transition: border-color .2s, background .2s;
  margin-bottom: 1.4rem;
  cursor: pointer;
}
.dropzone:hover,
.dropzone.dz-drag-hover { border-color: var(--brand); background: #eef3e6; }
.dropzone .dz-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
  pointer-events: none;
  padding: 1.5rem 0;
}
.dropzone .dz-icon { font-size: 2.5rem; line-height: 1; color: var(--brand); }
.dropzone .dz-message span { font-size: .92rem; }
/* When files are present: keep the drop hint visible, compact, pushed to bottom */
.dropzone.dz-started .dz-message {
  display: flex;
  order: 999;
  flex-direction: row;
  justify-content: center;
  padding: 0.65rem 0.8rem;
  gap: 0.4rem;
  border: none;
}
.dropzone.dz-started .dz-icon { display: none; }
.dropzone.dz-started .dz-message span { font-size: 0.84rem; }

/* ── Dropzone list view ── */

/* When files are present: switch to list layout */
.dropzone.dz-started {
  min-height: auto;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  cursor: default;
}

/* Override Dropzone CDN default preview styles */
.dropzone .dz-preview {
  display: block !important;
  margin: 0 !important;
  min-height: auto !important;
  position: relative !important;
  float: none !important;
  background: transparent !important;
}
/* Hide Dropzone's built-in image/detail overlays */
.dropzone .dz-preview .dz-image,
.dropzone .dz-preview .dz-details,
.dropzone .dz-preview .dz-progress,
.dropzone .dz-preview > .dz-success-mark,
.dropzone .dz-preview > .dz-error-mark,
.dropzone .dz-preview > .dz-remove { display: none !important; }

/* Card row */
.dz-card {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.8rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.dz-preview.dz-error .dz-card { border-color: var(--red); }

/* Thumbnail */
.dz-thumb-wrap {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dz-thumb-wrap img[data-dz-thumbnail] { display: none; width: 100%; height: 100%; object-fit: cover; }
.dz-thumb-wrap .dz-no-thumb { width: 26px; height: 26px; color: var(--muted); }

/* File info */
.dz-file-info { flex: 1; min-width: 0; }
.dz-file-info .dz-filename {
  font-size: 0.87rem;
  color: var(--text);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.35;
}
.dz-file-info .dz-filesize { font-size: 0.76rem; color: var(--muted); margin-top: 2px; }
.dz-file-info .dz-filesize strong { font-weight: 400; }

/* Remove button */
.dz-remove-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted);
  border-radius: 2px;
  display: flex;
  align-items: center;
  line-height: 0;
  transition: color 0.15s;
}
.dz-remove-btn:hover { color: var(--red); }

/* Thin progress line below each card */
.dz-progress-line {
  height: 3px;
  overflow: hidden;
  border-radius: 0 0 var(--radius) var(--radius);
}
.dz-progress-line-fill {
  height: 100%;
  width: 0%;
  background: var(--brand);
  transition: width 0.12s linear;
}
/* Hide when idle or errored */
.dz-preview:not(.dz-processing):not(.dz-success) .dz-progress-line { display: none; }
.dz-preview.dz-error .dz-progress-line { display: none; }
/* Fade out on success */
.dz-preview.dz-success .dz-progress-line-fill { width: 100% !important; }
.dz-preview.dz-success .dz-progress-line { opacity: 0; transition: opacity 0.5s 0.4s; }

/* Error message below card */
.dz-preview .dz-error-message {
  font-size: 0.78rem;
  color: var(--red);
  padding: 2px 0.55rem 3px;
  display: none;
}
.dz-preview.dz-error .dz-error-message { display: block; }

/* ── Captcha ── */
.captcha-row {
  margin-bottom: 1.4rem;
}

/* ── Upload progress overlay ── */
.upload-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(3px);
}
.upload-overlay.hidden { display: none; }

.upload-overlay-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 40px rgba(0, 0, 0, .22);
  padding: 2.75rem 3rem 2.5rem;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.upload-overlay-pct {
  font-size: 4rem;
  font-weight: 700;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 1.5rem;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}

.upload-overlay-track {
  width: 100%;
  height: 10px;
  background: var(--bg);
  border-radius: 9999px;
  overflow: hidden;
  margin-bottom: 1.75rem;
}

.upload-overlay-fill {
  height: 100%;
  width: 0%;
  background: var(--brand);
  border-radius: 9999px;
  transition: width .15s ease;
}

.upload-overlay-msg {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
}

/* Phase 2: done state */
#overlayDone { text-align: center; }

.overlay-done-h2 {
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--brand);
  margin: 1rem 0 .4rem;
}

.overlay-done-sub {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.6;
}

.overlay-status {
  min-height: 1.4em;
  font-size: .87rem;
  margin-top: .65rem;
  opacity: 0;
  transition: opacity .7s ease;
}
.overlay-status.visible { opacity: 1; }
.overlay-status.ok { color: var(--brand); }
.overlay-status.err { color: var(--red); }

#overlayDone .btn-secondary { margin-top: 1.35rem; }

/* ── Error message ── */
.error-msg {
  background: #fdecea;
  color: var(--red);
  border: 1px solid #f5c2c2;
  border-radius: var(--radius);
  padding: .65rem 1rem;
  font-size: .91rem;
  margin-bottom: 1rem;
}

/* ── Send button ── */
button[type="submit"] {
  width: 100%;
  padding: .8rem;
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s, opacity .2s;
  letter-spacing: .02em;
}
button[type="submit"]:hover:not(:disabled) { background: var(--brand-dk); }
button[type="submit"]:disabled { opacity: .4; cursor: not-allowed; }

.btn-secondary {
  margin-top: 1.5rem;
  padding: .65rem 1.8rem;
  background: transparent;
  border: 2px solid var(--brand);
  color: var(--brand);
  font-size: .95rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.btn-secondary:hover { background: var(--brand); color: #fff; }

/* ── Success card ── */
.success-card {
  text-align: center;
  padding: 3rem 2.25rem;
}
.success-card h2 {
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--brand);
  margin: 1.2rem 0 .5rem;
}
.success-card p { color: var(--muted); line-height: 1.6; }

/* Animated checkmark */
.checkmark-circle {
  display: flex;
  justify-content: center;
}
.checkmark-svg {
  width: 90px;
  height: 90px;
}
.checkmark-circle-ring {
  stroke: var(--brand);
  stroke-width: 2;
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  animation: stroke-ring .6s cubic-bezier(.65,0,.45,1) forwards;
}
.checkmark-tick {
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
  animation: stroke-tick .4s cubic-bezier(.65,0,.45,1) .6s forwards;
}

@keyframes stroke-ring {
  to { stroke-dashoffset: 0; }
}
@keyframes stroke-tick {
  to { stroke-dashoffset: 0; }
}

/* ── Footer ── */
footer {
  text-align: center;
  padding: 1.1rem 1rem;
  border-top: 1px solid var(--border);
  background: #fff;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: .45rem;
}
.footer-links a {
  color: #555;
  font-size: .85rem;
  text-decoration: none;
}
.footer-links a:hover { text-decoration: underline; }
.footer-address {
  color: #555;
  font-size: .78rem;
}

/* ── Modal lightbox ── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(0,0,0,.18);
  padding: 2rem 2.25rem;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--brand);
  padding-bottom: .4rem;
}
.modal-close {
  position: absolute;
  top: .75rem;
  right: .9rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
}
.modal-close:hover { color: var(--text); }

/* ── Utilities ── */
.hidden { display: none !important; }

@media (max-width: 480px) {
  .card { padding: 1.5rem 1.1rem; }
}

/* ── Category subtitle ── */
.doc-subtitle {
  color: var(--muted);
  font-size: 0.87rem;
  margin-bottom: 0.9rem;
  margin-top: -0.1rem;
}

/* ── Category 2×2 grid ── */
.category-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.4rem;
}

/* ── Category drop box ── */
.cat-dropzone {
  min-height: 130px;
  padding: 0;
  margin-bottom: 0;
  border-radius: 10px;
  opacity: 0.55;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, opacity 0.2s;
}

/* Override generic .dropzone:hover for category boxes */
.cat-dropzone:hover {
  opacity: 0.82;
  background: var(--bg);
  border-color: var(--border);
}

/* Override .dropzone.dz-started — keep box appearance, never show inline file list */
.cat-dropzone.dz-started {
  min-height: 130px;
  padding: 0;
  display: flex;
  flex-direction: row;
  gap: 0;
  cursor: pointer;
}

/* Suppress Dropzone-injected .dz-message and .dz-preview inside boxes */
.cat-dropzone .dz-message,
.cat-dropzone.dz-started .dz-message,
.cat-dropzone .dz-preview { display: none !important; }

/* Dragover state */
.cat-dropzone.dz-drag-hover {
  border-color: var(--brand) !important;
  background: #eef3e6 !important;
  transform: scale(1.035);
  opacity: 1;
}

/* Filled with valid files */
.cat-dropzone.has-files {
  border-color: var(--brand);
  border-style: solid;
  background: #f4f8ea;
  opacity: 1;
}
.cat-dropzone.has-files:hover {
  border-color: var(--brand-dk);
  background: #eef3e0;
}

/* Has file errors */
.cat-dropzone.has-errors {
  border-color: var(--red);
  border-style: solid;
  background: #fdecea;
  opacity: 1;
}

/* ── Box inner layout (icon + badge + name) ── */
.cat-box-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  pointer-events: none;
  text-align: center;
}

.cat-icon {
  width: 38px;
  height: 38px;
  color: var(--muted);
  transition: color 0.2s;
}
.cat-dropzone.has-files .cat-icon  { color: var(--brand); }
.cat-dropzone.has-errors .cat-icon { color: var(--red); }

.cat-name {
  font-size: 0.77rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.3;
  transition: color 0.2s;
}
.cat-dropzone.has-files .cat-name  { color: var(--brand); }
.cat-dropzone.has-errors .cat-name { color: var(--red); }

/* ── File count / error badge ── */
.cat-badge {
  position: absolute;
  top: 7px;
  right: 9px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  padding: 2px 7px;
  border-radius: 9999px;
  background: var(--brand);
  color: #fff;
  pointer-events: none;
}
.cat-badge.badge-error { background: var(--red); }

/* ── Category file lightbox ── */
#catModal .modal-content { max-width: 620px; }

#catModalBody {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

/* Previews moved here from inside Dropzone — restore display and reset CDN overrides */
#catModalBody .dz-preview {
  display: block !important;
  margin: 0 !important;
  min-height: auto !important;
  position: relative !important;
  float: none !important;
  background: transparent !important;
}

/* ── Drag-over overlay inside catModal ── */
.modal-drop-overlay {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: rgba(132, 168, 24, 0.12);
  border: 3px dashed var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 20;
}
.modal-drop-overlay span {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--brand);
  background: rgba(255,255,255,0.9);
  padding: 0.5rem 1.2rem;
  border-radius: var(--radius);
}

/* ── Button row inside catModal ── */
.modal-btn-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.1rem;
  margin-bottom: 0.25rem;
}

.btn-add-more {
  padding: 0.4rem 0.9rem;
  background: transparent;
  border: 1.5px solid var(--brand);
  color: var(--brand);
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-add-more:hover { background: var(--brand); color: #fff; }

.btn-clear-all {
  padding: 0.4rem 0.9rem;
  background: transparent;
  border: 1.5px solid var(--red);
  color: var(--red);
  font-size: 0.83rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.btn-clear-all:hover { background: var(--red); color: #fff; }

/* ── Mobile: single column grid ── */
@media (max-width: 480px) {
  .category-grid { grid-template-columns: 1fr; }
}
