/**
 * App.css
 */
html,
body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
}

body {
    line-height: 1.5;
}

h1,
h2,
h3,
h4 {
    line-height: 1.15;
    letter-spacing: -0.02em;
}

p {
    color: var(--text-soft);
}

a {
    transition: color 0.2s ease;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: 0.2s ease;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-faint);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

label {
    display: inline-block;
    margin-bottom: 8px;
    font-weight: 600;
}

strong {
    color: var(--text);
}

.muted {
    color: var(--text-faint);
}

.stack {
    display: grid;
    gap: 4px;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

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

.form-group {
    display: grid;
    gap: 8px;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-row--between {
    justify-content: space-between;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    border-radius: var(--radius-md);
    font-weight: 700;
    transition: 0.2s ease;
    border: 1px solid transparent;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn--block {
    width: 100%;
}

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

.btn--primary:hover {
    background: var(--primary-hover);
}
.btn--danger {
    background: var(--danger);
    color: var(--text-inverse);
}

.btn--danger:hover {
    background: var(--danger-hover);
    color: var(--danger-text-hover);
    border-color: var(--danger-text-hover);
}

.btn--secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn--secondary:hover {
    background: var(--surface-soft);
}

.btn--ghost {
    background: transparent;
    color: var(--primary);
    border-color: var(--border);
}

.btn--ghost:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
    color: var(--primary-hover);
}

.badge,
.status {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    font-weight: 700;
}

.status--pending {
    background: var(--warning-soft);
    color: var(--warning);
}

.status--transit {
    background: var(--primary-soft);
    color: var(--primary);
}

.status--delayed {
    background: var(--danger-soft);
    color: var(--danger);
}

.status--delivered {
    background: var(--success-soft);
    color: var(--success);
}

.status--available {
    background: var(--success-soft);
    color: var(--success);
}

.status--trip {
    background: var(--primary-soft);
    color: var(--primary);
}

.form-message {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
}

.form-message--error {
    background: var(--danger-soft);
    color: var(--danger);
}

.form-message--success {
    background: var(--success-soft);
    color: var(--success);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    background:
        radial-gradient(circle at top left, rgba(29, 78, 216, 0.10), transparent 40%),
        radial-gradient(circle at bottom right, rgba(21, 128, 61, 0.06), transparent 40%),
        linear-gradient(180deg, #f8fbff 0%, #f5f7fb 100%);
}

.auth-brand,
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
}

.auth-brand__inner {
    max-width: 520px;
}

.auth-brand__tag {
    display: inline-flex;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
    font-size: 0.88rem;
    margin-bottom: 24px;
}

.auth-brand h1 {
    font-size: clamp(2rem, 4vw, 3.4rem);
    margin-bottom: 12px;
    line-height: 1.1;
    color: var(--text);
}

.auth-brand > .auth-brand__inner > p {
    font-size: 1.05rem;
    color: var(--text-soft);
    margin-bottom: 32px;
    line-height: 1.6;
}

.auth-features {
    display: grid;
    gap: 16px;
}

.auth-feature {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.auth-feature__icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.auth-feature strong {
    display: block;
    font-size: 0.92rem;
    margin-bottom: 2px;
}

.auth-feature p {
    font-size: 0.84rem;
    color: var(--text-faint);
    margin: 0;
}

.auth-panel {
    background: rgba(255, 255, 255, 0.4);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
}

.auth-logo {
    font-size: 2rem;
    margin-bottom: 12px;
}

.auth-card h2 {
    font-size: 1.7rem;
    margin-bottom: 4px;
    color: var(--text);
}

.auth-card__header {
    margin-bottom: 28px;
}

.auth-card__header p {
    font-size: 0.95rem;
    color: var(--text-faint);
}

.auth-form {
    display: grid;
    gap: 18px;
}

.auth-card__footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-faint);
}

.auth-card__footer a {
    color: var(--primary);
    font-weight: 600;
}

.auth-card__footer a:hover {
    text-decoration: underline;
}

.app-shell {
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    overflow-y: auto;
    z-index: 20;
}

.sidebar__brand h1 {
    color: var(--sidebar-active);
    font-size: 1.35rem;
}

.sidebar__brand p {
    font-size: 0.92rem;
    color: var(--sidebar-text);
}

.sidebar__nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--sidebar-text);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--sidebar-active);
}

.nav-link--active {
    background: rgba(255, 255, 255, 0.12);
    color: var(--sidebar-active);
}

.app-main {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    margin-left: var(--sidebar-width);
}

