/* ============================================
   AlitaCRM - Lead Management System
   Design System (adapted from SAM Admin UI)
   Primary: #0D9488 (teal-600)
   Accent:  #5EEAD4 (teal-300)
   ============================================ */

/* -- Base Reset & Typography -- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #F0F2F5;
    color: #1e293b;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

html {
    scroll-behavior: smooth;
}

/* -- Custom Utilities -- */
.gradient-text {
    background: linear-gradient(135deg, #0D9488, #5EEAD4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.card-shadow {
    box-shadow: 0 4px 20px -2px rgba(0, 0, 0, .05);
}

.card-shadow:hover {
    box-shadow: 0 8px 30px -4px rgba(0, 0, 0, .1);
}

/* Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
}

/* -- Scrollbar -- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* -- Animations -- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes pulse-slow {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .6;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-fade-in-up {
    animation: fadeInUp .6s ease-out forwards;
}

.animate-fade-in-up-delay-1 {
    animation-delay: .1s;
    opacity: 0;
}

.animate-fade-in-up-delay-2 {
    animation-delay: .2s;
    opacity: 0;
}

.animate-fade-in-up-delay-3 {
    animation-delay: .3s;
    opacity: 0;
}

.animate-fade-in-up-delay-4 {
    animation-delay: .4s;
    opacity: 0;
}

.animate-fade-in-up-delay-5 {
    animation-delay: .5s;
    opacity: 0;
}

.animate-pulse-slow {
    animation: pulse-slow 2s ease-in-out infinite;
}

/* -- Stat Card -- */
.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    transition: all .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, .08);
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 13px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: 4px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* -- Table -- */
.proto-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.proto-table thead th {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #64748b;
    padding: 14px 20px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.proto-table tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    vertical-align: middle;
    white-space: nowrap;
}

.proto-table tbody tr:hover {
    background: #f8fafc;
}

.proto-table tbody tr {
    transition: background .15s ease;
}

/* Responsive table wrapper */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive .proto-table {
    min-width: 700px;
}

/* -- Tabs -- */
.tab-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #94a3b8;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    transition: color .2s;
    border-radius: 8px 8px 0 0;
    white-space: nowrap;
}

.tab-btn:hover {
    color: #0D9488;
    background: #f0fdfa;
}

.tab-btn.active {
    color: #0D9488;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0D9488;
    border-radius: 1px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp .3s ease-out;
}

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

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

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

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: .3s;
}

.toggle-switch input:checked+.toggle-slider {
    background: #0D9488;
}

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

/* -- Badge Colors -- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
}

/* Role badges */
.badge-super-admin,
.badge-role-super_admin {
    background: #fef3c7;
    color: #92400e;
}

.badge-leader,
.badge-role-leader {
    background: #dbeafe;
    color: #1e40af;
}

.badge-member,
.badge-role-member {
    background: #d1fae5;
    color: #065f46;
}

/* Status badges */
.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Lead status badges */
.badge-new {
    background: #dbeafe;
    color: #1e40af;
}

.badge-contacting {
    background: #fef3c7;
    color: #92400e;
}

.badge-interested {
    background: #e0e7ff;
    color: #3730a3;
}

.badge-negotiating {
    background: #fae8ff;
    color: #86198f;
}

.badge-chot-deal {
    background: #d1fae5;
    color: #065f46;
}

.badge-lost {
    background: #fee2e2;
    color: #991b1b;
}

/* Lead type badges */
.badge-private {
    background: #f0fdfa;
    color: #0D9488;
    border: 1px solid #99f6e4;
}

.badge-public {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

/* Generic */
.badge-processing {
    background: #fef3c7;
    color: #92400e;
}

.badge-completed {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* -- Modal -- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

.modal-box {
    background: white;
    border-radius: 20px;
    padding: 32px;
    max-width: 560px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, .25);
    animation: fadeInUp .3s ease-out;
}

/* -- Drag-Drop Zone -- */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #0D9488;
    background: #f0fdfa;
}

/* -- Progress Bar -- */
.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0D9488, #5EEAD4);
    border-radius: 4px;
    transition: width .5s ease;
}

/* -- Line Clamp -- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* -- Sidebar Active Anim -- */
.nav-item.active {
    animation: slideInLeft .3s ease;
}

/* -- Sidebar Accordion -- */
.sidebar-group .sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.sidebar-group.open .sidebar-submenu {
    max-height: 500px;
}

.sidebar-group .chevron {
    transition: transform .3s ease;
}

