/* Extracted from index.html. Load order matters: the cascade depends on it (see index.html <link> order). */
/* Modals */
.modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 1.25rem;
    box-sizing: border-box;
    background: rgba(17, 24, 39, 0.62);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-surface);
    width: 650px;
    max-width: 100%;
    max-height: calc(100vh - 2.5rem);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(17, 24, 39, 0.24);
}

.modal-header {
    min-height: 76px;
    box-sizing: border-box;
    padding: 1rem 1.25rem 1rem 1.5rem;
    border-bottom: 1px solid var(--brand-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(135deg, var(--brand-soft) 0%, var(--brand-soft) 100%);
}

.modal-heading {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.modal-header-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}

.modal-heading-icon {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--brand-line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--primary);
}

.modal-header h3 {
    margin: 0;
    color: var(--brand-hover);
    font-size: 1.05rem;
    line-height: 1.3;
}

.modal-subtitle {
    margin: 0.18rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.35;
}

.close-modal,
.side-panel-close {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.close-modal:hover,
.side-panel-close:hover {
    border-color: var(--brand-line);
    background: rgba(255, 255, 255, 0.78);
    color: var(--brand-hover);
}

.close-modal:focus-visible,
.side-panel-close:focus-visible {
    outline: 3px solid rgba(35, 47, 140, 0.2);
    outline-offset: 2px;
}

.modal-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0 0.8rem;
    border: 1px solid var(--brand-line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--brand-hover);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.modal-refresh-btn:hover {
    background: #fff;
    border-color: var(--brand-line);
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.btn-secondary {
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-dark);
}

.btn-secondary:hover {
    border-color: var(--brand-line);
    background: var(--brand-soft);
    color: var(--brand-hover);
}

/* Milestone Tracker */
.milestone-tracker {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 0 10px;
}

.milestone-tracker::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 20px;
    right: 20px;
    height: 4px;
    background: var(--border);
    z-index: 1;
}

.step {
    position: relative;
    z-index: 2;
    background: transparent;
    padding-top: 35px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    width: 80px;
    color: var(--text-muted);
}

.step::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 4px solid var(--border);
    box-sizing: border-box;
}

.step.completed {
    color: var(--primary);
}

.step.completed::before {
    border-color: var(--primary);
    background: var(--primary);
}

.step.active {
    color: var(--text-dark);
}

.step.active::before {
    border-color: var(--primary);
    background: white;
}

/* Auth component: header controls, account menu, modals, and shared auth styling */
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.profile-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 230px;
    background: #FFFFFF;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    padding: 6px;
    display: none;
    flex-direction: column;
    gap: 2px;
    z-index: 200;
}

.profile-menu.open {
    display: flex;
    animation: profileMenuPop 0.15s ease-out;
}

@keyframes profileMenuPop {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.profile-menu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px 10px;
}

.pm-avatar {
    width: 34px;
    height: 34px;
    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.75rem;
    flex-shrink: 0;
}

.pm-info {
    min-width: 0;
}

.pm-name {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-role {
    font-size: 0.7rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-divider {
    height: 1px;
    background: var(--surface-2);
    margin: 3px 0;
}

.profile-menu button {
    width: 100%;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

.profile-menu button i {
    width: 16px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.profile-menu button:hover {
    background: var(--surface-2);
    color: var(--primary);
}

.profile-menu button:hover i {
    color: var(--primary);
}

.profile-menu button.danger {
    color: #DC2626;
}

.profile-menu button.danger i {
    color: #EF4444;
}

.profile-menu button.danger:hover {
    background: #FEF2F2;
    color: #B91C1C;
}

.profile-menu button.danger:hover i {
    color: #B91C1C;
}

#profile-modal .modal-content {
    width: min(var(--login-details-width, 420px), calc(100vw - 2.5rem));
    min-width: min(420px, calc(100vw - 2.5rem));
}

#user-profile-modal .modal-content {
    width: min(var(--user-profile-width, 420px), calc(100vw - 2.5rem));
    min-width: min(420px, calc(100vw - 2.5rem));
}

.profile-modal-content { width: min(940px, calc(100vw - 2.5rem)); }
/* Fixed body height so switching tabs (Overview/Addresses/Contacts) doesn't resize the modal */
.profile-modal-content .modal-body { height: min(60vh, 460px); overflow-y: auto; overflow-x: hidden; }
.profile-modal-content .profile-tab-panel { min-height: 0; }
/* Keep all profile content within the modal width; tables scroll inside their own .table-responsive */
.profile-modal-content .profile-layout,
.profile-modal-content .profile-tab-list,
.profile-modal-content .profile-tab-panel,
.profile-modal-content .panel,
.profile-modal-content .table-responsive { max-width: 100%; min-width: 0; box-sizing: border-box; }

#logout-modal .modal-content {
    width: 420px;
}

#app-message-modal .modal-content {
    width: 430px;
}

