/**
 * EliteSuite SPA Styles
 * Premium, modern authentication and dashboard screens
 */

/* ========================================
   CSS Variables
   ======================================== */
:root {
    --color-bg: #0f172a;
    --color-bg-card: rgba(30, 41, 59, 0.8);
    --color-bg-input: rgba(51, 65, 85, 0.5);
    --color-primary: #0d9488;
    --color-primary-hover: #14b8a6;
    --color-text: #f1f5f9;
    --color-text-muted: #94a3b8;
    --color-border: rgba(148, 163, 184, 0.2);
    --color-error: #ef4444;
    --color-success: #10b981;
    --shadow-card: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --shadow-input: 0 1px 2px rgba(0, 0, 0, 0.2);
    --radius-lg: 16px;
    --radius-md: 8px;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ========================================
   Base Styles
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.app-body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image:
        radial-gradient(
            at 80% 20%,
            rgba(13, 148, 136, 0.15) 0%,
            transparent 50%
        ),
        radial-gradient(at 20% 80%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
}

/* Remove padding when showing dashboard with sidebar */
body.app-body.has-sidebar {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
}

/* ========================================
   Screen Container
   ======================================== */
.screen {
    display: none;
    width: 100%;
    max-width: 420px;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   Card Component
   ======================================== */
.card {
    background: var(--color-bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-card);
}

.card-header {
    text-align: center;
    margin-bottom: 32px;
}

.card-logo {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    margin: 0 auto 16px;
}

.card-title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-subtitle {
    color: var(--color-text-muted);
    font-size: 14px;
}

/* ========================================
   Form Elements
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--color-text-muted);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 16px;
    color: var(--color-text);
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.form-input::placeholder {
    color: var(--color-text-muted);
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--color-primary), #0891b2);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--color-primary-hover), #06b6d4);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(71, 85, 105, 0.5);
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   Error Message
   ======================================== */
.error-message {
    display: none;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-error);
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

/* ========================================
   Dashboard Styles
   ======================================== */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

.dashboard-email {
    font-size: 14px;
    color: var(--color-text-muted);
    word-break: break-all;
}

.dashboard-name {
    font-size: 18px;
    font-weight: 600;
}

.dashboard-content {
    padding: 24px;
    background: var(--color-bg-input);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    margin-bottom: 24px;
}

.dashboard-welcome {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 8px;
}

.dashboard-message {
    font-size: 20px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-success);
    margin-top: 16px;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: var(--color-success);
    border-radius: 50%;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 480px) {
    .card {
        padding: 24px;
    }

    .card-title {
        font-size: 20px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
}

/* ========================================
   Card Links (navigation between screens)
   ======================================== */
.card-links {
    text-align: center;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.card-link {
    color: var(--color-primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.card-link:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.card-link-separator {
    color: var(--color-text-muted);
    margin: 0 12px;
}

/* ========================================
   Success Message
   ======================================== */
.success-message {
    display: none;
    padding: 12px 16px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-success);
    font-size: 14px;
    margin-bottom: 20px;
    text-align: center;
}

/* ========================================
   Info Message
   ======================================== */
.info-message {
    padding: 20px;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    text-align: center;
}

.info-message p {
    margin: 0 0 8px;
    font-size: 15px;
    color: var(--color-text);
}

.info-message p:last-child {
    margin-bottom: 0;
}

.info-message .text-muted {
    font-size: 13px;
    color: var(--color-text-muted);
}

/* ========================================
   Success Logo
   ======================================== */
.success-logo {
    background: linear-gradient(
        135deg,
        var(--color-success),
        #059669
    ) !important;
}

/* ========================================
   App Layout (Sidebar + Main Area)
   ======================================== */
.screen-fullwidth {
    max-width: none;
    width: 100%;
    height: 100vh;
    animation: none;
}

.app-layout {
    display: flex;
    width: 100%;
    height: 100vh;
    background: var(--color-bg);
}

/* ========================================
   Left Sidebar
   ======================================== */
.sidebar {
    width: 260px;
    min-width: 260px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 100;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    height: 64px;
    border-bottom: 1px solid var(--color-border);
}

.sidebar-logo-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.sidebar-logo-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 12px 16px 12px;
    overflow-y: auto;
}

/* ========================================
   Navigation Items
   ======================================== */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.nav-item:hover {
    background: rgba(13, 148, 136, 0.1);
    color: var(--color-text);
}

.nav-item.active {
    background: rgba(13, 148, 136, 0.2);
    color: var(--color-primary-hover);
}

.nav-item.active .nav-icon {
    stroke: var(--color-primary-hover);
}

.nav-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    flex-shrink: 0;
}

.nav-arrow {
    width: 16px;
    height: 16px;
    margin-left: auto;
    stroke: currentColor;
    opacity: 0.5;
    transition: transform 0.2s ease;
}

.nav-item-new {
    background: linear-gradient(
        135deg,
        rgba(13, 148, 136, 0.15),
        rgba(99, 102, 241, 0.1)
    );
    border: 1px solid rgba(13, 148, 136, 0.3);
    color: var(--color-primary-hover);
}

.nav-item-new:hover {
    background: linear-gradient(
        135deg,
        rgba(13, 148, 136, 0.25),
        rgba(99, 102, 241, 0.15)
    );
    border-color: rgba(13, 148, 136, 0.5);
}

.nav-item-new.active .nav-arrow {
    transform: rotate(90deg);
}

.nav-separator {
    height: 1px;
    background: var(--color-border);
    margin: 12px 0;
}

.nav-spacer {
    flex: 1;
}

.nav-badge {
    margin-left: auto;
    padding: 2px 8px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
}

.nav-item-wizard {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.1),
        rgba(168, 85, 247, 0.1)
    );
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.nav-item-wizard:hover {
    background: linear-gradient(
        135deg,
        rgba(99, 102, 241, 0.2),
        rgba(168, 85, 247, 0.15)
    );
}

/* ========================================
   Popout Menu (New Button)
   ======================================== */
.nav-item-wrapper {
    position: relative;
}

.popout-menu {
    position: absolute;
    left: calc(100% + 8px);
    top: 0;
    width: 200px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all 0.2s ease;
    z-index: 9999;
    pointer-events: none;
}

.popout-menu::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    bottom: 0;
    width: 8px;
    background: transparent;
}