.sidebar-group.open .chevron {
    transform: rotate(90deg);
}

/* -- Mobile Sidebar Overlay -- */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 40;
}

.sidebar-overlay.active {
    display: block;
}

/* -- Sidebar Collapse -- */
.sidebar {
    width: 256px;
    transition: width .3s ease;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s ease;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: #f0fdfa;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar.collapsed .sidebar-collapse-btn {
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-logo {
    padding-left: 0;
    padding-right: 0;
    justify-content: center;
    gap: 0;
}

.sidebar.collapsed nav {
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar.collapsed .nav-item,
.sidebar.collapsed .sidebar-group > button {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar.collapsed .nav-item span.material-symbols-outlined,
.sidebar.collapsed .sidebar-group > button span.material-symbols-outlined:first-child {
    font-size: 22px;
}

.sidebar.collapsed .sidebar-group > button > span:first-child {
    gap: 0;
}

.sidebar.collapsed .sidebar-submenu {
    display: none !important;
    max-height: 0 !important;
}

.sidebar.collapsed .sidebar-user-info {
    padding-left: 0;
    padding-right: 0;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-user-info > div {
    justify-content: center;
}

/* Tooltip for collapsed sidebar */
.sidebar.collapsed .nav-item,
.sidebar.collapsed .sidebar-group > button {
    position: relative;
}

.sidebar.collapsed .nav-item:hover::after,
.sidebar.collapsed .sidebar-group > button:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    z-index: 999;
    pointer-events: none;
    animation: fadeIn .15s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
}

.sidebar.collapsed .nav-item:hover::before,
.sidebar.collapsed .sidebar-group > button:hover::before {
    content: '';
    position: absolute;
    left: calc(100% + 2px);
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-right-color: #1e293b;
    z-index: 999;
    pointer-events: none;
}

/* -- Chart Bar (CSS-only charts) -- */
.chart-bar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 200px;
    padding: 0 8px;
}

.chart-bar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.chart-bar-item .bar {
    width: 100%;
    border-radius: 6px 6px 0 0;
    transition: all .3s ease;
    cursor: pointer;
    min-height: 4px;
}

.chart-bar-item .bar:hover {
    opacity: .8;
}

.chart-bar-item .bar-label {
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
    text-align: center;
}

/* Donut chart placeholder */
.chart-donut {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: relative;
    margin: 0 auto;
}

.chart-donut::after {
    content: '';
    position: absolute;
    inset: 35%;
    background: white;
    border-radius: 50%;
}

/* -- Timeline -- */
.timeline-item {
    position: relative;
    padding-left: 32px;
    padding-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 28px;
    bottom: 0;
    width: 2px;
    background: #e2e8f0;
}

.timeline-item:last-child::before {
    display: none;
}

.timeline-item .timeline-dot {
    position: absolute;
    left: 4px;
    top: 4px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 3px solid #0D9488;
    background: white;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-label .required {
    color: #ef4444;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    color: #1e293b;
    outline: none;
    transition: all .2s;
}

.form-input:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .1);
}

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-input {
    resize: vertical;
    min-height: 100px;
}

/* -- Alert Banner -- */
.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-info {
    background: #f0fdfa;
    color: #0D9488;
    border: 1px solid #99f6e4;
}

/* -- Pagination -- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination .page-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    border: none;
    background: none;
    cursor: pointer;
    transition: all .15s;
}

.pagination .page-btn:hover {
    background: #f1f5f9;
}

.pagination .page-btn.active {
    background: #0D9488;
    color: white;
}

.pagination .page-btn:disabled {
    opacity: .4;
    cursor: default;
}

/* =====================
   RESPONSIVE UTILITIES
   ===================== */

/* Mobile sidebar */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .3s ease;
        position: fixed !important;
        z-index: 50 !important;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .hamburger-btn {
        display: flex !important;
    }

    .desktop-search {
        display: none !important;
    }
}

@media (min-width: 1024px) {
    .hamburger-btn {
        display: none !important;
    }

    .sidebar-overlay {
        display: none !important;
    }
}

/* Stats responsive */
@media (max-width: 639px) {
    .stat-card .stat-value {
        font-size: 24px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
    }
}

/* Form responsive */
@media (max-width: 639px) {
    .form-row {
        flex-direction: column !important;
    }

    .form-row>* {
        width: 100% !important;
    }

    .modal-box {
        padding: 20px;
        border-radius: 16px;
    }
}