.logout-confirmation {
    color: var(--ink-soft);
    line-height: 1.55;
}

.logout-confirmation p {
    margin: 0;
}

/* ==== export dialog ==== */
/* Pulse's Export dialog (the same in every app) in this page's modal and theme tokens.
   Markup: div.modal#export-modal > form.modal-content.export-dialog > .modal-header (title "Export <things>", subtitle "CSV · one row per <thing> · up to 1,000,000 rows" from /info export_limit, ×)
   > .modal-body.export-body: label.export-scope (input#export-use-filters, span > strong "Use the filters applied on the main page", small hint, ul.export-filter-list > li per applied filter)
   > div.export-options: .field Rows (label, div.export-rows > input#export-rows type=number min 1 max = export_limit, 5,000 by default and editable, button.export-rows-toggle (chevron) opening ul#export-rows-menu.export-rows-menu > li > button[data-rows]: 1,000 / 5,000 / 10,000 / 100,000 (each only below the maximum) / "Max (1,000,000)") and .field Order (label, select; hidden for a list with one order)
   > p.export-note (empty; only a failed download's message)
   > .modal-footer: Cancel, then the primary "Download CSV" ("Downloading… 12.3 MB" while the file arrives). A number above the maximum becomes the maximum when the box is left; while typed out of range the box is red and Download is off. No count before the download. */
/* short enough never to scroll, so nothing clips the Rows menu; the header and the footer round their own corners */
#export-modal .modal-content.export-dialog {
    width: min(520px, calc(100vw - 2.5rem));
    overflow: visible;
}
#export-modal .modal-body.export-body {
    display: grid;
    gap: 14px;
    overflow: visible;
}
#export-modal .modal-header {
    border-radius: 14px 14px 0 0;
}
#export-modal .modal-footer {
    border-radius: 0 0 14px 14px;
}
.export-body .field {
    display: grid;
    gap: 6px;
    min-width: 0;
    margin: 0;
}
.export-body .field[hidden] {
    display: none;
}
.export-body .field > label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 600;
}
.export-body .export-input {
    width: 100%;
    height: 40px;
    box-sizing: border-box;
    padding: 0 0.75rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--card);
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}
.export-body .export-input:focus {
    border-color: var(--indigo-line);
    box-shadow: 0 0 0 3px var(--indigo-soft);
}
.export-scope {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    cursor: pointer;
}
.export-scope.disabled {
    opacity: .6;
    cursor: default;
}
.export-scope input {
    flex: none;
    width: 16px;
    height: 16px;
    margin: 2px 0 0;
    accent-color: var(--indigo);
}
.export-scope span {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--ink);
    font-size: 0.875rem;
}
.export-scope small {
    color: var(--muted);
    font-size: 0.8rem;
}
.export-filter-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 0;
    padding: 0;
    list-style: none;
}
.export-filter-list:empty,
.export-filter-list.hidden {
    display: none;
}
.export-filter-list li {
    display: inline-flex;
    align-items: center;
    height: 22px;
    max-width: 100%;
    padding: 0 8px;
    border-radius: 999px;
    background: var(--indigo-soft);
    color: var(--indigo-deep);
    font-size: 0.72rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.export-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    gap: 12px;
}
.export-options.single {
    grid-template-columns: 1fr;
}
.export-rows {
    position: relative;
}
.export-rows input {
    padding-right: 34px;
    appearance: textfield;
    -moz-appearance: textfield;
}
.export-rows input::-webkit-inner-spin-button,
.export-rows input::-webkit-outer-spin-button {
    margin: 0;
    -webkit-appearance: none;
}
.export-rows input:invalid {
    border-color: var(--bad);
}
.export-rows-toggle {
    position: absolute;
    top: 1px;
    right: 1px;
    bottom: 1px;
    display: grid;
    place-items: center;
    width: 32px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}
