/*! RampSnap – Fahrer-App */

/* Inter wird mitgeliefert, wenn die Datei vorhanden ist; sonst greift der System-Stack. */
@font-face {
  font-family: 'InterLocal';
  src: url('fonts/inter.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --blue: #2563EB;
  --blue-dark: #1D4ED8;
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-soft: #334155;
  --muted: #64748B;
  --line: #E2E8F0;
  --ok: #10B981;
  --ok-dark: #047857;
  --warn: #F59E0B;
  --warn-dark: #B45309;
  --danger: #EF4444;
  --danger-dark: #B91C1C;
  --radius: 8px;
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
  --tap: 52px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'InterLocal', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
body.noscroll { overflow: hidden; }

button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.ic { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.screen { min-height: 100svh; display: flex; flex-direction: column; }
.main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

/* ---------------- Knöpfe ---------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--tap); padding: 12px 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn-block { display: flex; width: 100%; }
.btn-xl { min-height: 60px; font-size: 18px; }
.btn-small { min-height: 40px; padding: 8px 14px; font-size: 15px; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: var(--shadow); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.cta { margin: 4px 0 20px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; flex: none;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn .ic { width: 22px; height: 22px; }
.icon-btn-quiet { color: var(--muted); }

/* ---------------- Login ---------------- */

.login { max-width: 420px; margin: 0 auto; padding: 40px 20px calc(40px + env(safe-area-inset-bottom)); }
.login-head { text-align: center; margin-bottom: 28px; }
.logo {
  width: 64px; height: 64px; margin: 0 auto 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--blue); color: #fff; border-radius: 16px; box-shadow: var(--shadow);
}
.logo .ic { width: 32px; height: 32px; }
.login h1 { font-size: 30px; }
.login-sub { color: var(--muted); margin-top: 4px; }
.login-form { display: flex; flex-direction: column; gap: 6px; }
.login-form label, .lbl { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-top: 10px; }
.login-foot { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14px; }

.inp {
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font-size: 17px;
}
.inp:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(37 99 235 / .15); }
.inp-big, .inp-plate, .inp-slug { font-size: 22px; font-weight: 700; letter-spacing: .04em; }
.inp-slug { text-transform: uppercase; }
.form-err, .field-err { color: var(--danger-dark); font-size: 14px; min-height: 18px; margin: 6px 0; }

/* ---------------- Kopf ---------------- */

.hero { margin-bottom: 18px; }
.hero-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.hero-company { color: var(--muted); font-size: 14px; margin-top: 6px; }
.hero-status { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.hero-status.warn { color: var(--warn-dark); font-weight: 600; }
.hero-status .ic { width: 18px; height: 18px; }

.plate {
  display: inline-flex; align-items: stretch; height: 34px;
  border: 2px solid var(--ink); border-radius: 6px; background: #fff; color: #111;
  overflow: hidden; font-weight: 700;
}
.plate-eu {
  display: flex; align-items: flex-end; justify-content: center;
  width: 16px; padding-bottom: 3px; background: #0B3F99; color: #fff; font-size: 10px;
}
.plate-txt { display: flex; align-items: center; padding: 0 10px; font-size: 17px; letter-spacing: .06em; }
.plate-big { height: 42px; }
.plate-big .plate-txt { font-size: 22px; }
.plate-big .plate-eu { width: 20px; font-size: 11px; }

/* ---------------- Listen ---------------- */

.group { margin-bottom: 22px; }
.group-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin-bottom: 8px; cursor: default;
}
details.group summary.group-title { cursor: pointer; }
.rows { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.rows > li + li { border-top: 1px solid var(--line); }
.row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 14px; background: var(--surface); border: 0; text-align: left;
}
.row-btn { cursor: pointer; }
.row-btn:active { background: #F1F5F9; }
.row-label { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.row-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.row-meta { color: var(--muted); font-size: 14px; }
.row-state { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.row-state .ic { width: 18px; height: 18px; transform: rotate(180deg); }
.row-state.ok { color: var(--ok-dark); }
.row-state.ok .ic { transform: none; }
.tn { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; word-break: break-all; }
.tn-big { font-size: 22px; }
.cbx { width: 26px; height: 26px; flex: none; accent-color: var(--blue); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 3px 8px; border-radius: 999px; background: #F1F5F9; color: var(--muted);
  font-size: 12px; font-weight: 600;
}
.chip .ic { width: 14px; height: 14px; }
.chip-warn { background: #FEF3C7; color: var(--warn-dark); }
.empty { color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 16px; font-size: 15px; }

.note {
  background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: var(--radius);
  padding: 14px; margin-bottom: 18px; color: var(--ink-soft); font-size: 15px;
}
.note-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* ---------------- Fußleiste ---------------- */

.foot {
  position: sticky; bottom: 0;
  background: rgb(248 250 252 / .96);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  backdrop-filter: blur(6px);
}
.foot > .btn { max-width: 720px; margin: 0 auto; }
.foot-note { max-width: 720px; margin: 8px auto 0; color: var(--muted); font-size: 13px; text-align: center; }
.foot-state { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--ok-dark); font-weight: 600; margin-bottom: 10px; }

/* ---------------- Tour ---------------- */

.tour-head {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.tour-id {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: transparent; border: 0; cursor: pointer; text-align: left; padding: 4px 6px;
}
.tour-id-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.tour-id .ic { width: 18px; height: 18px; color: var(--muted); }

.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.meta-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 12px; min-height: 44px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink-soft); font-size: 15px; cursor: pointer;
}
.meta-item .ic { width: 18px; height: 18px; color: var(--muted); }

.pages { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 560px) { .pages { grid-template-columns: repeat(3, 1fr); } }
.page { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.page-thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 1 / 1;
  background: #F1F5F9; border: 0; padding: 0; cursor: pointer;
}
.page-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.page-thumb img.rot90 { transform: rotate(90deg); }
.page-thumb img.rot180 { transform: rotate(180deg); }
.page-thumb img.rot270 { transform: rotate(270deg); }
.page-thumb img.img-missing { opacity: .2; }
.page-no {
  position: absolute; left: 6px; top: 6px; min-width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--ink); color: #fff; border-radius: 6px; font-size: 13px; font-weight: 700;
}
.page-up {
  position: absolute; right: 6px; top: 6px; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--warn); color: #fff; border-radius: 6px;
}
.page-up .ic { width: 14px; height: 14px; }
.page-tools { display: flex; border-top: 1px solid var(--line); }
.tool {
  flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center;
  background: transparent; border: 0; color: var(--ink-soft); cursor: pointer;
}
.tool + .tool { border-left: 1px solid var(--line); }
.tool-danger { color: var(--danger-dark); }

.howto {
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; color: var(--muted);
}
.howto-lead { color: var(--ink); font-weight: 600; margin-bottom: 6px; }
.capture { display: flex; flex-direction: column; gap: 10px; }

/* ---------------- Auswahl, Dialoge ---------------- */

.sheet-wrap {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(15 23 42 / .5); padding: 0;
}
@media (min-width: 560px) { .sheet-wrap { align-items: center; padding: 20px; } }
.sheet {
  width: 100%; max-width: 520px; background: var(--surface);
  border-radius: 16px 16px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgb(15 23 42 / .18);
}
@media (min-width: 560px) { .sheet { border-radius: 16px; } }
.sheet-title { font-size: 20px; margin-bottom: 6px; }
.sheet-text { color: var(--muted); font-size: 15px; margin-bottom: 14px; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); }
.pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; }
.pick {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  min-height: var(--tap); padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
.pick.on { border-color: var(--blue); box-shadow: 0 0 0 2px rgb(37 99 235 / .18); }
.pick-name { font-weight: 600; }
.pick-note { color: var(--muted); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); z-index: 80;
  max-width: calc(100% - 32px); padding: 12px 18px;
  background: var(--ink); color: #fff; border-radius: 999px; font-size: 15px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-ok { background: var(--ok-dark); }
.toast-err { background: var(--danger-dark); }

.busy { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: rgb(15 23 42 / .35); }
.busy-box { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); font-weight: 600; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Ecken-Editor ---------------- */

.editor {
  position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column;
  background: #0F172A; color: #fff;
}
.ed-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top));
}
.ed-title { display: flex; flex-direction: column; font-size: 14px; }
.ed-title span { color: #94A3B8; font-size: 13px; }
.seg { display: inline-flex; background: #1E293B; border-radius: var(--radius); padding: 3px; }
.seg-btn {
  min-height: 38px; padding: 6px 14px; border: 0; border-radius: 6px;
  background: transparent; color: #CBD5E1; font-size: 14px; font-weight: 600; cursor: pointer;
}
.seg-btn.on { background: var(--blue); color: #fff; }
.ed-stage { position: relative; flex: 1; min-height: 0; }
.ed-canvas { position: absolute; inset: 0; touch-action: none; }
.ed-loupe {
  position: absolute; width: 120px; height: 120px; display: none;
  border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 16px rgb(0 0 0 / .5);
}
.ed-hint { padding: 0 16px 8px; color: #CBD5E1; font-size: 14px; text-align: center; }
.ed-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
}
.ed-bar .btn-dark { background: #1E293B; border-color: #334155; color: #E2E8F0; }
.ed-bar .btn { flex: 1; }

/* ---------------- Vorschau ---------------- */

.preview { position: fixed; inset: 0; z-index: 85; background: #0F172A; display: flex; flex-direction: column; color: #fff; }
.pv-bar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); font-weight: 600; }
.pv-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px; }
.pv-img { max-width: 100%; max-height: 100%; object-fit: contain; background: #fff; }
.pv-img.rot90 { transform: rotate(90deg); }
.pv-img.rot180 { transform: rotate(180deg); }
.pv-img.rot270 { transform: rotate(270deg); }
.pv-hint { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); text-align: center; color: #94A3B8; font-size: 14px; }

.fatal { padding: 24px; color: var(--danger-dark); }
.rs-picker { position: fixed; left: -9999px; width: 1px; height: 1px; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
