/* Native booking presentation. Existing theme and scheduling contracts stay authoritative. */
.portal-patient {
    --blue-soft: var(--soft);
    --muted: #5b6474;
    --portal-ease: cubic-bezier(.2,.7,.2,1);
}
.portal-patient .public-shell { min-height: calc(100svh - 65px); }
.portal-patient .portal-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    max-width: 1180px; margin: auto; padding: 23px 24px 0;
}
.portal-brand { display: flex; align-items: baseline; gap: 12px; }
.portal-brand strong { color: var(--blue-strong); font: 700 1.3rem 'DM Sans',sans-serif; }
.portal-brand span { color: var(--muted); font-size: .82rem; }
.portal-skip {
    position: absolute; top: 8px; left: 12px; z-index: 80; padding: 12px 18px;
    border-radius: 14px; color: #fff; background: var(--blue-strong); transform: translateY(-160%);
}
.portal-skip:focus { transform: none; }
.portal-header-help, .portal-help-button {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 15px; border: 1px solid var(--border); border-radius: 999px;
    background: #fff; color: var(--blue-strong); font: 700 .85rem 'DM Sans',sans-serif; cursor: pointer;
}
.portal-header-help svg { width: 21px; height: 21px; }
.portal-header-help .doko-mascot--quick { width: 26px; height: 32px; filter: none; }
.portal-flow-help { display: none; }
.portal-patient .portal-layout {
    grid-template-columns: minmax(0,1fr) 292px; gap: 22px 26px;
    padding: 24px 24px 70px;
}
.portal-layout > * { min-width: 0; }
.portal-patient .portal-identity {
    grid-column: 1 / -1; display: flex; align-items: center; gap: 20px;
    padding: 20px 26px; border-radius: 28px; box-shadow: 0 8px 28px rgba(17,24,39,.035);
    animation: portal-enter 360ms var(--portal-ease) both;
}
.portal-identity-copy { min-width: 0; }
.portal-patient .portal-identity .doctor-photo {
    flex: 0 0 82px; width: 82px; height: 82px; border-radius: 24px;
}
.portal-patient .portal-identity h1 {
    margin: 0 0 7px; font-size: clamp(1.5rem,3vw,2.1rem); line-height: 1.15; overflow-wrap: anywhere;
}
.portal-patient .portal-identity .specialty { margin: 0; line-height: 1.5; color: var(--blue-strong); }
.portal-patient .office-notice { grid-column: 1 / -1; margin: 0; border-radius: 20px; font-size: .9rem; }
.portal-patient .portal-calendar {
    border-radius: 28px; box-shadow: 0 14px 44px rgba(17,24,39,.055);
    animation: portal-enter 400ms var(--portal-ease) 40ms both;
}
.portal-patient .portal-calendar .calendar-head {
    padding: 25px 28px 22px; background: linear-gradient(120deg,#fff,var(--soft));
}
.portal-patient .portal-calendar .calendar-head h2 { font-size: clamp(1.45rem,2.6vw,1.9rem); }
.portal-patient .portal-calendar .calendar-head p { max-width: 48ch; font-size: .92rem; line-height: 1.6; }
.portal-patient .agenda-native { padding: 0; }
.portal-patient .agenda-native .steps { padding: 18px 24px 0; margin: 0; gap: 8px; }
.portal-patient .step {
    padding: 9px 10px; border-color: transparent; border-radius: 999px;
    background: transparent; font-weight: 600;
}
.portal-patient .step.is-active { color: var(--blue-strong); background: var(--soft); }
.portal-patient .step.is-active span { background: var(--blue-strong); }
.portal-patient .booking-card { border: 0; border-radius: 0; scroll-margin-top: 90px; }
.portal-patient .panel { padding: 26px 28px 28px; }
.portal-patient .panel.is-active { animation: portal-panel-enter 240ms var(--portal-ease) both; }
.portal-patient .panel-heading { margin-bottom: 22px; }
.portal-patient .panel-heading .eyebrow { display: none; }
.portal-patient .panel-heading h2 { font-size: clamp(1.2rem,2vw,1.45rem); line-height: 1.35; }
.portal-patient .panel-help { max-width: 50ch; font-size: .92rem; line-height: 1.6; }
.portal-patient .visit-choice { max-width: 470px; }
.portal-patient .visit-choice__option { border-radius: 17px; min-height: 58px; }
.portal-patient .visit-choice__option.is-selected,
.portal-patient .day-tab.is-selected,
.portal-patient .slot-button.is-selected {
    color: #fff; background: var(--blue-strong); border-color: var(--blue-strong);
}
.portal-patient .day-tab.is-selected span { color: #fff; }
.portal-patient .service-option { border-radius: 18px; padding: 18px; min-height: 110px; overflow-wrap: anywhere; }
.portal-patient .fixed-service { border-radius: 17px; }
.portal-patient .actions { position: static; margin: 25px 0 0; padding: 0; border: 0; background: transparent; }
.portal-patient .button { border-radius: 15px; }
.portal-patient .button--primary { background: var(--blue-strong); }
.portal-patient .button--ghost { color: var(--blue-strong); }
.portal-patient .button,
.portal-patient .visit-choice__option,
.portal-patient .service-option,
.portal-patient .slot-button,
.portal-header-help,
.portal-help-button {
    transition: transform 150ms var(--portal-ease), background-color 150ms ease, border-color 150ms ease;
}
.portal-patient button:not(:disabled):active { transform: scale(.985); }
.portal-patient :is(a,button,input,select,summary):focus-visible {
    outline: 2px solid var(--blue-strong); outline-offset: 3px;
}
.portal-patient .field input, .portal-patient .field select { font-size: 1rem; border-radius: 14px; }
.portal-patient .date-jump input { min-height: 44px; font-size: 1rem; }
.portal-patient .summary { grid-template-columns: repeat(auto-fit,minmax(150px,1fr)); border-radius: 18px; }
.portal-patient .summary-item { min-width: 0; overflow-wrap: anywhere; }
.portal-patient .summary-item span { text-transform: none; font-weight: 600; }
.portal-patient .confirmation { padding-block: 38px; }
.portal-support { display: grid; gap: 18px; align-content: start; animation: portal-enter 400ms var(--portal-ease) 90ms both; }
.portal-help {
    padding: 23px; border: 1px solid var(--border); border-radius: 28px;
    background: linear-gradient(160deg,var(--soft),#fff 75%);
}
.portal-help-top { display: flex; align-items: center; gap: 10px; }
.portal-help h2 { margin: 0; font: 700 1.1rem 'DM Sans',sans-serif; line-height: 1.3; }
.portal-help .doko-mascot--support { flex: 0 0 62px; width: 62px; height: 80px; filter: drop-shadow(0 8px 9px rgba(17,24,39,.1)); }
.portal-help .doko-mascot--support .mascot-head {
    transform-origin: 100px 126px; animation: portal-doko-greeting 720ms var(--portal-ease) 160ms both;
}
.portal-help p { margin: 13px 0 18px; color: var(--muted); font-size: .86rem; line-height: 1.65; }
.portal-help-button { width: 100%; background: #fff; }
.portal-office {
    padding: 21px 23px; border: 1px solid var(--border); border-radius: 24px; background: #fff;
}
.portal-office summary { min-height: 44px; padding-block: 10px; cursor: pointer; color: var(--text); font: 700 .96rem 'DM Sans',sans-serif; line-height: 1.5; }
.portal-office summary::marker { color: var(--blue-strong); }
.portal-office dl { margin: 18px 0 0; }
.portal-office dl > div + div { margin-top: 16px; }
.portal-office dt { font-size: .77rem; font-weight: 600; color: var(--muted); }
.portal-office dd { margin: 5px 0 0; font-size: .88rem; line-height: 1.6; overflow-wrap: anywhere; }
.portal-office .portal-map { display: inline-flex; min-height: 44px; align-items: center; color: var(--blue-strong); font-weight: 600; text-underline-offset: 4px; }
.portal-email-note { margin: 0; padding: 0 6px; color: var(--muted); font-size: .8rem; line-height: 1.6; }
.portal-patient .public-footer { gap: 12px 20px; padding: 23px 100px; font-size: .78rem; }
.portal-patient #chat-container:not(.chat-abierto) .chat-preview { display: none; }
.portal-patient #chat-container .chat-launcher,
body.portal-patient #chat-show { display: none; }
.portal-patient #chat-toggle { transition: transform 180ms var(--portal-ease),opacity 180ms ease; }
.portal-patient #chat-container.chat-abierto .chat-panel {
    display: flex; flex-direction: column; max-height: calc(100dvh - 36px); border-radius: 25px;
    animation: portal-panel-enter 240ms var(--portal-ease) both;
}
.portal-patient #chat-window { min-height: 80px; flex: 1 1 auto; height: min(340px,45dvh); }
.portal-patient #chat-form { flex: 0 0 auto; padding: 12px; }
.portal-patient #chat-close { flex-basis: 44px; width: 44px; height: 44px; border-radius: 14px; }
.portal-patient #chat-language { min-height: 44px; }
.portal-patient .chat-suggestion { min-height: 40px; }
.portal-patient .chat-header-title span { line-height: 1.35; }
.portal-patient.portal-chat-modal { overflow: hidden; }
.portal-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 980px) {
    .portal-patient .portal-layout { grid-template-columns: minmax(0,1fr); max-width: 820px; gap: 20px; }
    .portal-patient .portal-topbar { max-width: 820px; }
    .portal-support { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
    .portal-email-note { grid-column: 1 / -1; }
    .portal-flow-help {
        display: block; min-height: 36px; margin: 4px 24px 0 auto; padding: 6px 0;
        border: 0; background: transparent; color: var(--blue-strong); font: 600 .77rem 'Inter',sans-serif;
        text-decoration: underline; text-underline-offset: 4px; cursor: pointer;
    }
    .portal-patient .booking-card { scroll-margin-top: 110px; }
}
@media (max-width: 640px) {
    .portal-patient .portal-topbar { padding: 12px 16px 0; }
    .portal-brand { gap: 8px; }
    .portal-brand strong { font-size: 1.2rem; }
    .portal-brand span { font-size: .72rem; }
    .portal-header-help { padding: 8px 11px; font-size: .78rem; }
    .portal-patient .portal-layout { padding: 15px 12px 40px; gap: 16px; }
    .portal-patient .portal-identity { gap: 14px; padding: 18px; border-radius: 24px; }
    .portal-patient .portal-identity .doctor-photo { flex-basis: 64px; width: 64px; height: 64px; border-radius: 19px; }
    .portal-patient .portal-identity h1 { font-size: 1.28rem; margin-bottom: 5px; }
    .portal-patient .portal-identity .specialty { font-size: .83rem; }
    .portal-patient .portal-calendar { border-radius: 25px; }
    .portal-patient .portal-calendar .calendar-head { padding: 22px 20px 19px; }
    .portal-patient .portal-calendar .calendar-head h2 { font-size: 1.48rem; }
    .portal-patient .portal-calendar .calendar-head p { font-size: .85rem; line-height: 1.5; }
    .portal-patient .agenda-native .steps { padding: 14px 13px 0; gap: 4px; }
    .portal-flow-help { margin-right: 19px; }
    .portal-patient .step { padding: 8px 5px; font-size: .72rem; gap: 5px; }
    .portal-patient .step span { width: 22px; height: 22px; flex-basis: 22px; }
    .portal-patient .panel { padding: 22px 19px 24px; }
    .portal-patient .panel-heading h2 { font-size: 1.17rem; }
    .portal-patient .panel-help { font-size: .85rem; }
    .portal-patient .panel-heading--row .button { margin-top: 10px; }
    .portal-patient .service-grid, .portal-patient .form-grid { grid-template-columns: minmax(0,1fr); }
    .portal-patient .service-option { min-height: 100px; padding: 16px; }
    .portal-patient .actions {
        margin: 23px -19px -24px; padding: 12px 19px calc(12px + env(safe-area-inset-bottom));
        position: sticky; bottom: 0; border-top: 1px solid var(--border); background: rgba(255,255,255,.98);
    }
    .portal-patient .actions .button { min-width: 0; flex: 1; font-size: .88rem; padding: 11px 13px; }
    .portal-patient .summary { grid-template-columns: minmax(0,1fr); }
    .portal-support { grid-template-columns: minmax(0,1fr); gap: 14px; }
    .portal-help { padding: 20px; border-radius: 25px; }
    .portal-help-top { gap: 13px; }
    .portal-help p { margin-top: 8px; }
    .portal-office { padding: 20px; }
    .portal-patient .public-footer { padding: 22px 25px 30px; }
    .portal-patient .date-jump { flex-wrap: wrap; }
    .portal-patient #chat-container.chat-abierto {
        inset: 0; width: auto; max-width: none; height: 100dvh; min-height: 100svh; background: #fff;
    }
    .portal-patient #chat-container.chat-abierto .chat-panel {
        height: 100dvh; min-height: 0; max-height: 100dvh; margin: 0; border: 0; border-radius: 0;
    }
    .portal-patient #chat-container.chat-abierto .chat-header { gap: 8px; padding: 12px; }
    .portal-patient #chat-container.chat-abierto #chat-window { height: auto; min-height: 0; }
    .portal-patient #chat-container.chat-abierto #chat-form { padding-bottom: max(12px,env(safe-area-inset-bottom)); }
    .portal-patient #chat-container.chat-abierto .chat-launcher { display: none; }
    .portal-patient #chat-container.chat-abierto .chat-header-title strong { font-size: .9rem; }
    .portal-patient #chat-container.chat-abierto .chat-header-title span { font-size: .72rem; }
    .portal-patient #chat-container.chat-abierto #chat-language { max-width: 86px; padding-inline: 7px; }
}
@media (hover: hover) and (pointer: fine) {
    .portal-header-help:hover, .portal-help-button:hover { background: var(--soft); transform: translateY(-1px); }
}
@keyframes portal-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes portal-panel-enter { from { opacity: .3; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes portal-doko-greeting { 0%,100% { transform: rotate(0); } 40% { transform: rotate(-4deg); } 70% { transform: rotate(1deg); } }
@media (prefers-reduced-motion: reduce) {
    .portal-patient *, .portal-patient *::before, .portal-patient *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
    .portal-patient.chat-idle #chat-container:not(.chat-abierto) { transform: none; }
}
