:root {
    --navy: #071a33;
    --navy-soft: #10355e;
    --blue: #0674c8;
    --blue-dark: #045d9f;
    --blue-light: #eaf5fd;
    --create: #07845a;
    --create-dark: #056c49;
    --filter: #4f46e5;
    --filter-dark: #4338ca;
    --export: #087f8c;
    --export-dark: #066773;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --background: #f2f6fa;
    --border: #d8e2ec;
    --border-strong: #c5d2df;
    --text: #14202c;
    --muted: #617487;
    --danger: #b42318;
    --shadow: 0 1px 2px rgba(7, 26, 51, 0.04), 0 10px 28px rgba(7, 26, 51, 0.06);
    --shadow-hover: 0 2px 4px rgba(7, 26, 51, 0.06), 0 16px 36px rgba(7, 26, 51, 0.1);
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 18px;
    --control-height: 44px;
    --control-height-compact: 38px;
    --control-padding-x: 12px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 75% -10%, rgba(6, 116, 200, 0.06), transparent 28rem),
        var(--background);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
a:focus-visible {
    outline: 3px solid rgba(6, 116, 200, 0.22);
    outline-offset: 3px;
    border-radius: 4px;
}
.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    padding: 26px 18px;
    color: #fff;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background:
        radial-gradient(circle at 15% 5%, rgba(20, 113, 181, 0.22), transparent 13rem),
        var(--navy);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.brand, .login-brand {
    display: flex;
    flex-direction: column;
    text-decoration: none;
}
.brand { padding: 4px 10px; }

.brand-name {
    color: #fff;
    font-size: 1.65rem;
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.07em;
}

.brand-caption {
    margin-top: 2px;
    color: #a8d1ed;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.sidebar-nav {
    display: grid;
    gap: 4px;
    margin-top: 38px;
}
.nav-section-label {
    margin: 17px 12px 3px;
    color: #7894ad;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.sidebar-nav a {
    position: relative;
    display: flex;
    min-height: 44px;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #c6d4e2;
    font-size: 0.92rem;
    font-weight: 650;
    text-decoration: none;
    transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    transform: translateX(2px);
}
.sidebar-nav .is-active {
    border-color: rgba(112, 194, 246, 0.12);
    color: #fff;
    background: linear-gradient(90deg, #123d6c, var(--navy-soft));
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}
.sidebar-nav .is-active::before {
    position: absolute;
    inset: 10px auto 10px -18px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: #4db6f3;
    content: "";
}
.nav-icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: 0.85;
}
.sidebar-nav .is-active .nav-icon { opacity: 1; }

.has-sidebar .page-shell { min-width: 0; margin-left: 264px; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    padding: 11px 38px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(14px);
}

.topbar-user { display: flex; align-items: center; gap: 11px; }
.user-avatar {
    display: grid;
    width: 38px;
    height: 38px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), #4f46e5);
    font-size: 0.82rem;
    font-weight: 900;
    box-shadow: 0 5px 13px rgba(6, 116, 200, 0.24);
}
.user-copy { display: grid; text-align: right; }
.topbar small { color: var(--muted); }
.customer-brand {
    display: flex;
    flex-direction: column;
    margin-right: auto;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--navy);
    text-decoration: none;
}
.content { width: 100%; max-width: 1600px; min-width: 0; margin: 0 auto; padding: 38px 40px 64px; }
.page-heading {
    display: flex;
    min-height: 72px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    margin-bottom: 28px;
}
.actions, .form-actions, .section-heading {
    display: flex;
    align-items: center;
    gap: 10px;
}
.section-heading { justify-content: space-between; }
.actions form { margin: 0; }
.inline-form { display: inline; margin: 0; }
.link-button { padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; text-decoration: underline; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(1.8rem, 2.2vw, 2.35rem); line-height: 1.08; letter-spacing: -0.035em; }
h2 { margin-bottom: 12px; font-size: 1.12rem; line-height: 1.25; letter-spacing: -0.012em; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-size: 0.72rem; font-weight: 850; letter-spacing: 0.14em; text-transform: uppercase; }
.muted { color: var(--muted); }
.reference-highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 9px;
}
.reference-highlights span {
    display: grid;
    gap: 2px;
    min-width: 160px;
    padding: 8px 11px;
    border: 1px solid #b9d9ef;
    border-radius: 9px;
    background: var(--blue-light);
}
.reference-highlights small,
.shipment-references-cell small span {
    color: var(--muted);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}
.reference-highlights strong { overflow-wrap: anywhere; color: var(--navy); }
.shipment-references-cell { min-width: 180px; }
.shipment-references-cell > strong,
.shipment-references-cell > small { display: block; }
.shipment-references-cell > small { margin-top: 5px; overflow-wrap: anywhere; }
.shipment-references-cell small span { margin-right: 6px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
}

.dashboard-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.dashboard-columns {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    align-items: start;
}