.topbar {
    min-height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(10px);
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Global Search ── */
.search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 360px;
    overflow-y: auto;
    z-index: 35;
    margin-top: 4px;
}
.search-results[hidden] { display: none; }
.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--surface-soft); }
.search-item__type {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 60px;
}
.search-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.page-title {
    font-size: 1.7rem;
}

.page-content {
    padding: 24px;
    overflow-x: hidden;
    max-width: 100%;
}

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

.stat-card,
.panel,
.detail-card,
.state-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat-card {
    padding: 22px;
}

.stat-card__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 700;
}

.stat-card h3 {
    font-size: 1.95rem;
    margin-bottom: 8px;
}

.content-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 20px;
}

.panel__header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.panel__body {
    padding: 18px 20px;
    overflow-x: auto;
}

.panel__body .btn {
    margin-top: 8px;
}

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

.data-table thead th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    background: var(--surface-soft);
    border-bottom: 1px solid var(--border);
}

.data-table tbody td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    color: var(--text-soft);
}

.data-table tbody tr:hover {
    background: #fafcff;
}

.detail-card {
    padding: 20px;
}

.detail-card h4 {
    margin-bottom: 12px;
}

.state-card {
    padding: 28px 20px;
    text-align: center;
}

.state-card h3 {
    margin-bottom: 8px;
}

.state-card p {
    max-width: 46ch;
    margin: 0 auto;
}

.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.toolbar__left,
.toolbar__right {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.mobile-menu-btn {
    display: none;
}

.drawer-backdrop {
    display: none;
}

.modal-root,
.toast-root {
    position: fixed;
    z-index: 999;
}

.modal-root {
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: var(--overlay);
}

.modal-root.is-open {
    display: flex;
}

.modal {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.modal__header,
.modal__body,
.modal__footer {
    padding: 18px 20px;
}

.modal__header {
    border-bottom: 1px solid var(--border);
}

.modal__footer {
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.toast-root {
    bottom: 20px;
    right: 20px;
    display: grid;
    gap: 10px;
}

.toast {
    min-width: 280px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    box-shadow: var(--shadow-md);
    animation: toast-slide-in 0.25s ease;
    cursor: default;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.toast__icon {
    font-size: 1rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.toast__msg {
    flex: 1;
    font-size: 0.88rem;
    line-height: 1.4;
    color: var(--text);
}

.toast__close {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0 2px;
    flex-shrink: 0;
    line-height: 1;
    transition: color 0.12s ease;
}

.toast__close:hover {
    color: var(--text);
}

.toast--clickable {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.toast--clickable:hover {
    transform: translateX(-4px);
    box-shadow: var(--shadow-lg);
}

@keyframes toast-slide-in {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

.toast--success {
    border-left-color: var(--success);
    background: linear-gradient(135deg, var(--success-soft) 0%, var(--surface) 30%);
}

.toast--error {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-soft) 0%, var(--surface) 30%);
}

.toast--info {
    border-left-color: var(--primary);
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 30%);
}

.toast--warning {
    border-left-color: var(--warning);
    background: linear-gradient(135deg, var(--warning-soft) 0%, var(--surface) 30%);
}

.toast--lost {
    border-left-color: var(--danger);
    background: linear-gradient(135deg, var(--danger-soft) 0%, var(--surface) 40%);
}

.toast--won {
    border-left-color: var(--success);
    background: linear-gradient(135deg, var(--success-soft) 0%, var(--surface) 40%);
}
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.page-header__left,
.page-header__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.page-section-title {
    font-size: 1.25rem;
}

.btn--sm {
    min-height: 38px;
    padding: 0 14px;
}
.progress-block {
    display: grid;
    gap: 14px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-pill);
    transition: width 0.25s ease;
}

.progress-steps {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-faint);
    font-size: 0.9rem;
}

.progress-step__dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--border-strong);
    flex-shrink: 0;
}

.progress-step--active {
    color: var(--text);
    font-weight: 600;
}

.progress-step--active .progress-step__dot {
    background: var(--primary);
}

.timeline {
    display: grid;
    gap: 12px;
}

.timeline-item {
    position: relative;
    padding-left: 24px;
}

.timeline-item__dot {
    position: absolute;
    left: 0;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--primary);
}

.timeline-item__line {
    position: absolute;
    left: 4px;
    top: 16px;
    width: 2px;
    height: calc(100% + 8px);
    background: var(--border);
}

.timeline-item__line--last {
    display: none;
}

.chart-card {
    display: grid;
    gap: 16px;
}

