/* Extracted from index.html. Load order matters: the cascade depends on it (see index.html <link> order). */
/* Executive Tab Navigation Bar - Modern Floating Pills */

.exec-grid-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 1024px) {
    .exec-grid-row-2, .exec-grid-row-3, .exec-grid-row-4, .exec-grid-row-5 {
        grid-template-columns: 1fr;
    }

}

.dash-kpi-card {
    background: #FFFFFF;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 82px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dash-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

html, body {
    margin: 0;
    max-width: 100vw;
    overflow-x: hidden;
}
body {
    font-family: var(--font-ui);
    background-color: var(--bg-main);
    color: var(--text-dark);
}

.app-layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 100;
}

.sidebar .logo {
    height: var(--shell-header-height);
    min-height: var(--shell-header-height);
    box-sizing: border-box;
    padding: 0 1.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: white;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    transition: padding 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar .logo h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s;
}

.sidebar .logo-short {
    display: none;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1;
    color: white;
}

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color 0.2s, background-color 0.2s;
}

.sidebar-toggle-btn:hover {
    color: var(--sidebar-text-active);
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-btn i {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar collapsed state (desktop only) */
@media (min-width: 901px) {
    .sidebar.collapsed {
        width: 70px;
    }
    .sidebar.collapsed .logo {
        padding: 0.6rem 0;
        height: auto;
        min-height: var(--shell-header-height);
        flex-direction: column;
        justify-content: center;
        gap: 0.45rem;
    }
    .sidebar.collapsed .logo h2 {
        display: none;
    }
    .sidebar.collapsed .logo-short {
        display: block;
    }
    .sidebar.collapsed .sidebar-toggle-btn i {
        transform: rotate(180deg);
    }
    .sidebar.collapsed .nav-item {
        justify-content: center;
        padding: 0.6rem 0;
        gap: 0;
        position: relative;
    }
    .sidebar.collapsed .nav-item span {
        display: none;
    }
    .sidebar.collapsed .nav-item i {
        font-size: 1.2rem;
    }

    .sidebar.collapsed .nav-section-label {
        display: none;
    }
}

.nav-menu {
    padding: 0.55rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    overflow-y: auto;
    /* Dark-themed scrollbar so it doesn't render as a white bar on the navy sidebar */
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.nav-menu::-webkit-scrollbar {
    width: 6px;
}

.nav-menu::-webkit-scrollbar-track {
    background: transparent;
}

.nav-menu::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.18);
    border-radius: 3px;
}

.nav-menu::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.nav-item {
    flex: 0 0 auto;
    padding: 0.58rem 1.15rem;
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    font-weight: 500;
    font-size: 0.855rem;
    transition: all 0.2s;
}

.nav-item[hidden] {
    display: none !important;
}

.nav-item i {
    width: 18px;
    font-size: 0.9rem;
    text-align: center;
}

.nav-item:hover {
    color: var(--sidebar-text-active);
    background-color: rgba(255,255,255,0.05);
}

.nav-section-label {
    flex: 0 0 auto;
    padding: 0.7rem 1.15rem 0.25rem;
    color: rgba(156, 163, 175, 0.7);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-item.active {
    color: var(--sidebar-text-active);
    background-color: var(--sidebar-active-bg);
    border-left: 4px solid var(--primary);
}

/* Main Content */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    height: var(--shell-header-height);
    min-height: var(--shell-header-height);
    box-sizing: border-box;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--content-pad-x);
    position: sticky;
    top: 0;
    z-index: 90;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.topbar-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.84rem;
    white-space: nowrap;
}

.topbar-crumb-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    line-height: 1;
}

.topbar-crumb-item.root {
    color: var(--muted);
    font-weight: 500;
}

.topbar-crumb-item.root i {
    color: var(--primary);
    font-size: 0.85rem;
}

.topbar-crumb-divider {
    color: var(--line-strong);
    font-size: 0.65rem;
}

.topbar-crumb-item.active {
    color: var(--ink);
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar-live-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #059669;
    background: #ECFDF5;
    border: 1px solid #A7F3D0;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    line-height: 1;
}

.topbar-live-tag .pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10B981;
    display: inline-block;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: topbarPulse 2s infinite;
}

@keyframes topbarPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-auth-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-org-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.65rem 0.25rem 0.3rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #FFFFFF;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.user-profile-btn:hover {
    background: var(--bg);
    border-color: var(--line-strong);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--brand-ink) 0%, var(--brand-ink) 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    line-height: 1;
    letter-spacing: 0.02em;
    overflow: hidden;
    white-space: nowrap;
    flex-shrink: 0;
}

.user-profile-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    line-height: 1.2;
}

.user-profile-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-profile-role {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--muted);
}

