/* Gulf Racing Returns Portal — Blazor Edition */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --blue:        #40B4E5;
    --orange:      #F68B1F;
    --sidebar-bg:  #262B34;
    --sidebar-text: #C8D8E8;
    --sidebar-hover-bg: #1c2029;
    --sidebar-active-bg: #1c2029;
    --sidebar-active-text: #ffffff;
    --sidebar-border: #1c2029;
    --bg:          hsl(200, 30%, 97%);
    --card-bg:     #ffffff;
    --border:      hsl(200, 25%, 88%);
    --text:        hsl(200, 60%, 12%);
    --muted:       hsl(200, 20%, 45%);
    --radius:      6px;
    --shadow:      0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
    width: 256px; flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex; flex-direction: column;
    transition: width .2s;
}
.sidebar.collapsed { width: 64px; }

.sidebar-head {
    height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid var(--sidebar-border);
}
.sidebar.collapsed .sidebar-head { justify-content: center; }

.sidebar-brand {
    display: flex; align-items: center; gap: 8px;
    color: #fff; font-weight: 700; font-size: 18px;
    text-decoration: none; letter-spacing: -0.02em;
    overflow: hidden;
}
.brand-icon { color: var(--orange); flex-shrink: 0; }
.brand-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sidebar-collapse {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.6); padding: 4px; border-radius: 6px;
    display: flex; align-items: center; transition: background .15s, color .15s;
    flex-shrink: 0;
}
.sidebar-collapse:hover { background: var(--sidebar-hover-bg); color: #fff; }

.sidebar-nav { padding: 8px; flex: 1; display: flex; flex-direction: column; gap: 4px; }

.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; border-radius: 6px;
    color: var(--sidebar-text); text-decoration: none;
    font-size: 13.5px; font-weight: 500;
    transition: background .15s, color .15s;
}
.sidebar.collapsed .sidebar-nav a { justify-content: center; gap: 0; }

.sidebar-nav a:hover { background: var(--sidebar-hover-bg); color: #fff; }
.sidebar-nav a.active { background: #fafafa; color: var(--sidebar-bg); }

.sidebar-nav a svg { opacity: .8; flex-shrink: 0; }
.sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
    border-top: 1px solid var(--sidebar-border);
    padding: 16px;
    display: flex; align-items: center;
}
.sidebar.collapsed .sidebar-footer { justify-content: center; padding: 8px; }
.footer-version { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 11.5px; color: rgba(255,255,255,.5); }

.main-col { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
    height: 64px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}
.topbar-search { position: relative; width: 100%; max-width: 384px; }
.topbar-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.topbar-search input { height: 36px; }
.topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--orange); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 500; flex-shrink: 0;
}

.main-content { flex: 1; overflow-y: scroll; background: var(--bg); }

.page-body { padding: 32px; }

/* ── Page Header ── */
.page-header { margin-bottom: 24px; }
.page-title {
    font-size: 28px; font-weight: 700; color: var(--text);
    letter-spacing: -0.02em; line-height: 1.2;
    border: none; outline: none;
}
.page-subtitle { color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* ── Cards ── */
.card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
}

.card-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px; }

/* ── Stat Cards Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 14px;
}
.stats-grid + .stats-grid { margin-bottom: 24px; }

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}

.stat-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.stat-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.stat-label {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-trend {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

/* ── SLA Card ── */
.sla-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
}
.sla-card .sla-title { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 14px; }
.sla-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.sla-row:last-child { margin-bottom: 0; }
.sla-row .lbl { font-size: 11px; color: var(--muted); line-height: 1; }
.sla-row .sub { font-size: 10px; color: hsl(200,20%,62%); margin-top: 3px; }
.sla-row .val { font-size: 16px; font-weight: 700; color: var(--text); white-space: nowrap; }
.sla-row .val.accent { color: var(--blue); }

