:root {
    color-scheme: light;
    --bg: #F7F8FA;
    --panel: #FFFFFF;
    --ink: #0A285C;
    --navy: #0A285C;
    --text: var(--ink);
    --muted: #697B94;
    --line: #E5E9EE;
    --line-strong: #D7DEE5;
    --control: #C8CED6;
    --soft: #F6FAFD;
    --soft-2: #EDF7FB;
    --brand: #F3652A;
    --brand-strong: #F25A23;
    --teal: #36ABA7;
    --focus: #FAA93D;
    --danger: #8a2f2f;
    --danger-bg: #fff5f4;
    --success: #0AB65F;
    --success-bg: #EAF8F0;
    --shadow: 0 8px 30px rgba(14, 48, 90, 0.06);
    --shadow-lg: 0 18px 50px rgba(7, 21, 58, 0.14);
    --shadow-cta: 0 8px 24px rgba(243, 101, 42, 0.22);
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100dvh;
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

body.modal-open {
    overflow: hidden;
}

h1, h2, h3 {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

a {
    color: inherit;
}

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

button {
    min-height: 48px;
    border: 0;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1.45rem;
    background: var(--brand);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    cursor: pointer;
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .15s ease;
}

button:hover {
    background: var(--brand-strong);
    box-shadow: var(--shadow-cta);
}

button:active,
.button-link:active {
    transform: scale(0.98);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: .6;
}

:where(a, button, input, textarea, select, summary):focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
}

input[aria-invalid="true"] {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(138, 47, 47, .12);
}

button.danger {
    background: var(--danger);
    box-shadow: none;
}

button.danger:hover {
    box-shadow: none;
}

button.ghost {
    background: var(--danger-bg);
    color: var(--danger);
    box-shadow: none;
}

button.ghost:hover {
    box-shadow: none;
}

.button-link {
    display: inline-grid;
    min-height: 48px;
    place-items: center;
    border-radius: var(--radius-sm);
    padding: 0 1.45rem;
    background: var(--brand);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
}

.button-link:hover {
    background: var(--brand-strong);
    box-shadow: var(--shadow-cta);
}

input[type="text"],
input[type="password"],
input[type="time"],
input[type="number"],
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    background: #fff;
    color: var(--ink);
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="time"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(250, 169, 61, 0.22);
    outline: none;
}

textarea {
    width: 100%;
    min-height: 68px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: #fff;
    color: var(--ink);
    resize: vertical;
}

