/* Supplier portal — TND Admin UI visual language */
:root {
    --color-taupe:       #CDC2AF;
    --color-charcoal:    #2c2c2c;
    --color-bg:          #f5f5f5;
    --color-surface:     #ffffff;
    --color-text:        #2c2c2c;
    --color-text-light:  #666666;
    --color-text-secondary: #5a5a5a;
    --color-text-subtle: #999999;
    --color-border:      #f0ece5;
    --color-border-mid:  #d9d3c7;
    --color-success:     #2d9e5f;
    --color-warning:     #e8850a;
    --color-red:         #8B2500;
    --color-green:       #2d9e5f;
    --font-heading: 'Larken', Georgia, 'Times New Roman', serif;
    --font-body:    'Futura PT', Arial, sans-serif;
    --radius-sm: 2px;
    --radius-md: 3px;
    --radius-lg: 4px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 3px 8px rgba(0,0,0,.12);
    --transition: 0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: var(--font-body);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
a { color: var(--color-charcoal); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .7; text-decoration: underline; }

/* ---- Auth / login card ---- */
body.auth-page {
    justify-content: center;
    align-items: center;
    padding: 24px 16px;
}
.auth-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 40px 36px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    border-top: 3px solid var(--color-taupe);
}
.auth-logo { margin-bottom: 24px; }
.auth-logo img { display: block; height: 44px; width: auto; margin: 0 auto; }
.auth-title {
    font-family: var(--font-heading);
    font-size: 1.375rem;
    font-weight: 300;
    color: var(--color-charcoal);
    margin-bottom: 6px;
}
.auth-subtitle { color: var(--color-text-light); margin-bottom: 24px; font-size: 0.8125rem; }
.auth-desc {
    color: var(--color-text-light);
    font-size: 0.875rem;
    margin-bottom: 16px;
    text-align: left;
    line-height: 1.6;
}
.auth-form { text-align: left; }
.auth-footer { margin-top: 24px; color: var(--color-text-subtle); font-size: 0.75rem; text-align: center; }