/* ── Charts Grid ── */
.charts-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.charts-row.wide { grid-template-columns: 2fr 1fr; }
.dash-bottom-row { display: grid; grid-template-columns: 3fr 4fr; gap: 16px; margin-bottom: 16px; }
.chart-card {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px;
    box-shadow: var(--shadow);
    min-height: 280px;
}
.chart-card-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.chart-card-header { margin-bottom: 4px; }
.chart-card-header h3 { font-size: 14px; font-weight: 600; color: var(--text); }
.chart-card-header p { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.chart-hint { font-size: 10.5px; color: var(--muted); margin-bottom: 10px; }
.chart-csv-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; font-weight: 500; color: var(--muted);
    background: transparent; border: 1px solid var(--border);
    border-radius: 6px; padding: 3px 8px; cursor: pointer;
    white-space: nowrap; flex-shrink: 0;
}
.chart-csv-btn:hover { background: var(--bg); color: var(--text); }
.chart-csv-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Tables ── */
.table-wrap {
    background: var(--card-bg); border: 1px solid var(--border);
    border-radius: var(--radius); overflow-x: auto; overflow-y: hidden;
    box-shadow: var(--shadow);
}

table { width: 100%; border-collapse: collapse; }
thead tr { border-bottom: 1px solid var(--border); background: hsl(200,20%,98%); }
th {
    padding: 10px 14px; text-align: left;
    font-size: 11.5px; font-weight: 600; color: var(--muted);
    white-space: nowrap;
}
th.right { text-align: right; }
th.center { text-align: center; }
td {
    padding: 11px 14px; font-size: 13.5px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
td.right { text-align: right; }
td.center { text-align: center; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: hsl(210,25%,98.6%); }
tbody tr:hover { background: hsl(210,40%,96.5%); }
.link { color: var(--orange); text-decoration: none; font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ── Badges ── */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 6px;
    font-size: 11.5px; font-weight: 600; white-space: nowrap;
    text-transform: capitalize;
}
.badge-pending     { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-approved    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.badge-rejected    { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.badge-refunded    { background: #f3e8ff; color: #6b21a8; border: 1px solid #e9d5ff; }
.badge-shipped_back{ background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.badge-delivered   { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.badge-low         { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.badge-medium      { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.badge-high        { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.badge-auto        { background: #e0f2fe; color: #0369a1; border: 1px solid #bae6fd; }
.badge-manual      { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.badge-tiktok      { background: #010101; color: #ffffff; border: 1px solid #333; font-size: 10px; padding: 1px 7px; border-radius: 4px; margin-left: 6px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Inputs ── */
.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon { padding-left: 34px !important; }
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=submit]):not([type=reset]):not([type=button]):not([type=file]):not([type=color]),
select, textarea {
    width: 100%; padding: 7px 10px; border: 1px solid var(--border);
    border-radius: 6px; font-size: 13.5px; color: var(--text);
    font-family: inherit;
    background: #fff; outline: none; transition: border-color .15s;
    box-shadow: 0 1px 2px rgba(0,0,0,.05);
    -webkit-appearance: none; appearance: none;
}
input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=submit]):not([type=reset]):not([type=button]):not([type=file]):not([type=color]):focus,
select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(64,180,229,.12); }
.filter-row { display: flex; gap: 10px; margin-bottom: 16px; align-items: center; flex-wrap: wrap; }
.filter-row input, .filter-row select { max-width: 200px; }
/* Select with custom chevron */
.select-wrap { position: relative; display: inline-flex; align-items: center; width: 100%; }
.select-wrap select { -webkit-appearance: none; appearance: none; width: 100%; }
.select-chevron { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
/* Date range filter button */
.date-filter { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.date-filter-btn { height: 36px; padding: 0 12px; font-size: 13px; white-space: nowrap; min-width: 220px; justify-content: flex-start; gap: 7px; }
.date-popover-backdrop { position: fixed; inset: 0; z-index: 999; }
/* ── Calendar range picker ── */
.cal-popover { position: absolute; top: calc(100% + 4px); left: 0; z-index: 1000; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,.14); padding: 16px 16px 0; }
.cal-months { display: flex; gap: 24px; }
.cal-month { width: 224px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-nav-btn { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 6px; background: transparent; cursor: pointer; font-size: 16px; line-height: 1; color: var(--text); padding: 0; }
.cal-nav-btn:hover { background: var(--bg); }
.cal-nav-spacer { width: 28px; display: inline-block; }
.cal-month-title { font-size: 13px; font-weight: 600; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 32px); gap: 1px; }
.cal-wday { width: 32px; height: 28px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.cal-empty { width: 32px; height: 32px; }
.cal-day { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; font-size: 13px; border: none; background: transparent; cursor: pointer; color: var(--text); border-radius: 50%; position: relative; }
.cal-day:hover:not(.cal-disabled):not(.cal-range-start):not(.cal-range-end):not(.cal-selected) { background: rgba(64,180,229,.12); }
.cal-today { font-weight: 600; }
.cal-today::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; background: var(--blue); }
.cal-disabled { color: var(--border); cursor: default; pointer-events: none; }
.cal-selected { background: var(--blue); color: #fff; border-radius: 50%; }
.cal-range-start { background: var(--blue); color: #fff; border-radius: 50% 0 0 50%; }
.cal-range-end   { background: var(--blue); color: #fff; border-radius: 0 50% 50% 0; }
.cal-in-range { background: rgba(64,180,229,.15); color: var(--text); border-radius: 0; }

.date-label { flex: 1; truncate: hidden; }
.date-clear-x { margin-left: auto; display: flex; align-items: center; opacity: 0.55; cursor: pointer; padding: 2px; border-radius: 3px; }
.date-clear-x:hover { opacity: 1; }

/* ── Buttons ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 6px;
    font-size: 13px; font-weight: 500; font-family: inherit;
    cursor: pointer; border: none;
    transition: background .15s, opacity .15s; text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #32a4d5; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #ccd6dc; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: #ef4444; color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Details Grid ── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.detail-row { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.detail-label { font-size: 11.5px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.detail-value { font-size: 14px; color: var(--text); font-weight: 500; }

/* ── Fraud Risk Signals ── */
.fraud-card {
    border-radius: 8px; border: 1px solid var(--border); padding: 16px;
    margin-bottom: 24px;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.fraud-main { flex: 1; min-width: 0; }
.fraud-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fraud-head .title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.fraud-head .risk-badge { font-size: 11px; font-weight: 500; padding: 1px 8px; border-radius: 9999px; }
.fraud-head .since { font-size: 11.5px; color: var(--muted); margin-left: 2px; }
.fraud-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.fraud-stat { display: flex; align-items: flex-start; gap: 8px; }
.fraud-stat .ico {
    margin-top: 2px; width: 28px; height: 28px; flex-shrink: 0; border-radius: 6px;
    background: rgba(255,255,255,.7); display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.fraud-stat .val { font-size: 18px; font-weight: 700; line-height: 1; color: var(--text); }
.fraud-stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.fraud-stat .sub { font-size: 10px; color: rgba(107,114,128,.75); margin-top: 1px; }
.fraud-spark { flex-shrink: 0; width: 192px; }
.fraud-spark .cap { font-size: 10px; color: var(--muted); margin-bottom: 6px; text-align: right; }

/* ── Bulk selection bar ── */
.bulk-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 16px; border-radius: var(--radius);
    border: 1px solid rgba(246,139,31,.25); background: rgba(246,139,31,.06);
    margin-bottom: 16px;
}
.bulk-bar .count { font-size: 13px; font-weight: 500; color: var(--orange); }
.bulk-bar .spacer { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bulk-bar select { max-width: 170px; }
.tbl-check { width: 15px; height: 15px; accent-color: var(--orange); cursor: pointer; vertical-align: middle; }
.tbl-check:disabled { opacity: .35; cursor: not-allowed; }
.truncate-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap-cell { white-space: nowrap; }

/* ── Detail page ── */
.detail-page { max-width: 1024px; }
.detail-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .detail-cols { grid-template-columns: 1fr; } }
.dl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.dl-item.full { grid-column: 1 / -1; }
.dl-item .dt { font-size: 13px; font-weight: 500; color: var(--muted); }
.dl-item .dd { margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--text); }
.card-icon-head { display: flex; align-items: center; gap: 8px; }
.card-icon-head svg { color: var(--muted); flex-shrink: 0; }
.card-financials { background: rgba(246,139,31,.05); border-color: rgba(246,139,31,.25); }
.product-thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 16px; display: block; }
.btn-icon { padding: 7px; border-radius: 6px; }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.order-address-card { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.order-address-icon { color: var(--blue); flex-shrink: 0; margin-top: 2px; }
.order-address-lines { font-size: 13.5px; line-height: 1.5; color: var(--text); }
.order-address-name { font-weight: 600; }

/* ── Modal ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 10px; padding: 24px; width: min(500px, calc(100vw - 2rem)); max-height: 90svh; overflow-y: auto; box-shadow: 0 20px 40px rgba(0,0,0,.15); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h2 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 20px; line-height: 1; }

.journey-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.journey-card { border: 2px solid var(--border); border-radius: 8px; padding: 14px; cursor: pointer; transition: border-color .15s, background .15s; }
.journey-card:hover { border-color: var(--blue); background: #f0f9ff; }
.journey-card.selected { border-color: var(--blue); background: #f0f9ff; }
.journey-card h4 { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.journey-card p { font-size: 12px; color: var(--muted); }

/* ── Journey pill (countries table) ── */
.j-pill {
    display: flex; align-items: center; gap: 0; border-radius: 8px; padding: 0; width: 100%;
    font-size: 14px; font-weight: 500; cursor: pointer; transition: box-shadow .15s, border-color .15s;
    background: var(--card-bg); border: 1px solid hsl(200, 25%, 93%); color: var(--text);
    overflow: hidden;
}
.j-pill:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); border-color: hsl(200, 25%, 86%); }
.j-pill:active { box-shadow: none; }
.j-pill .nm { font-size: 12px; font-weight: 600; color: var(--text); }
.j-pill-body { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; flex: 1; min-width: 0; }
.j-pill-circle {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 20px; height: 20px; border-radius: 50%;
    font-size: 10px; font-weight: 800; letter-spacing: -.02em; color: #fff; line-height: 1;
}
.j-pill-chevron { display: inline-flex; align-items: center; flex-shrink: 0; margin-right: 10px; opacity: .4; color: var(--muted); }
.j-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Journey picker carousel modal ── */
.j-modal { background: #fff; border-radius: 12px; width: min(520px, calc(100vw - 2rem)); max-height: 90svh; overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,.18); }
.j-head { padding: 20px 20px 12px; }
.j-head h2 { font-size: 16px; font-weight: 600; }
.j-head p { font-size: 14px; color: var(--muted); margin-top: 2px; }
.j-stage { position: relative; padding: 4px 32px; }
.j-card { border: 2px solid; border-radius: 16px; padding: 20px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; box-shadow: 0 4px 6px rgba(0,0,0,.06); }
.j-bubble { height: 56px; width: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.j-badge { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; padding: 4px 12px; border-radius: 9999px; }
.j-name { font-size: 18px; font-weight: 700; line-height: 1.15; }
.j-tag { font-size: 12px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.j-desc { font-size: 12px; color: var(--muted); line-height: 1.6; margin: 0; }
.j-sel { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.j-nav { position: absolute; top: 50%; transform: translateY(-50%); height: 32px; width: 32px; border-radius: 9999px; border: 1px solid var(--border); background: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text); box-shadow: 0 2px 4px rgba(0,0,0,.08); }
.j-nav:hover { background: var(--bg); }
.j-nav:disabled { opacity: .35; cursor: default; }
.j-nav.prev { left: 4px; }
.j-nav.next { right: 4px; }
.j-dots { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 0; }
.j-dot { height: 8px; width: 8px; padding: 0; border-radius: 9999px; border: none; background: rgba(100,116,139,.25); cursor: pointer; transition: all .2s; }
.j-dot:hover { background: rgba(100,116,139,.4); }
.j-dot.active { width: 20px; }
.j-foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border); background: #f8fafc; }
.j-foot .tg { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 12px; }
.j-apply { color: #fff; border: none; min-width: 120px; }
.j-apply:hover { opacity: .9; }
.j-apply:disabled { opacity: .5; cursor: default; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1e293b; color: #fff; border-radius: 8px; padding: 12px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 100; max-width: 90vw; }
.toast .tt { font-size: 13px; font-weight: 600; }
.toast .td { font-size: 12px; opacity: .85; margin-top: 2px; }

/* ── Toggle ── */
.toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle input[type=checkbox] { width: 38px; height: 22px; appearance: none; background: #d1d5db; border-radius: 9999px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle input[type=checkbox]:checked { background: var(--orange); }
.toggle input[type=checkbox]::after { content: ''; position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle input[type=checkbox]:checked::after { left: 19px; }
.toggle-label { font-size: 13.5px; font-weight: 500; }

/* ── Misc ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.risk-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 9999px; padding: 2px 8px; font-size: 12px; line-height: 1.3; white-space: nowrap; }
.icon-row { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.icon-row svg { color: var(--muted); flex-shrink: 0; }
.cust-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; align-items: start; }
@media (max-width: 860px) { .cust-grid { grid-template-columns: 1fr; } }
.empty-state { text-align: center; padding: 48px; color: var(--muted); font-size: 13.5px; }
.mono { font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 12.5px; }
.text-muted { color: var(--muted); }
.font-semibold { font-weight: 600; }

/* ── Loading ── */
.loading-screen {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100vh; gap: 16px;
    background: var(--bg);
}
.loading-logo {
    display: flex; align-items: center; gap: 10px;
    font-size: 18px; font-weight: 700; color: var(--text);
    font-family: 'Inter', sans-serif;
}
.spinner {
    width: 28px; height: 28px;
    border: 2.5px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.page-loading { display: flex; align-items: center; justify-content: center; padding: 60px; }

/* ── Section header ── */
.section-label {
    font-size: 11px; font-weight: 600; color: var(--muted);
    text-transform: uppercase; letter-spacing: .6px;
    margin-bottom: 10px;
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: #fefce8; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,.15);
    display: none; left: 0; padding: .6rem 1.25rem .7rem;
    position: fixed; width: 100%; z-index: 1000;
    font-family: 'Inter', sans-serif; font-size: 13px;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }
.blazor-error-boundary { background: #b32121; padding: 1rem; color: white; }

/* ── Loading progress ── */
.loading-progress { position: relative; display: block; width: 6rem; height: 6rem; margin: 20vh auto 1rem; }
.loading-progress circle { fill: none; stroke: #e0e0e0; stroke-width: 0.6rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--blue); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%; transition: stroke-dasharray .05s ease-in-out; }
.loading-progress-text { position: absolute; text-align: center; font-weight: bold; inset: calc(20vh + 2.5rem) 0 auto .2rem; }
.loading-progress-text:after { content: var(--blazor-load-percentage-text, "Loading"); }

/* ── Config sections ── */
.config-section { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.config-section h3 { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text); }
.config-field { margin-bottom: 14px; }
.config-field label { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.config-field small { font-size: 11.5px; color: var(--muted); margin-top: 4px; display: block; }
.config-field input, .config-field select { max-width: 280px; }

/* ── Return/Customer detail ── */
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; text-decoration: none; margin-bottom: 20px; cursor: pointer; }
.back-link:hover { color: var(--text); }

/* ── RA Config (Returns Authorisation) ── */
.ra-config { max-width: 672px; display: flex; flex-direction: column; gap: 24px; }
.ra-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.ra-title { font-size: 15px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
.ra-title svg { color: var(--orange); flex-shrink: 0; }
.ra-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ra-card-body { padding: 0 20px 20px; }
.ra-section { border-top: 1px solid var(--border); padding-top: 20px; display: flex; flex-direction: column; gap: 24px; }
.ra-setting { display: flex; flex-direction: column; gap: 6px; }
.ra-setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ra-label { font-size: 13px; font-weight: 500; color: var(--text); }
.ra-help { font-size: 12px; color: var(--muted); line-height: 1.45; }
.ra-switch { width: 38px; height: 22px; appearance: none; -webkit-appearance: none; background: #d1d5db; border-radius: 9999px; cursor: pointer; position: relative; transition: background .2s; flex-shrink: 0; padding: 0; border: none; }
.ra-switch:checked { background: var(--orange); }
.ra-switch--excl:checked { background: #e8521a; }
.ra-switch::after { content: ''; position: absolute; width: 16px; height: 16px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.ra-switch:checked::after { left: 19px; }
.ra-threshold-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ra-field { display: flex; flex-direction: column; gap: 5px; }
.ra-field-label { font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.ra-input-row { display: flex; align-items: center; gap: 6px; }
.ra-input-row input { flex: 1; }
.ra-gbp { font-size: 11.5px; font-weight: 600; color: var(--muted); flex-shrink: 0; }
.ra-manage-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ra-manage-btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: #fff; padding: 8px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--text); transition: background .15s; }
.ra-manage-btn:hover { background: var(--bg); }
.ra-manage-btn svg.lead { color: var(--muted); }
.ra-manage-btn svg.chev { color: var(--muted); margin-left: 2px; }
.ra-sla-row { display: flex; align-items: center; gap: 8px; }
.ra-sla-row input { width: 96px; }
.ra-sla-row select { width: 112px; }
.ra-empty { display: flex; align-items: flex-start; gap: 12px; border: 1px dashed var(--border); border-radius: 8px; padding: 16px; font-size: 13px; color: var(--muted); }
.ra-empty svg { flex-shrink: 0; margin-top: 1px; color: var(--muted); }

/* Date range popover footer buttons */
.fp-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
}
.fp-footer-clear {
    padding: 5px 12px;
    font-size: 13px;
    font-family: inherit;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    color: var(--text);
    transition: background .15s;
}
.fp-footer-clear:hover { background: var(--bg); }
.fp-footer-apply {
    padding: 5px 12px;
    font-size: 13px;
    font-family: inherit;
    border: none;
    border-radius: 6px;
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    transition: opacity .15s;
}
.fp-footer-apply:hover { opacity: .88; }
.ra-footer { display: flex; align-items: center; gap: 12px; padding-top: 4px; }
.ra-unsaved { font-size: 12px; color: #d97706; font-weight: 600; }
.ra-toast { position: fixed; bottom: 20px; right: 20px; background: var(--text); color: #fff; padding: 12px 16px; border-radius: 8px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.2); z-index: 100; max-width: 320px; }
.ra-toast strong { display: block; margin-bottom: 2px; font-weight: 600; }
.ra-toast span { color: hsl(200,20%,80%); font-size: 12px; }

/* ── Countries filter bar ── */
.cnt-filter-bar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 16px;
}
.cnt-dropdown-row { display: flex; flex-wrap: nowrap; gap: 10px; align-items: center; flex-shrink: 0; }
.cnt-filters-label { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.cnt-count-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* ── Filter dropdowns (Journey / Service), styled after .ra-manage-btn ── */
.ra-manage-btn-wrap { position: relative; flex-shrink: 0; }
.ra-filter-btn { flex-shrink: 0; }
.ra-filter-btn-label { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ra-filter-btn .chev { transition: transform .15s; flex-shrink: 0; }
.ra-filter-btn .chev--open { transform: rotate(90deg); }
.ra-manage-dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
    min-width: 220px; max-height: 320px; overflow-y: auto;
    background: var(--card-bg); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.08);
    padding: 6px 0;
}
.ra-manage-dropdown-item {
    display: flex; align-items: center; gap: 8px; width: 100%;
    padding: 7px 14px; font-size: 13px; background: none; border: none;
    cursor: pointer; text-align: left; color: var(--text); white-space: nowrap;
    transition: background .1s;
}
.ra-manage-dropdown-item:hover { background: var(--bg); }
.ra-manage-dropdown-item--selected { background: rgba(64,180,229,.08); font-weight: 600; }

/* ── Default Service column ── */
.svc-default-btn {
    display: inline-flex; align-items: center; gap: 7px; width: 100%;
    padding: 5px 10px; border-radius: 7px; font-size: 13px; font-weight: 500;
    border: 1px solid var(--border); background: var(--card-bg); color: var(--text);
    cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.svc-default-btn:hover { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(64,180,229,.12); }
.svc-default-btn--none { color: var(--muted); font-weight: 400; }
.svc-carrier-chip {
    display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 22px; height: 22px; border-radius: 6px;
    font-size: 11px; font-weight: 700; color: #fff; line-height: 1;
}
.svc-carrier-chip--sm { width: 17px; height: 17px; border-radius: 4px; font-size: 10px; }
.svc-carrier-chip--none { background: var(--border) !important; color: var(--muted); }

/* ── Service picker dropdown ── */
.svc-picker {
    z-index: 401;
    min-width: 260px; background: var(--card-bg);
    border: 1px solid var(--border); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.13), 0 2px 8px rgba(0,0,0,.08);
    padding: 6px 0; overflow: hidden;
}
.svc-picker-overlay {
    position: fixed; inset: 0; z-index: 400;
}
.svc-picker-hd {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 14px 6px; font-size: 11px; font-weight: 600;
    color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
}
.svc-picker-country {
    font-size: 11px; font-weight: 500; color: var(--text);
    text-transform: none; letter-spacing: 0;
    background: hsl(220,15%,92%); border-radius: 4px;
    padding: 1px 6px; max-width: 140px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.svc-picker-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 14px; font-size: 13px; background: none; border: none;
    cursor: pointer; text-align: left; color: var(--text);
    transition: background .1s;
}
.svc-picker-item:hover { background: var(--hover-bg, rgba(0,0,0,.04)); }
.svc-picker-item--selected { background: rgba(64,180,229,.06); }
.svc-picker-item--clear { color: var(--muted); font-size: 12.5px; }
.svc-picker-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.svc-picker-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.svc-picker-meta { font-size: 11.5px; color: var(--muted); }
.svc-picker-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Decision History summary strip ── */
.dh-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}
.dh-stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.dh-stat-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.dh-stat-lbl {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

/* ── Wizard step 5 — reason exception picker ── */
.ra-reasons-picker {
    margin-top: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ra-reasons-picker-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0 0 8px 0;
}
.ra-reason-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 6px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
}
.ra-reason-row:hover { background: #fff; }
.ra-reason-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue);
    cursor: pointer;
    flex-shrink: 0;
}

/* ── RaConfig: return reason exceptions modal ── */
.ra-reasons-picker {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px;
    background: var(--bg, #f9fafb);
}
.ra-reason-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text);
    user-select: none;
    transition: background 0.1s;
}
.ra-reason-row:hover { background: rgba(0,0,0,.04); }
.ra-reason-row input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--blue, #2563eb);
    flex-shrink: 0;
    cursor: pointer;
}
.ra-reason-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Journey picker — wide grid modal ── */
.j-modal-wide {
    background: #fff;
    border-radius: 14px;
    width: min(980px, calc(100vw - 2rem));
    max-height: 90svh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,.22);
}
.j-modal-wide-head {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}
.j-grid-scroll {
    overflow: auto;
    padding: 16px 20px;
    flex: 1;
}
.j-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(152px, 1fr));
    gap: 10px;
    min-width: 800px;
}
.j-col {
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 16px 12px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    text-align: center;
    transition: border-color .15s, background .15s, box-shadow .15s, transform .1s;
}
.j-col:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-1px); }
.j-col--active { box-shadow: 0 0 0 1px currentColor; }
.j-circle {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.02em;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,.2);
    margin-bottom: 6px;
}
.j-col-name { font-size: 13px; font-weight: 700; line-height: 1.2; }
.j-col-tag  { font-size: 10.5px; color: var(--muted); line-height: 1.35; }
.j-steps {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    margin-top: 10px;
    position: relative;
    padding-left: 18px;
    gap: 6px;
}
/* The continuous vertical rail */
.j-steps::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border);
    border-radius: 1px;
    transition: background .2s;
}
.j-step-box {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
    display: flex;
    align-items: center;
    gap: 7px;
    text-align: left;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    position: relative;
    min-height: 34px;
}
/* The dot on the rail for each step */
.j-step-box::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    transition: background .2s, border-color .2s;
    z-index: 1;
}
.j-step-icon  { flex-shrink: 0; opacity: .55; display: flex; align-items: center; color: var(--text); transition: color .2s, opacity .2s; }
.j-step-text  { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.j-step-label { font-size: 10.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.j-step-sublabel { font-size: 9.5px; color: var(--muted); line-height: 1.25; }

/* Hover & active: colour the rail, dots, and icons */
.j-col:hover .j-steps::before,
.j-col--active .j-steps::before { background: var(--j-color); }
.j-col:hover .j-step-box::before,
.j-col--active .j-step-box::before { background: var(--j-color); border-color: var(--j-color); }
.j-col:hover .j-step-icon,
.j-col--active .j-step-icon { opacity: 1; color: var(--j-color); }
.j-col-current {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
    border: 1.5px solid;
    margin-top: 10px;
}

/* Return tracking timeline */
.tracking-timeline { display: flex; flex-direction: column; gap: 0; }
.tracking-event { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.tracking-event:last-child { padding-bottom: 0; }
.tracking-event:not(:last-child)::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 12px;
    bottom: -4px;
    width: 2px;
    background: var(--border);
}
.tracking-event-dot {
    flex-shrink: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    margin-top: 4px;
    z-index: 1;
}
.tracking-event-body { display: flex; flex-direction: column; gap: 2px; }
.tracking-event-status { font-size: 13px; font-weight: 600; color: var(--text); }
.tracking-event-desc { font-size: 12.5px; color: var(--muted); }
.tracking-event-date { font-size: 11.5px; color: var(--muted); }