label {
    display: grid;
    gap: 7px;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px clamp(18px, 4vw, 44px);
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.topbar h1 {
    font-size: clamp(1.35rem, 2vw, 1.75rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.topbar h1,
.login-box h1,
.calendar-header h2,
.section-heading h2,
.slots-header h3 {
    margin: 0;
}

.eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.logout-link {
    min-height: 44px;
    border: 1px solid var(--control);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    color: var(--navy);
    text-decoration: none;
    font-weight: 600;
}

button.logout-link {
    background: #fff;
    color: var(--navy);
    box-shadow: none;
}

button.logout-link:hover {
    border-color: #9CB7CC;
    background: var(--soft);
    color: var(--navy);
    box-shadow: none;
}

.logout-form {
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
    font-weight: 700;
}

.admin-nav {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--soft);
}

.admin-nav a {
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.admin-nav a.active {
    background: var(--soft-2);
    color: var(--navy);
}

.app-shell {
    display: grid;
    grid-template-columns: minmax(360px, 1.15fr) minmax(340px, 0.85fr);
    gap: 24px;
    width: min(1440px, calc(100% - 40px));
    margin: 28px auto;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 100;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--ink);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform .15s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-shell--stationary {
    width: min(1760px, calc(100% - 24px));
    grid-template-columns: 1fr;
}

.stationary-panel {
    width: 100%;
}

.availability-toggle {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand);
    border-radius: 8px;
    padding: 18px 20px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.availability-toggle.disabled {
    border-left-color: var(--danger);
}

.availability-toggle h2,
.availability-toggle p {
    margin: 0;
}

.availability-toggle p {
    margin-top: 5px;
    color: var(--muted);
    line-height: 1.45;
}

.calendar-panel,
.editor-panel,
.accounts-panel,
.login-box {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.calendar-panel,
.editor-panel,
.accounts-panel {
    padding: 22px;
}

.accounts-panel {
    grid-column: 1 / -1;
}

.admin-dashboard-panel {
    grid-column: 1 / -1;
    display: grid;
    gap: 24px;
}

.dashboard-toolbar {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px auto;
    gap: 14px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.dashboard-toolbar h2 {
    margin: 0;
}

.dashboard-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
    color: var(--ink);
    white-space: nowrap;
}

.dashboard-toggle input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.dashboard-toolbar-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.dashboard-channel-switcher {
    display: inline-flex;
    gap: 4px;
    min-height: 42px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.dashboard-channel-switcher button {
    border: 0;
    border-radius: 8px;
    padding: 8px 12px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.dashboard-channel-switcher button.active {
    background: var(--soft-2);
    color: var(--navy);
}

.dashboard-channel-switcher button[data-channel="online"].active {
    background: rgba(54, 171, 167, 0.16);
    color: #1d6f6c;
}

.dashboard-channel-switcher button[data-channel="stationary"].active {
    background: rgba(10, 40, 92, 0.12);
    color: var(--navy);
}

.dashboard-table-wrap,
.doctor-chart-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.scroll-region:focus-visible {
    outline-offset: 2px;
}

.dashboard-filter-empty td {
    padding: 22px 16px;
    color: var(--muted);
    text-align: center;
}

.doctor-info-table {
    width: 100%;
    border-collapse: collapse;
}

.doctor-info-table th,
.doctor-info-table td {
    border-bottom: 1px solid var(--line);
    padding: 13px 14px;
    text-align: left;
    vertical-align: top;
}

.doctor-info-table th {
    background: var(--soft-2);
    color: var(--navy);
    font-weight: 800;
}

.doctor-info-table tr:last-child td {
    border-bottom: 0;
}

.doctor-info-table tr[data-ended="1"] {
    color: var(--muted);
}

.dashboard-doctor-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.dashboard-doctor-services {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.time-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.time-pills span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 9px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 700;
}

.doctor-info-table th:nth-child(4),
.doctor-info-table td:nth-child(4) {
    min-width: 220px;
    width: 28%;
}

.occupancy-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 10px;
    max-height: 220px;
    margin: 0;
    padding: 0;
    overflow: auto;
    list-style: none;
}

.occupancy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.3;
}

.occupancy-time {
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.occupancy-count {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.occupancy-ok {
    background: var(--success-bg);
    color: var(--success);
}

.occupancy-high {
    background: #FFF6E7;
    color: var(--navy);
}

.occupancy-full {
    background: var(--danger-bg);
    color: var(--danger);
}

.occupancy-empty {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.manual-bookings-panel {
    display: grid;
    gap: 16px;
    margin-top: 18px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.manual-bookings-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.manual-bookings-inline {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.manual-booking-group {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.manual-booking-group-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.manual-booking-list {
    display: grid;
    gap: 10px;
}

.manual-booking-list-compact {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.manual-booking-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px auto;
    gap: 12px;
    align-items: end;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.manual-booking-meta {
    display: grid;
    gap: 4px;
}

.manual-booking-meta strong {
    font-size: 14px;
    line-height: 1.3;
}

.manual-booking-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.manual-booking-field {
    display: grid;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
}

.manual-booking-field input {
    width: 100%;
}

@media (max-width: 1100px) {
    .occupancy-list {
        grid-template-columns: 1fr;
    }

    .manual-bookings-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .manual-booking-row {
        grid-template-columns: 1fr;
    }

    .manual-booking-list-compact {
        grid-template-columns: 1fr;
    }
}

.doctor-chart-card {
    padding: 18px;
}

.chart-canvas-wrap {
    position: relative;
    width: 100%;
    max-height: 620px;
    margin-top: 14px;
}

.chart-canvas-wrap canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.doctor-schedule-panel {
    grid-column: 1 / -1;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 22px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.doctor-schedule-toolbar {
    display: grid;
    grid-template-columns: 42px 1fr 42px auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 18px;
}

.doctor-schedule-toolbar h2 {
    margin: 0;
}

.view-switcher {
    display: inline-flex;
    gap: 4px;
    justify-self: end;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 4px;
    background: var(--soft);
}

.view-switcher a {
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--muted);
    text-decoration: none;
    font-weight: 600;
}

.view-switcher a.active {
    background: var(--soft-2);
    color: var(--navy);
}

.doctor-schedule-table {
    display: grid;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.doctor-day-row {
    display: grid;
    grid-template-columns: minmax(160px, .32fr) minmax(0, 1fr);
    min-height: 108px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.doctor-day-row:last-child {
    border-bottom: 0;
}

.doctor-day-row.past-day {
    background: var(--bg);
}

.doctor-day-row.past-day .doctor-day-cell,
.doctor-day-row.past-day .doctor-day-work {
    opacity: .72;
}

.doctor-day-cell {
    display: grid;
    align-content: center;
    gap: 5px;
    border-right: 1px solid var(--line);
    padding: 18px;
    background: var(--soft);
}

.doctor-day-cell strong {
    font-size: 20px;
}

.doctor-day-cell > span:last-child {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.doctor-day-work {
    display: grid;
    gap: 12px;
    padding: 14px;
}

.doctor-existing-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
    align-items: center;
}

.empty-inline {
    color: var(--muted);
    font-weight: 700;
}

.doctor-slot-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 6px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 600;
}

.doctor-slot-chip span {
    padding: 0 4px;
}

.locked-chip {
    border-color: var(--line);
    background: var(--bg);
    color: var(--muted);
}

.compact-button {
    min-height: 32px;
    padding: 0 10px;
}

.doctor-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.doctor-inline-form > label,
.doctor-inline-form > .work-slot-channels-picker,
.doctor-inline-form > .work-slot-services-picker {
    min-width: 110px;
    flex: 1 1 110px;
}

.doctor-inline-form > button {
    flex: 0 0 auto;
}

.recurring-schedule-panel {
    margin: 0 0 20px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--soft);
}

.recurring-schedule-heading h3 {
    margin: 4px 0 6px;
    font-size: 1.05rem;
}

.recurring-schedule-lead {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.recurring-slot-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.recurring-slot-chip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: #fff;
}

.recurring-slot-weekday {
    font-weight: 700;
    min-width: 6.5rem;
}

.recurring-inline-form {
    grid-template-columns: minmax(150px, .8fr) minmax(110px, .6fr) minmax(110px, .6fr) minmax(110px, .55fr) minmax(170px, .9fr) auto;
}

.recurring-slot-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    background: #e8f5f1;
    color: var(--brand-strong);
    font-size: 11px;
    font-weight: 700;
}

.work-slot-services-picker {
    display: flex;
    align-items: end;
    min-height: 42px;
}

.work-slot-services-fieldset {
    margin: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--soft);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 12px;
    align-items: center;
}

.work-slot-services-fieldset legend {
    padding: 0 4px;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}

.compact-checkbox {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
}

.work-slot-services-single {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
}

.work-slot-services-empty {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.work-slot-chip-services {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.doctor-slot-chip {
    flex-wrap: wrap;
}

.calendar-header,
.section-heading,
.slots-header,
.slot-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.calendar-header {
    margin-bottom: 18px;
}

.nav-button {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--control);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--navy);
    text-decoration: none;
    font-size: 26px;
    font-weight: 700;
    transition: background-color .2s ease, border-color .2s ease, transform .15s ease;
}

.nav-button:hover {
    border-color: #9CB7CC;
    background: var(--soft);
}

.weekdays,
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.weekdays {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    text-transform: uppercase;
}

.calendar-day {
    min-height: 96px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 10px;
    background: #fff;
    text-decoration: none;
    transition: border-color .15s ease, background .15s ease;
}

.calendar-day strong {
    display: block;
    margin-bottom: 18px;
    font-size: 18px;
}

.calendar-day span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
}

.calendar-day.has-slots {
    border-color: rgba(54, 171, 167, 0.35);
    background: #EAF8F7;
}

.calendar-day.has-doctor-slots {
    border-color: rgba(58, 145, 181, 0.32);
    background: var(--soft-2);
}

.calendar-day.has-slots.has-doctor-slots {
    background: linear-gradient(135deg, #EAF8F7 0%, #EDF7FB 100%);
}

.calendar-day.disabled-day {
    border-color: rgba(180, 35, 24, 0.24);
    background: #fff8f7;
}

.calendar-day.selected {
    outline: 3px solid rgba(20, 108, 95, 0.18);
    border-color: var(--brand);
}

.calendar-day.muted {
    opacity: .46;
}

.stack-form {
    display: grid;
    gap: 16px;
}

.inline-form {
    margin: 0;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
}

.checkbox-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--brand);
}

.slots-header {
    margin: 26px 0 14px;
}

.slots-header span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.add-slot-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.doctor-slot-form {
    display: grid;
    grid-template-columns: 1fr 1fr minmax(120px, .7fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.slot-list {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}

.slot-row {
    display: grid;
    grid-template-columns: minmax(100px, .7fr) minmax(150px, 1.3fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.doctor-slot-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(120px, .7fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.admin-doctor-slot-row {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(150px, .7fr) minmax(120px, .55fr);
    gap: 12px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.doctor-create-details {
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.doctor-create-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 50px;
    padding: 0 16px;
    color: var(--brand);
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.doctor-create-details summary::-webkit-details-marker,
.doctor-record summary::-webkit-details-marker {
    display: none;
}

.doctor-create-details summary::after {
    content: "+";
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 6px;
    background: var(--brand);
    color: #fff;
    font-size: 20px;
    line-height: 1;
}

.doctor-create-details[open] summary::after {
    content: "-";
}

.doctor-create-form {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(150px, .85fr) minmax(150px, .85fr) auto;
    gap: 12px;
    align-items: end;
    padding: 14px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.doctor-create-form .doctor-note-field,
.doctor-edit-form .doctor-note-field {
    grid-column: 1 / -1;
}

.doctor-list {
    display: grid;
    margin-top: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.doctor-directory-head,
.doctor-record-summary {
    display: grid;
    grid-template-columns: minmax(170px, .85fr) minmax(110px, .45fr) minmax(200px, 1fr) minmax(110px, .4fr) minmax(180px, .55fr);
    gap: 14px;
    align-items: center;
}

.doctor-directory-head {
    padding: 12px 16px;
    background: var(--soft-2);
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
}

.doctor-record {
    border-top: 1px solid var(--line);
}

.doctor-record-summary {
    min-height: 70px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

.doctor-record[open] .doctor-record-summary {
    background: var(--soft);
}

.doctor-name-cell {
    display: grid;
    gap: 4px;
}

.doctor-name-cell small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.doctor-note-preview {
    color: var(--muted);
    line-height: 1.45;
}

.doctor-services-preview,
.doctor-services-inline,
.doctor-services-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.doctor-services-inline {
    margin: 8px 0 0;
}

.doctor-services-banner {
    margin: 0 0 16px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.doctor-services-hint {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.doctor-services-fieldset {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--soft);
}

.doctor-services-fieldset legend {
    padding: 0 6px;
    font-size: 12px;
    font-weight: 800;
    color: var(--muted);
}

.doctor-services-fieldset .checkbox-row + .checkbox-row {
    margin-top: 8px;
}

.service-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.service-badge-mp {
    background: #EAF8F7;
    color: var(--teal);
}

.service-badge-ose {
    background: var(--soft-2);
    color: #3A91B5;
}

.service-badge-none {
    background: var(--bg);
    color: var(--muted);
}

.service-badge-online {
    background: #EAF8F7;
    color: var(--teal);
}

.service-badge-stationary {
    background: var(--soft-2);
    color: var(--navy);
}

.work-slot-channels-fieldset,
.work-slot-services-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

.work-slot-channels-fieldset legend,
.work-slot-services-fieldset legend {
    padding: 0;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
}

.stationary-panel .section-lead {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.stationary-city-filter {
    margin: 0 0 16px;
}

.stationary-city-filter label {
    display: grid;
    gap: 6px;
    max-width: 280px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.stationary-city-filter select {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
}

.stationary-grid-head,
.stationary-grid-row--schedule {
    display: grid;
    gap: 14px;
    align-items: center;
}

.stationary-grid-head {
    padding: 12px 16px;
    background: var(--soft-2);
    color: var(--navy);
    font-size: 13px;
    font-weight: 800;
}

.stationary-grid-head--schedule,
.stationary-grid-row--schedule {
    grid-template-columns: minmax(160px, 1fr) minmax(90px, 0.4fr) minmax(240px, 1.35fr) minmax(80px, 0.32fr) minmax(96px, 0.34fr);
}

.stationary-grid-head--locations,
.stationary-locations-table .stationary-grid-row--locations {
    grid-template-columns: minmax(150px, 1fr) minmax(90px, 0.38fr) minmax(240px, 1.35fr) minmax(80px, 0.3fr) minmax(96px, 0.34fr) minmax(96px, 0.34fr);
}

.stationary-grid-row--schedule {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.stationary-locations-table .stationary-grid-row--locations {
    display: grid;
    gap: 14px;
    align-items: center;
    min-height: 70px;
    padding: 14px 16px;
    cursor: pointer;
    list-style: none;
}

.stationary-locations-table .stationary-grid-row--locations::-webkit-details-marker {
    display: none;
}

.stationary-locations-table .doctor-record[open] .stationary-grid-row--locations {
    background: var(--soft);
}

.stationary-directory-head,
.stationary-location-row {
    display: grid;
    grid-template-columns: minmax(170px, .9fr) minmax(110px, .5fr) minmax(220px, 1.2fr) minmax(120px, .4fr);
    gap: 14px;
    align-items: center;
}

.stationary-location-row {
    padding: 14px 16px;
    border-top: 1px solid var(--line);
}

.stationary-address-inline {
    color: var(--muted);
    font-size: 13px;
}

.stationary-inline-form {
    grid-template-columns: minmax(110px, .6fr) minmax(110px, .6fr) minmax(120px, .55fr) auto;
}

.stationary-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 20px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f9fafb;
}

.stationary-subnav a {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--muted);
    text-decoration: none;
}

.stationary-subnav a:hover {
    background: #fff;
    color: var(--text);
}

.stationary-subnav a.active {
    background: #fff;
    color: var(--navy);
    box-shadow: 0 1px 2px rgba(14, 48, 90, .08);
}

.stationary-form-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
    padding: 14px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.pricing-form-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
}

.location-form-grid {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.stationary-form-grid .full-width-field {
    grid-column: 1 / -1;
}

.stationary-form-grid label {
    display: grid;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.stationary-form-grid input,
.stationary-form-grid select,
.stationary-form-grid textarea {
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: #fff;
    font: inherit;
}

.stationary-form-grid textarea {
    min-height: 120px;
    padding: 10px 12px;
    resize: vertical;
}

.stationary-form-grid button[type="submit"] {
    justify-self: start;
}

.pricing-record-summary {
    grid-template-columns: minmax(170px, .85fr) minmax(100px, .4fr) minmax(110px, .45fr) minmax(160px, .5fr);
}

.stationary-overview-panel {
    margin-top: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.stationary-overview-panel .doctor-schedule-toolbar {
    border-bottom: 1px solid var(--line);
}

.stationary-overview-hint {
    margin: 0;
    padding: 12px 16px 16px;
    color: var(--muted);
    font-size: 13px;
}

.stationary-overview-matrix-wrap {
    padding: 0 0 8px;
}

.stationary-overview-matrix {
    width: 100%;
    border-collapse: collapse;
}

.stationary-overview-matrix th,
.stationary-overview-matrix td {
    border-top: 1px solid var(--line);
    border-right: 1px solid var(--line);
    padding: 10px 12px;
    vertical-align: top;
    text-align: left;
}

.stationary-overview-matrix thead th {
    background: var(--soft-2);
    color: var(--navy);
    font-size: 13px;
}

.stationary-overview-matrix thead th .eyebrow {
    display: block;
    margin-bottom: 2px;
    color: #356aa8;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.stationary-overview-location-cell {
    min-width: 220px;
    background: var(--soft);
}

.stationary-overview-location-cell small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.stationary-overview-location-link {
    color: var(--navy);
    font-weight: 800;
    text-decoration: none;
}

.stationary-overview-location-link:hover {
    text-decoration: underline;
}

.stationary-overview-cell {
    min-width: 108px;
}

.stationary-overview-cell.is-empty {
    color: var(--muted);
    text-align: center;
}

.stationary-overview-cell.past-day {
    background: #fafafa;
}

.stationary-overview-slot {
    display: block;
    margin: 0 0 6px;
    padding: 6px 8px;
    border-radius: 6px;
    background: #FFF0E8;
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
    white-space: nowrap;
}

.stationary-overview-slot:last-child {
    margin-bottom: 0;
}

.stationary-overview-month {
    display: grid;
    gap: 12px;
    padding: 16px;
}

.stationary-overview-day-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.stationary-overview-day-card.past-day {
    background: #fafafa;
}

.stationary-overview-day-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    align-items: baseline;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--soft-2);
    color: var(--navy);
}

.stationary-overview-day-head .eyebrow {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.stationary-overview-day-head span:last-child {
    margin-left: auto;
    color: #356aa8;
    font-size: 12px;
    font-weight: 700;
}

.stationary-overview-location-block {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}

.stationary-overview-location-block:first-of-type {
    border-top: 0;
}

.stationary-overview-location-block-head {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
}

.stationary-overview-slot-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stationary-overview-slot-list .stationary-overview-slot {
    display: inline-block;
    margin: 0;
}

@media (max-width: 1100px) {
    .stationary-schedule-table,
    .stationary-locations-table {
        overflow-x: auto;
    }

    .stationary-grid-head--schedule,
    .stationary-grid-row--schedule,
    .stationary-grid-head--locations,
    .stationary-locations-table .stationary-grid-row--locations {
        min-width: 920px;
    }

    .stationary-overview-matrix-wrap {
        overflow-x: auto;
    }

    .stationary-overview-matrix {
        min-width: 1100px;
    }
}

@media (max-width: 900px) {
    .stationary-form-grid,
    .pricing-form-grid,
    .location-form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .stationary-form-grid,
    .pricing-form-grid,
    .location-form-grid {
        grid-template-columns: 1fr;
    }

    .stationary-subnav {
        flex-direction: column;
    }
}

.status-pill,
.edit-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill.active {
    background: var(--success-bg);
    color: var(--success);
}

.status-pill.inactive {
    background: var(--bg);
    color: var(--muted);
}

.edit-pill {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
}

.doctor-row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.compact-link {
    min-height: 34px;
    padding: 0 12px;
}

.doctor-edit-form {
    display: grid;
    grid-template-columns: minmax(170px, 1fr) minmax(140px, .8fr) minmax(150px, .8fr) minmax(130px, auto) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
    border-top: 1px solid var(--line);
    background: var(--soft);
}

.doctor-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.readonly-value {
    display: flex;
    align-items: center;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0 12px;
    background: var(--soft);
    color: var(--ink);
    font-weight: 700;
}

.empty-state {
    margin: 0;
    padding: 18px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
    text-align: center;
}

.compact-empty {
    padding: 12px;
    text-align: left;
}

.schedule-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(7, 21, 58, 0.48);
}

.schedule-modal {
    width: min(1180px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel);
    box-shadow: var(--shadow-lg);
}

.schedule-modal.stationary-edit-modal {
    width: min(1560px, calc(100vw - 32px));
}

.modal-heading {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

.modal-heading h2 {
    margin: 0;
}

.embedded-schedule {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.alert {
    grid-column: 1 / -1;
    border-radius: 8px;
    padding: 12px 14px;
    font-weight: 700;
}

.alert-error {
    border: 1px solid #f0c4c0;
    background: var(--danger-bg);
    color: var(--danger);
}

.alert-success {
    border: 1px solid #94D9CF;
    background: var(--success-bg);
    color: var(--success);
}

.login-screen {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #F7F8FA 0%, #EEF3F7 100%);
}

.login-box {
    width: min(430px, 100%);
    padding: 1.8rem 1.7rem;
    border-radius: var(--radius-lg);
}

.login-box h1 {
    letter-spacing: -0.03em;
}

.login-box p {
    margin: 8px 0 22px;
    color: var(--muted);
    line-height: 1.65;
    max-width: 36ch;
}

.login-box p.login-kicker {
    margin: 0 0 0.35rem;
    color: var(--teal);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.login-box code {
    color: var(--ink);
    font-weight: 800;
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        width: 100%;
    }

    .admin-nav {
        grid-column: 1 / -1;
        width: 100%;
        overflow-x: auto;
    }

    .logout-form {
        justify-self: end;
    }

    .admin-nav a {
        flex: 1;
        text-align: center;
    }

    .availability-toggle {
        align-items: stretch;
        flex-direction: column;
    }

    .availability-toggle button {
        width: 100%;
    }

    .calendar-panel,
    .editor-panel,
    .doctor-schedule-panel,
    .doctor-chart-card {
        padding: 16px;
    }

    .dashboard-toolbar {
        grid-template-columns: 42px 1fr 42px;
    }

    .dashboard-toolbar-filters {
        grid-column: 1 / -1;
        justify-content: stretch;
    }

    .dashboard-toggle,
    .dashboard-channel-switcher {
        flex: 1 1 auto;
        white-space: normal;
    }

    .dashboard-channel-switcher button {
        flex: 1;
        text-align: center;
    }

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

    .doctor-info-table {
        min-width: 620px;
    }

    .doctor-schedule-toolbar {
        grid-template-columns: 42px 1fr 42px;
    }

    .view-switcher {
        grid-column: 1 / -1;
        justify-self: stretch;
    }

    .view-switcher a {
        flex: 1;
        text-align: center;
    }

    .calendar-day {
        min-height: 74px;
        padding: 8px;
    }

    .calendar-day strong {
        margin-bottom: 9px;
        font-size: 16px;
    }

    .calendar-day span {
        font-size: 10px;
    }

    .add-slot-form,
    .slot-row,
    .doctor-slot-form,
    .doctor-slot-row,
    .admin-doctor-slot-row,
    .doctor-create-form,
    .doctor-edit-form,
    .doctor-directory-head,
    .doctor-record-summary {
        grid-template-columns: 1fr;
    }

    .doctor-directory-head {
        display: none;
    }

    .doctor-row-actions,
    .doctor-actions {
        justify-content: stretch;
    }

    .doctor-row-actions {
        flex-direction: column;
    }

    .doctor-create-form .doctor-note-field,
    .doctor-edit-form .doctor-note-field {
        grid-column: auto;
    }

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

    .doctor-day-cell {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .doctor-inline-form {
        align-items: end;
    }

    .doctor-inline-form .work-slot-services-picker,
    .doctor-inline-form .work-slot-channels-picker {
        flex-basis: 100%;
    }

    .doctor-inline-form button {
        width: 100%;
    }

    .doctor-inline-form label {
        gap: 5px;
    }

    .doctor-slot-chip {
        display: grid;
        grid-template-columns: 1fr 1fr auto;
        width: 100%;
    }

    .slot-actions,
    .doctor-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .slot-actions button,
    .doctor-actions button,
    .doctor-actions .button-link {
        width: 100%;
    }

    .schedule-modal-backdrop {
        align-items: stretch;
        padding: 10px;
    }

    .schedule-modal {
        max-height: calc(100vh - 20px);
    }

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

@media (max-width: 480px) {
    .app-shell,
    .app-shell--stationary {
        width: min(100% - 24px, 100%);
        margin: 16px auto;
        gap: 16px;
    }

    .topbar {
        padding: 16px;
    }

    .login-screen {
        padding: 16px;
    }

    .login-box {
        padding: 22px 18px;
    }

    .calendar-panel,
    .editor-panel,
    .accounts-panel,
    .doctor-schedule-panel,
    .doctor-chart-card {
        padding: 14px;
    }

    .doctor-inline-form .work-slot-services-picker,
    .doctor-inline-form .work-slot-channels-picker,
    .doctor-inline-form button {
        flex-basis: 100%;
    }

    .doctor-slot-chip {
        grid-template-columns: 1fr auto;
    }

    .schedule-modal-backdrop {
        padding: 0;
    }

    .schedule-modal,
    .schedule-modal.stationary-edit-modal {
        width: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
.service-badge-mix {
    background: #F2F2FC;
    color: #8088D0;
}

.mix-rate-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: end;
}

.mix-rate-fields[hidden],
[data-standard-fields][hidden] {
    display: none !important;
}

.mix-rate-fields small {
    flex-basis: 100%;
    color: var(--muted);
}

.mix-capacity-summary {
    white-space: nowrap;
}