.export-rows-toggle svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.export-rows-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 5;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: var(--radius-xs);
    background: var(--card);
    box-shadow: var(--shadow-pop);
    list-style: none;
    max-height: 248px;
    overflow-y: auto;
}
.export-rows-menu.hidden {
    display: none;
}
.export-rows-menu button {
    display: block;
    width: 100%;
    height: 30px;
    margin: 0;
    padding: 0 10px;
    border: 0;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--ink);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    text-align: left;
    cursor: pointer;
}
.export-rows-menu button:hover,
.export-rows-menu button.active {
    background: var(--paper);
}
.export-note:empty {
    display: none;
}
.export-note {
    margin: 0;
    color: var(--bad);
    font-size: 0.8rem;
}
@media (max-width: 520px) {
    .export-options {
        grid-template-columns: 1fr;
    }
}

.profile-grid {
    display: grid;
    gap: 0.8rem;
}

.profile-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--border);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-row span {
    color: var(--text-muted);
}

.profile-row strong {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
}

.profile-layout {
    display: grid;
    gap: var(--page-card-gap);
}

.profile-feedback {
    min-height: 280px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 2rem;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: var(--bg-surface);
    color: var(--text-muted);
    text-align: center;
}

.profile-feedback i {
    color: var(--primary);
    font-size: 1.5rem;
}

.profile-feedback.is-error i {
    color: #B91C1C;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.7rem;
    border: 1px solid rgba(255, 255, 255, 0.24);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #FFFFFF;
    font-size: 0.78rem;
    font-weight: 700;
}

.profile-chip::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #86EFAC;
}

.profile-chip.is-negative::before {
    background: #FCA5A5;
}

.profile-tab-list {
    display: flex;
    gap: 0.35rem;
    padding: 0.35rem;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-surface);
    box-shadow: 0 1px 3px rgba(17, 24, 39, 0.04);
}

.profile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.profile-tab:hover {
    color: var(--text-dark);
    background: var(--bg);
}

.profile-tab.active {
    color: var(--primary);
    background: var(--brand-soft);
    box-shadow: inset 0 0 0 1px var(--brand-line);
}

.profile-tab-count {
    min-width: 20px;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    background: var(--line);
    color: var(--text-muted);
    font-size: 0.72rem;
    text-align: center;
}

.profile-tab.active .profile-tab-count {
    background: #FFFFFF;
    color: var(--primary);
}

.profile-tab-panel {
    display: none;
}

.profile-tab-panel.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.profile-tab-panel .panel {
    margin-bottom: 0;
    border: 1px solid var(--border);
    box-shadow: 0 4px 16px rgba(17, 24, 39, 0.04);
}

.profile-table td {
    vertical-align: top;
}
.profile-detail-table td { padding: 0.7rem 1rem; }
.profile-detail-table .profile-detail-label { width: 40%; color: var(--text-muted); font-weight: 600; font-size: 0.8rem; white-space: nowrap; }
.profile-detail-table .profile-detail-value { color: var(--text-dark); font-weight: 600; word-break: break-word; }

/* Bordered, rounded tables inside the profile modal */
.profile-bordered-table { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; overflow-x: auto; }
.profile-bordered-table .data-table { border-spacing: 0; }
.profile-bordered-table .data-table thead th { background: var(--bg); color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); }
.profile-bordered-table .data-table td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); font-size: 0.85rem; }
.profile-bordered-table .data-table tbody tr:last-child td { border-bottom: 0; }
.profile-bordered-table .data-table tbody tr:hover { background: var(--bg); }
/* Overview detail table: subtle zebra + no header row */
.profile-detail-table.data-table td:first-child { border-right: 1px solid var(--border); }

