/* KarteDa — receipt paper, ink and one loud lime accent. System fonts only (fast, no third-party requests). */
:root {
  --paper: #f5f2ea;
  --surface: #fffdf8;
  --ink: #141413;
  --muted: #625e55;
  --line: #e0dacb;
  --lime: #c6f135;
  --lime-ink: #141413;
  --warn-bg: #fff3cf;
  --warn-ink: #5c4300;
  --warn-line: #f0d47a;
  --danger: #c3362c;
  --ok: #1f7a3d;
  --radius: 18px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --surface: #1c1c1a;
    --ink: #f3f0e7;
    --muted: #a7a297;
    --line: #2e2d29;
    --warn-bg: #2d2610;
    --warn-ink: #f4dc8f;
    --warn-line: #5a4a14;
    --danger: #ff6b5e;
    --ok: #5fd38a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121211; --surface: #1c1c1a; --ink: #f3f0e7; --muted: #a7a297; --line: #2e2d29;
  --warn-bg: #2d2610; --warn-ink: #f4dc8f; --warn-line: #5a4a14; --danger: #ff6b5e; --ok: #5fd38a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--lime); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }

/* ---------- header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0 6px;
}
.logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 850; font-size: 22px; letter-spacing: -0.03em; text-decoration: none;
}
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--ink); display: grid; place-items: center; }
.logo-mark svg { width: 18px; height: 18px; }
.logo .da { background: var(--lime); color: var(--lime-ink); padding: 0 6px; border-radius: 7px; margin-left: 1px; }

.lang { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 999px; padding: 2px; }
.lang button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 999px;
  font-size: 14px; font-weight: 700; cursor: pointer; min-width: 44px; min-height: 34px;
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- home ---------- */
.hero { padding: 18px 0 16px; }
.hero h1 { font-size: clamp(30px, 8.5vw, 40px); line-height: 1.05; letter-spacing: -0.035em; margin: 0 0 8px; font-weight: 850; }
.hero p { margin: 0; color: var(--muted); }

.cat + .cat { margin-top: 22px; }
.cat-title {
  font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 10px 4px;
}
.stores { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tile {
  display: flex; align-items: center; gap: 12px;
  min-height: 76px; padding: 12px 16px 12px 20px; border-radius: var(--radius);
  border: 0; text-align: left; cursor: pointer; text-decoration: none;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
  transition: transform .08s ease;
}
.tile:active { transform: scale(0.98); }
.tile .name { flex: 1; min-width: 0; font-size: 27px; font-weight: 900; letter-spacing: -0.02em; line-height: 1; overflow-wrap: anywhere; }
.tile .meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 13px; font-weight: 700; opacity: 0.9; text-align: right; white-space: nowrap; }
.tile .tag { font-size: 11px; font-weight: 800; letter-spacing: .04em; padding: 2px 6px; border-radius: 6px; background: rgb(0 0 0 / 0.14); }
.tile .arrow { font-size: 30px; line-height: 1; font-weight: 400; opacity: .7; margin-top: -3px; }
.skeleton { background: var(--line); animation: pulse 1.2s infinite ease-in-out; box-shadow: none; cursor: default; }
@keyframes pulse { 50% { opacity: .55; } }

.share-cta {
  margin: 22px 0 8px; padding: 18px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px dashed var(--line);
  display: flex; gap: 14px; align-items: center; justify-content: space-between;
}
.share-cta p { margin: 0; font-size: 15px; color: var(--muted); }
.share-cta strong { display: block; color: var(--ink); font-size: 17px; }

.foot { display: flex; gap: 18px; flex-wrap: wrap; padding: 18px 0 40px; font-size: 14px; color: var(--muted); }
.foot a { text-decoration: none; border-bottom: 1px solid var(--line); padding: 6px 0; }
.foot-btn {
  font: inherit; color: var(--ink); font-weight: 700; background: var(--lime); border: 0;
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.install-hint {
  margin: -28px 0 40px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1.5px solid var(--line); font-size: 15px;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0;
  font-weight: 800; font-size: 17px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: var(--lime); color: var(--lime-ink); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { min-height: 42px; padding: 0 16px; font-size: 15px; }

/* ---------- card screen: everything black, barcode on white ---------- */
.cardview {
  position: fixed; inset: 0; z-index: 10; background: #000; color: #fff;
  display: flex; flex-direction: column;
  padding: max(10px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
.cv-top { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.cv-close {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid #333; background: transparent;
  color: #fff; font-size: 22px; cursor: pointer; display: grid; place-items: center; flex: none;
}
.cv-title { font-weight: 850; font-size: 20px; letter-spacing: -0.02em; line-height: 1.1; }
.cv-title small { display: block; font-size: 13px; font-weight: 600; color: #9a9a9a; letter-spacing: 0; }
.cv-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 0; }
.code-box {
  background: #fff; border-radius: 14px; padding: 18px 10px;
  width: min(100%, 520px); display: flex; justify-content: center;
}
.code-box.qr { width: min(100%, 340px); padding: 14px; }
.code-box svg { display: block; width: 100%; height: auto; max-height: 46vh; }
.code-num { font-family: var(--mono); font-size: clamp(18px, 5.6vw, 26px); letter-spacing: .12em; color: #fff; text-align: center; word-break: break-all; }
.cv-empty { text-align: center; max-width: 340px; }
.cv-empty h2 { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.cv-empty p { color: #aaa; margin: 0 0 20px; }
.cv-actions { display: grid; gap: 8px; width: min(100%, 520px); margin: 0 auto; }
.cv-actions .btn-primary { min-height: 60px; font-size: 19px; }
.link-btn { background: none; border: 0; color: #9a9a9a; font-size: 15px; padding: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms / pages ---------- */
.page-head { display: flex; align-items: center; gap: 10px; padding: 8px 0 4px; }
.back { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--surface); display: grid; place-items: center; text-decoration: none; font-size: 20px; flex: none; }
.page-head h1 { font-size: 26px; letter-spacing: -0.03em; margin: 0; font-weight: 850; }
.lead { color: var(--muted); margin: 6px 0 18px; }
.step { margin: 0 0 22px; }
.step > label, .step > .label { display: block; font-weight: 800; margin-bottom: 8px; }
.step .label span { color: var(--muted); font-weight: 600; }

.select {
  width: 100%; min-height: 54px; padding: 0 44px 0 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23625e55' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 16px center;
  font-size: 18px; font-weight: 600; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.select:focus { border-color: var(--ink); outline: none; }
.input.input-text { font-family: var(--font); font-size: 17px; letter-spacing: 0; margin-top: 8px; }
.prog-note { font-size: 14px; color: var(--muted); margin-top: 8px; }

.drop {
  font-weight: 400;
  display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: var(--radius);
  border: 2px dashed var(--line); background: var(--surface); cursor: pointer; min-height: 84px;
}
.step > .drop { display: flex; margin: 0; font-weight: 400; }
.drop:focus-within { border-color: var(--ink); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop .icon { width: 48px; height: 48px; border-radius: 14px; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-size: 22px; flex: none; }
.preview { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.preview img { width: 76px; height: 76px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.status { font-size: 15px; }
.status.ok { color: var(--ok); font-weight: 700; }
.status.bad { color: var(--danger); font-weight: 700; }
.status code { font-family: var(--mono); font-weight: 600; word-break: break-all; }

.input {
  width: 100%; min-height: 54px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line);
  background: var(--surface); font-family: var(--mono); font-size: 20px; letter-spacing: .06em;
}
.input:focus { border-color: var(--ink); outline: none; }

.check { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 6px; cursor: pointer; font-size: 16px; font-weight: 600; }
.check input { width: 26px; height: 26px; flex: none; margin: 0; accent-color: var(--ink); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-msg { min-height: 24px; margin: 10px 0; font-size: 15px; font-weight: 700; color: var(--danger); }
.captcha-note { font-size: 13px; color: var(--muted); text-align: center; margin-top: 8px; }

.done { text-align: center; padding: 26px 0; }
.done .big { font-size: 56px; line-height: 1; }
.token {
  font-family: var(--mono); font-size: 22px; font-weight: 700; letter-spacing: .04em;
  background: var(--surface); border: 2px solid var(--ink); border-radius: 14px; padding: 14px; margin: 14px 0 10px; user-select: all; overflow-wrap: anywhere;
}

.prose h2 { font-size: 19px; margin: 22px 0 6px; letter-spacing: -0.01em; }
.prose p, .prose li { color: var(--muted); }
.prose ul { padding-left: 20px; }

.toast {
  position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--lime); color: var(--lime-ink); font-weight: 800; font-size: 16px; line-height: 1.3; padding: 12px 18px; border-radius: 16px; z-index: 30;
  box-shadow: 0 6px 24px rgb(0 0 0 / .25); width: max-content; max-width: min(440px, calc(100% - 32px)); text-align: center;
}

/* ---------- admin ---------- */
.adm-tabs { display: flex; gap: 6px; margin: 10px 0 16px; flex-wrap: wrap; }
.adm-tabs button { border: 1.5px solid var(--line); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; cursor: pointer; }
.adm-tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.adm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.adm-card header { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.adm-card header b { color: var(--ink); }
.adm-card img { width: 100%; max-height: 320px; object-fit: contain; background: #000; border-radius: 12px; }
.adm-row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.adm-row .input { flex: 1 1 200px; font-size: 16px; min-height: 46px; }
.adm-row select { min-height: 46px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); padding: 0 10px; }
.adm-preview { background: #fff; border-radius: 10px; padding: 10px; margin-top: 10px; max-width: 360px; }
.adm-preview.qr { max-width: 220px; }
.adm-preview svg { width: 100%; height: auto; display: block; }
.btn-danger { background: var(--danger); color: #fff; }