.chart-card__bar {
    display: flex;
    width: 100%;
    height: 16px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    background: var(--surface-muted);
}

.chart-segment--pending {
    background: var(--warning);
}

.chart-segment--delayed {
    background: var(--danger);
}

.chart-segment--delivered {
    background: var(--success);
}

.chart-legend {
    display: grid;
    gap: 10px;
}

.chart-legend__item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-legend__dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    display: inline-block;
}

.metric-progress {
    display: grid;
    gap: 8px;
}

.metric-progress__head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}
.notification-bell {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.72rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.notification-panel {
    position: absolute;
    top: calc(var(--topbar-height) + 6px);
    right: 24px;
    width: 340px;
    max-height: 420px;
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 30;
}

.notification-panel.is-open {
    display: block;
}

/* ── Profile Button & Panel ── */
.profile-btn {
    font-size: 1.15rem;
    position: relative;
}

.profile-panel {
    position: absolute;
    top: calc(var(--topbar-height) + 6px);
    right: 24px;
    width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 31;
    padding: 16px;
}

.profile-panel.is-open {
    display: block;
}

.profile-panel__name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
}

.profile-panel__role {
    font-size: 0.82rem;
    margin-bottom: 12px;
    text-transform: capitalize;
}

.profile-panel__logout {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-weight: 600;
    font-size: 0.88rem;
    text-align: center;
    border: 1px solid var(--danger);
    transition: background 0.15s;
}

.profile-panel__logout:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* Hide sidebar logout on desktop — profile panel handles it */
.sidebar-logout {
    display: none;
}

.notification-panel__header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notification-list {
    display: grid;
}

.notification-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notification-item p {
    margin-top: 4px;
}

.notification-empty {
    padding: 18px 16px;
    color: var(--text-faint);
}
.dispatch-inline {
    display: flex;
    gap: 8px;
    align-items: center;
}
.chat-list {
    display: grid;
    gap: 10px;
}

.chat-item {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.chat-item--mine {
    background: var(--primary-soft);
}


/* ── Shimmer loading ── */
.shimmer-line {
    display: inline-block;
    height: 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--surface-muted) 25%, var(--border) 50%, var(--surface-muted) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.shimmer-table tbody td {
    padding: 18px 20px;
}

/* ── Page Error State ── */
.page-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    text-align: center;
    padding: 40px 20px;
}
.page-error-state__icon { font-size: 3rem; margin-bottom: 12px; }
.page-error-state__title { font-size: 1.25rem; color: var(--text); margin: 0 0 8px; }
.page-error-state__msg { color: var(--text-muted); margin: 0 0 24px; max-width: 400px; }
.page-error-state__actions { display: flex; gap: 10px; }

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.pagination__info {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-faint);
    font-size: 0.88rem;
}

.pagination__controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pg-btn {
    min-width: 36px;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    transition: 0.15s ease;
}

.pg-btn:hover:not(:disabled):not(.pg-btn--active) {
    background: var(--surface-muted);
    border-color: var(--border-strong);
    color: var(--text);
}

.pg-btn--active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-inverse);
}

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

.pg-per-page {
    width: auto;
    min-width: 100px;
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
}

/* ── Filter bar ── */
.table-filter {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.table-filter input {
    padding: 10px 14px;
    font-size: 0.92rem;
}

/* ── Sortable headers ── */
.data-table thead th[data-pg-sort]:hover {
    background: var(--surface-muted);
    color: var(--text);
}


/* ── Dispatch tabs ── */
.dispatch-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 4px;
    width: fit-content;
    padding-bottom: 0px;
}

.dispatch-tab {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-soft);
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: 0.15s ease;
}

.dispatch-tab:hover {
    background: var(--surface-muted);
    color: var(--text);
}

.dispatch-tab--active {
    background: var(--primary);
    color: var(--surface-soft);
}

.dispatch-tab--active:hover {
    background: var(--primary-hover);
    color: var(--text-inverse);
}

/* ── Clickable notification items ── */
.notification-item--link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.15s ease;
}

.notification-item--link:hover {
    background: var(--surface-muted);
}

.notification-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.notification-row--unread {
    background: var(--primary-soft);
}


/* ── Clickable stat cards ── */
.stat-card--link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    position: relative;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card--link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card--warning {
    border-left: 4px solid var(--warning);
}

.stat-card--danger {
    border-left: 4px solid var(--danger);
}

.stat-card--success {
    border-left: 4px solid var(--success);
}

.stat-card__icon {
    position: absolute;
    top: 18px;
    right: 18px;
    font-size: 1.6rem;
    opacity: 0.7;
}

