:root {
  --bg: #0E0D0B;
  --surface: #181612;
  --surface-2: #211E18;
  --line: #3B3120;
  --line-soft: #2A241A;
  --gold: #D9B15C;
  --gold-hi: #F0CB7A;
  --gold-dim: #5C4A24;
  --on-gold: #1A1407;
  --text: #F2EBDD;
  --text-2: #C9C0AE;
  --muted: #A89F8E;
  --faint: #8E8779;
  --paper: #F7F1E4;
  --danger: #E08A7A;
  --radius: 10px;
  --radius-sm: 6px;
  --serif: 'Cinzel', Georgia, serif;
  --sans: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--gold); }
a:hover { color: var(--gold-hi); }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
[hidden] { display: none !important; }
img { max-width: 100%; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; position: relative; }

/* Nagłówek */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(14px + env(safe-area-inset-top)) 20px 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 46px; height: 46px; }
.brand span { display: flex; flex-direction: column; font-family: var(--serif); font-size: 12.5px; font-weight: 600; line-height: 1.3; letter-spacing: .12em; color: var(--gold); }

.main { flex: 1; padding: 6px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.app--nav .main { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }

h1, .h1 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 28px; line-height: 1.15; color: var(--text); }
h2 { margin: 0; font-family: var(--serif); font-weight: 500; font-size: 21px; line-height: 1.2; }
.hello small { display: block; font-size: 14px; color: var(--muted); }
.hello h1 { font-size: 30px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.eyebrow--gold { color: var(--gold); }
.lead { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text-2); }
.small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.center { text-align: center; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.panel--gold { border-color: var(--gold); }
.panel--tight { padding: 4px 16px; gap: 0; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.divider { border-top: 1px solid var(--line); padding-top: 14px; display: flex; flex-direction: column; gap: 4px; }
.gold { color: var(--gold); }
.strong { font-weight: 600; }

/* Pieczątki */
.stamps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stamps--small { gap: 8px; }
.stamp { aspect-ratio: 1; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; border: 1px solid var(--gold-dim); }
.stamp img { width: 100%; height: 100%; display: block; border-radius: 50%; }
.stamp.is-filled { border-color: transparent; background: var(--bg); box-shadow: 0 0 0 1px rgba(217,177,92,.25); }
.stamp.is-reward:not(.is-filled) { border: 1.5px dashed var(--gold); }
.stamp__num { font-size: 13px; color: var(--faint); }
.stamps--small .stamp__num { font-size: 11px; }
.stamp__reward { font-size: 12px; font-weight: 600; color: var(--gold); }
.stamps--small .stamp__reward { font-size: 10px; }
.stamp__badge { position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%); background: var(--gold); color: var(--on-gold); font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 8px; white-space: nowrap; }
.stamp.is-new { animation: pop .7s cubic-bezier(.2,1.4,.4,1); }
@keyframes pop { 0% { transform: scale(.3) rotate(-25deg); opacity: 0; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

.chips { display: flex; gap: 8px; font-size: 12.5px; color: var(--muted); }
.chips span { flex: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; text-align: center; }
.chips strong { color: var(--text); }

/* Przyciski */
.btn { min-height: 52px; border-radius: var(--radius-sm); border: 1px solid transparent; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 600; font-size: 14px; letter-spacing: .07em; text-transform: uppercase; text-decoration: none; text-align: center; width: 100%; }
.btn--gold { background: var(--gold); color: var(--on-gold); }
.btn--gold:hover { background: var(--gold-hi); color: var(--on-gold); }
.btn--line { background: transparent; border-color: var(--gold); color: var(--gold); }
.btn--ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn--paper { background: var(--paper); color: var(--bg); }
.btn--danger { background: transparent; border-color: #6B3A30; color: var(--danger); }
.btn--sm { min-height: 44px; font-size: 12.5px; padding: 0 14px; width: auto; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn-row > * { flex: 1; }
.linkbtn { background: none; border: none; color: var(--gold); text-decoration: underline; padding: 8px 0; font-size: 14px; min-height: 44px; }

/* Formularze */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .label { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input { min-height: 50px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg); padding: 0 14px; font-size: 16px; color: var(--text); width: 100%; }
textarea.input { padding: 12px 14px; min-height: 80px; resize: vertical; }
.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--gold); outline: none; }
.split { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); flex-shrink: 0; margin-top: 1px; }
.error { color: var(--danger); font-size: 14px; }

/* Listy */
.list-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 14.5px; }
.list-row:last-child { border-bottom: none; }
.list-row span:last-child { color: var(--muted); white-space: nowrap; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .06em; padding: 2px 7px; border-radius: 10px; border: 1px solid var(--gold-dim); color: var(--gold); margin-left: 6px; vertical-align: 1px; }
.tag--solid { background: var(--gold); color: var(--on-gold); border-color: var(--gold); }

/* QR */
.qr-card { background: var(--paper); color: var(--bg); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.qr-card .qr { width: min(240px, 70vw); height: auto; display: block; }
.qr-card .name { font-weight: 600; font-size: 18px; }
.qr-card .code { font-size: 13px; color: #5C4A24; letter-spacing: .22em; font-weight: 600; }

/* Urodziny */
.bday-hero { text-align: center; align-items: center; }
.bday-hero img { width: 76px; height: 76px; }
.bday-hero .big { font-family: var(--serif); font-size: 52px; font-weight: 600; line-height: 1; color: var(--gold); }
.bday-today { background: linear-gradient(160deg, #2a2112, #181612 60%); }

/* Dolne menu */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); }
.nav__in { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.nav button { min-height: 58px; border: none; background: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav button[aria-current="page"] { color: var(--gold); }
.nav svg { width: 23px; height: 23px; }

/* Powiadomienie */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); width: min(480px, calc(100% - 32px)); background: var(--gold); color: var(--on-gold); border-radius: var(--radius-sm); padding: 14px 16px; font-size: 15px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--error { background: #F2D5CE; color: #4A1A10; }
.toast--reward { font-size: 17px; font-weight: 600; text-align: center; padding: 18px; }

/* Okno (arkusz) */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet__in { max-width: 520px; margin: 0 auto; padding: calc(12px + env(safe-area-inset-top)) 20px 40px; display: flex; flex-direction: column; gap: 16px; }
.sheet__bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; }
.back { background: none; border: none; color: var(--gold); font-weight: 600; font-size: 15px; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0; }

/* Skaner */
.scanner { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; object-fit: cover; min-height: 0; }
.scanner__frame { position: absolute; top: 50%; left: 50%; width: min(70vw, 280px); aspect-ratio: 1; transform: translate(-50%, -60%); border: 3px solid var(--gold); border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); pointer-events: none; }
.scanner__bar { padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; background: var(--bg); }

/* Panel – lista klientek */
.client { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.client:last-child { border-bottom: none; }
.client__main { flex: 1; min-height: 52px; border: none; background: transparent; border-radius: var(--radius-sm); display: flex; align-items: center; gap: 12px; padding: 0 6px; text-align: left; color: var(--text); }
.client__main:hover { background: var(--line-soft); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--gold-dim); color: var(--gold); font-size: 12.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.client__name { font-size: 15.5px; font-weight: 500; display: block; }
.client__meta { font-size: 12.5px; color: var(--muted); display: block; }
.plus { width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--gold-dim); background: transparent; color: var(--gold); font-size: 22px; flex-shrink: 0; line-height: 1; }
.dots { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.dots i { height: 8px; border-radius: 2px; background: var(--line-soft); }
.dots i.on { background: var(--gold); }
.hint { font-size: 14.5px; color: var(--text-2); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: 11px 13px; }
.hint--reward { border-color: var(--gold); color: var(--gold); font-weight: 600; font-size: 16px; }

.demo-bar { background: #2a2112; color: var(--gold); font-size: 12.5px; text-align: center; padding: 7px 12px; border-bottom: 1px solid var(--gold-dim); }
.demo-bar a { color: var(--gold-hi); }

.install { border: 1px dashed var(--gold-dim); border-radius: var(--radius); padding: 14px 16px; display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--text-2); }
.install b { color: var(--text); }

.spinner { width: 34px; height: 34px; border: 3px solid var(--gold-dim); border-top-color: var(--gold); border-radius: 50%; animation: spin 1s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Wydruk karty dla klientki bez aplikacji */
.print-card { display: none; }
@media print {
  body { background: #fff; color: #000; }
  .app, .sheet, .nav, .toast, .demo-bar { display: none !important; }
  .print-card { display: flex !important; flex-direction: column; align-items: center; gap: 10px; width: 85mm; margin: 10mm auto; padding: 8mm; border: 1px solid #D9B15C; border-radius: 4mm; color: #000; font-family: var(--sans); text-align: center; }
  .print-card img.logo { width: 26mm; }
  .print-card .qr { width: 38mm; height: 38mm; }
  .print-card h3 { font-family: var(--serif); margin: 0; font-size: 14pt; font-weight: 500; }
  .print-card p { margin: 0; font-size: 9pt; }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Okno potwierdzenia */
.ask { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.65); display: flex; align-items: center; justify-content: center; padding: 20px; }
.ask__box { background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); padding: 20px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.ask__box p { margin: 0; font-size: 16px; line-height: 1.5; }
