:root {
    --accent: #E77E80;
    --accent-dark: #C45F62;
    --ink: #263238;
    --muted: #6f7b81;
    --line: #e8ecee;
    --surface: #ffffff;
    --canvas: #f6f8f8;
    --green: #2a9d67;
    --purple: #8756b3;
    --danger: #c73e45;
    --warning: #9a6811;
    --radius: 16px;
    --shadow: 0 12px 35px rgba(35, 48, 54, .07);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 0%, rgba(231, 126, 128, .08), transparent 32rem),
        var(--canvas);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button {
    -webkit-tap-highlight-color: transparent;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    border-bottom: 1px solid rgba(232, 236, 238, .9);
    background: rgba(255, 255, 255, .94);
    backdrop-filter: blur(12px);
}

.topbar__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 2rem;
    align-items: center;
    width: min(1200px, calc(100% - 2rem));
    min-height: 68px;
    margin: 0 auto;
}

.brand {
    color: var(--ink);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -.02em;
    text-decoration: none;
    white-space: nowrap;
}

.brand__logo {
    display: block;
    width: auto;
    height: 44px;
    max-width: 190px;
    object-fit: contain;
}

.brand span,
.accent {
    color: var(--accent);
}

.nav {
    display: flex;
    gap: .25rem;
    align-items: center;
}

.nav-toggle {
    display: none;
    min-height: 42px;
    padding: .55rem .72rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--ink);
    background: #fff;
    align-items: center;
    gap: .5rem;
    cursor: pointer;
    font-size: .84rem;
    font-weight: 750;
}

.nav-toggle__icon,
.nav-toggle__icon::before,
.nav-toggle__icon::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    content: "";
}

.nav-toggle__icon {
    position: relative;
}

.nav-toggle__icon::before {
    position: absolute;
    top: -6px;
}

.nav-toggle__icon::after {
    position: absolute;
    top: 6px;
}

.nav a {
    padding: .58rem .72rem;
    border-radius: 9px;
    color: var(--muted);
    font-size: .88rem;
    font-weight: 650;
    text-decoration: none;
}

.nav a:hover,
.nav a.is-active {
    color: var(--accent-dark);
    background: #fff2f2;
}

.user-menu {
    display: flex;
    gap: .8rem;
    align-items: center;
    color: var(--muted);
    font-size: .86rem;
}

.user-menu form {
    margin: 0;
}

.link-button {
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--accent-dark);
    background: transparent;
    cursor: pointer;
    font-weight: 700;
}

