/* ==========================================================================
   REVITO - Admin & Specialist Dashboard Styles
   ========================================================================== */

:root {
    --admin-sidebar-bg: #1e2621;
    --admin-sidebar-active: #4c6454;
    --admin-main-bg: #f4f6f4;
    --admin-card-bg: #ffffff;
    --admin-border: #e2e8e4;
    --admin-text-main: #1f2923;
    --admin-text-muted: #64746a;
    --admin-radius-card: 18px;
    --admin-shadow-card: 0 8px 28px rgba(30, 67, 45, 0.07);
}

@media (max-width: 700px) {
    .calendar-shell {
        border-radius: 14px !important;
        overscroll-behavior-x: contain;
        scroll-snap-type: x proximity;
        scroll-padding-left: 70px;
        scrollbar-width: thin;
    }
    .week-calendar {
        grid-template-columns: 70px repeat(7, 240px) !important;
        min-width: 1750px !important;
    }
    .calendar-corner,
    .time-rail {
        position: sticky;
        left: 0;
        z-index: 20;
        background: #f8faf8 !important;
        box-shadow: 5px 0 10px rgba(31, 57, 42, .08);
    }
    .calendar-corner {
        z-index: 30;
    }
    .day-column {
        scroll-snap-align: center;
        scroll-margin-left: 0;
        scroll-snap-stop: always;
    }
    .day-head {
        height: 68px !important;
        padding: 10px 12px !important;
    }
    .day-head strong {
        font-size: .88rem !important;
    }
    .day-head span {
        font-size: .72rem !important;
    }
    .time-label {
        font-size: .74rem;
    }
    .appointment-card .appointment-time {
        font-size: 1.18rem !important;
    }
    .appointment-card .appointment-client-name {
        font-size: 1rem !important;
    }
    .add-slot {
        border-radius: 9px !important;
        font-size: 1rem !important;
    }
    .calendar-legend {
        display: none !important;
    }
}

/* Cohesive admin surfaces and touch-friendly controls. */
.admin-subtitle {
    margin-top: 3px;
    color: var(--admin-text-muted);
    font-size: .85rem;
    line-height: 1.45;
}

.filter-card,
.admin-card,
.booking-form-card,
.user-card-pad,
.day-card,
.session-card {
    border-radius: var(--admin-radius-card) !important;
}

.filter-card,
.admin-card,
.booking-form-card,
.user-card-pad {
    border-color: var(--admin-border) !important;
    box-shadow: var(--admin-shadow-card) !important;
}

.admin-content .form-input,
.admin-content .form-select,
.admin-content .form-textarea {
    border-radius: 11px;
    border-color: #d8e2db;
    background-color: #fff;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.admin-content .form-input:focus,
.admin-content .form-select:focus,
.admin-content .form-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 118, 85, .12);
    background-color: #fff;
}

.admin-content .btn {
    border-radius: 11px;
}