/* Hover-to-reveal on desktop */
.nav-item-wrapper:hover .popout-menu,
.popout-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    pointer-events: auto;
}

.nav-item-wrapper:hover .nav-arrow {
    transform: rotate(90deg);
}

.popout-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.popout-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-align: left;
}

.popout-item:hover {
    background: rgba(13, 148, 136, 0.15);
    color: var(--color-primary-hover);
}

.popout-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ========================================
   Main Area (Header + Content)
   ======================================== */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* ========================================
   Top Header
   ======================================== */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    height: 64px;
    padding: 0 24px;
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(20px);
    position: relative;
    z-index: 100;
}

.search-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: all 0.2s ease;
}

.search-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

.search-icon {
    width: 20px;
    height: 20px;
    stroke: var(--color-text-muted);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    padding: 12px 0;
    background: transparent;
    border: none;
    font-size: 14px;
    color: var(--color-text);
    font-family: inherit;
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--color-text-muted);
}

.search-badge {
    display: none;
}

/* ========================================
   Header Right Section
   ======================================== */
.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-btn:hover {
    background: var(--color-bg-input);
    border-color: var(--color-border);
    color: var(--color-text);
}

.header-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.notification-dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: 50%;
    border: 2px solid var(--color-bg);
}

/* ========================================
   User Menu
   ======================================== */
