:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-subtle: #fafafa;
  --fg: #0a0a0a;
  --fg-muted: #71717a;
  --card: #ffffff;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --primary: #18181b;
  --primary-hover: #27272a;
  --primary-fg: #ffffff;
  --ring: #3b82f6;
  --destructive: #dc2626;
  --destructive-bg: #fee2e2;
  --success: #16a34a;
  --success-bg: #dcfce7;
  --warning-bg: #fef3c7;
  --warning-fg: #92400e;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-modal: 0 8px 24px rgb(0 0 0 / 0.12);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; margin: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg-subtle);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg); }

h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 28px; font-weight: 600; line-height: 1.2; margin-bottom: 16px; letter-spacing: -0.01em; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.3; margin-bottom: 8px; letter-spacing: -0.005em; }
h3 { font-size: 16px; font-weight: 600; line-height: 1.4; margin-bottom: 8px; }

.muted { color: var(--fg-muted); }
.muted-small { color: var(--fg-muted); font-size: 13px; }

/* Layout */
.page-shell {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.form-shell { max-width: 820px; }
.page-shell.minimal {
  max-width: 480px;
  justify-content: center;
  padding: 24px 16px 24px;
  gap: 24px;
}
.centered { width: 100%; max-width: 480px; margin: 0 auto; }
.page-shell.minimal .centered { margin: 0 auto; }

/* Topbar (gateway, form, policy) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 0 8px; }
.page-shell.minimal .topbar { justify-content: center; padding: 0 0 8px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  background: var(--primary); color: var(--primary-fg);
  font-weight: 600;
}
.brand strong { display: block; font-size: 14px; font-weight: 600; }
.brand small { display: block; margin-top: 2px; font-size: 12px; color: var(--fg-muted); }

/* Form hero (intro on form page) */
.form-hero { margin-bottom: 24px; }
.form-hero h1 { font-size: 28px; }
.eyebrow {
  display: inline-flex; align-items: center;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--bg);
  color: var(--fg-muted);
  font-size: 12px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.lead { color: var(--fg-muted); font-size: 15px; line-height: 1.6; max-width: 640px; }

/* Cards */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.verify-card { padding: 24px; }
.policy-card { padding: 32px 28px; }
.policy-card h1 { font-size: 22px; }

.section-heading { margin-bottom: 16px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; color: var(--fg-muted); font-size: 14px; }

/* Stacks and grids */
.stack { display: grid; gap: 12px; }
.form-layout { display: grid; gap: 16px; }
.form-section { padding: 24px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; font-size: 14px; font-weight: 500; }
.field span { color: var(--fg); }
.field.wide { grid-column: 1 / -1; }
.field small.muted { font-weight: 400; }

/* Form actions */
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

/* Inputs */
input, select, textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 2px rgb(59 130 246 / 0.20);
}
input[readonly] { background: var(--bg-subtle); color: var(--fg-muted); }
input[type="checkbox"] {
  width: 16px; height: 16px; min-height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

/* Consent rows */
.consent {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: flex-start;
  margin: 8px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg-subtle);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
}
.consent input { margin-top: 3px; }
.consent a { color: var(--fg); }

/* Buttons (legacy .button + new .btn) */
.button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 14px;
  background: var(--bg);
  color: var(--fg);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.button:hover, .btn:hover { background: var(--bg-subtle); border-color: var(--border-strong); }
.button:focus-visible, .btn:focus-visible { box-shadow: 0 0 0 2px rgb(59 130 246 / 0.30); outline: none; }

.button.primary, .btn-primary, .action {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-fg);
}
.button.primary:hover, .btn-primary:hover, .action:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
  color: var(--primary-fg);
}

.button.secondary, .btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--fg);
}
.button.secondary:hover, .btn-ghost:hover { background: var(--bg-subtle); }

.btn-sm { min-height: 30px; padding: 4px 10px; font-size: 13px; }

