:root {
  --accent:       #2E5090;
  --accent-light: #eef2fb;
  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --border:       #e8eaee;
  --text:         #111827;
  --muted:        #9ca3af;
  --danger:       #dc2626;
  --success:      #16a34a;
  --radius:       14px;
  --font:         'DM Sans', 'Segoe UI', sans-serif;
}

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

svg { display: block; flex-shrink: 0; }
.nav-btn .icon { display: flex; align-items: center; justify-content: center; }
.nav-btn .icon svg { width: 22px; height: 22px; }
.btn-icon svg { width: 20px; height: 20px; }
.topbar-back svg { width: 20px; height: 20px; }
.akte-icon svg { width: 22px; height: 22px; color: var(--muted); }
.login-logo .icon svg { width: 48px; height: 48px; color: var(--accent); }
.upload-btn svg { width: 20px; height: 20px; }
.zip-btn svg { width: 20px; height: 20px; }
.empty-state svg { width: 40px; height: 40px; color: var(--border); margin: 0 auto .5rem; }
.doc-icon { display: flex; align-items: center; flex-shrink: 0; }
.doc-icon svg { width: 18px; height: 18px; color: var(--muted); }
.file-thumb-del svg { width: 14px; height: 14px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Layout */
#app { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-back {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 .25rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.topbar-title { font-size: 1.05rem; font-weight: 600; flex: 1; }
.topbar-actions { display: flex; gap: .5rem; }

.content { flex: 1; padding: 1rem; max-width: 640px; margin: 0 auto; width: 100%; }

/* Navbar */
.navbar {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem;
  padding: .6rem .25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-family: var(--font);
  font-size: .7rem;
  min-height: 56px;
  transition: color .15s;
}
.nav-btn .icon { font-size: 1.4rem; }
.nav-btn.active { color: var(--accent); }

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: .75rem;
  overflow: hidden;
}
.card-body { padding: 1rem; }
.card-header {
  padding: .875rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.card-title { font-weight: 600; font-size: 1rem; }

/* Akte-Item in der Liste */
.akte-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .875rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: .6rem;
  cursor: pointer;
  transition: background .1s;
  -webkit-tap-highlight-color: transparent;
}
.akte-item:active { background: var(--accent-light); }
.akte-icon { font-size: 1.5rem; flex-shrink: 0; }
.akte-info { flex: 1; min-width: 0; }
.akte-repco { font-weight: 600; font-size: .95rem; }
.akte-vin { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.akte-meta { font-size: .75rem; color: var(--muted); text-align: right; flex-shrink: 0; }
.badge {
  display: inline-block;
  padding: .2rem .5rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-archived { background: #f3f4f6; color: var(--muted); }
.badge-exported { background: #dcfce7; color: #16a34a; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .7rem 1.2rem;
  border-radius: 10px;
  border: none;
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  min-height: 44px;
  transition: opacity .15s;
}
.btn:active { opacity: .75; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-outline { background: transparent; color: var(--accent); border: 1.5px solid var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: .5rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  color: var(--muted);
}
.btn-icon:active { background: var(--bg); }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: .4rem; }
.form-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  outline: none;
  min-height: 44px;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--accent); }

/* QR-Scanner */
#qr-reader { width: 100%; border-radius: 12px; overflow: hidden; }
#qr-reader video { width: 100% !important; }

/* Datei-Grid (Bilder) */
.file-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .5rem;
  margin-bottom: .75rem;
}
.file-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb-del {
  position: absolute;
  top: .35rem;
  right: .35rem;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: .9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Dokumente-Liste */
.doc-list { display: flex; flex-direction: column; gap: .4rem; }
.doc-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .625rem .75rem;
  background: var(--bg);
  border-radius: 8px;
}
.doc-name { flex: 1; font-size: .875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-size { font-size: .75rem; color: var(--muted); flex-shrink: 0; }

/* VIN-Box */
.vin-box {
  background: var(--accent-light);
  border-radius: 10px;
  padding: .875rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.vin-label { font-size: .75rem; color: var(--muted); }
.vin-value { font-size: 1rem; font-weight: 600; font-family: monospace; letter-spacing: .05em; }
.vin-copy { margin-left: auto; }

/* Upload-Button */
.upload-btn {
  width: 100%;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-light);
  cursor: pointer;
  min-height: 56px;
  margin-bottom: 1rem;
}
.upload-btn:active { opacity: .7; }

/* ZIP-Button */
.zip-btn {
  width: 100%;
  background: var(--text);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 1rem;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 52px;
}
.zip-btn:active { opacity: .75; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  width: min(380px, 92vw);
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}
.modal-title { font-size: 1.1rem; font-weight: 600; margin: 0 0 .5rem; color: var(--text); }
.modal-desc { font-size: .875rem; color: var(--muted); margin: 0 0 1.25rem; }
.modal-actions { display: flex; gap: .75rem; margin-top: 1.25rem; }
.modal-actions .btn { flex: 1; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  pointer-events: none;
}
.toast {
  background: #1f2937;
  color: #fff;
  padding: .6rem 1.2rem;
  border-radius: 999px;
  font-size: .875rem;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* Loader */
.loader {
  display: inline-block;
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Sections */
.section-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin: 1.25rem 0 .6rem;
}
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: .5rem; }

/* Bottom-Padding für Navbar */
.content { padding-bottom: 80px; }
