html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #1e293b;
    background: #f5f7fb;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a, .btn-link {
    color: #2563eb;
}

a:hover {
    color: #1d4ed8;
}

.btn-primary {
    color: #fff;
    background-color: #2563eb;
    border-color: #2563eb;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
}

.btn-primary:active {
    background-color: #1e40af;
    border-color: #1e40af;
}

.btn-outline-primary {
    color: #2563eb;
    border-color: #2563eb;
}

.btn-outline-primary:hover {
    background-color: #2563eb;
    border-color: #2563eb;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #ffffff, 0 0 0 0.25rem rgba(37, 99, 235, 0.45);
    border-color: #2563eb;
}

.form-control, .form-select {
    border-color: #d8dee8;
}

.form-control:focus, .form-select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.15);
}

.content {
    padding-top: 1.4rem;
    padding-bottom: 2rem;
}

h1, h2, h3 {
    color: #0f172a;
    letter-spacing: -0.01em;
}

h1 {
    font-size: 1.65rem;
    font-weight: 700;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjI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IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e9f0;
}

.page-header p {
    max-width: 720px;
    margin-bottom: 0;
    color: #5b6472;
}

.toolbar {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(140px, 220px) minmax(140px, 180px) auto;
    gap: .75rem;
    align-items: end;
    margin-bottom: 1rem;
    padding: 1rem;
    background: #ffffff;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.toolbar-wide {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
}

.toolbar label {
    display: grid;
    gap: .25rem;
    font-weight: 600;
    color: #2f3742;
    font-size: 0.85rem;
}

.summary-line {
    display: flex;
    gap: 1rem;
    color: #5b6472;
    margin-bottom: .5rem;
    font-size: 0.88rem;
}

.pager {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
}

.customer-tabs {
    margin-bottom: 1rem;
}

.customer-tab-content {
    display: grid;
    gap: 1rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 1rem;
    align-items: start;
}

.detail-grid .full-span-panel {
    grid-column: 1 / -1;
}

.panel {
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    padding: 1.1rem 1.15rem;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.panel h2 {
    font-size: 1.05rem;
    font-weight: 650;
    margin-bottom: .85rem;
    color: #0f172a;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .85rem;
}

.section-header h2 {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.form-grid label {
    display: grid;
    gap: .25rem;
    font-weight: 600;
    color: #2f3742;
    font-size: 0.85rem;
}

.form-grid .form-check {
    display: flex;
    gap: .5rem;
    align-items: center;
    min-height: 2.4rem;
}

.form-grid .full-span {
    grid-column: 1 / -1;
}

.form-section-title {
    font-size: 0.95rem;
    margin: 0;
    color: #2f3742;
    font-weight: 650;
}

.fees-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(180px, 1fr));
    gap: .85rem;
    margin-bottom: 1rem;
}

.fee-panel {
    display: grid;
    align-content: start;
    gap: .75rem;
}

.fee-panel h3 {
    font-size: 0.95rem;
    margin: 0;
    color: #2f3742;
    font-weight: 650;
}

.fee-panel label {
    display: grid;
    gap: .25rem;
    font-weight: 600;
    color: #2f3742;
    font-size: 0.85rem;
}

.details-list {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: .35rem .9rem;
}

.details-list dt {
    color: #64748b;
    font-weight: 500;
    font-size: 0.88rem;
}

.details-list dd {
    margin-bottom: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    color: #0f172a;
    font-weight: 500;
}

.compact-filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: .75rem;
    align-items: end;
    margin-bottom: 1rem;
}

.compact-filters label {
    display: grid;
    gap: .25rem;
    font-weight: 600;
    color: #2f3742;
    font-size: 0.85rem;
}

.margin-editor {
    display: grid;
    grid-template-columns: minmax(80px, 110px) auto auto;
    gap: .4rem;
    align-items: center;
}

.margin-editor small {
    grid-column: 1 / -1;
    color: #5b6472;
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.dialog-actions {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 1rem;
}

.consents-form {
    display: grid;
    gap: .85rem;
    margin-bottom: 1rem;
}

.consents-form .form-check {
    display: flex;
    align-items: center;
    gap: .65rem;
}

.parcels-toolbar {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
}

/* Tables — softer, modern look */
.table {
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
}

.table > :not(caption) > * > * {
    padding: 0.7rem 0.85rem;
    border-bottom-color: #eef1f6;
}

.table thead th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 1px solid #e5e9f0;
}

.table tbody tr:hover {
    background-color: #f8fafc;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: .22rem .55rem;
    border-radius: 999px;
    background: #eef2f7;
    color: #243447;
    font-weight: 600;
    font-size: .78rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.3;
}

.status-badge-success {
    background: #dcfce7;
    color: #166534;
}

.status-badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.status-badge-muted {
    background: #f1f5f9;
    color: #475569;
}

.status-badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.nested-table {
    margin: .35rem 0;
    padding: .4rem;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    background: #f8fafc;
}

