:root {
    --red: #e2231a;
    --red-dark: #b31610;
    --navy: #111d35;
    --ink: #172033;
    --muted: #687287;
    --line: #e4e8ef;
    --soft: #f5f7fb;
    --white: #fff;
    --green: #147d55;
    --amber: #a66008;
    --blue: #235dc7;
    --shadow: 0 18px 50px rgba(17, 29, 53, .10);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--soft); }
body { margin: 0; min-height: 100vh; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }

.admin-shell { display: grid; grid-template-columns: 256px minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 256px; z-index: 20; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #d7ddec; background: linear-gradient(180deg, #111d35 0%, #0a1325 100%); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 49px; height: 49px; object-fit: contain; padding: 4px; border-radius: 12px; background: var(--white); }
.brand span { display: grid; }
.brand b { color: var(--white); font-size: 20px; letter-spacing: -.02em; }
.brand small { color: #9aa7bf; font-size: 11px; letter-spacing: .13em; text-transform: uppercase; }
.sidebar nav { display: grid; gap: 7px; margin-top: 44px; }
.sidebar nav a { display: flex; align-items: center; gap: 13px; padding: 12px 14px; border-radius: 10px; color: #c7cfdf; text-decoration: none; font-weight: 650; font-size: 14px; }
.sidebar nav a span { width: 20px; text-align: center; font-size: 18px; }
.sidebar nav a:hover, .sidebar nav a.active { color: var(--white); background: rgba(255,255,255,.09); }
.sidebar nav a.active { box-shadow: inset 3px 0 var(--red); }
.sidebar-foot { margin-top: auto; display: grid; grid-template-columns: 38px 1fr 30px; align-items: center; gap: 9px; padding: 14px 7px 0; border-top: 1px solid rgba(255,255,255,.12); }
.sidebar-foot b, .sidebar-foot small { display: block; }
.sidebar-foot b { color: var(--white); font-size: 13px; }
.sidebar-foot small { color: #8f9bb2; font-size: 11px; }
.sidebar-foot form { margin: 0; }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--red); color: white; font-weight: 800; }
.icon-button { border: 0; background: transparent; color: #aeb9cd; font-size: 21px; }

.admin-main { grid-column: 2; min-width: 0; }
.topbar { min-height: 106px; display: flex; align-items: center; gap: 22px; padding: 22px clamp(22px, 4vw, 58px); background: var(--white); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 2px 0 0; font-size: clamp(23px, 3vw, 31px); letter-spacing: -.035em; }
.topbar .button { margin-left: auto; }
.eyebrow { color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.menu-toggle { display: none; border: 0; background: transparent; font-size: 24px; }
.page-content { padding: 34px clamp(22px, 4vw, 58px) 50px; }
.admin-footer { padding: 20px clamp(22px, 4vw, 58px); color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }

.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 44px; padding: 0 18px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--white); font-weight: 750; text-decoration: none; }
.button:hover { border-color: #c8cfda; }
.button.primary { color: var(--white); background: var(--red); border-color: var(--red); box-shadow: 0 8px 20px rgba(226,35,26,.2); }
.button.primary:hover { background: var(--red-dark); }
.button.danger { color: #a31712; border-color: #f3c5c2; background: #fff7f7; }
.button.compact { min-height: 39px; padding: 0 14px; font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 18px; margin-bottom: 28px; }
.stat-card, .panel { background: var(--white); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 32px rgba(17,29,53,.05); }
.stat-card { padding: 21px; position: relative; overflow: hidden; }
.stat-card::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; right: -25px; top: -24px; background: var(--accent, var(--red)); opacity: .08; }
.stat-card span { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stat-card strong { display: block; margin-top: 10px; font-size: 31px; line-height: 1; letter-spacing: -.04em; }
.stat-card small { display: block; margin-top: 10px; color: var(--muted); }
.stat-card.transit { --accent: var(--blue); }.stat-card.delivered { --accent: var(--green); }.stat-card.exception { --accent: var(--amber); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, .75fr); gap: 20px; }
.panel { overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel-body { padding: 22px; }
.quick-actions { display: grid; gap: 11px; }
.quick-action { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.quick-action:hover { border-color: #cbd2de; background: var(--soft); }
.quick-action i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 9px; color: var(--red); background: #fff0ef; font-style: normal; font-size: 19px; }
.quick-action b, .quick-action small { display: block; }.quick-action b { font-size: 13px; }.quick-action small { margin-top: 3px; color: var(--muted); font-size: 11px; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th { padding: 13px 16px; color: var(--muted); background: #fafbfc; font-size: 11px; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 15px 16px; border-top: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
.data-table tbody tr:hover { background: #fcfcfd; }
.tracking-link { color: var(--navy); font-weight: 800; text-decoration: none; }
.tracking-link:hover { color: var(--red); }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 6px 9px; border-radius: 99px; font-size: 11px; font-weight: 800; background: #eef1f5; color: #526078; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.delivered { color: var(--green); background: #eaf8f1; }.status.transit { color: var(--blue); background: #edf3ff; }.status.exception { color: var(--amber); background: #fff4df; }
.actions { display: flex; gap: 6px; }.actions a { padding: 6px 8px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; }.actions a:hover { color: var(--red); background: #fff0ef; }
.empty { padding: 45px 22px; color: var(--muted); text-align: center; }

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.search { display: flex; flex: 1; max-width: 520px; }
.search input { flex: 1; border-radius: 9px 0 0 9px; border-right: 0; }.search button { border-radius: 0 9px 9px 0; }
.result-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.pagination { display: flex; justify-content: flex-end; gap: 7px; padding: 18px 22px; border-top: 1px solid var(--line); }.pagination a, .pagination span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 7px; text-decoration: none; font-size: 12px; }.pagination span { color: white; background: var(--navy); border-color: var(--navy); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 19px; }
.field { display: grid; gap: 7px; }.field.full { grid-column: 1 / -1; }.field label { font-size: 12px; font-weight: 750; }.required { color: var(--red); }
input, select, textarea { width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); border: 1px solid #d6dbe4; border-radius: 8px; background: var(--white); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(226,35,26,.10); }
textarea { min-height: 110px; resize: vertical; }
.field small { color: var(--muted); font-size: 11px; }.error-text { color: #b31610 !important; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0; }.detail { padding: 17px 22px; border-bottom: 1px solid var(--line); }.detail:nth-child(odd) { border-right: 1px solid var(--line); }.detail span, .detail strong { display: block; }.detail span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }.detail strong { margin-top: 5px; font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }.timeline li { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 18px; margin-left: 17px; padding: 0 0 27px 32px; border-left: 2px solid var(--line); }.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }.event-symbol { position: absolute; left: -18px; top: -4px; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid #d7dde7; border-radius: 10px; color: #667288; background: #f4f6f9; }.event-symbol svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }.event-symbol.accepted,.event-symbol.facility,.event-symbol.transportation { color: var(--blue); background: #edf3ff; border-color: #cbdcff; }.event-symbol.clearance,.event-symbol.attempted { color: var(--amber); background: #fff4df; border-color: #f1d69d; }.event-symbol.out-for-delivery { color: var(--red); background: #fff0ef; border-color: #f2c6c3; }.event-symbol.delivered { color: var(--green); background: #eaf8f1; border-color: #bce4d1; }.timeline b { display: block; font-size: 13px; }.timeline span, .timeline p { color: var(--muted); font-size: 12px; }.timeline p { margin: 5px 0 0; }.event-management { margin-top: 20px; }.event-actions { display: flex; align-items: start; gap: 6px; }.event-actions a,.system-event-label { padding: 6px 9px; border-radius: 7px; color: var(--blue); background: #edf3ff; font-size: 11px; font-weight: 800; text-decoration: none; }.event-actions a.delete { color: #a31712; background: #fff0ef; }.system-event-label { color: var(--muted) !important; background: var(--soft); }
.alert { margin: 20px clamp(22px, 4vw, 58px) 0; padding: 13px 16px; border: 1px solid #bbe7d2; border-radius: 9px; color: #12613f; background: #effaf5; font-size: 13px; }.alert.error { border-color: #f1c3c0; color: #9d1b15; background: #fff4f3; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.15fr) minmax(440px, .85fr); background: white; }
.auth-visual { position: relative; display: flex; flex-direction: column; padding: clamp(32px, 5vw, 70px); overflow: hidden; color: white; background: linear-gradient(135deg, rgba(9,19,38,.96), rgba(20,35,62,.91)), url('../../assets/images/speedex-fleet.webp') center/cover; }
.auth-visual::after { content: ""; position: absolute; width: 460px; height: 460px; right: -180px; bottom: -220px; border: 70px solid rgba(226,35,26,.15); border-radius: 50%; }
.brand.light { position: relative; z-index: 1; width: fit-content; }.auth-message { position: relative; z-index: 1; margin: auto 0; max-width: 590px; }.auth-message h1 { margin: 12px 0 20px; font-size: clamp(43px, 6vw, 76px); line-height: .98; letter-spacing: -.055em; }.auth-message p { max-width: 510px; color: #c7d0e2; line-height: 1.7; }.auth-copyright { position: relative; z-index: 1; margin: 0; color: #8f9bb2; font-size: 11px; }
.auth-panel { display: grid; place-items: center; padding: 36px; }.auth-card { width: min(100%, 420px); }.auth-card h2 { margin: 0; font-size: 31px; letter-spacing: -.04em; }.auth-card > p { margin: 9px 0 28px; color: var(--muted); line-height: 1.6; font-size: 13px; }.auth-card form { display: grid; gap: 17px; }.password-wrap { position: relative; }.password-wrap input { padding-right: 58px; }.password-wrap button { position: absolute; right: 8px; top: 8px; width: auto; min-height: 29px; padding: 0 7px; border: 0; color: var(--red); background: transparent; font-size: 11px; font-weight: 800; }.auth-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }.auth-row a, .text-link { color: var(--red); font-size: 12px; font-weight: 750; text-decoration: none; }.auth-card .button { width: 100%; }.auth-note { margin-top: 22px; padding: 13px; border-radius: 8px; color: var(--muted); background: var(--soft); font-size: 11px; line-height: 1.55; }.auth-error { padding: 11px 13px; border: 1px solid #f1c3c0; border-radius: 8px; color: #9d1b15; background: #fff4f3; font-size: 12px; }

@media (max-width: 980px) {
    .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }.dashboard-grid { grid-template-columns: 1fr; }
    .auth-page { grid-template-columns: 1fr; }.auth-visual { display: none; }.auth-panel { min-height: 100vh; }
}
@media (max-width: 760px) {
    .admin-shell { display: block; }.sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }.sidebar.open { transform: translateX(0); }.admin-main { width: 100%; }.menu-toggle { display: block; }.topbar { min-height: 86px; }.topbar .button { display: none; }.page-content { padding-top: 24px; }.form-grid, .detail-grid { grid-template-columns: 1fr; }.detail:nth-child(odd) { border-right: 0; }.toolbar { align-items: stretch; flex-direction: column; }.result-count { margin-left: 0; }.auth-panel { padding: 25px; }
}
@media (max-width: 480px) { .stats { grid-template-columns: 1fr; }.form-actions { flex-direction: column-reverse; }.form-actions .button { width: 100%; } }