/* Header responsive */
@media (max-width: 639px) {
    .page-header {
        padding: 12px 16px !important;
    }

    .page-header h1 {
        font-size: 16px !important;
    }

    .main-padding {
        padding: 16px !important;
    }
}

/* Table on mobile — card-style alternative hidden by default */
@media (max-width: 639px) {
    .proto-table thead th {
        padding: 10px 12px;
        font-size: 10px;
    }

    .proto-table tbody td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Filter bar wrap */
@media (max-width: 767px) {
    .filter-bar {
        flex-direction: column !important;
    }

    .filter-bar>* {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* =========================
   MOBILE BOTTOM NAV + FAB
   ========================= */

/* Fixed bottom navigation bar - mobile/tablet only */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 60;
    background: white;
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 20px -2px rgba(0, 0, 0, .06);
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-bottom-nav .nav-items {
    display: flex;
    align-items: center;
    justify-content: space-around;
    max-width: 480px;
    margin: 0 auto;
    position: relative;
}

.mobile-bottom-nav .nav-item-mobile {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px 6px;
    text-decoration: none;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .02em;
    transition: color .2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}

.mobile-bottom-nav .nav-item-mobile:hover,
.mobile-bottom-nav .nav-item-mobile:active {
    color: #0D9488;
}

.mobile-bottom-nav .nav-item-mobile.active {
    color: #0D9488;
}

.mobile-bottom-nav .nav-item-mobile.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: #0D9488;
    border-radius: 0 0 2px 2px;
}

.mobile-bottom-nav .nav-item-mobile .material-symbols-outlined {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 2px;
}

.mobile-bottom-nav .nav-item-mobile span.nav-label {
    line-height: 1;
}

/* FAB — center elevated button */
.mobile-bottom-nav .fab-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-bottom-nav .fab-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0D9488, #14b8a6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(13, 148, 136, .4);
    margin-top: -20px;
    transition: all .2s;
    text-decoration: none;
    position: relative;
    z-index: 2;
}

.mobile-bottom-nav .fab-btn:hover,
.mobile-bottom-nav .fab-btn:active {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(13, 148, 136, .5);
}

.mobile-bottom-nav .fab-btn .material-symbols-outlined {
    font-size: 26px;
    font-variation-settings: 'FILL' 1, 'wght' 600;
}

.mobile-bottom-nav .fab-label {
    font-size: 10px;
    font-weight: 700;
    color: #0D9488;
    margin-top: -2px;
    text-align: center;
    line-height: 1;
}

/* Badge counter on nav items */
.mobile-bottom-nav .nav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Show bottom nav on mobile/tablet, add padding to body */
@media (max-width: 1023px) {
    .mobile-bottom-nav {
        display: block;
    }

    .main-content {
        padding-bottom: 72px !important;
    }
}

/* ============================================
   DARK MODE THEME
   Toggle via data-theme="dark" on <html>
   ============================================ */

/* -- Dark Mode Toggle Button -- */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    background: transparent;
    cursor: pointer;
    transition: all .2s;
    color: #64748b;
    flex-shrink: 0;
}

.theme-toggle:hover {
    background: #f1f5f9;
    color: #0D9488;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    font-size: 20px;
}

.theme-toggle .icon-sun {
    display: none;
}

.theme-toggle .icon-moon {
    display: inline;
}

[data-theme="dark"] .theme-toggle {
    border-color: #334155;
    color: #94a3b8;
}

[data-theme="dark"] .theme-toggle:hover {
    background: #1e293b;
    color: #5EEAD4;
}

[data-theme="dark"] .theme-toggle .icon-sun {
    display: inline;
}

[data-theme="dark"] .theme-toggle .icon-moon {
    display: none;
}

/* -- Base Dark Overrides -- */
[data-theme="dark"] body {
    background: #0f172a;
    color: #e2e8f0;
}

/* Sidebar */
[data-theme="dark"] .sidebar {
    background: #1e293b;
    border-color: #334155;
}

[data-theme="dark"] .sidebar .p-6,
[data-theme="dark"] .sidebar>div:last-child {
    border-color: #334155;
}

[data-theme="dark"] .sidebar a,
[data-theme="dark"] .sidebar button {
    color: #94a3b8;
}