.page-shell {
    width: min(1200px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.4rem 0 4rem;
}

.auth-shell {
    display: grid;
    min-height: 100vh;
    padding: 1rem;
    place-items: center;
}

.auth-card {
    width: min(100%, 430px);
    padding: 2.35rem;
    border: 1px solid rgba(232, 236, 238, .9);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 24px 70px rgba(35, 48, 54, .1);
}

.auth-card__logo {
    display: block;
    width: min(310px, 80vw);
    height: auto;
    margin: 0 auto 1.5rem;
}

.auth-card h1 {
    margin: 0 0 .5rem;
    font-size: clamp(1.7rem, 5vw, 2.2rem);
    letter-spacing: -.04em;
}

.eyebrow {
    margin: 0 0 .35rem;
    color: var(--accent-dark);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.muted,
.page-heading p,
.option-card p {
    color: var(--muted);
}

.page-heading {
    display: flex;
    gap: 1.5rem;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 1.7rem;
}

.page-heading.compact {
    margin-bottom: 1rem;
}

.page-heading h1,
.card__heading h2 {
    margin: 0;
    letter-spacing: -.04em;
}

.page-heading h1 {
    font-size: clamp(1.85rem, 4vw, 2.65rem);
}

.page-heading p:not(.eyebrow) {
    margin: .3rem 0 0;
}

.card {
    padding: 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.card__heading {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.15rem;
}

.card__heading h2 {
    font-size: 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.3rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
    min-height: 155px;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.stat-card::after {
    position: absolute;
    right: -22px;
    bottom: -32px;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: currentColor;
    content: "";
    opacity: .06;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: .85rem;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin: .2rem 0 .35rem;
    font-size: 2.5rem;
    letter-spacing: -.05em;
}

.stat-card a {
    color: currentColor;
    font-size: .82rem;
    font-weight: 750;
    text-decoration: none;
}

.stat-card--orange { color: var(--accent-dark); }
.stat-card--green { color: var(--green); }
.stat-card--purple { color: var(--purple); }

.birthday-card {
    margin-bottom: 1.4rem;
    border-color: rgba(231, 126, 128, .3);
    background: linear-gradient(135deg, rgba(231, 126, 128, .1), #fff 52%);
}

.birthday-card__heading {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.birthday-card__heading h2 {
    margin-top: .15rem;
    font-size: 1.35rem;
}

.birthday-card__period {
    padding: .4rem .7rem;
    border-radius: 999px;
    color: var(--accent-dark);
    background: rgba(231, 126, 128, .13);
    font-size: .78rem;
    font-weight: 800;
}

.birthday-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .85rem;
}

.birthday-group {
    min-width: 0;
    padding: .9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .88);
}

.birthday-group--today {
    border-color: rgba(231, 126, 128, .4);
    background: rgba(231, 126, 128, .07);
}

.birthday-group__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .35rem;
    color: var(--text);
    font-size: .88rem;
    font-weight: 800;
}

.birthday-group__heading strong {
    display: grid;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    place-items: center;
    color: #fff;
    background: var(--accent);
    font-size: .78rem;
}

.birthday-list {
    display: grid;
    gap: .55rem;
    max-height: 210px;
    overflow: auto;
}

.birthday-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .75rem;
    align-items: center;
    padding: .65rem 0;
    border-top: 1px solid var(--line);
}

.birthday-item:first-child {
    border-top: 0;
}

.birthday-item__person {
    display: grid;
    min-width: 0;
    gap: .15rem;
}

.birthday-item b {
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.birthday-item time {
    color: var(--accent-dark);
    font-size: .82rem;
    font-weight: 800;
}

.birthday-whatsapp {
    display: inline-flex;
    min-height: 36px;
    padding: .45rem .7rem;
    border-radius: 9px;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: #25d366;
    font-size: .75rem;
    font-weight: 800;
    line-height: 1.1;
    text-decoration: none;
    transition: background .18s ease, transform .18s ease;
}

.birthday-whatsapp:hover,
.birthday-whatsapp:focus-visible {
    color: #fff;
    background: #1ebe5d;
    transform: translateY(-1px);
}

.birthday-no-phone {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 700;
}

.birthday-empty {
    margin: .55rem 0 .15rem;
    color: var(--muted);
    font-size: .88rem;
}

.day-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.day-summary {
    color: var(--text);
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.day-summary:hover,
.day-summary:focus-visible {
    border-color: currentColor;
    box-shadow: 0 18px 42px rgba(15, 35, 45, .12);
    transform: translateY(-2px);
}

.day-summary--today { color: var(--accent-dark); }
.day-summary--tomorrow { color: var(--purple); }

.day-summary__heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.day-summary__heading h2 { color: var(--text); }

.day-summary__heading strong {
    display: grid;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    place-items: center;
    background: currentColor;
    color: #fff;
    font-size: 1.45rem;
}

.day-summary__list {
    display: grid;
    gap: .15rem;
    margin: 1rem 0;
}

.day-summary__appointment {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: .75rem;
    padding: .75rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--text);
}

.day-summary__appointment time { font-weight: 800; }
.day-summary__appointment span,
.day-summary__appointment b { display: block; }
.day-summary__appointment span { color: var(--muted); }
.day-summary__appointment b { margin-bottom: .1rem; color: var(--text); }
.day-summary__empty { margin: .6rem 0; color: var(--muted); }
.day-summary__link { font-size: .86rem; font-weight: 800; }

.button {
    display: inline-flex;
    min-height: 42px;
    padding: .68rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 750;
    line-height: 1.1;
    text-decoration: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .5;
    transform: none;
}

.button--primary {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 8px 20px rgba(231, 126, 128, .24);
}

.button--primary:hover {
    background: var(--accent-dark);
}

.button--secondary {
    border-color: var(--line);
    color: var(--ink);
    background: #fff;
}

.button--danger {
    color: #fff;
    background: var(--danger);
}

.button--wide {
    width: 100%;
}

.text-link,
.actions a {
    color: #246e91;
    font-size: .84rem;
    font-weight: 750;
    text-decoration: none;
}

.actions {
    white-space: nowrap;
}

.actions a + a {
    margin-left: .75rem;
}

.actions .danger-link,
.danger-link {
    color: var(--danger);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: .7rem .75rem;
    color: #859096;
    font-size: .7rem;
    letter-spacing: .08em;
    text-align: left;
    text-transform: uppercase;
}

td {
    padding: .95rem .75rem;
    border-top: 1px solid #eff2f3;
    font-size: .9rem;
}

td small {
    color: var(--muted);
}

.table-empty {
    padding: 2.3rem;
    color: var(--muted);
    text-align: center;
}

.money {
    color: var(--green);
    font-weight: 800;
}

.badge {
    display: inline-block;
    padding: .28rem .58rem;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 800;
}

.badge--pending {
    color: #8a5b09;
    background: #fff1cf;
}

.badge--confirmed {
    color: #155c7c;
    background: #dceff7;
}

.badge--completed,
.badge--active {
    color: #196a46;
    background: #dcf4e7;
}

.badge--cancelled,
.badge--inactive {
    color: #667176;
    background: #e9edef;
}

.alert {
    margin-bottom: 1rem;
    padding: .8rem 1rem;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: .88rem;
}

.alert--success {
    border-color: #bfe5d0;
    color: #176a44;
    background: #e8f7ef;
}

.alert--error {
    border-color: #f0c2c5;
    color: #982c33;
    background: #fff0f1;
}

.alert--warning {
    border-color: #eed8a8;
    color: var(--warning);
    background: #fff8e6;
}

.form-stack {
    display: grid;
    gap: 1rem;
    margin-top: 1.4rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-stack label,
.form-grid label {
    display: grid;
    gap: .38rem;
    color: #445057;
    font-size: .82rem;
    font-weight: 750;
}

.form-stack small,
.form-grid small {
    color: var(--muted);
    font-size: .74rem;
    font-weight: 500;
}

input,
select,
textarea {
    width: 100%;
    min-height: 43px;
    padding: .68rem .75rem;
    border: 1px solid #dfe4e6;
    border-radius: 9px;
    outline: none;
    color: var(--ink);
    background: #fff;
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(231, 126, 128, .14);
}

.span-2 {
    grid-column: span 2;
}

.form-card {
    max-width: 800px;
}

.form-card--small {
    max-width: 520px;
}

.form-actions,
.confirm-actions {
    display: flex;
    gap: .75rem;
    justify-content: flex-end;
    margin-top: .35rem;
}

.checkbox {
    display: flex !important;
    gap: .55rem !important;
    align-items: center;
}

.checkbox input {
    width: 18px;
    min-height: 18px;
}

.search-bar {
    display: flex;
    gap: .65rem;
    align-items: center;
    margin-bottom: 1rem;
}

.search-bar input[type="search"] {
    max-width: 430px;
}

[data-live-item][hidden],
[data-live-empty][hidden] {
    display: none;
}

.form-field {
    display: grid;
    gap: .38rem;
    color: #445057;
    font-size: .82rem;
    font-weight: 750;
}

.search-combobox {
    position: relative;
}

.search-combobox__options {
    position: absolute;
    z-index: 60;
    top: calc(100% + .35rem);
    right: 0;
    left: 0;
    max-height: 260px;
    margin: 0;
    padding: .35rem;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 16px 38px rgba(35, 48, 54, .16);
}

.search-combobox__options[hidden] {
    display: none;
}

.search-combobox__options button {
    display: block;
    width: 100%;
    min-height: 44px;
    padding: .65rem .7rem;
    border: 0;
    border-radius: 8px;
    color: var(--ink);
    background: transparent;
    cursor: pointer;
    font-weight: 650;
    text-align: left;
}

.search-combobox__options button[hidden] {
    display: none;
}

.search-combobox__options button:hover,
.search-combobox__options button:focus {
    outline: none;
    color: var(--accent-dark);
    background: #fff2f2;
}

.search-combobox__empty {
    margin: 0;
    padding: .8rem;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
}

.audit-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: .8rem;
    align-items: end;
    margin-bottom: 1.2rem;
}

.audit-filters label {
    display: grid;
    gap: .35rem;
    color: #445057;
    font-size: .76rem;
    font-weight: 750;
}

.audit-filters__actions {
    display: flex;
    gap: .5rem;
    grid-column: 1 / -1;
}

.audit-details {
    margin-top: .4rem;
    font-size: .76rem;
}

.audit-details summary {
    color: var(--accent-dark);
    cursor: pointer;
    font-weight: 750;
}

.audit-details ul {
    margin: .45rem 0 0;
    padding-left: 1.1rem;
}

.badge--audit {
    color: var(--accent-dark);
    background: #fff2f2;
}

.pagination {
    display: flex;
    gap: .35rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.pagination a {
    display: grid;
    min-width: 38px;
    min-height: 38px;
    padding: .35rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
    place-items: center;
}

.pagination a.is-active {
    border-color: var(--accent);
    color: #fff;
    background: var(--accent);
}

.audit-retention {
    margin: 1rem 0 0;
    font-size: .78rem;
}

.appointment-layout {
    display: block;
}

.page-actions {
    display: flex;
    gap: .6rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.patient-summary {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(240px, .55fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.patient-profile {
    min-width: 0;
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .9rem 1.2rem;
    margin: 0;
}

.detail-list > div {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fafbfb;
}

.detail-list__wide {
    grid-column: 1 / -1;
}

.detail-list dt {
    margin-bottom: .25rem;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: .92rem;
    font-weight: 650;
}

.patient-metrics {
    display: grid;
    gap: .75rem;
}

.patient-metrics .stat-card {
    min-height: 0;
    padding: 1rem 1.2rem;
}

.patient-metrics .stat-card strong {
    margin-bottom: 0;
    font-size: 2rem;
}

.booking-card {
    position: relative;
}

.calendar-card {
    min-height: 690px;
}

body.has-booking-modal {
    overflow: hidden;
}

.booking-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: none;
    padding: 1rem;
    align-items: center;
    justify-items: center;
}

.booking-modal.is-open {
    display: grid;
}

.booking-modal__backdrop {
    position: absolute;
    background: rgba(21, 30, 34, .62);
    backdrop-filter: blur(3px);
    inset: 0;
}

.booking-modal__panel {
    position: relative;
    z-index: 1;
    width: min(620px, 100%);
    max-height: calc(100dvh - 2rem);
    padding: 1.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: 0 28px 70px rgba(21, 30, 34, .28);
}

.booking-modal__heading {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.15rem;
}

.booking-modal__heading h2 {
    margin: 0;
    font-size: 1.35rem;
    letter-spacing: -.04em;
}

.booking-modal__close {
    display: grid;
    width: 42px;
    min-width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    color: var(--ink);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    font-size: 1.55rem;
    line-height: 1;
    text-decoration: none;
    place-items: center;
}

.booking-modal__actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .7rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.booking-modal__actions .button {
    width: 100%;
}

#calendar {
    min-height: 620px;
}

.fc {
    --fc-border-color: #e9edef;
    --fc-button-bg-color: #35434a;
    --fc-button-border-color: #35434a;
    --fc-button-hover-bg-color: #263238;
    --fc-button-hover-border-color: #263238;
    --fc-button-active-bg-color: var(--accent);
    --fc-button-active-border-color: var(--accent);
    --fc-today-bg-color: rgba(231, 126, 128, .08);
    font-size: .88rem;
}

.fc .fc-toolbar-title {
    font-size: 1.2rem;
}

.fc .fc-button {
    font-size: .78rem;
    text-transform: capitalize;
}

.fc .fc-prev-button,
.fc .fc-next-button {
    min-width: 42px;
    min-height: 42px;
    padding: .35rem .7rem;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.55rem;
    font-weight: 800;
    line-height: 1;
}

.legend {
    display: flex;
    gap: 1rem;
    margin-top: 1.25rem;
    color: var(--muted);
    font-size: .75rem;
}

.legend span {
    display: flex;
    gap: .4rem;
    align-items: center;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.dot--victoria { background: #f39c12; }
.dot--marquetalia { background: #2563eb; }
.dot--personal { background: #7c3aed; }
.dot--today { background: #0f766e; }
.dot--holiday { background: #e74c3c; }

.fc .fc-day-today {
    box-shadow: inset 0 0 0 2px #0f766e;
}

.fc .fc-day-today .fc-daygrid-day-number {
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-weight: 800;
}

.fc .holiday-event {
    border-left: 3px solid #e74c3c !important;
    background-color: rgba(231, 76, 60, .24) !important;
    color: #9f2f26 !important;
    opacity: 1;
}

.fc .personal-event {
    border-color: #6d28d9;
    background: #7c3aed;
}

[data-entry-fields][hidden] {
    display: none !important;
}

.appointment-fields,
.personal-fields {
    display: grid;
    gap: .9rem;
}

.duration-picker {
    margin: 0;
    padding: 0;
    border: 0;
}

.duration-picker legend {
    margin-bottom: .55rem;
    color: var(--ink);
    font-size: .9rem;
    font-weight: 700;
}

.duration-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: .45rem;
}

.duration-options--personal {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.custom-end-field {
    display: grid;
    gap: .45rem;
    margin-top: .8rem;
}

.custom-end-field[hidden],
[data-duration-fields][hidden] {
    display: none !important;
}

.duration-options label {
    cursor: pointer;
}

.duration-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.duration-options span {
    display: grid;
    min-height: 44px;
    place-items: center;
    border: 1px solid #d8dee1;
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font-weight: 700;
    transition: border-color .15s ease, background .15s ease, color .15s ease, transform .15s ease;
}

.duration-options input:checked + span {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.duration-options input:focus-visible + span {
    outline: 3px solid rgba(242, 91, 64, .25);
    outline-offset: 2px;
}

.duration-options label:active span {
    transform: scale(.97);
}

.slot-feedback {
    margin: -.2rem 0 .2rem;
    padding: .75rem .85rem;
    border: 1px solid #cce4dc;
    border-radius: 10px;
    background: #f1faf7;
    color: #236451;
    font-size: .9rem;
    font-weight: 700;
}

.slot-feedback:empty {
    display: none;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.option-card {
    min-height: 220px;
    padding: 1.6rem;
    border: 1px solid var(--line);
    border-top: 4px solid var(--purple);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.option-card__icon {
    display: grid;
    width: 44px;
    height: 44px;
    margin-bottom: 1.3rem;
    border-radius: 13px;
    color: var(--purple);
    background: #f3ebf8;
    font-size: 1.2rem;
    place-items: center;
}

.option-card h2 {
    margin: 0;
    font-size: 1.18rem;
}

.option-card--disabled {
    border-top-color: #cbd2d5;
    opacity: .58;
}

.confirm-card,
.empty-state {
    width: min(100%, 520px);
    margin: 4rem auto;
    padding: 2rem;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow);
    text-align: center;
}

.confirm-card__icon,
.empty-state__icon {
    display: grid;
    width: 52px;
    height: 52px;
    margin: 0 auto 1.2rem;
    border-radius: 50%;
    color: var(--danger);
    background: #fff0f1;
    font-size: 1.5rem;
    font-weight: 900;
    place-items: center;
}

.confirm-card h1,
.empty-state h1 {
    margin: 0;
}

@media (max-width: 920px) {
    .topbar__inner {
        position: relative;
        grid-template-columns: 1fr auto auto;
        gap: .8rem;
        padding: .65rem 0;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav {
        position: absolute;
        top: calc(100% + 1px);
        right: 0;
        left: 0;
        display: none;
        grid-column: 1 / -1;
        padding: .6rem;
        border: 1px solid var(--line);
        border-top: 0;
        border-radius: 0 0 14px 14px;
        background: rgba(255, 255, 255, .98);
        box-shadow: 0 18px 28px rgba(35, 48, 54, .12);
        flex-direction: column;
        align-items: stretch;
    }

    .nav.is-open {
        display: flex;
    }

    .nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .user-menu span {
        display: none;
    }

    .patient-summary {
        grid-template-columns: 1fr;
    }

    .patient-metrics {
        grid-template-columns: repeat(3, 1fr);
    }

}

@media (max-width: 720px) {
    .duration-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .duration-options span {
        min-height: 48px;
    }

    .topbar__inner {
        width: calc(100% - 1rem);
        gap: .45rem;
    }

    .brand {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .brand__logo {
        height: 40px;
        max-width: 150px;
    }

    .nav-toggle {
        padding-inline: .6rem;
    }

    .page-shell {
        width: min(100% - 1rem, 1200px);
        padding-top: 1.25rem;
    }

    .page-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .page-heading > .button {
        width: 100%;
    }

    .page-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
    }

    .page-actions .button {
        width: 100%;
    }

    .detail-list,
    .patient-metrics {
        grid-template-columns: 1fr;
    }

    .detail-list__wide {
        grid-column: auto;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .day-summary-grid {
        grid-template-columns: 1fr;
    }

    .birthday-grid {
        grid-template-columns: 1fr;
    }

    .birthday-card {
        padding: 1.1rem;
    }

    .birthday-item b {
        white-space: normal;
    }

    .birthday-item {
        grid-template-columns: 1fr;
    }

    .birthday-whatsapp {
        width: 100%;
    }

    .stat-card {
        min-height: 130px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .span-2 {
        grid-column: span 1;
    }

    .search-bar {
        align-items: stretch;
        flex-direction: column;
    }

    .search-bar input[type="search"] {
        max-width: none;
    }

    .audit-filters {
        grid-template-columns: 1fr;
    }

    .audit-filters__actions {
        grid-column: auto;
        flex-direction: column;
    }

    .audit-filters__actions .button {
        width: 100%;
    }

    .form-actions,
    .confirm-actions {
        flex-direction: column-reverse;
    }

    .form-actions .button,
    .confirm-actions .button {
        width: 100%;
    }

    .card,
    .auth-card {
        padding: 1.1rem;
    }

    .table-wrap {
        overflow: visible;
    }

    .table-wrap table,
    .table-wrap thead,
    .table-wrap tbody,
    .table-wrap tr,
    .table-wrap th,
    .table-wrap td {
        display: block;
    }

    .table-wrap thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }

    .table-wrap tbody {
        display: grid;
        gap: .85rem;
    }

    .table-wrap tbody tr {
        overflow: hidden;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
    }

    .table-wrap tbody td {
        display: grid;
        grid-template-columns: minmax(105px, .8fr) minmax(0, 1.2fr);
        gap: .75rem;
        align-items: center;
        padding: .72rem .8rem;
        border-top: 1px solid #eff2f3;
        overflow-wrap: anywhere;
        text-align: right;
        white-space: normal;
    }

    .table-wrap tbody td:first-child {
        border-top: 0;
    }

    .table-wrap tbody td::before {
        color: #859096;
        content: attr(data-label);
        font-size: .68rem;
        font-weight: 800;
        letter-spacing: .06em;
        text-align: left;
        text-transform: uppercase;
    }

    .table-wrap tbody td.table-empty {
        display: block;
        padding: 1.5rem;
        text-align: center;
    }

    .table-wrap tbody td.table-empty::before {
        display: none;
    }

    .actions a {
        display: inline-flex;
        min-height: 38px;
        padding: .35rem 0;
        align-items: center;
    }

    .calendar-card {
        min-height: 560px;
        padding: .6rem;
    }

    .legend {
        flex-wrap: wrap;
        row-gap: .6rem;
    }

    .calendar-help {
        margin: .2rem .2rem .8rem;
        padding: .75rem .85rem;
        border: 1px solid #f2ddd5;
        border-radius: 10px;
        background: #fff8f5;
        color: #6f5c55;
        font-size: .85rem;
        line-height: 1.45;
    }

    .slot-feedback {
        margin: -.25rem 0 .25rem;
        padding: .7rem .8rem;
        border: 1px solid #cce4dc;
        border-radius: 10px;
        background: #f1faf7;
        color: #236451;
        font-size: .86rem;
        font-weight: 700;
    }

    .slot-feedback:empty {
        display: none;
    }

    #calendar {
        min-height: 520px;
    }

    .fc .fc-header-toolbar {
        gap: .7rem;
        align-items: stretch;
        flex-direction: column;
    }

    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }

    .fc .fc-prev-button,
    .fc .fc-next-button,
    .fc .fc-today-button,
    .fc .fc-dayGridMonth-button {
        min-height: 44px;
    }

    .fc .fc-daygrid-day-number {
        display: flex;
        min-width: 34px;
        min-height: 34px;
        align-items: center;
        justify-content: center;
    }

    .fc .fc-daygrid-day-frame {
        min-height: 64px;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-day-top {
        position: relative;
        z-index: 3;
        min-height: 36px;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-day-events {
        position: relative;
        z-index: 2;
        margin-top: 2px;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-event-harness,
    .fc .fc-dayGridMonth-view .fc-daygrid-event,
    .fc .fc-dayGridMonth-view .fc-event-main,
    .fc .fc-dayGridMonth-view .fc-event-main-frame {
        min-width: 0;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-event {
        margin: 1px;
        border-radius: 3px;
        font-size: .62rem;
        line-height: 1.15;
    }

    .fc .fc-dayGridMonth-view .fc-event-main-frame {
        display: block;
        overflow: hidden;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-event .fc-event-time {
        display: none;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-event .fc-event-title {
        display: block;
        overflow: hidden;
        padding: 2px 3px;
        font-weight: 700;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fc .fc-dayGridMonth-view .holiday-event .fc-event-title {
        display: none;
    }

    .fc .fc-dayGridMonth-view .fc-daygrid-more-link {
        display: block;
        overflow: hidden;
        padding: 1px 3px;
        color: #b9575b;
        font-size: .62rem;
        font-weight: 800;
        line-height: 1.2;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .fc .fc-timegrid-slot {
        height: 3.15rem;
    }

    .fc .fc-timegrid-slot-label {
        font-size: .78rem;
    }

    .legend {
        flex-wrap: wrap;
    }

    .table-wrap th,
    .table-wrap td {
        padding: .75rem .6rem;
    }
}

@media (max-width: 430px) {
    .brand {
        max-width: 118px;
        font-size: .92rem;
    }

    .brand__logo {
        height: 36px;
        max-width: 118px;
    }

    .nav-toggle span:last-child {
        display: none;
    }

    .auth-shell {
        align-items: start;
        padding: .5rem;
    }

    .auth-card {
        margin-top: 1rem;
    }

    .page-heading h1 {
        font-size: 1.75rem;
    }

    tbody td {
        grid-template-columns: 92px minmax(0, 1fr);
    }
}

@media (max-width: 720px) {
    .booking-modal {
        padding: 0;
        align-items: end;
    }

    .booking-modal__panel {
        width: 100%;
        max-height: 94dvh;
        padding: 1rem;
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 20px 20px 0 0;
    }

    .booking-modal__heading {
        position: sticky;
        z-index: 2;
        top: -1rem;
        margin: -1rem -1rem 1rem;
        padding: 1rem;
        border-bottom: 1px solid var(--line);
        background: rgba(255, 255, 255, .97);
        backdrop-filter: blur(8px);
    }

    .booking-modal__actions {
        grid-template-columns: 1fr;
    }

    .booking-modal .form-stack {
        gap: .95rem;
    }

    .booking-modal input,
    .booking-modal select,
    .booking-modal textarea,
    .booking-modal .button {
        min-height: 48px;
    }
}


/* Informes de ingresos y métricas */
.price-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.analytics-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 18px;
}

.analytics-filters label {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.analytics-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.analytics-kpi {
    display: grid;
    gap: 8px;
    min-height: 145px;
    align-content: center;
}

.analytics-kpi span {
    color: var(--muted);
    font-weight: 700;
    font-size: .82rem;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.analytics-kpi strong {
    color: var(--text);
    font-size: clamp(1.65rem, 3vw, 2.4rem);
    line-height: 1;
}

.analytics-kpi--future strong {
    color: #E77E80;
}

.analytics-kpi small {
    color: var(--muted);
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.analytics-chart {
    min-width: 0;
}

.analytics-chart:last-child {
    grid-column: 1 / -1;
}

.analytics-chart h2,
.analytics-table h2 {
    margin-top: 0;
    margin-bottom: 14px;
}

.analytics-chart__canvas {
    position: relative;
    height: 310px;
    min-width: 0;
}

.analytics-table {
    margin-top: 18px;
}

@media (max-width: 980px) {
    .analytics-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .analytics-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .price-grid,
    .analytics-filters,
    .analytics-kpis,
    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .analytics-chart:last-child {
        grid-column: auto;
    }

    .analytics-filters .button {
        width: 100%;
    }

    .analytics-chart__canvas {
        height: 260px;
    }

    .analytics-kpi {
        min-height: 118px;
    }
}


.button--whatsapp {
    background: #25D366;
    border-color: #25D366;
    color: #fff;
}

.button--whatsapp:hover,
.button--whatsapp:focus-visible {
    background: #128C7E;
    border-color: #128C7E;
    color: #fff;
}


/* Footer */
.app-footer {
    width: 100%;
    margin-top: 2rem;
    padding: 1rem 1.25rem 1.15rem;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .82);
    color: var(--muted);
    font-size: .82rem;
    text-align: center;
}

.app-footer p {
    max-width: 1200px;
    margin: 0 auto;
    line-height: 1.6;
}

.app-footer a {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
}

.app-footer a:hover,
.app-footer a:focus-visible {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

@media (max-width: 640px) {
    .app-footer {
        margin-top: 1.25rem;
        padding: .9rem 1rem 1rem;
        font-size: .76rem;
    }
}