/* ── Alert items ── */
.alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--text);
    transition: background 0.15s ease;
    font-size: 0.92rem;
}

.alert-item:hover {
    background: var(--surface-muted);
}

.alert-item--danger { border-left: 3px solid var(--danger); }
.alert-item--warning { border-left: 3px solid var(--warning); }
.alert-item--success { border-left: 3px solid var(--success); }

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex-shrink: 0;
}

/* ── Donut chart ── */
.donut-chart {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.donut-chart__ring {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
}

.donut-chart__center {
    width: var(--hole);
    height: var(--hole);
    background: var(--surface);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.donut-chart__center strong {
    font-size: 1.4rem;
    line-height: 1;
}

.donut-chart__center span {
    font-size: 0.72rem;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ── Bar chart ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: var(--bar-height, 160px);
    padding-top: 24px;
}

.bar-chart__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.bar-chart__bar {
    width: 100%;
    max-width: 48px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: height 0.3s ease;
    min-height: 4px;
}

.bar-chart__value {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
}

.bar-chart__label {
    font-size: 0.78rem;
    color: var(--text-faint);
    text-align: center;
}

/* ── KPI mini ── */
.kpi-mini {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.kpi-mini__label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    font-weight: 700;
}

.kpi-mini__value {
    font-size: 1.3rem;
}

.kpi-mini__sub {
    font-size: 0.82rem;
    color: var(--text-faint);
}


/* ── Chips ── */
.chip-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 36px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: var(--radius-pill);
    font-size: 0.85rem;
    font-weight: 600;
}

.chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: rgba(29, 78, 216, 0.15);
    color: var(--primary);
    border-radius: 50%;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s ease;
}

.chip__remove:hover {
    background: var(--danger-soft);
    color: var(--danger);
}


/* ── Speech-to-text ── */
.stt-mic {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    font-size: 1rem;
    padding: 0;
    margin-left: 6px;
    vertical-align: middle;
    transition: 0.15s ease;
    flex-shrink: 0;
}

.stt-mic:hover {
    background: var(--primary-soft);
    border-color: var(--primary);
}

/* Overlay */
#stt-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
}

#stt-overlay.stt-open {
    display: flex;
}

.stt-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 32px 40px;
    text-align: center;
    min-width: 300px;
    max-width: 420px;
}

.stt-pulse {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--danger);
    animation: stt-pulse-anim 1.2s ease-in-out infinite;
}

@keyframes stt-pulse-anim {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.6; }
}

.stt-status {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.stt-transcript {
    color: var(--text-soft);
    font-size: 0.95rem;
    min-height: 24px;
    margin-bottom: 16px;
    max-height: 120px;
    overflow-y: auto;
    word-break: break-word;
}

.stt-stop {
    margin-top: 4px;
}

/* Make form groups flex so mic sits next to input */
.form-group {
    position: relative;
}

.form-group .stt-mic {
    position: absolute;
    right: 4px;
    bottom: 8px;
}

.form-group input,
.form-group textarea {
    padding-right: 44px;
}

/* NEW: let helper panels span both desktop grid columns. */
.form-span-2 {
    grid-column: 1 / -1;
}

/* NEW: compact Smart Pricing panel for quote/shipment creation.
   This keeps Pricing Engine v2 visible without turning the create form
   into a pricing-configuration screen. */
.pricing-preview-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
}

.pricing-preview-card__text {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.pricing-preview-card__text strong {
    font-size: 0.92rem;
}

.pricing-preview-card__text span {
    font-size: 0.82rem;
    color: var(--text-faint);
    line-height: 1.35;
}

@media (max-width: 720px) {
    .pricing-preview-card {
        align-items: stretch;
        flex-direction: column;
    }

    .pricing-preview-card .btn {
        width: 100%;
    }
}
/* NEW: frontend validation state for create quote/shipment forms */
.field-invalid {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.08) !important;
}

.btn--disabled,
.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}
/* Inline dispatch forms — mic sits inline */
.dispatch-inline .stt-mic {
    position: static;
}


/* ── Currency input ── */
.currency-input {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--surface);
}

.currency-input select {
    width: auto;
    min-width: 72px;
    border: none;
    border-right: 1px solid var(--border);
    border-radius: 0;
    padding: 14px 10px;
    font-weight: 700;
    background: var(--surface-soft);
    color: var(--text);
}

.currency-input input {
    border: none;
    border-radius: 0;
    flex: 1;
    min-width: 0;
}

.currency-input select:focus,
.currency-input input:focus {
    box-shadow: none;
}