.team-member-card {
    background: linear-gradient(145deg, #fff 0%, #f8fbf8 100%);
}

@media (max-width: 640px) {
    .admin-topbar {
        position: relative;
        top: auto;
        padding: 16px 12px 14px;
        gap: 12px;
        background: linear-gradient(180deg, #fff 0%, #fbfdfb 100%);
    }

    .admin-title {
        font-size: 1.32rem;
        letter-spacing: -.02em;
    }

    .admin-subtitle,
    .admin-topbar > div > div:not(.admin-title) {
        font-size: .79rem !important;
        line-height: 1.45;
    }

    .admin-content {
        padding: 12px 10px calc(30px + env(safe-area-inset-bottom, 0px));
    }

    .admin-filter-bar,
    .filter-card,
    .admin-card,
    .booking-form-card,
    .user-card-pad {
        padding: 15px !important;
        border-radius: 16px !important;
    }

    .admin-content .form-group {
        margin-bottom: 15px;
    }

    .admin-content .form-label,
    .admin-content .filter-item label {
        display: block;
        margin-bottom: 6px;
        font-size: .75rem;
        line-height: 1.35;
        letter-spacing: .015em;
    }

    .admin-content .form-input,
    .admin-content .form-select {
        min-height: 48px;
        padding: 11px 12px;
    }

    .admin-content .form-textarea {
        min-height: 104px;
        padding: 11px 12px;
    }

    .admin-content .btn,
    .admin-topbar .btn {
        min-height: 44px;
        padding: 10px 14px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1.2;
    }

    .filter-row > .btn,
    .filter-row > a.btn {
        width: 100%;
    }

    .team-board-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .team-member-card {
        min-height: 0 !important;
        padding: 18px !important;
    }

    .table-container:has(.mobile-card-table) {
        overflow: visible;
        border: 0;
        box-shadow: none;
        background: transparent;
    }

    .mobile-card-table,
    .mobile-card-table tbody,
    .mobile-card-table tr,
    .mobile-card-table td {
        display: block;
        width: 100%;
        min-width: 0 !important;
    }

    .mobile-card-table thead {
        display: none;
    }

    .mobile-card-table tr {
        margin-bottom: 12px;
        padding: 13px 14px;
        border: 1px solid var(--admin-border);
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 5px 18px rgba(30, 67, 45, .06);
    }

    .mobile-card-table td,
    .mobile-card-table tr:hover td {
        display: grid;
        grid-template-columns: minmax(82px, 30%) minmax(0, 1fr);
        gap: 10px;
        align-items: start;
        padding: 7px 0;
        border: 0;
        background: transparent;
        text-align: left !important;
        overflow-wrap: anywhere;
    }

    .mobile-card-table td::before {
        content: attr(data-label);
        color: var(--admin-text-muted);
        font-size: .67rem;
        font-weight: 800;
        line-height: 1.35;
        text-transform: uppercase;
    }

    .mobile-card-table td:empty {
        display: none;
    }

    .mobile-card-table .action-btn-group {
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 7px;
    }

    .mobile-card-table .btn-action {
        width: auto;
        min-height: 38px;
        flex: 1 1 100px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-card-table .empty-table-row td {
        display: block;
        padding: 20px 8px;
        text-align: center !important;
    }

    .mobile-card-table .empty-table-row td::before {
        display: none;
    }

    .session-card {
        padding: 14px !important;
        background: #fbfdfb;
    }

    .schedule-grid {
        gap: 10px !important;
    }

    .schedule-grid .day-card {
        padding: 14px !important;
        box-shadow: 0 4px 16px rgba(30, 67, 45, .05);
    }
}

body.admin-body {
    background-color: var(--admin-main-bg);
    color: var(--admin-text-main);
    display: flex;
    min-height: 100vh;
}

body.admin-body img,
body.admin-body svg {
    max-width: 100%;
}

.admin-content > *,
.admin-card,
.filter-card,
.stat-card,
.table-container {
    min-width: 0;
    max-width: 100%;
}

/* Sidebar */
.admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    width: 260px;
    background: var(--admin-sidebar-bg);
    color: #e5eae6;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo {
    height: 38px;
    width: auto;
}

.sidebar-brand-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 20px 12px;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: #c0ccc3;
    font-weight: 600;
    font-size: 0.95rem;
    transition: var(--transition);
}

.sidebar-nav svg, .sidebar-logout-btn svg { flex-shrink: 0; }

.sidebar-nav a:hover, .sidebar-nav a.active {
    background: var(--admin-sidebar-active);
    color: #fff;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
}

.user-details {
    line-height: 1.3;
    min-width: 0;
    overflow-wrap: anywhere;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
}

.user-role-label {
    font-size: 0.78rem;
    color: #93a297;
}

/* Main Content Area */
.admin-main {
    margin-left: 260px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    background: #fff;
    border-bottom: 1px solid var(--admin-border);
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 0 rgba(31, 57, 42, .03);
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.admin-content {
    padding: 30px;
    flex-grow: 1;
    width: 100%;
    max-width: 1640px;
    margin: 0 auto;
}

/* Stat KPI Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--admin-radius-card);
    box-shadow: var(--admin-shadow-card);
}

.stat-card-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--admin-text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.stat-card-val {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-dark);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

/* Filter Controls Bar */
.admin-filter-bar {
    background: #fff;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--admin-border);
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-item {
    flex: 1;
    min-width: 180px;
}

.filter-item label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--admin-text-muted);
    text-transform: uppercase;
}

/* Modern Data Table */
.table-container {
    background: #fff;
    border-radius: var(--radius-md);
    border: 1px solid var(--admin-border);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    border-radius: var(--admin-radius-card);
    box-shadow: var(--admin-shadow-card);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}

.data-table th {
    background: #f8faf8;
    padding: 14px 18px;
    font-weight: 700;
    color: var(--admin-text-muted);
    border-bottom: 1px solid var(--admin-border);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.data-table td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--admin-border);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: #fbfdfb;
}