.profile-cell-main {
    display: block;
    color: var(--text-dark);
    font-weight: 600;
    white-space: normal;
}

.profile-cell-sub {
    display: block;
    margin-top: 0.24rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: normal;
}

.profile-table a {
    color: var(--primary);
    text-decoration: none;
}

.profile-table a:hover {
    text-decoration: underline;
}

.tracking-layout {
    display: grid;
    gap: 1rem;
    padding: 1rem 1.5rem 1.5rem;
}

.tracking-event-panel {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #FFFFFF;
    overflow: hidden;
}

.tracking-event-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
}

.tracking-event-title {
    color: var(--ink);
    font-weight: 850;
}

.tracking-event-subtitle {
    margin-top: 0.16rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.tracking-timeline {
    position: relative;
    display: grid;
    gap: 0.7rem;
    padding: 1rem;
}

.tracking-event-card {
    position: relative;
    padding: 0.78rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(135deg, #FFFFFF 0%, var(--brand-soft) 100%);
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.045);
}

.tracking-card-route {
    display: grid;
    grid-template-columns: minmax(92px, 0.42fr) minmax(340px, 3fr) minmax(92px, 0.42fr);
    align-items: center;
    gap: 0.45rem;
    padding: 0.1rem 0;
}

.tracking-card-route-mid {
    position: relative;
    min-width: 0;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}

.tracking-card-place {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tracking-card-place-icon {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-soft);
}

.tracking-card-label {
    display: none;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 850;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.tracking-card-value {
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 850;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tracking-card-route > .tracking-card-place:last-child {
    justify-content: flex-end;
}

.tracking-card-route > .tracking-card-place:last-child .tracking-card-value,
.tracking-card-route > .tracking-card-place:last-child .tracking-card-label {
    text-align: right;
}

.tracking-card-route-mid::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    background-image: linear-gradient(to right, var(--faint) 45%, transparent 45%);
    background-size: 8px 2px;
}

.tracking-card-line-label {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 0.34rem;
    max-width: 220px;
    padding: 0.28rem 0.65rem;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--ink-soft);
    font-size: 0.66rem;
    font-weight: 850;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tracking-card-line-time {
    position: absolute;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
    max-width: 140px;
    padding: 0.22rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #FFFFFF;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 820;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tracking-card-line-time.start {
    left: 0;
}

.tracking-card-line-time.end {
    right: 0;
}

.tracking-card-shipment {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.45rem;
}

.tracking-info-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.62rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--bg);
    color: var(--ink-soft);
    font-size: 0.74rem;
    font-weight: 760;
}

.tracking-info-chip.strong {
    border-color: #DDD6FE;
    background: var(--brand-soft);
    color: #5B21B6;
}

.tracking-info-chip.subtle {
    border-color: var(--line);
    background: #FFFFFF;
    color: var(--muted);
    font-weight: 720;
}

.tracking-info-chip.arrived {
    border-color: #A7F3D0;
    background: #ECFDF5;
    color: #047857;
}

.tracking-info-chip.estimated {
    border-color: #FDE68A;
    background: #FFFBEB;
    color: #B45309;
}

.tracking-info-chip.pending {
    border-color: var(--line-strong);
    background: var(--bg);
    color: var(--ink-soft);
}

.tracking-info-chip i {
    flex: 0 0 auto;
}

.shipment-kpi-clear {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--line-strong);
    border-radius: 7px;
    background: #FFFFFF;
    color: var(--primary);
    padding: 0.42rem 0.7rem;
    font: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.shipment-kpi-clear:hover {
    border-color: var(--primary);
    background: var(--brand-soft);
}

.shipment-kpi-banner {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.8rem 1rem;
    border: 1px solid var(--brand-line);
    border-radius: 8px;
    background: var(--brand-soft);
    color: #1E3A8A;
    font-size: 0.86rem;
    font-weight: 750;
}

