/* VersandQS - mobile-first, big touch targets, no ornament.
   Palette: navy #1d3557, ok green, warn amber, error red. */

* { box-sizing: border-box; }
/* SAFETY NET: the hidden attribute must always win. Rules like
   display:flex on a class otherwise override the UA's [hidden] style -
   this bit us twice (lightbox v0.5.3, label checkbox v0.8.1). */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px; line-height: 1.5;
  color: #1a1a1a; background: #eef1f5;
}
h1 { font-size: 1.45rem; margin: .4rem 0 .8rem; }
h2 { font-size: 1.15rem; margin: 1.4rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
a { color: #1d3557; }
.muted { color: #667; font-weight: 400; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: .6rem; flex-wrap: wrap;
  background: #1d3557; color: #fff; padding: .55rem .8rem;
  padding-top: max(.55rem, env(safe-area-inset-top));
}
.brand { color: #fff; text-decoration: none; font-weight: 700; }
.version { font-weight: 400; font-size: .72rem; opacity: .75; }
/* env badge: admin-only + subtle (usability review 3 - a permanent red LIVE
   badge devalues the warning colour) */
.env-badge { font-size: .68rem; font-weight: 700; padding: .1rem .45rem; border-radius: 3px; }
.env-dev  { background: #2a9d8f; color: #fff; }
.env-live { background: rgba(255, 255, 255, .18); color: #dce6f2; }

/* hamburger menu (v0.7.0): labelled entries instead of an icon bar */
.menu-toggle {
  margin-left: auto; min-width: 48px; min-height: 44px;
  background: none; border: 0; color: #fff; font-size: 1.6rem; cursor: pointer;
  border-radius: 8px; padding: .1rem .5rem;
}
.menu-toggle[aria-expanded="true"] { background: rgba(255, 255, 255, .16); }
/* admin info: dot on the hamburger while accounts wait for approval */
.menu-alert::after {
  content: ''; position: absolute; top: 6px; right: 4px;
  width: 10px; height: 10px; border-radius: 50%; background: #f4a261;
}
.menu-toggle { position: relative; }
/* pending approvals on /benutzer */
.pending-card { background: #fff8ec; border-color: #f0d9a8; }
.pending-row { align-items: center; margin: .5rem 0; }
.pending-wer { flex: 2 1 220px; }
.menu {
  background: #1d3557; padding: .2rem .8rem .8rem;
  display: flex; flex-direction: column; gap: .1rem;
}
.menu[hidden] { display: none; }
.menu a {
  color: #fff; text-decoration: none; font-size: 1.1rem; font-weight: 600;
  padding: .65rem .8rem; border-radius: 8px;
}
.menu a.nav-aktiv { background: rgba(255, 255, 255, .16); }
.menu a:hover { background: rgba(255, 255, 255, .1); }
.menu-user {
  color: #b9c9e0; font-size: 1rem; padding: .65rem .8rem .3rem;
  border-top: 1px solid rgba(255, 255, 255, .25); margin-top: .4rem;
}
.logout-form { margin: 0; }
.menu-logout {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  color: #fff; font-size: 1.1rem; font-weight: 600; padding: .65rem .8rem;
  border-radius: 8px; cursor: pointer;
}
.menu-logout:hover { background: rgba(255, 255, 255, .1); }
@media (max-width: 430px) {
  .env-badge { font-size: .6rem; padding: .08rem .3rem; }
}

/* layout */
.main { max-width: 960px; margin: 0 auto; padding: .9rem .8rem 3rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }
.card { background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: .9rem 1rem; margin: .6rem 0; }

/* buttons */
.btn {
  display: inline-block; background: #e9edf2; color: #1a1a1a;
  border: 1px solid #c9d2dc; border-radius: 8px;
  padding: .55rem 1rem; font-size: 1rem; text-decoration: none;
  cursor: pointer; text-align: center;
}
.btn-primary { background: #1d3557; border-color: #1d3557; color: #fff; font-weight: 600; }
.btn-warn { background: #b26a00; border-color: #b26a00; color: #fff; font-weight: 600; }
.btn-big { display: block; width: 100%; padding: .95rem 1rem; font-size: 1.1rem; margin: .55rem 0; }
.btn-small { padding: .25rem .6rem; font-size: .85rem; }
.btn-back { background: none; border: 0; color: #556; margin-top: .8rem; }
.btn-file { position: relative; }

/* badges + flash */
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 10px; vertical-align: middle; }
.badge-ok    { background: #d8f3dc; color: #1b4332; }
.badge-warn  { background: #ffe8c2; color: #7a4b00; }
.badge-error { background: #ffd7d9; color: #8a1c22; }
.badge-role  { background: #e2e8f0; color: #334; }
.flash { padding: .6rem .9rem; border-radius: 8px; margin: .5rem 0; }
.flash-ok    { background: #d8f3dc; color: #1b4332; }
.flash-error { background: #ffd7d9; color: #8a1c22; }
.flash-warnung { background: #fff3cd; color: #6b5200; }

/* progress gauge in the step circle (v0.6.1, fixed v0.8.0): conic ring
   fills to var(--p), the ICON inside says WHAT runs (arc = shrinking,
   ⬆ = upload, 🤖 = AI). The circle grows clearly while active and shrinks
   back to the small green check. The selectors need .step-check as prefix -
   the plain .gauge-active size was overridden by the later .step-check
   size rule (same specificity, later wins) and the circle never grew. */
.step-check { position: relative; transition: width .25s ease, height .25s ease; }
.step-check.gauge {
  border: 0 !important;
  background: conic-gradient(#1b7a4b calc(var(--p, 0) * 1%), #e2e8f0 0);
}
.step-check.gauge-active { width: 76px; height: 76px; }
.step-check.gauge::before {
  content: ''; position: absolute; inset: 7px;
  background: #fff; border-radius: 50%;
}
.step-check.gauge::after {
  content: attr(data-p); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem; font-weight: 800; color: #1b7a4b;
}
.step-check.gauge-active::after { font-size: 1.9rem; }
.gauge-spin { background: conic-gradient(#1b7a4b 0 25%, #e2e8f0 0); animation: kreis-spin .9s linear infinite; }
.gauge-pulse { animation: kreis-pulse 1s ease-in-out infinite; }
@keyframes kreis-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes kreis-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(27, 122, 75, .35); }
  50%      { box-shadow: 0 0 0 9px rgba(27, 122, 75, 0); }
}

/* lightbox - the [hidden] rule is MANDATORY: display:flex would otherwise
   override the hidden attribute and the overlay would block the whole page */
.lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 20, 35, .88);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 94vw; max-height: 88vh; border-radius: 8px; }
.foto-tile img { cursor: zoom-in; }

/* order positions on the open-box step */
.positionen-card { font-size: .85rem; max-height: 40vh; overflow-y: auto; }
.positionen-card table { width: 100%; border-collapse: collapse; }
.positionen-card td { padding: .2rem .4rem; border-top: 1px solid #eef2f6; vertical-align: top; }
.positionen-card td:first-child { white-space: nowrap; font-weight: 700; }

/* shipment list: prominent primary action + sortable column heads */
.btn-neu { max-width: 480px; margin: .3rem 0 .6rem; }
.sort-link { text-decoration: none; color: inherit; }
.sort-link:hover { text-decoration: underline; }

/* table */
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #dde3ea; border-radius: 8px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; padding: .55rem .7rem; background: #eef2f6; white-space: nowrap; }
.table td { padding: .5rem .7rem; border-top: 1px solid #e8edf2; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #f6f9fc; }
.table-small { font-size: .85rem; }
.row-error { background: #fff5f5; }
.pagination { margin: .8rem 0; display: flex; gap: .4rem; flex-wrap: wrap; }
.pagination a, .page-current { padding: .3rem .7rem; border-radius: 6px; text-decoration: none; }
.page-current { background: #1d3557; color: #fff; }

/* filter */
.filterbar { display: flex; gap: .5rem; margin: .7rem 0; flex-wrap: wrap; }
.filterbar input[type=search] { flex: 1; min-width: 180px; }
input, select, textarea {
  font: inherit; padding: .55rem .7rem; border: 1px solid #c9d2dc; border-radius: 8px;
  background: #fff; width: 100%;
}
.filterbar input, .filterbar select { width: auto; }
label { display: block; margin: .6rem 0; font-size: .95rem; }

/* detail */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .8rem; }
.override-box { background: #fff8ec; border: 1px solid #f0d9a8; border-radius: 6px; padding: .4rem .6rem; margin-top: .3rem; font-size: .9rem; }
.step-head { border-bottom: 1px solid #dde3ea; padding-bottom: .2rem; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .6rem; margin: .5rem 0; }
.foto-card { margin: 0; }
.foto-card img, .preview-img { width: 100%; border-radius: 8px; border: 1px solid #dde3ea; display: block; }
.foto-card figcaption { font-size: .75rem; color: #667; margin-top: .15rem; }
.comment { background: #fff; border: 1px solid #dde3ea; border-radius: 8px; padding: .6rem .8rem; margin: .5rem 0; }
.comment-head { display: flex; gap: .5rem; align-items: center; font-size: .85rem; flex-wrap: wrap; }
.comment-body { margin-top: .3rem; }
.comment-form textarea { margin-bottom: .5rem; }
.user-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.user-form input, .user-form select { width: auto; flex: 1; min-width: 140px; }

/* capture flow */
.screen { max-width: 480px; margin: 0 auto; }
.step-desc { font-size: 1rem; color: #334; }
.status-line { margin: .6rem 0; font-size: .95rem; }
.status-error { color: #8a1c22; font-weight: 600; }
.order-card { text-align: center; }
.order-ref { font-size: 1.6rem; font-weight: 800; letter-spacing: .12em; }
.progress { display: flex; gap: .45rem; margin: .3rem 0 .6rem; }
.dot { width: 18px; height: 18px; border-radius: 50%; background: #cdd6e0; border: 0; padding: 0; cursor: pointer; }
.dot-done { background: #2a9d8f; }
.dot-now { background: #1d3557; outline: 3px solid #b9c9e0; }
.sync-status {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: .6rem; justify-content: center;
  background: #fff8ec; border-bottom: 2px solid #f0d9a8; padding: .45rem .8rem; font-size: .9rem;
  cursor: pointer;
}
.sync-status[hidden] { display: none; }
/* detail list behind a tap on the banner (v0.7.0): plain-language photo
   list + explicit delete with its own confirmation */
.sync-detail {
  background: #fffdf5; border-bottom: 2px solid #f0d9a8;
  padding: .5rem .8rem; font-size: .9rem;
}
.sync-item { padding: .25rem 0; }
.sync-detail-actions { display: flex; gap: .5rem; margin-top: .4rem; flex-wrap: wrap; }
.update-banner {
  display: flex; align-items: center; gap: .6rem; justify-content: center;
  background: #d8e8f9; border-bottom: 2px solid #9dbfe4; padding: .45rem .8rem; font-size: .9rem;
}

/* ===================== capture checklist (v0.5.0) ===================== */
.foto-tipp { color: #445; font-size: .95rem; margin: .3rem 0 .6rem; }

.step-card {
  background: #fff; border: 1px solid #dde3ea; border-radius: 14px;
  padding: 1rem 1.1rem; margin: .8rem 0;
  box-shadow: 0 1px 3px rgba(29, 53, 87, .06);
}
.step-disabled { opacity: .45; pointer-events: none; }
.step-head-row { display: flex; gap: .8rem; align-items: flex-start; }
.step-nr {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: #1b7a4b; color: #fff; font-size: 1.3rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.step-titles { flex: 1; }
.step-titles h2 { margin: .1rem 0 .15rem; font-size: 1.2rem; }
.step-titles p { margin: 0 0 .4rem; color: #445; font-size: .98rem; }
.step-check {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: #b6c2cf; border: 3px solid #cdd6e0;
}
.step-check-done { background: #1b7a4b; border-color: #1b7a4b; color: #fff; }

/* uniform SQUARE grid (v0.7.0): photo tiles and the single "+" tile share
   one size; the trash can is a full >=48 px touch target */
.tile-row {
  display: grid; grid-template-columns: repeat(auto-fill, 150px);
  gap: .7rem; margin: .5rem 0;
}
.foto-tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 10px;
  overflow: hidden; border: 1px solid #dde3ea;
}
.foto-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* per tile: delete top-LEFT, retake top-RIGHT (Marcus 31.07.) */
.tile-del, .tile-retake {
  position: absolute; top: 4px; min-width: 48px; min-height: 48px;
  background: rgba(255, 255, 255, .92); border: 0; border-radius: 10px;
  font-size: 1.25rem; cursor: pointer;
}
.tile-del { left: 4px; }
.tile-retake { right: 4px; }
.tile-status {
  position: absolute; bottom: 6px; left: 6px;
  background: rgba(255, 255, 255, .92); border-radius: 8px;
  font-size: .9rem; padding: .1rem .4rem;
}
.tile-add {
  aspect-ratio: 1 / 1; width: 150px;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .2rem; border: 2px dashed #9db1c7; border-radius: 10px;
  background: #fbfcfe; color: #1d3557; font-size: .98rem; font-weight: 600;
  cursor: pointer; padding: .6rem; text-align: center;
}
.tile-add[hidden] { display: none; }
.tile-plus { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.manuell-box { max-width: 420px; margin-top: .4rem; }

/* collapsed finished steps (v0.7.0): green tappable row, body hidden */
.step-done-bar {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #d8f3dc; color: #1b4332; border: 0; border-radius: 10px;
  padding: .7rem .9rem; font-size: 1.05rem; font-weight: 700;
  margin-bottom: .6rem;
}
.step-done-bar[hidden] { display: none; }
.step-collapsed { padding: .4rem .5rem; }
.step-collapsed .step-done-bar { margin-bottom: 0; }
.step-collapsed .step-body { display: none; }

/* order positions behind the small list icon in the step-2 head */
.btn-positionen {
  flex: 0 0 auto; min-width: 48px; min-height: 48px;
  background: #e9edf2; border: 1px solid #c9d2dc; border-radius: 10px;
  font-size: 1.25rem; cursor: pointer;
}

/* recognition panel: comparison task line */
.erkannt-aufgabe { font-weight: 600; margin: .6rem 0 .2rem; }

/* label check area (step 4): Leichte Sprache first, tech detail small */
.label-msg {
  font-size: 1.05rem; margin: .5rem 0 .3rem; padding: .6rem .8rem;
  border-radius: 10px; background: #f2f5f8;
}
.label-ok    { background: #d8f3dc; color: #1b4332; font-weight: 600; }
.label-warn  { background: #fff3cd; color: #6b5200; }
.label-error { background: #ffd7d9; color: #8a1c22; font-weight: 600; }
.label-tech { font-size: .82rem; color: #667; margin: 0 0 .4rem .2rem; }
#label-fehler-box .btn { display: block; width: 100%; margin: .45rem 0; }

.erkannt-box {
  background: #f0faf3; border: 1px solid #bfe6cd; border-radius: 12px;
  padding: .8rem 1rem; margin: .7rem 0;
}
.erkannt-head { color: #1b7a4b; font-weight: 800; margin-bottom: .4rem; font-size: 1.05rem; }
.erkannt-table td { padding: .15rem .6rem .15rem 0; vertical-align: top; }
.erkannt-table td:first-child { color: #556; white-space: nowrap; }
.erkannt-table td:last-child { font-weight: 600; }

.checks-box {
  background: #f2f5f8; border-radius: 10px; padding: .7rem .9rem; margin: .6rem 0;
  font-size: .98rem;
}
.check-row { display: flex; gap: .55rem; align-items: flex-start; margin: .45rem 0; }
.check-icon { font-size: 1.15rem; line-height: 1.2; width: 1.4rem; text-align: center; }
.check-ok { color: #1b7a4b; font-weight: 800; }
.check-warn { color: #b26a00; font-weight: 800; }
.check-manual input { width: 1.3rem; height: 1.3rem; margin-top: .1rem; }
.check-manual { cursor: pointer; }

.finish-bar {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin: 1.2rem 0 2rem;
}
.finish-right { text-align: right; flex: 1; max-width: 480px; margin-left: auto; }
.finish-right .btn { width: 100%; }
.finish-right p { margin: .35rem 0 0; font-size: .9rem; }
#btn-abschliessen:disabled { opacity: .5; cursor: not-allowed; }
.fertig-box { text-align: center; }

.hilfe-liste li { margin: .5rem 0; }

/* auth */
.auth-body { background: #1d3557; min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.auth-main { width: 100%; max-width: 380px; padding: 1rem; }
.auth-card { background: #fff; border-radius: 12px; padding: 1.6rem 1.4rem; text-align: center; }
.auth-sub { color: #556; margin-top: -0.4rem; }
.auth-hint { font-size: .85rem; color: #667; }
