/* ============================================================
   PTScheduler — Theme System & Layout
   ============================================================ */

/* --- Google Fonts: Inter --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ============================================================
   THEMES — CSS custom properties per theme
   ============================================================ */

:root, [data-theme="ocean"] {
    --c-primary:        #0284C7;
    --c-primary-hover:  #0369A1;
    --c-primary-active: #075985;
    --c-primary-light:  #E0F2FE;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(2, 132, 199, 0.20);
    --c-avatar-from:    #0284C7;
    --c-avatar-to:      #06B6D4;
}

[data-theme="forest"] {
    --c-primary:        #16A34A;
    --c-primary-hover:  #15803D;
    --c-primary-active: #166534;
    --c-primary-light:  #DCFCE7;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(22, 163, 74, 0.20);
    --c-avatar-from:    #16A34A;
    --c-avatar-to:      #10B981;
}

[data-theme="sunset"] {
    --c-primary:        #EA580C;
    --c-primary-hover:  #C2410C;
    --c-primary-active: #9A3412;
    --c-primary-light:  #FFEDD5;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(234, 88, 12, 0.20);
    --c-avatar-from:    #EA580C;
    --c-avatar-to:      #FBBF24;
}

[data-theme="crimson"] {
    --c-primary:        #DC2626;
    --c-primary-hover:  #B91C1C;
    --c-primary-active: #991B1B;
    --c-primary-light:  #FEE2E2;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(220, 38, 38, 0.20);
    --c-avatar-from:    #DC2626;
    --c-avatar-to:      #F97316;
}

[data-theme="lavender"] {
    --c-primary:        #9333EA;
    --c-primary-hover:  #7E22CE;
    --c-primary-active: #6B21A8;
    --c-primary-light:  #F3E8FF;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(147, 51, 234, 0.20);
    --c-avatar-from:    #9333EA;
    --c-avatar-to:      #EC4899;
}

[data-theme="slate"] {
    --c-primary:        #475569;
    --c-primary-hover:  #334155;
    --c-primary-active: #1E293B;
    --c-primary-light:  #F1F5F9;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(71, 85, 105, 0.20);
    --c-avatar-from:    #475569;
    --c-avatar-to:      #64748B;
}

[data-theme="rose"] {
    --c-primary:        #E11D48;
    --c-primary-hover:  #BE123C;
    --c-primary-active: #9F1239;
    --c-primary-light:  #FFE4E6;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(225, 29, 72, 0.20);
    --c-avatar-from:    #E11D48;
    --c-avatar-to:      #F43F5E;
}

[data-theme="teal"] {
    --c-primary:        #0D9488;
    --c-primary-hover:  #0F766E;
    --c-primary-active: #115E59;
    --c-primary-light:  #CCFBF1;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(13, 148, 136, 0.20);
    --c-avatar-from:    #0D9488;
    --c-avatar-to:      #06B6D4;
}

[data-theme="amber"] {
    --c-primary:        #D97706;
    --c-primary-hover:  #B45309;
    --c-primary-active: #92400E;
    --c-primary-light:  #FEF3C7;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(217, 119, 6, 0.20);
    --c-avatar-from:    #D97706;
    --c-avatar-to:      #F59E0B;
}

[data-theme="indigo"] {
    --c-primary:        #4F46E5;
    --c-primary-hover:  #4338CA;
    --c-primary-active: #3730A3;
    --c-primary-light:  #E0E7FF;
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(79, 70, 229, 0.20);
    --c-avatar-from:    #4F46E5;
    --c-avatar-to:      #7C3AED;
}

/* ============================================================
   SEMANTIC COLORS — status / severity (theme-independent)
   ============================================================ */

:root {
    --c-success:      #16A34A;
    --c-warning:      #D97706;
    --c-warning-text: #92400E;
    --c-warning-bg:   #FEF3C7;
    --c-danger:       #DC2626;
    --c-info:         #3B82F6;
    --c-muted:        #6B7280;
    --c-step-bg:      #E5E7EB;
}

[data-theme$="-dark"] {
    --c-success:      #22C55E;
    --c-warning:      #F59E0B;
    --c-warning-text: #FCD34D;
    --c-warning-bg:   rgba(217,119,6,.15);
    --c-danger:       #EF4444;
    --c-info:         #60A5FA;
    --c-muted:        #9CA3AF;
    --c-step-bg:      #374151;
}

/* ============================================================
   BASE RESET & TYPOGRAPHY
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

html {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #1F2937;
    background: #F8FAFC;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    min-height: 100%;
}

a {
    color: var(--c-primary);
    text-decoration: none;
}
a:hover {
    color: var(--c-primary-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; color: #111827; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }

/* ============================================================
   BOOTSTRAP OVERRIDES — Buttons
   ============================================================ */

.btn-primary {
    --bs-btn-bg:                 var(--c-primary);
    --bs-btn-border-color:       var(--c-primary);
    --bs-btn-hover-bg:           var(--c-primary-hover);
    --bs-btn-hover-border-color: var(--c-primary-hover);
    --bs-btn-active-bg:          var(--c-primary-active);
    --bs-btn-active-border-color:var(--c-primary-active);
    --bs-btn-color:              var(--c-primary-text);
    --bs-btn-hover-color:        var(--c-primary-text);
    --bs-btn-active-color:       var(--c-primary-text);
    --bs-btn-focus-shadow-rgb:   0,0,0;
    font-weight: 500;
    border-radius: 6px;
}

.btn-outline-primary {
    --bs-btn-color:              var(--c-primary);
    --bs-btn-border-color:       var(--c-primary);
    --bs-btn-hover-bg:           var(--c-primary);
    --bs-btn-hover-border-color: var(--c-primary);
    --bs-btn-hover-color:        var(--c-primary-text);
    --bs-btn-active-bg:          var(--c-primary-hover);
    --bs-btn-active-border-color:var(--c-primary-hover);
    --bs-btn-active-color:       var(--c-primary-text);
    font-weight: 500;
    border-radius: 6px;
}

.btn {
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    line-height: 1.5;
}

.btn:focus, .btn:active:focus {
    box-shadow: 0 0 0 3px var(--c-focus-ring);
}

/* ============================================================
   BOOTSTRAP OVERRIDES — Forms
   ============================================================ */

.form-control, .form-select {
    border-radius: 6px;
    border-color: #D1D5DB;
    font-size: 0.875rem;
    color: #1F2937;
}

.form-control:focus, .form-select:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 3px var(--c-focus-ring);
}

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.form-check-input:checked {
    background-color: var(--c-primary);
    border-color: var(--c-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--c-focus-ring);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: #9CA3AF;
}