.action-btn-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-action {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    border: 1px solid var(--admin-border);
    background: #fff;
    cursor: pointer;
    transition: var(--transition);
}

.btn-action:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-action.btn-confirm {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.btn-action.btn-complete {
    background: #e0f2fe;
    color: #0369a1;
    border-color: #7dd3fc;
}

.btn-action.btn-cancel {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

/* A long visit visually occupies every half-hour it has reserved. */
.calendar-slot.has-extended-appointment {
    z-index: 3;
}

.calendar-slot.has-extended-appointment .appointment-card {
    position: relative;
    z-index: 4;
    box-shadow: 0 5px 14px rgba(35, 86, 52, .12);
}

/* The destructive action belongs to the edit form action row. */
#cancelBookingBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-left: 10px;
    padding: 10px 16px;
    border: 1px solid #fca5a5;
    border-radius: 11px;
    background: #fff1f2;
    color: #991b1b;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
    cursor: pointer;
}

#cancelBookingBtn:hover {
    background: #ffe4e6;
    border-color: #ef4444;
}

@media (max-width: 640px) {
    #editBookingForm > button[type="submit"] {
        display: flex;
        width: 100%;
        min-height: 44px;
        margin: 0;
        justify-content: center;
    }

    #cancelBookingBtn {
        width: 100%;
        margin: 10px 0 0;
    }
}

/* Language Switcher in Admin */
.admin-lang-switch {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full);
    padding: 3px;
    gap: 3px;
}

.admin-lang-switch.mini {
    background: #f1f4f1;
    border: 1px solid var(--admin-border);
}

.admin-lang-btn {
    padding: 4px 9px;
    font-size: 0.74rem;
    font-weight: 700;
    color: #c0ccc3;
    border-radius: var(--radius-full);
    transition: var(--transition);
    text-decoration: none;
    line-height: 1;
}

.admin-lang-btn:hover {
    color: #fff;
}

.admin-lang-btn.active {
    background: var(--admin-sidebar-active);
    color: #fff;
}

.admin-lang-switch.mini .admin-lang-btn {
    color: var(--admin-text-muted);
}

.admin-lang-switch.mini .admin-lang-btn:hover {
    color: var(--primary-dark);
}

.admin-lang-switch.mini .admin-lang-btn.active {
    background: var(--primary);
    color: #fff;
}

.sidebar-lang-box {
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.sidebar-lang-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8c9e92;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-brand-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-close-btn {
    display: none;
    background: transparent;
    border: none;
    color: #c0ccc3;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-logout-btn {
    width: 100%;
    border-color: rgba(255,255,255,0.2) !important;
    color: #fff !important;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    white-space: normal;
    padding: 8px 12px;
}

.sidebar-logout-btn:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
}

.admin-mobile-header {
    display: none;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 18, 0.65);
    backdrop-filter: blur(3px);
    z-index: 1400;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive Admin (Mobile & Tablet) */