.user-menu {
    position: relative;
    z-index: 200;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 6px 6px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.user-menu-btn:hover {
    background: var(--color-bg-input);
    border-color: var(--color-border);
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.user-email {
    font-size: 12px;
    color: var(--color-text-muted);
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-chevron {
    width: 16px;
    height: 16px;
    stroke: var(--color-text-muted);
    transition: transform 0.2s ease;
}

.user-menu-btn.active .user-chevron {
    transform: rotate(180deg);
}

/* ========================================
   User Dropdown
   ======================================== */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(20px);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    text-align: left;
}

.dropdown-item:hover {
    background: rgba(13, 148, 136, 0.15);
    color: var(--color-primary-hover);
}

.dropdown-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

.dropdown-separator {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

.dropdown-item-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    background: var(--color-bg);
    background-image:
        radial-gradient(
            at 80% 20%,
            rgba(13, 148, 136, 0.08) 0%,
            transparent 50%
        ),
        radial-gradient(
            at 20% 80%,
            rgba(99, 102, 241, 0.05) 0%,
            transparent 50%
        );
}

.content-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    max-width: 600px;
}

/* ========================================
   Responsive Sidebar - Icons Only Mode (1024px)
   ======================================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
        min-width: 72px;
    }

    .sidebar-logo {
        justify-content: center;
        padding: 16px;
    }

    .sidebar-logo-text {
        display: none;
    }

    .sidebar-nav {
        padding: 12px 8px;
    }

    .nav-item {
        justify-content: center;
        padding: 12px;
        position: relative;
    }

    .nav-item span:not(.nav-badge) {
        display: none;
    }

    .nav-item .nav-badge {
        position: absolute;
        top: 4px;
        right: 4px;
        padding: 2px 4px;
        font-size: 8px;
    }

    .nav-arrow {
        display: none;
    }

    /* Tooltip on hover */
    .nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 12px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--color-bg-card);
        border: 1px solid var(--color-border);
        color: var(--color-text);
        padding: 8px 12px;
        border-radius: 6px;
        font-size: 13px;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        transition: all 0.15s ease;
        z-index: 9999;
        box-shadow: var(--shadow-card);
        pointer-events: none;
    }

    .nav-item:hover::after {
        opacity: 1;
        visibility: visible;
    }

    /* Popout menu adjusts for collapsed sidebar */
    .popout-menu {
        left: calc(100% + 12px);
    }

    .user-info {
        display: none;
    }

    .search-container {
        max-width: none;
    }
}

/* ========================================
   Responsive Sidebar - Hamburger Mode (768px)
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        width: 260px;
        min-width: 260px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    /* Show full sidebar items when open */
    .sidebar.open .sidebar-logo-text {
        display: block;
    }

    .sidebar.open .nav-item span:not(.nav-badge) {
        display: inline;
    }

    .sidebar.open .nav-item {
        justify-content: flex-start;
    }

    .sidebar.open .nav-arrow {
        display: block;
    }

    .sidebar.open .nav-item::after {
        display: none;
    }

    .sidebar.open .nav-item .nav-badge {
        position: static;
        padding: 2px 8px;
        font-size: 10px;
    }

    /* Hamburger button */
    .hamburger-btn {
        display: flex;
    }

    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: block;
    }

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

/* ========================================
   Hamburger Button & Overlay
   ======================================== */
.hamburger-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.hamburger-btn:hover {
    background: var(--color-bg-input);
}

.hamburger-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

/* ========================================
   Dashboard Grid Layout
   ======================================== */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-bottom: 12px;
}

.dashboard-row {
    display: grid;
    gap: 12px;
}

.dashboard-row-2col {
    grid-template-columns: 1fr 1fr;
}

.dashboard-row-3col {
    grid-template-columns: 1fr 1fr 1fr;
}

/* ========================================
   KPI Section
   ======================================== */
.kpi-section {
    margin-bottom: 0;
}

/* KPI Scroll Container - Train-style horizontal scroll */
.kpi-scroll-container {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE/Edge */
    padding: 4px 0;
}

.kpi-scroll-container::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.kpi-scroll-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* Action Item Card - for onboarding/empty state */
.kpi-action-card {
    background: linear-gradient(
        135deg,
        var(--color-bg-card) 0%,
        rgba(13, 148, 136, 0.08) 100%
    );
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-width: 0;
}

.kpi-action-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(13, 148, 136, 0.15);
}

.kpi-action-card.priority-1 {
    border-left: 3px solid var(--color-primary);
    background: linear-gradient(
        135deg,
        rgba(13, 148, 136, 0.1) 0%,
        var(--color-bg-card) 100%
    );
}

.kpi-action-card.priority-2 {
    border-left: 3px solid #3b82f6;
}

.kpi-action-card.priority-3 {
    border-left: 3px solid #8b5cf6;
}

.kpi-action-card.priority-4 {
    border-left: 3px solid #f59e0b;
}

.kpi-action-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: rgba(13, 148, 136, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-action-icon svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-primary);
}

.kpi-action-icon.icon-blue {
    background: rgba(59, 130, 246, 0.15);
}

.kpi-action-icon.icon-blue svg {
    stroke: #3b82f6;
}

.kpi-action-icon.icon-purple {
    background: rgba(139, 92, 246, 0.15);
}

.kpi-action-icon.icon-purple svg {
    stroke: #8b5cf6;
}

.kpi-action-icon.icon-orange {
    background: rgba(245, 158, 11, 0.15);
}