.user-profile-caret {
    font-size: 0.65rem;
    color: var(--faint);
    transition: transform 0.2s ease;
    margin-left: 0.15rem;
}

.user-profile-btn[aria-expanded="true"] .user-profile-caret {
    transform: rotate(180deg);
}

/* Views */
.content-wrapper {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--page-card-gap) var(--content-pad-x) 1.25rem;
}

.view-section {
    display: none;
    min-width: 0;
}

.view-section.active {
    display: grid;
    /* Explicit 0-min column: without it the implicit `auto` track sizes to the
       widest child's max-content (nowrap filter bars, min-width tables) and the
       whole page overflows horizontally, clipped by .content-wrapper. */
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: var(--page-card-gap);
    animation: fadeIn 0.3s ease;
}

.view-section.active > *,
.po-page-stack > *,
.profile-layout > *,
.profile-overview-grid > * {
    margin-top: 0;
    margin-bottom: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.filters {
    display: flex;
    gap: 1rem;
}

.filters select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-surface);
    font-family: inherit;
    outline: none;
}

/* KPI Cards */

.kpi-card {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border-top: 4px solid var(--primary);
}

.kpi-card h4 {
    margin: 0 0 0.5rem 0;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-card .val {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Panels */
.panel {
    background: var(--bg-surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 0;
    padding: 1.5rem;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.panel-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.panel-header p {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.4;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.btn-danger {
    background: #DC2626;
    color: #FFFFFF;
}

.btn-danger:hover {
    background: #B91C1C;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    max-height: 600px;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th, .data-table td {
    padding: 0.7rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    font-size: 0.82rem;
    white-space: nowrap;
    vertical-align: middle;
}

.data-table th {
    background: var(--bg);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border);
}

.data-table tbody tr {
    transition: background-color 0.15s ease;
}

.data-table tbody tr:hover {
    background: var(--brand-soft);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table th.th-actions {
    text-align: right;
}

.data-table th.th-center {
    text-align: center;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge.transit { background: var(--status-blue); color: var(--status-blue-text); }
.badge.delivered { background: var(--status-green); color: var(--status-green-text); }
.badge.exception { background: var(--status-red); color: var(--status-red-text); }
.badge.open { background: var(--status-yellow); color: var(--status-yellow-text); }

/* Purchase orders */
.po-panel {
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.05);
}

.po-page-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--page-card-gap);
}

.po-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
}

.po-heading h2 {
    margin: 0;
    font-size: 1.05rem;
}

.po-heading p {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.po-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
    min-width: 0;
}

.po-toolbar-actions .btn {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.po-search {
    width: min(300px, 100%);
    flex: 1 1 260px;
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    box-sizing: border-box;
    padding: 0 0.45rem 0 0.85rem;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--bg);
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.po-search:focus-within {
    border-color: var(--brand-line);
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(35, 47, 140, 0.1);
}

.po-search > i {
    color: var(--text-muted);
    font-size: 0.84rem;
}

.po-search input {
    min-width: 0;
    flex: 1;
    padding: 0.65rem 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-dark);
    font: inherit;
    font-size: 0.86rem;
}

.po-search-button {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
}

.po-search-button:not(.primary) {
    width: auto;
    min-width: 54px;
    padding: 0 0.6rem;
    border: 1px solid var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
    font-size: 0.76rem;
    font-weight: 800;
    box-shadow: 0 1px 2px rgba(35, 47, 140, 0.16);
}

.po-search-button:hover {
    background: var(--brand-soft);
    color: var(--primary);
}

.po-search-button:not(.primary):hover {
    border-color: var(--brand-line);
    background: var(--brand-line);
    color: var(--brand-ink);
}

.po-search-button.primary {
    background: var(--primary);
    color: #FFFFFF;
}

.po-search-button.primary:hover {
    background: var(--primary-hover);
}

.po-refresh-button {
    min-height: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0 0.85rem;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--bg);
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.po-refresh-button.compact {
    width: 38px;
    justify-content: center;
    padding: 0;
    color: var(--ink-soft);
}

.po-refresh-button.compact span {
    display: none;
}

.po-refresh-button:hover {
    border-color: var(--faint);
    background: var(--surface-2);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.po-refresh-button:active {
    transform: translateY(1px);
}

.po-refresh-button.is-loading i {
    animation: spin 0.8s linear infinite;
}

.po-summary-bar {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 1.1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.po-result-count {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.po-result-count strong {
    color: var(--text-dark);
}

.po-kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--bg) 100%);
}

.po-kpi-card {
    padding: 0.85rem 0.95rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #FFFFFF;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.04);
}

.shipment-kpi-strip {
    grid-template-columns: repeat(6, minmax(100px, 1fr));
}

.shipment-kpi-strip .po-kpi-card {
    padding: 0.75rem 0.8rem;
}

.shipment-kpi-strip .po-kpi-label {
    font-size: 0.68rem;
}

.shipment-kpi-strip .po-kpi-value {
    font-size: 1.25rem;
}

.po-kpi-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.po-kpi-label i {
    color: var(--primary);
}

.po-kpi-value {
    margin-top: 0.35rem;
    color: var(--ink);
    font-size: 1.45rem;
    font-weight: 800;
}

.po-pagination {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.po-page-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--text-dark);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.po-page-button:hover:not(:disabled) {
    border-color: var(--brand-line);
    color: var(--primary);
}

.po-page-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#po-page-display {
    min-width: 64px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
}

.po-table-wrap {
    max-height: 610px;
    width: 100%;
    overflow-x: auto;
}

#purchase-order-table {
    width: 100%;
    min-width: 1200px;
    table-layout: fixed;
}

