:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --sidebar-bg: #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text: #94a3b8;
    --sidebar-width: 240px;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --light: #f8fafc;
    --dark: #0f172a;
    --gray: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.1);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --radius: 8px
}

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

    /* Hide scrollbar but keep scroll functionality */
    *::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none
    }

* {
    -ms-overflow-style: none;
    scrollbar-width: none
}

body {
    font-family: 'Segoe UI',-apple-system,sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6
}

.app-layout {
    display: flex;
    min-height: 100vh
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column
}

.sidebar-brand {
    padding: 20px;
    border-bottom: 1px solid #1e293b
}

    .sidebar-brand h2 {
        color: var(--primary);
        font-size: 20px;
        font-weight: 700
    }

    .sidebar-brand small {
        color: var(--sidebar-text);
        font-size: 12px
    }

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

    .sidebar-nav a {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 20px;
        color: var(--sidebar-text);
        text-decoration: none;
        font-size: 14px;
        transition: all .15s;
        border-left: 3px solid transparent
    }

        .sidebar-nav a:hover {
            background: var(--sidebar-hover);
            color: white
        }

        .sidebar-nav a.active {
            background: rgba(13,148,136,.15);
            color: var(--primary);
            border-left-color: var(--primary);
            font-weight: 600
        }

        .sidebar-nav a svg {
            width: 18px;
            height: 18px;
            flex-shrink: 0
        }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #1e293b
}

    .sidebar-footer .user-name {
        color: white;
        font-weight: 600;
        font-size: 14px
    }

    .sidebar-footer .user-role {
        display: inline-block;
        background: var(--primary);
        color: white;
        padding: 2px 10px;
        border-radius: 20px;
        font-size: 11px;
        font-weight: 600;
        margin-top: 4px
    }

    .sidebar-footer .logout-btn {
        display: block;
        margin-top: 10px;
        background: 0 0;
        border: 1px solid #334155;
        color: var(--sidebar-text);
        padding: 6px 14px;
        border-radius: var(--radius);
        cursor: pointer;
        font-size: 13px;
        width: 100%;
        text-align: center
    }

        .sidebar-footer .logout-btn:hover {
            background: #1e293b;
            color: white
        }

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0
}

.topbar {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 40
}

    .topbar h1 {
        font-size: 20px;
        font-weight: 700
    }

.page-body {
    padding: 24px 28px
}

.row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px
}

.col {
    flex: 1;
    min-width: 220px
}

.col-2 {
    flex: 2
}

.card {
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa
}

.card-body {
    padding: 20px
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    transition: transform .2s,box-shadow .2s
}

    .stat-card:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg)
    }

    .stat-card .stat-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 12px
    }

        .stat-card .stat-icon.teal {
            background: #ccfbf1;
            color: var(--primary)
        }

        .stat-card .stat-icon.blue {
            background: #dbeafe;
            color: var(--info)
        }

        .stat-card .stat-icon.amber {
            background: #fef3c7;
            color: var(--warning)
        }

        .stat-card .stat-icon.green {
            background: #dcfce7;
            color: var(--success)
        }

    .stat-card .stat-value {
        font-size: 28px;
        font-weight: 700;
        color: var(--dark)
    }

    .stat-card .stat-label {
        font-size: 13px;
        color: var(--gray);
        margin-top: 2px
    }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    text-decoration: none
}

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

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

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

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

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

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

.btn-outline {
    background: 0 0;
    border: 1px solid var(--border);
    color: var(--dark)
}

    .btn-outline:hover {
        background: var(--light)
    }

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

.btn-lg {
    padding: 12px 28px;
    font-size: 16px
}

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

.hero-btns .btn-outline, .landing-nav .btn-outline {
    border-color: white;
    color: white
}

    .hero-btns .btn-outline:hover, .landing-nav .btn-outline:hover {
        background: rgba(255,255,255,.15);
        color: white
    }

.form-group {
    margin-bottom: 16px
}

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

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    outline: 0;
    background: white
}

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

select.form-control {
    appearance: auto
}

