/* buchbereit-f6-2-smart-inbox-v1 */
:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #155eef;
  --primary-dark: #0b4bd4;
  --success: #147a45;
  --success-bg: #eaf8f0;
  --warning: #945f00;
  --warning-bg: #fff6dd;
  --danger: #b42318;
  --danger-bg: #fff0ee;
  --shadow: 0 12px 34px rgba(15, 23, 42, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; }

.shell { width: min(1480px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #101828; color: white; padding: 18px 0; box-shadow: var(--shadow); }
.brand { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand h1 { font-size: 22px; margin: 0; }
.brand p { margin: 4px 0 0; color: #cbd5e1; font-size: 13px; }
main { padding: 28px 0 60px; }

.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px; }
.card { grid-column: span 12; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; box-shadow: var(--shadow); }
.card h2, .card h3 { margin: 0 0 14px; }
.card p { color: var(--muted); }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }

.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: #fbfcfe; }
.kpi strong { display: block; font-size: 25px; margin-bottom: 5px; }
.kpi span { color: var(--muted); font-size: 12px; }

.button { appearance: none; border: 0; border-radius: 10px; background: var(--primary); color: white; padding: 11px 16px; font-weight: 750; cursor: pointer; transition: .15s ease; }
.button:hover { background: var(--primary-dark); }
.button:disabled { opacity: .5; cursor: wait; }
.button.secondary { background: #eaf0fb; color: #23324b; }
.button.success { background: var(--success); }
.button.danger { background: var(--danger); }
.button.small { padding: 7px 10px; font-size: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

label { display: block; font-weight: 700; margin-bottom: 6px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: white; color: var(--text); }
textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field.full { grid-column: 1 / -1; }

.smart-upload-card { border-color: #b9cff9; background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%); }
.upload-lead { max-width: 920px; font-size: 16px; line-height: 1.55; }
.smart-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
.smart-step { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 13px; background: #fff; }
.smart-step > span { grid-row: span 2; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #e8f0ff; color: var(--primary); font-weight: 800; }
.smart-step strong { font-size: 14px; }
.smart-step small { color: var(--muted); line-height: 1.3; }

.drop-zone { border: 2px dashed #89a9e7; border-radius: 18px; background: #f3f7ff; padding: 34px 24px; text-align: center; cursor: pointer; transition: .15s ease; }
.drop-zone.dragover { border-color: var(--primary); background: #e9f0ff; transform: translateY(-1px); }
.drop-zone strong { display: block; margin: 8px 0 5px; font-size: 19px; }
.drop-zone span { display: block; color: #40516b; }
.drop-zone small { display: block; margin-top: 8px; color: var(--muted); }
.upload-symbol { width: 46px; height: 46px; display: grid; place-items: center; margin: 0 auto; border-radius: 14px; background: white; color: var(--primary); font-size: 28px; font-weight: 600; box-shadow: 0 8px 20px rgba(21, 94, 239, .14); }
.upload-actions { justify-content: center; }
.privacy-note { margin-top: 16px; padding: 14px 16px; border-radius: 12px; border: 1px solid #cfe0ff; background: #f4f8ff; color: #33445f; line-height: 1.5; }
.privacy-note strong { color: #1c3f7a; }

.file-list { display: grid; gap: 8px; margin-top: 14px; }
.file-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 13px; }
.file-item span { display: grid; gap: 3px; min-width: 0; }
.file-item strong { overflow-wrap: anywhere; }
.file-item small { color: var(--muted); }

.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; background: #e9eef7; color: #30415e; }
.badge.success { color: var(--success); background: var(--success-bg); }
.badge.warning { color: var(--warning); background: var(--warning-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }

.message { display: none; padding: 13px 15px; border-radius: 12px; margin: 14px 0; background: #eef4ff; color: #244479; }
.message.show { display: block; }
.message.error { background: var(--danger-bg); color: var(--danger); }
.message.success { background: var(--success-bg); color: var(--success); }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
th { color: #475569; background: #f8fafc; position: sticky; top: 0; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.blockers { display: grid; gap: 8px; }
.blocker { border-left: 4px solid var(--warning); background: var(--warning-bg); border-radius: 8px; padding: 10px 12px; font-size: 13px; }

.bar-chart { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 180px) 1fr minmax(90px, auto); gap: 10px; align-items: center; }
.bar-track { height: 18px; border-radius: 999px; background: #e9eef7; overflow: hidden; }
.bar-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #155eef, #78a7ff); min-width: 2px; }
.report-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.note { padding: 12px 14px; border-radius: 10px; background: #f8fafc; border: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.spinner { width: 18px; height: 18px; display: inline-block; border: 3px solid rgba(255,255,255,.35); border-top-color: white; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; margin-right: 7px; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 980px) {
  .span-4, .span-5, .span-6, .span-7, .span-8 { grid-column: span 12; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .smart-steps { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1480px); }
  .card { padding: 16px; border-radius: 14px; }
  .form-grid, .kpi-grid { grid-template-columns: 1fr; }
  .brand { align-items: flex-start; flex-direction: column; }
  .bar-row { grid-template-columns: 90px 1fr; }
  .bar-row .bar-value { grid-column: 2; }
  .upload-actions { display: grid; grid-template-columns: 1fr; }
  .file-item { align-items: flex-start; }
}

@media print {
  .topbar, .no-print, #uploadCard, #sessionsCard { display: none !important; }
  body { background: white; }
  main { padding: 0; }
  .shell { width: 100%; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* buchbereit-3.4.0-mobile-scan-v1 */
.scanner-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  z-index: 10000;
  display: none;
  overflow: hidden;
  background: #050b14;
  color: white;
}
.scanner-overlay.show { display: block; }
.scanner-shell {
  width: min(100%, 760px);
  height: 100dvh;
  min-height: 0;
  max-height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  margin: 0 auto;
  overflow: hidden;
  background: #07111f;
}
.scanner-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: max(14px, env(safe-area-inset-top)) 16px 12px;
}
.scanner-header h2 { margin: 2px 0 0; font-size: 20px; }
.scanner-header .eyebrow { color: #8db8ff; }
.scanner-close {
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: white;
  padding: 9px 14px;
  font-weight: 750;
}
.scanner-view {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: black;
}
.scanner-view video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: cover;
  display: block;
}
.scanner-guide {
  position: absolute;
  inset: 7% 6%;
  border: 2px solid rgba(255,255,255,.72);
  border-radius: 18px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.18);
  pointer-events: none;
}
.scanner-guide::before,
.scanner-guide::after {
  content: "";
  position: absolute;
  width: 44px;
  height: 44px;
  border-color: #4f9cff;
}
.scanner-guide::before {
  left: -3px;
  top: -3px;
  border-left: 5px solid #4f9cff;
  border-top: 5px solid #4f9cff;
  border-radius: 14px 0 0;
}
.scanner-guide::after {
  right: -3px;
  bottom: -3px;
  border-right: 5px solid #4f9cff;
  border-bottom: 5px solid #4f9cff;
  border-radius: 0 0 14px;
}
.scanner-flash {
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0;
  pointer-events: none;
}
.scanner-flash.active { animation: scannerFlash .18s ease; }
@keyframes scannerFlash { 0% { opacity: .8; } 100% { opacity: 0; } }
.scanner-progress {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 14px;
  padding: 12px 16px 6px;
  font-size: 13px;
}
.scanner-progress strong { font-size: 16px; }
.scanner-progress span { color: #cbd5e1; }
.scanner-progress #scannerStatus { grid-column: 1 / -1; color: #8db8ff; }
.scanner-controls {
  display: grid;
  grid-template-columns: 1fr 92px 1fr;
  align-items: center;
  gap: 14px;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
}
.scanner-controls .button { min-height: 48px; }
.capture-button {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  border: 5px solid white;
  background: transparent;
  padding: 7px;
  justify-self: center;
}
.capture-button span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: white;
  transition: transform .08s ease;
}
.capture-button:active span { transform: scale(.88); }
.capture-button:disabled { opacity: .4; }
.scanner-help {
  margin: 0;
  padding: 0 16px max(12px, env(safe-area-inset-bottom));
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
}
.scan-quality-list { display: grid; gap: 12px; margin-top: 14px; }
.scan-quality-item {
  display: grid;
  grid-template-columns: 96px minmax(0,1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.scan-quality-item img {
  width: 96px;
  height: 112px;
  object-fit: cover;
  border-radius: 10px;
  background: #eef2f7;
}
.scan-quality-item p { margin: 4px 0 0; font-size: 13px; }
.scan-quality-item .button { white-space: nowrap; }
.scan-quality-item.grouping-uncertain { border-color: #f0c36a; background: #fffdf7; }
.scan-group-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.scan-group-actions .button { min-height: 36px; padding: 8px 10px; white-space: normal; }
.scan-group-finalize {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #f0c36a;
  border-radius: 12px;
  background: #fff8e7;
  color: #6f4b00;
}
.scan-resume {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  border: 1px solid #f0c36a;
  background: #fff8e7;
  color: #6f4b00;
}
.scan-resume strong { display: block; margin-bottom: 3px; }
body.scanner-open { overflow: hidden; }

@media (max-width: 620px) {
  .scanner-shell { width: 100%; }
  .scanner-controls { grid-template-columns: 1fr 86px 1fr; gap: 8px; }
  .capture-button { width: 76px; height: 76px; }
  .scanner-controls .button { padding: 9px 7px; font-size: 12px; }
  .scan-quality-item { grid-template-columns: 78px 1fr; }
  .scan-quality-item img { width: 78px; height: 96px; }
  .scan-quality-item > .button { grid-column: 1 / -1; width: 100%; }
  .scan-group-actions { flex-direction: column; }
  .scan-group-actions .button { width: 100%; }
  .scan-group-finalize { align-items: stretch; flex-direction: column; }
  .scan-group-finalize .button { width: 100%; }
  .scan-resume { align-items: stretch; flex-direction: column; }
}

/* buchbereit-3.4.0-r4-ios-viewport-fix */
@supports (height: 100svh) {
  .scanner-overlay,
  .scanner-shell {
    height: 100svh;
    max-height: 100svh;
  }
}

@media (max-width: 620px) {
  .scanner-shell {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .scanner-header {
    padding-top: max(9px, env(safe-area-inset-top));
    padding-bottom: 8px;
  }
  .scanner-header h2 { font-size: 18px; }
  .scanner-view { min-height: 0; }
  .scanner-progress { padding: 8px 14px 4px; }
  .scanner-controls {
    padding: 7px 12px max(8px, env(safe-area-inset-bottom));
  }
  .scanner-help { display: none; }
  .capture-button { width: 70px; height: 70px; }
}
/* buchbereit-3.4.0-r4-ios-viewport-fix-end */

/* buchbereit-3.4.0-mobile-scan-v1-end */


/* buchbereit-3.4.0-r6-a4-frame-crop */
.scanner-guide {
  inset: auto;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(82%, 440px);
  height: auto;
  aspect-ratio: 210 / 297;
  border-radius: 8px;
  border-width: 2px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.28);
}
.scanner-guide::before,
.scanner-guide::after {
  width: 38px;
  height: 38px;
}
/* buchbereit-3.4.0-r6-a4-frame-crop-end */


/* buchbereit-3.4.0-r7-scanner-exit-latest-session */
.scanner-header-spacer {
  width: 1px;
  height: 1px;
}
.scanner-cancel {
  border-color: rgba(255, 154, 154, .55) !important;
  color: #ffd4d4 !important;
  background: rgba(140, 30, 30, .20) !important;
}
.scanner-cancel:disabled { opacity: .45; }
/* buchbereit-3.4.0-r7-scanner-exit-latest-session-end */
