/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f0f4f8; color: #1a202c; font-size: 15px; -webkit-tap-highlight-color: transparent; }
a { text-decoration: none; color: inherit; }

/* ── Sidebar layout ────────────────────────────────────────────────────────── */
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 220px; background: #1e293b; display: flex; flex-direction: column; z-index: 100; }
.sidebar-brand { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand-name { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.sidebar-brand-sub  { font-size: 11px; color: #64748b; margin-top: 1px; }
.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: #94a3b8; font-size: 14px; font-weight: 500; transition: all .15s; margin-bottom: 2px; }
.sidebar-nav a:hover  { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.12); color: #fff; font-weight: 700; }
.sidebar-nav .nav-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: .7; transition: opacity .15s; }
.sidebar-nav a:hover .nav-icon, .sidebar-nav a.active .nav-icon { opacity: 1; }
.sidebar-footer { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { font-size: 12px; color: #94a3b8; margin-bottom: 8px; }
.sidebar-user strong { color: #e2e8f0; display: block; font-size: 13px; }
.sidebar-logout { display: block; font-size: 12px; color: #64748b; padding: 5px 0; }
.sidebar-logout:hover { color: #94a3b8; }

/* ── Page shell (sits right of sidebar) ─────────────────────────────────── */
.page-shell { margin-left: 220px; min-height: 100vh; display: flex; flex-direction: column; }
.page-header { background: #fff; border-bottom: 1px solid #e2e8f0; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: sticky; top: 0; z-index: 50; }
.page-header-title { font-size: 16px; font-weight: 700; color: #1e293b; }
.page-header-right  { display: flex; align-items: center; gap: 10px; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.page-body { padding: 20px 24px; max-width: 1400px; }

/* ── Summary bar ───────────────────────────────────────────────────────────── */
.summary-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat-card { background: #fff; border-radius: 10px; padding: 14px 18px; flex: 1; min-width: 120px; box-shadow: 0 1px 3px rgba(0,0,0,.07); }
.stat-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.stat-value { font-size: 24px; font-weight: 800; color: #1e293b; line-height: 1; }
.stat-value.accent  { color: #2563eb; }
.stat-value.warning { color: #d97706; }
.stat-value.danger  { color: #dc2626; }
.stat-value.success { color: #16a34a; }

/* ── Filter bar ────────────────────────────────────────────────────────────── */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; padding: 5px 14px; border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1.5px solid #e2e8f0; background: #fff; color: #475569; transition: all .15s; white-space: nowrap; }
.chip:hover   { border-color: #2563eb; color: #2563eb; }
.chip.active  { background: #2563eb; border-color: #2563eb; color: #fff; }
.chip.warning { background: #fef9c3; border-color: #fde68a; color: #854d0e; }
.chip.danger  { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }

/* ── Tabs ──────────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid #e2e8f0; margin-bottom: 20px; }
.tab { padding: 10px 20px; font-size: 14px; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; background: none; border-top: none; border-left: none; border-right: none; }
.tab:hover  { color: #1e293b; }
.tab.active { color: #2563eb; border-bottom-color: #2563eb; }

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.07); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f8fafc; padding: 11px 14px; text-align: left; font-size: 11px; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody td { padding: 11px 14px; font-size: 14px; vertical-align: middle; }
.td-mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 13px; }

/* ── Badges ────────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-cod      { background: #fee2e2; color: #991b1b; }
.badge-prepaid  { background: #d1fae5; color: #065f46; }
.badge-overdue  { background: #fee2e2; color: #991b1b; }
.badge-today    { background: #fef9c3; color: #854d0e; }
.badge-future   { background: #e0f2fe; color: #0c4a6e; }
.badge-pending  { background: #e2e8f0; color: #475569; }
.badge-arrived  { background: #fef9c3; color: #854d0e; }
.badge-delivered{ background: #dcfce7; color: #166534; }
.badge-failed   { background: #fee2e2; color: #991b1b; }
.badge-own-fleet    { background: #e0f2fe; color: #0369a1; }
.badge-per-order    { background: #fae8ff; color: #7e22ce; }
.badge-third-party  { background: #fff7ed; color: #9a3412; }
.badge-employee     { background: #f0fdf4; color: #166534; }
.badge-store-pickup { background: #f1f5f9; color: #475569; }

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; border: none; transition: all .15s; white-space: nowrap; }
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover  { background: #b91c1c; }
.btn-ghost     { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }
.btn-ghost:hover { background: #e2e8f0; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card { background: #fff; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 18px; }
.card + .card { margin-top: 12px; }
.card-title { font-size: 13px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 64px 24px; color: #94a3b8; }
.empty-state .icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .title { font-size: 16px; font-weight: 600; color: #64748b; margin-bottom: 6px; }
.empty-state .desc  { font-size: 14px; }

/* ── Action bar (selection) ────────────────────────────────────────────────── */
.action-bar { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; border-radius: 14px; padding: 14px 20px; display: flex; align-items: center; gap: 16px; box-shadow: 0 8px 32px rgba(0,0,0,.25); z-index: 100; white-space: nowrap; }
.action-bar .count { font-size: 14px; font-weight: 700; }
.action-bar .cod   { font-size: 13px; color: #94a3b8; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 5px; }
.form-input { width: 100%; padding: 9px 12px; border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s; font-family: inherit; }
.form-input:focus { border-color: #2563eb; }
select.form-input { cursor: pointer; }

/* ── Alerts / banners ──────────────────────────────────────────────────────── */
.banner { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.banner-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fde68a; }
.banner-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.banner-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.banner-info    { background: #e0f2fe; color: #0c4a6e; border: 1px solid #bae6fd; }

/* ── Spinner ───────────────────────────────────────────────────────────────── */
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid #e2e8f0; border-top-color: #2563eb; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Divider ───────────────────────────────────────────────────────────────── */
.divider { border: none; border-top: 1px solid #e2e8f0; margin: 16px 0; }

/* ── Section title ─────────────────────────────────────────────────────────── */
.section-title { font-size: 13px; font-weight: 700; color: #475569; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
