:root {
    /* Colors */
    --primary-color: #d4a373;
    /* Gold/Beige */
    --primary-dark: #b08968;
    --text-color: #333333;
    --text-light: #666666;
    /* Soft Purple & Orange Theme (Migraine Friendly) */
    --primary-color: #9B59B6;
    /* Soft Purple (Amethyst) */
    --primary-hover: #8E44AD;
    --secondary-color: #F39C12;
    /* Warm Orange */
    --bg-color: #FDFBFD;
    /* Off-white with hint of purple */
    --sidebar-bg: #2C3E50;
    /* Dark Blue-Grey (kept for contrast) */
    --text-color: #4A4A4A;
    /* Soft Dark Gray (not black) */
    --border-color: #E0DAE0;
    --card-bg: #FFFFFF;
    --danger-color: #E74C3C;
    --success-color: #27AE60;
    --text-muted: #888888;
    --border-color-light: #f0f0f0;
    --bg-hover: #f1f1f1;
    --bg-input: #ffffff;

    /* Soften Shadows */
    --box-shadow: 0 4px 12px -2px rgba(155, 89, 182, 0.15);

    /* Legacy/Helper Mappings */
    --white: #ffffff;
    --bg-dark: var(--sidebar-bg);
    --bg-light: #f8f9fa;
    --error: var(--danger-color);
    --success: var(--success-color);

    /* Fonts */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;

    /* Spacing */
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
}

/* List Row Standardization */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    /* Slighly more compact */
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.list-row:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.list-row-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 2;
}

.list-row-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.list-row-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Dark Mode Overrides */
body.dark-mode {
    --primary-color: #AF7AC5;
    /* Lighter Purple for dark bg */
    --primary-hover: #C39BD3;
    --secondary-color: #F8C471;
    /* Softer Orange */
    --bg-color: #2C3E50;
    /* Dark Slate Base */
    --sidebar-bg: #1A252F;
    /* Darker Sidebar */
    --text-color: #ECF0F1;
    /* Soft White */
    --border-color: #4A6278;
    --card-bg: #34495E;
    /* Dark Grey Cards */
    --box-shadow: 0 4px 12px -2px rgba(0, 0, 0, 0.3);
    --text-muted: #BDC3C7;
    --border-color-light: #3E5871;
    --bg-hover: #3E5871;
    --bg-input: #2C3E50;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    /* Global base font size for consistency */
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* Smooth transition */
}

/* Update Inputs for Dark Mode */
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea {
    background-color: #2C3E50;
    color: var(--text-color);
    border-color: var(--border-color);
}

body.dark-mode .modal-content {
    background-color: var(--card-bg);
}

/* Dashboard Layout */
.dashboard-body {
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-color);
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-width: 260px;
    max-width: 260px;
    flex: 0 0 260px;
    background-color: var(--bg-dark);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.5rem 0.5rem 8px;
    flex-shrink: 0;
    transition: all 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 0.85rem;
    /* Force consistent sidebar font size across all pages */
}

.sidebar-header {
    margin-bottom: 0.5rem;
    text-align: left !important;
    /* Force left alignment */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.5rem;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    /* Override inline center */
    padding-left: 8px !important;
    /* Left align icon */
    gap: 10px !important;
    /* Space between icon and text */
}

/* Ensure button has no extra margin */
.sidebar-header button {
    margin: 0 !important;
    padding: 0 !important;
    width: 24px;
    /* Fix width to ensure stability */
    text-align: center;
}

/* Sidebar Collapsed State */
body.sidebar-collapsed .sidebar {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    flex: 0 0 80px;
    /* Added flex rule for smooth transition */
}

body.sidebar-collapsed .dashboard-main {
    margin-left: 0;
    /* Changed from margin-left 80px since sidebar is flex item */
}

body.sidebar-collapsed .sidebar-header {
    flex-direction: column;
    gap: 0;
}

/* Only hide labels/buttons on desktop collapsed sidebar */
@media (min-width: 1025px) {

    body.sidebar-collapsed .logo-text,
    body.sidebar-collapsed .label,
    body.sidebar-collapsed .sidebar-footer button {
        display: none;
    }

    body.sidebar-collapsed .menu-item {
        padding: 5px 8px;
        justify-content: flex-start;
    }

    body.sidebar-collapsed .menu-item .icon {
        margin-right: 0;
    }

    /* Footer & Collapsed State Handling */
    body.sidebar-collapsed .sidebar-footer {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    body.sidebar-collapsed .sidebar-footer button {
        font-size: 0;
        padding: 0.5rem;
    }

    body.sidebar-collapsed .sidebar-footer button::first-letter {
        font-size: 1.2rem;
    }
}

/* Sidebar Menu Item */
.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: rgba(255, 255, 255, 0.7);
    margin: 2px 10px 2px 0;
    border-radius: 0 25px 25px 0;
    position: relative;
    font-weight: 500;
}

.menu-item:hover {
    color: var(--white);
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    background-color: var(--primary-color);
    color: var(--white);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
    position: relative;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 4px;
    background-color: var(--white);
    border-radius: 0 4px 4px 0;
}

/* Day Selector Pill Shape */
.week-nav-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--text-muted);
}

.week-nav-btn.active {
    background: var(--primary-color) !important;
    color: #fff !important;
    border-radius: 50px !important; /* Pill Shape */
    padding: 0.6rem 1.2rem !important;
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.3);
    font-weight: bold;
    transform: translateY(-1px);
}

.week-nav-btn.active .day-name,
.week-nav-btn.active .day-date {
    color: #fff !important;
}

/* FAB - Floating Action Button */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #8e44ad; /* Vibrant Violet */
    color: #fff;
    border: none;
    padding: 14px 28px;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 8px 25px rgba(142, 68, 173, 0.4);
    cursor: pointer;
    z-index: 2000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 8px;
}

.fab-btn:hover {
    transform: scale(1.08) translateY(-5px);
    box-shadow: 0 12px 30px rgba(142, 68, 173, 0.5);
    background: #9b59b6;
}

/* Interactive Grid Hover */
.slot-click-area {
    transition: background-color 0.2s ease;
}

.slot-click-area:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
    position: relative;
}

.slot-click-area:hover::after {
    content: '+';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    color: rgba(155, 89, 182, 0.3);
    font-weight: 300;
}

/* Icons */
.menu-item .icon {
    margin-right: 12px;
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    display: flex;
    justify-content: center;
}

/* PRO Badge */
.badge-pro {
    background: linear-gradient(135deg, #FFD700, #F39C12);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    margin-left: auto;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.3);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

body.sidebar-collapsed .badge-pro {
    display: none;
}

/* Main Dashboard Content */
.dashboard-main {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    overflow-x: hidden;
    margin-left: 0;
    transition: margin-left 0.3s;
    min-width: 0;
    font-size: 0.9rem;
    /* Consistent content font size across all pages */
}

/* Dashboard Header - Standardized across all pages */
/* Dashboard Header - Standardized across all pages */
.dashboard-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
    width: 100%;
    /* Ensure full width */
}

.dashboard-header>div {
    width: 100%;
    /* Ensure rows take full width */
    flex-wrap: wrap;
    /* Allow wrapping */
}

.dashboard-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-color);
    flex: 1;
    /* Allow title to shrink/grow */
    min-width: 200px;
}

/* Header Right Section */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    /* Push to right on desktop */
}

@media (max-width: 1024px) {
    .dashboard-header {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .dashboard-header>div:first-child {
        flex-wrap: nowrap;
        gap: 0.5rem;
        align-items: center;
        padding-left: 3.5rem;
    }

    .dashboard-header h2 {
        font-size: 0.95rem;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: 700;
    }

    .header-right {
        width: auto;
        justify-content: flex-end;
        margin-left: auto;
    }

    /* Controls Row on Mobile */
    .dashboard-header>div:last-child {
        flex-direction: column;
        align-items: stretch !important;
        /* Stack controls vertically */
        gap: 0.5rem;
    }

    /* Left Controls (View Toggle, Filter, Agenda Nav) */
    .dashboard-header>div:last-child>div:first-child {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center !important;
        width: 100%;
        gap: 0.5rem !important;
        padding-left: 3.5rem;
    }

    .agenda-controls {
        width: auto;
        justify-content: center;
        gap: 0.3rem;
        /* Spread buttons */
    }

    .agenda-controls button {
        flex: 1;
        /* Equal width buttons */
        display: flex;
        justify-content: center;
    }

    /* Week Nav Container */
    #weekNavContainer {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 5px;
        /* Space for scrollbar */
        justify-content: flex-start;
        /* Start align to allow scroll */
    }

    /* Right Action Buttons (Sync, Search, etc) */
    .dashboard-header>div:last-child>div:last-child {
        width: 100%;
        justify-content: center !important;
        gap: 0.5rem;
    }
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 0.8rem 1rem; /* Reduced padding */
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 20px rgba(155, 89, 182, 0.05); /* Soft Purple Shadow */
    display: flex;
    flex-direction: column;
    gap: 0.3rem; /* Reduced gap */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(155, 89, 182, 0.1);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.35rem; /* Slightly smaller for density */
    font-weight: 700;
    color: var(--text-color);
}