#purchase-order-table th {
    padding: 0.6rem 0.6rem;
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

#purchase-order-table td {
    padding: 0.65rem 0.6rem;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

#purchase-order-table th:nth-child(1),
#purchase-order-table td:nth-child(1) { width: 9%; }

#purchase-order-table th:nth-child(2),
#purchase-order-table td:nth-child(2) { width: 12%; }

#purchase-order-table th:nth-child(3),
#purchase-order-table td:nth-child(3) { width: 13%; }

#purchase-order-table th:nth-child(4),
#purchase-order-table td:nth-child(4) { width: 8%; text-align: right; }

#purchase-order-table th:nth-child(5),
#purchase-order-table td:nth-child(5) { width: 8%; text-align: right; }

#purchase-order-table th:nth-child(6),
#purchase-order-table td:nth-child(6) { width: 8%; text-align: right; }

#purchase-order-table th:nth-child(7),
#purchase-order-table td:nth-child(7) { width: 11%; }

#purchase-order-table th:nth-child(8),
#purchase-order-table td:nth-child(8) { width: 8%; }

#purchase-order-table th:nth-child(9),
#purchase-order-table td:nth-child(9) { width: 8%; }

#purchase-order-table th:nth-child(10),
#purchase-order-table td:nth-child(10) { width: 7%; text-align: center; }

#purchase-order-table th:nth-child(11),
#purchase-order-table td:nth-child(11) { width: 11%; }

#purchase-order-table th:nth-child(12),
#purchase-order-table td:nth-child(12) { width: 7%; text-align: center; }

#shipment-table {
    width: 100%;
    table-layout: fixed;
}

#shipment-table th {
    padding: 0.6rem 0.55rem;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#shipment-table td {
    padding: 0.6rem 0.55rem;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

#shipment-table .trk-detail-row td {
    white-space: normal;
    overflow: visible;
    max-width: none;
}

#shipment-table th:nth-child(1),
#shipment-table td:nth-child(1) { width: 4%; max-width: 44px; text-align: center; }

#shipment-table th:nth-child(2),
#shipment-table td:nth-child(2) { width: 10%; max-width: 110px; }

#shipment-table th:nth-child(3),
#shipment-table td:nth-child(3) { width: 14%; max-width: 150px; }

#shipment-table th:nth-child(4),
#shipment-table td:nth-child(4) { width: 13%; max-width: 140px; }

#shipment-table th:nth-child(5),
#shipment-table td:nth-child(5) { width: 9%; max-width: 95px; text-align: center; }

#shipment-table th:nth-child(6),
#shipment-table td:nth-child(6) { width: 13%; max-width: 140px; }

#shipment-table th:nth-child(7),
#shipment-table td:nth-child(7) { width: 16%; max-width: 175px; }

#shipment-table th:nth-child(8),
#shipment-table td:nth-child(8) { width: 13%; max-width: 150px; }

#shipment-table th:nth-child(9),
#shipment-table td:nth-child(9) { width: 8%; max-width: 95px; text-align: right; }

#container-table {
    width: 100%;
    table-layout: fixed;
}

#container-table th {
    padding: 0.6rem 0.55rem;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#container-table td {
    padding: 0.6rem 0.55rem;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

#container-table th:nth-child(1),
#container-table td:nth-child(1) { width: 18%; max-width: 180px; }

#container-table th:nth-child(2),
#container-table td:nth-child(2) { width: 14%; max-width: 140px; }

#container-table th:nth-child(3),
#container-table td:nth-child(3) { width: 10%; max-width: 100px; }

#container-table th:nth-child(4),
#container-table td:nth-child(4) { width: 18%; max-width: 180px; }

#container-table th:nth-child(5),
#container-table td:nth-child(5) { width: 14%; max-width: 140px; }

#container-table th:nth-child(6),
#container-table td:nth-child(6) { width: 13%; max-width: 130px; }