.sub-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-bottom: 1.1rem;
    border-bottom: 2px solid #e5e9f0;
}

.sub-nav-link {
    display: inline-flex;
    align-items: center;
    min-height: 2.4rem;
    padding: .4rem 1.05rem;
    color: #475569;
    text-decoration: none;
    background: transparent;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: color 0.12s ease, background-color 0.12s ease, border-color 0.12s ease;
}

.sub-nav-link:hover {
    color: #1e293b;
    background: #f1f5f9;
    border-bottom-color: #cbd5e1;
}

.sub-nav-link.active {
    color: #2563eb;
    background: transparent;
    border-bottom-color: #2563eb;
    font-weight: 700;
}

.sub-nav-link.active:hover {
    background: #eff6ff;
}

/* Disabled sub-nav links — explicit TBD placeholders only */
.sub-nav-link[disabled],
.sub-nav-link.disabled {
    color: #cbd5e1;
    cursor: not-allowed;
    pointer-events: none;
    font-weight: 500;
}

.nav-subgroup {
    margin-top: -.35rem;
    margin-bottom: .35rem;
}

.nav-sub-link {
    padding-left: 2.25rem;
    font-size: .92rem;
}

.parcels-bulk-actions {
    margin-bottom: .75rem;
}

.selection-column {
    width: 2.5rem;
    text-align: center;
}

.selected-row > td {
    background: #eff6ff;
}

.info-banner {
    border: 1px solid #bfdbfe;
    border-left: 4px solid #3b82f6;
    border-radius: 6px;
    padding: .65rem .85rem;
    margin-bottom: .9rem;
    background: #eff6ff;
    color: #1e40af;
    font-size: 0.88rem;
}

.section-heading-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.section-heading-row h2,
.side-panel h3 {
    margin-bottom: .25rem;
}

.section-heading-row p,
.side-panel-header p {
    margin-bottom: 0;
    color: #64748b;
}

.details-cell {
    max-width: 28rem;
    overflow-wrap: anywhere;
}

.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1040;
    width: min(520px, 100vw);
    height: 100vh;
    overflow-y: auto;
    padding: 1rem;
    border-left: 1px solid #e5e9f0;
    background: #fff;
    box-shadow: -18px 0 48px rgba(15, 23, 42, .16);
}

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

.history-list {
    display: grid;
    gap: .75rem;
}

.history-item {
    display: grid;
    gap: .45rem;
    padding: .75rem;
    border: 1px solid #e5e9f0;
    border-radius: 8px;
    background: #f8fafc;
}

.history-item > div {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.history-item p {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.raw-response-panel {
    width: min(880px, 100%);
}

.raw-response {
    max-height: min(68vh, 680px);
    overflow: auto;
    padding: .75rem;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    background: #0f172a;
    color: #e2e8f0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    z-index: 1050;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, .42);
}

.modal-panel {
    width: min(440px, 100%);
    border-radius: 10px;
    border: 1px solid #e5e9f0;
    background: #fff;
    padding: 1.1rem;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
}

.modal-panel-wide {
    width: min(980px, 100%);
    max-height: min(92vh, 860px);
    overflow: auto;
}

.modal-panel h2 {
    font-size: 1.15rem;
    font-weight: 650;
    margin-bottom: .65rem;
    color: #0f172a;
}

.cod-picker-panel {
    width: min(980px, 100%);
    max-height: min(92vh, 860px);
    overflow: auto;
}

.cod-picker-table {
    max-height: min(38vh, 420px);
    overflow: auto;
}

.compact-list {
    margin-bottom: 0;
    padding-left: 1.25rem;
}

.details-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.details-list div {
    display: grid;
    gap: .2rem;
}

.details-list dt {
    font-size: .78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
}

.details-list dd {
    margin-bottom: 0;
    overflow-wrap: anywhere;
}

.message-content {
    max-height: min(46vh, 520px);
    overflow: auto;
    padding: 1rem;
    border: 1px solid #e5e9f0;
    border-radius: 6px;
    background: #ffffff;
    overflow-wrap: anywhere;
}

@media (max-width: 900px) {
    .toolbar {
        grid-template-columns: 1fr;
    }

    .detail-grid,
    .form-grid,
    .fees-grid,
    .compact-filters {
        grid-template-columns: 1fr;
    }
}

/* Login screen */
.login-shell {
    min-height: calc(100vh - 5rem);
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(420px, 100%);
    display: grid;
    gap: 1rem;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 12px;
    border: 1px solid #e5e9f0;
    box-shadow: 0 8px 32px rgba(15, 23, 42, 0.06);
}

.login-panel form {
    display: grid;
    gap: .85rem;
}

.login-panel label {
    display: grid;
    gap: .25rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.auth-link {
    justify-self: start;
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
}

.auth-link:hover,
.auth-link:focus {
    color: #1d4ed8;
    text-decoration: underline;
}
