/* timeler2.css — Timeler-spezifische Styles
 * Setzt voraus: design-tokens.css, components.css, utilities.css
 * Enthaelt: Calendar, Appointments, Slide-Menu, Bottom-Nav, FAB, Patient Records
 * ====================================================================== */


/* ======================================================================
   TIMELER-SPEZIFISCH
   ====================================================================== */


/* Header, Nav, Main — aus components.css */
.crm-header-logo {
    color: var(--crm-text, #1e293b);
}


/* -------------------------------------------------------------------
   Slide Menu (hamburger / off-canvas)
   ------------------------------------------------------------------- */

.crm-slide-menu {
    position: fixed;
    right: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--crm-surface);
    box-shadow: -4px 0 24px rgba(0, 0, 0, .12);
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.crm-slide-menu.open {
    transform: translateX(0);
}

.crm-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.crm-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.crm-slide-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--crm-border);
}

.crm-slide-menu-name {
    font-size: 15px;
    font-weight: 700;
}

.crm-slide-menu-role {
    display: block;
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-slide-menu-items {
    padding: 0.5rem 0;
}

.crm-slide-menu-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 1.25rem;
    font-size: 14px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--crm-text);
    text-decoration: none;
    transition: background-color 0.15s;
}

.crm-slide-menu-item:hover {
    background: var(--crm-surface-2);
    text-decoration: none;
}

.crm-slide-menu-dropdown-toggle {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.6rem 1.25rem;
    font-size: 14px;
    width: 100%;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--crm-text);
    transition: background-color 0.15s;
    justify-content: space-between;
}

.crm-slide-menu-dropdown-toggle:hover {
    background: var(--crm-surface-2);
}

.crm-slide-menu-dropdown-content {
    padding-left: 2.5rem;
    display: none;
}

.crm-slide-menu-dropdown-content.open {
    display: block;
}


/* -------------------------------------------------------------------
   Impersonation Banner
   ------------------------------------------------------------------- */

.crm-impersonation-banner {
    display: flex;
    justify-content: center;
    gap: 1rem;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fef3c7;
    font-size: 13px;
    z-index: 101;
}


/* Toolbar, Buttons, Forms, Panels, Tabs, Modals, Tables, Toasts — aus components.css */


/* -------------------------------------------------------------------
   Bottom Navigation (mobile only)
   ------------------------------------------------------------------- */

.crm-bottom-nav {
    display: none;
}

.crm-bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    font-size: 10px;
    color: var(--crm-text-muted);
    border-top: 2px solid transparent;
    text-decoration: none;
    padding: 0.35rem 0;
    transition: color 0.15s;
}

.crm-bottom-nav-item:hover {
    text-decoration: none;
}

.crm-bottom-nav-item.active {
    color: var(--crm-primary-text, var(--crm-primary));
    border-top-color: var(--crm-primary);
    font-weight: 600;
}

.crm-bottom-nav-item svg,
.crm-bottom-nav-item i {
    font-size: 18px;
}


/* -------------------------------------------------------------------
   FAB (Floating Action Button)
   ------------------------------------------------------------------- */

.crm-fab-container {
    position: fixed;
    bottom: 80px;
    right: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    z-index: 900;
}