#container-table th:nth-child(7),
#container-table td:nth-child(7) { width: 13%; max-width: 130px; }

#document-table {
    width: 100%;
    table-layout: fixed;
}

#document-table th {
    padding: 0.6rem 0.55rem;
    color: var(--muted);
    font-size: 0.66rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

#document-table td {
    padding: 0.6rem 0.55rem;
    white-space: nowrap;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 0;
}

#document-table th:nth-child(1),
#document-table td:nth-child(1) { width: 50px; text-align: center; }

#document-table th:nth-child(2),
#document-table td:nth-child(2) { width: 14%; max-width: 150px; }

#document-table th:nth-child(3),
#document-table td:nth-child(3) { width: 13%; max-width: 140px; }

#document-table th:nth-child(4),
#document-table td:nth-child(4) { width: 10%; max-width: 110px; }

#document-table th:nth-child(5),
#document-table td:nth-child(5) { width: 15%; max-width: 170px; }

#document-table th:nth-child(6),
#document-table td:nth-child(6) { width: 18%; max-width: 200px; }

#document-table th:nth-child(7),
#document-table td:nth-child(7) { width: 70px; text-align: center; }

#document-table th:nth-child(8),
#document-table td:nth-child(8) { width: 11%; max-width: 120px; }

#document-table th:nth-child(9),
#document-table td:nth-child(9) { width: 9%; max-width: 100px; }

#document-table th:nth-child(10),
#document-table td:nth-child(10) { width: 85px; text-align: center; }

/* ── Unified clean tab header (replaces heavy dark banner) ── */
.tab-dark-header {
    overflow: hidden;
    border: 1px solid var(--border) !important;
    background: #FFFFFF !important;
    color: var(--text-dark) !important;
    border-radius: 12px;
    box-shadow: 0 1px 3px 0 rgba(16, 24, 40, 0.04);
}
.tab-dark-header .po-toolbar {
    border-bottom: 0;
    background: transparent;
    padding: 0.9rem 1.1rem;
}
.tab-dark-header .po-heading h2 {
    color: var(--text-dark);
    font-weight: 700;
}
.tab-dark-header .po-heading p {
    color: var(--text-muted);
    opacity: 1;
}
.tab-dark-header .po-refresh-button.compact {
    background: var(--bg);
    border-color: var(--line-strong);
    color: var(--ink-soft);
}
.tab-dark-header .po-refresh-button.compact:hover {
    background: var(--surface-2);
    border-color: var(--faint);
    color: var(--primary);
}
.tab-dark-header .po-search {
    width: clamp(280px, 42vw, 520px);
    flex: 0 1 520px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.tab-dark-header .po-toolbar-actions {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.75rem;
}
.tab-dark-header .po-search input {
    color: var(--text-dark);
}
.tab-dark-header .po-search input::placeholder {
    color: var(--text-muted);
}
.tab-dark-header .po-search i,
.tab-dark-header .po-search .po-search-button {
    color: var(--text-muted);
}
.tab-dark-header .po-search .po-search-button:not(.primary) {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text-dark);
    box-shadow: none;
}
.tab-dark-header .po-search-button.primary {
    background: var(--primary);
    color: #FFFFFF;
}
.tab-dark-header .po-search-button.primary:hover {
    background: var(--primary-hover);
}

/* ── Compact shipment stat bar (replaces big KPI cards) ── */
.shipment-stat-bar {
    display: flex;
    align-items: stretch;
    overflow: hidden;
}
.shipment-stat-item {
    flex: 1;
    padding: 0.6rem 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    border-right: 1px solid var(--surface-2);
    min-width: 0;
    transition: background 0.15s;
}
.shipment-stat-item:last-child { border-right: 0; }
.shipment-stat-item:hover { background: var(--bg); }
.shipment-stat-item[data-shipment-kpi] { cursor: pointer; }
.shipment-stat-item[data-shipment-kpi]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}
.shipment-stat-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 0.32rem;
    white-space: nowrap;
}
.shipment-stat-label i { color: var(--primary); font-size: 0.7rem; }
.shipment-stat-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.02em;
}
.shipment-stat-item.stat-danger .shipment-stat-label i { color: #DC2626; }
.shipment-stat-item.stat-danger .shipment-stat-value { color: #DC2626; }
.shipment-stat-item.stat-info .shipment-stat-label i { color: var(--info); }
.shipment-stat-item.stat-info .shipment-stat-value { color: var(--info); }

/* ── Chart card header padding fix (po-panel overrides panel padding to 0) ── */
.po-panel > .panel-header {
    padding: 1.25rem 1.5rem 0.75rem;
    margin-bottom: 0;
}

.shipment-filter-card {
    overflow: visible;
    position: relative;
}

.po-filter-card {
    overflow: visible;
    position: relative;
}
