/* ==========================================================
   5. DASHBOARD STYLES (dashboard.css)
   ========================================================== */

/* ----------------------------------------------------------
   DASHBOARD LAYOUT
   ---------------------------------------------------------- */
.dashboard {
    /* Auto-adjust container width */
    width: min(100%, 1200px);
    max-width: 100vw;
    margin: 0 auto;

    /* Safe padding that scales */
    padding: 1.5rem clamp(1rem, 5vw, 2rem);

    position: relative;
    color: var(--text-main);
    background: var(--bg-main);
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Global Overflow Fix */
html,
body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.dashboard * {
    box-sizing: border-box;
}

.dashboard input,
.dashboard button {
    max-width: 100%;
}

@media (min-width: 1024px) {
    .dashboard {
        max-width: 1200px;
        /* Cap width on desktop */
        padding: 2rem;
    }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile default */
    gap: 2rem;
}

/* 1. Grid Reflow: Desktop only affects larger screens */
@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
        align-items: start;
    }
}

/* 2. Central Card Utility - Safe Widths & Glassmorphism */
/* Elite Bento Glassmorphism */
.central-card,
.appointments-card,
.hours-card,
.promo-card,
.card {
    /* Safe Mobile Widths */
    width: 100%;
    max-width: 100%;
    margin: 0 auto 1.5rem auto !important;
    box-sizing: border-box !important;

    /* Bento Glassmorphism */
    border-radius: 24px;
    /* Updated radius */
    background: var(--bg-surface);
    /* Updated opacity */

    /* Visual Polish: Inner Borders & Softer Shadows */
    border: 1px solid rgba(14, 165, 233, 0.15);

    @supports (backdrop-filter: blur(12px)) {
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
    }

    /* Elite Shadows */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04),
    0 4px 6px -2px rgba(0, 0, 0, 0.01);

    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tablet Specifics (768px) */
@media (max-width: 768px) {
    .dashboard {
        padding: 1rem clamp(1.5rem, 5vw, 3rem);
    }

    .dashboard-grid {
        gap: 1.5rem;
        /* Reduce gap on tablet */
    }

    .central-card,
    .appointments-card,
    .hours-card,
    .promo-card,
    .card {
        margin-bottom: 1.5rem;
    }
}

/* Helper for mobile button */
.mobile-view-calendar-btn {
    display: none;
    margin-top: 1rem;
    text-align: center;
}

.dashboard .animated-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 30% 40%, rgba(14, 165, 233, 0.08), transparent 60%),
        radial-gradient(circle at 70% 60%, rgba(20, 184, 166, 0.08), transparent 60%);
    z-index: 0;
    animation: floatGlow 14s ease-in-out infinite alternate;
    pointer-events: none;
}

[data-theme="dark"] .dashboard .animated-bg {
    display: none;
    /* Hide glow on dark mode to prevent milkiness */
}

/* Common Button Active State */
button:active,
.btn:active,
.btn-primary:active {
    transform: scale(0.98);
}

/* ----------------------------------------------------------
   DARK MODE HOURS EDITOR
   ---------------------------------------------------------- */
[data-theme="dark"] .hours-row {
    background: #1e293b;
    /* Slate 800 */
    border-color: #334155;
}

[data-theme="dark"] .hours-row:hover {
    border-color: var(--sky-blue);
    background: #1e293b;
}

[data-theme="dark"] .day-label {
    color: #f1f5f9;
}

[data-theme="dark"] .time-inputs input[type="time"] {
    background: #0f172a;
    /* Slate 900 */
    color: #f1f5f9;
    border-color: #334155;
}

[data-theme="dark"] .time-inputs input[type="time"]:focus {
    border-color: var(--sky-blue);
}

/* Header */
.dash-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    /* Glassmorphism for header too */
    /* Glassmorphism for header too */
    /* Glassmorphism for header too */
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: blur(12px);

    padding: 1.8rem 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(14, 165, 233, 0.1);
    position: relative;
    z-index: 1;
    margin-bottom: 2.5rem;
    max-width: 100%;
    overflow-wrap: break-word;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

@media (max-width: 1024px) {
    .dash-head {
        flex-direction: column;
        align-items: stretch;
        /* Full width children */
        text-align: center;
        gap: 1.5rem;
        padding: 1.5rem 1rem;
    }

    .dash-head-actions {
        justify-content: center;
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Ensure buttons inside actions take full width or share space nicely */
    .dash-head-actions .nav-action-btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
        /* Don't get too small */
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .dash-head-actions {
        flex-direction: column;
    }

    .dash-head-actions .nav-action-btn {
        width: 100%;
    }
}



.dash-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    width: 100%;
    margin-top: 1.25rem;
    margin-bottom: 2rem;
    /* Breathing room for Add Appointment */
}