.kpi-action-icon.icon-orange svg {
    stroke: #f59e0b;
}

.kpi-action-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-action-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    line-height: 1.3;
}

.kpi-action-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.kpi-action-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: auto;
}

.kpi-action-cta svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    transition: transform 0.2s ease;
}

.kpi-action-card:hover .kpi-action-cta svg {
    transform: translateX(3px);
}

/* Standard KPI grid (kept for when user has data) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.kpi-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.kpi-card:hover {
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.kpi-card.kpi-positive {
    border-left: 3px solid var(--color-success);
}

.kpi-card.kpi-danger {
    border-left: 3px solid var(--color-error);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(13, 148, 136, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-icon svg {
    width: 20px;
    height: 20px;
    stroke: var(--color-primary);
}

.kpi-icon-blue {
    background: rgba(59, 130, 246, 0.15);
}

.kpi-icon-blue svg {
    stroke: #3b82f6;
}

.kpi-icon-purple {
    background: rgba(139, 92, 246, 0.15);
}

.kpi-icon-purple svg {
    stroke: #8b5cf6;
}

.kpi-icon-red {
    background: rgba(239, 68, 68, 0.15);
}

.kpi-icon-red svg {
    stroke: var(--color-error);
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.kpi-value-sub {
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text-muted);
}

.kpi-label {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 500;
}

.kpi-meta {
    margin-top: auto;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
}

.kpi-trend svg {
    width: 14px;
    height: 14px;
}

.kpi-trend.positive {
    color: var(--color-success);
}

.kpi-trend.negative {
    color: var(--color-error);
}

.kpi-detail {
    font-size: 12px;
    color: var(--color-text-muted);
}

.kpi-alerts {
    position: absolute;
    top: 16px;
    right: 16px;
}

.kpi-alert {
    display: flex;
    align-items: center;
    justify-content: center;
}

.kpi-alert svg {
    width: 18px;
    height: 18px;
}

.kpi-alert.warning svg {
    stroke: #f59e0b;
}

.kpi-alert.danger {
    width: 12px;
    height: 12px;
}

.text-success {
    color: var(--color-success);
}

.text-warning {
    color: #f59e0b;
}

/* ========================================
   Dashboard Block Base
   ======================================== */
.dashboard-block {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    background: rgba(15, 23, 42, 0.4);
}

.block-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.block-title svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-text-muted);
}

.block-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
}