.stat-card small {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

/* Service Row Refactor */
.service-row {
    display: grid;
    grid-template-columns: 50px 2fr 1fr 1fr 1fr 1.2fr 80px;
    padding: 0.65rem 1rem; /* Reduced padding for elegance */
    border-bottom: 1px solid var(--border-color-light);
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}

.service-row:hover {
    background: var(--bg-hover);
}

.svc-icon-circle {
    width: 45px;
    height: 45px;
    min-width: 45px; /* Force fixed size */
    aspect-ratio: 1/1;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: bold;
    font-size: 1rem;
}

.svc-name {
    font-weight: 600;
    color: var(--text-color);
}

.svc-price {
    font-weight: 700;
    color: var(--primary-color);
}

.svc-duration-mobile,
.svc-duration-hint-mobile {
    display: none;
}

.row-actions button {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: opacity 0.2s;
}

.row-actions button:hover {
    opacity: 0.7;
}

.action-btn-edit { color: #2196F3; }
.action-btn-delete { color: #dc3545; }

/* Mobile Services List (< 768px) */
@media (max-width: 767px) {
    #servicesTableHeader,
    #packagesTableHeader {
        display: none !important;
    }

    .service-row {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        gap: 0.8rem !important;
        padding: 0.6rem 0.5rem !important; /* Reduced mobile padding */
    }

    .row-border-wrap {
        flex-shrink: 0;
    }

    .svc-icon-circle {
        width: 45px;
        height: 45px;
        min-width: 45px;
        aspect-ratio: 1/1;
        font-size: 0.9rem;
    }

    .svc-info {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .svc-name {
        font-size: 0.95rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .svc-price-wrap {
        text-align: right;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 1px;
    }

    .svc-price {
        font-size: 1rem;
    }

    .svc-duration-hint-mobile {
        display: block;
        font-size: 0.75rem;
        color: var(--text-muted);
    }

    /* Hide unnecessary desktop columns */
    .svc-duration-desktop,
    .svc-cost,
    .svc-category {
        display: none !important;
    }

    .row-actions {
        display: flex !important;
        gap: 0.4rem;
        margin-left: 0.2rem;
    }

    .row-actions button {
        font-size: 0.95rem;
    }

    /* Scaling Top Buttons -15% */
    .billing-top-bar #btnAddService,
    .billing-top-bar #btnCategorias {
        font-size: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    .dashboard-stats {
        display: none !important; /* Hide main stats on mobile as requested */
    }
    
    .header-mini-stats {
        display: flex !important; /* Show mini stats instead */
    }

    .stat-card {
        padding: 0.6rem;
        gap: 0.2rem;
    }

    .stat-icon {
        font-size: 1.2rem;
    }

    .stat-label {
        font-size: 0.7rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }

    /* Scaling icons by 20% down on Mobile */
    .dashboard-header .btn-nav, 
    .dashboard-header .btn-icon {
        transform: scale(0.85); /* ~20% reduction */
        margin: -2px; /* Tighten space */
    }

    .dashboard-header {
        gap: 0.2rem !important; /* Tighten row spacing */
        margin-bottom: 0.5rem;
        padding-bottom: 0.3rem;
    }

    .dashboard-header > div {
        flex-wrap: nowrap !important;
    }

    .header-right {
        gap: 0.5rem !important;
    }

    .agenda-container {
        margin-top: 0 !important;
    }
}

.stat-card .stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    margin-top: 0.3rem;
}

.stat-card .text-warning {
    color: #F39C12;
}

.stat-card .text-success {
    color: #27AE60;
}

.stat-card .text-danger {
    color: #E74C3C;
}

/* Table Container & Compact Table */
.table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    padding: 0;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    /* Reduced font size */
}

th,
td {
    padding: 0.75rem 1rem;
    /* Reduced padding */
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--bg-light);
    font-weight: 600;
    color: var(--text-dark);
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Status Badges */
.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
}

.status.confirmado {
    background-color: #dbfdc8;
    color: #2e7d32;
}

.status.pendente {
    background-color: #fff3cd;
    color: #856404;
}

.status.cancelado {
    background-color: #f8d7da;
    color: #721c24;
}

/* Action Buttons */
.actions {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
    border-radius: 50%;
    transition: background-color 0.2s;
    /* Removed margin-right: 10px */
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-edit {
    color: var(--primary-color);
}

.btn-delete {
    color: var(--danger-color);
}


@media (max-width: 1024px) {
    .dashboard-body {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    /* Tablet/Mobile: Sidebar is off-canvas drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -240px;
        width: 240px;
        min-width: 240px;
        max-width: 240px;
        height: 100vh;
        height: 100dvh;
        display: flex;
        flex-direction: column;
        z-index: 1100;
        transition: left 0.35s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth native feel */
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
        background-color: var(--bg-dark);
        padding-top: 0;
        padding-bottom: 0;
        overflow-y: auto;
        overflow-x: hidden;
    }

    body.sidebar-mobile-open .sidebar {
        left: 0; /* Slide in from the left */
    }

    .sidebar .sidebar-header {
        flex-shrink: 0;
    }

    .sidebar .sidebar-menu {
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        flex: none;
        gap: 0 !important;
    }

    .sidebar .sidebar-footer {
        flex-shrink: 0;
        display: block;
        padding: 0.3rem 0.8rem;
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        background-color: var(--bg-dark);
    }

    .sidebar .sidebar-footer .logout-btn {
        width: 100%;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        text-align: center;
    }

    /* Sidebar header â€” proper spacing so â˜° toggle inside doesn't overlap */
    .sidebar .sidebar-header {
        padding: 0.3rem 0.8rem !important;
        margin-top: 0;
    }

    /* (duplicate left:0 removed â€” already handled above) */

    /* Hide mobile hamburger when sidebar is open (it's behind the sidebar anyway) */
    body.sidebar-mobile-open #mobileSidebarToggle {
        display: none !important;
    }

    .dashboard-main {
        margin-left: 0;
        padding: 0.5rem;
        /* Reduced padding for compact mobile view */
        padding-top: 0.5rem;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        flex: 1;
        width: 100%;
        padding-bottom: 100px;
    }

    /* Show mobile hamburger */
    #mobileSidebarToggle {
        display: block !important;
        z-index: 1200;
    }

    /* Hide desktop sidebar toggle */
    #sidebarToggle {
        display: none !important;
    }

    /* Mobile Hamburger compensation */
    .dashboard-header {
        padding-top: 0.5rem !important; /* Removed huge top padding, moved up next to hamburger */
    }

    .billing-top-bar,
    .expenses-top-bar,
    .prof-tabs-container,
    .dashboard-main>div:first-child {
        padding-top: 2.5rem;
    }

    /* â•â•â• Mobile Light Sidebar Theme â•â•â• */
    .sidebar {
        background-color: #ffffff !important;
        box-shadow: 4px 0 30px rgba(0, 0, 0, 0.12);
    }

    body.dark-mode .sidebar {
        background-color: #1e1e2e !important;
    }

    .sidebar .sidebar-header {
        border-bottom: 1px solid #f0f0f0;
        padding: 0.2rem 0.8rem !important;
        margin-bottom: 0 !important;
    }

    body.dark-mode .sidebar .sidebar-header {
        border-bottom-color: #333;
    }

    .sidebar .logo-text {
        color: var(--primary-color) !important;
    }

    .sidebar .menu-item {
        color: #4A4A4A !important;
        margin: 0 !important;
        border-radius: 0 !important;
        padding: 0 14px !important;
        border-bottom: none !important;
        opacity: 1 !important;
        font-weight: 500;
        font-size: 0.82rem;
        min-height: auto;
    }

    body.dark-mode .sidebar .menu-item {
        color: #ddd !important;
    }

    .sidebar .menu-item .icon {
        color: var(--primary-color) !important;
        margin-right: 10px !important;
        font-size: 1rem !important;
    }

    .sidebar .menu-item .label {
        color: inherit !important;
    }

    .sidebar .menu-item:hover {
        background-color: #f8f4fc !important;
        color: var(--primary-color) !important;
    }

    body.dark-mode .sidebar .menu-item:hover {
        background-color: rgba(155, 89, 182, 0.15) !important;
    }

    .sidebar .menu-item.active {
        background-color: var(--primary-color) !important;
        color: #fff !important;
        box-shadow: none !important;
        border-bottom-color: var(--primary-color);
    }

    .sidebar .menu-item.active .icon {
        color: #fff !important;
    }

    .sidebar .sidebar-section-label {
        color: #999 !important;
        border-bottom: none !important;
        padding: 2px 14px 0px !important;
        font-size: 0.65rem !important;
        margin-top: 0 !important;
    }

    body.dark-mode .sidebar .sidebar-section-label {
        color: #777 !important;
    }

    /* Remove the gap above ConfiguraÃ§Ãµes/Suporte on mobile */
    .sidebar .sidebar-menu:last-of-type {
        margin-top: 0 !important;
    }

    .sidebar .sidebar-footer {
        background-color: #ffffff !important;
        border-top: 1px solid #f0f0f0 !important;
        padding: 0.15rem 0.8rem !important;
        gap: 0 !important;
        margin-top: 0 !important;
    }

    body.dark-mode .sidebar .sidebar-footer {
        background-color: #1e1e2e !important;
        border-top-color: #333 !important;
    }

    .sidebar .logout-btn {
        background: transparent !important;
        color: #E74C3C !important;
        font-weight: 600;
        text-align: left !important;
        padding: 2px 8px !important;
        font-size: 0.82rem !important;
    }

    .sidebar .logout-btn:hover {
        background: #fdf0f0 !important;
    }

    body.dark-mode .sidebar .logout-btn:hover {
        background: rgba(231, 76, 60, 0.15) !important;
    }

    .sidebar .badge-pro {
        display: none !important;
    }
}




.logo-text {
    font-family: var(--font-heading);
    color: var(--primary-color);
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
    /* Minimal gap to eliminate scrollbar */
}

/* Sidebar Section Label */
.sidebar-section-label {
    padding: 0.3rem 0.8rem !important;
    font-size: 0.65rem !important;
    color: #8899aa;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.3rem !important;
}

/* Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.logout-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    text-align: left;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: var(--primary-hover);
}

.menu-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 5px 8px;
    font-size: 0.85rem;
    margin-bottom: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.7;
    white-space: nowrap;
    text-align: left;
}

.menu-item:hover,
.menu-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 1;
}

.menu-item .icon {
    margin-right: 0.8rem;
    font-size: 1.1rem;
}

/* Dashboard Content */
.dashboard-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: var(--spacing-md);
}

/* (duplicate .dashboard-header removed - canonical definition at line 276) */

.header-left {
    display: flex;
    align-items: center;
    /* Fix alignment */
    gap: 1.5rem;
}

.revenue-display {
    background: var(--bg-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    border: 1px solid #e1e1e1;
    margin-right: 1.5rem;
}

.revenue-display .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}

.revenue-display .value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #28a745;
    /* Green for money */
}

.theme-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.theme-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

body.dark-mode .theme-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.view-toggle {
    display: flex;
    background: #e9ecef;
    padding: 3px;
    border-radius: 6px;
    width: fit-content;
}

.toggle-btn {
    background: transparent;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--white);
    color: var(--primary-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Client Management */
.client-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
    border: 1px solid var(--border-color);
}

.client-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.client-avatar-placeholder {
    width: 45px;
    height: 45px;
    background: var(--bg-color);
    color: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin: 0 auto 0.8rem;
}

.history-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
}

.history-item:last-child {
    border-bottom: none;
}