.input-group-text {
    border-radius: 6px;
    background: #F9FAFB;
    border-color: #D1D5DB;
    color: #6B7280;
    font-size: 0.875rem;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid #16A34A; }
.invalid { outline: 1px solid #DC2626; }
.validation-message { color: #DC2626; font-size: 0.8125rem; }

/* ============================================================
   BOOTSTRAP OVERRIDES — Colors & Utilities
   ============================================================ */

.text-primary { color: var(--c-primary) !important; }
.bg-primary   { background-color: var(--c-primary) !important; }

.bg-primary-subtle   { background-color: var(--c-primary-light) !important; }
.text-primary-subtle { color: var(--c-primary) !important; }

/* Spinner */
.text-primary.spinner-border,
.spinner-border.text-primary { color: var(--c-primary) !important; }

/* Progress */
.progress { border-radius: 100px; background: #E5E7EB; }
.progress-bar { background-color: var(--c-primary); border-radius: 100px; }

/* ============================================================
   BOOTSTRAP OVERRIDES — Cards
   ============================================================ */

.card {
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    background: #ffffff;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #E5E7EB;
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.875rem 1rem;
    border-radius: 10px 10px 0 0 !important;
}

.card-body { padding: 1rem; }

/* ============================================================
   BOOTSTRAP OVERRIDES — Badges
   ============================================================ */

.badge {
    font-weight: 500;
    font-size: 0.7rem;
    border-radius: 100px;
    padding: 0.2em 0.6em;
}

.bg-primary.badge,
.badge.bg-primary {
    background-color: var(--c-primary) !important;
    color: var(--c-primary-text);
}

.badge.bg-primary-subtle {
    background-color: var(--c-primary-light) !important;
    color: var(--c-primary) !important;
}

/* ============================================================
   BOOTSTRAP OVERRIDES — Alerts
   ============================================================ */

.alert { border-radius: 8px; border: none; font-size: 0.875rem; }
.alert-warning { background: #FFFBEB; color: #92400E; }
.alert-success { background: #F0FDF4; color: #166534; }
.alert-danger  { background: #FFF1F2; color: #9F1239; }
.alert-info    { background: var(--c-primary-light); color: var(--c-primary-active); }

/* ============================================================
   BOOTSTRAP OVERRIDES — Modals
   ============================================================ */

.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    border-bottom: 1px solid #E5E7EB;
    padding: 1rem 1.25rem;
    border-radius: 12px 12px 0 0;
}

.modal-title { font-size: 1rem; font-weight: 600; }
.modal-body  { padding: 1.25rem; }

.modal-footer {
    border-top: 1px solid #E5E7EB;
    padding: 0.875rem 1.25rem;
}

/* ============================================================
   BOOTSTRAP OVERRIDES — Tables
   ============================================================ */

.table { font-size: 0.875rem; }
.table th {
    font-weight: 600;
    color: #6B7280;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #F9FAFB;
}
.table > :not(caption) > * > * { padding: 0.625rem 0.75rem; }
.table-hover > tbody > tr:hover > * { background: #F9FAFB; }

/* ============================================================
   LAYOUT — App Shell
   ============================================================ */

.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   LAYOUT — Sidebar
   ============================================================ */

.app-sidebar {
    width: 240px;
    background: #ffffff;
    border-right: 1px solid #E5E7EB;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: #E5E7EB transparent;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 1.125rem 1rem;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--c-primary);
    text-decoration: none !important;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
    min-height: 56px;
}

.sidebar-brand:hover { color: var(--c-primary-hover); }
.sidebar-brand img { height: 28px; width: auto; max-width: 120px; object-fit: contain; }

.sidebar-nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #9CA3AF;
    padding: 0.75rem 1rem 0.25rem;
}

.sidebar-divider {
    height: 1px;
    background: #F3F4F6;
    margin: 0.375rem 0.75rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.4375rem 0.75rem;
    color: #4B5563;
    text-decoration: none !important;
    border-radius: 7px;
    margin: 1px 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.1s, color 0.1s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link:hover {
    background: #F3F4F6;
    color: #111827;
}

.sidebar-link.active {
    background: var(--c-primary-light);
    color: var(--c-primary);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 0.9375rem;
    width: 1.125rem;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar-link.active i { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid #E5E7EB;
    padding: 0.75rem;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 7px;
    margin-bottom: 0.25rem;
    color: #374151;
    text-decoration: none !important;
    transition: background 0.1s;
    overflow: hidden;
}

.sidebar-user:hover { background: #F3F4F6; color: #111827; }

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-avatar-from), var(--c-avatar-to));
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.375rem 0.5rem;
    background: none;
    border: none;
    border-radius: 7px;
    color: #6B7280;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
    text-decoration: none !important;
}

.sidebar-logout:hover { background: #FEE2E2; color: #DC2626; }

/* ============================================================
   LAYOUT — Main Content
   ============================================================ */

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.app-topbar {
    height: 48px;
    background: #ffffff;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 1.5rem;
    gap: 0.75rem;
    flex-shrink: 0;
}

.app-topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #374151;
    text-decoration: none !important;
}

.app-topbar-user:hover { color: var(--c-primary); }

.app-content {
    flex: 1;
    padding: 1.5rem;
}

/* ============================================================
   LAYOUT — Mobile Bottom Nav
   ============================================================ */

.mobile-bottom-nav {
    display: none;
}

/* ============================================================
   LAYOUT — Mobile Bottom Sheet
   ============================================================ */

.mobile-sheet-backdrop,
.mobile-sheet {
    display: none;
}

/* ============================================================
   RESPONSIVE — Mobile
   ============================================================ */

@media (max-width: 767.98px) {
    .app-sidebar  { display: none !important; }
    .app-topbar   { display: none !important; }
    .app-content  {
        padding: 1rem;
        padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
    }
    .app-main { padding-top: env(safe-area-inset-top, 0px); }

    /* --- Bottom nav bar --- */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(64px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: #ffffff;
        border-top: 1px solid #E5E7EB;
        z-index: 200;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
        overflow-x: hidden;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 44px;
        gap: 3px;
        color: #9CA3AF;
        text-decoration: none !important;
        font-size: 0.62rem;
        font-weight: 600;
        letter-spacing: .01em;
        transition: color .15s;
        padding: 6px 0 4px;
        position: relative;
        background: none;
        border: none;
        cursor: pointer;
    }

    .mobile-nav-item i { font-size: 1.35rem; line-height: 1; }
    .mobile-nav-item span:not(.mobile-nav-indicator) { line-height: 1; }

    .mobile-nav-indicator {
        position: absolute;
        top: 0;
        width: 0;
        height: 2.5px;
        border-radius: 0 0 4px 4px;
        background: var(--c-primary);
        transition: width .2s ease;
    }

    .mobile-nav-item.active { color: var(--c-primary); }
    .mobile-nav-item.active .mobile-nav-indicator { width: 28px; }

    /* --- Bottom sheet --- */
    .mobile-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        z-index: 299;
        animation: sheetFadeIn .2s ease;
    }

    .mobile-sheet {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 85vh;
        background: var(--bs-body-bg, #fff);
        border-radius: 20px 20px 0 0;
        z-index: 300;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
        transform: translateY(100%);
        transition: transform .3s cubic-bezier(.32,.72,0,1);
        box-shadow: 0 -8px 40px rgba(0,0,0,.15);
    }
    .mobile-sheet.mobile-sheet-open {
        transform: translateY(0);
    }

    @keyframes sheetFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    .mobile-sheet-handle {
        display: flex;
        justify-content: center;
        padding: 12px 0 4px;
        cursor: pointer;
    }
    .mobile-sheet-handle span {
        width: 36px;
        height: 4px;
        border-radius: 4px;
        background: var(--bs-border-color, #D1D5DB);
    }

    .mobile-sheet-user {
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: .75rem 1.25rem 1rem;
    }

    .mobile-sheet-avatar {
        width: 44px;
        height: 44px;
        border-radius: 50%;
        background: var(--c-primary);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: .95rem;
        font-weight: 700;
        flex-shrink: 0;
        letter-spacing: .03em;
    }

    .mobile-sheet-theme-btn {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        border: 1px solid var(--bs-border-color, #E5E7EB);
        background: var(--bs-secondary-bg, #F3F4F6);
        color: var(--c-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        flex-shrink: 0;
        transition: background .15s;
    }
    .mobile-sheet-theme-btn:hover { background: var(--c-primary-light); }

    .mobile-sheet-section {
        padding: 0 1.25rem .75rem;
    }

    .mobile-sheet-label {
        font-size: .68rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .08em;
        color: var(--bs-secondary-color, #6B7280);
        padding: .5rem 0 .5rem;
    }

    .mobile-sheet-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .mobile-sheet-tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 6px;
        padding: 14px 4px 12px;
        border-radius: 14px;
        background: var(--bs-secondary-bg, #F3F4F6);
        color: var(--bs-body-color, #1F2937);
        text-decoration: none !important;
        font-size: .7rem;
        font-weight: 600;
        text-align: center;
        transition: background .12s, transform .1s;
        line-height: 1.2;
    }
    .mobile-sheet-tile i {
        font-size: 1.35rem;
        color: var(--c-primary);
    }
    .mobile-sheet-tile:hover {
        background: var(--c-primary-light);
        color: var(--bs-body-color, #1F2937);
    }
    .mobile-sheet-tile:active { transform: scale(.96); }

    .mobile-sheet-link {
        display: flex;
        align-items: center;
        gap: .65rem;
        padding: .7rem .5rem;
        font-size: .85rem;
        font-weight: 500;
        color: var(--bs-body-color, inherit);
        text-decoration: none !important;
        border-radius: 10px;
        transition: background .12s;
        border: none;
        background: none;
        width: 100%;
        text-align: left;
        cursor: pointer;
    }
    .mobile-sheet-link i:first-child { font-size: 1.05rem; color: var(--bs-secondary-color, #6B7280); flex-shrink: 0; }
    .mobile-sheet-link:hover { background: var(--bs-secondary-bg, rgba(0,0,0,.04)); color: var(--bs-body-color, inherit); }
    .mobile-sheet-link-danger { color: #DC2626 !important; }
    .mobile-sheet-link-danger i { color: #DC2626 !important; }

    /* --- Mobile: page headers, buttons, forms --- */
    .page-header { gap: 0.5rem; }
    .page-title { font-size: 1rem; }

    /* Prevent title + button overlap everywhere */
    h1, h2, h3, h4, h5 { overflow-wrap: break-word; word-break: break-word; }

    /* Shrink buttons on small screens */
    .btn { font-size: .8rem; }
    .btn-sm { font-size: .75rem; padding: .3rem .6rem; }
    .btn-group-sm > .btn { font-size: .72rem; padding: .25rem .5rem; }

    /* Cards: prevent internal overflow */
    .card-header.d-flex { flex-wrap: wrap; gap: .5rem; }
    .card-body { padding: .875rem; }

    /* Forms: search inputs full width on mobile */
    .form-control[style*="max-width"] { max-width: 100% !important; }
    .form-select.w-auto { max-width: 100%; }

    /* Stat cards responsive */
    .stat-card { padding: .75rem; gap: .5rem; }
    .stat-icon { width: 36px; height: 36px; font-size: .9rem; }
    .stat-value { font-size: 1.1rem; }
    .stat-label { font-size: .65rem; }

    /* Tables: force responsive scroll */
    .table { font-size: .78rem; }
    .table th, .table td { padding: .4rem .5rem; white-space: nowrap; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-responsive { margin: 0 -.875rem; padding: 0 .875rem; }

    /* Manage layout (admin panel) */
    .manage-header { padding: .875rem 1rem; gap: .75rem; flex-wrap: wrap; }
    .manage-card { padding: 1rem; }

    /* Modals: full-width on mobile */
    .modal-dialog { margin: .5rem; max-width: calc(100% - 1rem); }

    /* Calendar panel header */
    .cal-panel-header { flex-wrap: wrap; gap: .5rem; padding: .75rem 1rem; }
    .cal-topbar h4 { font-size: 1rem; }

    /* Alert bars with buttons inside */
    .alert.d-flex { flex-wrap: wrap; gap: .5rem; }

    /* Prevent horizontal page overflow */
    .app-content { overflow-x: hidden; }
    .row { margin-left: 0; margin-right: 0; }
}

/* ============================================================
   COMPONENTS — Avatars
   ============================================================ */

.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-avatar-from), var(--c-avatar-to));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.avatar-circle-lg {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-avatar-from), var(--c-avatar-to));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.75rem;
    flex-shrink: 0;
}

/* ============================================================
   COMPONENTS — Client Cards
   ============================================================ */

.client-card {
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
}

.client-card:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.10) !important;
    transform: translateY(-2px);
}

/* ============================================================
   COMPONENTS — Blazor Error & Loading
   ============================================================ */

.blazor-error-boundary {
    background: #FFF1F2;
    padding: 1rem 1rem 1rem 3.5rem;
    border-radius: 8px;
    color: #9F1239;
    font-size: 0.875rem;
}

.blazor-error-boundary::after { content: "Wystąpił nieoczekiwany błąd."; }

#blazor-error-ui {
    background: #1F2937;
    bottom: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.625rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-size: 0.875rem;
}

#blazor-error-ui .dismiss { cursor: pointer; float: right; }

/* ============================================================
   COMPONENTS — Page Headers
   ============================================================ */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
    min-width: 0;
}

/* ============================================================
   COMPONENTS — Stat Cards
   ============================================================ */

.stat-card {
    background: #ffffff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 9px;
    background: var(--c-primary-light);
    color: var(--c-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.stat-value { font-size: 1.5rem; font-weight: 700; color: #111827; line-height: 1.2; }
.stat-label { font-size: 0.75rem; color: #6B7280; font-weight: 500; }

/* ============================================================
   COMPONENTS — Theme Picker (Branding admin)
   ============================================================ */

.theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 0.625rem;
}

.theme-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 0.375rem;
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: transparent;
    width: 100%;
    font-size: 0.75rem;
    font-weight: 500;
    color: #4B5563;
}

.theme-swatch:hover { border-color: #D1D5DB; background: #F9FAFB; }

.theme-swatch.selected {
    border-color: var(--c-primary);
    background: var(--c-primary-light);
    color: var(--c-primary);
}

.theme-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ============================================================
   COMPONENTS — Upload Zone
   ============================================================ */

.upload-zone {
    border: 2px dashed #D1D5DB;
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
    background: #F9FAFB;
}

.upload-zone:hover {
    border-color: var(--c-primary);
    background: var(--c-primary-light);
}

.upload-zone input[type="file"] { display: none; }

/* ============================================================
   COMPONENTS — PWA Install Banner
   ============================================================ */

.pwa-banner {
    position: fixed;
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: min(480px, calc(100vw - 2rem));
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    z-index: 2000;
    animation: pwa-slide-up 0.25s ease-out;
}

@keyframes pwa-slide-up {
    from { opacity: 0; transform: translateX(-50%) translateY(16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-banner--ios {
    bottom: auto;
    top: max(12px, env(safe-area-inset-top, 12px));
    animation: pwa-slide-down 0.25s ease-out;
}

@keyframes pwa-slide-down {
    from { opacity: 0; transform: translateX(-50%) translateY(-16px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-banner-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
}

.pwa-banner-text { flex: 1; min-width: 0; }

.pwa-banner-title {
    font-weight: 700;
    font-size: 0.875rem;
    color: #111827;
    margin-bottom: 0.2rem;
}

.pwa-banner-body {
    font-size: 0.78rem;
    color: #6B7280;
    line-height: 1.45;
}

.pwa-banner-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.pwa-banner-close {
    color: #9CA3AF;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    text-decoration: none !important;
}

.pwa-banner-close:hover { color: #374151; }

[data-theme$="-dark"] .pwa-banner { background: #1E293B; border-color: #334155; box-shadow: 0 8px 32px rgba(0,0,0,.35); }
[data-theme$="-dark"] .pwa-banner-title { color: #F1F5F9; }
[data-theme$="-dark"] .pwa-banner-body { color: #94A3B8; }
[data-theme$="-dark"] .pwa-banner-close { color: #64748B; }
[data-theme$="-dark"] .pwa-banner-close:hover { color: #CBD5E1; }

.pwa-share-icon {
    display: inline-block;
    font-size: 1.1em;
    color: var(--c-primary);
    vertical-align: middle;
}

/* On desktop: banner sits in bottom-right corner (no bottom nav) */
@media (min-width: 768px) {
    .pwa-banner {
        left: auto;
        right: 1.5rem;
        bottom: 1.5rem;
        transform: none;
        animation: pwa-slide-right 0.25s ease-out;
    }
    @keyframes pwa-slide-right {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }
    .pwa-banner--ios {
        top: auto;
        bottom: 1.5rem;
        right: 1.5rem;
        animation: pwa-slide-right 0.25s ease-out;
    }
}

/* ============================================================
   MISC — NavLink active class compatibility
   ============================================================ */

/* Blazor NavLink adds class="active" — our sidebar-link.active handles it */
a.nav-link.active { /* kept for compat */ }

/* ============================================================
   ACCOUNT MANAGE LAYOUT
   ============================================================ */

.manage-shell { max-width: 860px; }
.admin-shell  { max-width: none; }

.manage-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
}

.manage-avatar {
    width: 64px; height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c-avatar-from), var(--c-avatar-to));
    color: #fff;
    font-weight: 700;
    font-size: 1.4rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    letter-spacing: -.02em;
}

.manage-user-name  { font-weight: 700; font-size: 1.05rem; line-height: 1.2; }
.manage-user-email { color: var(--bs-secondary-color); font-size: 0.875rem; }

.manage-body {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}

.manage-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 1rem;
}

.manage-nav { display: flex; flex-direction: column; gap: 2px; }

.manage-nav-section {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--bs-secondary-color);
    padding: .375rem .625rem .2rem;
}

.manage-nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.45rem 0.625rem;
    border-radius: 0.5rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all .13s ease;
}
.manage-nav-link:hover       { background: var(--bs-tertiary-bg); color: var(--bs-body-color); }
.manage-nav-link.active      { background: var(--c-primary-light); color: var(--c-primary); }
.manage-nav-link i           { font-size: 0.95rem; flex-shrink: 0; width: 1.1rem; text-align: center; }
.manage-nav-upgrade {
    background: linear-gradient(135deg, var(--c-primary-light), rgba(147,51,234,0.08));
    color: var(--c-primary);
    font-weight: 600;
    margin-bottom: 12px;
    border: 1px solid rgba(79,70,229,0.15);
}
.manage-nav-upgrade:hover {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

.manage-content { flex: 1; min-width: 0; }

.manage-card {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
}

@media (max-width: 767px) {
    .manage-body    { flex-direction: column; }
    .manage-sidebar { width: 100%; position: static; }
    .manage-nav     { flex-direction: row; flex-wrap: wrap; }
    .manage-nav-section { display: none; }
    .manage-nav-link { font-size: .8125rem; padding: .35rem .6rem; }
}

/* ============================================================
   HINT BUTTON
   ============================================================ */

.hint-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.hint-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem; height: 1rem;
    border-radius: 50%;
    border: 1.5px solid var(--bs-border-color);
    background: transparent;
    color: var(--bs-secondary-color);
    font-size: .6rem;
    font-weight: 800;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    transition: background .13s, color .13s, border-color .13s;
    vertical-align: middle;
}
.hint-btn:hover, .hint-btn-active {
    background: var(--c-primary);
    color: #fff;
    border-color: var(--c-primary);
}

.hint-pop {
    position: absolute;
    z-index: 1080;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 320px;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: .5rem;
    box-shadow: 0 6px 24px rgba(0,0,0,.13);
    padding: .7rem 1rem;
}
.hint-pop-right { left: auto; right: 0; transform: none; }
.hint-pop-left  { left: 0; transform: none; }

.hint-pop-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--c-primary);
    margin-bottom: .3rem;
}
.hint-pop-body {
    font-size: .77rem;
    line-height: 1.55;
    color: var(--bs-secondary-color);
}

/* ============================================================
   FULLCALENDAR — THEME OVERRIDES
   ============================================================ */

.fc {
    --fc-border-color:             var(--bs-border-color);
    --fc-page-bg-color:            var(--bs-body-bg);
    --fc-neutral-bg-color:         var(--bs-tertiary-bg);
    --fc-neutral-text-color:       var(--bs-secondary-color);
    --fc-button-text-color:        #fff;
    --fc-button-bg-color:          var(--c-primary);
    --fc-button-border-color:      var(--c-primary);
    --fc-button-hover-bg-color:    var(--c-primary-hover);
    --fc-button-hover-border-color:var(--c-primary-hover);
    --fc-button-active-bg-color:   var(--c-primary-hover);
    --fc-button-active-border-color:var(--c-primary-hover);
    --fc-today-bg-color:           color-mix(in srgb, var(--c-primary) 7%, transparent);
    --fc-now-indicator-color:      var(--c-primary);
    --fc-event-bg-color:           transparent;
    --fc-event-border-color:       transparent;
    --fc-event-text-color:         inherit;
    --fc-highlight-color:          color-mix(in srgb, var(--c-primary) 10%, transparent);
    font-size: 0.875rem;
}

/* Now indicator — prominent current-time line */
.fc .fc-timegrid-now-indicator-line {
    border-color: var(--c-primary) !important;
    border-width: 2.5px !important;
    z-index: 4 !important;
}
.fc .fc-timegrid-now-indicator-line::before {
    content: '';
    position: absolute;
    left: -6px;
    top: -6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-primary);
}
.fc .fc-timegrid-now-indicator-line::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: -4px;
    height: 8px;
    background: linear-gradient(to bottom, color-mix(in srgb, var(--c-primary) 12%, transparent), transparent);
    pointer-events: none;
}
.fc .fc-timegrid-now-indicator-arrow {
    border-color: var(--c-primary) !important;
    border-width: 6px !important;
}

/* Buttons */
.fc .fc-button {
    border-radius: 0.4rem !important;
    font-size: 0.8125rem !important;
    padding: 0.3rem 0.8rem !important;
    font-weight: 500 !important;
    transition: background .15s, border-color .15s !important;
}
.fc .fc-button:focus {
    box-shadow: 0 0 0 3px var(--c-focus-ring) !important;
    outline: none !important;
}
.fc .fc-button-group .fc-button { border-radius: 0 !important; }
.fc .fc-button-group .fc-button:first-child { border-radius: 0.4rem 0 0 0.4rem !important; }
.fc .fc-button-group .fc-button:last-child  { border-radius: 0 0.4rem 0.4rem 0 !important; }

/* Header + columns */
.fc .fc-toolbar-title       { font-size: 1.1rem !important; font-weight: 700; }
.fc .fc-col-header-cell-cushion { font-weight: 600; color: var(--bs-body-color); text-decoration: none; }
.fc .fc-daygrid-day-number  { color: var(--bs-body-color); text-decoration: none; font-weight: 500; }
.fc .fc-timegrid-slot-label { color: var(--bs-secondary-color); font-size: 0.72rem; }

/* Erase default event bubble — we paint inside eventContent */
.fc .fc-timegrid-event,
.fc .fc-daygrid-event { background: transparent !important; border: none !important; box-shadow: none !important; padding: 1px !important; }
.fc .fc-event-main { padding: 0 !important; height: 100%; }
.fc .fc-timegrid-event { border-radius: 0.4rem !important; overflow: hidden; margin-right: 2px !important; }
.fc .fc-daygrid-event  { border-radius: 0.3rem !important; overflow: hidden; }
.fc .fc-timegrid-col-events { margin: 0 2px !important; }

/* List view row */
.fc .fc-list-event:hover td { background: var(--bs-tertiary-bg) !important; }
.fc .fc-list-event-title a  { text-decoration: none; color: var(--bs-body-color); display: block; }
.fc .fc-list-table td { border-color: var(--bs-border-color) !important; }
.fc .fc-list-day-cushion { background: var(--bs-tertiary-bg) !important; }
.fc .fc-list-event-title { width: 100%; }
.fc .fc-list-event td { padding: .5rem .6rem !important; }
.fc .fc-list-event .fc-event-card { min-height: 38px; }
.fc .fc-list-event .fc-event-avatar { width: 28px; height: 28px; font-size: .65rem; }
.fc .fc-list-event .fc-event-client { font-size: .85rem; }
.fc .fc-list-event .fc-event-type { font-size: .73rem; }

/* ============================================================
   CALENDAR LAYOUT — shell, topbar, body, panel
   ============================================================ */

.cal-shell {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    height: calc(100vh - 48px - 3rem);
    min-height: 0;
}

.cal-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* --- Filter chips --- */
.cal-filters { display: flex; gap: 0.375rem; flex-wrap: wrap; }

.cal-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3rem 0.875rem;
    border-radius: 2rem;
    border: 1.5px solid var(--bs-border-color);
    background: transparent;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all .15s ease;
    color: var(--bs-secondary-color);
    white-space: nowrap;
    line-height: 1;
}
.cal-filter-chip:hover { border-color: var(--bs-secondary-color); color: var(--bs-body-color); }

.chip-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.cal-filter-chip.chip-all.active       { background: var(--c-primary);    border-color: var(--c-primary);   color: #fff; }
.cal-filter-chip.chip-scheduled.active { background: var(--c-primary-light); border-color: var(--c-primary); color: var(--c-primary); }
.cal-filter-chip.chip-completed.active { background: #d1fae5; border-color: #10b981; color: #065f46; }
.cal-filter-chip.chip-cancelled.active { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.cal-filter-chip.chip-noshow.active    { background: #ffedd5; border-color: #f97316; color: #9a3412; }
.cal-filter-chip.chip-awaiting.active  { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.bg-orange { background-color: #f59e0b !important; }

/* --- Body: calendar + slide panel --- */
.cal-body { display: flex; gap: 1rem; align-items: flex-start; flex: 1; min-height: 0; }
.cal-main  { flex: 1; min-width: 0; min-height: 0; }

/* Panel: animates in; removed from DOM on close (no Blazor @if trick needed) */
.cal-panel {
    width: 360px;
    flex-shrink: 0;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-body-bg);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 108px);
    overflow: hidden;
    animation: calPanelIn .25s cubic-bezier(.4,0,.2,1) both;
    position: sticky;
    top: 1rem;
}
@keyframes calPanelIn {
    from { opacity: 0; transform: translateX(18px); }
    to   { opacity: 1; transform: translateX(0); }
}

.cal-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--bs-border-color);
    flex-shrink: 0;
}

.cal-panel-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

/* Session detail rows inside panel */
.session-detail-list { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1rem; }
.session-detail-row  {
    display: flex; align-items: flex-start; gap: 0.625rem; font-size: 0.875rem;
}
.session-detail-row > i { color: var(--bs-secondary-color); font-size: 0.875rem; margin-top: 1px; flex-shrink: 0; }

/* ============================================================
   FULLCALENDAR — CUSTOM EVENT CARDS
   ============================================================ */

.fc-event-card {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.5rem 0.25rem 0;
    height: 100%;
    overflow: hidden;
    border-left: 3.5px solid transparent;
    border-radius: 0.35rem;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
}

.fc-event-card.status-scheduled { border-left-color: var(--c-primary); background: var(--c-primary-light); }
.fc-event-card.status-completed { border-left-color: #10b981;           background: #d1fae5; }
.fc-event-card.status-cancelled { border-left-color: #ef4444;           background: #fee2e2; opacity: .72; }
.fc-event-card.status-noshow         { border-left-color: #f97316; background: #ffedd5; }
.fc-event-card.status-awaitingpackage { border-left-color: #f59e0b; background: #fef3c7; }

.fc-event-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    color: #fff;
}
.status-scheduled .fc-event-avatar { background: var(--c-primary); }
.status-completed .fc-event-avatar { background: #10b981; }
.status-cancelled .fc-event-avatar { background: #ef4444; }
.status-noshow    .fc-event-avatar { background: #f97316; }

.fc-event-info    { min-width: 0; flex: 1; }
.fc-event-client  { font-weight: 600; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.fc-event-type    { font-size: 0.68rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .75; line-height: 1.25; }
.fc-event-time    { font-size: 0.6rem; font-weight: 500; opacity: .6; line-height: 1; margin-top: 1px; }

.status-scheduled .fc-event-client, .status-scheduled .fc-event-type { color: var(--c-primary); }
.status-completed .fc-event-client, .status-completed .fc-event-type { color: #065f46; }
.status-cancelled .fc-event-client, .status-cancelled .fc-event-type { color: #991b1b; }
.status-noshow    .fc-event-client, .status-noshow    .fc-event-type { color: #9a3412; }

/* Mobile: calendar layout */
@media (max-width: 767px) {
    .cal-body    { flex-direction: column; }
    .cal-panel   {
        width: 100%;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        border-radius: 1rem 1rem 0 0;
        max-height: 72vh;
        animation: calPanelUp .28s cubic-bezier(.4,0,.2,1) both;
        z-index: 1050;
        top: auto;
    }
    @keyframes calPanelUp {
        from { transform: translateY(100%); opacity: .5; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    /* FullCalendar toolbar — compact stacked layout */
    .fc .fc-toolbar.fc-header-toolbar {
        flex-wrap: wrap;
        gap: .5rem;
        margin-bottom: .75rem !important;
    }
    .fc .fc-toolbar-chunk {
        display: flex;
        align-items: center;
        gap: .35rem;
    }
    .fc .fc-toolbar-title {
        font-size: .95rem !important;
        white-space: nowrap;
    }
    .fc .fc-button {
        font-size: .7rem !important;
        padding: .25rem .5rem !important;
    }
    .fc .fc-today-button {
        font-size: .7rem !important;
        padding: .25rem .6rem !important;
    }

    /* Filter chips — smaller on mobile */
    .cal-filter-chip {
        font-size: .7rem;
        padding: .25rem .65rem;
    }
}

/* ============================================================
   SESSION TILES PAGE
   ============================================================ */

.session-tiles { display: flex; flex-direction: column; gap: 0.625rem; }

.session-tile {
    display: flex;
    align-items: stretch;
    gap: 1.125rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-left: 4px solid var(--c-primary);
    border-radius: 0.625rem;
    padding: 0.875rem 1.25rem;
    transition: box-shadow .15s ease, transform .15s ease;
}
.session-tile:hover { box-shadow: 0 4px 18px rgba(0,0,0,.09); transform: translateY(-1px); }

.session-tile.status-completed       { border-left-color: #10b981; }
.session-tile.status-cancelled       { border-left-color: #ef4444; opacity: .68; }
.session-tile.status-noshow          { border-left-color: #f97316; }
.session-tile.status-awaitingpackage { border-left-color: #f59e0b; background: rgba(245,158,11,.05); }

.session-tile-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 0.5rem 0.75rem;
    background: var(--c-primary-light);
    color: var(--c-primary);
    border-radius: 0.5rem;
    flex-shrink: 0;
    text-align: center;
}
.session-tile.status-completed        .session-tile-date { background: #d1fae5; color: #065f46; }
.session-tile.status-cancelled        .session-tile-date { background: var(--bs-tertiary-bg); color: var(--bs-secondary-color); }
.session-tile.status-noshow           .session-tile-date { background: #ffedd5; color: #9a3412; }
.session-tile.status-awaitingpackage  .session-tile-date { background: #fef3c7; color: #92400e; }

.session-tile-day     { font-size: 1.65rem; font-weight: 800; line-height: 1; }
.session-tile-month   { font-size: 0.64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; margin-top: 2px; }
.session-tile-weekday { font-size: 0.6rem;  opacity: .65; margin-top: 1px; }

.session-tile-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; justify-content: center; gap: 0.175rem;
}
.session-tile-client  { font-weight: 700; font-size: 0.975rem; line-height: 1.2; }
.session-tile-type    { font-size: 0.8125rem; color: var(--bs-secondary-color); }
.session-tile-time    { font-size: 0.8125rem; }
.session-tile-trainer { font-size: 0.775rem; }

.session-tile-meta { flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: .375rem; justify-content: center; }

.session-section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--bs-secondary-color);
}

@media (max-width: 767px) {
    .session-tiles { gap: .5rem; }
    .session-tile {
        padding: .875rem 1rem;
        gap: .875rem;
        border-radius: .75rem;
        width: 100%;
    }
    .session-tile-info { flex: 1; }
    .session-tile-client { font-size: .925rem; }
    .session-tile-type,
    .session-tile-time,
    .session-tile-trainer { font-size: .78rem; }
    .session-tile-meta { display: none; }
}

@media (max-width: 575px) {
    .session-tile            { padding: .75rem .875rem; gap: .75rem; }
    .session-tile-date       { min-width: 44px; padding: .4rem .6rem; }
    .session-tile-day        { font-size: 1.35rem; }
}

/* Sessions page layout with sliding panel */
.sessions-body { display: flex; gap: 1rem; align-items: flex-start; }
.sessions-main  { flex: 1; min-width: 0; }

.session-tile-selected {
    border-left-color: var(--c-primary) !important;
    box-shadow: 0 0 0 2px var(--c-primary-light), 0 4px 18px rgba(0,0,0,.08);
    transform: translateY(-1px);
}

@media (max-width: 767px) {
    .sessions-body { flex-direction: column; }
}

/* ============================================================
   DARK THEMES — Accent colors (medium-bright for dark backgrounds)
   ============================================================ */

[data-theme="ocean-dark"] {
    --c-primary:        #0EA5E9;
    --c-primary-hover:  #38BDF8;
    --c-primary-active: #7DD3FC;
    --c-primary-light:  rgba(14,165,233,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(14,165,233,0.30);
    --c-avatar-from:    #0284C7;
    --c-avatar-to:      #06B6D4;
}

[data-theme="forest-dark"] {
    --c-primary:        #22C55E;
    --c-primary-hover:  #4ADE80;
    --c-primary-active: #86EFAC;
    --c-primary-light:  rgba(34,197,94,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(34,197,94,0.30);
    --c-avatar-from:    #16A34A;
    --c-avatar-to:      #10B981;
}

[data-theme="sunset-dark"] {
    --c-primary:        #F97316;
    --c-primary-hover:  #FB923C;
    --c-primary-active: #FDBA74;
    --c-primary-light:  rgba(249,115,22,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(249,115,22,0.30);
    --c-avatar-from:    #EA580C;
    --c-avatar-to:      #FBBF24;
}

[data-theme="crimson-dark"] {
    --c-primary:        #EF4444;
    --c-primary-hover:  #F87171;
    --c-primary-active: #FCA5A5;
    --c-primary-light:  rgba(239,68,68,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(239,68,68,0.30);
    --c-avatar-from:    #DC2626;
    --c-avatar-to:      #F97316;
}

[data-theme="lavender-dark"] {
    --c-primary:        #A855F7;
    --c-primary-hover:  #C084FC;
    --c-primary-active: #D8B4FE;
    --c-primary-light:  rgba(168,85,247,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(168,85,247,0.30);
    --c-avatar-from:    #9333EA;
    --c-avatar-to:      #EC4899;
}

[data-theme="slate-dark"] {
    --c-primary:        #94A3B8;
    --c-primary-hover:  #CBD5E1;
    --c-primary-active: #E2E8F0;
    --c-primary-light:  rgba(148,163,184,0.15);
    --c-primary-text:   #0F172A;
    --c-focus-ring:     rgba(148,163,184,0.30);
    --c-avatar-from:    #475569;
    --c-avatar-to:      #64748B;
}

[data-theme="rose-dark"] {
    --c-primary:        #F43F5E;
    --c-primary-hover:  #FB7185;
    --c-primary-active: #FDA4AF;
    --c-primary-light:  rgba(244,63,94,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(244,63,94,0.30);
    --c-avatar-from:    #E11D48;
    --c-avatar-to:      #F43F5E;
}

[data-theme="teal-dark"] {
    --c-primary:        #14B8A6;
    --c-primary-hover:  #2DD4BF;
    --c-primary-active: #5EEAD4;
    --c-primary-light:  rgba(20,184,166,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(20,184,166,0.30);
    --c-avatar-from:    #0D9488;
    --c-avatar-to:      #06B6D4;
}

[data-theme="amber-dark"] {
    --c-primary:        #F59E0B;
    --c-primary-hover:  #FBBF24;
    --c-primary-active: #FCD34D;
    --c-primary-light:  rgba(245,158,11,0.15);
    --c-primary-text:   #1C1400;
    --c-focus-ring:     rgba(245,158,11,0.30);
    --c-avatar-from:    #D97706;
    --c-avatar-to:      #F59E0B;
}

[data-theme="indigo-dark"] {
    --c-primary:        #6366F1;
    --c-primary-hover:  #818CF8;
    --c-primary-active: #A5B4FC;
    --c-primary-light:  rgba(99,102,241,0.15);
    --c-primary-text:   #ffffff;
    --c-focus-ring:     rgba(99,102,241,0.30);
    --c-avatar-from:    #4F46E5;
    --c-avatar-to:      #7C3AED;
}

/* ============================================================
   DARK MODE — Bootstrap CSS variables override
   ============================================================ */

[data-theme$="-dark"] {
    --bs-body-bg:           #0F172A;
    --bs-body-bg-rgb:       15, 23, 42;
    --bs-body-color:        #E2E8F0;
    --bs-body-color-rgb:    226, 232, 240;
    --bs-border-color:      #334155;
    --bs-secondary-color:   #94A3B8;
    --bs-secondary-bg:      #1E293B;
    --bs-tertiary-bg:       #1E293B;
    --bs-emphasis-color:    #F8FAFC;
    --bs-link-color:        var(--c-primary);
    --bs-link-hover-color:  var(--c-primary-hover);
    color-scheme: dark;
}

/* ============================================================
   DARK MODE — Component overrides
   ============================================================ */

[data-theme$="-dark"] body {
    background: #0F172A;
    color: #E2E8F0;
}

[data-theme$="-dark"] h1,
[data-theme$="-dark"] h2,
[data-theme$="-dark"] h3,
[data-theme$="-dark"] h4,
[data-theme$="-dark"] h5,
[data-theme$="-dark"] h6 { color: #F1F5F9; }

[data-theme$="-dark"] .page-title { color: #F1F5F9; }

/* --- Sidebar --- */
[data-theme$="-dark"] .app-sidebar        { background: #1E293B; border-right-color: #334155; }
[data-theme$="-dark"] .sidebar-brand      { color: var(--c-primary); border-bottom-color: #334155; }
[data-theme$="-dark"] .sidebar-divider    { background: #334155; }
[data-theme$="-dark"] .sidebar-link       { color: #94A3B8; }
[data-theme$="-dark"] .sidebar-link:hover { background: #334155; color: #F1F5F9; }
[data-theme$="-dark"] .sidebar-link.active { background: var(--c-primary-light); color: var(--c-primary); }
[data-theme$="-dark"] .sidebar-footer     { border-top-color: #334155; }
[data-theme$="-dark"] .sidebar-user       { color: #94A3B8; }
[data-theme$="-dark"] .sidebar-user:hover { background: #334155; color: #F1F5F9; }
[data-theme$="-dark"] .sidebar-logout     { color: #64748B; }
[data-theme$="-dark"] .sidebar-logout:hover { background: rgba(239,68,68,.18); color: #F87171; }

/* --- Topbar --- */
[data-theme$="-dark"] .app-topbar { background: #1E293B; border-bottom-color: #334155; }

/* --- Cards --- */
[data-theme$="-dark"] .card        { background: #1E293B; border-color: #334155; }
[data-theme$="-dark"] .card-header { border-bottom-color: #334155; }

/* --- Forms --- */
[data-theme$="-dark"] .form-control,
[data-theme$="-dark"] .form-select          { background: #0F172A; border-color: #475569; color: #E2E8F0; }
[data-theme$="-dark"] .form-control:focus,
[data-theme$="-dark"] .form-select:focus    { background: #0F172A; border-color: var(--c-primary); color: #E2E8F0; }
[data-theme$="-dark"] .form-control::placeholder { color: #475569; }
[data-theme$="-dark"] .form-label           { color: #CBD5E1; }
[data-theme$="-dark"] .form-text            { color: #64748B; }
[data-theme$="-dark"] .input-group-text     { background: #1E293B; border-color: #475569; color: #64748B; }
[data-theme$="-dark"] .form-check-label     { color: #CBD5E1; }

/* --- Tables --- */
[data-theme$="-dark"] .table               { color: #E2E8F0; --bs-table-bg: transparent; }
[data-theme$="-dark"] .table th            { background: #0F172A; color: #64748B; border-color: #334155; }
[data-theme$="-dark"] .table > :not(caption) > * > * { border-color: #334155; }
[data-theme$="-dark"] .table-hover > tbody > tr:hover > * { background: #334155; }
[data-theme$="-dark"] .table-light         { --bs-table-bg: #0F172A; color: #64748B; }
[data-theme$="-dark"] .table-sm td,
[data-theme$="-dark"] .table-sm th         { border-color: #334155; }

/* --- Badges --- */
[data-theme$="-dark"] .bg-primary-subtle    { background-color: var(--c-primary-light) !important; }
[data-theme$="-dark"] .text-primary         { color: var(--c-primary) !important; }
[data-theme$="-dark"] .bg-success-subtle    { background-color: rgba(34,197,94,.18) !important; }
[data-theme$="-dark"] .text-success         { color: #4ADE80 !important; }
[data-theme$="-dark"] .bg-danger-subtle     { background-color: rgba(239,68,68,.18) !important; }
[data-theme$="-dark"] .text-danger          { color: #F87171 !important; }
[data-theme$="-dark"] .bg-warning-subtle    { background-color: rgba(245,158,11,.18) !important; }
[data-theme$="-dark"] .text-warning         { color: #FBBF24 !important; }
[data-theme$="-dark"] .bg-secondary-subtle  { background-color: rgba(148,163,184,.18) !important; }
[data-theme$="-dark"] .text-secondary       { color: #94A3B8 !important; }
[data-theme$="-dark"] .bg-dark-subtle       { background-color: rgba(148,163,184,.18) !important; }
[data-theme$="-dark"] .text-muted           { color: #64748B !important; }

/* --- Alerts --- */
[data-theme$="-dark"] .alert-warning { background: rgba(245,158,11,.15); color: #FCD34D; }
[data-theme$="-dark"] .alert-success { background: rgba(34,197,94,.15);  color: #86EFAC; }
[data-theme$="-dark"] .alert-danger  { background: rgba(239,68,68,.15);  color: #FCA5A5; }
[data-theme$="-dark"] .alert-info    { background: var(--c-primary-light); color: var(--c-primary); }

/* --- Modals --- */
[data-theme$="-dark"] .modal-content  { background: #1E293B; }
[data-theme$="-dark"] .modal-header   { border-bottom-color: #334155; }
[data-theme$="-dark"] .modal-footer   { border-top-color: #334155; }

/* --- Misc utilities --- */
[data-theme$="-dark"] .progress              { background: #334155; }
[data-theme$="-dark"] .border               { border-color: #334155 !important; }
[data-theme$="-dark"] .border-top           { border-top-color: #334155 !important; }
[data-theme$="-dark"] .border-bottom        { border-bottom-color: #334155 !important; }
[data-theme$="-dark"] .bg-light             { background-color: #334155 !important; }
[data-theme$="-dark"] .bg-body-secondary    { background-color: #1E293B !important; }
[data-theme$="-dark"] .rounded              { color: inherit; }
[data-theme$="-dark"] .opacity-75           { opacity: .75; }
[data-theme$="-dark"] dl dt                 { color: #94A3B8; }
[data-theme$="-dark"] .breadcrumb-item.active { color: #94A3B8; }
[data-theme$="-dark"] .breadcrumb-item + .breadcrumb-item::before { color: #475569; }

/* --- Calendar panel --- */
[data-theme$="-dark"] .cal-panel        { background: #1E293B; border-color: #334155; }
[data-theme$="-dark"] .cal-panel-header { border-bottom-color: #334155; }

/* --- Calendar filter chips --- */
[data-theme$="-dark"] .cal-filter-chip          { border-color: #475569; color: #94A3B8; }
[data-theme$="-dark"] .cal-filter-chip:hover     { border-color: #94A3B8; color: #CBD5E1; }
[data-theme$="-dark"] .cal-filter-chip.chip-scheduled.active { background: var(--c-primary-light); border-color: var(--c-primary); color: var(--c-primary); }
[data-theme$="-dark"] .cal-filter-chip.chip-completed.active { background: rgba(34,197,94,.2);  border-color: #22c55e; color: #4ADE80; }
[data-theme$="-dark"] .cal-filter-chip.chip-cancelled.active { background: rgba(239,68,68,.2);  border-color: #ef4444; color: #F87171; }
[data-theme$="-dark"] .cal-filter-chip.chip-noshow.active    { background: rgba(249,115,22,.2); border-color: #f97316; color: #FB923C; }
[data-theme$="-dark"] .cal-filter-chip.chip-awaiting.active  { background: rgba(245,158,11,.2); border-color: #f59e0b; color: #FBBF24; }

/* --- Calendar event cards --- */
[data-theme$="-dark"] .fc-event-card.status-scheduled    { background: var(--c-primary-light); }
[data-theme$="-dark"] .fc-event-card.status-completed    { background: rgba(34,197,94,.15);  }
[data-theme$="-dark"] .fc-event-card.status-cancelled    { background: rgba(239,68,68,.15);  }
[data-theme$="-dark"] .fc-event-card.status-noshow       { background: rgba(249,115,22,.15); }
[data-theme$="-dark"] .fc-event-card.status-awaitingpackage { background: rgba(245,158,11,.15); }
[data-theme$="-dark"] .status-completed .fc-event-client,
[data-theme$="-dark"] .status-completed .fc-event-type   { color: #4ADE80; }
[data-theme$="-dark"] .status-cancelled .fc-event-client,
[data-theme$="-dark"] .status-cancelled .fc-event-type   { color: #F87171; }
[data-theme$="-dark"] .status-noshow    .fc-event-client,
[data-theme$="-dark"] .status-noshow    .fc-event-type   { color: #FB923C; }

/* --- Session tiles --- */
[data-theme$="-dark"] .session-tile                              { background: #1E293B; border-color: #334155; }
[data-theme$="-dark"] .session-tile.status-awaitingpackage       { background: rgba(245,158,11,.07); }
[data-theme$="-dark"] .session-tile.status-cancelled             { opacity: .55; }
[data-theme$="-dark"] .session-tile.status-completed .session-tile-date   { background: rgba(34,197,94,.18);  color: #4ADE80; }
[data-theme$="-dark"] .session-tile.status-cancelled .session-tile-date   { background: #334155; color: #94A3B8; }
[data-theme$="-dark"] .session-tile.status-noshow    .session-tile-date   { background: rgba(249,115,22,.18); color: #FB923C; }
[data-theme$="-dark"] .session-tile.status-awaitingpackage .session-tile-date { background: rgba(245,158,11,.18); color: #FBBF24; }

/* --- Branding theme swatch --- */
[data-theme$="-dark"] .theme-swatch            { color: #94A3B8; }
[data-theme$="-dark"] .theme-swatch:hover      { border-color: #475569; background: #334155; }
[data-theme$="-dark"] .theme-swatch.selected   { background: var(--c-primary-light); color: var(--c-primary); border-color: var(--c-primary); }

/* --- Upload zone --- */
[data-theme$="-dark"] .upload-zone       { background: #0F172A; border-color: #475569; }
[data-theme$="-dark"] .upload-zone:hover { border-color: var(--c-primary); background: var(--c-primary-light); }

/* --- Stat cards --- */
[data-theme$="-dark"] .stat-card  { background: #1E293B; border-color: #334155; }
[data-theme$="-dark"] .stat-value { color: #F1F5F9; }

/* --- Mobile bottom nav --- */
[data-theme$="-dark"] .mobile-bottom-nav { background: #1E293B; border-top-color: #334155; }
[data-theme$="-dark"] .mobile-nav-item   { color: #475569; }

/* --- Mobile bottom sheet --- */
[data-theme$="-dark"] .mobile-sheet { background: #1E293B; box-shadow: 0 -8px 40px rgba(0,0,0,.4); }
[data-theme$="-dark"] .mobile-sheet-tile { background: #0F172A; }
[data-theme$="-dark"] .mobile-sheet-tile:hover { background: var(--c-primary-light); }
[data-theme$="-dark"] .mobile-sheet-theme-btn { background: #0F172A; border-color: #334155; }

/* --- Dropdowns --- */
[data-theme$="-dark"] .dropdown-menu    { background: #1E293B; border-color: #334155; }
[data-theme$="-dark"] .dropdown-item    { color: #CBD5E1; }
[data-theme$="-dark"] .dropdown-item:hover { background: #334155; color: #F1F5F9; }

/* --- Stat card awaiting highlight --- */
[data-theme$="-dark"] .card[style*="border-left:4px solid #D97706"] { background: #1E293B; }

/* ============================================================
   SKELETON LOADERS
   ============================================================ */

.skeleton {
    background: linear-gradient(
        90deg,
        rgba(0,0,0,.04) 25%,
        rgba(0,0,0,.08) 50%,
        rgba(0,0,0,.04) 75%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 6px;
    pointer-events: none;
}

[data-theme$="-dark"] .skeleton {
    background: linear-gradient(
        90deg,
        rgba(255,255,255,.03) 25%,
        rgba(255,255,255,.07) 50%,
        rgba(255,255,255,.03) 75%
    );
    background-size: 200% 100%;
}

.skeleton-line {
    height: 12px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-40 { width: 40%; }

.skeleton-card {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--bs-border-color, #e2e8f0);
    margin-bottom: 12px;
}

.skeleton-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--bs-border-color, #e2e8f0);
}

.skeleton-circle {
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--bs-border-color, #e2e8f0);
}

.skeleton-row:last-child { border-bottom: none; }

/* ============================================================
   PULL-TO-REFRESH
   ============================================================ */

.ptr-wrapper {
    position: relative;
    overflow: visible;
}

.ptr-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 0;
    overflow: hidden;
    transition: height .2s ease;
    color: var(--c-primary);
}

.ptr-indicator.active {
    height: 48px;
}

.ptr-indicator .ptr-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--c-primary-light);
    border-top-color: var(--c-primary);
    border-radius: 50%;
    animation: ptr-spin .6s linear infinite;
}

.ptr-indicator .ptr-arrow {
    font-size: 1.2rem;
    transition: transform .2s ease;
}

.ptr-indicator.pulling .ptr-arrow {
    transform: rotate(180deg);
}

@keyframes ptr-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: .75rem;
    opacity: .35;
}

.empty-state-title {
    font-weight: 600;
    font-size: .95rem;
    margin-bottom: .35rem;
    color: var(--bs-body-color);
}

.empty-state-desc {
    font-size: .8rem;
    color: var(--bs-secondary-color, #6c757d);
    margin-bottom: 1rem;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-cta {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    font-weight: 500;
    color: var(--c-primary);
    text-decoration: none;
    padding: .4rem .8rem;
    border-radius: 8px;
    background: var(--c-primary-light);
    transition: background .15s;
}

.empty-state-cta:hover {
    background: var(--c-primary);
    color: var(--c-primary-text, #fff);
}

/* --- Stat-icon color variants (light + dark) --- */
.stat-icon-green { background: #F0FDF4; color: #16A34A; }
.stat-icon-blue  { background: #EFF6FF; color: #3B82F6; }
.stat-icon-amber { background: #FEF3C7; color: #D97706; }
.stat-icon-red   { background: #FEF2F2; color: #DC2626; }

[data-theme$="-dark"] .stat-icon-green { background: rgba(34,197,94,.15);  color: #4ADE80; }
[data-theme$="-dark"] .stat-icon-blue  { background: rgba(59,130,246,.15); color: #60A5FA; }
[data-theme$="-dark"] .stat-icon-amber { background: rgba(217,119,6,.15);  color: #FBBF24; }
[data-theme$="-dark"] .stat-icon-red   { background: rgba(239,68,68,.15);  color: #F87171; }

/* --- Permission table --- */
.permission-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #6B7280; border-bottom-width: 2px; }
.permission-table td { border-bottom: 1px solid var(--bs-border-color-translucent); }
.permission-table .form-switch { margin: 0; padding-left: 2.5em; }
.permission-table .form-check-input { cursor: pointer; }
.permission-table .form-check-input:disabled { opacity: .35; cursor: not-allowed; }

/* --- Calendar day summary bar --- */
.cal-day-summary { display: flex; align-items: center; gap: .5rem; padding: .35rem .75rem; font-size: .8rem; color: #64748B; background: var(--bs-tertiary-bg, #f8fafc); border-bottom: 1px solid var(--bs-border-color-translucent); flex-wrap: wrap; }
.cal-day-summary .summary-pill { background: var(--c-primary-light); color: var(--c-primary); padding: .15rem .5rem; border-radius: 6px; font-weight: 500; font-size: .75rem; }
[data-theme$="-dark"] .cal-day-summary { background: #1E293B; color: #94A3B8; border-bottom-color: #334155; }

/* --- Calendar status dots (list view) --- */
.fc-event-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fc-event-status-dot.dot-scheduled      { background: var(--c-primary); }
.fc-event-status-dot.dot-completed      { background: #22C55E; }
.fc-event-status-dot.dot-cancelled      { background: #EF4444; }
.fc-event-status-dot.dot-noshow         { background: #F97316; }
.fc-event-status-dot.dot-awaitingpackage { background: #F59E0B; }

/* --- Awaiting-package inline warning --- */
.awaiting-pkg-label { font-size: .72rem; color: #b45309; font-weight: 600; margin-top: 2px; }
[data-theme$="-dark"] .awaiting-pkg-label { color: #fbbf24; }

[data-theme$="-dark"] .skeleton-card,
[data-theme$="-dark"] .skeleton-stat { border-color: #334155; }
[data-theme$="-dark"] .skeleton-row  { border-bottom-color: #334155; }

/* --- Toast notifications --- */
.toast-container-fixed { position: fixed; top: 1rem; right: 1rem; z-index: 9999; display: flex; flex-direction: column; gap: .5rem; max-width: 380px; pointer-events: none; }
.toast-item { pointer-events: auto; display: flex; align-items: center; padding: .65rem 1rem; border-radius: 10px; font-size: .875rem; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.12); animation: toastIn .3s ease-out; }
.toast-item.toast-hiding { animation: toastOut .3s ease-in forwards; }
@keyframes toastIn  { from { opacity:0; transform:translateX(40px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; transform:none; } to { opacity:0; transform:translateX(40px); } }
.toast-msg { flex: 1; }
.toast-close { background: none; border: none; font-size: 1.1rem; opacity: .6; cursor: pointer; padding: 0 0 0 .5rem; color: inherit; line-height: 1; }
.toast-close:hover { opacity: 1; }
.toast-success { background: #DCFCE7; color: #15803D; }
.toast-error   { background: #FEE2E2; color: #B91C1C; }
.toast-warning { background: #FEF3C7; color: #92400E; }
.toast-info    { background: #DBEAFE; color: #1E40AF; }
[data-theme$="-dark"] .toast-success { background: rgba(34,197,94,.18); color: #4ADE80; }
[data-theme$="-dark"] .toast-error   { background: rgba(239,68,68,.18); color: #F87171; }
[data-theme$="-dark"] .toast-warning { background: rgba(245,158,11,.18); color: #FBBF24; }
[data-theme$="-dark"] .toast-info    { background: rgba(59,130,246,.18); color: #60A5FA; }
[data-theme$="-dark"] .toast-item    { box-shadow: 0 4px 16px rgba(0,0,0,.35); }
@media (max-width: 480px) { .toast-container-fixed { left: 1rem; right: 1rem; max-width: none; } }

/* --- Legal pages --- */
.legal-page { max-width: 800px; margin: 0 auto; padding: 0 0 3rem; }
.legal-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .5rem; }
.legal-header i { font-size: 1.75rem; color: var(--c-primary); flex-shrink: 0; }
.legal-header h4 { margin: 0; font-weight: 700; }
.legal-meta { font-size: .78rem; color: var(--bs-secondary-color, #6c757d); margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--bs-border-color, rgba(0,0,0,.1)); }
.legal-intro { font-size: .925rem; line-height: 1.7; margin-bottom: 1.5rem; padding: 1rem 1.25rem; background: var(--bs-secondary-bg, rgba(0,0,0,.03)); border-radius: .75rem; }
.legal-page section { margin-bottom: 1.75rem; }
.legal-page h5 { font-weight: 700; font-size: 1rem; margin-bottom: .75rem; }
.legal-page ol, .legal-page ul { padding-left: 1.25rem; line-height: 1.75; font-size: .9rem; }
.legal-page ol > li { margin-bottom: .5rem; }
.legal-page p { font-size: .9rem; line-height: 1.7; }
.legal-right { display: flex; align-items: flex-start; gap: .6rem; padding: .6rem .75rem; border-radius: .5rem; background: var(--bs-secondary-bg, rgba(0,0,0,.03)); height: 100%; }
.legal-right i { font-size: 1.1rem; color: var(--c-primary); flex-shrink: 0; margin-top: .1rem; }
.legal-page .table { border-radius: .5rem; overflow: hidden; }

/* Cookie consent banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: .75rem 1rem;
    padding-bottom: max(.75rem, env(safe-area-inset-bottom));
    background: var(--bs-body-bg, #fff);
    border-top: 1px solid var(--bs-border-color, rgba(0,0,0,.1));
    box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    animation: cookieSlideUp .3s ease;
}
@keyframes cookieSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.cookie-banner-inner {
    max-width: 960px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.cookie-banner-text {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    flex: 1;
    min-width: 0;
    font-size: .85rem;
}
.cookie-banner-text i {
    font-size: 1.3rem;
    color: var(--c-primary);
    flex-shrink: 0;
    margin-top: .1rem;
}
.cookie-banner-text p { margin: .15rem 0 0; color: var(--bs-secondary-color, #6c757d); font-size: .8rem; }
.cookie-banner-text strong { color: var(--bs-body-color, inherit); }
.cookie-banner-btn { white-space: nowrap; flex-shrink: 0; }
@media (max-width: 480px) {
    .cookie-banner-inner { flex-direction: column; align-items: stretch; }
    .cookie-banner-btn { width: 100%; }
}

/* ============================================================
   ANIMATIONS — Subtle entrance & micro-interactions
   ============================================================ */

/* --- Fade-in + slide-up entrance for cards & sections --- */
.card,
.stat-card,
.manage-card,
.manage-header,
.alert,
.session-tile,
.empty-state {
    animation: fadeSlideUp .4s cubic-bezier(.25,.46,.45,.94) both;
    animation-delay: var(--enter-delay, 0ms);
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered children inside .row and common grid layouts */
.row > [class*="col-"]:nth-child(1)  { --enter-delay: 0ms; }
.row > [class*="col-"]:nth-child(2)  { --enter-delay: 60ms; }
.row > [class*="col-"]:nth-child(3)  { --enter-delay: 120ms; }
.row > [class*="col-"]:nth-child(4)  { --enter-delay: 180ms; }

/* Stagger for flex gap containers (admin cards, stat rows) */
.d-flex.flex-column.gap-3 > :nth-child(1) { --enter-delay: 0ms; }
.d-flex.flex-column.gap-3 > :nth-child(2) { --enter-delay: 60ms; }
.d-flex.flex-column.gap-3 > :nth-child(3) { --enter-delay: 120ms; }
.d-flex.flex-column.gap-3 > :nth-child(4) { --enter-delay: 180ms; }
.d-flex.flex-column.gap-3 > :nth-child(5) { --enter-delay: 240ms; }

/* Stat card row stagger */
.row > [class*="col-"] .stat-card:nth-child(1) { --enter-delay:  40ms; }
.row > [class*="col-"] .stat-card:nth-child(2) { --enter-delay: 100ms; }
.row > [class*="col-"] .stat-card:nth-child(3) { --enter-delay: 160ms; }
.row > [class*="col-"] .stat-card:nth-child(4) { --enter-delay: 220ms; }

/* Session tile stagger */
.session-tiles > .session-tile:nth-child(1)  { --enter-delay:  0ms; }
.session-tiles > .session-tile:nth-child(2)  { --enter-delay: 40ms; }
.session-tiles > .session-tile:nth-child(3)  { --enter-delay: 80ms; }
.session-tiles > .session-tile:nth-child(4)  { --enter-delay: 120ms; }
.session-tiles > .session-tile:nth-child(5)  { --enter-delay: 160ms; }
.session-tiles > .session-tile:nth-child(n+6) { --enter-delay: 200ms; }

/* --- Enhanced card hover — gentle lift + shadow bloom --- */
.card {
    transition: box-shadow .25s ease, transform .25s ease;
}
.card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.stat-card {
    transition: box-shadow .25s ease, transform .25s ease;
}
.stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

[data-theme$="-dark"] .card:hover     { box-shadow: 0 4px 16px rgba(0,0,0,0.25); }
[data-theme$="-dark"] .stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.25); }

/* --- Table row hover — smooth color transition --- */
.table-hover > tbody > tr {
    transition: background .15s ease;
}

/* --- Button micro-interactions --- */
.btn {
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .1s ease;
}
.btn:active:not(:disabled) {
    transform: scale(.97);
}

/* --- Badge subtle pulse on appear --- */
.badge {
    animation: badgePop .3s cubic-bezier(.175,.885,.32,1.275) both;
}
@keyframes badgePop {
    from { opacity: 0; transform: scale(.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* --- Alerts — slide in from top --- */
.alert {
    animation: alertSlideIn .35s cubic-bezier(.25,.46,.45,.94) both;
}
@keyframes alertSlideIn {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Modal — scale + fade entrance --- */
.modal.fade.show .modal-dialog,
.modal.show .modal-dialog {
    animation: modalScaleIn .3s cubic-bezier(.25,.46,.45,.94) both;
}
@keyframes modalScaleIn {
    from { opacity: 0; transform: scale(.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* --- Modal backdrop fade --- */
.modal.fade.show,
.modal.show[style*="background"] {
    animation: backdropFade .25s ease both;
}
@keyframes backdropFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- Form focus — subtle scale on inputs --- */
.form-control:focus,
.form-select:focus {
    transition: border-color .2s ease, box-shadow .2s ease;
}

/* --- Form switch — smoother toggle --- */
.form-check-input[type="checkbox"] {
    transition: background-color .2s ease, border-color .2s ease, box-shadow .2s ease;
}

/* --- Sidebar link — icon subtle shift on hover --- */
.sidebar-link i {
    transition: transform .2s ease, opacity .15s ease;
}
.sidebar-link:hover i {
    transform: translateX(1px);
}
.sidebar-link.active i {
    transform: scale(1.05);
}

/* --- Avatar hover glow --- */
.avatar-circle,
.sidebar-user-avatar {
    transition: box-shadow .25s ease;
}
.avatar-circle:hover,
.sidebar-user-avatar:hover {
    box-shadow: 0 0 0 3px var(--c-focus-ring);
}

/* --- Skeleton shimmer keyframes (used by .skeleton above) --- */
@keyframes skeleton-shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* --- Page title entrance --- */
.page-title,
h2 {
    animation: fadeSlideUp .35s cubic-bezier(.25,.46,.45,.94) both;
}

/* --- Breadcrumb fade-in --- */
.breadcrumb {
    animation: fadeIn .3s ease both;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- Manage nav link — smooth active indicator --- */
.manage-nav-link {
    transition: all .2s ease;
}

/* --- Theme swatch — smooth scale on hover --- */
.theme-swatch {
    transition: border-color .15s, background .15s, transform .15s;
}
.theme-swatch:hover {
    transform: scale(1.03);
}
.theme-swatch:active {
    transform: scale(.97);
}

/* --- Mobile bottom sheet smooth open --- */
@media (max-width: 767.98px) {
    .mobile-sheet {
        transition: transform .35s cubic-bezier(.32,.72,0,1);
    }

    /* Mobile nav item — subtle bounce on tap */
    .mobile-nav-item:active {
        transform: scale(.92);
    }
    .mobile-nav-item {
        transition: color .15s, transform .1s ease;
    }

    /* Mobile tile tap feedback */
    .mobile-sheet-tile:active {
        transform: scale(.94);
        transition: transform .08s ease;
    }
}

/* --- Progress bar animation --- */
.progress-bar {
    transition: width .6s cubic-bezier(.25,.46,.45,.94);
}

/* --- Upload zone pulse on hover --- */
.upload-zone {
    transition: border-color .2s ease, background .2s ease, transform .15s ease;
}
.upload-zone:hover {
    transform: scale(1.005);
}

/* --- Filter chip smooth transitions --- */
.cal-filter-chip {
    transition: all .2s ease;
}
.cal-filter-chip:active {
    transform: scale(.95);
}

/* ============================================================
   ACCESSIBILITY — Respect reduced motion preference
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
