:root {
  --navy: #12263a;
  --ink: #0c1824;
  --paper: #efe8db;
  --white: #fffcf7;
  --gold: #b07d12;
  --gold-soft: #f3e4bf;
  --muted: #c5d2dc;
  --line: rgba(18, 38, 58, 0.12);
  --danger: #9b2c2c;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Figtree", system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  font-family: var(--sans);
  background: var(--navy);
  color: var(--white);
  min-height: 100dvh;
  min-height: 100svh;
  line-height: 1.45;
  overflow: hidden;
}
a { color: var(--gold-soft); }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 1rem; }
.screen { min-height: 100dvh; display: none; flex-direction: column; }
.screen.is-on { display: flex; min-height: 100dvh; min-height: 100svh; }
.login {
  padding: calc(24px + var(--safe-t)) 20px calc(28px + var(--safe-b));
  max-width: 440px;
  margin: 0 auto;
  width: 100%;
  overflow: auto;
}
.brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}
.brand img { width: 56px; height: 56px; border-radius: 16px; }
.brand h1 { font-family: var(--serif); font-weight: 400; font-size: 1.7rem; line-height: 1.1; }
.brand p { color: #9aafbf; font-size: 0.86rem; margin-top: 4px; }
.lead { color: #e4edf4; margin-bottom: 22px; line-height: 1.5; font-size: 1.05rem; }
label { display: grid; gap: 6px; font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
input, select {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 14px 14px;
  min-height: 48px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 14px 18px; font-weight: 700; cursor: pointer;
  width: 100%; min-height: 48px; font-size: 1rem;
}
.btn:disabled { opacity: 0.55; }
.btn-gold { background: var(--gold); color: #fff8e8; }
.btn-navy { background: var(--white); color: var(--navy); }
.btn-ghost { background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #fff; }
.flash {
  background: #3a1c1c; color: #ffd7d7; padding: 10px 12px; border-radius: 12px;
  margin-bottom: 12px; font-size: 0.9rem;
}
.muted { color: #d2dde6; font-size: 0.95rem; line-height: 1.45; }
.app-head {
  padding: calc(12px + var(--safe-t)) 16px 12px;
  display: flex; justify-content: space-between; align-items: center;
  background: #0e1c2c;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.app-head h2 { font-size: 1.2rem; font-weight: 750; }
.plan-chip {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--gold); color: #fff8e8; padding: 4px 9px; border-radius: 999px;
}
.plan-chip.free { background: rgba(255,255,255,0.12); color: #d7e2eb; }
.view { flex: 1; overflow: auto; padding: 16px 16px calc(88px + var(--safe-b)); }
.card {
  background: var(--white); color: var(--ink);
  border-radius: 16px; padding: 16px; margin-bottom: 12px;
}
.card h3 { font-family: var(--serif); font-weight: 400; font-size: 1.35rem; margin-bottom: 6px; }
.card .meta { color: #4a5a68; font-size: 0.95rem; line-height: 1.4; }
.empty {
  text-align: center; padding: 36px 12px; color: #e4edf4; font-size: 1.02rem; line-height: 1.45;
}
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #0a1622;
  padding: 6px 2px calc(8px + var(--safe-b));
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 5;
}
.tabs button {
  background: none; border: 0; color: #c5d2dc; padding: 8px 2px;
  font-weight: 700; font-size: 0.78rem; line-height: 1.2; min-height: 48px;
}
.tabs button.is-on { color: var(--gold-soft); }
body.cam-open .tabs { visibility: hidden; pointer-events: none; }
.mode-switch {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 12px;
}
.mode-switch button {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.12);
  color: #c5d2dc; border-radius: 999px; padding: 10px 8px; font-weight: 700; font-size: 0.82rem;
}
.mode-switch button.is-on { background: var(--gold); color: #fff8e8; border-color: var(--gold); }
.check { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; margin: 8px 0 12px; }
.check input { width: auto; }
.view-scanner-top {
  display: flex;
  flex-direction: column;
  padding-top: 0;
}
.auto-stage { position: relative; }
.scanner-stage {
  display: none;
  position: sticky;
  top: 0;
  z-index: 3;
  background: #000;
  border-radius: 0 0 16px 16px;
  overflow: hidden;
  min-height: 42vh;
  margin: -16px -16px 12px;
  width: calc(100% + 32px);
}
.scanner-stage.is-live {
  display: block;
  min-height: 52vh;
}
.scanner-stage video, .scanner-stage canvas, .scanner-stage img {
  display: block; width: 100%; height: 52vh; max-height: none; object-fit: cover; object-position: center top; background: #000;
}
.auto-stage #auto-overlay {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: auto; max-height: none;
}
.scanner-stage canvas { touch-action: none; }
#auto-openings button {
  display: block; width: 100%; text-align: left; margin-top: 8px;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 10px 12px; color: #fff;
}
#auto-openings button.off { opacity: 0.45; text-decoration: line-through; }
#auto-dist-wrap input[type="range"] { width: 100%; margin-top: 6px; }
.hint {
  margin: 10px 0; padding: 12px 14px; background: rgba(243,228,191,0.14);
  border-radius: 12px; color: var(--gold-soft); font-size: 1rem; line-height: 1.45;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.row .btn { width: auto; flex: 1; min-width: 120px; }
.result {
  background: var(--gold-soft); color: var(--navy); border-radius: 16px; padding: 16px; margin-top: 12px;
}
.result strong { font-family: var(--serif); font-size: 2rem; display: block; }
.lock {
  background: var(--white); color: var(--ink); border-radius: 16px; padding: 22px; text-align: center;
}
.lock a.btn { margin-top: 14px; text-decoration: none; }
.dos-thumbs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px;
}
.dos-thumbs img { width: 100%; height: 88px; object-fit: cover; border-radius: 10px; }
.dos-thumbs figcaption { font-size: 0.72rem; color: #9aafbf; margin-top: 4px; }
.lock a.btn { margin-top: 14px; text-decoration: none; }
.history { margin-top: 16px; }
.history li {
  list-style: none; background: rgba(255,255,255,0.06); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; font-size: 0.9rem;
}
.camera-bar {
  display: flex; gap: 8px; margin: 10px 0;
}
.camera-bar .btn { flex: 1; }
.dropzone {
  margin: 10px 0 14px;
  padding: 14px;
  border: 1.5px dashed rgba(243, 228, 191, 0.45);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}
.dropzone p { color: #d2dde6; font-size: 0.95rem; margin-bottom: 10px; line-height: 1.45; }
.dropzone.is-over { border-color: var(--gold); background: rgba(176, 125, 18, 0.16); }
.hidden { display: none !important; }
video.live { min-height: 240px; }
.cloud-used { margin: 8px 0 14px; }
.cloud-used .bar { height: 8px; background: rgba(255,255,255,0.12); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.cloud-used .bar > span { display: block; height: 100%; background: var(--gold); }
.account .card { margin-top: 12px; }
.klus-omsch { white-space: pre-wrap; margin-top: 10px; font-size: 1rem; line-height: 1.45; color: var(--ink); }
.card .contact { margin-top: 10px; font-size: 1rem; color: var(--ink); }
.app-cam {
  position: fixed; inset: 0; z-index: 40;
  background: #000;
  display: flex; flex-direction: column;
  justify-content: flex-start;
  padding: 0;
  padding-top: var(--safe-t);
}
.app-cam video {
  flex: 1 1 auto;
  width: 100%;
  min-height: 58%;
  height: auto;
  object-fit: cover;
  object-position: center top;
  border-radius: 0;
  background: #111;
}
.app-cam-dock {
  flex: 0 0 auto;
  padding: 12px 12px calc(16px + var(--safe-b));
  background: #0a1622;
}
.app-cam-act { display: flex; gap: 8px; margin: 0; }
.app-cam-act .btn { flex: 1; }
.app-cam #app-cam-hint { margin-top: 10px; text-align: center; color: #d2dde6; }