.compact-list { display: grid; }
.compact-list > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 9px;
    border-bottom: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 140ms ease, padding-left 140ms ease;
}
.compact-list > a:last-child { border-bottom: 0; }
.compact-list > a:hover { padding-left: 13px; background: var(--blue-light); }
.compact-list > a:hover strong { color: var(--blue-dark); }
.compact-list span { display: grid; gap: 3px; }
.compact-list small { color: var(--muted); }
.compact-list time, .compact-list b { font-size: 0.82rem; white-space: nowrap; }

.metric-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric-card, .panel {
    min-width: 0;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    --metric-accent: var(--blue);
    --metric-tint: var(--blue-light);
    position: relative;
    display: grid;
    min-height: 142px;
    align-content: start;
    gap: 7px;
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}
.metric-card::before {
    position: absolute;
    inset: 0 0 auto;
    height: 3px;
    background: var(--metric-accent);
    content: "";
}
.metric-card:hover { border-color: color-mix(in srgb, var(--metric-accent) 35%, var(--border)); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.metric-card:nth-child(2) { --metric-accent: #4f46e5; --metric-tint: #eef2ff; }
.metric-card:nth-child(3) { --metric-accent: #07845a; --metric-tint: #eafaf3; }
.metric-card:nth-child(4) { --metric-accent: #d97706; --metric-tint: #fff7e8; }
.metric-card:nth-child(5) { --metric-accent: #087f8c; --metric-tint: #eaf9fb; }
.metric-card:nth-child(6) { --metric-accent: #b45309; --metric-tint: #fff7ed; }
.metric-card:nth-child(7) { --metric-accent: #7c3aed; --metric-tint: #f5f0ff; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric-icon {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 10px;
    color: var(--metric-accent);
    background: var(--metric-tint);
}
.metric-icon .icon { width: 17px; height: 17px; }
.metric-card small, .metric-label { color: var(--muted); }
.metric-label { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.035em; text-transform: uppercase; }
.metric-value { font-size: 1.7rem; line-height: 1.05; letter-spacing: -0.035em; }
.panel { margin-top: 22px; }
.panel p { margin-bottom: 0; color: var(--muted); }
.dashboard-panel { min-height: 0; margin-top: 0; }
.dashboard-panel .section-heading { align-items: flex-start; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.section-link {
    color: var(--blue-dark);
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: none;
    white-space: nowrap;
}
.section-link::after { content: " →"; }
.section-link:hover { color: var(--blue); }

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.button-primary { color: #fff; background: var(--blue); box-shadow: 0 6px 14px rgba(6, 116, 200, 0.18); }
.button-secondary { color: var(--text); border-color: var(--border); background: #fff; }
.button-danger { color: #fff; background: var(--danger); }
.button-create { color: #fff; background: var(--create); box-shadow: 0 6px 14px rgba(7, 132, 90, 0.2); }
.button-filter { color: #fff; background: var(--filter); box-shadow: 0 6px 14px rgba(79, 70, 229, 0.18); }
.button-export { color: #fff; background: var(--export); box-shadow: 0 6px 14px rgba(8, 127, 140, 0.18); }
.button-create::before {
    content: "+";
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
}
.button-filter::before {
    content: "";
    width: 15px;
    height: 15px;
    background: currentColor;
    clip-path: polygon(0 0, 100% 0, 62% 45%, 62% 88%, 38% 100%, 38% 45%);
}
.button:hover { transform: translateY(-1px); }
.button-primary:hover { background: var(--blue-dark); }
.button-secondary:hover { border-color: #aebdca; background: #f8fafc; }
.button-danger:hover { background: #921c13; }
.button-create:hover { background: var(--create-dark); }
.button-filter:hover { background: var(--filter-dark); }
.button-export:hover { background: var(--export-dark); }
.button:focus-visible, .icon-button:focus-visible {
    outline: 3px solid rgba(0, 112, 192, 0.25);
    outline-offset: 2px;
}
.button:disabled, .button[aria-disabled="true"] {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}
.button-small { min-height: 34px; padding: 6px 11px; border-radius: 8px; font-size: 0.76rem; }
.button-block { width: 100%; }
.button-icon {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.button-logout { min-height: 38px; padding: 7px 13px; color: #344557; }

.filters {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(160px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--filter);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.filters input, .filters select {
    width: 100%;
    min-width: 0;
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 9px var(--control-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-subtle);
    transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
.filters input:hover, .filters select:hover { border-color: var(--border-strong); background: #fff; }
.filters input:focus, .filters select:focus {
    border-color: var(--filter);
    outline: 3px solid rgba(79, 70, 229, 0.12);
    background: #fff;
}
.filters-grid { grid-template-columns: minmax(260px, 2fr) repeat(4, minmax(130px, 1fr)) auto; }
.filters-wide { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.filters-wide > input:first-child { grid-column: span 2; }
.filters > .button { width: 100%; min-height: var(--control-height); }
.filter-date { display: grid; min-width: 0; align-content: start; gap: 5px; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.filter-date input { min-width: 0; }

.report-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(160px, 1fr)) auto;
    align-items: end;
    gap: 12px 16px;
    margin-bottom: 22px;
    padding: 20px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--filter);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.report-filters-wide { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.report-filters .field { margin-bottom: 0; }
.report-filters select, .report-filters input[type="date"] {
    width: 100%;
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}
.status-options {
    min-width: 0;
    min-height: var(--control-height);
    margin: 0;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
}
.status-options legend { padding: 0 4px; font-size: 0.78rem; font-weight: 700; }
.status-options > div { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.status-options label { font-size: 0.82rem; white-space: nowrap; }
.report-filters .form-actions { min-width: 0; align-items: stretch; }
.report-filters .form-actions .button { min-height: var(--control-height); }
.report-filters-week-status { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-filters-week-status > .field:first-of-type,
.report-filters-week-status .status-options { grid-column: span 2; }
.report-filters-week-status .form-actions { grid-column: 3 / 5; }
.report-toolbar { margin: 18px 0 12px; }
.report-toolbar p { margin: 0; }
.report-table { min-width: 1100px; }
.report-table-wide { min-width: 2100px; }
.report-table-freight { min-width: 1900px; }
.report-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}
.report-summary-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.report-summary article {
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.report-summary span { color: var(--muted); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.report-summary strong { font-size: 1.08rem; }
.report-empty { text-align: center; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 1px 2px rgba(7, 26, 51, 0.03);
}

table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid #e2e9f0; text-align: left; vertical-align: middle; }
th { position: sticky; top: 0; z-index: 2; color: #5d7185; background: #f5f8fb; font-size: 0.7rem; font-weight: 850; letter-spacing: 0.065em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { background: #fff; transition: background-color 120ms ease; }
tbody tr:not(.shipment-row-orange, .shipment-row-yellow, .shipment-row-light_blue):hover { background: #f7fbfe; }
td small { color: var(--muted); }
.empty-cell { padding: 32px; color: var(--muted); text-align: center; }
.actions-column {
    left: 0;
    z-index: 4;
    width: 76px;
    min-width: 76px;
    text-align: center;
}
.action-cell {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
    text-align: center;
    box-shadow: 7px 0 12px -12px rgba(7, 26, 51, 0.7);
}
.table-actions {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}
.icon-button {
    display: inline-grid;
    width: 36px;
    height: 36px;
    place-items: center;
    padding: 0;
    border: 1px solid #b9d9ef;
    border-radius: 10px;
    color: #0064aa;
    background: var(--blue-light);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}
.icon-button:hover {
    border-color: var(--blue);
    color: #fff;
    background: var(--blue);
    transform: translateY(-1px);
}
.icon-button-danger {
    border-color: #efc0bc;
    color: var(--danger);
    background: #fff2f1;
}
.icon-button-danger:hover {
    border-color: var(--danger);
    color: #fff;
    background: var(--danger);
}
.icon-button-success {
    border-color: #a9ddc8;
    color: var(--create-dark);
    background: #ecfbf5;
}
.icon-button-success:hover {
    border-color: var(--create);
    color: #fff;
    background: var(--create);
}
.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.cell-wrap { min-width: 180px; max-width: 300px; white-space: normal; }
.shipment-table { min-width: 1700px; }
.freight-reference-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.freight-reference-header h3 { margin: 2px 0 0; font-size: 1.25rem; }
.freight-reference-currency { margin-bottom: 22px; }
.freight-reference-currency-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 0.82rem;
}
.freight-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.freight-card {
    display: grid;
    gap: 7px;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
}
.freight-card-cost { border-top-color: #d97706; }
.freight-card-margin { border-top-color: #07845a; }
.freight-card-negative { border-color: #ef4444; background: #fff1f2; }
.freight-card > span { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.freight-card > strong { font-size: 1.25rem; }
.freight-card > small { color: var(--muted); }
.freight-table-cell { min-width: 235px; }
.freight-table-cell small { display: block; white-space: nowrap; }
.negative-value { color: #b91c1c; font-weight: 700; }
.empty-state-inline { padding: 16px; border-radius: var(--radius-sm); color: var(--muted); background: var(--surface-subtle); }
.shipment-row-orange { background: #fff1e6; }
.shipment-row-yellow { background: #fff8cc; }
.shipment-row-light_blue { background: #e6f6ff; }

.dt-container {
    width: 100%;
    max-width: 100%;
    min-width: 100%;
    padding: 0;
}
.dt-container .dt-layout-row {
    margin: 0;
    padding: 14px 16px;
}
.dt-container .dt-layout-row:first-child {
    border-bottom: 1px solid var(--border);
    background: #fbfdff;
}
.dt-container .dt-layout-row:last-child {
    border-top: 1px solid var(--border);
    background: #fbfdff;
}
.dt-container .dt-layout-cell { display: flex; align-items: center; }
.dt-container .dt-layout-end { justify-content: flex-end; }
.dt-container .dt-length,
.dt-container .dt-search {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}
.dt-container .dt-input {
    height: var(--control-height-compact);
    min-height: var(--control-height-compact);
    padding: 8px 11px;
    border: 1px solid var(--border) !important;
    border-radius: 9px !important;
    color: var(--text);
    background: #fff !important;
}
.dt-container .dt-search .dt-input {
    width: min(320px, 40vw);
    margin-left: 0;
}
.dt-container .dt-input:focus {
    border-color: var(--blue) !important;
    outline: 3px solid var(--blue-light) !important;
}
.dt-container .dt-info { color: var(--muted); font-size: 0.82rem; }
.dt-container .dt-paging .dt-paging-button {
    min-width: 34px;
    min-height: 34px;
    margin-left: 4px;
    padding: 6px 9px !important;
    border: 1px solid var(--border) !important;
    border-radius: 7px !important;
    color: var(--text) !important;
    background: #fff !important;
}
.dt-container .dt-paging .dt-paging-button.current,
.dt-container .dt-paging .dt-paging-button:hover {
    border-color: var(--blue) !important;
    color: #fff !important;
    background: var(--blue) !important;
}
.dt-container .dt-paging .dt-paging-button.disabled {
    color: #9ba8b4 !important;
    opacity: 0.65;
}
table.dataTable { margin: 0 !important; }
table.dataTable > thead > tr > th,
table.dataTable > thead > tr > td {
    border-bottom: 1px solid var(--border);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    border: 1px solid rgba(7, 89, 133, 0.08);
    border-radius: 999px;
    color: #075985;
    background: #e0f2fe;
    font-size: 0.69rem;
    font-weight: 800;
    letter-spacing: 0.015em;
}
.badge-success { color: #166534; background: #dcfce7; }
.badge-warning { color: #92400e; background: #fef3c7; }
.badge-muted { color: #475569; background: #e2e8f0; }
.badge-status-sent { color: #166534; background: #dcfce7; }
.badge-status-failed { color: #991b1b; background: #fee2e2; }
.badge-status-pending { color: #92400e; background: #fef3c7; }

.stacked-form { display: grid; gap: 20px; }
.stacked-form .panel { margin-top: 0; }
.stacked-form > .panel > h2 {
    margin: -24px -24px 22px;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, #f8fbfe, #fff);
}
.stacked-form > .form-actions {
    width: max-content;
    padding: 2px 0;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 22px; }
.form-grid .field:has(textarea) { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
    width: 100%;
    min-width: 0;
    height: var(--control-height);
    min-height: var(--control-height);
    padding: 10px var(--control-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-subtle);
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.field textarea { height: auto; min-height: 92px; resize: vertical; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-strong); background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--blue);
    outline: 3px solid rgba(6, 116, 200, 0.11);
    background: #fff;
}
.field input:disabled, .field select:disabled, .field textarea:disabled,
.field input[readonly], .field textarea[readonly] {
    color: #526579;
    background: #edf2f7;
    cursor: not-allowed;
    opacity: 1;
}
.field input[type="checkbox"] { width: auto; height: auto; min-height: auto; }
.field-invalid input, .field-invalid select, .field-invalid textarea { border-color: var(--danger); }
.help-text { color: var(--muted); font-size: 0.76rem; line-height: 1.45; }
.field { display: grid; min-width: 0; align-content: start; gap: 8px; margin: 0; }
.field label { color: #344557; font-size: 0.8rem; font-weight: 780; }

.location-autocomplete { position: relative; }
.location-suggestions {
    position: absolute;
    z-index: 60;
    top: calc(var(--control-height) + 30px);
    right: 0;
    left: 0;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border-strong);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 16px 34px rgba(15, 38, 62, 0.16);
}
.location-suggestion {
    display: grid;
    width: 100%;
    gap: 3px;
    padding: 11px 14px;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    text-align: left;
    background: #fff;
    cursor: pointer;
}
.location-suggestion:last-child { border-bottom: 0; }
.location-suggestion:hover,
.location-suggestion.is-active { background: var(--blue-light); }
.location-suggestion strong { font-size: 0.86rem; }
.location-suggestion small { color: var(--muted); font-size: 0.74rem; }
.location-search-status { min-height: 1em; color: var(--muted); font-size: 0.72rem; }
.location-autocomplete input[aria-invalid="true"] { border-color: var(--danger); }

.route-map-panel { overflow: hidden; padding: 0; }
.route-map-heading { padding: 20px 22px 0; }
.route-map-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.25fr) minmax(250px, 0.75fr);
    gap: 0;
    margin-top: 16px;
    border-top: 1px solid var(--border);
}
.shipment-route-map { width: 100%; min-height: 390px; background: #e8f1f8; }
.route-coordinate-list { display: grid; align-content: start; padding: 20px; background: var(--surface-subtle); }
.route-coordinate {
    display: grid;
    gap: 5px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
}
.route-coordinate:last-child { border-bottom: 0; }
.route-coordinate span { color: var(--muted); font-size: 0.73rem; font-weight: 800; text-transform: uppercase; }
.route-coordinate strong { overflow-wrap: anywhere; font-size: 0.9rem; }
.route-coordinate code { color: #526579; font-size: 0.78rem; }
.route-marker {
    display: block;
    width: 19px;
    height: 19px;
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(15, 38, 62, 0.35);
}
.route-marker-origin { background: #0674c8; }
.route-marker-destination { background: #f97316; }

.attachment-upload-form {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin: 18px 0 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface-subtle);
}
.attachment-upload-form .button { min-height: var(--control-height); }
.attachment-upload-form input[type="file"] {
    height: auto;
    min-height: var(--control-height);
    padding: 7px;
    background: #fff;
}
.attachment-upload-form input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 7px 11px;
    border: 0;
    border-radius: 7px;
    color: var(--blue-dark);
    background: var(--blue-light);
    font-weight: 750;
    cursor: pointer;
}

/* Tom Select keeps every dropdown visually consistent while preserving the
   original select as the form's source of truth. */
.ts-wrapper {
    width: 100%;
    min-width: 0;
    font: inherit;
}
.ts-wrapper.single .ts-control,
.ts-wrapper.multi .ts-control {
    width: 100%;
    min-height: var(--control-height);
    padding: 9px 36px 9px var(--control-padding-x);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    background: var(--surface-subtle);
    background-image: none;
    box-shadow: none;
    font-size: inherit;
    line-height: 1.35;
    transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.ts-wrapper.single .ts-control {
    display: flex;
    height: var(--control-height);
    align-items: center;
    overflow: hidden;
}
.ts-wrapper.multi .ts-control {
    display: flex;
    min-height: var(--control-height);
    align-items: center;
    gap: 5px;
    padding: 5px 9px;
    flex-wrap: wrap;
}
.ts-wrapper.multi .ts-control > .item {
    display: inline-flex;
    width: auto;
    max-width: 100%;
    align-items: center;
    padding: 5px 9px;
    border: 1px solid #badcf3;
    border-radius: 999px;
    color: var(--blue-dark);
    background: var(--blue-light);
    font-size: 0.79rem;
    font-weight: 750;
    line-height: 1.2;
}
.ts-wrapper.multi .ts-control > input {
    min-width: 110px !important;
    flex: 1 1 110px;
}
.ts-wrapper.single .ts-control .item {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ts-wrapper.single .ts-control::after {
    position: absolute;
    top: 50%;
    right: 13px;
    width: 7px;
    height: 7px;
    margin: -5px 0 0;
    border: 0;
    border-right: 2px solid #506274;
    border-bottom: 2px solid #506274;
    transform: rotate(45deg);
    content: "";
}
.ts-wrapper.dropdown-active.single .ts-control::after {
    margin-top: -1px;
    transform: rotate(225deg);
}
.ts-control > input {
    width: auto !important;
    min-width: 1px;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    font: inherit;
}
.ts-wrapper:hover .ts-control { border-color: var(--border-strong); background: #fff; }
.ts-wrapper.focus .ts-control {
    border-color: var(--blue);
    outline: 3px solid rgba(6, 116, 200, 0.11);
    background: #fff;
    box-shadow: none;
}
.filters .ts-wrapper.focus .ts-control,
.report-filters .ts-wrapper.focus .ts-control {
    border-color: var(--filter);
    outline-color: rgba(79, 70, 229, 0.12);
}
.ts-wrapper.disabled { opacity: 1; }
.ts-wrapper.disabled .ts-control {
    color: #526579;
    background: #edf2f7;
    cursor: not-allowed;
    opacity: 1;
}
.field-invalid .ts-control { border-color: var(--danger); }
.ts-dropdown {
    z-index: 80;
    margin-top: 5px;
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 32px rgba(7, 26, 51, 0.16);
    font-size: 0.86rem;
}
.ts-dropdown .dropdown-input-wrap {
    padding: 9px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.ts-dropdown .dropdown-input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: 0;
}
.ts-dropdown .dropdown-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-light); }
.ts-dropdown .option,
.ts-dropdown .optgroup-header,
.ts-dropdown .no-results { padding: 10px 12px; }
.ts-dropdown .option { color: var(--text); cursor: pointer; }
.ts-dropdown .option.active { color: var(--blue-dark); background: var(--blue-light); }
.ts-dropdown .option.selected { color: #fff; background: var(--blue); }
.ts-dropdown .no-results { color: var(--muted); }
.filters .ts-wrapper,
.report-filters .ts-wrapper { min-width: 0; }
.filters .ts-control,
.report-filters .ts-control { min-height: var(--control-height); }
.dt-length .ts-wrapper { display: inline-block; width: 72px; vertical-align: middle; }
.dt-container .dt-length .ts-wrapper.dt-input {
    height: var(--control-height-compact);
    min-height: var(--control-height-compact);
    padding: 0;
    border: 0 !important;
    background: transparent !important;
}
.dt-container .dt-length .ts-control {
    height: var(--control-height-compact);
    min-height: var(--control-height-compact);
    padding: 7px 30px 7px 10px;
    border-radius: 9px;
}

.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.detail-grid .panel { margin-top: 0; }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(130px, 35%) 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); font-size: 0.83rem; font-weight: 700; }
.detail-list dd { margin: 0; }

.shipment-overview-grid,
.quotation-overview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}
.shipment-overview-grid > .panel,
.quotation-overview-grid > .panel {
    min-width: 0;
    margin-top: 0;
}
.shipment-overview-card {
    display: flex;
    flex-direction: column;
    padding: 22px;
}
.overview-card-heading {
    display: flex;
    min-height: 48px;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}
.overview-card-heading h2 { margin: 0; }
.overview-card-kicker {
    margin-bottom: 4px !important;
    color: var(--blue) !important;
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.095em;
    text-transform: uppercase;
}
.overview-card-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
}
.overview-detail-list { flex: 1; }
.overview-detail-list > div { grid-template-columns: minmax(94px, 38%) minmax(0, 1fr); }
.overview-detail-list dd {
    min-width: 0;
    overflow-wrap: anywhere;
}
.overview-detail-list .overview-emphasis {
    margin: 2px -10px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: var(--blue-light);
}
.detail-supporting-text {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 0.76rem;
}

.shipment-commercial-card,
.quotation-commercial-card { border-top: 3px solid var(--blue); }
.supplier-payment-card { border-top: 3px solid #0f766e; }
.supplier-payment-detail-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.supplier-payment-detail-list > div,
.supplier-payment-detail-list > div:last-child {
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 6px;
    min-width: 0;
    padding: 13px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}
.supplier-payment-detail-list dd {
    overflow-wrap: anywhere;
    font-weight: 650;
}
.supplier-payment-detail-list small {
    display: block;
    margin-top: 5px;
    color: #9a5a07;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
}
.commercial-highlight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 4px;
}
.commercial-highlight,
.commercial-service,
.commercial-special-conditions {
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-subtle);
}
.commercial-highlight {
    display: grid;
    align-content: start;
    gap: 4px;
    min-height: 82px;
    padding: 12px 13px;
}
.commercial-highlight > strong {
    color: var(--navy);
    font-size: 1.08rem;
    line-height: 1.2;
}
.commercial-term-context {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
}
.comparison-value {
    display: block;
    margin-top: 4px;
    color: #9a5a07;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
}
.commercial-term-label {
    color: var(--muted);
    font-size: 0.66rem;
    font-weight: 850;
    letter-spacing: 0.045em;
    text-transform: uppercase;
}
.commercial-highlight small,
.commercial-service small,
.commercial-special-conditions small {
    color: #9a5a07;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.35;
}
.commercial-services-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 9px;
}
.commercial-service {
    display: grid;
    align-content: start;
    gap: 7px;
    min-height: 96px;
    padding: 11px 12px;
}
.commercial-service-state {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.78rem;
    line-height: 1.25;
}
.commercial-service-state::before {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 3px #e2e8f0;
    content: "";
}
.commercial-service-state[data-state="yes"]::before {
    background: #16a36a;
    box-shadow: 0 0 0 3px #dff7ec;
}
.commercial-service-state[data-state="unknown"]::before {
    background: #d97706;
    box-shadow: 0 0 0 3px #fef3c7;
}
.commercial-special-conditions {
    display: grid;
    gap: 5px;
    margin-top: 9px;
    padding: 11px 13px;
}
.air-weight-summary {
    display: grid;
    gap: 13px;
    margin: 14px 0 18px;
    padding: 16px;
    border: 1px solid #b9dcf4;
    border-radius: 12px;
    background: linear-gradient(135deg, #f3f9fd 0%, #fff 100%);
}
.stacked-form > .air-weight-summary { margin: 0; box-shadow: var(--shadow); }
.air-weight-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}
.air-weight-heading h3 { margin: 3px 0 0; font-size: 1.05rem; }
.air-weight-values {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
}
.air-weight-values > div {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: #fff;
}
.air-weight-values span { color: var(--muted); font-size: 0.7rem; font-weight: 800; text-transform: uppercase; }
.air-weight-values strong { color: var(--navy); font-size: 1rem; }
.air-weight-values small { color: var(--muted); font-size: 0.7rem; }
.air-weight-values .air-weight-chargeable { border-color: #8bc8ef; background: var(--blue-light); }
.air-weight-values .air-weight-chargeable strong { color: var(--blue-dark); font-size: 1.16rem; }
.air-weight-note { margin: 0; color: var(--muted); font-size: 0.78rem; }
.air-weight-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-radius: 8px;
    color: #25634d;
    background: #eaf8f2;
    font-size: 0.76rem;
}
.air-weight-comparison-warning { color: #8a4d05; background: #fff4d6; }
.commercial-special-conditions p {
    color: var(--text);
    font-size: 0.78rem;
    line-height: 1.45;
}
.commercial-term-overridden {
    border-color: #edc860;
    border-left: 3px solid #d99a08;
    background: #fffdf5;
}
.commercial-audit-note {
    margin-top: auto !important;
    padding-top: 11px;
    color: var(--muted) !important;
    font-size: 0.7rem;
    line-height: 1.4;
}
.commercial-empty-state { margin: 4px 0 0; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 20px; color: var(--muted); }
.messages { margin-bottom: 20px; }
.message { padding: 13px 15px; border: 1px solid #86efac; border-left-width: 4px; border-radius: 10px; color: #166534; background: #f0fdf4; box-shadow: 0 4px 14px rgba(7, 26, 51, 0.04); }
.message-warning { border-color: #f7c948; color: #7c4a03; background: #fffbeb; }
.message-error { border-color: #fca5a5; color: var(--danger); background: #fff0ef; }
.message-info { border-color: #93c5fd; color: #1e40af; background: #eff6ff; }
.notice { margin-bottom: 14px; padding: 13px 15px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; background: #fff; box-shadow: 0 4px 14px rgba(7, 26, 51, 0.04); }
.notice-warning { border-color: #f1b72b; color: #7c4a03; background: #fffbeb; }

.tabs {
    position: sticky;
    top: 86px;
    z-index: 20;
    display: flex;
    gap: 5px;
    overflow-x: auto;
    margin-bottom: 18px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 24px rgba(7, 26, 51, 0.06);
    backdrop-filter: blur(12px);
}
.tabs a { padding: 9px 12px; border-radius: 8px; color: var(--muted); font-size: 0.78rem; font-weight: 750; text-decoration: none; white-space: nowrap; transition: color 140ms ease, background-color 140ms ease; }
.tabs a:hover, .tabs a:focus-visible { color: var(--blue-dark); background: var(--blue-light); outline: none; }
.section-anchor { scroll-margin-top: 16px; }
.subsection { margin-top: 28px; }

.login-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
    background: radial-gradient(circle at top left, #0d3d68, var(--navy) 58%);
}

.login-card {
    width: min(100%, 430px);
    padding: 40px;
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.28);
}

.login-brand { width: max-content; margin-bottom: 40px; padding: 13px 18px; border-radius: 9px; background: var(--navy); }
.login-card form { display: grid; gap: 18px; margin-top: 24px; }
.field-error, .form-errors { color: var(--danger); }
.form-errors { margin-bottom: 18px; padding: 10px 12px; border-radius: 8px; background: #fff0ef; }

.empty-state {
    max-width: 620px;
    margin: 12vh auto 0;
    padding: 48px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
    box-shadow: var(--shadow);
}

.empty-state-mark { display: grid; width: 58px; height: 58px; margin: 0 auto 20px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-weight: 900; }
.empty-state > p:not(.eyebrow) { line-height: 1.6; }
.empty-state-actions { display: flex; justify-content: center; margin-top: 24px; }

.portal-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
    padding: 30px;
    border-radius: 16px;
    color: #fff;
    background: linear-gradient(120deg, var(--navy), #0b4d7c);
    box-shadow: var(--shadow);
}
.portal-hero p { margin-bottom: 0; color: #cfe7f8; }
.portal-hero .eyebrow { color: #7dd3fc; }
.portal-security-note {
    padding: 7px 10px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    color: #d9eefc;
    font-size: 0.76rem;
    white-space: nowrap;
}
.portal-week-status { margin-bottom: 30px; }
.portal-week-status form {
    display: grid;
    grid-template-columns: minmax(260px, 1.5fr) minmax(150px, 1fr) minmax(150px, 1fr) auto;
    align-items: end;
    gap: 14px;
    margin-top: 20px;
}
.portal-week-status .status-options { min-width: 0; }
.portal-status-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}
.portal-status-choices label { font-size: 0.82rem; white-space: nowrap; }
.portal-week-status input[type="date"] {
    width: 100%;
    min-height: 40px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
}
.portal-shipments { margin-top: 30px; }
.portal-filters { flex-wrap: wrap; }
.portal-filters select { min-width: 190px; }
.portal-shipment-table { min-width: 1180px; }
.portal-detail-heading { align-items: center; }
.portal-inner-table { margin-top: 16px; }
.portal-cargo-description { color: var(--text) !important; }
.portal-document-list { display: grid; }
.portal-document-list > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    color: var(--blue);
    text-decoration: none;
}
.portal-document-list > a:last-child { border-bottom: 0; }
.portal-document-list > a > span:first-child { display: grid; gap: 4px; color: var(--text); }
.portal-document-list small { color: var(--muted); }

@media (max-width: 900px) {
    .freight-card-grid { grid-template-columns: 1fr; }
    .sidebar { position: static; width: 100%; min-height: 0; }
    .sidebar-nav { grid-template-columns: repeat(2, 1fr); margin-top: 22px; }
    .has-sidebar .page-shell { margin-left: 0; }
    .content { padding: 32px 30px 54px; }
    .card-grid { grid-template-columns: 1fr; }
    .metric-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-metrics, .dashboard-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid, .form-grid, .shipment-overview-grid, .quotation-overview-grid { grid-template-columns: 1fr; }
    .filters, .filters-grid, .filters-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters > input:first-child,
    .filters-wide > input:first-child { grid-column: 1 / -1; }
    .report-filters, .report-filters-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-summary, .report-summary-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filters .form-actions,
    .report-filters-week-status .status-options { grid-column: 1 / -1; }
    .report-filters-week-status > .field:first-of-type { grid-column: 1 / -1; }
    .portal-week-status form { grid-template-columns: 1fr 1fr; }
    .route-map-layout { grid-template-columns: 1fr; }
    .shipment-route-map { min-height: 340px; }
    .route-coordinate-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
    .route-coordinate { border-bottom: 0; }
    .air-weight-values { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .air-weight-comparison { align-items: flex-start; flex-direction: column; }
}

@media (min-width: 901px) and (max-width: 1280px) {
    .content { padding-right: 28px; padding-left: 28px; }
    .shipment-overview-grid, .quotation-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters, .filters-grid, .filters-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filters > input:first-child,
    .filters-wide > input:first-child { grid-column: 1 / -1; }
    .report-filters, .report-filters-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-filters .form-actions,
    .report-filters-week-status .status-options { grid-column: 1 / -1; }
    .report-filters-week-status > .field:first-of-type { grid-column: 1 / -1; }
    .report-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-summary-four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
    .sidebar { padding: 20px 14px; }
    .sidebar-nav { gap: 3px; }
    .sidebar-nav a { min-height: 42px; padding: 9px 10px; font-size: 0.82rem; }
    .nav-icon { width: 16px; height: 16px; }
    .dashboard-metrics, .dashboard-columns, .metric-row { grid-template-columns: 1fr; }
    .topbar { align-items: flex-start; padding: 12px 18px; }
    .topbar > div { display: none; }
    .content { padding: 22px 16px; }
    .page-heading, .portal-hero { align-items: flex-start; flex-direction: column; }
    .page-heading .actions { width: 100%; flex-wrap: wrap; }
    .page-heading .actions .button { flex: 1 1 auto; }
    .metric-card { min-height: 128px; }
    .panel { padding: 20px; }
    .shipment-overview-card { padding: 18px; }
    .overview-card-heading { align-items: center; }
    .overview-card-actions { flex-wrap: wrap; justify-content: flex-end; }
    .commercial-services-grid { grid-template-columns: 1fr; }
    .commercial-highlight-grid { grid-template-columns: 1fr; }
    .supplier-payment-detail-list { grid-template-columns: 1fr; }
    .commercial-service { min-height: 0; }
    .stacked-form > .panel > h2 { margin: -20px -20px 20px; padding: 16px 20px; }
    .stacked-form > .form-actions { display: grid; width: 100%; grid-template-columns: 1fr; }
    .filters, .report-filters { padding: 15px; }
    .filters, .filters-grid, .filters-wide,
    .report-filters, .report-filters-wide,
    .report-summary, .report-summary-four { grid-template-columns: 1fr; }
    .filters > input:first-child,
    .filters-wide > input:first-child,
    .report-filters .form-actions,
    .report-filters-week-status .status-options,
    .report-filters-week-status > .field:first-of-type { grid-column: auto; }
    .filters > .button,
    .report-filters .form-actions { width: 100%; }
    .attachment-upload-form { grid-template-columns: 1fr; }
    .attachment-upload-form .button { width: 100%; }
    .report-filters .form-actions { display: grid; grid-template-columns: 1fr; }
    .dt-container .dt-layout-row { flex-direction: column; align-items: stretch; gap: 10px; }
    .dt-container .dt-layout-cell, .dt-container .dt-layout-end { justify-content: flex-start; }
    .dt-container .dt-search { width: 100%; }
    .dt-container .dt-search label { display: none; }
    .dt-container .dt-search .dt-input { width: 100%; max-width: none; }
    .dt-container .dt-paging { display: flex; flex-wrap: wrap; gap: 4px; }
    .tabs { top: 72px; }
    .portal-security-note { white-space: normal; }
    .portal-metrics, .portal-week-status form { grid-template-columns: 1fr; }
    .route-coordinate-list { grid-template-columns: 1fr; gap: 0; }
    .route-coordinate { border-bottom: 1px solid var(--border); }
    .air-weight-values { grid-template-columns: 1fr; }
    .air-weight-heading { align-items: flex-start; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
