/* Amazon analytics dashboard (tab=dashboard). Every class is ad- prefixed and scoped to #view-amazon-dashboard or its modal. */
.ad-root, .ad-modal {
    --ad-surface: #FFFFFF;
    --ad-ink: #0F172A;
    --ad-ink-2: #334155;
    --ad-muted: #64748B;
    --ad-faint: #94A3B8;
    --ad-line: #E2E8F0;
    --ad-line-soft: #EEF2F6;
    --ad-wash: #F8FAFC;
    --ad-accent: #4F46E5;
    --ad-accent-wash: #EEF2FF;
    --ad-s1: #2a78d6;
    --ad-s2: #eb6834;
    --ad-s3: #1baf7a;
    --ad-good: #0ca30c;
    --ad-good-text: #0F7A0F;
    --ad-critical: #d03b3b;
    --ad-critical-text: #B42318;
    --ad-critical-wash: #FEF3F2;
    --ad-warning-wash: #FFF8EB;
    --ad-radius: 12px;
    --ad-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.03);
    color: var(--ad-ink);
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
}
.ad-root { max-width: 1520px; }

/* ---------- Filter bar ---------- */
.ad-filterbar { background: var(--ad-surface); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); box-shadow: var(--ad-shadow); padding: 14px 18px; margin-bottom: 18px; }
.ad-filterbar-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-search-box-wrap { display: flex; align-items: center; gap: 8px; flex: 1 1 340px; max-width: 580px; }
.ad-search { position: relative; flex: 1; }
.ad-search i.fa-magnifying-glass { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ad-faint); font-size: 13px; }
.ad-search input { width: 100%; height: 38px; padding: 0 34px 0 36px; border: 1px solid var(--ad-line); border-radius: 10px; font-size: 13px; color: var(--ad-ink); outline: none; background: var(--ad-wash); font-family: inherit; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s; }
.ad-search input::placeholder { color: var(--ad-faint); }
.ad-search input:focus { border-color: #A5B4FC; background: var(--ad-surface); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10); }
.ad-search-clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--ad-faint); cursor: pointer; padding: 4px 6px; border-radius: 6px; display: none; }
.ad-search-clear:hover { color: var(--ad-ink); background: var(--ad-line-soft); }
.ad-search.has-value .ad-search-clear { display: block; }
#ad-search-btn { height: 38px; padding: 0 16px; border-radius: 10px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0; }

.ad-scope { display: inline-flex; padding: 3px; background: var(--ad-line-soft); border-radius: 10px; gap: 2px; flex-shrink: 0; }
.ad-scope button { border: 0; background: transparent; height: 32px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--ad-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-family: inherit; }
.ad-scope button:hover { color: var(--ad-ink); }
.ad-scope button.active { background: var(--ad-surface); color: var(--ad-ink); box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12); }
.ad-scope .ad-count { font-size: 11px; font-weight: 700; color: var(--ad-muted); font-variant-numeric: tabular-nums; }
.ad-scope button.active .ad-count { color: var(--ad-accent); }