.currency-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}


/* ── Button loading state ── */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}


/* ── AI Insight panel ── */
.insight-panel {
    border-left: 3px solid var(--primary);
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 40%);
}

.insight-panel .panel__header {
    border-bottom-color: rgba(29, 78, 216, 0.12);
}

.insight-panel .panel__header h3 {
    color: var(--primary);
}

.insight-body {
    min-height: 60px;
}

.insight-result p {
    margin-bottom: 8px;
    line-height: 1.6;
    color: var(--text);
}

.insight-list {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 10px;
}

.insight-list li {
    padding: 10px 14px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-left: 3px solid var(--primary);
    border-radius: var(--radius-sm);
    line-height: 1.5;
    color: var(--text);
}

.insight-loading {
    padding: 8px 0;
}

.insight-meta {
    color: var(--text-faint);
}


/* ── Shipment progress stepper ── */
.sp-progress {
    display: grid;
    gap: 16px;
    position: relative;
}

.sp-track {
    width: 100%;
    height: 6px;
    background: var(--surface-muted);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.sp-track__fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

/* NEW: flexible shipment stepper — supports 4, 5, or more steps on desktop */
.sp-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 8px;
    align-items: start;
}

.sp-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.sp-dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: 0.2s ease;
    font-size: 1.1rem;
}

.sp-dot__icon {
    position: relative;
    z-index: 2;
}

.sp-dot__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    z-index: 1;
    animation: sp-pulse 1.5s ease-in-out infinite;
}

@keyframes sp-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.35); opacity: 0; }
}

.sp-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-faint);
    transition: color 0.2s ease;
}

/* States */
.sp-step--done .sp-dot {
    background: var(--success-soft);
}

.sp-step--done .sp-label {
    color: var(--success);
}

.sp-step--active .sp-dot {
    background: var(--primary-soft);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.sp-step--active .sp-dot__pulse {
    background: var(--primary);
}

.sp-step--active .sp-label {
    color: var(--primary);
}

.sp-step--delayed .sp-dot {
    background: var(--danger-soft);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.15);
}

.sp-step--delayed .sp-dot__pulse {
    background: var(--danger);
}

.sp-step--delayed .sp-label {
    color: var(--danger);
}

.sp-step--future .sp-dot {
    background: var(--surface-muted);
    border: 2px solid var(--border);
}

.sp-step--future .sp-label {
    color: var(--text-faint);
}

/* Hover: enlarge dot */
.sp-step:hover .sp-dot {
    transform: scale(1.1);
}

.sp-delay-badge {
    display: flex;
    justify-content: center;
}

.sp-delay-badge span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.85rem;
    animation: sp-badge-pulse 2s ease-in-out infinite;
}

@keyframes sp-badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* ── Timeline (redesigned) ── */
.tl {
    display: grid;
    gap: 0;
}

.tl-item {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    position: relative;
    min-height: 52px;
}

.tl-line {
    position: absolute;
    left: 17px;
    top: 36px;
    width: 2px;
    bottom: 0;
}

.tl-item--last .tl-line {
    display: none;
}

.tl-dot {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
    z-index: 2;
    transition: transform 0.15s ease;
    border: 2px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border);
}

.tl-item:hover .tl-dot {
    transform: scale(1.15);
}

.tl-item--last .tl-dot {
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12);
    animation: sp-pulse 1.5s ease-in-out infinite;
}

.tl-content {
    padding: 6px 0 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tl-content strong {
    font-size: 0.92rem;
    color: var(--text);
}

.tl-time {
    font-size: 0.78rem;
    color: var(--text-faint);
}

/* ── Keep progress-bar for metric bars (used by charts) ── */
.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--surface-muted);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-pill);
    transition: width 0.25s ease;
}


/* ── Shipment detail page ── */
.sd-progress-panel {
    border-top: 3px solid var(--primary);
}

.sd-summary-wrap {
    position: relative;
}

.sd-scroll-btn {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    color: var(--text);
    line-height: 1;
    padding: 0;
}

.sd-scroll-btn:hover { background: var(--surface-soft); }
.sd-scroll-left { left: -4px; }
.sd-scroll-right { right: -4px; }

.sd-summary {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-top: 8px;
    scrollbar-width: thin;
}

.sd-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    flex: 1 0 160px;
    min-width: 160px;
    padding: 18px;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.sd-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.sd-card__icon {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.sd-card h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    margin-bottom: 4px;
}