@media (max-width: 900px) {
    body.admin-body {
        flex-direction: column;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }

    .admin-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 16px;
        background: #ffffff;
        border-bottom: 1px solid var(--admin-border);
        position: sticky;
        top: 0;
        z-index: 1300;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }

    .btn-hamburger {
        background: #f4f7f5;
        border: 1px solid var(--admin-border);
        border-radius: 8px;
        padding: 8px;
        cursor: pointer;
        color: var(--primary-dark);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: var(--transition);
    }

    .btn-hamburger:hover {
        background: #e6ede8;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 8px;
        text-decoration: none;
    }

    .mobile-brand-logo {
        height: 28px;
        width: auto;
    }

    .mobile-brand-title {
        font-size: 1rem;
        font-weight: 800;
        color: var(--primary-dark);
        letter-spacing: 0.5px;
    }

    .mobile-topbar-right {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .user-avatar-mini {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        background: var(--primary);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 700;
        font-size: 0.85rem;
    }

    .sidebar-backdrop {
        display: block;
    }

    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(290px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
        z-index: 1500;
        transform: translateX(-105%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: env(safe-area-inset-bottom, 0px);
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.4);
    }

    .sidebar-close-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .admin-main {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        padding: 0;
    }

    .admin-topbar {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .admin-topbar > div:last-child {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .admin-topbar > div:last-child .btn {
        flex: 1 1 auto;
        justify-content: center;
        text-align: center;
    }

    .admin-title {
        font-size: 1.35rem;
    }

    .admin-content {
        padding: 14px 12px 32px;
    }

    /* Stats Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 14px;
        gap: 10px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
    }

    .stat-value {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    /* Filters Box */
    .filter-card {
        padding: 16px;
        margin-bottom: 18px;
    }

    .filter-row {
        gap: 12px;
    }

    .filter-item {
        min-width: 100%;
        flex: 1 1 100%;
    }

    /* Table Container */
    .table-container {
        border-radius: var(--radius-sm);
        margin-bottom: 20px;
        -webkit-overflow-scrolling: touch;
    }

    .data-table th, .data-table td {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .action-btn-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        min-width: 100px;
    }

    .btn-action {
        width: 100%;
        text-align: center;
        padding: 6px 8px;
    }
}

@media (max-width: 640px) {
    body.admin-body {
        min-height: 100dvh;
    }

    .admin-mobile-header {
        padding: 8px max(10px, env(safe-area-inset-right, 0px)) 8px max(10px, env(safe-area-inset-left, 0px));
        gap: 8px;
    }

    .mobile-brand,
    .mobile-topbar-right {
        min-width: 0;
    }

    .mobile-topbar-right {
        gap: 6px;
    }

    .admin-lang-btn {
        padding: 7px 8px;
    }

    .btn-hamburger,
    .user-avatar-mini {
        flex: 0 0 auto;
    }

    .admin-main,
    .admin-content,
    .admin-topbar > * {
        min-width: 0;
    }

    .admin-topbar {
        padding: 14px 12px;
        align-items: stretch;
    }

    .admin-topbar > div:last-child {
        width: 100%;
    }

    .admin-topbar > div:last-child > .btn,
    .admin-topbar > div:last-child > a.btn,
    .admin-topbar > div:last-child > button.btn {
        flex: 1 1 100%;
        width: 100%;
        justify-content: center;
    }

    .admin-title {
        font-size: 1.25rem;
        line-height: 1.25;
        overflow-wrap: anywhere;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 8px;
    }

    .admin-content {
        padding: 10px max(8px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
        overflow-x: hidden;
    }

    .admin-filter-bar,
    .filter-card,
    .admin-card,
    .booking-form-card,
    .user-card-pad {
        padding: 16px !important;
    }

    .filter-row,
    .admin-filter-bar {
        align-items: stretch;
    }

    .filter-item,
    .filter-row > *,
    .admin-filter-bar > * {
        min-width: 0;
        max-width: 100%;
    }

    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    .table-container {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
    }

    .data-table:not(.appointments-table) {
        min-width: 620px;
    }

    .admin-content .form-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .admin-content .form-group,
    .admin-content .form-input,
    .admin-content .form-select,
    .admin-content .form-textarea {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .exception-grid {
        grid-template-columns: minmax(0, 1fr) !important;
    }

    .schedule-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .day-card {
        padding: 16px;
    }

    .modal-card {
        width: calc(100% - 12px) !important;
        max-width: none !important;
        max-height: 94dvh;
        margin: 6px;
        border-radius: 12px;
    }

    .modal-head, .modal-foot {
        padding: 14px 16px;
    }

    .modal-body {
        padding: 16px;
        overflow-x: hidden;
    }

    .modal-foot {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 8px;
    }

    .modal-foot .btn,
    .modal-foot button {
        width: 100%;
        justify-content: center;
    }

    .status-toggle-group {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .bulk-assign-inputs {
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-assign-inputs > div {
        width: 100%;
    }

    .slot-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .appointments-table,
    .appointments-table tbody,
    .appointments-table tr,
    .appointments-table td {
        display: block;
        width: 100%;
    }

    .appointments-table thead {
        display: none;
    }

    .appointments-table tr {
        padding: 10px 12px;
        border-bottom: 1px solid var(--admin-border);
    }

    .appointments-table tr:last-child {
        border-bottom: 0;
    }

    .appointments-table td,
    .appointments-table tr:hover td {
        display: grid;
        grid-template-columns: minmax(78px, 30%) minmax(0, 1fr);
        gap: 10px;
        padding: 8px 0;
        border: 0;
        background: transparent;
        overflow-wrap: anywhere;
    }

    .appointments-table td::before {
        content: attr(data-label);
        color: var(--admin-text-muted);
        font-size: 0.7rem;
        font-weight: 800;
        line-height: 1.35;
        text-transform: uppercase;
    }

    .appointments-table .action-btn-group {
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start !important;
    }

    .appointments-table .btn-action {
        width: auto;
        flex: 1 1 92px;
    }
}

@media (max-width: 380px) {
    .mobile-brand-title,
    .user-avatar-mini {
        display: none;
    }

    .admin-sidebar {
        width: calc(100vw - 28px);
        max-width: calc(100vw - 28px);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    .stats-grid {
        grid-template-columns: 1fr !important;
    }

    .appointments-table td {
        grid-template-columns: 1fr;
        gap: 4px;
    }
}
/* Calendar actions stay visible in every suitable free slot. */
.calendar-slot .add-slot { display: flex !important; }
.calendar-slot.open:hover .add-slot { background: #edf8ef; border-color: var(--primary); }
@media (max-width: 700px) {
    .specialist-tabs {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        width: 100%;
        gap: 8px;
        overflow: visible !important;
        flex-wrap: initial !important;
    }
    .specialist-tab {
        min-width: 0;
        text-align: center;
        padding: 12px 8px;
        line-height: 1.2;
    }

    .admin-content .team-board-grid {
        grid-template-columns: minmax(0, 1fr) !important;
        gap: 12px !important;
    }

    .admin-content .team-board-grid .team-member-card {
        min-height: 0 !important;
        padding: 18px !important;
    }
}

.pass-schedule-panel { margin-top:20px; }
.pass-schedule-panel summary { cursor:pointer;list-style:none; }
.pass-schedule-panel form { margin-top:16px; }
.pass-date-row { display:flex;align-items:end;gap:12px;margin:12px 0; }
.pass-date-row label { flex:1;min-width:0; }
.pass-date-row .form-input { margin:6px 0 0;width:100%; }
.pass-schedule-actions { display:flex;flex-wrap:wrap;gap:12px;margin-top:16px; }
@media(max-width:600px) { .pass-date-row { flex-wrap:wrap; } .pass-date-row label { flex-basis:40%; } }
