:root {
  --bg: #f4f6fb; --card: #fff; --text: #1a1f36; --muted: #6b7280; --border: #e5e7eb;
  --primary: #2563eb; --primary-dark: #1d4ed8; --danger: #dc2626; --success: #16a34a; --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.7rem; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; margin: 0 0 .75rem; }
h3 { font-size: 1.05rem; margin: 0 0 .4rem; }
p { margin: 0 0 .75rem; }
code { background: #eef2ff; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.inline { display: inline; }

.topbar { background: var(--card); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a.active, .nav a:hover { color: var(--text); text-decoration: none; }
.nav a.btn, .nav a.btn:hover { color: #fff; }
.nav button.link { color: var(--muted); font-weight: 500; }
main { padding: 24px 16px 40px; }
.footer { padding: 16px; color: var(--muted); font-size: .85rem; text-align: center; }

.btn { display: inline-block; background: var(--primary); color: #fff; border: 1px solid var(--primary); padding: 9px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; font-size: .95rem; line-height: 1.2; }
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline:hover { background: #eef2ff; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #fef2f2; }
.btn-sm { padding: 5px 10px; font-size: .85rem; }
.btn-lg { padding: 12px 24px; font-size: 1.05rem; }
.btn-block { width: 100%; }
button.link { background: none; border: none; color: var(--primary); cursor: pointer; font: inherit; padding: 0; }
button.link:hover { text-decoration: underline; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.card.narrow { max-width: 480px; margin: 20px auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.link-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; }
.stat-num { font-size: 1.8rem; font-weight: 700; }
.stat-label { color: var(--muted); font-size: .9rem; }
@media (max-width: 600px) { .stats { grid-template-columns: 1fr; } }

.flash { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash ul { margin: 0; padding-left: 18px; }
.flash-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.flash-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.flash-info { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.flash-warn { background: #fffbeb; border-color: #fde68a; color: #92400e; }

label { display: block; margin-bottom: 14px; font-weight: 500; }
label small { font-weight: 400; display: block; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid #d1d5db; border-radius: 8px; font: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
label.checkbox { display: flex; align-items: center; gap: 8px; }
label.checkbox input { width: auto; margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.colors { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.color-opt { margin: 0; cursor: pointer; }
.color-opt input { display: none; }
.color-opt span { display: block; width: 26px; height: 26px; border-radius: 50%; border: 3px solid transparent; }
.color-opt input:checked + span { border-color: var(--text); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: none; }
.list-item > div { flex: 1; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.badge { display: inline-block; font-size: .75rem; background: #f3f4f6; color: var(--muted); padding: 1px 7px; border-radius: 999px; font-weight: 500; }
.et-card .actions { margin-top: 12px; }

.day-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.day-row.disabled .intervals { opacity: .4; }
.day-row label { margin: 0; padding-top: 8px; }
.interval { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.interval input { width: 120px; margin: 0; }
@media (max-width: 600px) { .day-row { grid-template-columns: 1fr; } }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: .85rem; color: var(--muted); font-weight: 600; }
.actions-cell { white-space: nowrap; }
.actions-cell form { margin-left: 4px; }
.tabs { display: flex; gap: 4px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 4px; }
.tabs a { padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.tabs a.active { background: var(--primary); color: #fff; }
.tabs a:hover { text-decoration: none; }

.hero { text-align: center; padding: 50px 0 30px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: 2.4rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; margin-top: 30px; }
.feature { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }

.public-wrap { max-width: 640px; margin: 0 auto; }
.avatar { width: 64px; height: 64px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.8rem; font-weight: 700; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.et-link { display: flex; justify-content: space-between; align-items: center; color: var(--text); gap: 12px; }
.et-link:hover { text-decoration: none; border-color: var(--primary); }
.et-link p:last-child { margin: 0; }
.et-link .arrow { font-size: 1.4rem; color: var(--muted); }

.book { display: grid; grid-template-columns: 300px 1fr; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.book-info { padding: 24px; border-right: 1px solid var(--border); background: #fafbff; }
.book-info h1 { font-size: 1.4rem; margin: 10px 0 12px; }
.book-info .meta { color: var(--muted); margin-bottom: 6px; }
.tz-label { margin-top: 18px; font-size: .9rem; }
.book-main { padding: 24px; }
#step-pick { display: grid; grid-template-columns: 1fr 200px; gap: 24px; }
@media (max-width: 860px) { .book { grid-template-columns: 1fr; } .book-info { border-right: none; border-bottom: 1px solid var(--border); } #step-pick { grid-template-columns: 1fr; } }
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-head button { font-size: 1.5rem; padding: 0 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow { text-align: center; font-size: .75rem; color: var(--muted); text-transform: uppercase; padding: 4px 0; }
.cal-grid .day { aspect-ratio: 1; border: none; border-radius: 50%; background: transparent; color: #c0c4cc; font: inherit; cursor: default; }
.cal-grid .day.available { background: #eef2ff; color: var(--primary); font-weight: 600; cursor: pointer; }
.cal-grid .day.available:hover { background: #dbe4ff; }
.cal-grid .day.selected, .cal-grid .day.selected:hover { background: var(--primary); color: #fff; }
.cal-grid .day.today { text-decoration: underline; }
.times h3 { margin-bottom: 10px; }
.time-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding-right: 4px; }
.time-list button { padding: 9px; border: 1px solid var(--primary); color: var(--primary); background: #fff; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; }
.time-list button:hover { background: #eef2ff; }
.chosen { background: #eef2ff; border-radius: 8px; padding: 10px 12px; margin-bottom: 16px; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
#step-form { max-width: 460px; }

.details { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; margin: 16px 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.cancel-box { margin: 16px 0; }
.cancel-box summary { cursor: pointer; color: var(--danger); font-weight: 500; }
.cancel-box form { margin-top: 10px; }

/* ---------- Polecane terminy, lista oczekujących ---------- */
.time-list button.recommended { background: #fff7e6; border-color: #f59e0b; color: #92400e; }
.time-list button.recommended:hover { background: #fdebc8; }
.time-list button.recommended::before { content: '★ '; }
.time-list button.waitlist { background: #f3f4f6; border-color: #d1d5db; color: var(--muted); font-weight: 500; }
.time-list button.waitlist::before { content: '⏳ '; }
.time-list button.waitlist:hover { background: #e5e7eb; }
.legend { font-size: .8rem; margin-top: 12px; line-height: 1.6; }
.legend-rec { color: #f59e0b; }
.cal-grid .day.has-rec { box-shadow: inset 0 -3px 0 #f59e0b; }
.cal-grid .day.waitlist-only { background: #f3f4f6; color: var(--muted); cursor: pointer; }
.cal-grid .day.waitlist-only:hover { background: #e5e7eb; }
.cal-grid .day.waitlist-only.selected { background: var(--muted); color: #fff; }
.badge-info { background: #eff6ff; color: #1e40af; }
#chosen-note { font-size: .85rem; }

/* ---------- Tryb kiosku ---------- */
body.kiosk { background: #fff; }
body.kiosk main { padding: 12px; max-width: 100%; }
body.kiosk .book { border: none; font-size: 1.1rem; }
body.kiosk .time-list button, body.kiosk .btn { padding: 14px; font-size: 1.1rem; }
body.kiosk .cal-grid .day { font-size: 1.1rem; }
body.kiosk .time-list { max-height: none; }
body.kiosk .tz-label { display: none; }
.kiosk-bar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.kiosk-done { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 1.1rem; }

/* ---------- Kod QR ---------- */
.qr svg { width: 260px; height: 260px; max-width: 100%; }
.qr-card p.small { font-size: .85rem; word-break: break-all; }
.print-only { display: none; }
@media print {
  .topbar, .footer, .no-print, .flash { display: none !important; }
  .print-only { display: block; margin-bottom: 12px; font-size: 1.2rem; }
  body { background: #fff; }
  main { padding: 0; }
  .qr-grid { display: block; }
  .qr-card { border: none; page-break-inside: avoid; }
  .qr svg { width: 420px; height: 420px; }
}

/* ---------- Logowanie społecznościowe, 2FA ---------- */
.social { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.btn-social { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: var(--text); border: 1px solid #d1d5db; }
.btn-social:hover { background: #f9fafb; text-decoration: none; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .85rem; margin: 10px 0 16px; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.form-grid.tight { gap: 0 12px; }
.block { display: block; margin: -8px 0 14px; }
.code-input { font-size: 1.4rem; letter-spacing: .25em; text-align: center; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 16px; }
.secret { display: block; margin-top: 8px; font-size: 1rem; letter-spacing: .1em; word-break: break-all; }
.backup-codes { list-style: none; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0; }
.backup-codes code { display: block; padding: 8px; background: #f3f4f6; border-radius: 6px; text-align: center; font-size: 1.05rem; letter-spacing: .1em; }
.company { margin-top: -8px; }
