:root {
    --red: #b91c1c;
    --red-light: #fef2f2;
    --red-dark: #991b1b;
    --white: #ffffff;
    --off-white: #f8f6f3;
    --gray-50: #fafafa;
    --gray-100: #f5f5f4;
    --gray-200: #e7e5e4;
    --gray-300: #d6d3d1;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-600: #57534e;
    --gray-700: #44403c;
    --gray-800: #292524;
    --gray-900: #1c1917;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --amber: #d97706;
    --amber-light: #fffbeb;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

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

html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font);
    background: var(--off-white);
    color: var(--gray-800);
    line-height: 1.5;
    min-height: 100vh;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Top Bar ── */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}
.top-bar__brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: .95rem;
    color: var(--gray-800);
}
.top-bar__brand span { color: var(--red); }
.top-bar__user {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--gray-500);
}
.top-bar__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--red);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 700;
}
.top-bar__logout {
    font-size: .8rem;
    color: var(--gray-400);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all .15s;
}
.top-bar__logout:hover {
    background: var(--gray-100);
    color: var(--red);
    text-decoration: none;
}

/* ── Page Container ── */
.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

/* ── Cards ── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
}
.card__header {
    padding: 16px 20px 12px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.card__header h2,
.card__header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-700);
}
.card__body { padding: 16px 20px; }
.card__footer {
    padding: 12px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 8px;
}

/* ── Stats Grid ── */
.stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}
.stat-card__value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--gray-800);
}
.stat-card__label {
    font-size: .75rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .03em;
    margin-top: 2px;
}

/* ── Badges / Pills ── */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .02em;
}
.pill--in_transit { background: #dbeafe; color: #1d4ed8; }
.pill--confirmed { background: #fef3c7; color: #92400e; }
.pill--delivered { background: #dcfce7; color: #166534; }
.pill--pickup_scheduled { background: #e0e7ff; color: #3730a3; }
.pill--cancelled { background: #fee2e2; color: #991b1b; }
.pill--customs_clearance { background: #f3e8ff; color: #6b21a8; }
.pill--delayed { background: #fff7ed; color: #9a3412; }
.pill--quoted { background: var(--gray-100); color: var(--gray-600); }
.pill--active { background: var(--green-light); color: var(--green); }
.pill--inactive { background: var(--gray-100); color: var(--gray-500); }

/* ── Shipment List ── */
.shipment-item {
    display: block;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    padding: 16px;
    transition: box-shadow .15s;
    border: 1px solid var(--gray-100);
    color: var(--gray-800);
}
.shipment-item:hover {
    box-shadow: var(--shadow-md);
    text-decoration: none;
    border-color: var(--gray-200);
}
.shipment-item__top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}
.shipment-item__number {
    font-weight: 600;
    font-size: .95rem;
}
.shipment-item__route {
    font-size: .82rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.shipment-item__route i { color: var(--gray-300); font-size: .7rem; }
.shipment-item__meta {
    font-size: .75rem;
    color: var(--gray-400);
    display: flex;
    gap: 12px;
}

/* ── Detail Sections ── */
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    font-size: .88rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-row__label { color: var(--gray-400); }
.detail-row__value { font-weight: 500; text-align: right; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all .15s;
    font-family: inherit;
    line-height: 1.2;
}
.btn--primary {
    background: var(--red);
    color: var(--white);
}
.btn--primary:hover { background: var(--red-dark); }
.btn--secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}
.btn--secondary:hover { background: var(--gray-200); }
.btn--ghost {
    background: transparent;
    color: var(--gray-500);
}
.btn--ghost:hover { background: var(--gray-100); color: var(--gray-700); }
.btn--block { width: 100%; }
.btn--sm { padding: 7px 14px; font-size: .8rem; }
.btn--green { background: var(--green); color: var(--white); }
.btn--green:hover { background: #15803d; }
.btn--amber { background: var(--amber); color: var(--white); }
.btn--amber:hover { background: #b45309; }

/* ── Form Elements ── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 500;
    color: var(--gray-600);
    margin-bottom: 4px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    font-family: inherit;
    background: var(--white);
    color: var(--gray-800);
    transition: border-color .15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(185,28,28,.1);
}
select.form-control { appearance: auto; }
textarea.form-control { resize: vertical; min-height: 60px; }

/* ── Timeline ── */
.timeline {
    position: relative;
    padding-left: 24px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--gray-200);
}
.timeline-item {
    position: relative;
    padding-bottom: 20px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--white);
    border: 2px solid var(--gray-300);
}
.timeline-item--latest::before {
    background: var(--red);
    border-color: var(--red);
}
.timeline-item__title {
    font-size: .85rem;
    font-weight: 500;
    color: var(--gray-700);
}
.timeline-item__meta {
    font-size: .75rem;
    color: var(--gray-400);
    margin-top: 2px;
}
.timeline-item__desc {
    font-size: .8rem;
    color: var(--gray-500);
    margin-top: 4px;
}

/* ── Modal ── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,.4);
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-box {
    background: var(--white);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp .25s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--gray-100);
    position: sticky;
    top: 0;
    background: var(--white);
    z-index: 1;
}
.modal-title { font-weight: 600; font-size: 1rem; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
}
.modal-close:hover { color: var(--gray-600); }
.modal-body { padding: 16px 20px; }
.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}
.empty-state i {
    font-size: 2rem;
    display: block;
    margin-bottom: 12px;
    color: var(--gray-200);
}
.empty-state p { font-size: .88rem; }

/* ── Login Page ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--off-white) 0%, var(--white) 100%);
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 32px 24px;
}
.login-box__brand {
    text-align: center;
    margin-bottom: 28px;
}
.login-box__brand h1 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gray-800);
}
.login-box__brand h1 span { color: var(--red); }
.login-box__brand p {
    font-size: .82rem;
    color: var(--gray-400);
    margin-top: 4px;
}
.login-box .alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: .82rem;
    margin-bottom: 16px;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}
.login-box .alert--success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

/* ── Attendance ── */
.attendance-status {
    text-align: center;
    padding: 24px;
}
.attendance-status__icon {
    font-size: 3rem;
    margin-bottom: 12px;
}
.attendance-status__text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.attendance-status__sub {
    font-size: .82rem;
    color: var(--gray-400);
    margin-bottom: 20px;
}

/* ── Salary ── */
.salary-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}
.salary-stat {
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    padding: 14px;
    text-align: center;
}
.salary-stat__value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gray-800);
}
.salary-stat__label {
    font-size: .7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: .03em;
}
.salary-stat__sub {
    font-size: .7rem;
    color: var(--gray-400);
    margin-top: 2px;
}

/* ── Bank Accounts ── */
.bank-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.bank-card__name {
    font-weight: 600;
    font-size: .95rem;
    margin-bottom: 2px;
}
.bank-card__detail {
    font-size: .82rem;
    color: var(--gray-500);
}
.bank-card__badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: .65rem;
    font-weight: 500;
    background: var(--green-light);
    color: var(--green);
    margin-top: 6px;
}

/* ── Responsive ── */
@media (min-width: 768px) {
    .container { padding: 24px; }
    .stats { grid-template-columns: repeat(4, 1fr); }
    .salary-summary { grid-template-columns: repeat(4, 1fr); }
    .modal-overlay { align-items: center; }
    .modal-box { border-radius: var(--radius); }
}