/* Stock & Marketing */
.stock-alert {
    color: var(--danger-color);
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-icon-action {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-icon-action:hover {
    background: var(--bg-color);
    border-color: var(--primary-color);
}

.btn-whatsapp {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

/* Pix Status Traffic Light Colors */
.status-pill {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    line-height: 1;
}
.status-pix-waiting {
    background: #fff8e1;
    color: #fbc02d;
    border: 1px solid #fbc02d;
}
.status-pix-paid {
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #27ae60;
}
.status-default {
    background: #f5f5f5;
    color: #777;
    border: 1px solid #ddd;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

/* Reports Styles */
.reports-container {
    max-width: 800px;
    margin: 0 auto;
}

.report-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.ranking-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.ranking-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rank-info {
    display: flex;
    justify-content: space-between;
    font-weight: 500;
}

.rank-bar-bg {
    height: 12px;
    background: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
}

.rank-bar-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 6px;
    transition: width 1s ease-in-out;
}

/* Agenda View */
.agenda-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.date-navigation {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav,
.btn-today {
    border: 2px solid var(--primary-color);
    background: transparent;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
    transition: all 0.2s;
}

.btn-nav:hover,
.btn-today:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-today {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agenda-table-container {
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.agenda-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    /* Important for equal width columns in week view */
}

/* Standardize layout containers */


.agenda-table th,
.agenda-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

/* Week View Overrides */
.agenda-table th {
    background-color: var(--white);
    /* Cleaner look for week headers */
    color: var(--text-light);
    border: none;
    /* Removed borders as requested */
    font-weight: normal;
    text-transform: uppercase;
    font-size: 0.85rem;
    padding-bottom: 0.5rem;
}

.time-header {
    width: 60px;
    /* Small width for time column */
    text-align: right;
    padding-right: 1rem;
}

.header-today {
    color: var(--primary-color) !important;
    font-weight: bold !important;
}

.week-cell {
    border: 1px solid #f0f0f0;
    /* Subtle grid lines */
    padding: 0.25rem;
    vertical-align: top;
    height: 60px;
    /* Min height for cells */
}

.week-cell.empty {
    background-color: transparent;
}

/* ... */

/* Day View (Default) Styles restore */
#view-agenda:not(.week-mode) .agenda-table th {
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}


/* Controls Row */
.controls-row {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-primary-sm {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.btn-primary-sm:hover {
    background-color: var(--primary-hover);
}

.btn-danger {
    background-color: #dc3545;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--white);
    color: #333;
    padding: 2rem;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* Ensure all modal form elements have readable text */
.modal-content input,
.modal-content select,
.modal-content textarea {
    color: #333;
    background-color: #fff;
}

.modal-content label {
    color: #555;
}

.modal-content h2,
.modal-content h3 {
    color: #333;
}

.modal-content option {
    color: #333;
    background-color: #fff;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #888;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.modal-footer {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.time-slot {
    font-weight: bold;
    color: var(--text-color);
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.status-badge.confirmado {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success);
}

.status-badge.pendente {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.livre {
    background-color: #f8f9fa;
    color: #6c757d;
    border: 1px solid #dee2e6;
}

.row-free {
    background-color: #fcfcfc;
    color: #aaa;
}

.row-free td {
    color: #999;
}

.row-free:hover {
    background-color: var(--primary-light);
    /* Or slightly darker gray */
    cursor: pointer;
}

.week-cell.empty:hover {
    background-color: #f0f0f0;
    cursor: pointer;
}

/* Login Layout */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #fdfbfb 0%, #ebedee 100%);
}

.login-container {
    background: var(--white);
    padding: 3rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-header {
    margin-bottom: 2rem;
}

.logo {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
        width: 90%;
    }

    .logo {
        font-size: 2rem;
    }
}

/* Form Styles */
.form-group {
    margin-bottom: var(--spacing-md);
    text-align: left;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
}

.shake {
    animation: shake 0.5s;
}

@keyframes shake {
    0% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    50% {
        transform: translateX(5px);
    }

    75% {
        transform: translateX(-5px);
    }

    100% {
        transform: translateX(0);
    }
}

.form-input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Button Borders & Theme Consistency */
.btn-primary,
.btn-secondary,
.btn-nav,
.btn-today,
.toggle-btn,
.btn-whatsapp {
    border: 2px solid var(--primary-color) !important;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    padding: 0.8rem 1.5rem;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover) !important;
}

/* (duplicate .dashboard-header removed - canonical definition near top of file) */

/* Ensure header text is light in dark mode */
body.dark-mode .dashboard-header {
    color: var(--text-color) !important;
}

.btn-block {
    width: 100%;
}

.primary-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Week Navigation Bar */
.week-nav-bar {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0;
    padding: 0;
    overflow-x: auto;
}

.week-nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 50px;
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-light);
}

.week-nav-btn:hover {
    border-color: var(--primary-color);
    background: rgba(155, 89, 182, 0.05);
    /* very light purple */
    color: var(--primary-color);
}

.week-nav-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px rgba(155, 89, 182, 0.3);
}

.week-nav-btn .day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    margin-bottom: 2px;
}

.week-nav-btn .day-date {
    font-weight: bold;
    font-size: 0.9rem;
}

.error-message {
    color: var(--error);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
    background-color: rgba(220, 53, 69, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
}

.hidden {
    display: none;
}

.login-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #999;
}

/* Mini Calendar Popup */
.calendar-popup {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    background: var(--card-bg, #fff);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    min-width: 280px;
    margin-top: 0.5rem;
}

.calendar-popup.hidden {
    display: none;
}

.calendar-popup .calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: bold;
    color: var(--text-color);
}

.calendar-popup .cal-nav {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.calendar-popup .calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.calendar-popup .cal-day-header {
    text-align: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: var(--text-light);
    padding: 0.25rem;
}

.calendar-popup .cal-day {
    text-align: center;
    padding: 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.calendar-popup .cal-day:hover {
    background: var(--primary-color);
    color: white;
}

.calendar-popup .cal-day.today {
    background: rgba(155, 89, 182, 0.2);
    font-weight: bold;
}

.calendar-popup .cal-day.selected {
    background: var(--primary-color);
    color: white;
}

.calendar-popup .cal-day.other-month {
    color: var(--text-light);
    opacity: 0.5;
}

/* Birthday Popup */
.birthday-popup {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1000;
    background: var(--card-bg, #fff);
    border: 1px solid var(--primary-color);
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    padding: 1rem;
    min-width: 280px;
    max-width: 350px;
    margin-top: 0.5rem;
}

.birthday-popup.hidden {
    display: none;
}

.birthday-popup h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.birthday-list {
    max-height: 250px;
    overflow-y: auto;
}

.birthday-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm, 4px);
    margin-bottom: 0.5rem;
    background: rgba(155, 89, 182, 0.1);
}

.birthday-item:last-child {
    margin-bottom: 0;
}

.birthday-item .birthday-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.birthday-item .birthday-info {
    flex: 1;
}

.birthday-item .birthday-name {
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-color);
}

.birthday-item .birthday-date {
    font-size: 0.75rem;
    color: var(--text-light);
}

.birthday-empty {
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
    padding: 1rem;
}

/* Report Modal Styles */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.radio-label,
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-color);
}

.radio-label input[type="radio"],
.checkbox-label input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.checkbox-group.vertical {
    flex-direction: column;
    gap: 0.75rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.report-more-options {
    margin-top: 1rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.expand-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.expand-btn:hover {
    color: var(--primary-dark);
}

.expand-icon {
    transition: transform 0.2s;
    display: inline-block;
}

.expand-btn.expanded .expand-icon {
    transform: rotate(90deg);
}

.advanced-options {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(155, 89, 182, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(155, 89, 182, 0.2);
}

.advanced-options.hidden {
    display: none;
}

.advanced-options .form-group {
    margin-bottom: 1rem;
}

.advanced-options .form-group:last-child {
    margin-bottom: 0;
}

/* Modal Tabs */
.modal-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-light);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: bold;
}

.tab-pane {
    display: none;
    padding: 0.5rem 0;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Search Popup */
.search-popup {
    position: absolute;
    top: 100%;
    right: 0;
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    z-index: 1000;
    margin-top: 0.5rem;
}

.search-popup h4 {
    margin: 0 0 1rem 0;
    color: var(--primary-color);
    font-size: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.search-input-wrapper {
    margin-bottom: 1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-color);
    font-family: inherit;
}

.search-results-list {
    max-height: 250px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-hover);
}

.search-result-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.search-result-client {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 0.1rem;
}

.search-result-service {
    font-size: 0.8rem;
    color: var(--primary-color);
}

.search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* --- Comanda Refactor --- */
.comanda-header-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
}

.btn-big-plus {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 10px rgba(0, 123, 255, 0.3);
}

.btn-big-plus:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.status-toggle-group {
    display: flex;
    background: var(--bg-light);
    padding: 0.3rem;
    border-radius: 8px;
    gap: 0.3rem;
}