.sd-card p {
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.sd-card .muted {
    font-size: 0.82rem;
    display: block;
    margin-top: 2px;
}

.sd-delay-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--danger-soft);
    border: 1px solid rgba(185, 28, 28, 0.15);
    border-radius: var(--radius-md);
}

.sd-delay-card__icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sd-delay-card p {
    margin: 0 0 2px;
    color: var(--text);
    font-size: 0.9rem;
}

.sd-pod-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 12px;
    padding: 14px 16px;
    background: var(--success-soft);
    border: 1px solid rgba(21, 128, 61, 0.15);
    border-radius: var(--radius-md);
}

.sd-pod-card__icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.sd-pod-card p {
    margin: 0 0 2px;
    color: var(--text);
    font-size: 0.9rem;
}

.sd-tab-content {
    animation: sd-fade-in 0.2s ease;
}

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

@media (max-width: 900px) {
    .sd-scroll-btn { display: flex; align-items: center; justify-content: center; }
}

/* NEW: keep steps readable on small screens */
@media (max-width: 640px) {
    .sp-steps {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
    }

    .sp-label {
        font-size: 0.76rem;
        line-height: 1.2;
    }
}


/* ── Ratings ── */
.star { font-size: 1.3rem; color: var(--border-strong); }
.star--filled { color: #f59e0b; }

.star-btn {
    font-size: 1.8rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--border-strong);
    padding: 2px 4px;
    transition: color 0.1s ease, transform 0.1s ease;
}
.star-btn:hover { transform: scale(1.2); }
.star-btn.star-btn--active { color: #f59e0b; }

.rating-stars-input { display: flex; gap: 4px; }

.rating-form { padding: 4px 0; }

.rating-display {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.rating-display__comment {
    font-style: italic;
    color: var(--text-soft);
    font-size: 0.9rem;
}

.rating-summary {
    display: flex;
    align-items: center;
    gap: 14px;
}
.rating-summary__score {
    font-size: 2.2rem;
    font-weight: 700;
    color: #f59e0b;
    line-height: 1;
}
.rating-summary__stars { margin-bottom: 2px; }

.rating-card {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}
.rating-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}
.rating-card__comment {
    font-style: italic;
    color: var(--text-soft);
    font-size: 0.88rem;
    margin: 4px 0;
}


/* ── Share button ── */
.share-wrap {
    position: relative;
    display: inline-block;
}

.share-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    z-index: 20;
    overflow: hidden;
}

.share-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--text);
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    cursor: pointer;
    transition: background 0.12s ease;
}

.share-option:hover {
    background: var(--surface-muted);
}

.share-option + .share-option {
    border-top: 1px solid var(--border);
}


/* ── AI Admin ── */
.prompt-preview {
    font-size: 0.8rem;
    color: var(--text-faint);
    background: var(--surface-muted);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    display: inline-block;
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ── AI Insight panel ── */
.insight-panel {
    border-left: 3px solid var(--primary);
    background: linear-gradient(135deg, var(--primary-soft) 0%, var(--surface) 40%);
}

.insight-panel .panel__header {
    border-bottom-color: rgba(29, 78, 216, 0.12);
}

.insight-panel .panel__header h3 {
    color: var(--primary);
}

.insight-body {
    min-height: 60px;
}

.insight-loading {
    padding: 8px 0;
}

/* Insight cards */
.insight-cards {
    display: grid;
    gap: 12px;
}

.insight-card {
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.insight-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.insight-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.insight-card__icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.insight-card__num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
    background: var(--surface-muted);
    color: var(--text-faint);
}

.insight-card__title {
    font-size: 0.92rem;
    color: var(--text);
}

.insight-card__body {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text-soft);
    margin: 0;
}

.insight-card__body strong {
    color: var(--text);
}

/* Severity colors */
.insight-card--danger {
    border-left: 3px solid var(--danger);
    background: linear-gradient(135deg, var(--danger-soft) 0%, var(--surface) 30%);
}
.insight-card--danger .insight-card__num { background: var(--danger-soft); color: var(--danger); }

.insight-card--warning {
    border-left: 3px solid var(--warning);
    background: linear-gradient(135deg, var(--warning-soft) 0%, var(--surface) 30%);
}
.insight-card--warning .insight-card__num { background: var(--warning-soft); color: var(--warning); }

.insight-card--success {
    border-left: 3px solid var(--success);
    background: linear-gradient(135deg, var(--success-soft) 0%, var(--surface) 30%);
}
.insight-card--success .insight-card__num { background: var(--success-soft); color: var(--success); }