/* Badges */
.badge {
  display: inline-flex; align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  background: var(--bg);
  color: var(--fg);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.muted, .badge-neutral { background: var(--bg-subtle); color: var(--fg-muted); border-color: var(--border); }
.badge.outline { color: var(--fg); border-color: var(--border-strong); background: var(--bg); }
.badge-success { background: var(--success-bg); color: #14532d; border-color: transparent; }

/* Result blocks */
.result { margin-top: 12px; }
.result.success, .result.error, .result.loading {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
}
.result.success {
  display: flex; flex-direction: column; gap: 14px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #14532d;
}
.result.success .result-info { display: flex; flex-direction: column; gap: 4px; }
.result.success .result-info h2 { margin: 0; font-size: 16px; color: #14532d; }
.result.success .result-info p { margin: 0; font-size: 14px; color: #166534; }
.result.success .btn-primary { align-self: flex-start; }
.result.error {
  border: 1px solid #fecaca;
  background: var(--destructive-bg);
  color: var(--destructive);
}
.result.loading {
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--fg-muted);
}
.result h2 { margin-bottom: 4px; font-size: 16px; }
.status { margin-bottom: 4px; font-weight: 600; color: var(--success); }
.mode { margin-bottom: 0; color: var(--fg-muted); font-size: 13px; }

/* Trust / hero rows (gateway hero, kept for compatibility) */
.topbar-badges, .trust-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.trust-row { margin-top: 24px; }
.trust-row div {
  min-width: 140px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
}
.trust-row strong { display: block; font-size: 13px; font-weight: 600; color: var(--fg); }
.trust-row span { display: block; margin-top: 2px; color: var(--fg-muted); font-size: 13px; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.72fr);
  gap: 32px;
  align-items: center;
}
.hero-copy, .form-hero { max-width: 720px; }

.info-band {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}
.info-band h2 { margin-bottom: 4px; font-size: 16px; }
.info-band p { margin: 0; color: var(--fg-muted); font-size: 14px; max-width: 720px; }

.step {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--fg-muted);
  font-weight: 600;
  font-size: 13px;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px; height: 8px;
  margin-top: 6px;
  border-radius: 999px;
  background: var(--success);
}

/* Cookie banner */
.cookie-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px;
  max-width: 640px; margin: 0 auto;
  padding: 14px 18px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  font-size: 14px;
  display: flex; flex-direction: column; gap: 12px;
  z-index: 1000;
}
body.has-cookie-banner { padding-bottom: 130px; }
@media (min-width: 600px) {
  body.has-cookie-banner { padding-bottom: 90px; }
}
.cookie-banner p { margin: 0; color: var(--fg); }
.cookie-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cookie-actions a { color: var(--fg-muted); font-size: 13px; }
@media (min-width: 600px) {
  .cookie-banner { flex-direction: row; align-items: center; }
  .cookie-banner p { flex: 1; }
}

/* Footer — sticky bottom przez body flex column */
.site-footer {
  flex: 0 0 auto;
  padding: 20px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--fg-muted);
  display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.site-footer a { color: var(--fg-muted); }
.site-footer .dot { color: var(--border-strong); }

/* Responsive */
@media (max-width: 860px) {
  .hero-grid, .field-grid { grid-template-columns: 1fr; }
  .topbar, .info-band { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 560px) {
  .page-shell { width: min(100% - 24px, 1120px); padding-top: 16px; }
  h1 { font-size: 24px; }
  .verify-card, .form-section { padding: 18px; }
  .button, .btn { width: 100%; }
  .form-actions .button, .form-actions .btn { width: auto; }
}

/* Zalaczniki — preview na formularzu */
.attachments-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.attachment-item {
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.attachment-item.attachment-error {
  background: #fef2f2;
  border-color: #fecaca;
}
.attachment-name { font-weight: 500; flex: 1; min-width: 200px; }
.attachment-meta { color: #71717a; font-size: 12px; }
.attachment-warning { color: #dc2626; font-weight: 500; font-size: 12px; }