.toggle-btn-status {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.toggle-btn-status.active {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

body.dark-mode .toggle-btn-status.active {
    background: var(--bg-input);
    color: var(--primary-color);
}

.btn-success {
    background-color: #27ae60;
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-success:hover {
    background-color: #219150;
}

.summary-details {
    padding: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    border: 1px solid var(--border-color-light);
}

.summary-details span {
    font-weight: 500;
}

body.dark-mode .summary-details {
    background: var(--bg-input);
}

.dropdown-results {
    position: absolute;
    z-index: 1005;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 100%;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

/* Stats Grid & Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card small {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-color);
}

.text-warning {
    color: #f39c12;
}

.text-success {
    color: #27ae60;
}

.text-danger {
    color: #e74c3c;
}

body.dark-mode .dropdown-results {
    background: var(--bg-input);
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.comanda-items-list {
    margin-top: 1rem;
    background: var(--bg-light);
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color-light);
}

body.dark-mode .comanda-items-list {
    background: var(--bg-input);
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

/* Client Tabs */
.client-tabs-header {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.tab-item {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
    padding-bottom: 0.5rem;
    opacity: 0.6;
    transition: all 0.2s;
    font-weight: 500;
}

.tab-item:hover {
    opacity: 1;
}

.tab-item.active {
    color: var(--primary-color);
    font-weight: bold;
    border-bottom: 2px solid var(--primary-color);
    opacity: 1;
}

/* Header Inputs */
.search-wrapper input:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

/* Sub-Navigation Tabs */
.sub-tab-item {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-light);
    /* Gray for inactive */
    cursor: pointer;
    padding-bottom: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    /* Overlap border */
}

.sub-tab-item:hover {
    color: var(--primary-color);
}

.sub-tab-item.active {
    color: var(--primary-color);
    /* Purple/Primary */
    border-bottom: 2px solid var(--primary-color);
}

/* Info Box */
.info-box {
    background-color: #e3f2fd;
    /* Light Blue */
    color: #1565c0;
    /* Dark Blue */
    padding: 1rem;
    border-radius: 4px;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    font-size: 0.9rem;
    position: relative;
}

.info-box .btn-close-info {
    background: #fff;
    border: 1px solid #90caf9;
    color: #1565c0;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.info-box .btn-close-info:hover {
    background: #f5f5f5;
}

/* Filter Row */
.filter-row {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-row label {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.filter-row select {
    margin-top: 0.5rem;
    min-width: 250px;
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--text-color);
    border: none;
    border-bottom: 1px solid #ddd;
    background: transparent;
    cursor: pointer;
}

.filter-row select:focus {
    outline: none;
    border-bottom-color: var(--primary-color);
}

/* Warning Text */
.warning-text {
    color: #f57c00;
    /* Orange */
    font-weight: 500;
    font-size: 1rem;
}

/* Appointment Block Selection & Actions */
.appointment-block {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.appointment-block.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--primary-color), 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 100 !important;
    transform: scale(1.02);
}

.appointment-action-buttons {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    gap: 8px;
    background: rgba(255, 255, 255, 0.9);
    padding: 6px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 101;
}

.appointment-block.selected .appointment-action-buttons {
    display: flex;
}

.appt-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: transform 0.2s;
    border: none;
    color: white;
}

.appt-action-btn:hover {
    transform: scale(1.1);
}

/* Specific Colors for Actions */
.btn-action-whatsapp {
    background: #25D366;
}

.btn-action-reminder {
    background: #E67E22;
}

.btn-action-edit {
    background: #9B59B6;
}

.btn-action-delete {
    background: #E74C3C;
}

/* Modal Styles Refinements */
#appointmentDetailsModal .modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.details-actions .action-item:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    transition: all 0.2s;
}

.details-list .detail-row:last-child {
    border-bottom: none;
}

/* ========== EXPENSES PAGE (DESPESAS) ========== */

.expenses-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.expenses-top-left {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.expenses-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: 1px;
    margin: 0;
}

.expenses-period-toggle {
    display: flex;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.period-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.period-btn.active {
    background: var(--primary-color);
    color: #fff;
    font-weight: 600;
}

.expenses-month-selector {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.expenses-month-selector label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.expenses-month-selector input {
    padding: 0.4rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    color: var(--text-color);
    background: var(--card-bg);
}

.expenses-top-right {
    display: flex;
    gap: 1rem;
}

.expenses-action-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--primary-color);
    transition: background 0.2s;
}

.expenses-action-btn:hover {
    background: rgba(155, 89, 182, 0.1);
}

.expenses-action-btn.primary {
    background: var(--primary-color);
    color: #fff;
}

.expenses-action-btn.primary:hover {
    background: var(--primary-hover);
}

/* Filters Row */
.expenses-filters {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px 8px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    flex-wrap: wrap;
    gap: 1rem;
}

.expenses-filter-tabs {
    display: flex;
    gap: 0.5rem;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    color: var(--text-muted);
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-tab.active {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

.expenses-search-group {
    display: flex;
    gap: 1rem;
    flex: 1;
    max-width: 600px;
}

.expenses-search-field {
    position: relative;
    flex: 1;
}

.expenses-search-field input {
    width: 100%;
    padding: 0.5rem 0.5rem 0.5rem 2.2rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background: var(--bg-light);
    color: var(--text-color);
}

.search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.expenses-total {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.expenses-total strong {
    color: var(--text-color);
    font-size: 1rem;
}

/* Table */
.expenses-table-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow-x: auto;
}

.expenses-table {
    width: 100%;
    border-collapse: collapse;
}

.expenses-table th,
.expenses-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: var(--text-color);
}

.expenses-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.expenses-table th.sortable {
    cursor: pointer;
}

.expenses-table tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .expenses-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Badges */
.badge-fixed {
    background: #00b894;
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-auto {
    color: #3498db;
    font-size: 0.8rem;
    font-style: italic;
}

/* Pagination */
.expenses-pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.expenses-pagination select {
    padding: 0.2rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--card-bg);
    color: var(--text-color);
}

.pagination-btn {
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
}

/* ========== EXPENSE MATERIAL MODAL ========== */

.material-modal {
    padding: 0;
    max-width: 500px;
    border-radius: 12px;
    overflow: hidden;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
}

.material-modal-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: #fff;
    /* border-bottom: 1px solid #eee; */
}

.back-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c5ce7;
    font-weight: bold;
}

.material-modal-header h2 {
    font-size: 1.2rem;
    color: #333;
    margin: 0;
}

#expenseForm {
    padding: 0 2rem 2rem;
}

/* Type Toggles */
.expense-type-toggles {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.type-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    color: #888;
    transition: all 0.3s;
}

.type-btn[data-type="Regular"].active {
    background: #3c40c6;
    color: #fff;
    border-color: #3c40c6;
}

.type-btn[data-type="Fixa"] {
    color: #00b894;
    border-color: #00b894;
}

.type-btn[data-type="Fixa"].active {
    background: #00b894;
    color: #fff;
}

.type-btn[data-type="Parcelada"] {
    color: #ffa502;
    border-color: #ffa502;
}

.type-btn[data-type="Parcelada"].active {
    background: #ffa502;
    color: #fff;
}

/* Status Toggle Switch */
.expense-status-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.status-label {
    font-size: 0.9rem;
    color: #333;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: #2ecc71;
}

input:focus+.slider {
    box-shadow: 0 0 1px #2ecc71;
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Material Inputs */
.material-form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.material-form-group label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.material-input {
    width: 100%;
    padding: 0.5rem 0;
    border: none;
    border-bottom: 1px solid #ddd;
    outline: none;
    font-size: 1rem;
    color: #333;
    transition: border-color 0.3s;
    background: transparent;
}

.material-input:focus {
    border-bottom-color: #6c5ce7;
}

.material-modal-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
}

.material-save-btn {
    padding: 0.8rem 2rem;
    background: #e0e0e0;
    color: #888;
    border: none;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.3s;
}

.material-save-btn:hover,
form:valid .material-save-btn {
    background: #6c5ce7;
    /* Or gray if disabled by logic, but CSS :valid trick works nicely */
    color: #fff;
}


.billing-top-bar {
    margin-bottom: 1.5rem;
}

.billing-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    margin: 0 0 1rem 0;

    letter-spacing: 1px;
}

.billing-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}

.billing-search {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.billing-search label {
    font-size: 0.8rem;
    color: var(--text-color);
    font-weight: 600;
}

.billing-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.billing-search-input-wrap .form-input {
    width: 320px;
    padding: 0.5rem 2rem 0.5rem 0.8rem;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--card-bg);
    color: var(--text-color);
}

