* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
}
a {
    text-decoration: none;
    color: inherit;
}

/* ─── Login ─── */
.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
}
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    width: 380px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}
.login-logo {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: linear-gradient(135deg, #e8630a, #ff8c42);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
}
.login-card h1 {
    font-size: 22px;
    margin-bottom: 4px;
}
.login-sub {
    font-size: 13px;
    color: #666;
    margin-bottom: 24px;
}
.login-card input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
}
.login-card input:focus {
    border-color: #e8630a;
}
.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8630a, #ff8c42);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 4px;
}
.login-hint {
    font-size: 11px;
    color: #999;
    margin-top: 16px;
}
.alert {
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
}
.alert.error {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}
.alert.success {
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
}

/* ─── Topnav ─── */
.topnav {
    background: #1a1a2e;
    color: #fff;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.topnav .brand {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.topnav .brand::before {
    content: "⚡";
    margin-right: 6px;
}
.nav-links {
    display: flex;
    gap: 4px;
}
.nav-links a {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s;
}
.nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
}
.nav-links a.active {
    background: rgba(255, 255, 255, 0.15);
}
.logout-link {
    color: #fca5a5 !important;
}

/* ─── Admin Main ─── */
.admin-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 24px;
}
.page-header .sub {
    font-size: 13px;
    color: #666;
}

/* ─── Stats ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}
.stat-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.stat-card .stat-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 4px;
}
.stat-card .stat-sub {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}
.stat-card.orange .stat-value {
    color: #e8630a;
}
.stat-card.green .stat-value {
    color: #16a34a;
}
.stat-card.blue .stat-value {
    color: #2563eb;
}
.stat-card.purple .stat-value {
    color: #9333ea;
}

/* ─── Card ─── */
.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    margin-bottom: 20px;
}
.card h2 {
    font-size: 16px;
    margin-bottom: 16px;
}

/* ─── Table ─── */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
th,
td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
th {
    font-weight: 600;
    color: #666;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
tr:hover td {
    background: #fafafa;
}
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge.onway {
    background: #fef3c7;
    color: #d97706;
}
.badge.preparing {
    background: #dbeafe;
    color: #2563eb;
}
.badge.delivered {
    background: #dcfce7;
    color: #16a34a;
}
.badge.pending {
    background: #f3e8ff;
    color: #9333ea;
}
.badge.active {
    background: #dcfce7;
    color: #16a34a;
}
.badge.inactive {
    background: #fef2f2;
    color: #dc2626;
}
.actions-cell {
    display: flex;
    gap: 4px;
}
.btn-sm {
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    font-size: 12px;
    cursor: pointer;
    font-weight: 500;
}
.btn-edit {
    background: #f0f0f0;
    color: #333;
}
.btn-edit:hover {
    background: #e0e0e0;
}
.btn-danger {
    background: #fef2f2;
    color: #dc2626;
}
.btn-danger:hover {
    background: #fee2e2;
}
select.status-select {
    padding: 5px 8px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 12px;
    background: #fff;
    cursor: pointer;
}

/* ─── Form ─── */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.form-grid.one-col {
    grid-template-columns: 1fr;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 13px;
    outline: none;
}
.form-group input:focus {
    border-color: #e8630a;
}
.btn-primary {
    padding: 10px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #e8630a, #ff8c42);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.btn-primary:hover {
    opacity: 0.9;
}
.btn-secondary {
    padding: 10px 24px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #fff;
    color: #333;
    font-size: 13px;
    cursor: pointer;
}

/* ─── Modal ─── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.open {
    display: flex;
}
.modal {
    background: #fff;
    border-radius: 20px;
    padding: 32px;
    width: 480px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
}
.modal h2 {
    margin-bottom: 20px;
    font-size: 18px;
}
.modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
}
