:root {
    --brand: #7c3aed;
    --brand-dark: #5b21b6;
    --brand-soft: #f2ecff;
    --accent: #06b6d4;
    --ink: #171425;
    --muted: #78718a;
    --line: #ebe7f3;
    --surface: #ffffff;
    --soft: #f8f6fc;
    --radius: 14px;
    --radius-sm: 10px;
    --card-shadow: 0 16px 42px rgba(56, 37, 102, .11);
    --card-shadow-hover: 0 22px 54px rgba(56, 37, 102, .15);
}

* { box-sizing: border-box; }
html { width: 100%; overflow-x: hidden; text-size-adjust: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    width: 100%;
    overflow-x: hidden;
    background: var(--soft);
    color: var(--ink);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    letter-spacing: 0;
}
img, svg, canvas, video { max-width: 100%; }
button, input, select, textarea { font: inherit; max-width: 100%; }
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 22px;
    background:
        radial-gradient(circle at top left, rgba(124,58,237,.16), transparent 34%),
        linear-gradient(135deg, rgba(124,58,237,.08), rgba(6,182,212,.06) 52%, rgba(255,255,255,0)),
        var(--soft);
}
.auth-shell {
    width: min(880px, 100%);
    min-height: 520px;
    display: grid;
    grid-template-columns: .9fr 1fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(49,46,129,.16);
}
.auth-brand-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    color: #fff;
    background:
        linear-gradient(160deg, #7c3aed 0%, #5b21b6 58%, #312e81 100%);
}
.auth-logo {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #fff;
    color: var(--brand);
    font-weight: 900;
    font-size: 19px;
    margin-bottom: 20px;
}
.auth-brand-panel h1 { margin: 0 0 10px; font-size: 31px; font-weight: 900; }
.auth-brand-panel p { max-width: 320px; color: rgba(255,255,255,.86); line-height: 1.6; margin: 0; }
.auth-points { display: grid; gap: 9px; margin-top: 26px; }
.auth-points span {
    width: fit-content;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,.16);
    font-weight: 800;
    font-size: 12px;
}
.auth-points svg { width: 15px; height: 15px; }
.auth-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px 44px;
    background: #fff;
}
.auth-head span { color: var(--brand); font-weight: 900; font-size: 12px; text-transform: uppercase; }
.auth-head h2 { font-size: 27px; font-weight: 900; margin: 5px 0 6px; }
.auth-head p { color: var(--muted); margin: 0 0 22px; font-size: 13px; }
.auth-card form { display: grid; gap: 13px; margin-bottom: 16px; }
.auth-card label { color: #373047; font-size: 12px; }
.auth-card .form-control {
    min-height: 46px;
    background: #fbfbff;
    border-color: #ded6f5;
    border-radius: 8px;
}
.auth-card .form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(124,58,237,.13);
}
.password-field {
    position: relative;
    display: block;
}
.password-field .form-control {
    padding-right: 46px;
}
.password-toggle {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--brand);
}
.password-toggle:hover {
    background: var(--brand-soft);
}
.password-toggle svg {
    width: 18px;
    height: 18px;
}
.auth-switch { margin: 0; color: var(--muted); font-size: 13px; }
.auth-switch a { color: var(--brand); font-weight: 900; text-decoration: none; }
.auth-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
}
.auth-options .btn {
    min-height: 40px;
    box-shadow: 0 10px 24px rgba(56,37,102,.08);
}
.app-toast {
    position: fixed;
    right: 18px;
    top: 82px;
    max-width: min(420px, calc(100% - 36px));
    padding: 13px 16px;
    border-radius: 8px;
    background: #17191f;
    color: #fff;
    box-shadow: 0 16px 40px rgba(28,35,54,.22);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 1000;
    font-weight: 800;
    font-size: 13px;
}
.app-toast.show { opacity: 1; transform: translateY(0); }
.app-toast.success { background: #5b21b6; }
.app-toast.error { background: #be123c; }

.portal-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 226px;
    position: fixed;
    inset: 0 auto 0 0;
    overflow-y: auto;
    background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 58%, #312e81 100%);
    color: #fff;
    padding: 24px 8px;
    z-index: 20;
}
.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 0 24px 28px;
    color: #fff;
    text-decoration: none;
}
.brand svg { width: 28px; height: 28px; }
.brand strong { display: block; font-size: 17px; }
.brand small { display: block; color: rgba(255,255,255,.82); text-decoration: underline; }
.brand-logo-link {
    display: grid;
    place-items: center;
    min-height: 74px;
    padding: 10px 12px 18px;
    margin-bottom: 4px;
}
.sidebar-spacer { height: 8px; }
.brand-logo-link img {
    width: 118px;
    height: 52px;
    object-fit: contain;
    display: block;
    background: rgba(255,255,255,.96);
    border-radius: 8px;
    padding: 6px;
    box-shadow: 0 12px 26px rgba(23,20,37,.16);
}
.side-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 9px 16px;
    margin: 2px 0;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 700;
    font-size: 12px;
}
.side-nav a:hover, .side-nav a.is-active { background: rgba(255,255,255,.18); box-shadow: inset 3px 0 0 rgba(255,255,255,.85); }
.side-nav svg { width: 17px; height: 17px; flex: 0 0 auto; }
.nav-label { padding: 18px 16px 5px; color: rgba(255,255,255,.7); font-size: 11px; text-transform: uppercase; font-weight: 800; }
.courier-badge {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 18px;
    border-radius: 3px;
    color: #111;
    font-weight: 900;
    font-size: 11px;
}
.courier-badge.yellow { background: #facc15; }
.courier-badge.green { background: #22d3ee; }

.portal-main { width: 100%; margin-left: 226px; }
.topbar {
    height: 70px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { margin: 0; font-size: 19px; font-weight: 800; }
.topbar p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { text-align: right; font-size: 12px; }
.user-chip strong, .user-chip span { display: block; }
.user-chip span { color: var(--muted); }
.content-wrap { padding: 18px; }

.btn { border-radius: var(--radius-sm); font-weight: 700; font-size: 12px; min-height: 34px; display: inline-flex; align-items: center; gap: 7px; justify-content: center; }
.btn svg { width: 16px; height: 16px; }
.btn-brand { color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand-dark)); border-color: var(--brand); box-shadow: 0 8px 18px rgba(124,58,237,.2); }
.btn-brand:hover { color: #fff; background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-brand { color: var(--brand); border-color: #d8cdf8; background: #fff; }
.btn-cancel {
    color: #be123c;
    background: #fff1f5;
    border: 1px solid #fecdd3;
    min-height: 30px;
    padding-inline: 10px;
}
.btn-cancel:hover { color: #fff; background: #be123c; border-color: #be123c; }
.icon-button {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: var(--radius-sm);
    color: var(--brand);
}
.icon-button svg { width: 18px; height: 18px; }
.sidebar-toggle { display: none; }

.dashboard-grid { display: grid; grid-template-columns: 360px 1fr 166px; gap: 18px; align-items: stretch; }
.dashboard-grid > *, .two-column > *, .report-layout > * { min-width: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stat-card, .panel, .status-strip article, .ratio-card {
    background: var(--surface);
    border: 1px solid rgba(235,231,243,.9);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}
.stat-card, .panel, .ratio-card {
    transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.stat-card:hover, .panel:hover, .ratio-card:hover {
    border-color: rgba(216,205,248,.95);
    box-shadow: var(--card-shadow-hover);
}
.stat-card { min-height: 104px; padding: 16px; }
.stat-icon { display: inline-grid; place-items: center; color: var(--brand); margin-bottom: 8px; }
.stat-icon svg { width: 34px; height: 34px; stroke-width: 1.7; }
.stat-card span:not(.stat-icon), .status-strip span, .ratio-card span { display: block; color: var(--muted); font-size: 12px; }
.stat-card strong, .status-strip strong, .ratio-card strong { display: block; margin-top: 4px; font-size: 17px; }
.stat-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.user-summary-card strong { font-size: 15px; line-height: 1.25; overflow-wrap: anywhere; }
.panel { padding: 16px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 800; }
.panel-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.panel-head a { color: var(--brand); font-size: 12px; text-decoration: none; }
.ratio-stack { display: grid; gap: 14px; }
.ratio-card { display: grid; place-items: center; text-align: center; }
.ratio-card strong {
    width: 74px;
    height: 74px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 16px;
    background:
        radial-gradient(circle closest-side, #fff 71%, transparent 72%),
        conic-gradient(var(--brand) var(--ratio), #eee9fb 0);
}
.status-strip { display: grid; grid-template-columns: repeat(10, minmax(92px, 1fr)); gap: 10px; margin: 14px 0; }
.status-strip article { min-height: 58px; padding: 10px 14px; text-align: center; }
.status-card-link { color: inherit; text-decoration: none; display: block; border-radius: var(--radius); }
.status-card-link article { height: 100%; transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.status-card-link:hover article,
.status-card-link.selected article {
    border-color: var(--brand);
    box-shadow: 0 18px 44px rgba(124,58,237,.16);
}
.status-card-link.selected article { outline: 2px solid rgba(124,58,237,.95); outline-offset: -2px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .form-control { width: 110px; min-height: 34px; font-size: 12px; }
.search-box { min-height: 36px; display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 10px; min-width: 260px; }
.search-box svg { width: 16px; color: var(--muted); }
.search-box input { border: 0; outline: 0; width: 100%; font-size: 12px; }
.excel { color: #0f8a4b; background: #ecfff5; border-color: #c7f5db; }

.table { margin-bottom: 0; color: #333946; }
.table-responsive { position: relative; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-responsive::after {
    content: "";
    position: sticky;
    display: block;
    float: right;
    top: 0;
    right: 0;
    width: 26px;
    height: 1px;
    pointer-events: none;
}
.table th { background: #f7f7f8; color: #747986; font-size: 12px; font-weight: 700; white-space: nowrap; }
.table td { font-size: 12px; vertical-align: middle; border-color: var(--line); }
.table small { display: block; color: #6b7280; }
.inner-y-scroll {
    max-height: 315px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
    scrollbar-color: var(--brand) #eee8ff;
    scrollbar-width: thin;
}
.inner-y-scroll::-webkit-scrollbar { width: 7px; }
.inner-y-scroll::-webkit-scrollbar-track { background: #eee8ff; border-radius: 999px; }
.inner-y-scroll::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 999px; }
.orders-table a { color: var(--brand); text-decoration: none; }
.orders-table .tracking-link {
    color: #4c1d95;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 800;
}
.orders-table .tracking-link:hover { color: var(--brand); }
.row-actions { display: flex; gap: 6px; }
.row-actions .icon-button { width: 30px; height: 30px; }
.status-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: #ffba1a; margin-right: 6px; }
.status-dot.delivered { background: #0baa25; }
.status-dot.returned { background: #ef2222; }

.booking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 36px; align-items: start; }
.form-stack { display: grid; gap: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
label { color: #5c6370; font-size: 12px; font-weight: 700; }
.wide { grid-column: 1 / -1; }
.form-control, .form-select { border-color: var(--line); background-color: #f7f7f8; border-radius: var(--radius-sm); min-height: 38px; font-size: 13px; }
.fixed-value { display: flex; align-items: center; font-weight: 800; color: var(--brand); background: #f4efff; border-color: rgba(124, 58, 237, .28); }
.select-search { display: grid; gap: 7px; }
.select-search-input {
    background: #fff;
    border-color: #d8cdf8;
}
.city-autocomplete { position: relative; }
.city-suggestions {
    position: absolute;
    inset: calc(100% + 6px) 0 auto 0;
    display: none;
    max-height: 230px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d8cdf8;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow-hover);
    z-index: 30;
    padding: 6px;
}
.city-suggestions.show { display: grid; gap: 4px; }
.city-suggestions button {
    min-height: 34px;
    border: 0;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--ink);
    text-align: left;
    padding: 7px 9px;
    font-size: 13px;
    font-weight: 700;
}
.city-suggestions button:hover { background: var(--brand-soft); color: var(--brand); }
.city-suggestions button:disabled { color: var(--muted); cursor: default; }
.courier-panel { display: grid; gap: 14px; position: sticky; top: 88px; }
.courier-select { border: 2px solid var(--brand); background: var(--brand-soft); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.segmented input { display: none; }
.segmented label { min-height: 42px; border-radius: var(--radius-sm); background: #fff; box-shadow: 0 10px 24px rgba(56,37,102,.09); display: grid; place-items: center; cursor: pointer; }
.segmented input:checked + label { color: var(--brand); border: 1px solid var(--brand); background: var(--brand-soft); }

.courier-title { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.courier-title h2 { margin: 0; font-size: 20px; }
.upload-panel p { color: var(--muted); }
.upload-zone { min-height: 220px; border: 1px dashed #cfd4dc; border-radius: 8px; display: grid; place-items: center; align-content: center; gap: 8px; color: var(--muted); margin: 16px 0; }
.upload-zone svg { width: 42px; height: 42px; color: var(--brand); }
.timeline { display: grid; gap: 14px; margin-top: 18px; }
.timeline div { display: grid; grid-template-columns: 18px 160px 1fr; gap: 10px; align-items: center; }
.timeline span { width: 12px; height: 12px; background: var(--brand); border-radius: 50%; }
.timeline small { color: var(--muted); }
.track-result { margin-top: 16px; }
.track-empty {
    min-height: 170px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed #d8cdf8;
    border-radius: 8px;
    background: #fff;
    padding: 22px;
}
.track-empty span {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
}
.track-empty svg { width: 24px; height: 24px; }
.track-empty h2 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 900; }
.track-empty p { margin: 0; max-width: 520px; line-height: 1.5; }
.track-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}
.track-summary section {
    min-height: 76px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.track-summary span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.track-summary strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.track-remarks {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 800;
}
.compact-empty { min-height: 180px; }
.report-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-tile { min-height: 86px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); display: grid; place-items: center; align-content: center; gap: 8px; font-weight: 800; color: #333; box-shadow: var(--card-shadow); }
.report-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.report-hero h2 { margin: 0; font-size: 22px; font-weight: 900; }
.report-hero p { margin: 3px 0 0; color: var(--muted); }
.report-filter {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--card-shadow);
}
.report-tabs {
    display: inline-grid;
    grid-template-columns: repeat(4, minmax(76px, 1fr));
    gap: 6px;
}
.report-tabs button {
    min-height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: #f7f7f8;
    color: var(--ink);
    font-weight: 800;
}
.report-tabs button.is-active {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 10px 24px rgba(109,40,217,.22);
}
.report-custom {
    display: flex;
    align-items: center;
    gap: 8px;
}
.report-custom input {
    min-height: 36px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0 10px;
    background: #f7f7f8;
    font-size: 13px;
}
.report-custom .is-active { background: var(--brand-soft); color: var(--brand); border-color: rgba(124,58,237,.32); }
.report-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.report-metrics article {
    min-height: 104px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--card-shadow);
    padding: 14px;
    display: grid;
    align-content: center;
    gap: 5px;
    box-shadow: 0 10px 28px rgba(49,46,129,.05);
}
.report-metrics span, .report-metrics small { color: var(--muted); }
.report-metrics strong { font-size: 24px; font-weight: 950; overflow-wrap: anywhere; }
.report-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 14px;
    margin-bottom: 14px;
}
.report-chart { min-height: 320px; }
.report-chart canvas { max-height: 230px; }
.report-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
}
.report-rates { display: grid; gap: 12px; align-content: start; }
.report-rates h2 { margin: 0; font-size: 16px; font-weight: 900; }
.report-rates section {
    min-height: 104px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.report-rates span { color: var(--muted); font-size: 12px; }
.report-rates strong {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--ink);
    background:
        radial-gradient(circle closest-side, #fff 68%, transparent 70%),
        conic-gradient(var(--brand) var(--rate), #eee8ff 0);
}
.destination-list { display: grid; gap: 9px; }
.destination-list section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.destination-list strong { display: block; font-size: 14px; }
.destination-list span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.destination-list b {
    min-width: 38px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
}
.courier-status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}
.courier-status-head h2 { margin: 0; font-size: 22px; font-weight: 900; }
.courier-status-head p { margin: 3px 0 0; color: var(--muted); }
.courier-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.courier-status-card { display: grid; gap: 14px; }
.courier-status-title { display: flex; align-items: center; gap: 12px; }
.courier-status-title h2 { margin: 0; font-size: 18px; }
.courier-status-title small { color: var(--muted); }
.courier-status-rates {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.courier-status-rates section {
    min-height: 104px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 7px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.courier-status-rates span { color: var(--muted); font-size: 12px; }
.courier-status-rates strong {
    width: 58px;
    height: 58px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background:
        radial-gradient(circle closest-side, #fff 68%, transparent 70%),
        conic-gradient(var(--brand) var(--rate), #eee8ff 0);
}
.courier-status-list { display: grid; gap: 9px; }
.courier-status-list section { display: grid; gap: 6px; }
.courier-status-list div { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.courier-status-list span { color: var(--muted); font-size: 12px; }
.courier-status-list b { font-size: 13px; }
.courier-status-list section > i {
    height: 8px;
    display: block;
    max-width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #8b5cf6, #5b21b6);
}
.profile-panel { max-width: 420px; text-align: center; margin: 0 auto; }
.avatar { width: 80px; height: 80px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-grid; place-items: center; font-size: 34px; font-weight: 900; margin-bottom: 12px; }
.muted-copy { color: var(--muted); line-height: 1.6; margin: 0; }
.address-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.address-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--card-shadow);
}
.address-card.is-default {
    border-color: rgba(124,58,237,.55);
    background: linear-gradient(180deg, #fff, #fbf8ff);
    box-shadow: var(--card-shadow-hover);
}
.address-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.address-card-head strong { display: block; font-size: 15px; }
.address-card-head span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.address-card-head b {
    min-height: 24px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 11px;
}
.address-card p { margin: 0; color: #3f3a4f; line-height: 1.45; overflow-wrap: anywhere; }
.address-meta { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.address-meta span { display: flex; align-items: center; gap: 6px; overflow-wrap: anywhere; }
.address-meta svg { width: 14px; height: 14px; color: var(--brand); flex: 0 0 auto; }
.address-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 4px; }
.icon-button.danger { color: #dc2626; background: #fff1f2; border-color: #fecdd3; }
.sheet-entry-form {
    display: grid;
    grid-template-columns: 1.4fr 160px 1.5fr auto;
    gap: 10px;
    align-items: center;
}
.sheet-bulkbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}
.sheet-bulkbar label { display: flex; align-items: center; gap: 7px; margin: 0; }
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.detail-grid section {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.detail-grid span, .modal-address span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.detail-grid strong { font-size: 14px; overflow-wrap: anywhere; }
.order-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 18px;
    background: rgba(23,20,37,.44);
    z-index: 1200;
}
.order-modal.show { display: grid; }
.confirm-modal {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 18px;
    background: rgba(23,20,37,.44);
    z-index: 1300;
}
.confirm-modal.show { display: grid; }
.confirm-panel {
    width: min(420px, 100%);
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 24px 70px rgba(23,20,37,.26);
}
.confirm-panel h2 { margin: 0 0 8px; font-size: 18px; font-weight: 900; }
.confirm-panel p { margin: 0 0 16px; color: var(--muted); line-height: 1.5; }
.order-modal-panel {
    position: relative;
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    overflow-y: auto;
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 24px 80px rgba(23,20,37,.28);
}
.order-modal-panel h2 { margin: 0 0 14px; font-size: 18px; font-weight: 900; }
.order-modal-close { position: absolute; top: 12px; right: 12px; }
.compact-detail { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.modal-address {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.modal-address p { margin: 0; }

@media (max-width: 1100px) {
    .dashboard-grid, .two-column, .booking-layout { grid-template-columns: 1fr; }
    .report-layout { grid-template-columns: 1fr; }
    .status-strip { grid-template-columns: repeat(5, 1fr); }
    .courier-panel { position: static; }
}

@media (max-width: 760px) {
    html, body { max-width: 100%; overflow-x: hidden; }
    input, select, textarea, .form-control, .form-select, .search-box input {
        font-size: 16px;
    }
    .btn, .icon-button, .segmented label, .report-tabs button {
        touch-action: manipulation;
    }
    .portal-shell, .portal-main, .content-wrap, .panel {
        max-width: 100%;
    }
    .auth-body { padding: 14px; }
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
        border-radius: 12px;
        box-shadow: 0 18px 46px rgba(49,46,129,.14);
    }
    .auth-brand-panel {
        padding: 22px;
        min-height: 172px;
    }
    .auth-logo { width: 44px; height: 44px; margin-bottom: 12px; }
    .auth-brand-panel h1 { font-size: 23px; }
    .auth-brand-panel p { font-size: 13px; line-height: 1.45; }
    .auth-points {
        display: flex;
        flex-wrap: wrap;
        gap: 7px;
        margin-top: 16px;
    }
    .auth-points span { font-size: 11px; padding: 7px 9px; }
    .auth-card { padding: 24px; }
    .auth-head h2 { font-size: 23px; }
    .auth-options { grid-template-columns: 1fr; }
    .sidebar {
        width: min(292px, 86vw);
        padding: 12px 10px;
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 20px 0 44px rgba(23,20,37,.2);
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-spacer { height: 4px; }
    .portal-main { margin-left: 0; }
    .sidebar-toggle { display: inline-grid; }
    .topbar {
        height: auto;
        min-height: 56px;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        box-shadow: 0 8px 22px rgba(49,46,129,.07);
    }
    .topbar h1 { font-size: 16px; }
    .topbar p { display: none; }
    .top-actions { margin-left: auto; gap: 8px; }
    .top-actions .btn-brand {
        width: 38px;
        min-width: 38px;
        padding: 0;
        font-size: 0;
    }
    .top-actions .btn-brand svg { margin: 0; }
    .user-chip { display: none; }
    .content-wrap { padding: 10px; }
    .dashboard-grid { gap: 10px; }
    .report-hero { align-items: flex-start; flex-direction: column; }
    .report-hero .btn { width: 100%; }
    .courier-status-head { align-items: flex-start; flex-direction: column; }
    .courier-status-head .btn { width: 100%; }
    .courier-status-grid { grid-template-columns: 1fr; gap: 10px; }
    .courier-status-rates section { min-height: 86px; }
    .courier-status-rates strong { width: 48px; height: 48px; font-size: 12px; }
    .report-filter { align-items: stretch; flex-direction: column; }
    .report-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-custom { display: grid; grid-template-columns: 1fr 1fr; }
    .report-custom .btn { grid-column: 1 / -1; }
    .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .report-metrics article { min-height: 66px; padding: 9px; gap: 2px; }
    .report-metrics span, .report-metrics small { font-size: 10px; line-height: 1.2; }
    .report-metrics strong { font-size: 15px; }
    .report-chart { min-height: 202px; }
    .report-chart canvas { max-height: 130px; }
    .report-rates {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }
    .report-rates h2 { grid-column: 1 / -1; margin-bottom: -2px; }
    .report-rates section { min-height: 86px; gap: 6px; }
    .report-rates strong { width: 48px; height: 48px; font-size: 12px; }
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }
    .stat-card {
        min-height: 58px;
        padding: 8px;
        display: grid;
        grid-template-columns: 24px 1fr;
        grid-template-areas:
            "icon label"
            "icon value"
            "meta meta";
        align-content: center;
        column-gap: 8px;
    }
    .stat-icon { grid-area: icon; margin: 0; align-self: center; }
    .stat-icon svg { width: 20px; height: 20px; }
    .stat-card span:not(.stat-icon) {
        grid-area: label;
        font-size: 10px;
        line-height: 1.2;
        align-self: end;
    }
    .stat-card strong {
        grid-area: value;
        font-size: 14px;
        line-height: 1.1;
        align-self: start;
    }
    .stat-card small {
        grid-area: meta;
        font-size: 9.5px;
        margin-top: 4px;
    }
    .chart-panel { min-height: 190px; overflow: hidden; }
    .chart-panel canvas { max-height: 145px; }
    .ratio-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ratio-card { min-height: 88px; }
    .ratio-card strong { width: 48px; height: 48px; font-size: 12px; }
    .status-strip {
        display: flex;
        overflow-x: scroll !important;
        gap: 10px;
        padding-bottom: 3px;
        margin: 12px -12px 12px;
        padding-left: 12px;
        scroll-snap-type: x mandatory;
    }
    .status-strip .status-card-link,
    .status-strip > article {
        flex: 0 0 128px;
        scroll-snap-align: start;
    }
    .status-strip article { min-height: 58px; }
    .two-column, .form-grid, .report-grid { grid-template-columns: 1fr; }
    .two-column,
    .two-column > .panel,
    .report-layout,
    .report-layout > .panel,
    .dashboard-grid,
    .dashboard-grid > .panel {
        min-width: 0;
        overflow-x: clip;
    }
    .two-column .h-scroll,
    .report-layout .h-scroll,
    .dashboard-grid .h-scroll {
        overflow-x: auto !important;
    }
    .address-grid { grid-template-columns: 1fr; }
    .sheet-entry-form { grid-template-columns: 1fr; }
    .detail-grid, .compact-detail { grid-template-columns: 1fr; }
    .track-summary { grid-template-columns: 1fr; }
    .timeline div { grid-template-columns: 18px 1fr; }
    .timeline small { grid-column: 2; }
    .panel { padding: 13px; }
    .panel-head { align-items: flex-start; }
    .booking-layout { gap: 12px; }
    .courier-panel { gap: 12px; }
    .segmented { gap: 7px; }
    .segmented label { min-height: 40px; font-size: 12px; }
    .search-box { min-width: 100%; }
    .toolbar { gap: 8px; }
    .toolbar .form-control { width: 100%; }
    .toolbar .btn { flex: 1 1 calc(50% - 8px); }
    .table-responsive {
        margin-inline: -13px;
        padding-inline: 13px;
        padding-right: 54px;
        padding-bottom: 8px;
        width: calc(100% + 26px);
        max-width: calc(100% + 26px);
        display: block;
        overflow-x: auto;
        overflow-y: hidden;
        touch-action: pan-x;
        scroll-snap-type: x proximity;
        overscroll-behavior-x: contain;
        border-radius: 8px;
    }
    .mobile-scroll-table,
    .mobile-scroll-table-wrap .table-responsive {
        margin-inline: -13px;
        padding-inline: 13px;
        padding-bottom: 8px;
        width: calc(100% + 26px);
        max-width: calc(100% + 26px);
        overflow-x: scroll !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        scrollbar-color: var(--brand) #eee8ff;
        scrollbar-width: thin;
    }
    .mobile-scroll-table table,
    .mobile-scroll-table-wrap .table {
        width: max-content !important;
        min-width: 860px !important;
    }
    .mobile-scroll-table th,
    .mobile-scroll-table td,
    .mobile-scroll-table-wrap .table th,
    .mobile-scroll-table-wrap .table td {
        white-space: nowrap;
    }
    .h-scroll {
        display: block;
        width: 100% !important;
        max-width: 100% !important;
        margin-inline: 0 !important;
        padding-inline: 0 !important;
        padding-right: 0 !important;
        padding-bottom: 9px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x;
        overscroll-behavior-x: contain;
        scrollbar-color: var(--brand) #eee8ff;
        scrollbar-width: thin;
    }
    .h-scroll > table,
    .h-scroll .scroll-table,
    .h-scroll table {
        width: 860px !important;
        min-width: 860px !important;
        max-width: none !important;
        table-layout: auto !important;
        scroll-snap-align: start;
    }
    .h-scroll.h-scroll-compact > table,
    .h-scroll.h-scroll-compact .scroll-table,
    .h-scroll.h-scroll-compact table {
        width: 640px !important;
        min-width: 640px !important;
    }
    .h-scroll th,
    .h-scroll td {
        white-space: nowrap !important;
        overflow-wrap: normal !important;
    }
    .h-scroll::-webkit-scrollbar { height: 6px; }
    .h-scroll::-webkit-scrollbar-track { background: #eee8ff; border-radius: 999px; }
    .h-scroll::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 999px; }
    .table-responsive::-webkit-scrollbar { height: 6px; }
    .table-responsive::-webkit-scrollbar-track { background: #eee8ff; border-radius: 999px; }
    .table-responsive::-webkit-scrollbar-thumb { background: var(--brand); border-radius: 999px; }
    .table-responsive {
        scrollbar-color: var(--brand) #eee8ff;
        scrollbar-width: thin;
    }
    .table:not(.orders-table) {
        width: max-content;
        min-width: 760px;
        table-layout: auto;
    }
    .table:not(.orders-table) th,
    .table:not(.orders-table) td {
        padding: 8px 7px;
        font-size: 10px;
        white-space: nowrap;
        overflow-wrap: anywhere;
    }
    .table:not(.orders-table) th { font-size: 9px; }
    .table { width: max-content; min-width: 680px; scroll-snap-align: start; }
    .orders-table { min-width: 880px; }
    .orders-table th, .orders-table td { white-space: nowrap; }
    .orders-table td:nth-child(3), .orders-table td:nth-child(8), .orders-table td:nth-child(9) { white-space: normal; min-width: 112px; }
    .orders-table {
        width: max-content;
        min-width: 900px;
        border-collapse: collapse;
        border-spacing: 0;
    }
    .orders-table thead { display: table-header-group; }
    .orders-table tbody { display: table-row-group; }
    .orders-table tr { display: table-row; }
    .orders-table th,
    .orders-table td {
        display: table-cell;
        width: auto;
        padding: 9px 8px;
        border-color: var(--line);
        white-space: nowrap;
    }
    .orders-table td::before { content: none; }
    .orders-table td:nth-child(3),
    .orders-table td:nth-child(8),
    .orders-table td:nth-child(9) { white-space: normal; min-width: 118px; }
    .orders-table .row-actions { display: flex; flex-wrap: nowrap; }
    .row-actions .icon-button { width: 34px; height: 34px; }
    .app-toast {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 14px;
        max-width: none;
    }
}

@media (max-width: 420px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-custom { grid-template-columns: 1fr; }
    .report-custom .btn { grid-column: auto; }
    .content-wrap { padding: 10px; }
    .stat-card {
        min-height: 54px;
        padding: 7px;
        column-gap: 7px;
    }
    .stat-icon svg { width: 19px; height: 19px; }
    .stat-card span:not(.stat-icon) { font-size: 9.5px; }
    .stat-card strong { font-size: 13px; }
    .auth-brand-panel { display: none; }
    .auth-card { padding: 22px; }
    .auth-head h2 { font-size: 22px; }
}