.block-content {
    flex: 1;
    padding: 16px 20px;
    overflow-y: auto;
    max-height: 380px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-success);
    text-transform: uppercase;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.pulse-dot-sm {
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse 2s infinite;
    display: inline-block;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.blink-dot {
    width: 6px;
    height: 6px;
    background: var(--color-error);
    border-radius: 50%;
    animation: blink 1s infinite;
    display: inline-block;
}

@keyframes blink {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* ========================================
   Cleaners Realtime Block
   ======================================== */
.cleaner-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cleaner-row {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(51, 65, 85, 0.3);
    border-radius: 6px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cleaner-row:hover {
    background: rgba(51, 65, 85, 0.5);
}

.cleaner-row.status-busy {
    border-left-color: var(--color-success);
}

.cleaner-row.status-transit {
    border-left-color: #3b82f6;
}

.cleaner-row.status-finishing {
    border-left-color: #a855f7;
}

.cleaner-row.late {
    border-left-color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

.cleaner-row.status-leave,
.cleaner-row.status-away {
    opacity: 0.6;
    border-left-color: var(--color-text-muted);
}

.cleaner-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.cleaner-avatar.muted {
    background: var(--color-text-muted);
}

.cleaner-avatar-group {
    display: flex;
}

.cleaner-avatar-group .cleaner-avatar:last-child {
    margin-left: -10px;
    border: 2px solid var(--color-bg);
}

.cleaner-info {
    min-width: 0;
}

.cleaner-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cleaner-name.muted {
    color: var(--color-text-muted);
}

.cleaner-customer {
    font-size: 11px;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cleaner-customer.muted {
    font-style: italic;
}

.status-badge-sm {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge-sm.busy {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.status-badge-sm.transit {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.status-badge-sm.finishing {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.status-badge-sm.leave,
.status-badge-sm.away {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-muted);
}

.cleaner-timing {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 4px;
}

.cleaner-timing.on-time {
    color: var(--color-success);
}

.cleaner-timing.early {
    color: #3b82f6;
}

.cleaner-timing.late {
    color: var(--color-error);
    background: rgba(239, 68, 68, 0.15);
}

.cleaner-map-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.cleaner-map-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.cleaner-map-btn svg {
    width: 14px;
    height: 14px;
}

.cleaner-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cleaner-divider::before,
.cleaner-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ========================================
   Schedule Block
   ======================================== */
.schedule-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.schedule-row {
    display: grid;
    grid-template-columns: 70px 1fr 100px auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(51, 65, 85, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.schedule-row:hover {
    background: rgba(51, 65, 85, 0.5);
}

.schedule-row.completed {
    opacity: 0.6;
}

.schedule-row.in-progress {
    background: rgba(13, 148, 136, 0.1);
    border: 1px solid rgba(13, 148, 136, 0.3);
}

.schedule-row.late-warning {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.schedule-row.unassigned {
    border: 1px dashed var(--color-error);
    background: rgba(239, 68, 68, 0.05);
}

.schedule-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
}

.schedule-info {
    min-width: 0;
}

.schedule-customer {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.schedule-service {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--color-text-muted);
}

.schedule-service svg {
    width: 12px;
    height: 12px;
}

.schedule-cleaner {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
}

.unassigned-text {
    color: var(--color-error);
    font-weight: 500;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-pill.completed {
    background: rgba(16, 185, 129, 0.2);
    color: var(--color-success);
}

.status-pill.in-progress {
    background: rgba(13, 148, 136, 0.2);
    color: var(--color-primary);
}

.status-pill.upcoming {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-muted);
}

.status-pill.late {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error);
}

.status-pill.unassigned {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-error);
}

/* ========================================
   Alerts Block
   ======================================== */
.alert-count {
    background: var(--color-error);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
}

.alert-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.alert-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: rgba(51, 65, 85, 0.3);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.alert-item:hover {
    background: rgba(51, 65, 85, 0.5);
}

.alert-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.alert-icon svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-error);
}

.alert-icon.warning {
    background: rgba(245, 158, 11, 0.2);
}

.alert-icon.warning svg {
    stroke: #f59e0b;
}

.alert-icon.info {
    background: rgba(59, 130, 246, 0.2);
}

.alert-icon.info svg {
    stroke: #3b82f6;
}

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

.alert-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 2px;
}

.alert-meta {
    font-size: 11px;
    color: var(--color-text-muted);
}

.alert-action {
    flex-shrink: 0;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sm:hover {
    background: var(--color-bg-input);
}

.btn-primary-sm {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.btn-primary-sm:hover {
    background: var(--color-primary-hover);
}

/* ========================================
   Cash Flow Block
   ======================================== */
.toggle-group {
    display: flex;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 6px;
    padding: 2px;
}

.toggle-btn {
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn.active {
    background: var(--color-primary);
    color: white;
}

.cashflow-bars {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cashflow-item {
    display: grid;
    grid-template-columns: 70px 1fr 80px;
    align-items: center;
    gap: 12px;
}

.cashflow-label {
    font-size: 12px;
    color: var(--color-text-muted);
}

.cashflow-bar-container {
    height: 24px;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 4px;
    overflow: hidden;
}

.cashflow-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.cashflow-bar.invoiced {
    background: linear-gradient(90deg, var(--color-primary), #06b6d4);
}

.cashflow-bar.received {
    background: linear-gradient(90deg, var(--color-success), #34d399);
}

.cashflow-bar.expenses {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.cashflow-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    text-align: right;
}

.cashflow-summary {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border);
}

.cashflow-net {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cashflow-net-label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.cashflow-net-value {
    font-size: 20px;
    font-weight: 700;
}

.cashflow-net.positive .cashflow-net-value {
    color: var(--color-success);
}

/* ========================================
   Funnel Block
   ======================================== */
.funnel-stages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.funnel-stage {
    display: flex;
    align-items: center;
    gap: 12px;
}

.funnel-bar {
    height: 32px;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.funnel-bar.stage-1 {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

.funnel-bar.stage-2 {
    background: linear-gradient(90deg, #8b5cf6, #a78bfa);
}

.funnel-bar.stage-3 {
    background: linear-gradient(90deg, var(--color-success), #34d399);
}

.funnel-info {
    display: flex;
    flex-direction: column;
    min-width: 80px;
}

.funnel-count {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
}

.funnel-label {
    font-size: 11px;
    color: var(--color-text-muted);
}

.funnel-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 0;
}

.funnel-conversion {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-success);
    background: rgba(16, 185, 129, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
}

.funnel-conversion.warning {
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
}

/* ========================================
   Team Performance Block
   ======================================== */
.performer-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.performer-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(51, 65, 85, 0.3);
    border-radius: 6px;
}

.performer-rank {
    width: 24px;
    height: 24px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
}

.performer-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: white;
}

.performer-info {
    flex: 1;
}

.performer-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.performer-stats {
    font-size: 11px;
    color: var(--color-text-muted);
}

.performer-badge {
    font-size: 18px;
}

.performer-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 12px;
    color: var(--color-error);
}

.performer-alert svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ========================================
   Equipment Block
   ======================================== */
.block-equipment {
    background: linear-gradient(
        135deg,
        rgba(34, 197, 94, 0.05),
        rgba(13, 148, 136, 0.05)
    );
    border-color: rgba(34, 197, 94, 0.3);
}

.equipment-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.equipment-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    background: rgba(51, 65, 85, 0.3);
    border-radius: 6px;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
}

.equipment-row:hover {
    background: rgba(51, 65, 85, 0.5);
}

.equipment-row.status-in-use {
    border-left-color: var(--color-primary);
}

.equipment-row.status-garage {
    border-left-color: var(--color-text-muted);
    opacity: 0.7;
}

.equipment-row.status-missing {
    border-left-color: var(--color-error);
    background: rgba(239, 68, 68, 0.1);
}

.equipment-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.equipment-icon.vehicle {
    background: rgba(59, 130, 246, 0.2);
}

.equipment-icon.vehicle svg {
    width: 16px;
    height: 16px;
    stroke: #3b82f6;
}

.equipment-icon.tool {
    background: rgba(13, 148, 136, 0.2);
}

.equipment-icon.tool svg {
    width: 16px;
    height: 16px;
    stroke: var(--color-primary);
}

.equipment-info {
    min-width: 0;
}

.equipment-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.equipment-id {
    font-size: 10px;
    color: var(--color-text-muted);
}

.equipment-holder {
    flex-shrink: 0;
}

.holder-badge {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
}

.holder-badge.in-use {
    background: rgba(13, 148, 136, 0.2);
    color: var(--color-primary);
}

.holder-badge.garage {
    background: rgba(148, 163, 184, 0.2);
    color: var(--color-text-muted);
}

.holder-badge.missing {
    background: rgba(239, 68, 68, 0.2);
    color: var(--color-error);
}

/* ========================================
   Responsive Dashboard
   ======================================== */
@media (max-width: 1400px) {
    .dashboard-row-3col {
        grid-template-columns: 1fr 1fr;
    }

    .block-equipment {
        grid-column: span 2;
    }
}

@media (max-width: 1100px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Enable horizontal scroll for KPI section */
    .kpi-scroll-track {
        display: flex;
        gap: 12px;
        scroll-snap-type: x mandatory;
        padding-right: 20%;
    }

    .kpi-scroll-track > * {
        flex: 0 0 calc(50% - 6px);
        scroll-snap-align: start;
    }

    .dashboard-row-2col,
    .dashboard-row-3col {
        grid-template-columns: 1fr;
    }

    .block-ai {
        grid-column: span 1;
    }
}

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

    /* Full-width cards on mobile with peek of next card */
    .kpi-scroll-track {
        display: flex;
        gap: 12px;
        scroll-snap-type: x mandatory;
        padding-right: 15%;
    }

    .kpi-scroll-track > * {
        flex: 0 0 calc(85% - 6px);
        scroll-snap-align: start;
    }

    .schedule-row {
        grid-template-columns: 60px 1fr;
        gap: 8px;
    }

    .schedule-cleaner,
    .schedule-status {
        grid-column: 2;
    }

    .cleaner-row {
        grid-template-columns: auto 1fr auto;
    }

    .cleaner-timing,
    .cleaner-map-btn {
        display: none;
    }
}

/* ========================================
   Add New Row (for dashboard blocks)
   ======================================== */
.add-new-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-top: 12px;
    background: linear-gradient(
        135deg,
        rgba(13, 148, 136, 0.08),
        rgba(99, 102, 241, 0.05)
    );
    border: 1px dashed rgba(13, 148, 136, 0.3);
    border-radius: var(--radius-md);
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-new-row:hover {
    background: linear-gradient(
        135deg,
        rgba(13, 148, 136, 0.15),
        rgba(99, 102, 241, 0.1)
    );
    border-color: rgba(13, 148, 136, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

.add-new-row:active {
    transform: translateY(0);
}

.add-new-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-new-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* ========================================
   Modal Overlay & Container
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

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

.modal {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(13, 148, 136, 0.1);
    transform: scale(0.95) translateY(-20px);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--color-border);
}

.modal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.modal-title svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    font-size: 24px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-error);
}

.modal-body {
    padding: 24px;
}

/* Form Row (two columns) */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 480px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Textarea in modal forms */
.form-textarea {
    min-height: 80px;
    resize: vertical;
}

/* Modal form select styling */
.modal select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* Modal Actions (button row) */
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border);
}

.modal-actions .btn {
    min-width: 100px;
}

.modal-actions .btn-primary {
    width: auto;
}

/* ========================================
   Modal Responsive
   ======================================== */
@media (max-width: 600px) {
    .modal {
        max-width: 100%;
        margin: 0;
        border-radius: var(--radius-md);
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions .btn {
        width: 100%;
    }
}

/* ========================================
   Toggle Switch Component
   ======================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    margin-left: auto;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(148, 163, 184, 0.3);
    transition: 0.3s;
    border-radius: 24px;
}

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

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
}

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

.dropdown-item-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.dropdown-item-toggle:hover {
    background: rgba(13, 148, 136, 0.15);
}

.dropdown-item-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* ========================================
   Light Mode Theme
   ======================================== */
body.light-mode {
    --color-bg: #f8fafc;
    --color-bg-card: rgba(255, 255, 255, 0.95);
    --color-bg-input: rgba(241, 245, 249, 0.8);
    --color-primary: #0d9488;
    --color-primary-hover: #0f766e;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: rgba(148, 163, 184, 0.3);
    --color-error: #dc2626;
    --color-success: #059669;
    --shadow-card: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    --shadow-input: 0 1px 3px rgba(0, 0, 0, 0.08);
}

body.light-mode.app-body {
    background: var(--color-bg);
    background-image:
        radial-gradient(
            at 80% 20%,
            rgba(13, 148, 136, 0.08) 0%,
            transparent 50%
        ),
        radial-gradient(
            at 20% 80%,
            rgba(99, 102, 241, 0.05) 0%,
            transparent 50%
        );
}

/* Light mode sidebar */
body.light-mode .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
    border-right: 1px solid var(--color-border);
}

body.light-mode .sidebar-logo-text {
    background: linear-gradient(135deg, var(--color-primary), #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Light mode header */
body.light-mode .top-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--color-border);
}

/* Light mode cards */
body.light-mode .card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
}

body.light-mode .dashboard-block,
body.light-mode .user-dropdown,
body.light-mode .popout-menu {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
}

body.light-mode .kpi-card {
    background: var(--color-bg-card);
    border-top: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

body.light-mode .kpi-card.kpi-positive {
    border-left: 3px solid var(--color-success);
}

body.light-mode .kpi-card.kpi-danger {
    border-left: 3px solid var(--color-error);
}

/* Light mode nav items */
body.light-mode .nav-item:hover {
    background: rgba(13, 148, 136, 0.1);
}

body.light-mode .nav-item.active {
    background: rgba(13, 148, 136, 0.15);
    color: var(--color-primary);
}

/* Light mode input fields */
body.light-mode .form-input,
body.light-mode .search-container {
    background: var(--color-bg-input);
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

body.light-mode .form-input:focus,
body.light-mode .search-container:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

body.light-mode .form-input::placeholder,
body.light-mode .search-input::placeholder {
    color: var(--color-text-muted);
}

/* Light mode buttons */
body.light-mode .header-btn:hover {
    background: var(--color-bg-input);
}

body.light-mode .user-menu-btn:hover {
    background: var(--color-bg-input);
}

/* Light mode dropdown items */
body.light-mode .dropdown-item:hover,
body.light-mode .popout-item:hover {
    background: rgba(13, 148, 136, 0.1);
}

body.light-mode .dropdown-item-danger:hover {
    background: rgba(220, 38, 38, 0.1);
    color: var(--color-error);
}

/* Light mode main content area */
body.light-mode .main-content {
    background: var(--color-bg);
    background-image:
        radial-gradient(
            at 80% 20%,
            rgba(13, 148, 136, 0.05) 0%,
            transparent 50%
        ),
        radial-gradient(
            at 20% 80%,
            rgba(99, 102, 241, 0.03) 0%,
            transparent 50%
        );
}

/* Light mode cleaner cards */
body.light-mode .cleaner-row {
    background: rgba(255, 255, 255, 0.9);
    border-top: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-left: 3px solid transparent;
}

body.light-mode .cleaner-row:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .cleaner-row.status-busy {
    border-left-color: var(--color-success);
}

body.light-mode .cleaner-row.status-transit {
    border-left-color: #3b82f6;
}

body.light-mode .cleaner-row.status-finishing {
    border-left-color: #a855f7;
}

body.light-mode .cleaner-row.late {
    border-left-color: var(--color-error);
    background: rgba(220, 38, 38, 0.05);
}

body.light-mode .cleaner-row.status-leave,
body.light-mode .cleaner-row.status-away {
    opacity: 0.6;
    border-left-color: var(--color-text-muted);
}

/* Light mode status badges */
body.light-mode .status-badge-sm.busy {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

body.light-mode .status-badge-sm.transit {
    background: rgba(59, 130, 246, 0.15);
    color: #2563eb;
}

body.light-mode .status-badge-sm.available {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}

/* Light mode scrollbar */
body.light-mode ::-webkit-scrollbar-track {
    background: #f1f5f9;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Light mode schedule items */
body.light-mode .schedule-item,
body.light-mode .equipment-grid > div {
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid var(--color-border);
}

body.light-mode .schedule-item:hover {
    background: rgba(241, 245, 249, 1);
}

/* Light mode quick action buttons */
body.light-mode .action-item,
body.light-mode .alert-item {
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid var(--color-border);
}

body.light-mode .action-item:hover {
    background: rgba(241, 245, 249, 1);
    border-color: var(--color-primary);
}

/* Light mode team member and service cards */
body.light-mode .team-member-card,
body.light-mode .service-card {
    background: rgba(241, 245, 249, 0.8);
    border: 1px solid var(--color-border);
}

/* Light mode block headers */
body.light-mode .block-header {
    background: rgba(241, 245, 249, 0.6);
    border-bottom: 1px solid var(--color-border);
}

body.light-mode .block-title {
    color: var(--color-text);
}

body.light-mode .block-title svg {
    stroke: var(--color-text-muted);
}

/* Light mode equipment rows */
body.light-mode .equipment-row {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
    border-left: 3px solid transparent;
}

body.light-mode .equipment-row:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .equipment-row.status-in-use {
    border-left-color: var(--color-primary);
    background: rgba(13, 148, 136, 0.05);
}

body.light-mode .equipment-row.status-garage {
    border-left-color: #94a3b8;
    background: rgba(241, 245, 249, 0.6);
}

body.light-mode .equipment-row.status-missing {
    border-left-color: var(--color-error);
    background: rgba(220, 38, 38, 0.05);
}

body.light-mode .equipment-name {
    color: var(--color-text);
}

body.light-mode .equipment-id {
    color: var(--color-text-muted);
}

body.light-mode .equipment-holder {
    color: var(--color-text-muted);
}

/* Light mode schedule rows */
body.light-mode .schedule-row {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
}

body.light-mode .schedule-row:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .schedule-row.completed {
    background: rgba(241, 245, 249, 0.6);
    opacity: 0.7;
}

body.light-mode .schedule-row.in-progress {
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.25);
}

body.light-mode .schedule-row.late-warning {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
}

body.light-mode .schedule-row.unassigned {
    background: rgba(220, 38, 38, 0.05);
    border: 1px dashed rgba(220, 38, 38, 0.4);
}

body.light-mode .schedule-time {
    color: var(--color-text);
}

body.light-mode .schedule-customer {
    color: var(--color-text);
}

body.light-mode .schedule-service {
    color: var(--color-text-muted);
}

body.light-mode .schedule-cleaner {
    color: var(--color-text-muted);
}

/* Light mode performer rows */
body.light-mode .performer-row {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--color-border);
}

body.light-mode .performer-row:hover {
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

body.light-mode .performer-rank {
    background: rgba(100, 116, 139, 0.15);
    color: var(--color-text-muted);
}

body.light-mode .performer-name {
    color: var(--color-text);
}

body.light-mode .performer-stats {
    color: var(--color-text-muted);
}
