:root[data-theme="dark"] {
    --bg-dark: #0f1113;
    --sidebar-bg: #0a0c0e;
    --card-bg: #161a1d;
    --primary: #e8a5b5;
    /* Rose Gold/Pink from logo */
    --primary-hover: #d18fa0;
    --text-main: #e0e0e0;
    --text-muted: #8892b0;
    --border: rgba(255, 255, 255, 0.08);
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
    --bg-dark: #f8f9fa;
    --sidebar-bg: #ffffff;
    --card-bg: #ffffff;
    --primary: #d48a9c;
    /* Slightly darker for legibility on light */
    --primary-hover: #c07b8d;
    --text-main: #2d3436;
    --text-muted: #636e72;
    --border: rgba(0, 0, 0, 0.08);
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #d63031;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* Default to dark if no theme set */
:root {
    --bg-dark: #0f1113;
    --sidebar-bg: #0a0c0e;
    --card-bg: #161a1d;
    --primary: #e8a5b5;
    --primary-hover: #d18fa0;
    --text-main: #e0e0e0;
    --text-muted: #8892b0;
    --border: rgba(255, 255, 255, 0.08);
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
    overflow-x: hidden;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    transition: background 0.3s, border-color 0.3s;
}

.brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.3s;
    font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(232, 165, 181, 0.1);
    color: var(--primary);
}

.btn-theme {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.btn-theme:hover {
    background: var(--primary);
    color: #fff;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2.5rem;
    overflow-y: auto;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.stat-card .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Tables / Lists */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
}

/* Custom Scrollbar */
.table-container::-webkit-scrollbar,
.kanban-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.table-container::-webkit-scrollbar-track,
.kanban-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb,
.kanban-list::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover,
.kanban-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1.2rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-paid {
    background: rgba(46, 204, 113, 0.15);
    color: #2ecc71;
}

.status-designed {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

.status-in-progress {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.status-shipped-collected {
    background: rgba(155, 89, 182, 0.15);
    color: #9b59b6;
}

.status-archived {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.status-accepted {
    background: rgba(52, 152, 219, 0.15);
    color: #3498db;
}

/* AI Shimmer Effect */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.ai-shimmer {
    background: linear-gradient(90deg, var(--card-bg) 25%, rgba(212, 175, 55, 0.1) 50%, var(--card-bg) 75%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite linear;
}

.btn-ai-scan {
    background: linear-gradient(45deg, #d4af37, #f1c40f);
    color: #000 !important;
    border: none;
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.3);
}

.btn-ai-scan:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.5);
}

.scan-status-tag {
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    margin-top: 4px;
    display: inline-block;
}

.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    align-items: flex-start;
}

.kanban-column {
    background: var(--sidebar-bg);
    min-width: 300px;
    max-width: 300px;
    border-radius: 12px;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    min-height: 70vh;
}

.kanban-header {
    padding: 1.2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-count {
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.kanban-list {
    padding: 1rem;
    flex: 1;
    min-height: 200px;
    max-height: calc(100vh - 250px);
    overflow-y: auto;
}

.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    cursor: grab;
    transition: 0.2s;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

.kanban-card.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border: 2px dashed var(--primary);
}

.kanban-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
    color: var(--text-main);
}

.kanban-card .customer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: block;
}

.kanban-card .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid var(--border);
}

.kanban-card .due {
    display: flex;
    align-items: center;
    gap: 5px;
}

.kanban-card .due.overdue {
    color: var(--danger);
    font-weight: 700;
}

.kanban-card .balance {
    font-weight: 700;
}

.kanban-card .balance.unpaid {
    color: var(--danger);
}

.kanban-card .balance.paid {
    color: var(--success);
}

/* Drag and Drop Visual Feedback */
.kanban-list.drag-over {
    background: rgba(212, 175, 55, 0.05);
}

.btn-primary {
    background: var(--primary);
    color: #121417;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--card-bg);
    width: 600px;
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border);
    position: relative;
}

.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input,
select,
textarea {
    width: 100%;
    background: #121417;
    border: 1px solid var(--border);
    padding: 0.65rem 0.8rem;
    border-radius: 8px;
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
}

@media (max-width: 768px) {

    input,
    select,
    textarea {
        padding: 0.4rem 0.6rem;
        font-size: 0.82rem;
        min-height: 36px;
    }
}

/* ============================================================
   MOBILE RESPONSIVE — iPhone 13 & similar (max-width: 768px)
   ============================================================ */

/* ── Hamburger: hidden on desktop ── */
.hamburger-btn {
    display: none;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

/* ── Sidebar overlay backdrop ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 998;
}

.sidebar-overlay.open {
    display: block;
}

@media (max-width: 768px) {

    /* Body: stack vertically */
    body {
        flex-direction: column;
    }

    /* Show hamburger on mobile */
    .hamburger-btn {
        display: flex;
    }

    /* Sidebar becomes a slide-in drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        height: 100vh;
        width: 260px;
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .sidebar.open {
        left: 0;
    }

    /* Main content: tighter padding */
    .main-content {
        padding: 1.2rem 1rem;
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    input,
    select,
    textarea {
        padding: 8px 10px !important;
        font-size: 0.85rem !important;
        min-height: auto !important;
        min-width: 0 !important;
        appearance: none;
        -webkit-appearance: none;
        box-sizing: border-box !important;
    }

    /* Header: stack title + actions vertically */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Stats grid: 2 columns on mobile */
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card h3 {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }

    .stat-card .value {
        font-size: 1.3rem;
    }

    /* Tables: horizontal scroll */
    .table-container {
        padding: 0.8rem 0;
        border-radius: 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-height: none;
    }

    table {
        min-width: 560px;
    }

    th,
    td {
        padding: 0.8rem 0.7rem;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    /* Kanban board: horizontal snap scroll */
    .kanban-board {
        padding-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }

    .kanban-column {
        min-width: 80vw;
        max-width: 80vw;
        scroll-snap-align: start;
        min-height: 50vh;
    }

    .kanban-list {
        max-height: 55vh;
    }

    /* Modal: slides up from bottom */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal-content {
        width: 100%;
        max-width: 100%;
        border-radius: 20px 20px 0 0;
        padding: 1.8rem 1.4rem;
        padding-bottom: calc(1.8rem + env(safe-area-inset-bottom));
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Status badges: smaller */
    .status-badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }

    /* Buttons */
    .btn-primary {
        padding: 0.65rem 1.2rem;
        font-size: 0.9rem;
    }

    /* Dashboard 2-col grids collapse to single column */
    .dashboard-split {
        grid-template-columns: 1fr !important;
    }

    /* Theme toggle buttons */
    .btn-theme {
        width: 36px;
        height: 36px;
    }
}