/* POZ Smart Rejestracja AI – style interfejsu pacjenta (izolowane prefiksem .pozsr-) */
.pozsr-root {
	--pz-navy: #1e3a8a;
	--pz-blue: #1d4ed8;
	--pz-blue-50: #eff6ff;
	--pz-blue-100: #dbeafe;
	--pz-text: #0f172a;
	--pz-muted: #475569;
	--pz-border: #cbd5e1;
	--pz-bg: #ffffff;
	--pz-ok: #166534;
	--pz-ok-bg: #dcfce7;
	--pz-warn: #854d0e;
	--pz-warn-bg: #fef9c3;
	--pz-err: #b91c1c;
	--pz-err-bg: #fee2e2;
	--pz-radius: 14px;
	--pz-focus: 0 0 0 3px #ffffff, 0 0 0 6px #1d4ed8;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--pz-text);
	box-sizing: border-box;
}
.pozsr-root *, .pozsr-root *::before, .pozsr-root *::after { box-sizing: inherit; }
.pozsr-root h2, .pozsr-root h3, .pozsr-root h4 { color: var(--pz-navy); font-family: inherit; line-height: 1.25; margin: 0 0 .6em; letter-spacing: 0; text-transform: none; }
.pozsr-root h2 { font-size: 1.35rem; }
.pozsr-root h3 { font-size: 1.15rem; }
.pozsr-root h4 { font-size: 1rem; }
.pozsr-root p { margin: 0 0 .75em; }
.pozsr-root button, .pozsr-root input, .pozsr-root textarea, .pozsr-root select { font: inherit; color: inherit; letter-spacing: normal; text-transform: none; }
.pozsr-root :focus-visible { outline: none; box-shadow: var(--pz-focus); }
.pozsr-root [hidden] { display: none !important; }
.pozsr-sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.pozsr-muted { color: var(--pz-muted); }
.pozsr-small { font-size: .875rem; }
html.pozsr-lock, html.pozsr-lock body { overflow: hidden; }