[data-theme="dark"] .sidebar a:hover,
[data-theme="dark"] .sidebar button:hover {
    background: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .sidebar .nav-item.active {
    background: rgba(13, 148, 136, .15);
    color: #5EEAD4;
}

[data-theme="dark"] .sidebar .text-slate-400,
[data-theme="dark"] .sidebar .text-slate-500 {
    color: #64748b;
}

[data-theme="dark"] .sidebar .text-slate-900 {
    color: #e2e8f0;
}

/* Header */
[data-theme="dark"] .page-header {
    background: rgba(15, 23, 42, .9) !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .page-header h1 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .page-header p,
[data-theme="dark"] .page-header .text-slate-400 {
    color: #64748b !important;
}

[data-theme="dark"] .hamburger-btn {
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

[data-theme="dark"] .hamburger-btn:hover {
    background: #334155 !important;
}

/* Search & date inputs in header */
[data-theme="dark"] .page-header input,
[data-theme="dark"] .page-header select {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Sidebar overlay dark */
[data-theme="dark"] .sidebar-overlay.active {
    background: rgba(0, 0, 0, .6);
}

/* -- Cards & Panels -- */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .bg-white {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] .stat-card:hover {
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, .3);
}

[data-theme="dark"] .stat-card .stat-value {
    color: #f1f5f9;
}

[data-theme="dark"] .stat-card .stat-label {
    color: #64748b;
}

/* -- Tables -- */
[data-theme="dark"] .proto-table thead th {
    color: #94a3b8;
    border-color: #334155;
}

[data-theme="dark"] .proto-table tbody td {
    border-color: #1e293b;
    color: #cbd5e1;
}

[data-theme="dark"] .proto-table tbody tr:hover {
    background: #334155 !important;
}

[data-theme="dark"] .proto-table tfoot tr {
    background: #0f172a !important;
}

[data-theme="dark"] .proto-table .text-slate-900 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .proto-table .text-slate-500,
[data-theme="dark"] .proto-table .text-slate-600 {
    color: #94a3b8 !important;
}

[data-theme="dark"] .proto-table .text-slate-400 {
    color: #64748b !important;
}

/* -- Forms -- */
[data-theme="dark"] .form-input {
    background: #0f172a;
    border-color: #334155;
    color: #e2e8f0;
}

[data-theme="dark"] .form-input:focus {
    border-color: #0D9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, .2);
}

[data-theme="dark"] .form-input::placeholder {
    color: #475569;
}

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

[data-theme="dark"] select,
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] textarea {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* -- Modals -- */
[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, .6);
}

[data-theme="dark"] .modal-box {
    background: #1e293b;
    border: 1px solid #334155;
}

/* -- Tabs -- */
[data-theme="dark"] .tab-nav {
    border-color: #334155;
}

[data-theme="dark"] .tab-btn {
    color: #64748b;
}

[data-theme="dark"] .tab-btn:hover {
    color: #5EEAD4;
    background: #0f172a;
}

[data-theme="dark"] .tab-btn.active {
    color: #5EEAD4;
}

[data-theme="dark"] .tab-btn.active::after {
    background: #5EEAD4;
}

/* -- Badges (keep badge colors vivid on dark) -- */
[data-theme="dark"] .badge-super-admin {
    background: rgba(254, 243, 199, .15);
    color: #fbbf24;
}

[data-theme="dark"] .badge-leader {
    background: rgba(219, 234, 254, .12);
    color: #60a5fa;
}

[data-theme="dark"] .badge-member {
    background: rgba(209, 250, 229, .12);
    color: #34d399;
}

[data-theme="dark"] .badge-active {
    background: rgba(209, 250, 229, .12);
    color: #34d399;
}

[data-theme="dark"] .badge-inactive {
    background: rgba(254, 226, 226, .12);
    color: #f87171;
}

[data-theme="dark"] .badge-new {
    background: rgba(219, 234, 254, .12);
    color: #60a5fa;
}

[data-theme="dark"] .badge-contacting {
    background: rgba(254, 243, 199, .12);
    color: #fbbf24;
}

[data-theme="dark"] .badge-interested {
    background: rgba(224, 231, 255, .12);
    color: #818cf8;
}

[data-theme="dark"] .badge-negotiating {
    background: rgba(250, 232, 255, .12);
    color: #c084fc;
}

[data-theme="dark"] .badge-chot-deal {
    background: rgba(209, 250, 229, .12);
    color: #34d399;
}

[data-theme="dark"] .badge-lost {
    background: rgba(254, 226, 226, .12);
    color: #f87171;
}

[data-theme="dark"] .badge-private {
    background: rgba(240, 253, 250, .1);
    color: #5EEAD4;
    border-color: #0D9488;
}

[data-theme="dark"] .badge-public {
    background: rgba(239, 246, 255, .1);
    color: #60a5fa;
    border-color: #3b82f6;
}

/* -- Alerts -- */
[data-theme="dark"] .alert-warning {
    background: rgba(254, 243, 199, .1);
    color: #fbbf24;
    border-color: rgba(253, 230, 138, .2);
}

[data-theme="dark"] .alert-error {
    background: rgba(254, 226, 226, .1);
    color: #f87171;
    border-color: rgba(254, 202, 202, .2);
}

[data-theme="dark"] .alert-success {
    background: rgba(209, 250, 229, .1);
    color: #34d399;
    border-color: rgba(167, 243, 208, .2);
}

[data-theme="dark"] .alert-info {
    background: rgba(240, 253, 250, .1);
    color: #5EEAD4;
    border-color: rgba(153, 246, 228, .2);
}

/* -- Progress Bar -- */
[data-theme="dark"] .progress-bar {
    background: #334155;
}

/* -- Drop Zone -- */
[data-theme="dark"] .drop-zone {
    border-color: #334155;
    background: #0f172a;
}

[data-theme="dark"] .drop-zone:hover,
[data-theme="dark"] .drop-zone.dragover {
    border-color: #0D9488;
    background: rgba(13, 148, 136, .05);
}

/* -- Timeline -- */
[data-theme="dark"] .timeline-item::before {
    background: #334155;
}

[data-theme="dark"] .timeline-item .timeline-dot {
    border-color: #0D9488;
    background: #1e293b;
}

/* -- Chart CSS bars -- */
[data-theme="dark"] .chart-bar-item .bar-label {
    color: #64748b;
}

[data-theme="dark"] .chart-donut::after {
    background: #1e293b;
}

/* -- Pagination -- */
[data-theme="dark"] .pagination .page-btn {
    color: #94a3b8;
}

[data-theme="dark"] .pagination .page-btn:hover {
    background: #334155;
}

[data-theme="dark"] .pagination .page-btn.active {
    background: #0D9488;
    color: white;
}

/* -- Scrollbar -- */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #1e293b;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #334155;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* -- Filter bar & misc borders -- */
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-slate-100,
[data-theme="dark"] .border-b {
    border-color: #334155 !important;
}

[data-theme="dark"] .divide-slate-50>*+* {
    border-color: #334155;
}

/* -- Text color overrides -- */
[data-theme="dark"] .text-slate-900 {
    color: #f1f5f9 !important;
}

[data-theme="dark"] .text-slate-800 {
    color: #e2e8f0 !important;
}

[data-theme="dark"] .text-slate-700 {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .text-slate-600 {
    color: #94a3b8 !important;
}

[data-theme="dark"] .text-slate-500 {
    color: #64748b !important;
}

[data-theme="dark"] .text-slate-400 {
    color: #475569 !important;
}

/* -- BG overrides -- */
[data-theme="dark"] .bg-slate-50 {
    background: #0f172a !important;
}

[data-theme="dark"] .bg-slate-100 {
    background: #1e293b !important;
}

/* -- Hover BG -- */
[data-theme="dark"] .hover\:bg-slate-50:hover {
    background: #334155 !important;
}

/* -- Mobile Bottom Nav Dark -- */
[data-theme="dark"] .mobile-bottom-nav {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 -4px 20px -2px rgba(0, 0, 0, .3);
}

[data-theme="dark"] .mobile-bottom-nav .nav-item-mobile {
    color: #64748b;
}

[data-theme="dark"] .mobile-bottom-nav .nav-item-mobile:hover,
[data-theme="dark"] .mobile-bottom-nav .nav-item-mobile.active {
    color: #5EEAD4;
}

[data-theme="dark"] .mobile-bottom-nav .nav-item-mobile.active::before {
    background: #5EEAD4;
}

[data-theme="dark"] .mobile-bottom-nav .fab-btn {
    box-shadow: 0 4px 15px rgba(13, 148, 136, .3);
}

/* -- Toggle Switch Dark -- */
[data-theme="dark"] .toggle-slider {
    background: #475569;
}

/* -- Gradient rankings (keep vivid) -- */
[data-theme="dark"] .bg-gradient-to-br {
    opacity: .9;
}

/* -- User Menu Dropdown -- */
[data-theme="dark"] #userMenu {
    background: #1e293b !important;
    border-color: #334155 !important;
}

[data-theme="dark"] #userMenu a {
    color: #94a3b8 !important;
}

[data-theme="dark"] #userMenu a:hover {
    background: #334155 !important;
}