/* Shared presentation layer. No booking, role or availability rules. */
:root {
    --accent: #5956c9;
    --accent-hover: #4541aa;
    --ink: #27334b;
    --muted: #627087;
    --paper: #f5f6fa;
    --line: #e6e9f1;
    --soft: #efeffc;
    --shadow: 0 3px 6px #28334d02, 0 12px 32px #28334d05;
}
body { font-size: 15px; -webkit-font-smoothing: antialiased; }
h1 { font-size: clamp(27px, 2.5vw, 36px); letter-spacing: -.9px; }
h2 { font-size: 23px; letter-spacing: -.45px; }
h3 { font-size: 17px; }
:focus-visible { outline-color: var(--accent); }
.ui-icon { width: 21px; height: 21px; flex-shrink: 0; }
.brand strong { letter-spacing: -1.3px; font-size: 31px; }
.brand small { letter-spacing: 2.1px; color: var(--muted); font-size: 9px; }
.button, button[type=submit] {
    gap: 9px;
    min-height: 46px;
    border-radius: 11px;
    padding: 11px 20px;
    transition: background-color .16s ease, border-color .16s ease;
}
.button-secondary, button.button-secondary { border-color: var(--line) !important; }
input:not([type=checkbox]):not([type=radio]), select, textarea {
    border-color: #d2d9e6;
    min-height: 48px;
    padding: 11px 14px;
    transition: border-color .16s ease, box-shadow .16s ease;
}
input:not([type=checkbox]):not([type=radio]):focus, select:focus, textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px #5956c910;
}
.field label { font-size: 13px; margin-bottom: 9px; }
.field small { font-size: 12px; }
.panel { border-color: var(--line); box-shadow: var(--shadow); }
.eyebrow { font-size: 10px; letter-spacing: 1.65px; }
.app-shell { grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { gap: 0; padding: 35px 20px 24px; }
.sidebar > .brand { padding: 0 15px; margin-bottom: 42px; }
.nav-caption { padding: 0 15px; margin-bottom: 14px; font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--muted); }
.sidebar nav { gap: 7px; }
.sidebar nav a { display: flex; align-items: center; gap: 13px; color: #607087; min-height: 47px; font-size: 14px; font-weight: 500; padding: 12px 15px; }
.sidebar nav a:hover { background: #f7f7fc; }
.sidebar nav a[aria-current=page] { background: var(--soft); color: var(--accent); font-weight: 600; }
.sidebar-footer { padding: 22px 14px 0; border-top: 1px solid var(--line); font-size: 12px; }
.sidebar-footer a { display: inline-block; margin-top: 8px; }
.topbar { background: var(--surface); min-height: 80px; padding: 16px 38px; }
.user-summary { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-summary p { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.user-avatar { display: grid; place-items: center; width: 40px; height: 40px; flex-shrink: 0; border-radius: 13px; background: var(--soft); color: var(--accent); font-weight: 700; }
.role-label { font-size: 12px; }
.content { padding: 34px 38px; }
.page-heading { margin-bottom: 26px; }
.page-heading h2 { margin: 0; }
.dashboard-stats { margin-bottom: 34px; gap: 22px; }
.metric-card { display: flex; align-items: flex-start; justify-content: space-between; padding: 26px 28px; }
.metric-card p { font-size: 13px; margin-bottom: 12px; }
.metric-card .stat { font-size: 37px; margin: 0 0 8px; color: var(--ink); }
.metric-card > .ui-icon { color: var(--accent); width: 26px; height: 26px; }
.metric-caption { font-size: 12px; color: var(--muted); }
.table-wrap { border-radius: 14px; box-shadow: var(--shadow); }
th { background: #fafbfe; font-size: 11px; letter-spacing: .25px; }
th, td { padding: 17px 20px; }
td { font-size: 13px; }
td a { font-weight: 600; text-decoration: none; }
td a:hover { text-decoration: underline; }
td .muted { display: inline-block; font-size: 12px; margin-top: 3px; }
.badge { font-size: 11px; padding: 5px 10px; border-color: transparent; }
.badge[data-status=cancelado], .badge[data-status=inactivo] { background: #f1f3f7; color: #626c7e; }
.badge[data-status=confirmado], .badge[data-status=activo], .badge[data-status=atendido] { background: #eaf6ef; color: #2c6845; }
.badge[data-status=ausente] { background: #fcefee; color: #9b4544; }
.badge[data-status=reprogramado] { background: #fff5e5; color: #825e23; }
.directory-search { display: flex; align-items: flex-end; gap: 20px; padding: 22px 24px; }
.directory-search .field { flex: 1; margin: 0; }
.directory-search .actions { padding-bottom: 1px; }
.empty-state { border-style: dashed; box-shadow: none; padding: 42px 24px; }
.alert { border-radius: 12px; font-size: 14px; }
/* Public booking */
.online-header { padding-top: 26px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.online-main { padding-top: 30px; }
.online-intro { margin-bottom: 28px; }
.online-intro h1 { font-size: clamp(27px, 3vw, 34px); }
.online-intro .eyebrow { color: var(--accent); }
.wizard-steps { background: white; padding: 17px 22px; border: 1px solid var(--line); border-radius: 14px; gap: 18px; box-shadow: var(--shadow); }
.wizard-steps li { padding: 6px 0 12px; border-bottom-width: 2px; font-size: 13px; }
.wizard-steps li > span { width: 31px; height: 31px; background: #f1f3f8; color: #66738a; }
.wizard-steps li.completed > span { background: var(--soft); color: var(--accent); }
.wizard-panel { padding: 30px 34px; }
.wizard-panel h2 { font-size: 25px; }
.section-heading { padding-bottom: 3px; }
.step-label { font-size: 10px; letter-spacing: 1.1px; }
.slot-search { background: #f9fafe; border: 1px solid #edf0f6; border-radius: 12px; padding: 20px; margin-bottom: 28px; }
.slot-heading h3 { font-size: 16px; margin-bottom: 8px; }
.slot-heading { margin-bottom: 16px; }
.slot-heading .muted { font-size: 12px; }
.slot-fieldset legend { font-size: 12px; color: var(--muted); }
.slot-grid { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.slot-option span { border-color: #dfe2f0; font-size: 14px; padding: 14px 10px; transition: background-color .16s ease, border-color .16s ease; }
.slot-option small { font-size: 11px; }
.slot-option:hover span { background: #f5f4fe; }
.slot-option input:checked + span { background: var(--accent); border-color: var(--accent); box-shadow: 0 3px 8px #5956c91c; }
.slot-option input:focus-visible + span { outline-color: var(--accent); }
.booking-summary { border-top: 3px solid #b6b4ec; padding: 25px; }
.booking-summary h2 { text-transform: none; font-size: 19px; line-height: 1.5; }
.booking-summary h2::first-letter { text-transform: uppercase; }
.coverage-option { padding: 17px; border-color: #dde3ee; transition: border-color .16s ease, background-color .16s ease; }
.coverage-option:hover { border-color: #a5a2e3; }
.coverage-option:has(input:checked) { background: #f8f7ff; }
.price-summary { background: #f4f3fd; border-color: #e7e5f9; }
.online-policy { font-size: 12px; padding: 0 4px; }
.online-footer { font-size: 12px; }
/* Access */
.auth-shell { grid-template-columns: minmax(320px, .9fr) minmax(460px, 1.1fr); }
.auth-story { background: #eeedf8; padding: clamp(36px, 5vw, 76px); }
.auth-message { max-width: 430px; }
.auth-symbol { display: block; margin-bottom: 30px; color: var(--accent); }
.auth-symbol .ui-icon { width: 42px; height: 42px; stroke-width: 1.2; }
.auth-story h1 { font-size: clamp(32px, 3.4vw, 46px); line-height: 1.17; letter-spacing: -1.5px; }
.auth-story p { font-size: 15px; }
.auth-story .eyebrow { color: var(--accent); font-size: 10px; }
.auth-content { padding: 48px 36px; }
.auth-form { max-width: 465px; padding: 34px; background: white; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 18px 60px #30385409; }
.auth-form h1 { font-size: 28px; }
.auth-form > p { font-size: 13px; }
.login-booking { border-bottom: 1px solid var(--line); padding-bottom: 24px; margin-bottom: 28px; }
.login-booking .button { width: 100%; background: #f8f8fd !important; color: var(--accent) !important; }
.login-submit { width: 100%; margin-top: 5px; }
.auth-form .checkbox { font-size: 13px; }
/* Calendar */
.fc .fc-toolbar-title { font-size: 20px; font-weight: 600; line-height: 1.4; letter-spacing: -.4px; }
.fc .fc-button { font-size: 12px; padding: 9px 13px; border-radius: 9px; }
.fc .fc-col-header-cell-cushion { font-size: 12px; padding: 12px 4px; color: var(--muted); }
.fc .fc-timegrid-slot-label { font-size: 11px; color: var(--muted); }
.fc .fc-timegrid-event { border-radius: 5px; padding: 3px; }
.fc .fc-scrollgrid { border-radius: 10px; overflow: hidden; }
@media (max-width: 1050px) {
    .app-shell { grid-template-columns: 210px minmax(0, 1fr); }
    .content, .topbar { padding-left: 25px; padding-right: 25px; }
    .sidebar { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 850px) {
    .booking-summary { padding: 20px; }
    .auth-shell { grid-template-columns: 1fr 1.15fr; }
    .auth-story { padding: 32px; }
    .auth-content { padding: 32px 20px; }
    .auth-form { padding: 26px; }
}
@media (max-width: 760px) {
    .app-shell { display: block; }
    .sidebar { padding: 18px 18px 8px; }
    .sidebar > .brand { padding: 0; margin-bottom: 16px; }
    .nav-caption { display: none; }
    .sidebar nav { gap: 5px; scrollbar-width: thin; scrollbar-color: #d3d5e7 transparent; }
    .sidebar nav a { padding: 10px 12px; font-size: 12px; gap: 8px; min-height: 43px; }
    .sidebar nav .ui-icon { width: 17px; height: 17px; }
    .topbar { padding: 13px 18px; }
    .user-summary { gap: 9px; }
    .user-avatar { width: 33px; height: 33px; border-radius: 10px; }
    .user-summary p { font-size: 12px; }
    .topbar button { padding: 9px 12px; font-size: 12px; }
    .content { padding: 25px 18px; }
    .metric-card { padding: 23px; }
    .dashboard-stats { gap: 14px; margin-bottom: 28px; }
    .auth-shell { display: block; }
    .auth-story { padding: 24px; gap: 24px; }
    .auth-story h1 { font-size: 30px; max-width: 410px; }
    .auth-symbol { display: none; }
    .auth-story .auth-message > p:last-child { margin-bottom: 0; font-size: 13px; }
    .auth-content { padding: 24px 18px 36px; }
    .auth-form { max-width: 500px; }
    .directory-search { flex-direction: column; align-items: stretch; gap: 16px; }
}
@media (max-width: 560px) {
    .online-header { padding: 20px 18px; }
    .online-main { padding-top: 25px; }
    .online-intro { margin-top: 0; margin-bottom: 22px; }
    .online-intro p { font-size: 14px; }
    .wizard-steps { padding: 13px 12px; gap: 8px; border-radius: 12px; }
    .wizard-steps li { font-size: 10px; gap: 9px; padding-bottom: 9px; }
    .wizard-panel { padding: 23px 19px; }
    .wizard-panel h2 { font-size: 22px; }
    .slot-search { padding: 15px; gap: 14px; }
    .slot-search .field { min-width: 0; flex-basis: 100%; }
    .slot-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    .slot-option span { padding: 13px 5px; font-size: 13px; }
    .slot-fieldset + p { font-size: 12px; }
    .auth-form { padding: 26px 22px; }
    .auth-form h1 { font-size: 26px; }
    .page-heading > .button { width: 100%; }
    .fc .fc-button { padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

/* Public monthly availability, rendered by Blade without extra dependencies. */
.month-navigation { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.month-navigation h3 { margin: 0; text-transform: capitalize; }
.month-navigation .button { min-width: 44px; padding: .6rem; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .45rem; }
.month-weekday { text-align: center; font-size: .8rem; color: var(--muted); padding: .4rem 0; }
.month-day { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: .4rem; min-height: 76px; border: 1px solid #dcdaf2; border-radius: 10px; background: #f4f3fc; color: #4541aa; text-decoration: none; }
.month-day strong { font-size: 1.1rem; }
.month-day small { font-size: .75rem; }
.month-day:hover { background: #e9e7fa; }
.month-day.is-selected { background: #5956c9; color: white; border-color: #5956c9; }
.month-day.is-unavailable { background: #f5f6f8; border-color: #edf0f4; color: #737b8a; }
#horarios { scroll-margin-top: 1rem; }
@media (max-width: 560px) {
    .month-grid { gap: 3px; }
    .month-day { min-height: 64px; border-radius: 6px; gap: .25rem; }
    .month-day small { font-size: .6rem; text-align: center; }
    .month-navigation h3 { font-size: 1.1rem; }
}

/* Public booking: vertical progress and semantic availability states. */
.online-header .brand strong { font-size: 1.35rem; letter-spacing: -.04em; }
.booking-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.booking-content { min-width: 0; }
.booking-progress { list-style: none; margin: 0; padding: 32px 24px; background: #5956c9; color: white; border-radius: 16px; }
.booking-progress li { display: flex; gap: 14px; position: relative; padding-bottom: 36px; }
.booking-progress li:last-child { padding-bottom: 0; }
.booking-progress li:not(:last-child)::before { content: ''; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 1px; background: #a9a7e6; }
.progress-number { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border: 1px solid #c6c4f2; border-radius: 50%; font-weight: 700; }
.booking-progress .current .progress-number { background: white; color: #4541aa; box-shadow: 0 0 0 4px #7774d5; }
.booking-progress strong { display: block; font-size: .95rem; line-height: 1.5; }
.booking-progress p { margin: 8px 0 0; color: #eeedff; font-size: .8rem; line-height: 1.6; }
.booking-content .section-heading h2 { padding-bottom: 18px; border-bottom: 1px solid #e7e9f1; font-size: 1.4rem; }
.booking-content .month-navigation { margin-top: 24px; }
.booking-content .month-day { min-height: 88px; }
.month-day small { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 3px; text-align: center; line-height: 1.35; }
.month-day small svg { width: 12px; height: 12px; flex-shrink: 0; }
.month-day.is-available { background: #eaf8f1; border-color: #9fd1b7; color: #226345; }
.month-day.is-available:hover { background: #d9f1e4; }
.month-day.is-blocked { background: #fbeef1; border-color: #f0d6de; color: #955568; }
.month-day.is-full { background: #fff8e6; border-color: #ebdcb0; color: #806322; }
.month-day.is-past { background: #f1f3f6; border-color: #e6e9ef; color: #737b8a; }
.month-day.is-selected { background: #eeecff; border: 2px solid #5956c9; color: #4541aa; box-shadow: 0 0 0 2px #e0dcfa; }
.calendar-legend { margin: 24px 0 16px; padding-top: 18px; border-top: 1px solid #e7e9f1; }
.calendar-legend h4 { margin: 0 0 12px; font-size: .9rem; }
.calendar-legend ul { padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 18px; list-style: none; font-size: .75rem; }
.calendar-legend li { display: flex; align-items: center; gap: 7px; }
.calendar-legend li::before { content: ''; width: 12px; height: 12px; border-radius: 4px; border: 1px solid; }
.calendar-legend .is-available::before { background: #eaf8f1; border-color: #9fd1b7; }
.calendar-legend .is-full::before { background: #fff8e6; border-color: #ebdcb0; }
.calendar-legend .is-blocked::before { background: #fbeef1; border-color: #f0d6de; }
.calendar-legend .is-past::before { background: #f1f3f6; border-color: #cbd1db; }
.booking-content .slot-option span { border-radius: 999px; }
@media (max-width: 900px) {
    .booking-layout { grid-template-columns: minmax(0, 1fr); }
    .booking-progress { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 18px 12px; }
    .booking-progress li { flex-direction: column; align-items: center; padding: 0; gap: 8px; text-align: center; }
    .booking-progress li::before, .booking-progress p { display: none; }
    .booking-progress strong { font-size: .7rem; }
    .progress-number { flex-basis: 32px; width: 32px; height: 32px; }
}
@media (max-width: 560px) {
    .booking-content .wizard-panel { padding: 20px 12px; }
    .booking-content .month-day { min-height: 78px; }
    .month-day small { font-size: .62rem; }
    .month-day small svg { width: 10px; height: 10px; }
    .calendar-legend ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .online-header .brand strong { font-size: 1.1rem; }
}

.booking-content .month-day small { max-width: 100%; min-width: 0; overflow-wrap: anywhere; }
.booking-content .slot-option input:checked + span { background: #5956c9; color: #fff; border-color: #5956c9; }

/* Compact booking with horizontal progress and adjacent time selection. */
.online-header { padding-top: 14px; padding-bottom: 14px; }
.online-main { max-width: 1280px; padding-top: 8px; }
.online-intro { margin: 4px 0 18px; }
.online-intro h1 { font-size: 28px; margin-bottom: 6px; }
.booking-layout { display: block; }
.booking-progress { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; background: white; color: #778094; padding: 14px 20px; margin-bottom: 18px; border: 1px solid #e7e9f1; }
.booking-progress li { flex-direction: row; align-items: center; padding: 0; gap: 10px; }
.booking-progress p { display: none; }
.booking-progress strong { font-size: .8rem; }
.booking-progress li:not(:last-child)::before { display: block; left: 40px; right: 0; top: 17px; bottom: auto; width: auto; height: 1px; background: #e4e5ee; z-index: 0; }
.booking-progress li > div, .progress-number { position: relative; background: white; z-index: 1; }
.progress-number { flex: 0 0 34px; width: 34px; height: 34px; border-color: #e4e5ee; }
.booking-progress .current { color: #5956c9; }
.booking-progress .current .progress-number { background: #5956c9; color: white; box-shadow: none; }
.booking-content .compact-booking { padding: 20px; }
.booking-columns { display: grid; grid-template-columns: 170px minmax(0,1fr) 270px; gap: 24px; align-items: start; }
.calendar-help h2 { font-size: 1rem; margin: 0 0 12px; }
.calendar-help p { font-size: .8rem; }
.calendar-help .calendar-legend { margin: 18px 0; padding-top: 14px; }
.calendar-help .calendar-legend ul { display: grid; grid-template-columns: 1fr; gap: 12px; }
.calendar-help .slot-search { display: block; padding: 0; margin: 12px 0 0; border: 0; }
.calendar-help .slot-search .field { min-width: 0; }
.calendar-help .slot-search button { margin-top: 10px; font-size: .75rem; }
.booking-content .month-navigation { margin: 0 0 10px; }
.month-navigation h3 { font-size: 1rem; }
.month-navigation .button { min-height: 36px; min-width: 36px; padding: 6px; }
.month-grid { gap: 4px; }
.booking-content .month-day { min-height: 56px; gap: 3px; border-radius: 7px; }
.month-day strong { font-size: .9rem; }
.month-day small { font-size: .65rem; }
.month-day small svg { display: none; }
.month-weekday { font-size: .65rem; padding: 4px 0; }
.available-times { min-width: 0; border-left: 1px solid #e7e9f1; padding-left: 20px; }
.available-times .slot-heading { display: block; }
.available-times h3 { font-size: 1rem; margin: 0 0 8px; }
.available-times .slot-heading p { font-size: .85rem; margin: 0 0 6px; text-transform: capitalize; }
.available-times .slot-heading > span { display: block; font-size: .75rem; margin-bottom: 16px; }
.available-times .slot-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; max-height: 260px; overflow-y: auto; padding: 4px; }
.available-times .slot-option span { padding: 10px 3px; font-size: .75rem; min-height: 40px; }
.available-times .slot-option small { display: none; }
.available-times .slot-fieldset { margin-bottom: 10px; }
.available-times .small { font-size: .75rem; margin: 8px 0; }
.available-times .empty-state { padding: 20px 8px; }
.slot-continue { width: 100%; }
@supports selector(form:has(input:checked)) { .available-times form:not(:has(input[name="start_time"]:checked)) .slot-continue { display: none; } }
.online-policy { margin: 12px 0; }
.online-footer { margin-top: 18px; padding-top: 0; }
@media (max-width: 1050px) {
    .booking-columns { grid-template-columns: 135px minmax(0,1fr) 220px; gap: 14px; }
    .available-times { padding-left: 12px; }
}
@media (max-width: 850px) {
    .booking-columns { grid-template-columns: minmax(0,1fr); gap: 20px; }
    .booking-month { grid-row: 1; }
    .available-times { grid-row: 2; border-left: 0; border-top: 1px solid #e7e9f1; padding: 18px 0 0; }
    .calendar-help { grid-row: 3; }
    .calendar-help .calendar-legend ul { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .available-times .slot-grid { max-height: none; }
    .booking-progress { padding: 12px 8px; gap: 6px; }
    .booking-progress li { flex-direction: column; gap: 6px; }
    .booking-progress strong { font-size: .65rem; text-align: center; }
    .booking-progress li:not(:last-child)::before { left: 55%; right: -45%; }
    .booking-content .compact-booking { padding: 16px 12px; }
    .booking-content .month-day { min-height: 62px; }
}

.patient-login-invite { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px; margin: 18px 0; background: #f1f0fc; border-radius: 12px; }
.patient-login-invite p { margin: 0; font-size: .9rem; }
.patient-login-dialog { width: min(440px, calc(100% - 32px)); max-height: calc(100dvh - 40px); overflow-y: auto; border: 1px solid #e0e2ed; border-radius: 16px; padding: 24px; color: #29334a; box-shadow: 0 20px 60px #20204433; }
.patient-login-dialog::backdrop { background: #20204488; }
.patient-login-dialog h2 { margin-top: 0; }
.patient-login-invite[hidden], #patient-login-notice[hidden], #patient-login-error[hidden] { display: none; }
@media (max-width: 560px) { .patient-login-invite { flex-direction: column; align-items: stretch; } }

.patient-readonly { padding: 20px; margin: 20px 0; background: #f7f8fb; border: 1px solid #e5e8ef; border-radius: 14px; }
.patient-readonly h3 { margin: 0 0 18px; font-size: 1rem; }
.patient-readonly dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin: 0; }
.patient-readonly dt { color: #68738a; font-size: .8rem; margin-bottom: 5px; }
.patient-readonly dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 560px) { .patient-readonly dl { grid-template-columns: minmax(0,1fr); } }

#rich-tools[hidden], #body[hidden] { display: none; }
#rich-tools button { border: 1px solid #d9dbea; border-radius: 9px; background: #f2f1fb; color: #4541aa; padding: 10px 14px; cursor: pointer; }
#rich-tools .actions { margin-bottom: 16px; }
#rich-editor:focus-visible { outline: 2px solid #5956c9; outline-offset: 2px; }

.table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
.table-scroll-hint { font-size: .85rem; margin-bottom: .5rem; }
@media(max-width: 640px) { .table-wrap td:last-child { min-width: 105px; } }

.listing-controls {display:flex;align-items:end;gap:1rem;flex-wrap:wrap}.listing-controls .field{margin:0}.table-actions{display:flex;gap:6px;flex-wrap:wrap;min-width:150px}.table-actions form{margin:0}.table-action{position:relative;display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;min-height:40px;padding:8px;border:1px solid #e4e5f0;border-radius:10px;background:#f4f4fc;color:#5752bf}.table-action:hover,.table-action:focus-visible{background:#e9e8ff}.action-tooltip{display:none;position:absolute;z-index:20;bottom:100%;right:0;background:#29334a;color:white;padding:5px 8px;border-radius:5px;white-space:nowrap;font-size:12px}.table-action:hover .action-tooltip,.table-action:focus-visible .action-tooltip{display:block}th a{color:inherit;white-space:nowrap}

/* Patient workspace: route-based tabs preserve independent filters and policies. */
.patient-tabs{display:flex;gap:6px;overflow-x:auto;max-width:100%;padding:6px;margin:0 0 24px;background:#fff;border:1px solid var(--line);border-radius:14px;scrollbar-width:thin}
.patient-tabs a{flex:0 0 auto;padding:12px 18px;border-radius:10px;text-decoration:none;color:var(--muted);font-weight:600;white-space:nowrap}
.patient-tabs a[aria-current=page]{background:#eeedfc;color:#4847aa;box-shadow:inset 0 -2px #5b5ac7}
.patient-data-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:24px;margin:0}.patient-data-grid dt{font-size:13px;color:var(--muted);margin-bottom:5px}.patient-data-grid dd{margin:0;font-weight:600;overflow-wrap:anywhere}
.section-heading{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:16px;margin-bottom:20px}.section-heading h2{margin-bottom:8px}
.profile-editor>summary,.profile-group>summary{font-weight:600;cursor:pointer;padding:8px 0;min-height:44px}.profile-editor[open]>summary{margin-bottom:20px}.profile-editor>form.panel{padding:0;border:0;box-shadow:none;margin:0}
.profile-group{border:1px solid var(--line);border-radius:12px;padding:18px;margin:20px 0;min-width:0}.profile-group legend{padding:0 8px;font-weight:600}.profile-group[open]>summary{margin-bottom:16px}
.listing-controls,.category-controls{display:flex;align-items:flex-end;gap:16px;flex-wrap:wrap}.listing-controls .field{margin-bottom:0}.listing-controls :is(input,select,button),.category-controls :is(select,button){min-height:44px}.category-controls select{width:auto;max-width:100%}
@media(max-width:700px){.patient-data-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:18px}.patient-tabs a{padding:10px 12px}.listing-controls .field{flex:1 1 130px}.profile-group{padding:14px}}
@media(max-width:420px){.patient-data-grid{grid-template-columns:1fr}}

/* Identidad institucional compartida y configuración de marca. */
.brand .institutional-logo { display: block; width: min(100%, 200px); height: 75px; object-fit: contain; object-position: left center; }
.branding-settings { margin-bottom: 2rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--color-border); }
.branding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.branding-asset { min-width: 0; padding: 1.25rem; border: 1px solid var(--color-border); border-radius: 12px; background: var(--color-surface-muted); }
.branding-asset .muted { font-size: .875rem; line-height: 1.6; }
.branding-asset input[type=file] { max-width: 100%; }
.branding-preview { margin: 1rem 0; }
.branding-preview figcaption { font-weight: 600; margin-bottom: .5rem; }
.branding-preview img { display: block; max-width: 100%; object-fit: contain; background: #fff; border: 1px solid var(--color-border); border-radius: 8px; padding: .5rem; }
.branding-remove { display: flex; align-items: center; gap: .65rem; min-height: 44px; cursor: pointer; }
.branding-remove input { width: auto; margin: 0; }
@media(max-width: 700px) { .branding-grid { grid-template-columns: 1fr; } .brand .institutional-logo { width: 160px; height: 60px; } }
[data-theme="dark"] .brand .institutional-logo { background: #fff; border-radius: 8px; padding: 8px; }

/* Administración de cuentas: reutiliza las superficies del tema. */
.user-roles{border:1px solid var(--line);border-radius:12px;padding:16px 20px;margin:0 0 24px;min-width:0}.user-roles legend{font-weight:600;padding:0 8px}.user-roles .checkbox{display:inline-flex;margin:8px 22px 8px 0;min-height:36px;align-items:center}

/* Login: marca y control de tema alineados dentro del bloque principal. */
.login-shell{position:relative}
.login-shell .login-theme-header{position:absolute;top:clamp(36px,5vw,76px);right:36px;padding:0;z-index:2}
.login-shell .auth-content{padding-top:148px}
.login-brand{display:flex;align-items:center;gap:14px;color:var(--ink);text-decoration:none;min-width:0}
.login-brand:hover span{text-decoration:underline;text-underline-offset:4px}
.login-brand span{font-size:clamp(21px,2vw,28px);font-weight:600;line-height:1.2;letter-spacing:-.5px}
.login-shell .login-brand .institutional-logo{width:auto;height:48px;max-width:128px;object-fit:contain;flex-shrink:0}
@media(max-width:850px){.login-shell .login-theme-header{top:32px;right:20px}.login-brand{flex-wrap:wrap}}
@media(max-width:650px){.login-shell .login-theme-header{position:static;padding:24px 24px 0}.login-shell .auth-content{padding-top:24px}.login-brand{gap:12px}.login-shell .login-brand .institutional-logo{height:40px;max-width:106px}.login-brand span{font-size:23px}}

html[data-theme=dark] .login-shell .login-brand .institutional-logo{background:#fff;border-radius:8px;padding:6px}
