:root {
    --ingram-blue: #0077d4;
    --ingram-blue-dark: #005ea8;
    --surface: #ffffff;
    --surface-muted: #f4f7fa;
    --border: #d9e1e8;
    --text: #172033;
    --text-muted: #5f6b7a;
}

html {
    background: var(--surface-muted) !important;
}

body {
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

nav.bg-\[\#0077D4\] {
    background-color: var(--ingram-blue) !important;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

nav a {
    white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease;
}

nav a:hover {
    background-color: rgba(255, 255, 255, 0.14) !important;
    color: #fff !important;
}

.environment-badge {
    margin-left: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 9999px;
    padding: 0.2rem 0.55rem;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

header.bg-white {
    border-bottom: 1px solid var(--border);
    box-shadow: none;
}

header h1 {
    color: var(--text) !important;
    font-size: 1.75rem !important;
    letter-spacing: -0.025em;
}

main table thead {
    background-color: #f7f9fb !important;
}

main table tbody tr {
    transition: background-color 120ms ease;
}

main table tbody tr:hover {
    background-color: #f2f7fb;
}

.bg-indigo-600,
.bg-blue-500 {
    background-color: var(--ingram-blue) !important;
}

.bg-indigo-600:hover,
.bg-blue-500:hover {
    background-color: var(--ingram-blue-dark) !important;
}

.text-indigo-600,
.text-blue-600 {
    color: var(--ingram-blue) !important;
}

.border-indigo-500 {
    border-color: var(--ingram-blue) !important;
}

.login-page {
    background:
        linear-gradient(115deg, rgba(0, 119, 212, 0.06), transparent 45%),
        var(--surface-muted);
}

.login-card {
    border: 1px solid var(--border);
    border-radius: 1rem;
    background: var(--surface);
    box-shadow: 0 18px 45px rgba(25, 45, 70, 0.1);
    padding: 2.5rem;
}

.login-eyebrow {
    margin-top: 1.5rem;
    color: var(--ingram-blue);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
    text-transform: uppercase;
}

.login-copy {
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

.export-modal-layout {
    display: flex;
    min-height: 100%;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.export-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 31, 48, 0.68);
    backdrop-filter: blur(3px);
}

.export-modal-panel {
    position: relative;
    width: min(100%, 38rem);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    background: #fff;
    box-shadow: 0 28px 70px rgba(8, 29, 46, 0.28);
}

.export-modal-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1rem;
    align-items: start;
    padding: 1.5rem 1.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.export-modal-icon {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: 0.65rem;
    background: #eaf5fd;
    color: var(--ingram-blue);
}

.export-modal-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.export-modal-kicker {
    color: var(--ingram-blue);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.export-modal-header h3 {
    margin-top: 0.2rem;
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.export-modal-header p {
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.export-modal-close {
    display: grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: 0.4rem;
    color: #738091;
}

.export-modal-close:hover {
    background: #f0f3f6;
    color: var(--text);
}

.export-modal-close svg {
    width: 1.1rem;
    height: 1.1rem;
}

.export-modal-body {
    padding: 1.5rem 1.75rem;
}

.export-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.export-field-full {
    grid-column: 1 / -1;
}

.export-field label {
    display: block;
    margin-bottom: 0.4rem;
    color: #344153;
    font-size: 0.78rem;
    font-weight: 650;
}

.export-field input,
.export-field select {
    width: 100%;
    min-height: 2.75rem;
    border: 1px solid #cbd5df;
    border-radius: 0.5rem;
    background-color: #fff;
    color: var(--text);
    padding: 0.65rem 0.75rem;
    outline: none;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.export-field input:focus,
.export-field select:focus {
    border-color: var(--ingram-blue);
    box-shadow: 0 0 0 3px rgba(0, 119, 212, 0.13);
}

.export-note {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    margin-top: 1.25rem;
    border: 1px solid #d7e5ef;
    border-radius: 0.55rem;
    background: #f5f9fc;
    padding: 0.8rem 0.9rem;
    color: #536476;
    font-size: 0.78rem;
    line-height: 1.45;
}

.export-note svg {
    flex: 0 0 auto;
    width: 1.05rem;
    height: 1.05rem;
    margin-top: 0.05rem;
    color: var(--ingram-blue);
}

.export-error {
    margin-top: 0.75rem;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    background: #fff5f5;
    padding: 0.75rem 0.9rem;
    color: #b42318;
    font-size: 0.8rem;
}

.export-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border);
    background: #f8fafb;
}

.export-modal-footer > span {
    color: #6b7787;
    font-size: 0.75rem;
}

.export-modal-footer > div {
    display: flex;
    gap: 0.6rem;
}

.export-button-primary,
.export-button-secondary {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    padding: 0.55rem 0.95rem;
    font-size: 0.82rem;
    font-weight: 650;
}

.export-button-primary {
    background: var(--ingram-blue);
    color: #fff;
}

.export-button-primary:hover {
    background: var(--ingram-blue-dark);
}

.export-button-primary svg {
    width: 1rem;
    height: 1rem;
}

.export-button-secondary {
    border-color: #cbd5df;
    background: #fff;
    color: #344153;
}

.export-button-secondary:hover {
    background: #f2f5f7;
}

.analytics-page main {
    background: #f2f5f7;
}

.analytics-dashboard {
    display: grid;
    gap: 1.5rem;
}

.analytics-toolbar {
    display: grid;
    grid-template-columns: minmax(18rem, 1.5fr) minmax(10rem, 0.8fr) minmax(8rem, 0.55fr) auto auto;
    gap: 0.75rem;
    align-items: end;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
    padding: 1rem;
}

.analytics-filter-group {
    display: block;
}

.analytics-filter-group > span {
    display: block;
    margin-bottom: 0.35rem;
    color: #596779;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.analytics-filter-group select,
.analytics-period-filter > div {
    width: 100%;
    min-height: 2.6rem;
    border: 1px solid #cbd5df;
    border-radius: 0.45rem;
    background: #fff;
    color: var(--text);
}

.analytics-filter-group select {
    padding: 0.55rem 0.7rem;
    font-size: 0.82rem;
}

.analytics-period-filter > div {
    display: flex;
    align-items: center;
    padding: 0 0.7rem;
}

.analytics-period-filter input {
    min-width: 0;
    flex: 1;
    border: 0;
    background: transparent;
    color: var(--text);
    font-size: 0.78rem;
    outline: none;
}

.analytics-period-filter > div > span {
    margin: 0 0.55rem;
    color: #9aa5b1;
}

.analytics-filter-group select:focus,
.analytics-period-filter > div:focus-within {
    border-color: var(--ingram-blue);
    box-shadow: 0 0 0 3px rgba(0, 119, 212, 0.12);
    outline: none;
}

.analytics-apply-button,
.analytics-export-button {
    display: inline-flex;
    min-height: 2.6rem;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid var(--ingram-blue);
    border-radius: 0.45rem;
    padding: 0.55rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.analytics-apply-button {
    background: var(--ingram-blue);
    color: #fff;
}

.analytics-export-button {
    background: #fff;
    color: var(--ingram-blue);
}

.analytics-apply-button:hover {
    background: var(--ingram-blue-dark);
}

.analytics-export-button:hover {
    background: #eef7fd;
}

.analytics-export-button svg {
    width: 1rem;
    height: 1rem;
}

.operations-kpis {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
}

.operation-kpi {
    min-width: 0;
    padding: 1.25rem 1.4rem;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.operation-kpi:nth-child(3n) {
    border-right: 0;
}

.operation-kpi:nth-last-child(-n + 3) {
    border-bottom: 0;
}

.operation-kpi > span {
    display: block;
    color: #667384;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.operation-kpi strong {
    display: block;
    margin-top: 0.35rem;
    color: #102f46;
    font-size: 2rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.operation-kpi small {
    display: block;
    margin-top: 0.55rem;
    color: #315f7f;
    font-size: 0.72rem;
    font-weight: 700;
}

.operation-kpi small span {
    color: #8994a2;
    font-weight: 500;
}

.operation-kpi-status strong {
    color: #b42318;
}

.analytics-panel,
.analytics-report {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    background: #fff;
}

.analytics-panel-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
    align-items: stretch;
}

.analytics-panel-header {
    display: flex;
    min-height: 3.8rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e4eaf0;
}

.analytics-panel-header h2,
.analytics-report-actions h2 {
    color: #233244;
    font-size: 0.92rem;
    font-weight: 700;
}

.analytics-panel-header p {
    margin-top: 0.15rem;
    color: #7b8795;
    font-size: 0.7rem;
}

.analytics-chart {
    height: 17rem;
    padding: 1.25rem;
}

.analytics-chart-large {
    height: 21rem;
}

.analytics-table-wrap {
    overflow-x: auto;
}

.analytics-table-wrap table {
    width: 100%;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.analytics-table-wrap th {
    background: #f7f9fb;
    color: #667384;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: left;
    text-transform: uppercase;
}

.analytics-table-wrap th,
.analytics-table-wrap td {
    padding: 0.72rem 0.85rem;
    border-bottom: 1px solid #e4eaf0;
}

.analytics-table-wrap tbody tr:last-child td {
    border-bottom: 0;
}

.analytics-table-wrap td {
    color: #526072;
}

.analytics-table-wrap td:first-child {
    color: var(--text);
    font-weight: 600;
}

.analytics-empty {
    padding: 2rem !important;
    color: #7b8795 !important;
    text-align: center;
}

.channel-label,
.status-label {
    display: inline-flex;
    border-radius: 9999px;
    padding: 0.18rem 0.45rem;
    font-size: 0.62rem;
    font-weight: 700;
}

.channel-label,
.status-label.is-neutral {
    background: #eef2f5;
    color: #526072;
}

.status-label.is-cancelled {
    background: #feecec;
    color: #b42318;
}

.status-label.is-complete {
    background: #e8f7ee;
    color: #147a41;
}

.status-label.is-pending {
    background: #fff5d6;
    color: #946200;
}

.analytics-report summary {
    display: flex;
    cursor: pointer;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    list-style: none;
}

.analytics-report summary::-webkit-details-marker {
    display: none;
}

.analytics-report summary strong,
.analytics-report summary small {
    display: block;
}

.analytics-report summary strong {
    color: #233244;
    font-size: 0.85rem;
}

.analytics-report summary small {
    margin-top: 0.15rem;
    color: #7b8795;
    font-size: 0.7rem;
    font-weight: 400;
}

.analytics-report summary svg {
    width: 1.1rem;
    height: 1.1rem;
    color: #687586;
    transition: transform 150ms ease;
}

.analytics-report[open] summary svg {
    transform: rotate(180deg);
}

.analytics-report-content {
    border-top: 1px solid #e4eaf0;
}

.analytics-report-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
}

.analytics-report-actions a {
    color: var(--ingram-blue);
    font-size: 0.75rem;
    font-weight: 700;
}

@media (min-width: 768px) and (max-width: 1023px) {
    .analytics-toolbar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .analytics-apply-button,
    .analytics-export-button {
        width: 100%;
    }

    .operations-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .operation-kpi,
    .operation-kpi:nth-child(3n) {
        border-right: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
    }

    .operation-kpi:nth-child(2n) {
        border-right: 0;
    }

    .operation-kpi:nth-last-child(-n + 2) {
        border-bottom: 0;
    }
}

@media (max-width: 767px) {
    nav .h-16 {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
        height: auto;
        padding: 0.5rem 0;
    }

    nav .h-16 > .flex:first-child {
        justify-content: center;
    }

    nav .h-16 > .flex:last-child {
        overflow-x: auto;
        scrollbar-width: none;
        width: 100%;
    }

    nav a {
        margin-left: 0.25rem !important;
    }

    nav img {
        height: 2rem !important;
    }

    .environment-badge {
        display: none;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .shipment-toolbar,
    .shipment-toolbar-actions,
    .shipment-search-form {
        align-items: stretch;
        flex-direction: column;
    }

    .shipment-toolbar {
        gap: 0.75rem;
    }

    .shipment-search-form > div,
    .shipment-search-form select {
        width: 100%;
    }

    .shipment-search-form input {
        min-width: 0;
        width: 100%;
    }

    main .flex-grow {
        min-width: 0;
    }

    .export-modal-layout {
        align-items: flex-end;
        padding: 0;
    }

    .export-modal-panel {
        border-radius: 1rem 1rem 0 0;
    }

    .export-form-grid {
        grid-template-columns: 1fr;
    }

    .export-field-full {
        grid-column: auto;
    }

    .export-modal-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .export-modal-footer > div {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .analytics-toolbar,
    .operations-kpis,
    .analytics-panel-grid {
        grid-template-columns: 1fr;
    }

    .analytics-apply-button,
    .analytics-export-button {
        width: 100%;
    }

    .operation-kpi,
    .operation-kpi:nth-child(2n),
    .operation-kpi:nth-child(3n) {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .operation-kpi:last-child {
        border-bottom: 0;
    }

    .analytics-chart-large {
        height: 17rem;
    }

    .analytics-activity-panel table {
        min-width: 42rem;
    }

    .analytics-report-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.5rem;
    }
}