.crm-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 2px solid rgba(0, 0, 0, .1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.crm-fab:hover {
    transform: scale(1.05);
}

.crm-fab:active {
    transform: scale(0.97);
}

.crm-fab-primary {
    background: var(--crm-primary);
    color: var(--crm-on-primary, #fff);
}

.crm-fab-primary:hover {
    background: var(--crm-primary-dark);
}

.crm-fab-secondary {
    background: var(--crm-surface);
    color: var(--crm-text);
    border: 1px solid var(--crm-border);
}

.crm-fab-secondary:hover {
    background: var(--crm-surface-2);
}

/* PWA Install Banner */
.crm-install-banner {
    position: fixed;
    bottom: 72px;
    left: .75rem;
    right: .75rem;
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1rem;
    background: var(--crm-surface, #fff);
    border: 1px solid var(--crm-border, #e2e8f0);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    z-index: 1000;
    animation: slideUp .3s ease;
}

/* Beta Badge */
.crm-beta-badge {
    display: inline-block;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .05em;
    padding: .15em .5em;
    background: var(--crm-accent, #f59e0b);
    color: #fff;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: .35rem;
}

/* Pill Navigation */
.crm-pill-nav {
    display: flex;
    gap: .5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.crm-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .4rem .85rem;
    border: 1px solid var(--crm-border, #e2e8f0);
    border-radius: 20px;
    background: var(--crm-surface, #fff);
    color: var(--crm-text-secondary, #64748b);
    font-size: .85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
}
.crm-pill:hover { border-color: var(--crm-primary, #3b82f6); color: var(--crm-text, #1e293b); }
.crm-pill.active {
    background: var(--crm-primary, #3b82f6);
    color: var(--crm-on-primary, #fff);
    border-color: var(--crm-primary, #3b82f6);
}

/* Onboarding feature cards */
.crm-onboarding-feature {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
}
.crm-onboarding-icon {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: var(--crm-surface-2, #f1f5f9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-primary, #3b82f6);
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Pagination, Settings, Stats, Toggle, Search, Dropdown, Empty State,
   Spinner, Notification Settings — aus components.css */


/* ======================================================================
   LAYER 3: TIMELER-SPECIFIC (Calendar, Appointments)
   ====================================================================== */


/* -------------------------------------------------------------------
   Calendar Toolbar / Nav
   ------------------------------------------------------------------- */

.crm-cal-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.crm-cal-date-row {
    font-size: 1.1rem;
    font-weight: 700;
}

.crm-cal-controls {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.crm-cal-view-toggle {
    display: flex;
    gap: 0.25rem;
}

.crm-cal-view-toggle .crm-tab {
    /* Uses existing crm-tab styles */
}


/* -------------------------------------------------------------------
   Therapist Legend
   ------------------------------------------------------------------- */

.crm-cal-therapist-legend {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    margin-bottom: 0.75rem;
}

.crm-cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: 99px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.2s, box-shadow 0.2s, border-color 0.2s;
    user-select: none;
}

.crm-cal-legend-item.active {
    border-color: var(--crm-text-muted);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}

.crm-cal-legend-item.inactive {
    opacity: 0.35;
    border-color: var(--crm-border);
}

.crm-cal-legend-item:hover {
    box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
    opacity: 1;
}

.crm-cal-legend-item.hidden {
    opacity: 0.35;
}

.crm-cal-legend-dot {
    width: 10px;
    height: 10px;
    min-width: 10px;
    min-height: 10px;
    border-radius: 50%;
    flex: 0 0 10px;
    display: inline-block;
}

.crm-cal-legend-item.inactive .crm-cal-legend-dot {
    background: #d1d5db !important;
}

.legend-name {
    white-space: nowrap;
}


/* -------------------------------------------------------------------
   Calendar Filter Bar
   ------------------------------------------------------------------- */

.crm-cal-filter-bar {
    margin-bottom: 1rem;
}


/* -------------------------------------------------------------------
   Calendar Grid (shared)
   ------------------------------------------------------------------- */

.crm-cal-grid {
    background: var(--crm-surface);
    border-radius: var(--crm-radius);
    box-shadow: var(--crm-shadow);
    overflow: hidden;
}

/* --- Calendar Fullscreen Mode --- */
body.calendar-fullscreen .crm-header,
body.calendar-fullscreen .crm-bottom-nav,
body.calendar-fullscreen .crm-cal-filter-bar,
body.calendar-fullscreen .crm-fab-container {
    display: none !important;
}

body.calendar-fullscreen .crm-main {
    padding: 0;
    max-width: none;
}

body.calendar-fullscreen .crm-toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--crm-bg);
    padding: 0.5rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--crm-border);
}

body.calendar-fullscreen .crm-cal-therapist-legend {
    padding: 0.35rem 1rem;
    margin: 0;
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-surface);
}

body.calendar-fullscreen .crm-cal-grid {
    border-radius: 0;
    box-shadow: none;
}

body.calendar-fullscreen .crm-cal-grid .fc {
    height: calc(100vh - 90px) !important;
}


/* -------------------------------------------------------------------
   Week View
   ------------------------------------------------------------------- */

.crm-cal-week {
    display: grid;
    /* grid-template-columns set dynamically by JS based on visible days */
    grid-template-columns: 50px repeat(5, 1fr);
}

.crm-cal-week-header {
    display: contents;
}

.crm-cal-week-header-cell {
    padding: 0.5rem;
    text-align: center;
    background: var(--crm-surface-2);
    border-bottom: 1px solid var(--crm-border);
    border-left: 1px solid var(--crm-border);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--crm-text-muted);
}

.crm-cal-week-header-cell:first-child {
    border-left: none;
}

.crm-cal-week-header-cell.today {
    color: var(--crm-primary-text, var(--crm-primary));
    position: relative;
}

.crm-cal-week-header-cell.today::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--crm-primary);
}

.crm-cal-week-body {
    display: contents;
}

.crm-cal-time-label {
    padding: 0.25rem 0.5rem;
    font-size: 11px;
    color: var(--crm-text-muted);
    text-align: right;
    border-right: 1px solid var(--crm-border);
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-surface);
    min-height: 60px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.crm-cal-time-slot {
    position: relative;
    min-height: 60px;
    border-bottom: 1px solid var(--crm-border);
    border-left: 1px solid var(--crm-border);
}

.crm-cal-time-slot.outside-hours {
    background: #f9fafb;
}
.crm-cal-time-slot.past-slot {
    background: #f3f4f6;
    opacity: .75;
}
.crm-cal-time-slot.past-slot:hover {
    background: #e9eaec;
}
.crm-cal-week-header-cell.past-day {
    color: var(--crm-text-muted);
    opacity: .6;
}
.crm-cal-time-slot.holiday-slot {
    background: repeating-linear-gradient(-45deg, #fef2f2, #fef2f2 4px, #fff1f2 4px, #fff1f2 8px);
    pointer-events: none;
}
.crm-cal-week-header-cell.holiday {
    background: #fef2f2;
    color: var(--crm-danger, #dc2626);
}
.holiday-badge {
    font-size: .6rem;
    font-weight: 600;
    color: var(--crm-danger, #dc2626);
    vertical-align: middle;
}
.fc-holiday {
    opacity: 0.6;
}

.crm-cal-time-slot:hover {
    background: var(--crm-primary-light);
}


/* -------------------------------------------------------------------
   Month View
   ------------------------------------------------------------------- */

.crm-cal-month {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.crm-cal-month-header {
    padding: 0.5rem;
    text-align: center;
    background: var(--crm-surface-2);
    border-bottom: 1px solid var(--crm-border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--crm-text-muted);
}

.crm-cal-month-day {
    min-height: 100px;
    padding: 0.35rem;
    border-bottom: 1px solid var(--crm-border);
    border-left: 1px solid var(--crm-border);
    position: relative;
}

.crm-cal-month-day:nth-child(7n+1) {
    border-left: none;
}

.crm-cal-month-day.today {
    background: var(--crm-primary-light);
}

.crm-cal-month-day.other-month {
    opacity: 0.4;
}

.crm-cal-month-date {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.crm-cal-month-day.today .crm-cal-month-date {
    color: var(--crm-primary-text, var(--crm-primary));
}


/* -------------------------------------------------------------------
   Day View
   ------------------------------------------------------------------- */

.crm-cal-day {
    display: grid;
    grid-template-columns: 52px 1fr;
}

.crm-cal-day .crm-cal-time-label {
    /* Inherits from shared .crm-cal-time-label */
}

.crm-cal-day .crm-cal-time-slot {
    /* Inherits from shared .crm-cal-time-slot */
}


/* -------------------------------------------------------------------
   Appointment Cards (calendar cells)
   ------------------------------------------------------------------- */

.crm-cal-appointment {
    position: absolute;
    left: 2px;
    right: 2px;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    overflow: hidden;
    cursor: pointer;
    transition: filter 0.15s, box-shadow 0.15s;
    line-height: 1.3;
    border-left: 3px solid;
    z-index: 1;
}

.crm-cal-appointment:hover {
    filter: brightness(0.95);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
    z-index: 10;
}

.crm-cal-appointment--angefragt,
.crm-cal-appointment--verschoben {
    opacity: 0.75;
    border-left-style: dashed;
}

.crm-cal-appointment--abgesagt {
    opacity: 0.35;
    text-decoration: line-through;
    border-left-style: dotted;
    pointer-events: none;
}

.crm-cal-appointment--blocked {
    background: repeating-linear-gradient(
        45deg,
        #f1f5f9,
        #f1f5f9 5px,
        #e2e8f0 5px,
        #e2e8f0 10px
    ) !important;
    border-color: #94a3b8;
    color: var(--crm-text-muted);
}

/* Appointment inner elements (rendered by app.js) */
.appointments-container {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 40px;
    overflow: visible;
}

.appointment-patient {
    font-weight: 600;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.appointment-time {
    opacity: 0.8;
    font-size: 10px;
}

.appointment-room {
    opacity: 0.8;
    font-size: 10px;
}

.status-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 14px;
    z-index: 10;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.prep-indicator {
    font-size: 10px;
    opacity: 0.7;
}

.patient-unconfirmed {
    border-left-style: dashed;
}

/* (Old legend-item styles removed — using crm-cal-legend-item instead) */


/* -------------------------------------------------------------------
   Month Appointment Pills
   ------------------------------------------------------------------- */

.crm-cal-month-appt {
    display: block;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.5;
    cursor: pointer;
    transition: filter 0.15s;
}

.crm-cal-month-appt:hover {
    filter: brightness(0.92);
}

.crm-cal-month-more {
    font-size: 10px;
    color: var(--crm-text-muted);
    cursor: pointer;
    padding: 1px 4px;
}

.crm-cal-month-more:hover {
    color: var(--crm-primary-text, var(--crm-primary));
}


/* -------------------------------------------------------------------
   Slot Picker
   ------------------------------------------------------------------- */

.crm-cal-slot-picker {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.crm-cal-selected-slot {
    padding: 0.4rem 0.75rem;
    background: var(--crm-surface-2);
    border-radius: var(--crm-radius);
    border: 1px solid var(--crm-border);
    flex: 1;
    font-size: 14px;
}

.crm-cal-slot-placeholder {
    color: var(--crm-text-muted);
    font-style: italic;
}

.crm-cal-slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.35rem;
    padding: 0.75rem;
}

.crm-cal-slot-btn {
    padding: 0.35rem;
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    font-size: 13px;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    color: var(--crm-text);
}

.crm-cal-slot-btn:hover {
    background: var(--crm-primary-light);
    border-color: var(--crm-primary);
}

.crm-cal-slot-btn.selected {
    background: var(--crm-primary);
    color: var(--crm-on-primary, #fff);
    border-color: var(--crm-primary);
}

.crm-cal-slot-btn.unavailable {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}


/* -------------------------------------------------------------------
   Slot Calendar (Fullscreen Availability Picker)
   ------------------------------------------------------------------- */

.crm-modal-fullscreen .crm-modal-box {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.slot-calendar-info {
    font-size: 13px;
    padding: 0.5rem 0;
    line-height: 1.6;
}

.slot-calendar-info p {
    margin: 0.15rem 0;
}

.slot-calendar-legend {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 12px;
    flex-wrap: wrap;
}

.slot-calendar-legend .legend-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 3px;
    vertical-align: middle;
    margin-right: 4px;
}

.slot-calendar-legend .legend-dot.free {
    background: var(--crm-success, #22c55e);
}

.slot-calendar-legend .legend-dot.partial {
    background: var(--crm-warning, #f59e0b);
}

.slot-calendar-legend .legend-dot.blocked {
    background: var(--crm-neutral-200, #e5e7eb);
}

.slot-calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

.slot-calendar-nav span {
    font-weight: 600;
    font-size: 14px;
    flex: 1;
    text-align: center;
}

.slot-calendar-loading {
    text-align: center;
    padding: 2rem;
    color: var(--crm-text-muted);
}

/* Grid layout */
.slot-calendar-grid {
    display: grid;
    grid-template-columns: 60px repeat(var(--slot-days, 5), 1fr);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    overflow: hidden;
}

.slot-header-row {
    display: contents;
}

.slot-day-header {
    padding: 0.5rem 0.25rem;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    background: var(--crm-surface-2);
    border-bottom: 2px solid var(--crm-border);
    border-left: 1px solid var(--crm-border);
}

.slot-day-header:first-child {
    border-left: none;
}

.slot-day-header.today {
    color: var(--crm-primary-text, var(--crm-primary));
    background: rgba(37, 99, 235, 0.06);
}

.slot-day-header small {
    font-weight: 400;
    color: var(--crm-text-muted);
}

.slot-time-header {
    padding: 0.5rem 0.25rem;
    background: var(--crm-surface-2);
    border-bottom: 2px solid var(--crm-border);
}

.slot-row {
    display: contents;
}

.slot-time {
    padding: 0.3rem 0.4rem;
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-align: right;
    border-bottom: 1px solid var(--crm-border);
    background: var(--crm-surface);
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.slot-cell {
    border-bottom: 1px solid var(--crm-border);
    border-left: 1px solid var(--crm-border);
    min-height: 28px;
    transition: background-color 0.15s;
}

/* Slot states */
.slot-cell.slot-free {
    background: rgba(34, 197, 94, 0.12);
    cursor: pointer;
}

.slot-cell.slot-free:hover {
    background: rgba(34, 197, 94, 0.3);
}

.slot-cell.slot-partial {
    background: rgba(245, 158, 11, 0.15);
    cursor: pointer;
}

.slot-cell.slot-partial:hover {
    background: rgba(245, 158, 11, 0.3);
}

.slot-cell.slot-blocked {
    background: var(--crm-neutral-100, #f3f4f6);
    cursor: not-allowed;
}

.slot-cell.slot-past {
    background: var(--crm-neutral-50, #f9fafb);
    cursor: not-allowed;
    opacity: 0.5;
}

.slot-cell.slot-outside-hours {
    background: repeating-linear-gradient(
        -45deg,
        var(--crm-neutral-50, #f9fafb),
        var(--crm-neutral-50, #f9fafb) 3px,
        var(--crm-neutral-100, #f3f4f6) 3px,
        var(--crm-neutral-100, #f3f4f6) 6px
    );
    cursor: not-allowed;
}


/* -------------------------------------------------------------------
   Bundle Preview
   ------------------------------------------------------------------- */

.crm-cal-bundle-preview {
    background: var(--crm-surface-2);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 13px;
}

.crm-cal-bundle-preview-title {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.crm-cal-bundle-preview-item {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    font-size: 12px;
}


/* -------------------------------------------------------------------
   Appointment Detail View
   ------------------------------------------------------------------- */

.crm-cal-appt-detail {
    padding: 1rem;
}

.crm-cal-appt-status {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
}

.crm-cal-appt-status--confirmed {
    background: #dcfce7;
    color: #166534;
}

.crm-cal-appt-status--unconfirmed {
    background: #fef3c7;
    color: #92400e;
}

.crm-cal-appt-status--cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.crm-cal-appt-status--completed {
    background: #e0e7ff;
    color: #3730a3;
}

.crm-cal-appt-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.crm-cal-appt-detail-row {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--crm-border);
    font-size: 14px;
}

.crm-cal-appt-detail-row:last-child {
    border-bottom: none;
}

.crm-cal-appt-detail-label {
    min-width: 120px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--crm-text-muted);
}


/* -------------------------------------------------------------------
   FullCalendar v6 Overrides
   ------------------------------------------------------------------- */

/* Container */
.crm-cal-grid .fc {
    font-family: inherit;
    font-size: 13px;
}

/* Time axis */
.crm-cal-grid .fc .fc-timegrid-slot {
    height: 2.5em;
}

.crm-cal-grid .fc .fc-timegrid-slot-label {
    font-size: 11px;
    color: var(--crm-text-muted);
    vertical-align: top;
    padding-top: 2px;
}

/* Day headers */
.crm-cal-grid .fc .fc-col-header-cell {
    padding: 0.5rem 0;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--crm-text-muted);
    background: var(--crm-surface-2);
    border-color: var(--crm-border);
}
.crm-cal-grid .fc .fc-col-header-cell a,
.crm-cal-grid .fc .fc-col-header-cell-cushion {
    color: var(--crm-text-muted) !important;
    text-decoration: none;
}

.crm-cal-grid .fc .fc-col-header-cell.fc-day-today .fc-col-header-cell-cushion,
.crm-cal-grid .fc .fc-col-header-cell.fc-day-today a,
.crm-cal-grid .fc th.fc-day-today .fc-col-header-cell-cushion,
.crm-cal-grid .fc th.fc-day-today a {
    color: var(--crm-primary-text, var(--crm-primary)) !important;
    font-weight: 700;
}

/* Today column highlight */
.crm-cal-grid .fc .fc-day-today {
    background: rgba(37, 99, 235, 0.03) !important;
}

/* Past days: dimmed column header + background */
.crm-cal-grid .fc .fc-col-header-cell.fc-day-past .fc-col-header-cell-cushion {
    opacity: .5;
}
.crm-cal-grid .fc .fc-timegrid-col.fc-day-past {
    background: #f8f9fa;
}
.crm-cal-grid .fc .fc-timegrid-col.fc-day-past .fc-event {
    opacity: .65;
    filter: grayscale(20%);
}

/* Now indicator */
.crm-cal-grid .fc .fc-timegrid-now-indicator-line {
    border-color: var(--crm-danger, #ef4444);
    border-width: 2px;
}

.crm-cal-grid .fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--crm-danger, #ef4444);
}

/* Time slots — clickable for new appointments */
.crm-cal-grid .fc .fc-timegrid-col-events {
    margin-right: 12px; /* leave clickable margin beside events */
}

.crm-cal-grid .fc .fc-timegrid-col:not(.fc-timegrid-axis) {
    cursor: cell;
}

/* Events */
.crm-cal-grid .fc .fc-event {
    border-radius: 4px;
    border: none;
    border-left: 3px solid;
    cursor: pointer;
    font-size: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    transition: box-shadow 0.15s ease;
    color: inherit; /* override global a{color:--crm-primary} — use FC inline textColor */
    overflow: hidden; /* verhindert Raum/Text-Überlauf in benachbarte Slots */
}

.crm-cal-grid .fc .fc-event:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.22);
    z-index: 10 !important;
    /* kein translateY — wuerde Event in vorherigen Slot ragen */
}

/* Event inner content */
.fc-event-inner {
    padding: 2px 4px;
    overflow: hidden;
    line-height: 1.3;
}

/* Spezifitaet 0-1-0 reicht nicht gegen FC-Bundle (.fc-timegrid-event .fc-event-time = 0-2-0) */
.crm-cal-grid .fc .fc-event .fc-event-time {
    font-size: 10px;
    opacity: 0.85;
    font-weight: 600;
}

/* Explizite Groesse verhindert optisch vergroesserte Schrift bei full-width Events */
.crm-cal-grid .fc .fc-event .fc-event-title {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-event-room {
    font-size: 10px;
    opacity: 0.7;
}

.fc-event-status {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 10px;
}

/* Status modifiers */
.fc-event--cancelled {
    opacity: 0.45;
    text-decoration: line-through;
}

.fc-event--pending {
    border-left-style: dashed !important;
    animation: fc-pulse 2s ease-in-out infinite;
}

@keyframes fc-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.fc-event--blocked {
    background: repeating-linear-gradient(
        -45deg,
        var(--crm-neutral-200, #e5e7eb),
        var(--crm-neutral-200, #e5e7eb) 4px,
        var(--crm-neutral-100, #f3f4f6) 4px,
        var(--crm-neutral-100, #f3f4f6) 8px
    ) !important;
    border-left-color: var(--crm-neutral-400, #9ca3af) !important;
}

.fc-event--completed {
    opacity: 0.7;
}

/* Bundle-Termin ohne Therapeut (z.B. Fango) */
.fc-event--no-staff {
    border-style: dashed !important;
    border-width: 2px !important;
    opacity: 0.9;
}

.fc-event--noshow {
    opacity: 0.5;
    border-left-color: var(--crm-danger, #ef4444) !important;
}

/* ===== Overflow Badge (+X) ===== */
.fc-overflow-badge {
    position: absolute;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 200;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: all;
}
.fc-overflow-badge:hover {
    background: rgba(0,0,0,.7);
}

/* ===== Calendar Tooltip ===== */
.fc-tooltip {
    display: none;
    position: absolute;
    z-index: 9999;
    width: 220px;
    background: #1e293b;
    color: #f1f5f9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    pointer-events: auto;
}
.fc-tooltip-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    margin-bottom: 4px;
}
.fc-tooltip-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #fff;
    flex: 1;
}
.fc-tooltip-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    flex-shrink: 0;
}
.fc-tooltip-close:hover { color: #fff; }
.fc-tooltip-row {
    color: #cbd5e1;
}
.fc-tooltip-notes {
    margin-top: 4px;
    color: #94a3b8;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc-tooltip-link {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 4px 8px;
    background: rgba(255,255,255,.1);
    border: none;
    border-radius: 4px;
    color: #93c5fd;
    font-size: 0.78rem;
    cursor: pointer;
    text-align: left;
}
.fc-tooltip-link:hover {
    background: rgba(255,255,255,.2);
}

.fc-event--patient-unconfirmed {
    border-left-style: dotted !important;
}

/* Month view events */
.crm-cal-grid .fc .fc-daygrid-event {
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 11px;
    margin-bottom: 1px;
    border-left: 3px solid;
    white-space: nowrap;
    overflow: hidden;
    color: inherit; /* override global a{color:--crm-primary} */
}

/* Ensure dot-style events also show background */
.crm-cal-grid .fc .fc-daygrid-dot-event {
    background: inherit;
    color: inherit;
}

.crm-cal-grid .fc .fc-daygrid-dot-event .fc-event-title {
    font-weight: 600;
}

/* Selection mirror */
.crm-cal-grid .fc .fc-highlight {
    background: rgba(37, 99, 235, 0.1);
}

/* Borders */
.crm-cal-grid .fc td,
.crm-cal-grid .fc th {
    border-color: var(--crm-border);
}

/* Business hours */
.crm-cal-grid .fc .fc-non-business {
    background: var(--crm-surface-2);
}

/* Scrollbar */
.crm-cal-grid .fc .fc-scroller {
    scrollbar-width: thin;
}

/* DayGrid month day cells */
.crm-cal-grid .fc .fc-daygrid-day-number {
    font-size: 13px;
    padding: 4px 8px;
    color: var(--text-primary, #1e293b);
}

.crm-cal-grid .fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
    background: var(--crm-primary);
    color: var(--crm-on-primary, #fff);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Filter bar spacing */
.crm-cal-filter-bar {
    margin-bottom: 0.75rem;
}


/* -------------------------------------------------------------------
   Appointment List (non-calendar)
   ------------------------------------------------------------------- */

.crm-appt-list-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--crm-border);
}

.crm-appt-list-item:last-child {
    border-bottom: none;
}

.crm-appt-list-time {
    min-width: 90px;
    font-size: 13px;
    font-weight: 700;
    color: var(--crm-primary-text, var(--crm-primary));
    flex-shrink: 0;
}

.crm-appt-list-info {
    flex: 1;
    min-width: 0;
}

.crm-appt-list-name {
    font-size: 14px;
    font-weight: 700;
}

.crm-appt-list-meta {
    font-size: 12px;
    color: var(--crm-text-muted);
}

.crm-appt-list-status {
    font-size: 11px;
}


/* -------------------------------------------------------------------
   Patient Frequency Info
   ------------------------------------------------------------------- */

.crm-frequency-info {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--crm-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 13px;
    color: #166534;
}

.crm-frequency-overdue {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}


/* -------------------------------------------------------------------
   Current Time Indicator
   ------------------------------------------------------------------- */

.crm-cal-now-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--crm-danger);
    z-index: 5;
    pointer-events: none;
}

.crm-cal-now-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    background: var(--crm-danger);
    border-radius: 50%;
}


/* -------------------------------------------------------------------
   Drag & Drop Indicators
   ------------------------------------------------------------------- */

.crm-cal-drag-ghost {
    opacity: 0.6;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
    z-index: 10;
}

.crm-cal-drop-target {
    background: var(--crm-primary-light) !important;
    outline: 2px dashed var(--crm-primary);
    outline-offset: -2px;
}


/* -------------------------------------------------------------------
   Toast Animations + Undo-Toast
   ------------------------------------------------------------------- */

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.crm-toast-out {
    animation: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.crm-toast--undo {
    border-left-color: var(--crm-warning, #f59e0b);
    align-items: center;
    gap: 0.5rem;
}

.crm-toast-msg {
    flex: 1;
    font-size: 13px;
}

.crm-toast-undo-btn {
    background: var(--crm-warning, #f59e0b);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.crm-toast-undo-btn:hover {
    filter: brightness(0.9);
}

.crm-toast-countdown {
    font-size: 11px;
    color: var(--crm-text-muted);
    min-width: 2.5ch;
    text-align: right;
}

/* -------------------------------------------------------------------
   Calendar Printing
   ------------------------------------------------------------------- */

@media print {
    .crm-header,
    .crm-bottom-nav,
    .crm-fab-container,
    .crm-cal-controls,
    .crm-slide-menu,
    .crm-modal-overlay,
    .crm-toast-container {
        display: none !important;
    }

    .crm-main {
        padding: 0;
        max-width: none;
    }

    .crm-cal-grid {
        box-shadow: none;
        border: 1px solid #ccc;
    }

    .crm-cal-appointment {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .crm-panel {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}


/* ======================================================================
   RESPONSIVE BREAKPOINTS
   ====================================================================== */

@media (max-width: 640px) {
    /* Header */
    .crm-header {
        padding: 0 0.75rem;
    }

    .crm-nav {
        display: none;
    }

    .crm-header-user-name {
        display: none;
    }

    /* Bottom nav visible */
    .crm-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--crm-surface);
        border-top: 1px solid var(--crm-border);
        box-shadow: 0 -2px 8px rgba(0, 0, 0, .06);
        z-index: 200;
        height: 64px;
    }

    /* Main */
    .crm-main {
        padding: 1rem 0.75rem;
        padding-bottom: 80px;
    }

    /* FAB above bottom nav */
    .crm-fab-container {
        bottom: 80px;
    }

    /* Calendar mobile */
    .crm-cal-week {
        grid-template-columns: 40px repeat(7, 1fr);
    }

    .crm-cal-month-day {
        min-height: 60px;
    }

    .crm-cal-time-label {
        font-size: 10px;
        padding: 0.2rem;
    }

    .crm-cal-week-header-cell {
        font-size: 10px;
        padding: 0.35rem 0.15rem;
    }

    .crm-cal-appointment {
        font-size: 10px;
        padding: 1px 3px;
    }

    .crm-cal-month-appt {
        font-size: 9px;
    }

    /* Modal as bottom sheet */
    .crm-modal {
        align-items: flex-end;
    }

    .crm-modal-box {
        border-radius: var(--crm-radius) var(--crm-radius) 0 0;
        max-height: 90vh;
    }

    /* Settings stack */
    .crm-settings-grid {
        grid-template-columns: 1fr;
    }

    .crm-settings-sidebar {
        position: static;
    }

    /* Full-width inputs */
    .crm-input,
    .crm-select {
        width: 100%;
    }

    .crm-form-row {
        flex-direction: column;
        gap: 0;
    }

    .crm-management-grid {
        grid-template-columns: 1fr;
    }

    /* Page title smaller */
    .crm-page-title {
        font-size: 1.15rem;
    }

    /* Toolbar stacks */
    .crm-toolbar {
        gap: 0.5rem;
    }

    /* Status tabs scroll */
    .crm-status-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .crm-status-tabs::-webkit-scrollbar {
        display: none;
    }

    /* Cal nav stacks */
    .crm-cal-nav {
        gap: 0.5rem;
    }

    .crm-cal-therapist-legend {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.25rem;
    }

    .crm-cal-therapist-legend::-webkit-scrollbar {
        display: none;
    }

    /* Slot picker */
    .crm-cal-slot-grid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
    }

    /* Table responsive */
    .crm-table th,
    .crm-table td {
        padding: 0.5rem 0.65rem;
        font-size: 13px;
    }

    /* Checkbox grid single col */
    .crm-checkbox-grid {
        grid-template-columns: 1fr;
    }

    /* Stats grid */
    .crm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.65rem;
    }

    /* Pagination compact */
    .crm-pagination {
        gap: 0.25rem;
    }

    .crm-page-btn {
        padding: 0.3rem 0.55rem;
        font-size: 12px;
    }

    /* Day view time col */
    .crm-cal-day {
        grid-template-columns: 40px 1fr;
    }

    /* Appt detail */
    .crm-cal-appt-detail-row {
        flex-direction: column;
        gap: 0.2rem;
    }

    .crm-cal-appt-detail-label {
        min-width: auto;
    }

    /* Slide menu full-width on small screens */
    .crm-slide-menu {
        width: 100%;
    }
}

@media (min-width: 641px) {
    .crm-bottom-nav {
        display: none;
    }

    .crm-fab-container {
        bottom: 2rem;
    }
}

/* Tablet breakpoint */
@media (min-width: 641px) and (max-width: 1024px) {
    .crm-cal-month-day {
        min-height: 80px;
    }

    .crm-settings-grid {
        grid-template-columns: 200px 1fr;
    }

    .crm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* Animations + Utility Classes — aus utilities.css */

/* ============================
   Patient Records — Module Styles
   ============================ */

.info-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.5rem;
}

.info-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--crm-text-muted);
    margin-bottom: 0.2rem;
}

.info-value {
    font-weight: 500;
    color: var(--crm-text);
}

.treatment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--crm-border);
}

.treatment-item:hover {
    background: var(--crm-surface-2);
}

.treatment-item:last-child {
    border-bottom: none;
}

.treatment-info {
    flex: 1;
}

.treatment-date {
    font-weight: 600;
    color: var(--crm-text);
    margin-bottom: 0.15rem;
}

.treatment-details {
    font-size: 13px;
    color: var(--crm-text-muted);
}

.treatment-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.billed-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 13px;
    cursor: pointer;
}

.billed-checkbox input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
}

.note-item {
    padding: 0.75rem;
    background: var(--crm-surface-2);
    border-radius: var(--crm-radius);
    margin-bottom: 0.5rem;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.35rem;
}

.note-meta {
    font-size: 12px;
    color: var(--crm-text-muted);
}

.note-text {
    color: var(--crm-text);
    line-height: 1.6;
    font-size: 14px;
}

.note-delete {
    background: none;
    border: none;
    color: var(--crm-danger);
    cursor: pointer;
    font-size: 16px;
    padding: 0;
    line-height: 1;
}

.note-delete:hover {
    opacity: 0.7;
}

.freq-info {
    padding: 0.65rem 0.85rem;
    background: var(--crm-surface-2);
    border-radius: var(--crm-radius);
    font-size: 14px;
    margin-bottom: 0.75rem;
}

/* ============================
   Statistics — Module Styles
   ============================ */

/* --- Summary Cards --- */
.crm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: 1.25rem 1rem;
    text-align: center;
}

.stats-card-success { border-left: 3px solid var(--crm-success, #22c55e); }
.stats-card-warning { border-left: 3px solid var(--crm-warning, #f59e0b); }
.stats-card-danger  { border-left: 3px solid var(--crm-danger, #ef4444); }

.stats-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    color: var(--crm-text);
    font-variant-numeric: tabular-nums;
}

.stats-label {
    font-size: 12px;
    color: var(--crm-text-muted);
    margin-top: 0.35rem;
}

/* --- Patient Table --- */
.stats-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.stats-table thead {
    background: var(--crm-surface-2);
    position: sticky;
    top: 0;
    z-index: 1;
}

.stats-table th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 2px solid var(--crm-border);
}

.stats-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--crm-border);
    vertical-align: middle;
}

.stats-patient-row {
    cursor: pointer;
    transition: background 0.12s;
}

.stats-patient-row:hover {
    background: var(--crm-surface-2);
}

.stats-patient-row:last-child td {
    border-bottom: none;
}

.stats-patient-name {
    font-weight: 600;
}

.stats-patient-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
    white-space: nowrap;
}

.stats-td-name {
    white-space: nowrap;
}

.stats-td-num {
    text-align: center;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.stats-td-date {
    white-space: nowrap;
    color: var(--crm-text-muted);
    font-size: 13px;
}

.stats-num-success { color: var(--crm-success, #22c55e); font-weight: 600; }
.stats-num-warning { color: var(--crm-warning, #f59e0b); font-weight: 600; }
.stats-num-danger  { color: var(--crm-danger, #ef4444); font-weight: 600; }

.stats-th-icon {
    text-align: center;
    width: 50px;
}

.stats-th-date {
    width: 100px;
}

/* Mobile: Stats-Tabelle als Karten */
@media (max-width: 640px) {
    .stats-table thead { display: none; }
    .stats-table,
    .stats-table tbody { display: block; width: 100%; }
    .stats-patient-row {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem 0.75rem;
        padding: 0.75rem;
        border-bottom: 1px solid var(--crm-border);
    }
    .stats-patient-row td { border: none; padding: 0; }
    .stats-td-name {
        flex: 1 1 100%;
        white-space: normal;
        margin-bottom: 0.25rem;
    }
    .stats-td-name .stats-patient-badge {
        margin-left: 0.25rem;
    }
    .stats-td-num {
        font-size: 13px;
        text-align: left;
    }
    .stats-td-num::before {
        font-size: 11px;
        color: var(--crm-text-muted);
        margin-right: 2px;
    }
    .stats-num-success::before { content: "✓ "; }
    .stats-num-warning::before { content: "✗ "; }
    .stats-num-danger::before { content: "⊘ "; }
    .stats-td-date {
        margin-left: auto;
        font-size: 12px;
    }
}

/* --- Detail Modal --- */
.stats-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.75rem;
}

.stats-detail-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.stats-detail-row {
    display: flex;
    gap: 1rem;
    padding: 0.35rem 0;
    font-size: 13px;
    border-bottom: 1px solid var(--crm-border);
}

.stats-detail-row:last-child {
    border-bottom: none;
}

/* ============================
   Appointments Table
   ============================ */

.apt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.apt-table thead {
    background: var(--crm-surface-2);
}

.apt-table th {
    padding: 0.55rem 0.65rem;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--crm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    border-bottom: 2px solid var(--crm-border);
    white-space: nowrap;
}

.apt-table td {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--crm-border);
    vertical-align: middle;
}

.apt-row {
    cursor: pointer;
    transition: background 0.12s;
}

.apt-row:hover {
    background: var(--crm-surface-2);
}

.apt-row:last-child td {
    border-bottom: none;
}

.apt-td-color {
    width: 4px;
    padding: 0 !important;
}

.apt-color-bar {
    display: block;
    width: 4px;
    height: 100%;
    min-height: 28px;
    background: var(--apt-color, #888);
    border-radius: 2px;
}

.apt-td-patient {
    white-space: nowrap;
}

.apt-patient-name {
    font-weight: 600;
}

.apt-td-date,
.apt-td-time,
.apt-td-duration {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--crm-text-muted);
}

.apt-td-time {
    font-weight: 600;
    color: var(--crm-text);
}

.apt-td-therapist,
.apt-td-room {
    white-space: nowrap;
}

.apt-th-status {
    width: 4px;
    padding: 0 !important;
}

.apt-th-actions {
    text-align: right;
}

.apt-td-actions {
    text-align: right;
    white-space: nowrap;
}

.apt-td-actions .crm-btn-xs {
    padding: 3px 6px;
    font-size: 0;
    line-height: 1;
    border-radius: 4px;
}

/* Status badges */
.apt-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.apt-status-confirmed {
    background: #dcfce7;
    color: #166534;
}

.apt-status-pending {
    background: #fef3c7;
    color: #92400e;
}

.apt-status-done {
    background: #dbeafe;
    color: #1e40af;
}

.apt-status-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.apt-status-noshow {
    background: #fde68a;
    color: #78350f;
}

/* Responsive: horizontal scroll on small screens */
@media (max-width: 768px) {
    .apt-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ============================
   Calendar Additional Styles
   ============================ */

.patient-unconfirmed-badge {
    display: inline-flex;
    align-items: center;
    color: var(--crm-warning);
    margin-left: 4px;
}

/* Dropdown (hamburger user-switch etc.) */
.dropdown.active,
.crm-actions-dropdown.active {
    display: block;
}

/* Quick nav buttons (patient record tabs) */
.quick-nav-btn.active {
    background: var(--crm-primary);
    color: var(--crm-on-primary, #fff);
    border-color: var(--crm-primary);
}

/* Filter pills */
.filter-pill.active {
    background: var(--crm-primary);
    color: var(--crm-on-primary, #fff);
    border-color: var(--crm-primary);
}

/* ============================
   Progress Bar + Utilities
   ============================ */

.crm-progress-bar {
    height: 6px;
    background: var(--crm-border);
    border-radius: 3px;
    overflow: hidden;
}
.crm-progress-bar > div {
    height: 100%;
    background: var(--crm-primary);
    border-radius: 3px;
    transition: width .3s;
}
.crm-text-muted {
    color: var(--crm-text-muted);
    font-size: 13px;
}
.crm-card {
    background: var(--crm-surface);
    border: 1px solid var(--crm-border);
    border-radius: var(--crm-radius);
    padding: .75rem;
}


/* -------------------------------------------------------------------
   Stammdaten / Management Lists
   ------------------------------------------------------------------- */

.crm-btn-xs {
    padding: .2rem .4rem;
    font-size: 12px;
    line-height: 1;
    border-radius: 4px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--crm-border);
    gap: .5rem;
    font-size: 14px;
}
.list-item:last-child {
    border-bottom: none;
}
.list-item:hover {
    background: var(--crm-surface-hover, #f8fafc);
}
.list-item > span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.therapist-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex: 1;
    min-width: 0;
}
.therapist-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}
.list-actions {
    display: flex;
    gap: .25rem;
    flex-shrink: 0;
}
.list-actions .crm-btn {
    padding: .25rem .4rem;
    font-size: 12px;
    line-height: 1;
}
.badge-blacklist {
    background: var(--crm-danger, #ef4444);
    color: #fff;
    font-size: 11px;
    padding: .1rem .4rem;
    border-radius: 4px;
    margin-left: .5rem;
}
.patient-blacklisted {
    opacity: .6;
}
.add-btn {
    font-size: 12px !important;
    margin-left: .5rem;
}


/* -------------------------------------------------------------------
   Team View — Acting Bar, PIN Modal, Team Mode
   ------------------------------------------------------------------- */

/* Hide nav for team mode */
body.team-mode .crm-nav,
body.team-mode .crm-bottom-nav,
body.team-mode .crm-header-user-name {
    display: none;
}

/* Acting bar — sticky top bar showing who is authenticated */
.team-acting-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .4rem 1rem;
    background: var(--crm-primary, #2563eb);
    color: var(--crm-on-primary, #fff);
    font-size: 13px;
    position: sticky;
    top: 0;
    z-index: 90;
}
.team-acting-bar strong {
    font-weight: 600;
}
.team-acting-bar .crm-btn {
    color: var(--crm-on-primary, #fff);
    border-color: color-mix(in srgb, var(--crm-on-primary, #fff) 40%, transparent);
    font-size: 12px;
    padding: .2rem .5rem;
    margin-left: auto;
}
.team-acting-bar .crm-btn:hover {
    background: rgba(255,255,255,.15);
}

/* Timeout countdown badge */
.team-timeout-badge {
    font-variant-numeric: tabular-nums;
    opacity: .85;
    font-size: 12px;
}

/* PIN input — larger for tablet */
.team-pin-input {
    font-size: 24px !important;
    text-align: center;
    letter-spacing: .3em;
    padding: .6rem !important;
}

/* ============= COMMUNICATION SETTINGS ============= */

/* Channel cards (toggle row) */
.crm-channel-grid {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.crm-channel-card {
    border: 1px solid var(--crm-border, #e2e8f0);
    border-radius: var(--crm-radius, 8px);
    padding: .75rem 1rem;
    background: var(--crm-surface, #fff);
    transition: border-color .15s;
}
.crm-channel-card:hover {
    border-color: var(--crm-primary, #2563eb);
}
.crm-channel-header {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.crm-channel-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--crm-surface-2, #f1f5f9);
    color: var(--crm-text-muted, #64748b);
    flex-shrink: 0;
}
.crm-channel-info {
    flex: 1;
    min-width: 0;
}
.crm-channel-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--crm-text, #1e293b);
}
.crm-channel-info .crm-form-hint {
    margin-top: 0;
}

/* Status pill (inline in panel header) */
.crm-status-pill {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .6rem;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 500;
    background: var(--crm-surface-2, #f1f5f9);
    color: var(--crm-text-muted, #64748b);
    margin-left: auto;
}
.crm-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--crm-text-muted, #94a3b8);
    flex-shrink: 0;
}
.crm-status-pill.is-ok .crm-status-dot { background: #22c55e; }
.crm-status-pill.is-ok { background: #dcfce7; color: #166534; }
.crm-status-pill.is-error .crm-status-dot { background: #ef4444; }
.crm-status-pill.is-error { background: #fee2e2; color: #991b1b; }
.crm-status-pill.is-warning .crm-status-dot { background: #f59e0b; }
.crm-status-pill.is-warning { background: #fef3c7; color: #92400e; }
.crm-status-pill.is-info .crm-status-dot { background: #3b82f6; }
.crm-status-pill.is-info { background: #dbeafe; color: #1e40af; }

/* Feedback category pills */
.feedback-cat-pill { cursor: pointer; border: 2px solid transparent; transition: border-color .15s; }
.feedback-cat-pill.is-active { border-color: var(--crm-primary, #3b82f6); font-weight: 600; }
.feedback-cat-pill:hover { opacity: .85; }

/* Form error message */
.crm-form-error {
    color: #dc2626;
    font-size: .85rem;
    margin-top: .5rem;
    padding: .5rem .75rem;
    background: #fef2f2;
    border-radius: 6px;
}

/* Form divider */
.crm-form-divider {
    border-top: 1px solid var(--crm-border, #e2e8f0);
    margin: .5rem 0 .85rem;
}

/* Button group */
.crm-btn-group {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin-top: .25rem;
}

/* ============= BADGES ============= */
.crm-badge {
    display: inline-block;
    padding: .15em .5em;
    border-radius: var(--radius-sm, 4px);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}
.crm-badge-sm { font-size: .7rem; padding: .1em .4em; }
.crm-badge--success { background: #dcfce7; color: #166534; }
.crm-badge--danger  { background: #fee2e2; color: #991b1b; }
.crm-badge--warning { background: #fef3c7; color: #92400e; }
.crm-badge--info    { background: #dbeafe; color: #1e40af; }
.crm-badge--neutral { background: #f1f5f9; color: #475569; }

/* ============= AUDIT LOG TABLE ============= */
.crm-audit-log-list .crm-table { border-collapse: collapse; }
.crm-audit-log-list .crm-table th {
    text-align: left;
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    padding: .4rem .5rem;
    border-bottom: 2px solid var(--border-color, #e2e8f0);
}
.crm-audit-log-list .crm-table td {
    padding: .35rem .5rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    vertical-align: middle;
}

/* ============= ERSCHEINUNGSBILD — Upload Cards ============= */
.crm-upload-row {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.crm-upload-card {
    flex: 1;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--crm-radius, 8px);
    padding: 1rem;
    background: var(--crm-surface, #fff);
}
.crm-upload-card--small {
    flex: 0 0 180px;
}
.crm-upload-card h4 {
    margin: 0 0 .75rem;
    font-size: .875rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}
.crm-upload-box {
    text-align: center;
}
.crm-upload-preview {
    width: 100%;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--crm-bg, #f8fafc);
    border: 1px dashed var(--border-color, #e2e8f0);
    border-radius: var(--crm-radius, 8px);
    overflow: hidden;
    margin-bottom: .75rem;
}
.crm-upload-preview img {
    max-width: 100%;
    max-height: 120px;
    object-fit: contain;
}
.crm-upload-preview--icon {
    min-height: 80px;
    width: 80px;
    margin: 0 auto .75rem;
}
.crm-upload-preview--icon img {
    max-width: 48px;
    max-height: 48px;
}
.crm-upload-empty {
    color: var(--text-muted, #94a3b8);
    font-size: .8rem;
    padding: 1rem;
}
.crm-upload-empty .icon {
    display: block;
    margin: 0 auto .25rem;
    opacity: .5;
}
.crm-upload-actions {
    display: flex;
    gap: .5rem;
    justify-content: center;
}
.crm-upload-actions .crm-btn {
    font-size: .8rem;
    padding: .35rem .75rem;
}

/* ============= ERSCHEINUNGSBILD — Color Picker ============= */
.crm-color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}
.crm-color-input-group label {
    display: block;
    font-size: .8rem;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
    margin-bottom: .35rem;
}
.crm-color-picker {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.crm-color-picker input[type="color"] {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--crm-radius, 8px);
    padding: 2px;
    cursor: pointer;
    background: none;
}
.crm-color-hex {
    width: 90px;
    font-family: 'JetBrains Mono', monospace;
    font-size: .85rem;
}

/* ============= ERSCHEINUNGSBILD — Branding Preview ============= */
.crm-branding-preview {
    margin-top: 1rem;
    border: 1px solid var(--border-color, #e2e8f0);
    border-radius: var(--crm-radius, 8px);
    overflow: hidden;
}
.crm-preview-navbar {
    padding: .6rem 1rem;
    color: #fff;
    font-size: .85rem;
    font-weight: 600;
}
.crm-preview-buttons {
    padding: .75rem 1rem;
    display: flex;
    gap: .5rem;
    background: var(--crm-bg, #f8fafc);
}

/* ============= ERSCHEINUNGSBILD — Labels / Bezeichnungen ============= */
.crm-info-box {
    display: flex;
    align-items: flex-start;
    gap: .75rem;
    padding: .75rem 1rem;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--crm-radius, 8px);
    font-size: .85rem;
    color: #1e40af;
    line-height: 1.4;
}
.crm-info-box .icon {
    flex-shrink: 0;
    margin-top: 2px;
}
.crm-labels-current {
    margin-bottom: 1rem;
}
.crm-labels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: .75rem;
}

/* ============= Responsive — Upload Cards ============= */
@media (max-width: 600px) {
    .crm-upload-row {
        flex-direction: column;
    }
    .crm-upload-card--small {
        flex: auto;
    }
    .crm-upload-preview--icon {
        margin: 0 auto .75rem;
    }
    .crm-color-grid {
        grid-template-columns: 1fr;
    }
    .crm-labels-grid {
        grid-template-columns: 1fr;
    }
}


/* ======================================================================
   LEGACY BRIDGE — portiert aus style.css, noch nicht auf crm-* umbenannt
   Wird schrittweise durch CRM-Klassen ersetzt
   ====================================================================== */

/* --- Tabs (booking type toggle, patient records) --- */
.tab-btn {
    padding: 0.5rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 1rem;
    color: var(--crm-text-muted, #6b7280);
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--crm-primary); }
.tab-btn.active {
    color: var(--crm-primary);
    border-bottom-color: var(--crm-primary);
    font-weight: 600;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Day/Week View Appointments --- */
.day-appointment {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--crm-radius, 6px);
    color: #fff;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}
.day-appointment:hover {
    transform: translateX(2px);
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.day-appointment.blocked {
    opacity: 0.7;
    background: repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(0,0,0,0.1) 5px, rgba(0,0,0,0.1) 10px) !important;
}
.day-appointment.filter-dimmed { opacity: 0.25; }
.day-appointment.has-prep { position: relative; }
.day-apt-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.day-apt-details { font-size: 0.8rem; opacity: 0.9; white-space: nowrap; }
.day-apt-status { font-size: 0.85rem; margin-left: auto; white-space: nowrap; }

/* --- Dropdown (impersonation menu) --- */
.dropdown-section {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--crm-border, #e5e7eb);
}
.dropdown-section:last-child { border-bottom: none; }
.dropdown-label {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--crm-text-muted, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.dropdown-item {
    display: block;
    padding: 0.375rem 0.75rem;
    color: var(--crm-text, #374151);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.15s;
}
.dropdown-item:hover {
    background: var(--crm-surface-2, #f3f4f6);
    color: var(--crm-text, #111827);
}

/* --- Hamburger Off-Canvas Menu --- */
.hamburger-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--crm-text-muted, #6b7280);
    cursor: pointer;
    padding: 0.375rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}
.hamburger-btn:hover { color: var(--crm-primary); }
.hamburger-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}
.hamburger-overlay.active { opacity: 1; visibility: visible; }
.hamburger-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: 100%;
    background: var(--crm-surface, #fff);
    z-index: 1001;
    box-shadow: -4px 0 24px rgba(0,0,0,.12);
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}
.hamburger-menu.active { right: 0; }
.menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--crm-border, #e5e7eb);
    background: var(--crm-surface-2, #f9fafb);
}

/* --- Slot Picker (selected slot display) --- */
.selected-slot-display {
    flex: 1;
    padding: 0.375rem 0.75rem;
    background: var(--crm-surface-2, #f9fafb);
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 6px);
    min-height: 40px;
    display: flex;
    align-items: center;
}
.selected-slot-display .slot-placeholder {
    color: var(--crm-text-muted, #9ca3af);
    font-style: italic;
}
.selected-slot-display.has-selection {
    background: #ecfdf5;
    border-color: #10b981;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}
.selected-slot-display .selected-slot-date { color: var(--crm-text); font-weight: 500; }
.selected-slot-display .selected-slot-time { color: #10b981; font-weight: 600; font-size: 1.1em; }

/* --- Color Presets (room color picker) --- */
.color-presets { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 0.375rem; }
.color-preset {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.color-preset:hover { transform: scale(1.15); box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.color-preset.selected {
    border-color: var(--crm-text, #111827);
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--crm-text-muted, #9ca3af);
}

/* --- Plugin Feedback --- */
.plugin-item.feedback-success { background: rgba(16, 185, 129, 0.1); }

/* --- Practice Hours --- */
.practice-hours-table tr.day-disabled { opacity: 0.5; }
.practice-hours-table tr.day-disabled .day-start-select,
.practice-hours-table tr.day-disabled .day-end-select {
    pointer-events: none;
    background: var(--crm-surface-2, #f3f4f6);
}

/* --- Therapist Legend (collapse/expand) --- */
.therapist-legend.expanded {
    max-height: 50px;
    padding: 0.375rem 0;
    margin-bottom: 0.375rem;
    opacity: 1;
}

/* --- Quick Nav & Filter Pills --- */
.quick-nav-btn {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 6px);
    background: var(--crm-surface, #fff);
    color: var(--crm-text-muted, #6b7280);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}
.quick-nav-btn.active {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
}
.filter-pill {
    padding: 0.25rem 0.75rem;
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: 999px;
    background: var(--crm-surface, #fff);
    color: var(--crm-text-muted, #6b7280);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.15s;
}
.filter-pill.active {
    background: var(--crm-primary);
    color: #fff;
    border-color: var(--crm-primary);
}

/* ── Notification Settings Modal ───────────────────────── */
.notif-channel-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.notif-channel-card {
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 0.5rem);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.notif-channel-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.notif-channel-icon { opacity: 0.6; display: flex; }
.notif-channel-status {
    font-size: 0.8rem;
    color: var(--crm-text-muted, #6b7280);
    margin: 0;
    min-height: 1.2em;
}
.notif-channel-actions { display: flex; gap: 0.5rem; }
.notif-channel-toggle { margin-top: 0.25rem; }

.notif-event-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
.notif-event-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 0.5rem);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.875rem;
}
.notif-event-item:hover { background: var(--crm-bg-hover, #f9fafb); }
.notif-event-item input[type="checkbox"] { accent-color: var(--crm-primary); }
.notif-event-icon { opacity: 0.5; display: flex; }

@media (max-width: 480px) {
    .notif-event-grid { grid-template-columns: 1fr; }
}

/* ── Appointment Cards (Patient View) ──────────────────── */
.crm-appointment-card {
    background: #fff;
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 0.5rem);
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.15s;
}
.crm-appointment-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.crm-appointment-card.is-past { opacity: 0.55; }
.crm-appointment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.crm-appointment-card-date { font-weight: 600; font-size: 0.95rem; }
.crm-appointment-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.25rem;
    font-size: 0.875rem;
    color: var(--crm-text-muted, #6b7280);
}
.crm-appointment-card-body > div { display: flex; align-items: center; gap: 0.35rem; }
.crm-appointment-card-notes {
    flex: 1 1 100%;
    font-style: italic;
    margin-top: 0.25rem;
}
.crm-appointment-card-actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    padding-top: .5rem;
    border-top: 1px solid var(--crm-border);
    margin-top: .25rem;
}
.crm-apt-pending-badge {
    font-size: .75rem;
    font-weight: 600;
    color: #92400e;
    background: #fef3c7;
    border-radius: 999px;
    padding: .15rem .6rem;
}
.crm-apt-confirmed-badge {
    font-size: .75rem;
    font-weight: 600;
    color: #16a34a;
    background: #dcfce7;
    border-radius: 999px;
    padding: .15rem .6rem;
}

/* ── Help Modal Sections ───────────────────────────────── */
.crm-help-section {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--crm-border, #e5e7eb);
    border-radius: var(--crm-radius, 0.5rem);
    margin-bottom: 0.75rem;
}
.crm-help-section h4 {
    margin: 0 0 0.35rem;
    font-size: 0.95rem;
}
.crm-help-section p {
    margin: 0 0 0.35rem;
    font-size: 0.85rem;
    color: var(--crm-text-muted, #6b7280);
    line-height: 1.5;
}
.crm-help-section p:last-child { margin-bottom: 0; }
.crm-help-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--crm-bg-hover, #f3f4f6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--crm-primary);
}

/* ── Slide Menu Legal Links ───────────────────────────── */
.crm-slide-menu-legal {
    padding: .75rem 1rem;
    margin-top: auto;
    border-top: 1px solid var(--crm-border, #e5e7eb);
    font-size: .75rem;
    color: var(--crm-text-muted, #94a3b8);
    text-align: center;
}
.crm-slide-menu-legal a {
    color: var(--crm-text-muted, #94a3b8);
    text-decoration: none;
}
.crm-slide-menu-legal a:hover {
    color: var(--crm-text, #1e293b);
    text-decoration: underline;
}
.crm-slide-menu-legal-sep {
    margin: 0 .4rem;
}

/* ── Privacy / Datenschutz Page ───────────────────────── */
.crm-privacy-content {
    font-size: .9rem;
    line-height: 1.7;
    color: var(--crm-text, #1e293b);
}
.crm-privacy-content h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 1.75rem 0 .5rem;
    color: var(--crm-text, #1e293b);
}
.crm-privacy-content h4 {
    font-size: .95rem;
    font-weight: 600;
    margin: 1.25rem 0 .4rem;
}
.crm-privacy-content p {
    margin: 0 0 .75rem;
}
.crm-privacy-content ul {
    margin: 0 0 .75rem 1.25rem;
    padding: 0;
}
.crm-privacy-content li {
    margin-bottom: .3rem;
}
.crm-privacy-content a {
    color: var(--crm-primary, #2563eb);
    text-decoration: none;
}
.crm-privacy-content a:hover {
    text-decoration: underline;
}
.crm-privacy-updated {
    font-size: .8rem;
    color: var(--crm-text-muted, #94a3b8);
    margin-bottom: 1.5rem;
}

/* ── GDPR Admin — Patient Search ─────────────────────── */
.crm-gdpr-search-item {
    display: flex;
    align-items: center;
    gap: .75rem;
    width: 100%;
    padding: .5rem .75rem;
    background: var(--crm-surface, #fff);
    border: 1px solid var(--crm-border, #e2e8f0);
    border-radius: var(--crm-radius, 6px);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    font-size: .875rem;
    transition: background .15s;
    margin-bottom: .25rem;
}
.crm-gdpr-search-item:hover {
    background: var(--crm-surface-2, #f8fafc);
}
.crm-gdpr-search-name {
    font-weight: 600;
}
.crm-gdpr-search-email {
    color: var(--crm-text-muted, #94a3b8);
    font-size: .8rem;
}
.crm-btn-warning {
    background: #f59e0b;
    color: #fff;
    border: none;
}
.crm-btn-warning:hover { filter: brightness(.9); }
.crm-btn-success {
    background: #10b981;
    color: #fff;
    border: none;
}
.crm-btn-success:hover { filter: brightness(.9); }