.billing-search-arrow {
    position: absolute;
    right: 10px;
    color: var(--text-muted, #999);
    font-size: 0.7rem;
    pointer-events: none;
}

.billing-total-receber {
    font-size: 0.9rem;
    color: var(--text-color);
    white-space: nowrap;
}

.billing-total-receber strong {
    color: var(--text-color);
    font-size: 1rem;
}

.billing-table-container {
    width: 100%;
    overflow-x: auto;
    background: var(--card-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.billing-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.billing-table thead th {
    padding: 0.7rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-color);
    border-bottom: 2px solid var(--border-color);
    background: var(--card-bg);
}

/* Client Header Row */
.billing-client-header {
    background: #2c3444;
    cursor: pointer;
    transition: background 0.2s;
}

.billing-client-header:hover {
    background: #353d4e;
}

.billing-client-header td {
    padding: 0.6rem 0.8rem;
    color: #fff;
    font-weight: 500;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.billing-toggle {
    text-align: center;
    font-size: 0.7rem;
    color: #aab;
    width: 30px;
}

.billing-client-name {
    font-weight: 600;
}

.billing-client-total {
    text-align: right;
    color: #e74c7c;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
}

.billing-client-actions {
    text-align: center;
}

.billing-delete-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.billing-delete-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Service Detail Rows */
.billing-service-row td {
    padding: 0.5rem 0.8rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.82rem;
}

.billing-service-row:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .billing-service-row:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.billing-not-paid {
    color: #e74c3c;
    font-weight: 600;
}

/* â”€â”€ Mobile Billing Redesign (Vertical Cards) â”€â”€ */
@media (max-width: 768px) {
    /* Global Reset for Zero Scroll */
    *, *:before, *:after {
        box-sizing: border-box !important;
    }

    .dashboard-main {
        padding: 5px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        margin: 0 !important;
    }

    /* Filters and Controls */
    .billing-top-bar {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 0 5px !important;
    }

    .billing-controls {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .billing-search {
        width: 100% !important;
    }

    .billing-search-input-wrap .form-input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }

    .billing-controls .btn-secondary,
    .billing-total-receber {
        align-self: flex-start !important;
        margin: 0 !important;
        padding: 5px 0 !important;
        width: 100% !important;
        text-align: left !important;
    }

    .billing-table-container {
        border: none;
        background: transparent;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: hidden !important;
    }

    .billing-table {
        display: block;
        width: 100% !important;
    }

    .billing-table thead {
        display: none;
    }

    .billing-table tbody {
        display: block;
        padding: 0;
        width: 100% !important;
    }

    /* Client Card Container */
    .billing-client-header {
        display: flex !important;
        flex-direction: column !important;
        background: #fff !important;
        margin: 0 0 2px 0 !important;
        border-radius: 12px 12px 0 0 !important;
        padding: 12px 10px !important;
        border: 1px solid var(--border-color) !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
        color: var(--text-color) !important;
        position: relative;
        width: 100% !important;
        min-width: 0 !important;
    }

    .billing-client-header td {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        border: none !important;
        background: none !important;
        white-space: normal !important;
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    .billing-client-header .billing-client-name {
        order: 1;
        font-size: 0.95rem !important;
        font-weight: 800 !important;
        margin-bottom: 5px;
        color: var(--primary-color) !important;
        padding-right: 40px !important;
        word-break: break-all !important;
        overflow-wrap: anywhere !important;
    }

    .billing-client-header .billing-client-total {
        order: 2;
        text-align: left !important;
        font-size: 0.85rem !important;
        font-weight: 700 !important;
        color: #e67e22 !important;
        width: 100% !important;
        display: block !important;
    }

    .billing-client-header .billing-toggle {
        display: none !important;
    }

    .billing-client-header .billing-client-actions {
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto !important;
    }

    /* Service Detail List (The "Floating" area) */
    .billing-service-row {
        display: block !important;
        background: #fff !important;
        margin-bottom: 15px !important;
        padding: 10px !important;
        border: 1px solid var(--border-color) !important;
        border-top: none !important;
        border-radius: 0 0 12px 12px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04) !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    .billing-service-row td {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: flex-start !important;
        padding: 8px 0 !important;
        border-bottom: 1px solid var(--border-color-light) !important;
        font-size: 0.8rem !important;
        width: 100% !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .billing-service-row td:last-child {
        border-bottom: none !important;
    }

    .billing-service-row td:before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 0.65rem;
        text-transform: uppercase;
        margin-right: 10px;
        flex: 0 0 80px !important;
        text-align: left !important;
    }

    .billing-service-row td {
        text-align: right !important;
    }

    /* Column Grouping - Service and Price */
    .billing-service-row td[data-label="ServiÃ§o"] {
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }
    
    .billing-service-row td[data-label="PreÃ§o"] {
        padding-top: 5px !important;
        margin-bottom: 5px;
        color: var(--primary-color) !important;
        font-weight: 700;
    }

    #billingGroupedBody td {
        min-width: 0 !important; 
    }

    .billing-service-row .status-pill {
        transform: scale(0.8);
        transform-origin: right;
        margin: 0;
    }

    /* Actions row alignment */
    .billing-service-row td[data-label="AÃ§Ãµes"] {
        justify-content: flex-end !important;
    }
}

/* â”€â”€ Billing Detail Modal â”€â”€ */
.billing-detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1100;
}

.billing-detail-overlay.hidden {
    display: none;
}

.billing-detail-panel {
    background: #fff;
    color: #333;
    width: 92%;
    max-width: 480px;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
    animation: bdSlideUp 0.25s ease;
}

@keyframes bdSlideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.billing-detail-icons {
    display: flex;
    justify-content: center;
    gap: 2.5rem;
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.billing-detail-icons .bd-icon-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 0.75rem;
    color: #555;
    transition: color 0.2s;
}

.billing-detail-icons .bd-icon-btn:hover {
    color: var(--primary-color, #9b59b6);
}

.billing-detail-icons .bd-icon-btn .bd-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.bd-icon-whats .bd-icon-circle {
    background: #25d366;
    color: #fff;
}

.bd-icon-lembrete .bd-icon-circle {
    background: #27ae60;
    color: #fff;
}

.billing-detail-body {
    padding: 0.8rem 1.2rem;
}

.bd-row {
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.bd-row:last-child {
    border-bottom: none;
}

.bd-row-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f3e8ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    color: #9b59b6;
}

.bd-row-content {
    flex: 1;
    min-width: 0;
}

.bd-row-content .bd-label {
    font-size: 0.8rem;
    color: #333;
    font-weight: 500;
}

.bd-row-content .bd-value {
    font-size: 0.75rem;
    color: #888;
    margin-top: 1px;
}

.bd-row-chevron {
    font-size: 0.7rem;
    color: #ccc;
    align-self: center;
    cursor: pointer;
}

.bd-row.clickable {
    cursor: pointer;
    transition: background 0.15s;
}

.bd-row.clickable:hover {
    background: #faf6ff;
    border-radius: 6px;
}

.bd-total-row {
    padding: 0.7rem 0;
    border-top: 1px solid #eee;
}

.bd-total-label {
    font-size: 0.8rem;
    color: #333;
}

.bd-total-value {
    font-size: 0.8rem;
    font-weight: 600;
}

.bd-total-owing {
    color: #e74c3c;
}

.billing-detail-actions {
    padding: 0.8rem 1.2rem 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.bd-btn-payment {
    width: 100%;
    padding: 0.75rem;
    background: var(--primary-color, #9b59b6);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.bd-btn-payment:hover {
    filter: brightness(1.1);
}

.bd-actions-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.bd-link-remove {
    font-size: 0.8rem;
    color: var(--primary-color, #9b59b6);
    cursor: pointer;
    border: none;
    background: none;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.bd-link-recibo {
    font-size: 0.8rem;
    color: #555;
    cursor: pointer;
    border: none;
    background: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.bd-link-close {
    font-size: 0.85rem;
    color: var(--primary-color, #9b59b6);
    cursor: pointer;
    border: none;
    background: none;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 0.3rem 0;
}

/* â”€â”€ Sub-Modals (WhatsApp, Lembrete, Desconto, Status) â”€â”€ */
.bd-sub-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

.bd-sub-overlay.hidden {
    display: none;
}

.bd-sub-panel {
    background: #fff;
    color: #333;
    width: 88%;
    max-width: 400px;
    border-radius: 10px;
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.2);
    padding: 1.2rem;
    animation: bdSlideUp 0.2s ease;
}

.bd-sub-panel h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    margin: 0 0 1rem;
}

/* WhatsApp sub-modal */
.bd-chat-option {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 0.5rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.85rem;
    color: #333;
}

.bd-chat-option:hover {
    background: #f5f5f5;
}

.bd-chat-option .bd-chat-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* Lembrete sub-modal */
.bd-lembrete-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 0.7rem;
    font-size: 0.78rem;
    color: #856404;
    margin-bottom: 0.8rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.bd-lembrete-options {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin: 1rem 0;
}

.bd-lembrete-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 2px solid #eee;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    font-size: 0.8rem;
    color: #555;
    background: none;
}

.bd-lembrete-card:hover,
.bd-lembrete-card.selected {
    border-color: var(--primary-color, #9b59b6);
    background: #faf6ff;
}

.bd-lembrete-card .bd-lembrete-icon {
    font-size: 2rem;
    color: var(--primary-color, #9b59b6);
}

.bd-lembrete-hint {
    font-size: 0.72rem;
    color: #999;
    text-align: center;
    margin-top: 0.5rem;
}

/* Discount sub-modal */
.bd-discount-toggle {
    display: flex;
    border: 2px solid var(--primary-color, #9b59b6);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.8rem;
}

.bd-discount-toggle button {
    flex: 1;
    padding: 0.5rem;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
    background: #fff;
    color: var(--primary-color, #9b59b6);
}

.bd-discount-toggle button.active {
    background: var(--primary-color, #9b59b6);
    color: #fff;
}

.bd-discount-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.bd-discount-summary {
    font-size: 0.85rem;
    color: #555;
}

.bd-discount-summary .bd-discount-line {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}

.bd-discount-summary .bd-total-line {
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    border-top: 1px solid #eee;
    padding-top: 0.5rem;
    margin-top: 0.3rem;
}

/* Status sub-modal */
.bd-status-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.bd-status-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 0.3rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    font-size: 0.88rem;
    color: #333;
    transition: background 0.15s;
}

.bd-status-list li:hover {
    background: #faf6ff;
}

.bd-status-list li:last-child {
    border-bottom: none;
}

.bd-status-radio {
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s;
}

.bd-status-radio.selected {
    border-color: var(--primary-color, #9b59b6);
}

.bd-status-radio.selected::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--primary-color, #9b59b6);
    border-radius: 50%;
}

/* Sub-modal footer buttons */
.bd-sub-footer {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    margin-top: 1rem;
}

.bd-sub-btn {
    flex: 1;
    padding: 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.bd-sub-btn-cancel {
    background: #fff;
    border: 1px solid #ddd;
    color: var(--primary-color, #9b59b6);
}

.bd-sub-btn-save {
    background: var(--primary-color, #9b59b6);
    border: none;
    color: #fff;
}

.bd-sub-btn-save:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Clickable billing rows */
.billing-service-row.clickable-row {
    cursor: pointer;
}

.billing-service-row.clickable-row:hover {
    background: rgba(155, 89, 182, 0.05) !important;
}

/* â”€â”€ Payment History Sub-Modal â”€â”€ */
.bd-payhistory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.bd-payhistory-header h3 {
    margin: 0;
}

.bd-payhistory-add-btn {
    padding: 0.4rem 0.8rem;
    border: 2px solid #27ae60;
    color: #27ae60;
    background: #fff;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.bd-payhistory-add-btn:hover {
    background: #27ae60;
    color: #fff;
}

.bd-payhistory-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
    color: #333;
}

.bd-payhistory-list {
    min-height: 40px;
    padding: 0.5rem 0;
}

.bd-payhistory-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.3rem;
    border-bottom: 1px solid #f5f5f5;
    font-size: 0.82rem;
    color: #555;
}

.bd-payhistory-item:last-child {
    border-bottom: none;
}

.bd-payhistory-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bd-payhistory-item-method {
    font-size: 0.72rem;
    color: #999;
}

.bd-payhistory-item-amount {
    font-weight: 600;
    color: #27ae60;
}

/* â”€â”€ Novo Pagamento Form â”€â”€ */
.bd-novo-form {
    margin-bottom: 0.5rem;
}

.bd-form-field {
    margin-bottom: 1rem;
}

.bd-form-label {
    display: block;
    font-size: 0.78rem;
    color: #999;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.bd-form-input {
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: none;
    border-bottom: 2px solid #eee;
    font-size: 0.9rem;
    color: #333;
    background: transparent;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bd-form-input:focus {
    border-bottom-color: var(--primary-color, #9b59b6);
}

.bd-form-select {
    width: 100%;
    padding: 0.65rem 0.7rem;
    border: none;
    border-bottom: 2px solid #eee;
    font-size: 0.9rem;
    color: #333;
    background: transparent;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23999' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    transition: border-color 0.2s;
}

.bd-form-select:focus {
    border-bottom-color: var(--primary-color, #9b59b6);
}

.bd-input-with-icon {
    position: relative;
}

.bd-input-with-icon .bd-input-icon {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    pointer-events: none;
}

.bd-novo-remaining {
    text-align: right;
    font-size: 0.82rem;
    color: #888;
    margin-top: 0.3rem;
}


/* Ajuste para telas menores (Responsividade) */
@media (max-width: 768px) {
    .sidebar-menu {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }

}


/* ========== PROFESSIONALS PAGE ========== */

.prof-tabs-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 0;
    /* Tabs sit on toolbar or just above */
    padding-bottom: 0;
    border-bottom: 2px solid #eee;
    background: #fff;
    /* Ensure it looks clean */
    padding-left: 2rem;
    padding-top: 1rem;
}

.prof-tab {
    background: none;
    border: none;
    padding: 1rem 0;
    font-size: 0.9rem;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    text-transform: uppercase;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.3s;
}

.prof-tab:hover {
    color: var(--primary-color);
}

.prof-tab.active {
    color: var(--primary-color);
}

.prof-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-color);
}

.prof-toolbar {
    background: #fff;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 0;
    /* Connected to table */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.prof-search {
    position: relative;
    width: 350px;
}

.prof-search input {
    width: 100%;
    padding: 0.6rem 0.6rem 0.6rem 2.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.prof-search input:focus {
    border-color: var(--primary-color);
}

.prof-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
}

.prof-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-upgrade {
    background: #fff;
    border: 1px solid #2ecc71;
    color: #2ecc71;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-upgrade:hover {
    background: #2ecc71;
    color: #fff;
}

.prof-table-container {
    background: #fff;
    padding: 0;
}

.prof-table {
    width: 100%;
    border-collapse: collapse;
}

.prof-table th {
    text-align: left;
    padding: 1rem 2rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #666;
    border-bottom: 1px solid #eee;
    background: #f9f9f9;
    font-weight: 700;
}

.prof-table td {
    padding: 1rem 2rem;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
    font-size: 0.9rem;
    color: #333;
}

.prof-avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ccc;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    text-transform: uppercase;
}

.prof-status-active {
    background: #d4edda;
    color: #155724;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.prof-status-inactive {
    background: #f8d7da;
    color: #721c24;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.prof-pagination {
    background: #fff;
    padding: 1rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: #666;
    border-top: 1px solid #eee;
}

.prof-pagination select {
    padding: 0.2rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* ========== UPGRADE MODAL ========== */
.upgrade-plan-btn {
    width: 100%;
    background: #9c27b0;
    color: #fff;
    border: none;
    padding: 1rem;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-transform: uppercase;
    box-shadow: 0 4px 6px rgba(156, 39, 176, 0.2);
}

.upgrade-plan-btn:hover {
    background: #7b1fa2;
    transform: translateY(-2px);
}

.upgrade-plan-btn:active {
    transform: translateY(0);
}

.upgrade-badge {
    background: #00e676;
    /* Bright Teal/Green */
    color: #004d40;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.95rem;
    /* Slightly larger */
    margin: 0 0.3rem;
    display: inline-block;
    vertical-align: middle;
}

/* ========== COMMISSIONS SUB-TABS ========== */
.comm-sub-tab {
    background: none;
    border: none;
    padding: 1rem 0;
    font-size: 0.9rem;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    text-transform: uppercase;
    position: relative;
    border-bottom: 3px solid transparent;
    transition: all 0.3s;
}

.comm-sub-tab.active {
    color: #9c27b0;
    /* Purple */
    border-bottom-color: #9c27b0;
}

/* ========== DATE RANGE PICKER ========== */
.date-picker-modal {
    display: flex;
    padding: 0 !important;
    /* Override default modal padding */
}

.date-preset-btn {
    background: none;
    border: none;
    padding: 1rem 1.5rem;
    text-align: left;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    outline: none;
}

.date-preset-btn:hover {
    background: #f5f5f5;
}

.date-preset-btn.active {
    color: #2196f3;
    background: #e3f2fd;
    border-left-color: #2196f3;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    /* Slight gap */
    margin-top: 0.5rem;
}

.cal-days-header {
    display: contents;
}

.cal-days-header span {
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    padding-bottom: 0.5rem;
}

.cal-day {
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 50%;
    /* Default circle for hover */
    position: relative;
    z-index: 1;
}

.cal-day:hover {
    background: #f0f0f0;
}

.cal-day.other-month {
    color: #ddd;
    /* Optional: disable interaction */
}

/* Range Styles */
.cal-day.in-range::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: -2px;
    /* cover gap */
    right: -2px;
    background: #e3f2fd;
    z-index: -1;
}

.cal-day.start-range::before {
    left: 50%;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.cal-day.end-range::before {
    right: 50%;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.cal-day.start-range {
    background: #2196f3;
    color: #fff;
}

.cal-day.end-range {
    background: #2196f3;
    color: #fff;
}

.cal-day.start-range.end-range::before {
    display: none;
    /* Single day selection */
}

.cal-nav-btn {
    background: none;
    border: 1px solid #eee;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    color: #555;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.cal-nav-btn:hover {
    background: #f5f5f5;
}

.cal-month-label {
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}


/* Commission Filter Modal */
.comm-filter-options {
    display: flex;
    flex-direction: column;
}

.comm-filter-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.comm-filter-option:last-child {
    border-bottom: none;
}

.comm-filter-option:hover {
    background: #f9f9f9;
}

.comm-filter-option.active {
    background: #e8f5e9;
    /* Light Green */
}

/* Check Icon Logic */
.comm-filter-option .check-icon {
    width: 24px;
    height: 24px;
    border: 2px solid #ccc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    /* Hide checkmark by default */
    font-size: 0.9rem;
}

.comm-filter-option.active .check-icon {
    border-color: #4caf50;
    background: #4caf50;
    color: #fff;
    /* Show checkmark */
}

/* Reset specific styles in HTML if needed, but CSS class handles most */

/* Responsive Styles */
@media (max-width: 768px) {

    /* Main Content */
    .dashboard-main,
    body.sidebar-collapsed .dashboard-main {
        margin-left: 0 !important;
        width: 100%;
        padding: 1rem;
        padding-top: 4rem;
        /* Space for mobile toggle */
    }

    /* Ensure Toggle Button is Visible */
    #mobileSidebarToggle {
        display: block !important;
    }

    /* --- Expenses Page --- */
    .expenses-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .expenses-top-left {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        width: 100%;
    }

    .expenses-period-toggle {
        width: 100%;
    }

    .period-btn {
        flex: 1;
        text-align: center;
    }

    .expenses-month-selector {
        width: 100%;
    }

    .expenses-month-selector input {
        width: 100%;
    }

    .expenses-top-right {
        flex-direction: column;
        width: 100%;
    }

    .expenses-action-btn {
        width: 100%;
    }

    /* Filters */
    .expenses-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .expenses-filter-tabs {
        width: 100%;
    }

    .filter-tab {
        flex: 1;
        text-align: center;
    }

    .expenses-search-group {
        flex-direction: column;
        width: 100%;
    }

    /* Table */
    .expenses-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .expenses-table th,
    .expenses-table td {
        white-space: nowrap;
        padding: 0.8rem 0.5rem;
    }

    /* Reduce font sizes slightly */
    .expenses-title {
        font-size: 1.2rem;
    }

    /* Pagination */
    .expenses-pagination {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
}

/* Force hide header logout button globally */
.logout-btn-header,
#btnLogoutHeader {
    display: none !important;
}

/* ==========================================
   COMPREHENSIVE RESPONSIVE STYLES
   ==========================================*/

/* --- Login Page Responsive --- */
@media (max-width: 600px) {
    .login-container {
        margin: 1rem;
        padding: 1.5rem;
        max-width: 100%;
        border-radius: 12px;
    }

    .login-header h1.logo {
        font-size: 2rem;
    }

    .login-subtitle {
        font-size: 0.85rem;
    }

    .login-form {
        padding: 0;
    }

    .form-input {
        font-size: 1rem;
        padding: 0.75rem;
    }

    .btn-primary.btn-block {
        font-size: 1rem;
        padding: 0.85rem;
    }
}

/* --- Mobile Styles (â‰¤768px) â€” COMPACT LAYOUT --- */
@media (max-width: 768px) {

    /* Mobile hamburger visibility */
    #mobileSidebarToggle {
        display: block !important;
    }

    /* Dashboard main */
    .dashboard-main {
        padding: 0.5rem;
        padding-top: 0 !important;
        padding-bottom: 90px;
    }

    /* ========== DASHBOARD HEADER â€” COMPACT ========== */
    .dashboard-header {
        padding: 0 !important;
        padding-top: 0.2rem !important;
        gap: 0.3rem !important;
        margin-top: 0 !important;
        margin-bottom: 0.3rem !important;
        flex-direction: column !important;
        align-items: stretch !important;
        border-bottom: 1px solid var(--border-color);
    }

    /* Top row: date left, theme+sair right â€” force horizontal ONLY for agenda */
    .dashboard-header:has(#currentDateDisplay)>div:first-child {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: flex-start !important;
        padding: 0 0.25rem;
        padding-left: 3.5rem !important;
    }

    /* For all other pages (Services, Clients, Stock), let them stack nicely */
    .dashboard-header:not(:has(#currentDateDisplay))>div:first-child {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
        padding: 0 0.5rem !important;
        padding-top: 3.5rem !important; /* Space for absolute hamburger menu */
    }

    /* Force every row inside the header to wrap gracefully */
    .dashboard-header:not(:has(#currentDateDisplay)) div {
        flex-wrap: wrap !important;
    }
    
    .dashboard-header:not(:has(#currentDateDisplay))>div:first-child > div {
        justify-content: flex-start !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }

    /* Target search control rows specifically */
    .dashboard-header:not(:has(#currentDateDisplay)) div[id$="Controls"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.8rem !important;
    }
    
    /* Make search wrappers fill mobile screens */
    .dashboard-header:not(:has(#currentDateDisplay)) .search-wrapper,
    .dashboard-header:not(:has(#currentDateDisplay)) input[type="text"] {
        max-width: 100% !important;
        width: 100% !important;
    }

    .dashboard-header:not(:has(#currentDateDisplay)) button[id^="btn"] {
        flex: 1;
        text-align: center;
        min-width: 140px;
    }

    .dashboard-header h2 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Hide "Sair" button text on mobile, keep icon only */
    #headerLogoutBtn .logout-text,
    #headerLogoutBtn span.logout-text {
        display: none;
    }

    #headerLogoutBtn {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.85rem !important;
        min-width: auto !important;
    }

    /* ========== CONTROLS ROW â€” COMPACT ICON BAR ========== */
    .dashboard-header>div:nth-child(2) {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.25rem !important;
        padding: 0 0.25rem;
    }

    /* First sub-row: Controls container */
    .dashboard-header>div:nth-child(2)>div:first-child {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        gap: 0.3rem !important;
        width: 100% !important;
        flex: none !important;
        padding-left: 3.5rem !important;
    }

    /* View toggle (Dia/Semana) â€” compact inline */
    .view-toggle {
        order: 1;
        width: auto;
        flex-shrink: 0;
    }

    .toggle-btn {
        padding: 0.3rem 0.75rem;
        font-size: 0.8rem;
        min-height: 32px;
    }

    /* Hide "Ocultar Ocupados" on mobile â€” too verbose */
    div:has(> #hideOccupiedFilter) {
        display: none !important;
    }

    /* Agenda controls (â® HOJE â¯ ðŸ“…) â€” compact */
    .agenda-controls {
        order: 2;
        width: auto !important;
        margin: 0 !important;
        gap: 0.2rem !important;
        flex-shrink: 0;
    }

    .btn-nav {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.85rem !important;
        min-height: 32px;
        min-width: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hide "HOJE" button text in header â€” we have floating bottom version */
    .btn-today {
        display: none !important;
    }

    /* ========== WEEK NAV â€” INLINE PROMINENT ========== */
    .week-nav-bar,
    #weekNavContainer {
        order: 3;
        width: 100% !important;
        flex: none !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 !important;
        padding: 0.2rem 0 !important;
        justify-content: center;
    }

    /* ========== ACTION ICONS ROW â€” COMPACT CENTERED ========== */
    .dashboard-header>div:nth-child(2)>div:last-child {
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
        width: 100% !important;
        flex: none !important;
        order: 4;
        padding: 0.15rem 0;
    }

    /* Action buttons (Sync, Birthday, Search, Report) â€” icon only style */
    #syncBtn,
    #birthdayBtn,
    #searchBtn,
    #reportBtn {
        padding: 0.3rem !important;
        font-size: 1.1rem !important;
        min-width: 36px;
        min-height: 36px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: var(--primary-color, #9B59B6) !important;
        color: white !important;
        border: none !important;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    }

    /* ========== PROFESSIONAL FILTER â€” COMPACT ========== */
    #profFilter {
        min-width: 0 !important;
        width: 100%;
        font-size: 0.85rem;
    }

    /* ========== TIMELINE â€” MAXIMIZE SPACE ========== */
    .agenda-container {
        height: auto !important;
        flex: 1;
    }

    .timeline-container {
        height: auto !important;
        overflow-y: visible !important;
    }

    .time-column {
        width: 48px !important;
        font-size: 0.75rem;
    }

    /* Appointment cards in timeline */
    .appointment-card,
    .timeline-appointment {
        font-size: 0.75rem !important;
        padding: 2px 4px !important;
    }

    .appointment-card .appt-text,
    .timeline-appointment span {
        font-size: 0.7rem;
    }

    /* ========== FLOATING BOTTOM BUTTONS ========== */
    #mobileFloatingBar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        display: flex !important;
        align-items: center;
        justify-content: center;
        padding: 0.75rem 1rem;
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
        z-index: 1000;
        gap: 1rem;
        pointer-events: none;
    }

    #mobileFloatingBar>* {
        pointer-events: auto;
    }

    #mobileTodayBtn {
        background: var(--card-bg, #fff);
        color: var(--primary-color, #9B59B6);
        border: 2px solid var(--primary-color, #9B59B6);
        padding: 0.6rem 2rem;
        border-radius: 24px;
        font-weight: 700;
        font-size: 0.9rem;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        transition: all 0.2s;
    }

    #mobileTodayBtn:active {
        transform: scale(0.95);
    }

    #mobileFabBtn {
        background: var(--primary-color, #9B59B6);
        color: #fff;
        border: none;
        width: 52px;
        height: 52px;
        border-radius: 50%;
        font-size: 1.6rem;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(155, 89, 182, 0.4);
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        position: absolute;
        right: 1rem;
        bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
    }

    #mobileFabBtn:active {
        transform: scale(0.9);
    }

    /* ========== STATS GRID ========== */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    .stat-card {
        padding: 0.75rem;
    }

    .stat-card small {
        font-size: 0.65rem;
    }

    .stat-card .stat-value {
        font-size: 1rem;
    }

    /* ========== GENERAL MOBILE COMPONENTS ========== */

    /* Tables */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 0.8rem;
    }

    th,
    td {
        padding: 0.5rem;
        white-space: nowrap;
    }

    /* Card grids â€” single column */
    .clients-grid,
    .services-grid,
    .stock-grid,
    .comandas-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* List rows */
    .list-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .list-row .actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Modals: full-screen on mobile */
    .modal-content {
        max-width: 100% !important;
        width: 100% !important;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0 !important;
        margin: 0;
        overflow-y: auto;
    }

    .modal {
        align-items: flex-start;
        padding: 0;
    }

    /* Revenue display */
    .revenue-display {
        margin-right: 0;
        padding: 0.4rem 0.8rem;
    }

    .revenue-display .value {
        font-size: 1rem;
    }

    /* Client cards */
    .client-card {
        padding: 0.75rem;
    }

    .client-avatar-placeholder {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }

    /* Forms in modals */
    form[style*="padding: 1.2rem 1.5rem"] {
        padding: 1rem !important;
    }

    /* Comma modal items row */
    div[style*="display: flex; gap: 1rem; margin-bottom: 1rem; align-items: flex-end"] {
        flex-wrap: wrap;
    }

    /* Button groups in modals */
    div[style*="display: flex; justify-content: space-between"][style*="padding-top: 1rem"],
    div[style*="display: flex; justify-content: space-between"][style*="border-top"] {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    /* User profile in header */
    .user-profile {
        display: none;
    }

    /* Calendar popup */
    .calendar-popup {
        left: 0 !important;
        right: auto;
        width: 280px;
    }

    /* Search popup */
    .search-popup {
        left: 0 !important;
        right: 0 !important;
        width: auto;
        min-width: 250px;
    }

    /* Birthday popup */
    .birthday-popup {
        left: 0 !important;
        right: 0 !important;
        width: auto;
    }

    /* Reports */
    .reports-container {
        max-width: 100%;
    }

    .report-card {
        padding: 1rem;
    }

    /* Performance cards */
    .perf-grid {
        grid-template-columns: 1fr !important;
    }

    /* Commission filter modal */
    .comm-filter-modal {
        width: 90% !important;
        min-width: 0 !important;
    }

    /* Settings page */
    .settings-grid {
        grid-template-columns: 1fr !important;
    }

    /* Billing grouped cards */
    .billing-client-card {
        padding: 0.75rem;
    }

    /* Header right buttons */
    .header-right {
        gap: 0.3rem !important;
    }

    /* ========== BILLING PAGE â€” MOBILE ========== */
    .billing-top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .billing-controls {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .billing-search {
        width: 100% !important;
    }

    .billing-search-input-wrap {
        width: 100% !important;
    }

    .billing-total-receber {
        text-align: center;
        font-size: 0.9rem;
    }

    .billing-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .billing-table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    /* ========== EXPENSES PAGE â€” MOBILE ========== */
    .expenses-top-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.75rem !important;
    }

    .expenses-top-left {
        width: 100% !important;
    }

    .expenses-top-right {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
    }

    .expenses-top-right .expenses-action-btn {
        flex: 1;
        min-width: 0;
        font-size: 0.7rem !important;
        padding: 0.5rem 0.4rem !important;
        white-space: nowrap;
    }

    .expenses-filters {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .expenses-filter-tabs {
        width: 100% !important;
        display: flex !important;
    }

    .expenses-filter-tabs .filter-tab {
        flex: 1;
        text-align: center;
        font-size: 0.75rem !important;
    }

    .expenses-search-group {
        flex-direction: column !important;
        gap: 0.4rem !important;
        width: 100% !important;
    }

    .expenses-search-field {
        width: 100% !important;
    }

    .expenses-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .expenses-table {
        font-size: 0.8rem;
        min-width: 500px;
    }

    .expenses-period-toggle {
        display: flex !important;
        width: 100%;
    }

    .expenses-period-toggle .period-btn {
        flex: 1;
        text-align: center;
        font-size: 0.8rem;
    }

    .expenses-month-selector {
        width: 100%;
    }

    .expenses-pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center !important;
        font-size: 0.8rem;
    }

    /* ========== PROFESSIONALS & COMMISSIONS PAGE â€” MOBILE ========== */
    .prof-tabs-container {
        flex-wrap: wrap !important;
        gap: 0.3rem !important;
    }

    .prof-tab {
        flex: 1;
        text-align: center;
        font-size: 0.75rem !important;
        padding: 0.5rem 0.3rem !important;
        white-space: nowrap;
    }

    .prof-toolbar {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .prof-search {
        width: 100% !important;
    }

    .prof-search input {
        width: 100% !important;
    }

    .prof-actions {
        flex-wrap: wrap !important;
        gap: 0.4rem !important;
        width: 100% !important;
        justify-content: center !important;
    }

    .prof-actions .btn-upgrade,
    .prof-actions .btn-primary {
        font-size: 0.75rem !important;
        padding: 0.45rem 0.6rem !important;
    }

    .prof-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .prof-table {
        font-size: 0.8rem;
        min-width: 600px;
    }

    .prof-pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center !important;
        font-size: 0.8rem;
    }

    /* Commissions sub-panel on mobile */
    #tab-commissions>div[style*="display: flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
    }

    #tab-commissions .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    #dateRangeDisplay {
        width: 100%;
        justify-content: center;
    }

    /* Date range modal on mobile */
    .date-picker-modal {
        flex-direction: column !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }

    .date-picker-sidebar {
        width: 100% !important;
        flex-direction: row !important;
        overflow-x: auto;
        border-right: none !important;
        border-bottom: 1px solid #eee !important;
        padding: 0.5rem !important;
    }

    .date-picker-sidebar .date-preset-btn {
        white-space: nowrap;
        font-size: 0.75rem;
    }

    .date-picker-main {
        padding: 1rem !important;
    }

    .date-picker-main>div[style*="display: flex; gap: 2rem"] {
        flex-direction: column !important;
        gap: 1rem !important;
    }

    /* ========== COMANDA PAGE â€” MOBILE ========== */
    .comanda-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }

    .comanda-info {
        flex-direction: column !important;
        gap: 0.3rem !important;
    }

    /* ========== MESSAGES PAGE â€” MOBILE ========== */
    .messages-container {
        flex-direction: column !important;
    }

    .messages-sidebar {
        width: 100% !important;
        max-height: 200px;
        overflow-y: auto;
    }

    /* ========== WHATSAPP PAGE â€” MOBILE ========== */
    .whatsapp-container {
        flex-direction: column !important;
    }

    .whatsapp-sidebar {
        width: 100% !important;
        max-height: 200px;
    }

    /* ========== COMMON: All page titles ========== */
    .billing-title,
    .expenses-title {
        font-size: 1.1rem !important;
    }

    /* Common: form rows stack on mobile */
    .form-row {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* Common: hide theme toggle text */
    .header-right .btn-icon {
        font-size: 1rem !important;
        padding: 0.3rem !important;
    }
}



/* --- Small Mobile (â‰¤480px) --- */
@media (max-width: 480px) {

    .dashboard-main {
        padding: 0.5rem;
        padding-top: 3rem;
    }

    .dashboard-header h2 {
        font-size: 0.9rem;
    }

    /* Stats single column */
    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* Smaller buttons */
    .btn-nav,
    .btn-today {
        padding: 0.35rem 0.6rem;
        font-size: 0.8rem;
    }

    .btn-icon {
        font-size: 1rem;
        padding: 0.2rem;
    }

    /* Even smaller timeline time column */
    .time-column {
        width: 46px !important;
        font-size: 0.7rem;
    }

    /* Modal footer buttons */
    .modal-content button {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.8rem !important;
    }

    /* Login page */
    .login-container {
        margin: 0.5rem;
        padding: 1.2rem;
    }

    .login-header h1.logo {
        font-size: 1.6rem;
    }
}

/* --- Tablet Portrait (481px - 1024px) --- */
@media (min-width: 481px) and (max-width: 1024px) {

    /* Two-column grids for tablets */
    .clients-grid,
    .services-grid,
    .stock-grid {
        grid-template-columns: 1fr 1fr !important;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Modals are slightly narrower */
    .modal-content {
        max-width: 90% !important;
        border-radius: 12px !important;
    }

    .modal {
        align-items: center;
        padding: 1rem;
    }
}

/* --- Touch-friendly improvements for all mobile/tablet --- */
@media (max-width: 1024px) {

    /* Larger tap targets - uniform alignment */
    .sidebar .menu-item {
        padding: 12px 16px !important;
        min-height: 44px;
        border-radius: 8px !important;
        margin: 2px 8px !important;
    }

    /* Make all buttons minimum touch size */
    button,
    .btn-nav,
    .btn-today,
    .btn-icon,
    .toggle-btn {
        min-height: 36px;
    }

    /* Smooth scrolling */
    .dashboard-main,
    .timeline-container,
    .table-container {
        -webkit-overflow-scrolling: touch;
    }

    /* Better select inputs on mobile */
    select,
    input[type="date"],
    input[type="time"] {
        font-size: 16px;
        /* Prevents iOS zoom on input focus */
    }

    /* Ensure backdrop covers everything */
    #sidebarBackdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1099;
    }
}

/* --- Print Styles --- */
@media print {

    .sidebar,
    #mobileSidebarToggle,
    .dashboard-header button,
    .sidebar-footer {
        display: none !important;
    }

    .dashboard-main {
        margin: 0;
        padding: 0;
    }
}

/* ==========================================
   CLIENT PORTAL â€” RESPONSIVE OVERRIDES
   ========================================== */

/* Tablet & Mobile: client portal sidebar as full-height drawer */
@media (max-width: 1024px) {

    /* Ensure sidebar is above the backdrop */
    .sidebar {
        z-index: 1100;
    }

    /* Ensure backdrop sits between content and sidebar */
    #sidebarBackdrop {
        z-index: 1099 !important;
    }

    /* Hamburger must be above everything except modals */
    #mobileSidebarToggle {
        z-index: 1200 !important;
    }
}

/* Mobile-specific client portal tweaks */
@media (max-width: 768px) {

    /* Client portal: the welcome card and action cards already
       have inline <style> rules in client-dashboard.html.
       Here we just ensure the main content has correct spacing. */

    /* Booking wizard adjustments */
    #bookingWizard .card {
        padding: 1rem !important;
        max-width: 100% !important;
    }

    #bookingWizard h3 {
        font-size: 1rem;
    }

    /* Available slots grid â€” smaller on mobile */
    #availableSlotsGrid {
        grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)) !important;
        gap: 0.4rem !important;
    }

    /* Profile card full-width on mobile */
    #view-profile .card {
        max-width: 100% !important;
        padding: 1.2rem !important;
    }

    /* Appointment list items stack on mobile */
    .appointment-item-client {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Client Portal: sidebar hidden on mobile, bottom nav used instead */
@media (max-width: 768px) {
    .client-portal-body .sidebar {
        display: none !important;
    }

    .client-portal-body #mobileSidebarToggle {
        display: none !important;
    }

    .client-portal-body .dashboard-main {
        margin-left: 0 !important;
        padding-top: 0.5rem !important;
    }

    .client-portal-body .dashboard-header {
        padding: 0.6rem 1rem;
    }
}

/* --- Expediente / Schedule Modal --- */
.schedule-day-row {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #eee;
}

.schedule-day-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.schedule-day-header input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #9B59B6;
    cursor: pointer;
}

.schedule-day-header label {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
    cursor: pointer;
}

.schedule-copy-icon {
    color: #9B59B6;
    cursor: pointer;
    font-size: 1.1rem;
    margin-left: 0.5rem;
    transition: transform 0.2s;
}

.schedule-copy-icon:hover {
    transform: scale(1.1);
}

.schedule-time-slots {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-left: 2rem;
}

.schedule-time-slot {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.time-input-group {
    display: flex;
    flex-direction: column;
}

.time-input-group label {
    font-size: 0.75rem;
    color: #666;
    margin-bottom: 0.2rem;
}

.time-input-group input[type="time"] {
    border: none;
    border-bottom: 2px solid #ccc;
    padding: 0.3rem 0;
    font-size: 0.95rem;
    outline: none;
    color: #333;
    transition: border-color 0.2s;
    background: transparent;
}

.time-input-group input[type="time"]:focus {
    border-bottom-color: #9B59B6;
}

.btn-icon-schedule {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

.btn-add-slot {
    color: #9B59B6;
    font-size: 1.4rem;
}

.btn-remove-slot {
    color: #e74c3c;
}

/* Mobile Table Stacking Utility */
@media (max-width: 1024px) {
    .table-card-mobile table, 
    .table-card-mobile thead, 
    .table-card-mobile tbody, 
    .table-card-mobile th, 
    .table-card-mobile td, 
    .table-card-mobile tr { 
        display: block; 
    }
    
    .table-card-mobile thead tr { 
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    
    /* Side-by-Side Mobile Card Layout */
    .table-card-mobile, 
    .table-card-mobile tbody, 
    .table-card-mobile tr, 
    .table-card-mobile td {
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
    }

    .table-card-mobile thead {
        display: none !important;
    }

    .table-card-mobile tr { 
        border: 1px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 2rem;
        background: #fff;
        box-shadow: 0 4px 16px rgba(0,0,0,0.06);
        padding: 0;
        overflow: hidden;
    }

    .table-card-mobile td { 
        border: none;
        border-bottom: 1px solid #f8f8f8; 
        padding: 0.8rem 1rem !important;
        display: flex !important;
        flex-direction: row !important; /* Side-by-side */
        justify-content: space-between !important;
        align-items: center !important;
        gap: 1rem !important;
        min-height: 48px !important;
        text-align: right !important;
    }

    .table-card-mobile td:last-child {
        border-bottom: none;
    }

    .table-card-mobile td::before { 
        content: attr(data-label) ": " !important;
        font-weight: 800 !important;
        color: var(--primary-color) !important;
        font-size: 0.65rem !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        flex-shrink: 0 !important;
        text-align: left !important;
    }

    /* Long values should stack (like Service name) */
    .table-card-mobile td[data-label="Serviço"],
    .table-card-mobile td[data-label="Ações"] {
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
    }

    .table-card-mobile td[data-label="Serviço"]::before,
    .table-card-mobile td[data-label="Ações"]::before {
        margin-bottom: 4px !important;
    }

    .table-card-mobile td[data-label="Serviço"] {
        background: rgba(155, 89, 182, 0.03);
        padding: 1rem !important;
        font-weight: 600;
        font-size: 1rem;
    }

    /* Client Header Row - Special Case */
    .table-card-mobile tr.billing-client-header {
        background: #fdfafd;
        border-bottom: 2px solid var(--primary-color);
        padding: 1rem;
    }

    .table-card-mobile tr.billing-client-header td {
        padding: 0.2rem 0 !important;
        border: none !important;
        flex-direction: row !important;
        align-items: center !important;
        background: none !important;
    }

    .table-card-mobile tr.billing-client-header td::before {
        display: none !important;
    }

    .table-card-mobile tr.billing-client-header .billing-client-name {
        font-size: 1.2rem !important;
        color: var(--primary-color) !important;
        font-weight: 700;
    }
}

/* ==========================================
   SERVICES & PACKAGES RESPONSIVE GRID
   ==========================================*/
.service-row {
    display: grid;
    grid-template-columns: 50px 2fr 1fr 1fr 1fr 1.2fr 80px;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.service-row:hover {
    background: var(--bg-hover, #f9f9f9);
}

.package-row {
    display: grid;
    grid-template-columns: 2fr 1fr 3fr 80px;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    align-items: center;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s;
}

.package-row:hover {
    background: var(--bg-hover, #f9f9f9);
}

@media (max-width: 768px) {
    #servicesTableHeader,
    #packagesTableHeader {
        display: none !important;
    }
    
    .service-row, .package-row {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.4rem;
        background: var(--card-bg, #fff);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        margin-bottom: 1rem;
        padding: 1rem;
        position: relative;
    }

    .service-row .row-border-wrap {
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        padding-left: 0.5rem;
    }

    .service-row .row-border-wrap div {
        height: 80% !important;
    }

    .service-row .row-cell, .package-row .row-cell {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding-left: 1.5rem; /* Space for the colored border indicator */
    }

    .package-row .row-cell {
        padding-left: 0;
    }

    .service-row .row-cell::before, .package-row .row-cell::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.65rem;
        text-transform: uppercase;
        margin-bottom: 0.1rem;
    }


    /* Keep Nome slightly larger */
    .service-row .row-cell[data-label="Nome:"] {
        font-size: 1.1rem;
        color: var(--primary-color);
    }
    .service-row .row-cell[data-label="Nome:"]::before {
        display: none;
    }

    .package-row .row-cell[data-label="Nome:"] {
        font-size: 1.1rem;
        color: var(--primary-color);
    }
    .package-row .row-cell[data-label="Nome:"]::before {
        display: none;
    }

    .service-row .row-actions, .package-row .row-actions {
        width: 100%;
        justify-content: flex-end;
        padding-top: 0.5rem;
        border-top: 1px dashed var(--border-color-light);
        margin-top: 0.5rem;
    }
}

/* Mobile Billing Table to Cards Transformation */
@media (max-width: 768px) {
    .billing-top-bar {
        flex-direction: column;
        align-items: stretch !important;
        gap: 1rem;
        padding: 1rem;
    }

    .billing-controls {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }

    .billing-search {
        width: 100%;
    }

    .billing-search-input-wrap {
        width: 100%;
    }

    .billing-total-receber {
        align-self: center;
        width: 100%;
        text-align: center;
        background: rgba(155, 89, 182, 0.05);
        padding: 0.8rem;
        border-radius: 8px;
        order: -1;
    }

    .billing-table-container {
        padding: 0.5rem;
    }

    .billing-table thead {
        display: none;
    }

    .billing-table, 
    .billing-table tbody, 
    .billing-table tr, 
    .billing-table td {
        display: block;
        width: 100%;
    }

    .billing-client-header {
        margin-top: 1.5rem;
        background: #f8f9fa !important;
        border: 1px solid var(--border-color);
        border-radius: 8px 8px 0 0;
        display: flex !important;
        flex-wrap: wrap;
        padding: 0.8rem !important;
        position: relative;
    }

    .billing-client-header td {
        padding: 0.2rem !important;
        border: none !important;
        display: block !important;
    }

    .billing-client-header .billing-toggle {
        width: 30px;
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .billing-client-header .billing-client-name {
        flex: 1;
        font-weight: 700;
        font-size: 1.1rem;
        color: var(--primary-color);
    }

    .billing-client-header .billing-client-total {
        width: 100%;
        text-align: right;
        font-size: 0.85rem;
        color: var(--text-muted);
        border-top: 1px dashed var(--border-color) !important;
        padding-top: 0.5rem !important;
        margin-top: 0.3rem;
    }

    .billing-client-header .billing-client-actions {
        position: absolute;
        right: 10px;
        top: 10px;
    }

    .billing-service-row {
        background: #fff;
        border: 1px solid var(--border-color);
        border-top: none;
        margin-bottom: 0px;
        padding: 0.5rem !important;
        position: relative;
        box-shadow: 0 2px 6px rgba(0,0,0,0.02);
    }

    .billing-service-row:last-child {
        border-radius: 0 0 8px 8px;
        margin-bottom: 1rem;
    }

    /* End of responsive utilities */
}
