/* Orbit Beleg-App - mobile-first, hell/dunkel automatisch */
:root {
  --bg: #f2f5f9; --card: #ffffff; --text: #17212b; --muted: #5d6b7a; --line: #dde4ec;
  --primary: #1f6feb; --primary-text: #ffffff; --secondary: #e8eef6; --secondary-text: #17324d;
  --ok: #1a7f37; --warn: #9a6700; --bad: #c62828; --notice: #fff7e0;
  --radius: 14px; --gap: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1722; --card: #182231; --text: #e8eef5; --muted: #9db0c4; --line: #2a374a;
    --primary: #4c8dff; --primary-text: #08111e; --secondary: #243247; --secondary-text: #dbe7f5;
    --ok: #4ccf75; --warn: #e3b341; --bad: #ff7b72; --notice: #3a3115;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
[hidden] { display: none !important; }

.topbar {
  display: flex; align-items: center; gap: 10px; padding: 12px var(--gap);
  padding-top: calc(12px + env(safe-area-inset-top)); background: #1f4e79; color: #fff;
}
.topbar h1 { margin: 0; font-size: 1.15rem; font-weight: 600; }
.topbar img { border-radius: 8px; }

main { max-width: 640px; margin: 0 auto; padding: var(--gap); display: grid; gap: var(--gap); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--gap); }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: .92rem; margin: 8px 0; }
.error { color: var(--bad); font-weight: 600; margin: 10px 0; }

label { display: block; font-size: .9rem; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input:not([type]) {
  width: 100%; font: inherit; padding: 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
#pair-code { font-size: 1.3rem; letter-spacing: .12em; text-transform: uppercase; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px;
  padding: 0 18px; border: 0; border-radius: 12px; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--secondary); color: var(--secondary-text); text-align: center; -webkit-tap-highlight-color: transparent;
}
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.secondary { background: var(--secondary); color: var(--secondary-text); }
.btn.big { min-height: 84px; flex-direction: column; font-size: 1rem; }
.btn.big span { font-size: 1.8rem; line-height: 1; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.link { background: none; color: var(--muted); font-weight: 500; text-decoration: underline; min-height: 44px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn:focus-visible, input:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.row .btn { flex: 1 1 140px; }

.pages { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.pages li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; }
.pages .thumb { width: 56px; height: 72px; object-fit: cover; border-radius: 8px; background: var(--secondary); flex: none; display: grid; place-items: center; font-size: 1.6rem; }
.pages .info { flex: 1; min-width: 0; }
.pages .info strong { display: block; }
.pages .info span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.pages .tools { display: flex; gap: 4px; }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 10px; background: var(--secondary); color: var(--secondary-text); font-size: 1.1rem; cursor: pointer; }
.icon-btn:disabled { opacity: .35; }

.bar { height: 10px; border-radius: 6px; background: var(--secondary); overflow: hidden; margin: 8px 0 12px; }
.bar > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.steps { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.steps li::before { content: "○"; width: 1.4em; text-align: center; }
.steps li.active { color: var(--text); font-weight: 600; }
.steps li.active::before { content: "◔"; color: var(--primary); animation: spin 1s linear infinite; display: inline-block; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓"; color: var(--ok); font-weight: 700; }
.steps li.failed { color: var(--bad); font-weight: 600; }
.steps li.failed::before { content: "✕"; color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.active::before { animation: none; } }

.notice { background: var(--notice); border-radius: 12px; padding: 12px; margin: 12px 0; }

.summary { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.summary .head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.summary .vendor { font-size: 1.15rem; font-weight: 700; }
.summary .total { font-size: 1.3rem; font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--secondary); }
.badge.ok { color: var(--ok); } .badge.partial { color: var(--warn); } .badge.bad { color: var(--bad); }
.summary dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0; }
.summary dt { color: var(--muted); } .summary dd { margin: 0; text-align: right; }
.summary ul { margin: 8px 0; padding-left: 18px; color: var(--muted); font-size: .92rem; }
.summary .warn { color: var(--warn); font-size: .92rem; }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history li { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.history li:last-child { border-bottom: 0; }
.history .meta { color: var(--muted); font-size: .85rem; }

footer { display: flex; justify-content: space-between; align-items: center; max-width: 640px; margin: 0 auto; padding: 8px var(--gap) 24px; color: var(--muted); font-size: .85rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  max-width: 90vw; background: #17212b; color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 10;
}