.shipment-kpi-banner.is-visible {
    display: flex;
}

.shipment-kpi-banner span {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
}

.coming-soon-block { text-align: center; padding: 3.5rem 1.5rem; }
.coming-soon-icon { width: 68px; height: 68px; margin: 0 auto 1.1rem; border-radius: 18px; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; color: var(--primary); background: linear-gradient(135deg, var(--brand-soft) 0%, var(--info-soft) 100%); }
.coming-soon-block h3 { margin: 0 0 0.5rem; font-size: 1.2rem; color: var(--text-dark); }
.coming-soon-block p { margin: 0 auto; max-width: 520px; color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; }

.analytics-chart-card {
    min-width: 0;
    overflow: hidden;
}

.analytics-chart-card.wide {
    grid-column: 1 / -1;
}

.user-dashboard-list {
    display: grid;
    gap: 1rem;
}

.user-dashboard-card {
    overflow: hidden;
}

.user-dashboard-title {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 850;
}

.user-dashboard-frame {
    width: 100%;
    aspect-ratio: 1280 / 612;
    min-height: 380px;
    background: var(--bg);
    border-top: 1px solid var(--line);
}

.user-dashboard-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (max-width: 700px) {
    .tracking-card-route {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .tracking-card-route-mid {
        justify-content: flex-start;
    }

    .analytics-chart-grid,
    .user-dashboard-list {
        grid-template-columns: 1fr;
    }

    .user-dashboard-frame {
        min-height: 280px;
    }
}

.tracking-event-main {
    min-width: 0;
}

.empty-state {
    display: grid;
    place-items: center;
    min-height: 120px;
    padding: 1rem;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    background: var(--bg);
    text-align: center;
}

/* Rates */

/* Sales Rate Search */

@media (max-width: 900px) {
    .po-kpi-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .top-bar {
        padding: 0 1rem;
    }

}

@media (max-width: 700px) {
    .topbar-breadcrumbs .topbar-crumb-item.root,
    .topbar-breadcrumbs .topbar-crumb-divider {
        display: none;
    }
    .topbar-live-tag {
        display: none;
    }
    .user-profile-meta {
        display: none;
    }

    .po-toolbar {
        align-items: stretch;
        flex-direction: column;
        padding: 1rem;
    }

    .po-toolbar-actions {
        align-items: stretch;
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .po-search {
        width: 100%;
        flex-basis: 100%;
    }

    .po-refresh-button.compact {
        width: 100%;
    }

    .po-summary-bar {
        padding: 0.65rem 1rem;
    }

    .po-kpi-strip {
        padding: 0.85rem 1rem;
        grid-template-columns: 1fr;
    }

    .po-page-button span {
        display: none;
    }

    .po-page-button {
        width: 34px;
        justify-content: center;
        padding: 0;
    }

    .modal {
        padding: 0.75rem;
        align-items: flex-end;
    }

    .modal-content {
        max-height: calc(100vh - 1.5rem);
        border-radius: 14px;
    }

    .modal-header,
    .side-panel-header {
        padding: 0.9rem 1rem;
    }

    .modal-body,
    .side-panel-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 0.85rem 1rem;
    }

    .modal-heading-icon {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .profile-row {
        grid-template-columns: 90px minmax(0, 1fr);
    }

    .app-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex: 0 0 auto;
    }

    .sidebar .logo {
        display: none;
    }

    .nav-menu {
        flex-direction: row;
        gap: 0.35rem;
        padding: 0.55rem;
        overflow-x: auto;
    }

    .nav-item {
        flex: 0 0 auto;
        gap: 0.5rem;
        padding: 0.65rem 0.8rem;
        border-radius: 8px;
        font-size: 0.82rem;
        white-space: nowrap;
    }

    .nav-item.active {
        border-left: 0;
        background: var(--sidebar-active-bg);
        box-shadow: inset 0 -2px 0 var(--primary);
    }

    .main-content {
        min-height: 0;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .profile-tab {
        flex: 1 0 auto;
    }

    .panel {
        padding: 1rem;
    }
}
