/* Wygląd wg makiet Pawła (docs/materialy-od-pawla/makieta-*.jpg): granat #0F172A, złote przyciski, duże cele dotyku. */
:root {
  --bg: #0f172a;
  --card: #1e293b;
  --card-2: #172033;
  --border: #334155;
  --text: #f8fafc;
  --muted: #94a3b8;
  --dim: #64748b;
  --gold: #eab308;
  --gold-2: #d97706;
  --gold-text: #facc15;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --green: #22c55e;
  --green-2: #16a34a;
  --red: #ef4444;
  --red-bg: #2a1520;
  --radius: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  min-height: 100dvh;
}
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3 { margin: 0; }
p { line-height: 1.45; }
a { color: #60a5fa; }
[hidden] { display: none !important; }

/* ---------- karty ---------- */
.card {
  background: linear-gradient(145deg, var(--card), var(--bg));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.title-gold { color: var(--gold-text); font-weight: 800; font-size: 1.6rem; text-align: center; margin: 8px 0 16px; }
.subtitle { color: var(--muted); text-align: center; margin: -8px 0 16px; font-size: 0.95rem; }

/* ---------- przyciski ---------- */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s ease, filter 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  border-color: #fde047;
  color: #000;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 10px 25px -5px rgba(217, 119, 6, 0.4);
}
.btn-blue {
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  border-color: #3b82f6;
  color: #fff;
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.3);
}
.btn-green {
  background: linear-gradient(90deg, var(--green), var(--green-2));
  border-color: #4ade80;
  color: #fff;
  font-weight: 900;
  font-size: 1.2rem;
  min-height: 68px;
  text-transform: uppercase;
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.35);
}
.btn-red { background: #7f1d1d; border-color: var(--red); color: #fff; }
.btn-ghost { background: none; border: none; color: var(--muted); }
.btn-small { min-height: 44px; width: auto; padding: 8px 14px; font-size: 0.9rem; border-radius: 12px; }
.btn-row { display: flex; gap: 12px; margin-top: 20px; }
.btn-row > .btn:first-child { flex: 1; }
.btn-row > .btn:last-child { flex: 2; }
.btn-row.even > .btn { flex: 1; }

/* ---------- pola ---------- */
label.field { display: block; }
.field-label { display: block; color: var(--muted); font-size: 0.9rem; margin: 0 0 6px 4px; }
.input {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  color: #fff;
  padding: 14px 16px;
  border-radius: 12px;
  font: inherit;
  font-size: 1.05rem; /* >= 16px: iOS nie przybliża przy fokusie */
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}
.input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(234, 179, 8, 0.2); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.4; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-2 .field-label { font-size: 0.8rem; min-height: 2.3em; display: flex; align-items: flex-end; }

.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--dim); font-weight: 700; font-size: 0.85rem; text-transform: uppercase; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- logowanie / pulpit ---------- */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.logo-box { background: #fff; border-radius: 18px; padding: 8px; width: 180px; margin: 0 auto 12px; }
.logo-box img { display: block; width: 100%; height: auto; }
.tagline { color: var(--muted); text-transform: uppercase; letter-spacing: 3px; font-size: 0.8rem; font-weight: 600; text-align: center; margin: 0 0 28px; }
.welcome { text-align: center; padding: 18px; }
.welcome h1 { color: var(--gold-text); font-size: 1.3rem; text-transform: uppercase; letter-spacing: 0.5px; }
.welcome p { margin: 6px 0 0; color: #cbd5e1; overflow-wrap: anywhere; }
.topbar { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 4px 0 16px; color: var(--muted); font-weight: 700; letter-spacing: 2px; font-size: 0.8rem; }
.topbar img { width: 28px; height: 28px; border-radius: 50%; background: #fff; }
.tile { flex-direction: column; gap: 10px; border-radius: 22px; padding: 28px 16px; font-size: 1.3rem; }
.tile .icon { font-size: 2.6rem; line-height: 1; }
.tile.big { padding: 40px 16px; font-size: 1.5rem; }
.tiles > * + * { margin-top: 18px; }
.logout { margin-top: auto; padding-top: 32px; }
.logout .btn { text-transform: uppercase; letter-spacing: 3px; text-decoration: underline; color: var(--dim); }

/* ---------- nagłówek podstron ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 20px; }
.page-head h2 { color: var(--gold-text); font-size: 1.4rem; text-transform: uppercase; }

/* ---------- kroki ---------- */
.steps { display: flex; align-items: center; margin: 8px 4px 20px; }
.dot {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  background: #334155; color: var(--muted);
}
.dot.done { background: #ca8a04; color: #000; }
.dot.current { background: var(--gold-text); color: #000; box-shadow: 0 0 0 4px #713f12, 0 0 12px rgba(250, 204, 21, 0.5); }
.dot-line { flex: 1; height: 4px; margin: 0 6px; border-radius: 4px; background: #334155; }

.warning { background: var(--red-bg); border: 1px solid #991b1b; border-radius: 28px; padding: 24px 20px; }
.warning .big-icon { font-size: 3rem; text-align: center; }
.warning h2 { color: var(--red); text-align: center; font-size: 1.7rem; margin: 6px 0 12px; }
.warning ul { background: rgba(127, 29, 29, 0.35); border: 1px solid rgba(153, 27, 27, 0.6); border-radius: 16px; margin: 18px 0 24px; padding: 14px 14px 14px 34px; color: #cbd5e1; }
.warning li { margin: 8px 0; }

.section-title { display: flex; align-items: center; gap: 10px; font-size: 1.15rem; font-weight: 800; margin-bottom: 14px; }
.field-group { margin: 8px 0 0; color: var(--gold-text); font-size: 0.85rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.03em; }
.section-num { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #000; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; flex: none; }
.card.section { border-top: 2px solid var(--gold); }

.gps-result { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(37, 99, 235, 0.15); border: 1px solid rgba(59, 130, 246, 0.5); }

/* ---------- zdjęcia ---------- */
.photo-cat + .photo-cat { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.photo-cat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.photo-cat-head h4 { margin: 0; font-size: 1rem; }
.count { color: var(--muted); font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.count.full { color: var(--green); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin-bottom: 10px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #0b1222; border: 1px solid var(--border); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Pole dotyku 44x44 (rękawice, brudny ekran); widoczne kółko 32 px dzięki przezroczystej ramce. */
.thumb .remove {
  position: absolute; top: 0; right: 0; z-index: 1;
  width: 44px; height: 44px; border-radius: 50%;
  border: 6px solid transparent; background: rgba(15, 23, 42, 0.85); background-clip: padding-box;
  color: #fff; font-size: 1.1rem; line-height: 1; padding: 0; cursor: pointer;
}
.thumb .thumb-retry {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  height: 44px; border: none; background: var(--gold); color: #000; font-weight: 800; font-size: 0.9rem; cursor: pointer;
}
.thumb .progress { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(0, 0, 0, 0.5); }
.thumb .progress > div { height: 100%; background: var(--gold); width: 0; transition: width 0.2s; }
.thumb .state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; background: rgba(15, 23, 42, 0.6); font-size: 0.75rem; font-weight: 700; text-align: center; padding: 4px; }
.thumb.error .state { background: rgba(127, 29, 29, 0.8); justify-content: flex-start; padding: 6px 40px 46px 6px; font-size: 0.65rem; overflow: hidden; }
.pick-row { display: flex; gap: 8px; }
.pick-row .btn { flex: 1; min-height: 50px; font-size: 0.95rem; }
.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- lista lokalizacji ---------- */
.loc-card { display: block; width: 100%; text-align: left; color: inherit; text-decoration: none; cursor: pointer; border-left: 4px solid var(--gold); font: inherit; }
.loc-card.st-sent { border-left-color: var(--green); }
.loc-card.st-send_error { border-left-color: var(--red); }
.loc-card.st-sending { border-left-color: var(--blue); }
.loc-card h3 { font-size: 1.1rem; }
.badge { display: inline-block; margin-top: 8px; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; border: 1px solid; }
.badge.st-draft { color: var(--gold-text); background: rgba(234, 179, 8, 0.15); border-color: rgba(234, 179, 8, 0.35); }
.badge.st-sent { color: #4ade80; background: rgba(34, 197, 94, 0.15); border-color: rgba(34, 197, 94, 0.35); }
.badge.st-send_error { color: #f87171; background: rgba(239, 68, 68, 0.15); border-color: rgba(239, 68, 68, 0.4); }
.badge.st-sending { color: #93c5fd; background: rgba(37, 99, 235, 0.15); border-color: rgba(59, 130, 246, 0.4); }
.meta-line { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* ---------- komunikaty ---------- */
.alert { border-radius: 14px; padding: 14px 16px; margin: 12px 0; border: 1px solid; line-height: 1.4; }
.alert-error { background: rgba(127, 29, 29, 0.35); border-color: #b91c1c; color: #fecaca; }
.alert-info { background: rgba(37, 99, 235, 0.12); border-color: #1d4ed8; color: #bfdbfe; }
.alert-success { background: rgba(22, 163, 74, 0.15); border-color: #16a34a; color: #bbf7d0; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: 1.3rem; letter-spacing: 1px; color: #fff; background: #0b1222; padding: 10px 12px; border-radius: 10px; margin: 8px 0; user-select: all; word-break: break-all; }

.save-state { text-align: right; margin: -12px 4px 8px; font-size: 0.75rem; font-weight: 700; color: var(--muted); min-height: 1em; }
.save-state.error { color: #fca5a5; }

.summary dl { margin: 0; }
.summary dt { color: var(--muted); font-size: 0.85rem; margin-top: 10px; }
.summary dd { margin: 2px 0 0; word-break: break-word; white-space: pre-wrap; }
.summary .empty { color: var(--dim); font-style: italic; }
.done-icon { font-size: 4.5rem; text-align: center; margin: 12px 0; }
.done-title { font-size: 2rem; font-weight: 900; text-align: center; margin-bottom: 12px; }

.user-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.user-row + .user-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.user-row .who { min-width: 0; }
.user-row .who div { overflow-wrap: anywhere; }
.user-actions { display: flex; flex-direction: column; gap: 6px; flex: none; }
.inactive { opacity: 0.55; }

/* ---------- nakładka i toast ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, 0.92); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; }
.overlay-text { color: var(--gold-text); font-weight: 800; font-size: 1.2rem; text-align: center; }
.spinner { width: 56px; height: 56px; border-radius: 50%; border: 6px solid #334155; border-top-color: var(--gold); animation: spin 0.9s linear infinite; margin-bottom: 20px; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: #0b1222; border: 1px solid var(--border); color: #fff; padding: 12px 18px; border-radius: 12px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.toast.error { border-color: #b91c1c; background: #450a0a; }

.view-enter { animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view-enter, .spinner { animation: none; } }