.dash-actions button,
.dash-actions a {
    width: 100%;
}

/* Sidebar */
.sidebar-sticky {
    position: sticky;
    top: 100px;
}

.sidebar-sticky .card {
    margin-bottom: 1.5rem;
}


/* ----------------------------------------------------------
   INSIGHTS & APPOINTMENTS
   ---------------------------------------------------------- */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
    position: relative;
    z-index: 1;
}

.insight-card {
    background: var(--bg-surface);
    border-radius: 1rem;
    padding: 1.5rem 1.8rem;
    text-align: center;
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    flex-grow: 1;
    /* Fluid Width */
    flex-basis: 0;
    /* Align perfectly */
    /* Removed min-width for full fluidity */
    margin: 0 auto;
    /* Centering Logic */
}

.insight-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(14, 165, 233, 0.15);
    z-index: 2;
    /* Bring to front on hover */
}

.insight-card h4 {
    font-size: 1.1rem;
    color: var(--muted);
    margin-bottom: 0.4rem;
}

.insight-card p {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--sky-blue);
    text-align: center;
    /* Enforce center alignment */
}

/* Appointments Table */
.appointments-card {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(14, 165, 233, 0.08);
    margin-bottom: 2.5rem;
    display: flex;
    flex-direction: column;
    max-height: 420px;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

[data-theme="dark"] .appointments-card {
    background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
    border: 1px solid rgba(56, 189, 248, 0.2);
    /* Sky blue tint */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.appointments-card h3 {
    margin-bottom: 0;
    /* Let container handle gap */
    color: var(--text-main);
    font-weight: 700;
    flex-shrink: 0;
}

.appt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    padding-right: 1.5rem;
    /* Fix View All Overflow */
}

.appt-header a {
    /* Align 'View All' to right edge */
    margin-left: auto;
}

@media (max-width: 480px) {
    .appt-header {
        flex-direction: column;
        text-align: center;
    }

    .appt-header button {
        width: 100%;
        margin-top: 0.5rem;
    }

    /* ----------------------------------------------------------
   TABLE SCROLL COMPONENT (Restored)
   ---------------------------------------------------------- */
    .table-scroll {
        width: 100%;
        /* Vertical Scroll for Desktop/All */
        max-height: 400px;
        overflow-y: auto;
        overflow-x: auto;
        /* Allow horizontal if needed (mobile) */
        -webkit-overflow-scrolling: touch;
        border-radius: 0.6rem;
        border: 1px solid rgba(14, 165, 233, 0.08);
        background: var(--bg-surface-secondary);
        position: relative;

        /* Visual Hint for scrolls (subtle) */
        scrollbar-width: thin;
        scrollbar-color: var(--sky-blue) rgba(240, 250, 255, 0.7);
    }

    .table-scroll::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }

    .table-scroll::-webkit-scrollbar-thumb {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
        border-radius: 1rem;
    }

    .table-scroll::-webkit-scrollbar-track {
        background: rgba(240, 250, 255, 0.7);
    }

    .table {
        width: 100%;
        border-collapse: collapse;
        min-width: 100%;
        /* Ensure it fills container */
    }

    .table th,
    .table td {
        padding: 1rem 1.25rem;
        text-align: left;
        border-bottom: 1px solid rgba(14, 165, 233, 0.08);
    }

    /* Sticky Header */
    .table th {
        background: var(--bg-surface);
        color: var(--text-muted);
        font-weight: 600;
        font-size: 0.9rem;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        position: sticky;
        top: 0;
        z-index: 10;
        /* Ensure over rows */
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    }

    .table td {
        color: var(--text-main);
        font-size: 0.95rem;
        white-space: nowrap;
        /* Prevent wrapping for clean rows */
    }

    /* Mobile Specific Tweaks for Table */
    @media (max-width: 768px) {
        .table-scroll {
            /* On mobile, ensure horizontal scroll is obvious */
            display: block;
            max-height: 500px;
            /* Allow a bit more height on mobile if needed */

            /* Mobile Scroll Hint Gradients */
            background:
                linear-gradient(to right, var(--bg-surface-secondary) 30%, rgba(255, 255, 255, 0)),
                linear-gradient(to right, rgba(255, 255, 255, 0), var(--bg-surface-secondary) 70%) 0 100%,
                radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.1), rgba(0, 0, 0, 0)),
                radial-gradient(farthest-side at 100% 50%, rgba(14, 165, 233, 0.15), rgba(0, 0, 0, 0)) 100%;
            background-repeat: no-repeat;
            background-attachment: local, local, scroll, scroll;
            background-size: 40px 100%, 40px 100%, 14px 100%, 14px 100%;
        }

        .table th,
        .table td {
            padding: 0.85rem 1rem;
        }
    }

    .table td a {
        color: var(--sky-blue);
        text-decoration: none;
        font-weight: 500;
    }

    .table td a:hover {
        text-decoration: underline;
    }

    /* Status Badges within Table */
    .status-badge {
        display: inline-flex;
        align-items: center;
        padding: 0.25rem 0.6rem;
        border-radius: 99px;
        font-size: 0.75rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    .status-booked {
        background: #e0f2fe;
        color: #0284c7;
    }

    .status-completed {
        background: #dcfce7;
        color: #16a34a;
    }

    .status-cancelled {
        background: #fee2e2;
        color: #dc2626;
    }

    .cancel-btn {
        background: #fff;
        color: #ef4444;
        /* Red text */
        border: 1px solid #fee2e2;
        border-radius: 6px;
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
        font-weight: 600;
        transition: all 0.2s ease;
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .cancel-btn:hover {
        background: #fee2e2;
        border-color: #fecaca;
        color: #dc2626;
        transform: translateY(-1px);
    }

    .cancel-btn.confirm-state {
        background: #dc2626;
        color: white;
        border-color: #b91c1c;
        box-shadow: 0 4px 6px rgba(220, 38, 38, 0.25);
        animation: pulseRed 0.5s ease-in-out;
    }

    @keyframes pulseRed {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.05);
        }

        100% {
            transform: scale(1);
        }
    }

    /* ----------------------------------------------------------
   HOURS EDITOR
   ---------------------------------------------------------- */


    .hours-card {
        background: var(--bg-surface);
        padding: 2rem 1.5rem;
        border-radius: 1.25rem;
        box-shadow: 0 10px 35px rgba(14, 165, 233, 0.08);
        margin: 1.5rem auto;
        position: relative;
        overflow: visible !important;
        max-width: 640px;
    }

    [data-theme="dark"] .hours-card {
        background: linear-gradient(145deg, #1e293b 0%, #334155 100%);
        border: 1px solid rgba(56, 189, 248, 0.2);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    }

    .hours-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at 20% 30%, rgba(14, 165, 233, 0.08), transparent 60%),
            radial-gradient(circle at 80% 70%, rgba(20, 184, 166, 0.08), transparent 60%);
        animation: subtleFloat 12s ease-in-out infinite alternate;
        z-index: 0;
        pointer-events: none;
    }

    .hours-header {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 1rem;
        margin-bottom: 1.5rem;
        position: relative;
        z-index: 1;
    }

    .hours-header h3 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-main);
    }

    .copy-all {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
        color: #fff;
        font-weight: 600;
        border: none;
        border-radius: 0.6rem;
        padding: 0.6rem 1.2rem;
        box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25);
        cursor: pointer;
        transition: all 0.25s ease;
    }

    .copy-all:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 22px rgba(20, 184, 166, 0.35);
    }

    .hours-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
        justify-content: center;
    }

    @media (max-width: 768px) {
        .hours-grid {
            grid-template-columns: 1fr;
        }

        .time-inputs input[type="time"] {
            flex: 1;
        }
    }

    .day-editor {
        transition: transform 0.25s ease,
            box-shadow 0.25s ease;
        text-align: center;
        position: relative;
    }

    .day-editor:hover {
        transform: translateY(-5px);
        box-shadow: 0 12px 24px rgba(14, 165, 233, 0.15);
    }

    .day-editor h4 {
        font-size: 1.05rem;
        margin-bottom: 1rem;
        color: var(--text-main);
        font-weight: 600;
    }

    .toggle-wrap {
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 1rem;
    }

    .day-toggle {
        width: 40px;
        height: 22px;
        border-radius: 12px;
        background: rgba(14, 165, 233, 0.2);
        position: relative;
        cursor: pointer;
        transition: background 0.25s ease;
    }

    .day-toggle::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 3px;
        width: 16px;
        height: 16px;
        background: #fff;
        border-radius: 50%;
        transition: transform 0.25s ease;
    }

    .day-toggle.active {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
    }

    .day-toggle.active::after {
        transform: translateX(18px);
    }

    .time-inputs {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 0.6rem;
    }

    .time-inputs input[type="time"] {
        border: 1.5px solid rgba(14, 165, 233, 0.15);
        border-radius: 0.5rem;
        padding: 0.5rem 0.7rem;
        font-family: "Poppins", system-ui, sans-serif;
        font-size: 0.95rem;
        transition: border-color 0.25s ease, box-shadow 0.25s ease;
    }

    .time-inputs input[type="time"]:focus {
        border-color: var(--sky-blue);
        box-shadow: 0 0 6px rgba(14, 165, 233, 0.25);
    }

    .hours-collapse {
        overflow: hidden;
        max-height: 0;
        opacity: 0;
        transition: all 0.4s ease;
        visibility: hidden;
    }

    .hours-collapse.active {
        opacity: 1;
        visibility: visible;
        max-height: 800px;
    }

    .edit-hours-btn {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
        color: #fff;
        font-weight: 600;
        border: none;
        border-radius: 0.6rem;
        padding: 0.6rem 1.2rem;
        box-shadow: 0 6px 18px rgba(14, 165, 233, 0.25);
        cursor: pointer;
        transition: all 0.25s ease;
        position: relative;
        z-index: 5;

        /* Auto Width & Centered */
        width: auto;
        display: block;
        margin: 1rem auto 0 auto;
    }

    .edit-hours-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 22px rgba(20, 184, 166, 0.35);
    }

    .save-check {
        font-size: 1.1rem;
        margin-top: 0.6rem;
        color: var(--teal);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .day-editor.saved .save-check {
        opacity: 1;
    }


    .promo-card {
        position: relative;
        background: var(--bg-surface);
        border-radius: 1.25rem;
        padding: 2rem;
        margin-top: 2rem;
        box-shadow: 0 10px 35px rgba(14, 165, 233, 0.15),
            0 0 60px rgba(20, 184, 166, 0.1);
        overflow: hidden;
        border: 1px solid var(--border-subtle);
        transition: transform 0.3s ease, box-shadow 0.3s ease;
        backdrop-filter: blur(10px);

        /* Mobile Specific: Shrink & Center */
        max-width: 340px;
        width: 100%;
        margin: 2rem auto 1.5rem auto;
        padding: 1rem;
    }

    .promo-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 40px rgba(14, 165, 233, 0.25),
            0 0 70px rgba(20, 184, 166, 0.15);
    }

    .promo-card::before {
        content: "";
        position: absolute;
        inset: 0;
        background: radial-gradient(circle at top left, rgba(14, 165, 233, 0.15), transparent 60%),
            radial-gradient(circle at bottom right, rgba(20, 184, 166, 0.1), transparent 60%);
        animation: gradientMove 12s ease-in-out infinite alternate;
        opacity: 0.5;
        z-index: 0;
    }

    .promo-header {
        position: relative;
        z-index: 1;
        margin-bottom: 1.25rem;
        text-align: center;
    }

    .promo-header h3 {
        color: var(--text-main);
        font-size: 1.5rem;
        font-weight: 700;
        text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    }

    .promo-header p {
        color: var(--text-muted);
        font-size: 1rem;
        margin-top: 0.4rem;
    }

    .promo-body {
        position: relative;
        z-index: 1;
        display: flex;
        flex-direction: column;
        /* Stack on mobile default */
        width: 100%;
        gap: 1rem;
        align-items: center;
    }

    .promo-body input {
        flex: 1;
        /* min-width removed */
        width: 100%;
        padding: 0.9rem 1.2rem;
        border-radius: 0.75rem;
        border: 1.5px solid rgba(14, 165, 233, 0.2);
        background: var(--bg-input);
        color: var(--text-main);
        font-weight: 600;
        font-size: 1rem;
        letter-spacing: 0.3px;
        outline: none;
        transition: all 0.25s ease;
    }

    .promo-body input::placeholder {
        color: #94a3b8;
    }

    .promo-body input:focus {
        border-color: var(--sky-blue);
        box-shadow: 0 0 8px rgba(14, 165, 233, 0.25);
    }

    .promo-body button {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
        border: none;
        border-radius: 0.75rem;
        color: #fff;
        font-weight: 700;
        font-size: 1rem;
        padding: 0.9rem 1.5rem;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 8px 25px rgba(14, 165, 233, 0.25);

        /* Full Width CTA */
        width: 100%;
    }

    .promo-body button:hover {
        transform: scale(1.05);
        box-shadow: 0 12px 35px rgba(14, 165, 233, 0.35);
    }

    .promo-msg {
        margin-top: 1rem;
        font-size: 0.95rem;
        text-align: center;
        color: var(--teal);
        font-weight: 500;
    }

    /* Toast */
    .toast {
        position: fixed;
        bottom: 1.5rem;
        right: 1.5rem;
        background: var(--sky-blue);
        color: #fff;
        padding: 0.9rem 1.5rem;
        border-radius: 0.65rem;
        font-weight: 500;
        box-shadow: 0 8px 20px rgba(14, 165, 233, 0.3);
        opacity: 0;
        transform: translateY(20px);
        transition: opacity 0.4s ease, transform 0.4s ease;
        z-index: 1000;
    }

    .toast.show {
        opacity: 1;
        transform: translateY(0);
    }

    /* Upload Loading Overlay */
    .upload-overlay {
        position: fixed;
        inset: 0;
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(5px);
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease;
    }

    .upload-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    .spin-icon {
        width: 48px;
        height: 48px;
        border: 4px solid #e0f2fe;
        border-top: 4px solid var(--sky-blue);
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-bottom: 1rem;
    }

    @keyframes spin {
        0% {
            transform: rotate(0deg);
        }

        100% {
            transform: rotate(360deg);
        }
    }

    /* Upgrade Banner */
    .upgrade-banner {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
        color: #fff;
        padding: 1rem 1.5rem;
        border-radius: 0.75rem;
        margin-bottom: 1.5rem;
        text-align: center;
        font-weight: 500;

        /* Center Bottom Card */
        width: 100%;
        margin-left: auto;
        margin-right: auto;
        box-sizing: border-box;
        box-shadow: 0 8px 20px rgba(14, 165, 233, 0.25);
        animation: slideDown 0.5s ease-out;
    }

    .upgrade-banner a {
        color: #fff;
        text-decoration: underline;
        margin-left: 0.5rem;
        font-weight: 700;
    }

    .upgrade-banner a:hover {
        text-decoration: none;
        opacity: 0.9;
    }

    /* Premium Drop */
    #premiumDrop {
        overflow: hidden;
        transform: translateY(-10px);
        opacity: 0;
        max-height: 0;
        transition: all 0.5s ease;
    }

    #premiumDrop:not(.hidden) {
        opacity: 1;
        transform: translateY(0);
        max-height: 800px;
    }

    .premium-drop {
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.3);
        border-radius: 12px;
        padding: 1.5rem;
        margin-top: 1rem;
        animation: fadeIn 0.4s ease;
    }

    .plan-summary {
        background: rgba(255, 255, 255, 0.05);
        padding: 0.8rem;
        border-radius: 8px;
        margin-bottom: 1rem;
    }

    /* Video Thumb */
    video.media-thumb {
        width: 33%;
        aspect-ratio: 1 / 1;
        object-fit: cover;
        border-radius: 0.75rem;
        box-shadow: 0 4px 14px rgba(14, 165, 233, 0.15);
        transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.3s ease;
        background: #000;
        opacity: 0.95;
        will-change: transform;
        display: block;
    }

    video.media-thumb:hover {
        transform: scale(1.05);
        box-shadow: 0 6px 18px rgba(14, 165, 233, 0.3);
        opacity: 1;
    }

    /* Responsive Dashboard Specifics */
    /* Responsive Dashboard Specifics */
    @media (max-width: 768px) {
        .dashboard {
            padding: 2rem 1rem !important;
            /* 16px side padding - Enforced */
        }

        .table-scroll {
            max-height: 55vh;
            width: 100%;
            display: block;
            overflow-x: auto;
        }

        /* Insight Cards - Mobile Centered */
        .insight-card {
            text-align: center;
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
            box-sizing: border-box;
        }

        /* -----------------------------------------------------
       SMART SCHEDULE COMPONENT (Mobile)
       ----------------------------------------------------- */

        /* 1. Dynamic Row Limit: Show only first 4 appointments */
        .appointments-card tbody tr:nth-child(n+5) {
            display: none;
        }

        /* 2. Table-to-Card Conversion */
        .appointments-card table,
        .appointments-card thead,
        .appointments-card tbody,
        .appointments-card th,
        .appointments-card td,
        .appointments-card tr {
            display: block;
        }

        .appointments-card thead {
            display: none;
            /* Hide headers */
        }

        .appointments-card tr {
            margin-bottom: 1.5rem;
            /* Increased spacing */
            background: #f8fafc;
            border: 1px solid #e2e8f0;
            border-radius: 0.75rem;
            padding: 1rem;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
        }

        .appointments-card tr:last-child {
            margin-bottom: 0;
        }

        .appointments-card td {
            display: block;
            text-align: left;
            padding: 0.25rem 0;
            border: none;
            white-space: normal;
            /* Allow text wrap */
            position: relative;
        }

        /* Stack styling tweaks */
        /* Time (1st column) */
        .appointments-card td:nth-of-type(1) {
            font-weight: 700;
            color: var(--sky-blue);
            font-size: 1.1rem;
            margin-bottom: 0.2rem;
        }

        /* Client (2nd column) */
        .appointments-card td:nth-of-type(2) {
            font-size: 1.1rem;
            font-weight: 600;
            color: var(--text-dark);
        }

        /* Service/Other (subsequent) */
        .appointments-card td:nth-of-type(3),
        .appointments-card td:nth-of-type(4) {
            color: var(--muted);
            font-size: 0.95rem;
        }

        /* Button inside card */
        .appointments-card td:last-child {
            margin-top: 0.5rem;
        }

        .appointments-card td::before {
            content: attr(data-label);
            font-weight: 600;
            color: var(--muted);
            display: block;
            font-size: 0.85rem;
            margin-bottom: 0.25rem;
        }

        .appointments-card td button {
            width: 100%;
            /* Full width action button */
            padding: 0.8rem;
            /* Larger touch target */
            display: block;
        }

        /* -----------------------------------------------------
       DASHBOARD GRID OPTIMIZATION
       ----------------------------------------------------- */

        /* Stat Cards: Full Width & Box Sizing */
        .insight-card {
            width: 100%;
            box-sizing: border-box;
        }

        /* Tighten table rows on generic tables (if any remain) */
        .table th,
        .table td {
            padding: 0.5rem 0.75rem;
        }

        /* 2-Column Grid for Operating Hours Time Inputs */
        .time-inputs {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem;
            margin-top: 0.5rem;
        }

        .time-inputs span {
            display: none;
            /* Hide 'to' text/dash if needed, or make it grid item */
        }

        /* Adjust inputs for compact mode */
        .time-inputs input[type="time"] {
            width: 100%;
            padding: 0.4rem;
            font-size: 16px !important;
            /* redundant but safe */
        }

        /* Stack grids vertically */
        .insights-grid,
        .hours-grid {
            grid-template-columns: 1fr;
        }

        /* Show mobile CTA */
        .mobile-view-calendar-btn {
            display: block;
            text-align: center;
            margin-top: 1.5rem;
        }

        .mobile-view-calendar-btn button {
            padding: 1rem 2rem;
            font-size: 1rem;
        }
    }





    /* ==========================================================
   NEW FEATURES (Appended for Refinement)
   ========================================================== */

    /* Modern Copy Button */
    .copy-btn-modern {
        background: #fff;
        border: 1px solid rgba(14, 165, 233, 0.3);
        border-radius: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        font-weight: 600;
        color: var(--teal);
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        gap: 0.5rem;
        position: relative;
        overflow: hidden;
    }

    .copy-btn-modern:hover {
        background: var(--teal);
        color: #fff;
        box-shadow: 0 4px 12px rgba(20, 184, 166, 0.25);
        transform: translateY(-1px);
    }

    .copy-btn-modern.copied {
        background: #10b981;
        border-color: #10b981;
        color: #fff;
    }

    /* Hours Editor - Clean Row Layout */
    .hours-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
        margin-top: 1rem;
    }

    .hours-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        padding: 1rem 1.5rem;
        border-radius: 0.75rem;
        border: 1px solid rgba(14, 165, 233, 0.1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
        transition: all 0.2s ease;
    }

    .hours-row:hover {
        border-color: rgba(14, 165, 233, 0.3);
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.08);
    }

    .day-label {
        width: 80px;
        font-weight: 600;
        color: var(--text-dark);
        font-size: 1rem;
    }

    .day-actions {
        display: flex;
        align-items: center;
        gap: 1.5rem;
        flex: 1;
        justify-content: flex-end;
    }

    /* Custom Toggle Switch */
    .toggle-switch {
        display: inline-block;
        width: 44px;
        height: 24px;
        position: relative;
    }

    .toggle-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

    .slider {
        position: absolute;
        cursor: pointer;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: #cbd5e1;
        transition: .4s;
        border-radius: 24px;
    }

    .slider:before {
        position: absolute;
        content: "";
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
        background-color: white;
        transition: .4s;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    input:checked+.slider {
        background: linear-gradient(135deg, var(--sky-blue), var(--teal));
    }

    input:checked+.slider:before {
        transform: translateX(20px);
    }

    input:focus+.slider {
        box-shadow: 0 0 1px var(--sky-blue);
    }

    .time-range {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        opacity: 1;
        transition: opacity 0.3s ease;
    }

    .hours-row.closed .time-range {
        opacity: 0.3;
        pointer-events: none;
    }

    /* Calendar Modal Styles */
    .calendar-modal {
        display: none;
        position: fixed;
        z-index: 2000;
        inset: 0;
        background: rgba(15, 23, 42, 0.6);
        backdrop-filter: blur(4px);
        align-items: center;
        justify-content: center;
        padding: 1rem;
        animation: fadeIn 0.3s ease;
    }

    .calendar-modal.active {
        display: flex;
    }

    .calendar-content {
        background: #fff;
        width: 100%;
        max-width: 500px;
        border-radius: 1.5rem;
        padding: 2rem;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
        position: relative;
        animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }

    .calendar-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 1.5rem;
    }

    .calendar-header h2 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--text-dark);
    }

    .close-modal-btn {
        background: transparent;
        border: none;
        font-size: 1.5rem;
        color: var(--muted);
        cursor: pointer;
        line-height: 1;
    }

    /* Simple Calendar Grid */
    .cal-grid {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        gap: 0.5rem;
        text-align: center;
    }

    .cal-day-name {
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--muted);
        margin-bottom: 0.5rem;
    }

    .cal-day {
        aspect-ratio: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        font-size: 0.95rem;
        cursor: pointer;
        transition: all 0.2s;
        color: var(--text-dark);
    }

    .cal-day:hover:not(.empty) {
        background: #f1f5f9;
    }

    .cal-day.empty {
        cursor: default;
    }

    .cal-day.today {
        background: var(--sky-blue);
        color: white;
        font-weight: 600;
        box-shadow: 0 4px 10px rgba(14, 165, 233, 0.3);
    }

    .cal-day.has-event {
        position: relative;
    }

    .cal-day.has-event::after {
        content: "";
        position: absolute;
        bottom: 4px;
        width: 4px;
        height: 4px;
        border-radius: 50%;

        background: var(--teal);
    }

    /* ============================
   NEW CALENDAR ENHANCEMENTS
   ============================ */

    /* 1. Event Indicator Dots */
    .cal-dot {
        position: absolute;
        bottom: 6px;
        width: 5px;
        height: 5px;
        background: var(--teal);
        border-radius: 50%;
    }

    .cal-day.today .cal-dot {
        background: #fff;
        /* White dot on blue today circle */
    }

    /* 2. Selected Day Highlight */
    .cal-day.selected {
        background: #e2e8f0;
        /* Light gray selection */
        box-shadow: inset 0 0 0 2px var(--sky-blue);
        font-weight: 600;
    }

    .cal-day.today.selected {
        background: var(--sky-blue);
        box-shadow: inset 0 0 0 2px #fff;
    }

    /* 3. Day Detail Panel */
    .cal-details-panel {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
        border-top: 1px solid #f1f5f9;
        min-height: 100px;
        animation: fadeIn 0.3s ease;
    }

    .cal-details-header {
        font-size: 1.1rem;
        color: var(--text-dark);
        margin-bottom: 1rem;
        font-weight: 700;
    }

    .cal-empty-state {
        text-align: center;
        color: var(--muted);
        padding: 1.5rem 0;
        font-size: 0.95rem;
        background: #f8fafc;
        border-radius: 12px;
    }

    /* 4. Appointment List */
    .cal-appt-list {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        max-height: 250px;
        overflow-y: auto;
        padding-right: 4px;
        /* Space for scrollbar */
    }

    /* Scrollbar polish */
    .cal-appt-list::-webkit-scrollbar {
        width: 4px;
    }

    .cal-appt-list::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 4px;
    }

    .cal-appt-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: #fff;
        border: 1px solid #e2e8f0;
        padding: 0.75rem 1rem;
        border-radius: 12px;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    .cal-appt-item:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
        border-color: var(--sky-blue);
    }

    .cal-appt-time {
        font-weight: 700;
        color: var(--sky-blue);
        font-size: 0.95rem;
        min-width: 70px;
    }

    .cal-appt-info {
        flex: 1;
        margin: 0 1rem;
        text-align: left;
    }

    .cal-client-name {
        font-weight: 600;
        color: var(--text-dark);
        font-size: 0.95rem;
    }

    .cal-appt-status {
        font-size: 0.75rem;
        text-transform: uppercase;
        font-weight: 700;
        padding: 0.25rem 0.5rem;
        border-radius: 6px;
    }

    /* MODAL INPUTS (Larger & Easier) */
    .calendar-content input,
    .calendar-content select {
        font-size: 1.05rem !important;
        /* Larger text */
        padding: 0.9rem 1rem !important;
        /* Easy click target */
        transition: all 0.2s ease-in-out;
    }

    .calendar-content input:focus {
        transform: scale(1.01);
        /* Subtle zoom on focus */
        border-color: var(--sky-blue);
        box-shadow: 0 4px 12px rgba(14, 165, 233, 0.15);
    }

    /* Animation for Modal Open */
    @keyframes modalPop {
        0% {
            transform: scale(0.95);
            opacity: 0;
        }

        100% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .calendar-content {
        animation: modalPop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    /* ----------------------------------------------------------
       CALENDAR DARK MODE SUPPORT
       ---------------------------------------------------------- */
    [data-theme="dark"] .calendar-content {
        background: #1e293b;
        /* Slate 800 */
        color: #f1f5f9;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    }

    [data-theme="dark"] .calendar-header h2 {
        color: #f1f5f9;
        background: transparent;
    }

    [data-theme="dark"] .close-modal-btn {
        color: #94a3b8;
    }

    [data-theme="dark"] .cal-day {
        color: #e2e8f0;
    }

    [data-theme="dark"] .cal-day:hover:not(.empty) {
        background: #334155;
        /* Slate 700 */
    }

    [data-theme="dark"] .cal-day.selected {
        background: #334155;
        box-shadow: inset 0 0 0 2px var(--sky-blue);
    }

    [data-theme="dark"] .cal-details-panel {
        border-top-color: #334155;
    }

    [data-theme="dark"] .cal-details-header {
        color: #f1f5f9;
    }

    [data-theme="dark"] .cal-empty-state {
        background: #0f172a;
        /* Slate 900 */
        color: #64748b;
    }

    [data-theme="dark"] .cal-appt-item {
        background: #1e293b;
        border-color: #334155;
    }

    [data-theme="dark"] .cal-appt-item:hover {
        border-color: var(--sky-blue);
        background: #1e293b;
        /* Keep dark bg */
    }

    [data-theme="dark"] .cal-client-name {
        color: #f1f5f9;
    }

    [data-theme="dark"] .cal-appt-list::-webkit-scrollbar-thumb {
        background: #475569;
    }

    /* Mobile Tweak for Panel */
    @media (max-width: 480px) {
        .cal-appt-item {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.5rem;
        }

        .cal-appt-time {
            font-size: 1.1rem;
        }

        .cal-appt-info {
            margin: 0;
        }

        .cal-appt-status {
            align-self: flex-start;
        }
    }


    /* Mobile Fixes for New Layout */



    /* Mobile Appointments & Quick Actions */


    /* 900px Container Overrides (Tablet/Small Laptop) */
    @media (max-width: 900px) {

        /* Allow vertical stacking and natural flow */
        .dashboard,
        section.dashboard {
            /* Force natural flow */
            display: block !important;
            height: auto !important;
            min-height: 100vh !important;
            max-height: none !important;
            overflow-y: visible !important;
            /* Scroll vertically */
            overflow-x: hidden !important;
            /* No horizontal */
            padding-bottom: 3rem !important;
        }

        .dashboard-grid {
            /* If grid exists */
            display: flex !important;
            flex-direction: column !important;
        }

        .hours-card,
        .promo-card {
            margin-bottom: 2.5rem !important;
        }

        .hours-card {
            overflow: visible !important;
            height: auto !important;
            max-height: none !important;
        }
    }

    /* 640px Specifics (Large Mobile) */
    /* Mobile Layout (<600px) - The "Floating" Look */
    @media (max-width: 600px) {

        /* Force padding for floating effect */
        .dashboard {
            padding: 1rem 1.25rem !important;
        }

        /* TYPOGRAPHY SCALING FOR MOBILE */
        .dash-head h1,
        h1 {
            font-size: 1.75rem !important;
            /* Scale down from 2.5rem+ */
        }

        .dash-head p,
        p.lead {
            font-size: 1rem !important;
        }

        h2 {
            font-size: 1.35rem !important;
        }

        h3,
        .card h3 {
            font-size: 1.15rem !important;
            margin-bottom: 0.75rem !important;
        }

        /* Helper to ensure cards scale down but float */
        .central-card,
        .appointments-card,
        .hours-card,
        .promo-card,
        .card {
            width: auto !important;
            margin-left: 0 !important;
            margin-right: 0 !important;
            max-width: 100% !important;
            min-width: 0 !important;
            padding: 1.25rem 1rem !important;
            /* Tighter padding like auth pages */
            border-radius: 16px !important;
            /* Slightly smaller radius */
            box-sizing: border-box !important;
        }

        /* Tighter Buttons & Inputs */
        .btn,
        button,
        input,
        select {
            font-size: 0.95rem !important;
            padding: 0.85rem !important;
            /* Compact touch targets */
        }

        .dash-head {
            padding: 1.5rem 1rem !important;
            border-radius: 16px !important;
        }

        .dash-actions button,
        .dash-actions a {
            flex: 1 1 100%;
            text-align: center;
        }

        .hours-grid {
            grid-template-columns: 1fr;
            width: 100%;
        }

        .hours-row {
            flex-direction: column;
            align-items: flex-start;
            gap: 0.75rem;
            width: 100%;
        }

        .day-actions {
            width: 100%;
            justify-content: space-between;
            margin-top: 0.5rem;
        }

        .promo-body {
            flex-direction: column;
        }

        .promo-body button {
            width: 100%;
        }

        /* Mobile Appointments & Quick Actions */
        .desktop-appt-view {
            display: none !important;
        }

        .mobile-appt-view {
            display: block !important;
        }

        .quick-actions-mobile {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .quick-actions-mobile .qa-btn {
            width: 100%;
            justify-content: center;
            padding: 1rem;
        }
    }
}