.table-wrap {
    overflow-x: auto
}

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

    table th {
        background: var(--light);
        padding: 10px 14px;
        text-align: left;
        font-size: 12px;
        font-weight: 600;
        color: var(--gray);
        text-transform: uppercase;
        letter-spacing: .5px;
        border-bottom: 2px solid var(--border)
    }

    table td {
        padding: 10px 14px;
        border-bottom: 1px solid var(--border);
        font-size: 14px
    }

    table tr:hover {
        background: #f1f5f9
    }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600
}

.badge-new {
    background: #dbeafe;
    color: #1d4ed8
}

.badge-assigned {
    background: #e0e7ff;
    color: #4338ca
}

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

.badge-in_transit {
    background: #e0f2fe;
    color: #0369a1
}

.badge-out_for_delivery {
    background: #cffafe;
    color: #0e7490
}

.badge-delivering_now {
    background: #d1fae5;
    color: #059669
}

.badge-delivered {
    background: #dcfce7;
    color: #15803d
}

.badge-failed {
    background: #fee2e2;
    color: #b91c1c
}

.badge-returned {
    background: #e0f2fe;
    color: #075985
}

.badge-cancelled {
    background: #f1f5f9;
    color: #475569
}

.badge-available {
    background: #dcfce7;
    color: #15803d
}

.badge-offline {
    background: #f1f5f9;
    color: #475569
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0
}

.alert-danger {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    align-items: center;
    justify-content: center
}

    .modal-overlay.active {
        display: flex
    }

.modal {
    background: white;
    border-radius: 12px;
    max-width: 520px;
    width: 92%;
    max-height: 90vh;
    overflow-y: auto
}

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

.modal-body {
    padding: 20px
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px
}

.close-btn {
    background: 0 0;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray)
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,var(--sidebar-bg),#334155)
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 400px;
    box-shadow: var(--shadow-lg)
}

    .auth-card h1 {
        text-align: center;
        color: var(--primary);
        margin-bottom: 8px
    }

    .auth-card p {
        text-align: center;
        color: var(--gray);
        margin-bottom: 24px
    }

.text-center {
    text-align: center
}

.text-gray {
    color: var(--gray)
}

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

.text-danger {
    color: var(--danger)
}

.text-primary {
    color: var(--primary)
}

.text-warning {
    color: var(--warning)
}

.text-sm {
    font-size: 13px
}

.text-right {
    text-align: right
}

.mt-1 {
    margin-top: 8px
}

.mt-2 {
    margin-top: 16px
}

.mt-3 {
    margin-top: 24px
}

.mb-1 {
    margin-bottom: 8px
}

.mb-2 {
    margin-bottom: 16px
}

.mb-3 {
    margin-bottom: 24px
}

.d-flex {
    display: flex
}

.gap-2 {
    gap: 16px
}

.flex-wrap {
    flex-wrap: wrap
}

.items-center {
    align-items: center
}

.justify-between {
    justify-content: space-between
}

.w-full {
    width: 100%
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray)
}

    .empty-state h3 {
        margin-bottom: 8px;
        color: #334155
    }

.delivery-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    background: white;
    transition: box-shadow .2s
}

    .delivery-card:hover {
        box-shadow: var(--shadow-lg)
    }

.dc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px
}

.dc-qr {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary)
}

.dc-details {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    font-size: 14px;
    color: var(--gray)
}

    .dc-details strong {
        color: var(--dark)
    }

.dc-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap
}

.toggle-group {
    display: flex;
    gap: 4px
}

.toggle-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 2px solid var(--border);
    background: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px
}

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

    .toggle-btn.off {
        background: var(--sidebar-bg);
        color: white;
        border-color: var(--sidebar-bg)
    }

/* Responsive Base Styles */
@media (max-width: 1024px) {
    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .auth-card {
        width: 90%;
        max-width: 400px;
        padding: 24px;
    }

        .auth-card h1 {
            font-size: 24px;
        }

    .row {
        flex-direction: column;
    }

    .col, .col-2 {
        min-width: 100%;
        flex: none;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 20px;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 14px;
    }
}