/* Przyciski */
.pozsr-open-btn, .pozsr-root .pozsr-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4em;
	min-height: 44px; padding: .6em 1.15em; border-radius: 999px;
	border: 2px solid var(--pz-blue); background: #fff; color: var(--pz-blue);
	font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2;
	transition: background-color .15s ease, color .15s ease, transform .1s ease;
}
.pozsr-open-btn, .pozsr-root .pozsr-btn-primary { background: var(--pz-blue); color: #fff; }
.pozsr-open-btn { font-size: 1.05rem; padding: .8em 1.6em; box-shadow: 0 6px 18px rgba(29, 78, 216, .25); }
.pozsr-open-btn:hover, .pozsr-root .pozsr-btn-primary:hover { background: var(--pz-navy); border-color: var(--pz-navy); color: #fff; }
.pozsr-root .pozsr-btn:hover { background: var(--pz-blue-50); }
.pozsr-root .pozsr-btn-primary:hover { background: var(--pz-navy); }
.pozsr-root .pozsr-btn-ghost { border-color: var(--pz-border); color: var(--pz-text); }
.pozsr-root .pozsr-btn-danger { border-color: var(--pz-err); color: var(--pz-err); }
.pozsr-root .pozsr-btn-danger:hover { background: var(--pz-err-bg); }
.pozsr-root .pozsr-btn-lg { min-height: 52px; font-size: 1.05rem; width: 100%; }
.pozsr-root .pozsr-btn[disabled] { opacity: .6; cursor: not-allowed; }
.pozsr-root .pozsr-link { background: none; border: 0; padding: .25em 0; color: var(--pz-blue); text-decoration: underline; cursor: pointer; min-height: 32px; }
.pozsr-root .pozsr-actions { display: flex; flex-wrap: wrap; gap: .6em; margin-top: 1em; }

/* Okno modalne */
.pozsr-overlay { position: fixed; inset: 0; z-index: 100000; background: rgba(15, 23, 42, .55); display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; transition: opacity .18s ease; }
.pozsr-overlay.pozsr-in { opacity: 1; }
.pozsr-modal { background: var(--pz-bg); width: min(760px, 100%); max-height: min(92vh, 900px); border-radius: 20px; box-shadow: 0 24px 60px rgba(15, 23, 42, .35); display: flex; flex-direction: column; transform: translateY(12px); transition: transform .18s ease; overflow: hidden; }
.pozsr-in .pozsr-modal { transform: none; }
.pozsr-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--pz-blue-100); background: linear-gradient(180deg, var(--pz-blue-50), #fff); }
.pozsr-modal-title { margin: 0 !important; }
.pozsr-root .pozsr-modal-close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--pz-navy); cursor: pointer; }
.pozsr-root .pozsr-modal-close:hover { background: var(--pz-blue-100); }
.pozsr-modal-body { padding: 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1 1 auto; }
@media (max-width: 640px) {
	.pozsr-overlay { padding: 0; align-items: stretch; }
	.pozsr-modal { width: 100%; max-height: none; height: 100vh; height: 100dvh; border-radius: 0; }
	.pozsr-modal-body { padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}

/* Osadzenie */
.pozsr-embed { border: 1px solid var(--pz-blue-100); border-radius: 20px; padding: 20px; background: #fff; max-width: 820px; }
.pozsr-embed > .pozsr-modal-title { margin-bottom: 12px !important; }

/* Wybór trybu */
.pozsr-lead { font-size: 1.1rem; font-weight: 600; }
.pozsr-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin: 12px 0; }
.pozsr-root .pozsr-choice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; text-align: left; padding: 20px; border: 2px solid var(--pz-blue-100); border-radius: var(--pz-radius); background: #fff; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease; }
.pozsr-root .pozsr-choice:hover { border-color: var(--pz-blue); box-shadow: 0 8px 24px rgba(29, 78, 216, .12); }
.pozsr-choice-icon { font-size: 28px; }
.pozsr-choice-title { font-weight: 700; font-size: 1.1rem; color: var(--pz-navy); }
.pozsr-choice-desc { color: var(--pz-muted); }
.pozsr-links { margin-top: 8px; }

/* Etapy */
.pozsr-root .pozsr-steps { list-style: none; margin: 0 0 16px; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.pozsr-steps li { display: flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--pz-muted); padding: 4px 10px 4px 4px; border-radius: 999px; background: #f1f5f9; }
.pozsr-step-no { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--pz-border); font-weight: 700; }
.pozsr-steps li.pozsr-cur { background: var(--pz-blue); color: #fff; }
.pozsr-steps li.pozsr-cur .pozsr-step-no { color: var(--pz-blue); border-color: #fff; }
.pozsr-steps li.pozsr-done { background: var(--pz-blue-100); color: var(--pz-navy); }
@media (max-width: 640px) { .pozsr-steps li:not(.pozsr-cur) .pozsr-step-label { display: none; } }

/* Karty lekarzy */
.pozsr-root .pozsr-doctor-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pozsr-doctor-card { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--pz-border); border-radius: var(--pz-radius); background: #fff; }
.pozsr-doctor-card.pozsr-any { border: 2px dashed var(--pz-blue); background: var(--pz-blue-50); }
.pozsr-doctor-photo, .pozsr-doctor-avatar { width: 64px; height: 64px; flex: 0 0 64px; border-radius: 50%; object-fit: cover; }
.pozsr-doctor-avatar { display: inline-flex; align-items: center; justify-content: center; background: var(--pz-blue-100); color: var(--pz-navy); font-weight: 700; font-size: 1.2rem; }
.pozsr-root .pozsr-doctor-name { margin: 0 0 2px; font-size: 1.05rem; }
.pozsr-doctor-spec, .pozsr-doctor-scope { margin: 0 0 4px !important; color: var(--pz-muted); font-size: .92rem; }
.pozsr-doctor-next { font-size: .92rem; margin: 6px 0 10px !important; }
.pozsr-doctor-body { flex: 1; min-width: 0; }

/* Rodzaje wizyt */
.pozsr-type-list { display: grid; gap: 10px; }
.pozsr-root .pozsr-type { display: flex; flex-direction: column; align-items: flex-start; text-align: left; gap: 2px; padding: 14px 16px; border: 2px solid var(--pz-blue-100); border-radius: var(--pz-radius); background: #fff; cursor: pointer; min-height: 56px; }
.pozsr-root .pozsr-type:hover { border-color: var(--pz-blue); }
.pozsr-type-name { font-weight: 700; color: var(--pz-navy); }
.pozsr-type-meta, .pozsr-type-desc { color: var(--pz-muted); font-size: .9rem; }

/* Kalendarz */
.pozsr-cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pozsr-root .pozsr-cal-title { margin: 0; text-transform: capitalize; }
.pozsr-root .pozsr-cal-nav { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--pz-border); background: #fff; font-size: 22px; cursor: pointer; color: var(--pz-navy); }
.pozsr-root .pozsr-cal-nav[disabled] { opacity: .35; cursor: not-allowed; }
.pozsr-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.pozsr-cal-dow { text-align: center; font-size: .8rem; font-weight: 700; color: var(--pz-muted); padding: 4px 0; }
.pozsr-root .pozsr-cal-day { height: 48px; min-height: 44px; border-radius: 12px; border: 1px solid transparent; background: #f8fafc; color: #64748b; cursor: not-allowed; font-weight: 600; }
.pozsr-root .pozsr-cal-day.pozsr-has { background: var(--pz-blue-50); color: var(--pz-navy); border-color: var(--pz-blue-100); cursor: pointer; }
.pozsr-root .pozsr-cal-day.pozsr-has:hover { border-color: var(--pz-blue); }
.pozsr-root .pozsr-cal-day.pozsr-sel { background: var(--pz-blue); color: #fff; }
.pozsr-slots { margin-top: 16px; }
.pozsr-slot-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pozsr-root .pozsr-slot { min-height: 48px; padding: 8px; border-radius: 12px; border: 2px solid var(--pz-blue); background: #fff; color: var(--pz-blue); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.pozsr-root .pozsr-slot:hover { background: var(--pz-blue); color: #fff; }
.pozsr-root .pozsr-slot.pozsr-taken { border-color: var(--pz-border); color: #94a3b8; text-decoration: line-through; }
.pozsr-slot-time { font-weight: 700; font-size: 1.05rem; }
.pozsr-slot-doc { font-size: .75rem; text-align: center; }

/* Formularze */
.pozsr-form { display: grid; gap: 12px; }
.pozsr-field { display: grid; gap: 4px; }
.pozsr-field label { font-weight: 600; }
.pozsr-root .pozsr-field input, .pozsr-root .pozsr-field textarea, .pozsr-root .pozsr-chat-input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1.5px solid #94a3b8; border-radius: 10px; background: #fff; }
.pozsr-root .pozsr-field input[aria-invalid=true] { border-color: var(--pz-err); }
.pozsr-root input.pozsr-code { font-size: 1.5rem; letter-spacing: .35em; text-align: center; max-width: 220px; }
.pozsr-help { font-size: .85rem; color: var(--pz-muted); }
.pozsr-field-error { color: var(--pz-err); font-size: .875rem; min-height: 0; }
.pozsr-check { display: flex; align-items: flex-start; gap: 10px; }
.pozsr-root .pozsr-check input { width: 22px; height: 22px; margin-top: 2px; flex: 0 0 22px; }
.pozsr-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pozsr-privacy { background: #f8fafc; border-radius: 12px; padding: 12px; }
.pozsr-guardian { display: grid; gap: 12px; padding-left: 12px; border-left: 3px solid var(--pz-blue-100); }

/* Podsumowanie, komunikaty */
.pozsr-card { border: 1px solid var(--pz-blue-100); border-radius: var(--pz-radius); padding: 14px 16px; margin-bottom: 14px; background: var(--pz-blue-50); }
.pozsr-root .pozsr-summary { display: grid; gap: 6px; margin: 0 0 12px; }
.pozsr-summary > div { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.pozsr-summary dt { color: var(--pz-muted); }
.pozsr-root .pozsr-summary dd { margin: 0; font-weight: 600; }
@media (max-width: 480px) { .pozsr-summary > div { grid-template-columns: 1fr; gap: 0; } }
.pozsr-alert { padding: 12px 14px; border-radius: 12px; margin: 8px 0; border-left: 4px solid; }
.pozsr-alert-info { background: var(--pz-blue-50); border-color: var(--pz-blue); }
.pozsr-alert-success { background: var(--pz-ok-bg); border-color: var(--pz-ok); color: var(--pz-ok); }
.pozsr-alert-warning { background: var(--pz-warn-bg); border-color: #ca8a04; color: var(--pz-warn); }
.pozsr-alert-error { background: var(--pz-err-bg); border-color: var(--pz-err); color: var(--pz-err); }
.pozsr-success { text-align: center; padding: 8px 0 12px; }
.pozsr-success-icon { width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; background: var(--pz-ok-bg); color: var(--pz-ok); font-size: 34px; display: flex; align-items: center; justify-content: center; }
.pozsr-booking-no strong { font-size: 1.35rem; letter-spacing: .04em; color: var(--pz-navy); }

/* Czat */
.pozsr-chat { display: flex; flex-direction: column; gap: 10px; min-height: 420px; }
.pozsr-chat-note { background: #f8fafc; padding: 10px 12px; border-radius: 12px; color: var(--pz-muted); }
.pozsr-chat-log { flex: 1; min-height: 260px; max-height: 55vh; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px; }
.pozsr-msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; word-wrap: break-word; }
.pozsr-msg-user { align-self: flex-end; background: var(--pz-blue); color: #fff; border-bottom-right-radius: 4px; }
.pozsr-msg-bot { align-self: flex-start; background: #f1f5f9; border-bottom-left-radius: 4px; }
.pozsr-msg-emergency { background: var(--pz-err-bg); color: var(--pz-err); font-weight: 600; border: 2px solid var(--pz-err); }
.pozsr-typing { color: var(--pz-muted); font-style: italic; }
.pozsr-msg-ui { align-self: stretch; }
.pozsr-secure { border: 2px solid var(--pz-blue-100); border-radius: var(--pz-radius); padding: 12px; background: #fff; }
.pozsr-secure-label { font-weight: 700; color: var(--pz-navy); font-size: .9rem; }
.pozsr-chat-form { display: flex; gap: 8px; align-items: flex-end; }
.pozsr-root .pozsr-chat-input { resize: vertical; }
.pozsr-chat-tools { display: flex; gap: 16px; flex-wrap: wrap; }
.pozsr-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.pozsr-root .pozsr-chip { border: 1px solid var(--pz-blue-100); background: var(--pz-blue-50); color: var(--pz-navy); border-radius: 999px; padding: 6px 12px; cursor: pointer; min-height: 36px; text-align: left; }
.pozsr-root .pozsr-chip:hover { border-color: var(--pz-blue); }

@media (prefers-reduced-motion: reduce) {
	.pozsr-root *, .pozsr-overlay, .pozsr-modal { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
	.pozsr-root .pozsr-btn, .pozsr-root .pozsr-slot, .pozsr-root .pozsr-cal-day { border: 1px solid ButtonText; }
}