.ad-toolbar-actions { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.ad-toolbar-actions .btn { height: 34px; padding: 0 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

.ad-meta { margin-left: auto; display: inline-flex; align-items: center; gap: 12px; font-size: 12px; color: var(--ad-muted); white-space: nowrap; flex-shrink: 0; }
.ad-meta .btn { height: 34px; border-radius: 8px; }
.ad-meta i.spinning, .ad-toolbar-actions i.spinning { animation: spin 0.8s linear infinite; }

.ad-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ad-filter-more { display: none; align-items: center; gap: 8px; flex-wrap: wrap; width: 100%; padding-top: 10px; margin-top: 2px; border-top: 1px dashed var(--ad-line); }
.ad-filter-more.open { display: flex; }
.ad-filter-spacer { flex: 1; }

.ad-pill-wrap { position: relative; }
.ad-pill { height: 32px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 1px solid transparent; border-radius: 999px; background: var(--ad-line-soft); font-size: 12.5px; color: var(--ad-ink-2); cursor: pointer; font-family: inherit; max-width: 280px; transition: background 0.15s, border-color 0.15s; }
.ad-pill:hover { background: #E4E9F0; }
.ad-pill .ad-pill-label { font-weight: 600; white-space: nowrap; }
.ad-pill .ad-pill-value { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ad-accent); }
.ad-pill .ad-pill-value:empty { display: none; }
.ad-pill .ad-pill-label:has(+ .ad-pill-value:not(:empty))::after { content: ":"; }
.ad-pill .fa-chevron-down { font-size: 9px; color: var(--ad-faint); }
.ad-pill.is-set { background: var(--ad-accent-wash); border-color: #C7D2FE; }
.ad-pill.is-set .ad-pill-label { color: #4338CA; }
.ad-pill[aria-expanded="true"] { border-color: var(--ad-accent); background: var(--ad-surface); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.10); }
.ad-pill-more { background: transparent; border: 1px dashed #CBD5E1; color: var(--ad-muted); }
.ad-pill-more:hover { background: var(--ad-wash); }
.ad-pill-more .ad-more-count { background: var(--ad-accent); color: #FFFFFF; border-radius: 999px; font-size: 10.5px; padding: 0 6px; line-height: 16px; }
.ad-pill-more .ad-more-count:empty { display: none; }

.ad-select { height: 32px; border: 1px solid var(--ad-line); border-radius: 8px; padding: 0 8px; font-size: 12.5px; color: var(--ad-ink-2); background: var(--ad-surface); font-family: inherit; cursor: pointer; }
.ad-select:focus { outline: none; border-color: var(--ad-accent); }

.ad-target { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border-radius: 999px; background: var(--ad-warning-wash); font-size: 12.5px; font-weight: 600; color: #8A5A12; }
.ad-target input { width: 46px; height: 24px; border: 1px solid #F1D49B; border-radius: 6px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ad-ink); background: #FFFFFF; font-family: inherit; }
.ad-target input:focus { outline: none; border-color: #D97706; }

.ad-clear-all { height: 32px; border: 0; background: transparent; color: #DC2626; border-radius: 8px; font-size: 12.5px; font-weight: 600; padding: 0 10px; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.ad-clear-all:hover { background: #FEF2F2; }
.ad-clear-all:disabled { color: var(--ad-faint); cursor: default; background: transparent; }

/* Popover (multi select, date range) */
.ad-pop { position: absolute; top: calc(100% + 8px); left: 0; z-index: 60; width: 320px; background: var(--ad-surface); border: 1px solid var(--ad-line); border-radius: 12px; box-shadow: 0 20px 40px -16px rgba(15, 23, 42, 0.30); display: none; flex-direction: column; overflow: hidden; }
.ad-pop.open { display: flex; }
.ad-pop.align-right { left: auto; right: 0; }
.ad-pop-search { padding: 10px; border-bottom: 1px solid var(--ad-line-soft); }
.ad-pop-search input { width: 100%; height: 34px; border: 1px solid var(--ad-line); border-radius: 8px; padding: 0 10px; font-size: 12.5px; outline: none; font-family: inherit; }
.ad-pop-search input:focus { border-color: var(--ad-accent); }
.ad-pop-list { max-height: 300px; overflow-y: auto; padding: 6px; }
.ad-pop-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 12.5px; color: var(--ad-ink-2); }
.ad-pop-item:hover { background: var(--ad-wash); }
.ad-pop-item input { accent-color: var(--ad-accent); margin: 0; flex: 0 0 auto; width: 15px; height: 15px; }
.ad-pop-item-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ad-pop-item-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.ad-pop-item-sub { font-size: 11px; color: var(--ad-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-pop-item-count { font-size: 11px; color: var(--ad-muted); font-variant-numeric: tabular-nums; }
.ad-pop-empty { padding: 18px; text-align: center; font-size: 12.5px; color: var(--ad-faint); }
.ad-pop-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px; border-top: 1px solid var(--ad-line-soft); background: var(--ad-wash); }
.ad-presets { padding: 6px; }
.ad-preset { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font-size: 12.5px; color: var(--ad-ink-2); cursor: pointer; font-family: inherit; text-align: left; }
.ad-preset:hover { background: var(--ad-wash); }
.ad-preset.active { font-weight: 700; color: var(--ad-ink); }
.ad-preset .fa-check { font-size: 12px; color: var(--ad-accent); visibility: hidden; }
.ad-preset.active .fa-check { visibility: visible; }
.ad-custom-range { border-top: 1px solid var(--ad-line-soft); padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ad-custom-range label { font-size: 11px; font-weight: 600; color: var(--ad-muted); display: flex; flex-direction: column; gap: 4px; }
.ad-custom-range input { height: 32px; border: 1px solid var(--ad-line); border-radius: 8px; padding: 0 8px; font-size: 12.5px; font-family: inherit; color: var(--ad-ink); }

.ad-link { border: 0; background: transparent; color: var(--ad-accent); font-weight: 600; cursor: pointer; font-size: 12.5px; padding: 0; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; }
.ad-link:hover { text-decoration: underline; }
.ad-btn-mini { height: 30px; padding: 0 14px; border-radius: 8px; border: 0; background: var(--ad-accent); color: #FFFFFF; font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
.ad-btn-mini:hover { background: #4338CA; }

.ad-applied-section { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ad-line-soft); }
.ad-applied-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; color: var(--ad-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.ad-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex: 1; }
.ad-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--ad-surface); border: 1px solid var(--ad-line); font-size: 12px; color: var(--ad-ink-2); max-width: 360px; }
.ad-chip b { font-weight: 600; color: var(--ad-muted); }
.ad-chip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.ad-chip button { border: 0; background: transparent; width: 20px; height: 20px; border-radius: 50%; color: var(--ad-faint); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.ad-chip button:hover { background: var(--ad-line-soft); color: var(--ad-ink); }
.ad-no-filters { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ad-muted); font-weight: 500; font-style: italic; }

.ad-filter-row-apply { height: 32px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; margin-left: 4px; }

.ad-btn-pending {
    background: #EA580C !important;
    border-color: #EA580C !important;
    color: #FFFFFF !important;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.25) !important;
}

/* ---------- Section tabs ---------- */
.ad-tabs { display: inline-flex; align-items: center; gap: 4px; padding: 4px; background: var(--ad-surface); border: 1px solid var(--ad-line); border-radius: 12px; margin-bottom: 18px; box-shadow: var(--ad-shadow); max-width: 100%; overflow-x: auto; }
.ad-tab { border: 0; background: transparent; height: 36px; padding: 0 16px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--ad-muted); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-family: inherit; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.ad-tab:hover { color: var(--ad-ink); background: var(--ad-wash); }
.ad-tab.active { color: #FFFFFF; background: var(--ad-ink); }
.ad-tab i { font-size: 12px; }
.ad-tab-count { font-size: 11px; font-weight: 700; padding: 0 7px; line-height: 18px; border-radius: 999px; background: var(--ad-line-soft); color: var(--ad-muted); font-variant-numeric: tabular-nums; }
.ad-tab-count:empty { display: none; }
.ad-tab.active .ad-tab-count { background: rgba(255, 255, 255, 0.18); color: #FFFFFF; }

.ad-section { display: none; }
.ad-section.active { display: block; animation: fadeIn 0.18s ease; }

/* ---------- KPI strips ---------- */
.ad-kpis { display: flex; flex-direction: column; gap: 14px; margin-bottom: 18px; }
.ad-strip { background: var(--ad-surface); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); box-shadow: var(--ad-shadow); overflow: hidden; }
.ad-strip-title { padding: 12px 20px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ad-faint); }
.ad-strip-cells { display: grid; grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr)); }
@media (max-width: 1240px) { .ad-strip-cells { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ad-kpi { position: relative; border: 0; background: transparent; padding: 16px 20px 18px; display: flex; flex-direction: column; gap: 6px; text-align: left; font-family: inherit; color: var(--ad-ink); min-width: 0; transition: background 0.15s; }
.ad-kpi + .ad-kpi { box-shadow: inset 1px 0 0 var(--ad-line-soft); }
button.ad-kpi { cursor: pointer; }
button.ad-kpi:hover { background: #F7F8FF; }
button.ad-kpi:focus-visible { outline: 2px solid var(--ad-accent); outline-offset: -2px; }
.ad-kpi-label { font-size: 12.5px; font-weight: 600; color: var(--ad-muted); display: flex; align-items: center; gap: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-kpi-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; white-space: nowrap; }
.ad-kpi-value small { font-size: 13px; font-weight: 600; color: var(--ad-muted); margin-left: 4px; letter-spacing: 0; }
.ad-kpi-sub { font-size: 12px; color: var(--ad-muted); line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-kpi-go { position: absolute; right: 16px; top: 18px; font-size: 11px; color: var(--ad-accent); opacity: 0; transition: opacity 0.15s, transform 0.15s; }
button.ad-kpi:hover .ad-kpi-go { opacity: 1; transform: translateX(2px); }
.ad-kpi.tone-critical .ad-kpi-value { color: var(--ad-critical-text); }
.ad-kpi.tone-good .ad-kpi-value { color: var(--ad-good-text); }
.ad-kpi.is-loading .ad-kpi-value, .ad-kpi.is-loading .ad-kpi-sub { opacity: 0.4; }
.ad-tag { display: inline-flex; align-items: center; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px; background: var(--ad-warning-wash); color: #8A5A12; white-space: nowrap; }
.ad-skeleton { display: inline-block; width: 72px; height: 26px; border-radius: 6px; background: linear-gradient(90deg, #EEF2F6 0%, #F8FAFC 50%, #EEF2F6 100%); background-size: 200% 100%; animation: ad-shimmer 1.2s ease-in-out infinite; }
@keyframes ad-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Cards and grids ---------- */
.ad-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.ad-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ad-span-2 { grid-column: 1 / -1; }
@media (max-width: 1180px) {
    .ad-grid, .ad-grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.ad-card { background: var(--ad-surface); border: 1px solid var(--ad-line); border-radius: var(--ad-radius); box-shadow: var(--ad-shadow); display: flex; flex-direction: column; min-width: 0; }
.ad-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.ad-card-title { font-size: 15px; font-weight: 700; color: var(--ad-ink); display: flex; align-items: center; gap: 10px; letter-spacing: -0.01em; }
.ad-card-sub { font-size: 12.5px; color: var(--ad-muted); margin-top: 4px; }
.ad-card-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ad-icon-btn { width: 32px; height: 32px; border: 1px solid var(--ad-line); border-radius: 8px; background: var(--ad-surface); color: var(--ad-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }
.ad-icon-btn:hover { color: var(--ad-ink); background: var(--ad-wash); }
.ad-icon-btn.active { color: var(--ad-accent); border-color: #C7D2FE; background: var(--ad-accent-wash); }
.ad-seg { display: inline-flex; padding: 3px; border-radius: 8px; background: var(--ad-line-soft); gap: 2px; }
.ad-seg button { border: 0; background: transparent; height: 26px; padding: 0 10px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--ad-muted); cursor: pointer; font-family: inherit; white-space: nowrap; }
.ad-seg button.active { background: var(--ad-surface); color: var(--ad-ink); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12); }
.ad-card-body { position: relative; padding: 10px 20px 20px; flex: 1; min-height: 0; transition: opacity 0.15s; }
.ad-chart { position: relative; height: 320px; }
.ad-chart.h-sm { height: 260px; }
.ad-chart.h-lg { height: 440px; }
.ad-card.is-loading .ad-card-body { opacity: 0.45; pointer-events: none; }
.ad-card.is-loading .ad-card-head .ad-card-title::after { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ad-line); border-top-color: var(--ad-accent); animation: spin 0.8s linear infinite; }
.ad-card-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ad-line-soft); font-size: 12px; color: var(--ad-muted); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.ad-card-foot { padding: 12px 20px 14px; border-top: 1px solid var(--ad-line-soft); font-size: 12px; color: var(--ad-muted); display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

.ad-state { height: 100%; min-height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; color: var(--ad-muted); font-size: 12.5px; padding: 20px; }
.ad-state i { font-size: 24px; color: var(--ad-faint); }
.ad-state.is-error i { color: var(--ad-critical); }
.ad-state .spinner { margin: 0; width: 28px; height: 28px; }
.ad-state-title { font-weight: 600; color: var(--ad-ink-2); font-size: 13px; }

.ad-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; color: var(--ad-ink-2); margin: 4px 0 12px; }
.ad-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ad-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ad-legend i.line { height: 2px; width: 16px; border-radius: 1px; }

.ad-single { min-height: 150px; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 8px 4px; }
.ad-single-value { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }
.ad-single-label { font-size: 15px; font-weight: 600; color: var(--ad-ink-2); }
.ad-single-sub { font-size: 12.5px; color: var(--ad-muted); }
.ad-single .ad-link { align-self: flex-start; margin-top: 8px; }

.ad-change-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.ad-change { font-size: 12px; padding: 5px 10px; border-radius: 8px; background: var(--ad-wash); border: 1px solid var(--ad-line-soft); color: var(--ad-ink-2); font-variant-numeric: tabular-nums; }
.ad-change b { font-weight: 700; }
.ad-change .up { color: var(--ad-critical-text); }
.ad-change .down { color: var(--ad-good-text); }

.ad-edges { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ad-muted); }
.ad-edges input { width: 100px; height: 30px; border: 1px solid var(--ad-line); border-radius: 8px; padding: 0 10px; font-size: 12.5px; font-family: inherit; color: var(--ad-ink); }

/* ---------- Tables (card table views, lane table, shipments) ---------- */
.ad-table-wrap { overflow: auto; max-height: 380px; border: 1px solid var(--ad-line-soft); border-radius: 10px; }
.ad-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.ad-table th { position: sticky; top: 0; z-index: 1; background: var(--ad-wash); color: var(--ad-muted); font-size: 11.5px; font-weight: 600; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--ad-line); white-space: nowrap; }
.ad-table td { padding: 10px 12px; border-bottom: 1px solid var(--ad-line-soft); color: var(--ad-ink-2); vertical-align: middle; }
.ad-table tr:last-child td { border-bottom: 0; }
.ad-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ad-table tbody tr.is-link { cursor: pointer; }
.ad-table tbody tr.is-link:hover td { background: #F7F8FF; }
.ad-table th.sortable { cursor: pointer; user-select: none; }
.ad-table th.sortable:hover { color: var(--ad-ink); }
.ad-table th.sortable i { margin-left: 5px; font-size: 9px; opacity: 0.4; }
.ad-table th.sorted { color: var(--ad-accent); }
.ad-table th.sorted i { opacity: 1; }
.ad-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.ad-strong { font-weight: 600; color: var(--ad-ink); }
.ad-muted { color: var(--ad-muted); }
.ad-faint { color: var(--ad-faint); }
.ad-bar-cell { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.ad-bar-cell .track { flex: 1; height: 6px; border-radius: 3px; background: var(--ad-line-soft); overflow: hidden; }
.ad-bar-cell .fill { height: 100%; border-radius: 3px; background: var(--ad-s1); }
.ad-bar-cell span { min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.ad-status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ad-status.s-delivered { background: #ECF8EC; color: var(--ad-good-text); }
.ad-status.s-in_transit { background: #EAF2FC; color: #1C5CAB; }
.ad-status.s-not_departed { background: var(--ad-line-soft); color: var(--ad-muted); }
.ad-status.s-overdue, .ad-status.s-late { background: var(--ad-critical-wash); color: var(--ad-critical-text); }
.ad-fc { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: #FFF4E5; color: #9A5B00; font-family: 'JetBrains Mono', monospace; }
.ad-days { font-variant-numeric: tabular-nums; font-weight: 600; }
.ad-days.over { color: var(--ad-critical-text); }
.ad-days.within { color: var(--ad-good-text); }

/* Shipments section */
#ad-ship-back[hidden], .ad-pill-wrap[hidden] { display: none; }
.ad-ship-summary { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 12.5px; color: var(--ad-muted); margin-top: 4px; }
.ad-ship-summary b { color: var(--ad-ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.ad-ship-table-wrap { max-height: calc(100vh - 300px); min-height: 280px; border: 0; border-top: 1px solid var(--ad-line-soft); border-radius: 0; margin: 0 -20px -20px; }
.ad-ship-table td { white-space: nowrap; padding: 11px 9px; }
.ad-ship-table th { padding: 10px 9px; }
.ad-ship-table th:first-child, .ad-ship-table td:first-child { padding-left: 16px; }
.ad-ship-table th:last-child, .ad-ship-table td:last-child { padding-right: 12px; }
.ad-ship-id { display: flex; flex-direction: column; gap: 3px; }
.ad-ship-id small { font-size: 11px; color: var(--ad-faint); }
.ad-route { display: inline-flex; align-items: center; gap: 6px; }
.ad-route i { font-size: 9px; color: var(--ad-faint); }
.ad-pager { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.ad-pager label { display: inline-flex; align-items: center; gap: 8px; }
.ad-pager .btn-page-nav { height: 30px; border-radius: 8px; }

/* ---------- India map ---------- */
.ad-map-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 16px; align-items: start; }
@media (max-width: 1400px) { .ad-map-wrap { grid-template-columns: minmax(0, 1fr); } }
.ad-map { position: relative; height: 380px; display: flex; align-items: center; justify-content: center; }
.ad-map svg { height: 100%; width: auto; max-width: 100%; overflow: visible; }
.ad-map path { stroke: #FFFFFF; stroke-width: 0.8; cursor: pointer; transition: opacity 0.12s; outline: none; }
.ad-map path.is-empty { cursor: default; }
.ad-map path:hover, .ad-map path:focus-visible, .ad-map path.is-active { stroke: var(--ad-ink); stroke-width: 1.4; }
.ad-map-side { display: flex; flex-direction: column; gap: 14px; }
.ad-map-detail { border: 1px solid var(--ad-line-soft); border-radius: 10px; padding: 12px 14px; background: var(--ad-wash); min-height: 160px; }
.ad-map-detail h4 { font-size: 13.5px; font-weight: 700; margin: 0 0 8px; }
.ad-map-detail .ad-map-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.ad-map-stats div { display: flex; flex-direction: column; }
.ad-map-stats b { font-size: 15px; font-weight: 700; }
.ad-map-stats span { font-size: 11px; color: var(--ad-muted); }
.ad-map-cities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.ad-map-cities li { display: flex; justify-content: space-between; gap: 10px; color: var(--ad-ink-2); }
.ad-map-cities li span:last-child { font-variant-numeric: tabular-nums; color: var(--ad-muted); white-space: nowrap; }
.ad-scale { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--ad-muted); }
.ad-scale-bar { display: flex; gap: 2px; }
.ad-scale-bar i { flex: 1; height: 8px; border-radius: 2px; }
.ad-scale-ticks { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.ad-tooltip { position: fixed; z-index: 10050; pointer-events: none; background: #FFFFFF; border: 1px solid var(--ad-line); border-radius: 10px; box-shadow: 0 14px 30px -12px rgba(15, 23, 42, 0.35); padding: 10px 12px; font-size: 12px; color: var(--ad-ink-2); max-width: 260px; display: none; }
.ad-tooltip b { display: block; font-size: 15px; color: var(--ad-ink); }
.ad-tooltip .ad-tooltip-title { font-weight: 600; color: var(--ad-muted); margin-top: 2px; }
.ad-tooltip ul { list-style: none; padding: 0; margin: 8px 0 0; border-top: 1px solid var(--ad-line-soft); padding-top: 8px; }
.ad-tooltip li { display: flex; justify-content: space-between; gap: 14px; }

/* ---------- Modal ---------- */
.ad-modal .detail-modal { max-width: 1000px; border-radius: 16px; }
.ad-modal .modal-header { padding: 18px 24px; }
.ad-modal .modal-header h3 { font-size: 16px; font-weight: 700; }
.ad-modal .modal-body { padding: 18px 24px 24px; gap: 14px; }
.ad-modal-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-modal-tools .ad-search { max-width: 340px; }
.ad-modal-tools .ad-ship-summary { margin-left: auto; margin-top: 0; }
.ad-modal .ad-table-wrap { max-height: 56vh; }

.ad-timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 10px; }
.ad-timeline li { border: 1px solid var(--ad-line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; background: #FFFFFF; }
.ad-timeline li.done { border-color: #CDEBCD; background: #F6FCF6; }
.ad-timeline .code { font-size: 11px; font-weight: 700; color: var(--ad-muted); display: flex; align-items: center; gap: 6px; }
.ad-timeline li.done .code { color: var(--ad-good-text); }
.ad-timeline .name { font-size: 12.5px; font-weight: 600; color: var(--ad-ink); }
.ad-timeline .when { font-size: 12px; color: var(--ad-muted); font-variant-numeric: tabular-nums; }
.ad-legs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .ad-legs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ad-leg { border: 1px solid var(--ad-line); border-radius: 10px; padding: 10px 12px; background: #FFFFFF; }
.ad-leg span { font-size: 11px; color: var(--ad-muted); font-weight: 600; display: block; }
.ad-leg b { font-size: 18px; font-weight: 700; }
