:root {
    --primary-color: #374151;
    --primary-dark: #111827;
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #111827;
    --bg-topbar: #ffffff;
    --bg-secondary: #f9fafb;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --white: #ffffff;
    --danger: #991b1b;
    --success: #065f46;
    --warning: #92400e;
    --sidebar-width: 255px;
    --input-bg: #ffffff;

    /* Semantic Accents - Light Mode */
    --accent-green-bg: #e8f5e9;
    --accent-green-text: #2e7d32;
    --accent-green-border: #4caf50;

    --accent-yellow-bg: #fff3cd;
    --accent-yellow-text: #856404;
    --accent-yellow-border: #ffc107;

    --accent-blue-bg: #e0f2fe;
    --accent-blue-text: #0369a1;
    --accent-blue-border: #bae6fd;

    --accent-gray-bg: #f1f5f9;
    --accent-gray-text: #1e293b;
    --accent-gray-border: #cbd5e1;
}

body.dark-mode {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --bg-sidebar: #020617;
    --bg-topbar: #1e293b;
    --bg-secondary: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --sidebar-text: rgba(255, 255, 255, 0.6);
    --sidebar-active: #60a5fa;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --input-bg: #1e293b;
    --primary-color: hsl(196, 100%, 83%);
    /* Lighter blue for dark mode */

    /* Semantic Accents - Dark Mode */
    --accent-green-bg: rgba(16, 185, 129, 0.1);
    --accent-green-text: #34d399;
    --accent-green-border: #059669;

    --accent-yellow-bg: rgba(245, 158, 11, 0.1);
    --accent-yellow-text: #fbbf24;
    --accent-yellow-border: #d97706;

    --accent-blue-bg: rgba(59, 130, 246, 0.1);
    --accent-blue-text: #60a5fa;
    --accent-blue-border: #2563eb;

    --accent-gray-bg: rgba(148, 163, 184, 0.1);
    --accent-gray-text: #cbd5e1;
    --accent-gray-border: #475569;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

a {
    text-decoration: none;
    color: var(--primary-color);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease, background-color 0.3s;
}

.sidebar-header {
    padding: 20px;
    background: rgba(0, 0, 0, 0.1);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 5px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--sidebar-text);
    transition: all 0.3s;
    font-weight: 500;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--sidebar-hover);
    color: var(--sidebar-active);
    border-left: 4px solid var(--sidebar-active);
}

.sidebar-nav a svg {
    margin-right: 12px;
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

.topbar {
    background: var(--bg-topbar);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 10;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-weight: 600;
    color: var(--text-main);
}

.btn-logout {
    padding: 8px 15px;
    border-radius: 5px;
    background: #ffebee;
    color: #ef4444;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

body.dark-mode .btn-logout {
    background: rgba(239, 68, 68, 0.1);
}

.btn-logout:hover {
    background: var(--danger);
    color: var(--white);
}

.content-wrapper {
    padding: 30px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.04);
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: background-color 0.3s, border-color 0.3s;
}

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

.card-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-main);
}

/* Stats Row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 20px;
    border-left: 5px solid var(--primary-color);
    border: 1px solid var(--border);
    border-left-width: 5px;
}

.stat-card.danger {
    border-left-color: var(--danger);
}

.stat-card.success {
    border-left-color: var(--success);
}

.stat-info h4 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
}

.stat-info .number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table th {
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-secondary);
}

table tr:hover {
    background: var(--bg-secondary);
}

body.dark-mode table a {
    color: var(--primary-color);
}

body.dark-mode table a strong {
    color: var(--text-main);
}

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.btn-primary {
    background: hsl(196deg 43.13% 40.81%);
    color: var(--white);
}

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

.btn-info {
    background: #0ea5e9;
    color: var(--white);
}

.btn-info:hover {
    background: #0284c7;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover {
    background: #047857;
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}

.btn-warning:hover {
    background: #b45309;
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    opacity: 0.9;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

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

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

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 15px;
    transition: border 0.3s, background-color 0.3s, color 0.3s;
    font-family: 'Inter', sans-serif;
    background-color: var(--input-bg);
    color: var(--text-main);
}

.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Mobile Toggle */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-main);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .mobile-toggle {
        display: block;
    }

    .sidebar-close {
        display: block;
    }
}

.sidebar-close {
    display: none;
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: var(--white);
    font-size: 32px;
    cursor: pointer;
    line-height: 1;
    z-index: 101;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

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

.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

body.dark-mode .alert-success {
    background: rgba(21, 87, 36, 0.2);
    color: #8ce6a3;
    border-color: #155724;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

body.dark-mode .alert-danger {
    background: rgba(114, 28, 36, 0.2);
    color: #f89a9e;
    border-color: #721c24;
}

/* Tabs */
.tabs-nav {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-link {
    padding: 10px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s;
}

.tab-link:hover {
    color: var(--primary-color);
}

.tab-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

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

/* Autocomplete Suggestions */
.autocomplete-wrapper {
    position: relative;
}

.suggestions-box {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 5px;
    display: none;
    animation: fadeIn 0.2s ease;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
    color: var(--text-main);
    border-bottom: 1px solid var(--border);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--bg-secondary);
    color: var(--primary-color);
}

/* Theme Toggle */
.theme-toggle {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    transition: all 0.3s;
}

.theme-toggle:hover {
    background: var(--border);
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 10px 0;
}

.kanban-column {
    flex: 1;
    background: var(--bg-secondary);
    border-radius: 10px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
}

.kanban-column-header {
    padding: 15px;
    border-bottom: 2px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-column-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.kanban-count {
    background: var(--bg-page);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.kanban-items {
    padding: 15px;
    flex: 1;
    min-height: 100px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.kanban-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-main);
}

.kanban-card .customer {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.kanban-card .meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.sortable-ghost {
    opacity: 0.4;
    background: var(--primary-color) !important;
}

/* Logo Styling */
.logo-container {
    text-align: center;
    margin-bottom: 15px;
    padding: 0 15px;
}

.sidebar-logo {
    max-width: 200px;
    max-height: 100px;
    margin: 15px 0px;
    object-fit: contain;
    filter: brightness(0) invert(1);
    /* Makes black/colored logos white for the dark sidebar */
}

.login-logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo {
    max-width: 200px;
    max-height: 120px;
    margin: 15px 0px;
    object-fit: contain;
}

/* Footer Styling */
.main-footer {
    padding: 20px 30px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 1px solid var(--border);
    margin-top: auto;
    background: var(--bg-card);
    transition: background-color 0.3s, border-color 0.3s;
}

/* Logo Adjustment for Dark Mode */
body.dark-mode .sidebar-logo {
    filter: brightness(0) invert(1) opacity(0.8);
}