.insight-card--info {
    border-left: 3px solid var(--primary);
}
.insight-card--info .insight-card__num { background: var(--primary-soft); color: var(--primary); }

/* Meta footer */
.insight-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    font-size: 0.76rem;
    color: var(--text-faint);
}

.insight-meta span {
    padding: 3px 8px;
    background: var(--surface-muted);
    border-radius: var(--radius-sm);
}


/* ── Insight TTS button ── */
.insight-listen-btn--playing {
    color: var(--danger);
    border-color: var(--danger);
    animation: tts-pulse 1.5s ease-in-out infinite;
}

@keyframes tts-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}


/* ── Insight action buttons ── */
.insight-card__actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ia-btn {
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.12s ease;
    color: var(--text-soft);
}

.ia-btn:hover:not(:disabled) { background: var(--surface-muted); }
.ia-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.ia-btn--selected {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary);
}

.ia-done {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-faint);
    padding: 5px 0;
}


/* ── Insight collapse/expand ── */
.insight-collapse-btn {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(29, 78, 216, 0.2);
    border-radius: var(--radius-sm);
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.7rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.15s ease;
    padding: 0;
    flex-shrink: 0;
}

.insight-collapse-btn:hover {
    background: var(--primary);
    color: var(--text-inverse);
}


/* ── Nav groups ── */
.nav-group {
    margin-top: 8px;
}

.nav-group__label {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(203, 213, 225, 0.5);
    padding: 8px 14px 4px;
    font-weight: 700;
}


/* ── Fix hidden attribute override ── */
[hidden] {
    display: none !important;
}


/* ── Live Tracking Map ── */
.tracking-live-map {
    height: 380px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    background: var(--surface-muted);
    overflow: hidden;
    position: relative;
    z-index: 1;
}

@keyframes tracking-pulse-anim {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 0; transform: scale(2.5); }
}

.tracking-pulse {
    animation: tracking-pulse-anim 2s ease-out infinite;
}

.tracking-row:hover {
    background: var(--surface-soft);
}


/* ── Print styles ── */
@media print {
    .sidebar, .topbar, .notification-panel, .profile-panel, .stt-mic, #stt-overlay,
    .dispatch-tabs, .btn, .insight-panel, .share-wrap {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    body {
        background: white !important;
    }
}


/* ── CRM tab styles ── */
.crm-tab--new-pulse {
    animation: crm-new-pulse 1.5s ease-in-out infinite;
    background: var(--primary-soft);
    color: var(--primary);
    font-weight: 700;
}

@keyframes crm-new-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(29, 78, 216, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(29, 78, 216, 0); }
}

.crm-tab--won {
    color: var(--success);
    font-weight: 600;
}

.crm-tab--lost {
    color: var(--danger);
    font-weight: 600;
}

/* Lost tab active state: red bg + white text */
.crm-tab--lost.dispatch-tab--active {
    background: var(--danger);
    color: white;
}
/* Lost tab active state: red bg + white text */
.crm-tab--won.dispatch-tab--active {
    background: var(--success);
    color: white;
}

/* ── Dispatch nav badge ── */
.dispatch-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--danger);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 4px;
}


/* ── Driver preview on dispatch ── */
.driver-preview {
    padding: 8px 12px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    line-height: 1.5;
}

.driver-preview--busy {
    border-left: 3px solid var(--warning);
}

.driver-preview--free {
    border-left: 3px solid var(--success);
}

/* ── ETA edit modal ── */
.eta-modal {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--overlay);
    padding: 16px;
}

.eta-modal__card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 100%;
    max-width: 360px;
}

.eta-modal__card h3 {
    margin-bottom: 16px;
}

/* ── Quick action buttons in my-shipments ── */
.quick-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.quick-actions .btn--sm {
    font-size: 0.75rem;
    padding: 0 8px;
    min-height: 28px;
}


/* ── Report results table: sticky header + dual scroll ── */
.report-table-wrap {
    max-height: 500px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.report-table-wrap .data-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
    box-shadow: 0 1px 0 var(--border);
}

.report-table-wrap .data-table {
    min-width: 800px;
}


/* ── Report type selector buttons ── */
.rpt-type-btn.rpt-selected {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}

.rpt-type-btn:not(.rpt-selected) {
    background: var(--surface);
    color: var(--text-soft);
}

.period-btn.period-selected {
    background: var(--primary);
    color: var(--text-inverse);
    border-color: var(--primary);
}


/* ── Bottom Navigation (mobile only) ── */
.bottom-nav {
    display: none; /* hidden on desktop */
}