/* ---- Header (taupe, same as admin) ---- */
.app-header {
    background: var(--color-taupe);
    padding: 0;
    flex-shrink: 0;
    /* Stay pinned to the top of the viewport while the page scrolls (like the
       admin site), so the header — logo, title and Sign out — stays available. */
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner {
    display: flex;
    align-items: center;
    gap: 16px;
    height: 48px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}
.header-logo img { display: block; height: 28px; width: auto; }
/* Clickable logo + title return to the portal home */
.header-logo a, .header-title h1 a { color: inherit; text-decoration: none; display: inline-block; }
.header-logo a:hover, .header-title h1 a:hover { opacity: .7; text-decoration: none; }
.header-title h1 {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(44,44,44,.55);
}
.header-meta { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.supplier-name { font-size: 0.75rem; color: rgba(44,44,44,.65); text-transform: uppercase; letter-spacing: 1px; }
.signout-link { font-size: 0.75rem; color: rgba(44,44,44,.65); text-transform: uppercase; letter-spacing: 1px; text-decoration: none; }
.signout-link:hover { color: var(--color-charcoal, #2c2c2c); text-decoration: underline; }

/* ---- Main layout ---- */
.app-main { flex: 1; padding: 28px 16px; }
.container { max-width: 900px; margin: 0 auto; }
.app-footer {
    border-top: 1px solid var(--color-border);
    padding: 16px 24px;
    background: var(--color-surface);
}
.app-footer p {
    text-align: center;
    color: var(--color-text-subtle);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ---- Panels ---- */
.panel {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--color-border);
    overflow: hidden;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border);
    background: #fdfcfa;
}
.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 300;
    color: var(--color-charcoal);
}
.panel-body { padding: 20px; }
.panel-body-flush { padding: 0; }

/* ---- Alerts ---- */
.alert {
    padding: 11px 16px;
    border-radius: var(--radius-md);
    border-left: 3px solid;
    margin-bottom: 16px;
    font-size: 0.8125rem;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.5;
}
.alert-warning { background: #fff8ef; color: #7a4800; border-color: var(--color-warning); }
.alert-success { background: #f0faf3; color: #1a5c35; border-color: var(--color-success); }
.alert-error   { background: #fff3f0; color: var(--color-red); border-color: var(--color-red); }
.alert-action  { margin-left: auto; font-size: 0.75rem; white-space: nowrap; font-weight: 600; text-decoration: underline; }
.error-list    { margin: 4px 0 0 16px; padding: 0; }
.error-list li { margin-bottom: 4px; }

/* ---- Forms ---- */
.form-group  { margin-bottom: 18px; }
.form-label  {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #5a5a5a;
    margin-bottom: 6px;
}
.help-icon {
    cursor: help;
    color: var(--color-text-subtle);
    display: inline-flex;
    vertical-align: middle;
    margin-left: 4px;
    transition: color var(--transition, 0.15s ease);
}
.help-icon:hover { color: var(--color-text-light); }
.form-input, .form-file {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--color-taupe);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color var(--transition);
}
.form-input:focus { outline: none; border-color: var(--color-charcoal); box-shadow: 0 0 0 3px rgba(205,194,175,.35); }
.form-hint { font-size: 0.75rem; color: var(--color-text-light); margin-top: 5px; line-height: 1.5; }
.form-actions { margin-top: 20px; }
.required { color: var(--color-red); }
.optional  { color: var(--color-text-subtle); font-weight: 400; font-size: .85em; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background var(--transition), opacity var(--transition);
    min-height: 38px;
    white-space: nowrap;
}
.btn:disabled, .btn[disabled] { opacity: .55; cursor: not-allowed; pointer-events: none; }
.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--color-charcoal); color: var(--color-taupe); border-color: var(--color-charcoal); }
.btn-primary:hover { background: #1a1a1a; color: var(--color-taupe); }
.btn-outline  { background: var(--color-surface); color: var(--color-charcoal); border-color: var(--color-border-mid); }
.btn-outline:hover { background: #f5f0e8; color: var(--color-charcoal); }
.btn-secondary{ background: var(--color-surface); color: var(--color-charcoal); border-color: var(--color-taupe); }
.btn-secondary:hover { background: #f5f0e8; color: var(--color-charcoal); }
.btn-full     { width: 100%; }
.btn-sm       { padding: 6px 14px; font-size: 0.6875rem; min-height: 32px; }

/* ---- Table ---- */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.data-table th {
    padding: 8px 12px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #5a5a5a;
    border-bottom: 2px solid var(--color-taupe);
    white-space: nowrap;
    background: transparent;
}
.data-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #faf9f7; }
.nowrap   { white-space: nowrap; }
.filename { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-muted   { color: var(--color-text-light); }
.text-error   { color: var(--color-red); font-weight: 600; }
.text-success { color: var(--color-green); font-weight: 600; }
.text-sm      { font-size: 0.75rem; }

/* ---- Badges ---- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;
}
.badge-submitted  { background: #e0f0fb; color: #0a4a7a; }
.badge-queued     { background: #e8f0fd; color: #1a3a8f; }
.badge-processing { background: #fff8ef; color: #7a4800; }
.badge-completed  { background: #e8f5ee; color: #1a5c35; }
.badge-failed     { background: #fff3f0; color: #8B2500; }
.badge-withdrawn  { background: #ebebeb; color: #666; }

/* ---- How it works panel ---- */
.how-it-works-header { user-select: none; }
.hiw-chevron { font-size: 0.6rem; color: var(--color-text-subtle); }

.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}
.steps li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.step-num {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--color-taupe);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    margin-top: 1px;
}
.step-body {
    flex: 1;
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--color-text-light);
}
.step-body strong {
    display: block;
    color: var(--color-charcoal);
    font-weight: 600;
    margin-bottom: 3px;
}

/* =====================================================================
   Reporting page — ported from the admin Reporting page. Orders and
   Revenue (ex VAT) don't exist on this side, and there's no Vendor
   picker (the supplier's own vendor(s) are resolved server-side), but
   everything else — filtering/sorting, stat cards, Trend chart, Sales by
   Country/Postcode, Product Detail drill-down — matches admin exactly.
   ===================================================================== */

/* Widen just this page for its two-column layout (main table + sidebar);
   every other supplier page keeps the normal 900px container. */
.reporting-page .container { max-width: 1200px; }

/* --- Per-column table filters (table.data-table.filterable) --- */
.data-table thead tr.filter-row th {
    padding: 4px 6px;
    background: #f4f1ec;
    border-top: 1px solid var(--color-border, #e5e0d8);
}
.data-table thead tr.filter-row input.col-filter {
    width: 100%;
    box-sizing: border-box;
    font-size: 0.75rem;
    font-weight: 400;
    padding: 3px 6px;
    border: 1px solid var(--color-border, #ccc);
    border-radius: 3px;
    color: var(--color-charcoal, #222);
}
.data-table tr.tr-filtered-out { display: none !important; }
.data-table tr.filter-norows td {
    text-align: center; color: #888; font-style: italic; padding: 12px;
}

/* Sortable table headers (opt-in via table.data-table.sortable) */
.data-table th.sortable-th { cursor: pointer; user-select: none; -webkit-user-select: none; }
.data-table th.sortable-th:hover { color: var(--color-charcoal); }
.data-table th.sortable-th .sort-ind { margin-left: .35em; font-size: .8em; opacity: .35; }
.data-table th.sortable-th .sort-ind::after { content: '\2195'; }                       /* ↕ idle */
.data-table th.sortable-th[data-sort-dir="asc"]  .sort-ind { opacity: 1; }
.data-table th.sortable-th[data-sort-dir="asc"]  .sort-ind::after { content: '\25B2'; } /* ▲ */
.data-table th.sortable-th[data-sort-dir="desc"] .sort-ind { opacity: 1; }
.data-table th.sortable-th[data-sort-dir="desc"] .sort-ind::after { content: '\25BC'; } /* ▼ */

/* Right-align numeric columns and use lining figures */
.data-table th.num-col, .data-table td.num-col {
    text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.data-table td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; }
.data-table tfoot tr.totals-row td {
    border-top: 2px solid var(--color-border-mid); background: var(--color-bg);
}
.data-table tr.row-not-in-store td { color: var(--color-text-light); }
.tag-muted {
    display: inline-block; font-size: .65rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--color-text-light); border: 1px solid var(--color-border-mid);
    border-radius: 10px; padding: 0 6px; margin-left: 6px; vertical-align: middle;
}

/* Filter bar (Brand picker, Period, Show Discontinued) */
.sales-controls {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end;
    padding-bottom: 1rem; border-bottom: 1px solid var(--color-border);
}
.sales-controls .form-group { margin: 0; }
.sales-controls select.form-input { min-width: 220px; }
.sales-controls #custom-dates { gap: .6rem; align-items: flex-end; }
.sales-controls #custom-dates input.form-input { min-width: 150px; }

/* Brand picker — searchable multi-select with checkboxes (same widget the
   admin Vendor/Brand pickers use; only Brand exists on this page). */
.vendor-picker { position: relative; display: inline-block; min-width: 240px; }
.vendor-picker-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; cursor: pointer; background: var(--color-surface);
}
.vendor-picker-dropdown {
    display: none;
    position: fixed;
    background: var(--color-surface);
    border: 1px solid var(--color-border-mid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    width: 320px;
    z-index: 500;
    padding: 10px;
}
.vendor-picker.is-open .vendor-picker-dropdown { display: block; }
.vendor-picker-search { margin-bottom: 8px; width: 100%; box-sizing: border-box; }
.vendor-picker-list {
    max-height: 260px; overflow-y: auto;
    border: 1px solid var(--color-border); border-radius: var(--radius-md);
    padding: 4px 0;
}
.vendor-picker-option {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px; font-size: 0.8125rem; cursor: pointer; margin: 0;
}
.vendor-picker-option:hover { background: var(--color-bg); }
.vendor-picker-option.is-hidden { display: none; }
.vendor-picker-option input[type="checkbox"] { margin: 0; }
.vendor-picker-empty { padding: 10px; font-size: 0.8125rem; color: var(--color-text-light); }
.vendor-picker-actions { display: flex; justify-content: space-between; margin-top: 8px; }
.vendor-picker-option-all {
    font-weight: 600;
    padding-bottom: 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--color-border);
}

/* "Show Discontinued Products" — compact inline checkbox next to Brand/Period */
.discontinued-filter-option {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.8125rem; cursor: pointer; margin: 0;
}
.discontinued-filter-option input[type="checkbox"] { margin: 0; }
.sales-controls .form-group-centered-toggle {
    align-self: stretch;
    display: flex;
    flex-direction: column;
}
.sales-controls .form-group-centered-toggle .discontinued-filter-option-wrap {
    flex: 1;
    display: flex;
    align-items: center;
}

/* Stat cards */
.stat-cards {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .75rem; margin: 1.25rem 0;
}
.stat-card {
    background: var(--color-surface); border: 1px solid var(--color-border-mid);
    border-radius: var(--radius-lg); padding: .85rem 1rem;
    display: flex; flex-direction: column; gap: .35rem;
}
.stat-card .stat-label {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--color-text-light); font-weight: 600;
}
.stat-card .stat-value {
    font-size: 1.5rem; font-weight: 700; color: var(--color-charcoal);
    font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat-card .stat-value.stat-value-sm { font-size: .95rem; font-weight: 600; }
/* Multiple Vendors/Brands selected: shrink the font and let it wrap across
   lines instead of a single truncated line, so more of the actual list is
   readable without needing to hover — the full list stays in the title
   attribute regardless, as a fallback if it still doesn't all fit. */
.stat-card .stat-value.stat-value-wrap {
    font-size: .72rem; font-weight: 600; white-space: normal;
    word-break: break-word; line-height: 1.35; display: block;
}
.stat-card .stat-sub { font-size: .8rem; font-weight: 400; color: var(--color-text-light); }

/* Trend chart */
.trend-section {
    background: linear-gradient(180deg, #fdfcfa, var(--color-surface));
    border: 1px solid var(--color-border-mid);
    border-radius: var(--radius-lg); padding: 1.1rem 1.2rem 1rem; margin: 0 0 1.25rem;
    box-shadow: var(--shadow-sm);
}
.trend-header { display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; flex-wrap: wrap; }
.trend-header h3 {
    font-family: var(--font-heading); font-size: 1.05rem; font-weight: 300; color: var(--color-charcoal);
}
.trend-header .panel-header-hint { flex: 1; }
.panel-header-hint { font-size: 0.75rem; color: var(--color-text-subtle); white-space: nowrap; }

.geo-filter-input { width: 100%; max-width: 360px; margin-bottom: .75rem; }
.check-col { width: 28px; text-align: center; }
.check-col input[type="checkbox"] { margin: 0; }
.geo-panel-actions { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .5rem; }

.geo-pager { display: flex; align-items: center; gap: .4rem; font-size: .75rem; color: var(--color-text-light); }
.geo-pager-label { white-space: nowrap; }
.geo-pager-btn {
    border: 1px solid var(--color-border-mid); background: var(--color-surface); border-radius: var(--radius-sm);
    width: 22px; height: 22px; line-height: 1; padding: 0; cursor: pointer; font-size: .875rem;
}
.geo-pager-btn:disabled { opacity: .35; cursor: default; }
.geo-pager-btn:not(:disabled):hover { background: var(--color-bg); }

/* Main table (left) + Country/Postcode/Product Detail sidebar (right) */
.brand-sales-columns { display: flex; gap: 1.5rem; align-items: flex-start; }
.brand-sales-main-col { flex: 1 1 auto; min-width: 0; }
.brand-sales-sidebar-col { flex: 0 0 320px; width: 320px; }
.brand-sales-sidebar-col .trend-section { margin-bottom: 1rem; }
.brand-sales-sidebar-col .geo-filter-input { max-width: none; }
.brand-sales-sidebar-col .panel-header-hint {
    white-space: normal;
    display: block;
    margin: -.25rem 0 .5rem;
}
@media (max-width: 900px) {
    .brand-sales-columns { flex-direction: column; }
    .brand-sales-sidebar-col { flex: 1 1 auto; width: 100%; }
}

/* Collapsible Sales by Country / Postcode Region / Product Detail panels */
.geo-panel-toggle {
    display: flex; align-items: center; gap: .5rem; width: 100%;
    background: none; border: none; padding: 0; margin: 0; cursor: pointer; text-align: left;
    font: inherit; color: inherit;
}
.geo-panel-toggle h3 {
    font-family: var(--font-heading); font-size: 1.05rem; font-weight: 300; color: var(--color-charcoal);
}
.geo-panel-arrow {
    display: inline-block; font-size: .7rem; color: var(--color-text-secondary);
    transition: transform var(--transition);
}
.geo-panel-toggle[aria-expanded="true"] .geo-panel-arrow { transform: rotate(90deg); }
.geo-panel-body { margin-top: .85rem; }

.trend-charts { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.trend-chart {
    flex: 1 1 320px; min-width: 280px;
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
    padding: .9rem 1rem 1rem;
}
.trend-chart-title {
    display: flex; align-items: center; gap: 7px;
    font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    color: var(--color-text-secondary); margin-bottom: .8rem;
}
.trend-chart-title::before {
    content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.3);
}
.trend-chart-title-revenue::before { background: linear-gradient(180deg, #55534e, var(--color-charcoal)); }
.trend-chart-title-units::before   { background: linear-gradient(180deg, #cdc2af, #a99a80); }
.trend-bars {
    display: flex; align-items: flex-end; gap: 10px;
    height: 160px; overflow-x: auto; overflow-y: hidden; padding: 0 2px 2px;
    background-image: repeating-linear-gradient(
        to top, var(--color-border) 0, var(--color-border) 1px,
        transparent 1px, transparent 25%
    );
    background-size: 100% 100%;
    border-bottom: 1.5px solid var(--color-border-mid);
}
.trend-bar-col {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    height: 100%; min-width: 34px; flex: 1 0 auto;
    border-radius: var(--radius-sm);
    transition: background .15s ease;
}
.trend-bar-col:hover { background: rgba(0,0,0,.03); }
.trend-bar-value {
    font-size: .75rem; font-weight: 700; color: var(--color-charcoal);
    letter-spacing: -.1px;
    white-space: nowrap; margin-bottom: 4px;
}
.trend-bar-change {
    display: inline-flex; align-items: center; justify-content: center; gap: 2px;
    font-size: .625rem; font-weight: 700; white-space: nowrap; letter-spacing: .1px;
    padding: 1px 6px; border-radius: 999px;
    min-height: .8em; margin-bottom: 6px;
}
.trend-bar-change-up   { color: #1f7a44; background: rgba(45,158,95,.15); }
.trend-bar-change-down { color: #a43226; background: rgba(192,57,43,.13); }
.trend-bar-change-flat { color: var(--color-text-light); background: rgba(0,0,0,.05); }
.trend-bar {
    width: 65%; min-width: 16px;
    background: linear-gradient(180deg, #55534e, var(--color-charcoal));
    border-radius: 6px 6px 2px 2px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 2px rgba(0,0,0,.08);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
    transform-origin: bottom;
    animation: trend-grow .5s cubic-bezier(.22,1,.36,1) backwards;
    cursor: default;
}
@keyframes trend-grow {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}
.trend-bar:hover {
    filter: brightness(1.15);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 2px 6px rgba(0,0,0,.18);
}
.trend-bar-units { background: linear-gradient(180deg, #cdc2af, #a99a80); }
.trend-bar-peak {
    background: linear-gradient(180deg, #3fb377, var(--color-success));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 2px 5px rgba(45,158,95,.35);
}
.trend-bar-units.trend-bar-peak {
    background: linear-gradient(180deg, #e8a94a, var(--color-warning));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 2px 5px rgba(200,140,30,.35);
}
.trend-bar-latest:not(.trend-bar-peak) {
    box-shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 0 0 2px var(--color-border-mid);
}
.trend-bar-label {
    font-size: .625rem; color: var(--color-text-subtle); margin-top: 6px; white-space: nowrap;
}
.trend-bar-skeleton {
    height: 22% !important;
    animation: trend-skeleton-shimmer 1.4s ease-in-out infinite !important;
    background: linear-gradient(90deg, #e2ddd3 25%, #cfc8ba 37%, #e2ddd3 63%);
    background-size: 400% 100%;
}
@keyframes trend-skeleton-shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* Hover/focus popup for a single Trend bar */
.trend-tooltip {
    position: fixed;
    z-index: 900;
    display: none;
    min-width: 184px;
    max-width: 250px;
    background: var(--color-charcoal);
    color: var(--color-taupe);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: .7rem .85rem;
    font-size: .8125rem;
    line-height: 1.55;
    pointer-events: none;
}
.trend-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    width: 0; height: 0;
    margin-left: -6px;
    border: 6px solid transparent;
}
.trend-tooltip-above::after { top: 100%;    border-top-color: var(--color-charcoal); }
.trend-tooltip-below::after { bottom: 100%; border-bottom-color: var(--color-charcoal); }
.trend-tooltip-month {
    font-weight: 700; color: #fff;
    font-size: 1rem;
    margin-bottom: .45rem;
}
.trend-tooltip-value {
    font-weight: 600; color: #fff;
    font-size: 1rem;
}
.trend-tooltip-row {
    display: flex; align-items: baseline; gap: 5px; flex-wrap: wrap;
    margin-top: .45rem;
    padding: .3rem .5rem;
    border-radius: var(--radius-sm);
}
.trend-tooltip-change-up   { color: #9df0c1; font-weight: 700; background: rgba(127,224,172,.16); }
.trend-tooltip-change-down { color: #f5aca6; font-weight: 700; background: rgba(240,147,140,.16); }
.trend-tooltip-change-flat { color: var(--color-taupe); font-weight: 700; background: rgba(255,255,255,.08); }
.trend-tooltip-muted {
    color: #bdb7b0; font-size: .8125rem; margin-top: .5rem;
}
.trend-tooltip-peak {
    display: inline-block; margin-top: .5rem;
    background: rgba(255,255,255,.14); color: #fff;
    font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
    padding: 3px 7px; border-radius: 2px;
}
.loading-banner {
    display: inline-flex; align-items: center; gap: .5rem;
    font-size: .8125rem; font-weight: 600; color: var(--color-text-secondary);
    background: var(--color-bg); border-radius: var(--radius-sm);
    padding: .5rem .75rem; margin-top: .75rem;
}
.spinner {
    display: inline-block; width: 14px; height: 14px; flex: 0 0 auto;
    border: 2px solid var(--color-border-mid); border-top-color: var(--color-charcoal);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* SKU table — clicking a SKU activates/expands the Product Detail panel */
.sku-link {
    background: none; border: none; padding: 0; margin: 0; cursor: pointer;
    font-family: inherit; font-size: inherit; font-weight: 600; white-space: nowrap;
    color: var(--color-charcoal); text-decoration: underline; text-decoration-color: var(--color-border-mid);
}
.sku-link:hover { color: var(--color-success); text-decoration-color: currentColor; }
.col-sku { width: 130px; white-space: normal; }
.sku-th-rrp-value { white-space: normal; line-height: 1.25; }

/* Product Detail sidebar panel */
.sku-detail-panel.is-inactive .geo-panel-toggle h3,
.sku-detail-panel.is-inactive .geo-panel-arrow { color: var(--color-text-subtle); }
.sku-detail-panel .geo-panel-toggle[disabled] { cursor: default; }
.sku-detail-title {
    font-family: var(--font-heading); font-size: .95rem; font-weight: 400; margin: 0 0 .1rem;
    white-space: normal; overflow-wrap: break-word; word-break: break-word;
}
.sku-detail-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: .75rem; margin-bottom: .85rem;
}
.sku-detail-header-text { flex: 1 1 auto; min-width: 0; }
.sku-detail-image {
    flex: 0 0 auto;
    width: 104px; height: 104px; margin: 0;
    display: flex; align-items: center; justify-content: center;
    background: var(--color-bg); border-radius: var(--radius-md); overflow: hidden;
}
.sku-detail-image img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sku-detail-content .data-table { width: 100%; }
.sku-detail-content .data-table th { white-space: normal; line-height: 1.25; }
.sku-detail-content .data-table th,
.sku-detail-content .data-table td { padding-left: 4px; padding-right: 4px; }

/* Visual polish — scoped to body.reporting-page so it can't affect
   .stat-card/.data-table/.panel usage on other supplier pages. */
.reporting-page .panel-header {
    background: linear-gradient(180deg, #fdfcfa, var(--color-surface));
}
.reporting-page .panel-header h2 {
    font-size: 1.15rem;
}
.reporting-page .stat-card {
    position: relative;
    border-top: none;
    padding-top: 1rem;
    transition: box-shadow var(--transition), transform var(--transition);
    overflow: hidden;
}
.reporting-page .stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.reporting-page .stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}
.reporting-page .stat-card-vendor::before   { background: var(--color-taupe); }
.reporting-page .stat-card-brand::before    { background: var(--color-warning); }
.reporting-page .stat-card-revenue::before  { background: linear-gradient(90deg, #55534e, var(--color-charcoal)); }
.reporting-page .stat-card-units::before    { background: linear-gradient(90deg, #cdc2af, #a99a80); }
.reporting-page .stat-card-skus::before     { background: var(--color-success); }
.reporting-page .stat-card-period::before   { background: var(--color-border-mid); }
.reporting-page .stat-card .stat-value {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 1.3rem;
}
.reporting-page .stat-card .stat-value.stat-value-sm { font-family: var(--font-body); font-weight: 600; font-size: .82rem; }
/* Overrides stat-value-sm's own font-size above for the same element (equal
   specificity, later in source order) — needed since .stat-value-wrap alone
   isn't specific enough to win against the .stat-value-sm rule above it. */
.reporting-page .stat-card .stat-value.stat-value-wrap { font-size: .72rem; }
.reporting-page .sales-controls {
    background: #fbfaf8;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem 1.1rem;
    margin-bottom: 1.25rem;
}
.reporting-page .data-table tbody tr:nth-child(even) td { background: #fbfaf8; }
.reporting-page .data-table tbody tr:nth-child(even):hover td { background: #f5f2ec; }
.reporting-page .data-table td { padding-top: 11px; padding-bottom: 11px; }
.reporting-page .geo-panel-toggle:hover h3 { color: var(--color-charcoal); }
.reporting-page .trend-section {
    transition: box-shadow var(--transition);
}
.reporting-page .trend-section:hover {
    box-shadow: var(--shadow-md);
}

/* Sales by Country / Sales by Postcode Region tables sit in the narrow
   sidebar column — let their header text wrap onto a second line so
   columns narrow enough to fit without a horizontal scrollbar. */
#country-table th, #postcode-table th,
#country-table th.num-col, #postcode-table th.num-col {
    white-space: normal;
    line-height: 1.3;
}