/* ── Driver Shipments (card-based) ── */
.ds-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.ds-tabs::-webkit-scrollbar { display: none; }

.ds-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    flex: 1;
    min-width: 70px;
    transition: all 0.15s;
    font-family: inherit;
}
.ds-tab--active {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.ds-tab__icon { font-size: 1.3rem; }
.ds-tab__label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); }
.ds-tab--active .ds-tab__label { color: var(--primary); }
.ds-tab__count {
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.ds-search { margin-bottom: 12px; }
.ds-search input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--surface);
}

.ds-card {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    color: var(--text);
    transition: box-shadow 0.15s;
    cursor: pointer;
}
.ds-card:active { box-shadow: var(--shadow-md); }

.ds-card__body { padding: 16px; }

.ds-card__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}
.ds-card__id {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--primary);
}
.ds-card__badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}
.ds-card__badge--danger { background: var(--danger-soft); color: var(--danger); }
.ds-card__badge--gps { background: rgba(34,197,94,0.1); color: #15803d; }

.ds-card__route {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.ds-card__meta {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.ds-card__actions {
    padding: 0 16px 16px;
}

.ds-action {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}
.ds-action--primary { background: var(--primary); color: #fff; }
.ds-action--primary:active { background: #1e40af; }
.ds-action--gps { background: #15803d; color: #fff; }
.ds-action--gps:active { background: #166534; }
.ds-action--stop { background: var(--surface-muted); color: var(--danger); border: 1px solid var(--danger); }

.ds-empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.ds-empty__icon { font-size: 2.5rem; display: block; margin-bottom: 12px; }
.ds-empty p { font-size: 1rem; }


/* ── Action Banner (dashboard) ── */
.action-banner {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.action-banner__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.04);
    font-size: 0.88rem;
}
.action-banner__items,
.action-banner__more {
    display: grid;
    gap: 0;
}
.action-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
}
.action-row__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.action-row__label { flex: 1; }
.action-row__btn {
    flex-shrink: 0;
    font-size: 0.78rem;
    white-space: nowrap;
}

/* NEW: tax preview should not disturb form-grid alignment */
.tax-preview-row {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: -8px;
    margin-bottom: 4px;
}

.tax-preview-inline {
    display: none;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-soft);
    font-size: 0.78rem;
    color: var(--text-soft);
}

.tax-preview-inline__title,
.tax-preview-inline__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.tax-preview-inline__title {
    margin-bottom: 6px;
    font-weight: 800;
    color: var(--text);
}

.tax-preview-inline__rows {
    display: grid;
    gap: 4px;
}

.tax-preview-inline__row strong {
    color: var(--text);
    white-space: nowrap;
}

.tax-preview-inline__total {
    margin-top: 4px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
    font-weight: 800;
}

.tax-preview-inline__action {
    margin-top: 8px;
}

.tax-preview-inline__action .btn {
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 0.76rem;
}

.tax-preview-inline__hint {
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-faint);
}

@media (max-width: 640px) {
    .tax-preview-inline__title,
    .tax-preview-inline__row {
        align-items: flex-start;
    }
}
.assistant-prefilled {
    border-color: #2563eb !important;
    background: rgba(37, 99, 235, 0.06);
}

.assistant-missing {
    border-color: #f59e0b !important;
    background: rgba(245, 158, 11, 0.08);
    animation: pulseMissing 1.6s infinite;
}

@keyframes pulseMissing {
    0% {
        box-shadow: 0 0 0 0 rgba(245,158,11,.35);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(245,158,11,0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(245,158,11,0);
    }
}
.compliance-ticker {
  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;

  padding: 10px 16px;
  margin: 8px 0;
  border-left: 3px solid var(--primary);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  font-size: 0.85rem;
}

.compliance-ticker__label {
  flex: 0 0 auto;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.compliance-ticker__viewport {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  max-width: 100%;
  height: 1.4em;
  overflow: hidden;
}

.compliance-ticker__track {
  position: absolute;
  left: 0;
  top: 0;

  white-space: nowrap;
  color: var(--text-soft);

  max-width: none;
  width: max-content;

  animation: complianceTickerMove 28s ease-in-out infinite;
  will-change: transform, opacity;
}

@keyframes complianceTickerMove {
  0% {
    transform: translateX(-100%);
    opacity: 0;
  }

  12% {
    transform: translateX(0);
    opacity: 1;
  }

  78% {
    transform: translateX(0);
    opacity: 1;
  }

  100% {
    transform: translateX(100%);
    opacity: 0;
  }
}
[data-sd-panel="timeline"] {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}


