/* Shared brand, typography and surfaces. Matrix editors and semantic status colours remain component-owned. */
:root {
    --brand-green: #5caf27;
    --brand-purple: #67258b;
    --brand-magenta: #c31262;
    --brand-forest: #173a2a;
    --theme-primary: #397a24;
    --theme-primary-hover: #2c601c;
    --theme-ink: #182e25;
    --theme-muted: #7b8b82;
    --theme-border: #dfe7e2;
    --theme-canvas: #f5f8f7;
    --theme-shadow: 0 5px 20px rgba(24, 56, 37, .045);
    --app-accent: var(--theme-primary);
    --app-accent-soft: #edf6e7;
    --app-ink: var(--theme-ink);
    --app-muted: var(--theme-muted);
    --app-mint: var(--brand-green);
    --mv-ink: var(--theme-ink);
    --mv-muted: var(--theme-muted);
    --mv-border: var(--theme-border);
}
body.app-body { background: var(--theme-canvas); color: var(--theme-ink); }
.app-body>.app-bg-orb,.app-body>.app-grid { display: none !important; }
.app-body .app-main-shell { background: linear-gradient(130deg,#f9fbfa,var(--theme-canvas)); }
.app-body #app { background: url('/assets/images/operations-waves.svg?v=2') right top / min(100%,1100px) 180px no-repeat; }
.app-body #app:has(#operations-map-page) { background-image: none; }
.app-body .app-topbar { height: 64px; min-height: 64px; padding: 0 26px; gap: 18px; background: #ffffffbd; border-bottom: 1px solid #e3ebe5; box-shadow: none; }
.app-topbar .topbar-brand { padding: 4px 11px 4px 7px; gap: 9px; border: 1px solid #dfe7e2; border-radius: 14px; background: #fff; color: #24372c; font-size: 11px; font-weight: 600; box-shadow: 0 3px 10px #233c2804; }
.app-topbar .topbar-brand img { width: 27px; height: 27px; }
.app-topbar .account-menu-trigger { padding: 4px; gap: 9px; border: 0; border-radius: 12px; background: transparent; box-shadow: none; }
.app-topbar .account-menu-trigger>div:first-child { width: 33px; height: 33px; background: #e4f2db; color: #335e22; font-size: 12px; }
.app-topbar .account-menu-trigger .text-sm { font-size: 11px; font-weight: 600; }
.app-topbar .account-menu-trigger .text-xs { display: none; }
.app-topbar .topbar-upload { padding: 10px 15px; border-radius: 10px; color: #fff; background: var(--theme-primary); font-size: 11px; font-weight: 600; box-shadow: none; }
.app-topbar .topbar-upload:hover { background: var(--theme-primary-hover); transform: none; }
#app :is(.rounded-3xl.bg-white,.bg-white.shadow-soft,.bg-white.shadow-floaty,.orders-table-card,.dashboard-stat-card,.returns-kpi-card) {
    border: 1px solid var(--theme-border);
    border-radius: 18px;
    box-shadow: var(--theme-shadow);
}
.app-body :is(button,a,input[type=submit]):is(.bg-zinc-950,.bg-zinc-900,.bg-black):not(:disabled) {
    background: var(--theme-primary);
    color: #fff;
    border-color: var(--theme-primary);
}
.app-body :is(button,a):is(.bg-zinc-950,.bg-zinc-900,.bg-black):not(:disabled):hover { background: var(--theme-primary-hover); }
.app-body :is(button,a):is(.bg-zinc-950,.bg-zinc-900):disabled { background: #b2c0b3; color: #fff; box-shadow: none; }
#app :is(input,select,textarea):focus-visible { outline: 2px solid #72aa50; outline-offset: 2px; }
.app-body :is(input[type=checkbox],input[type=radio]) { accent-color: var(--theme-primary); }
.app-body button:focus-visible,.app-body a:focus-visible { outline: 2px solid #72aa50; outline-offset: 3px; }
#app :is(.dashboard-hero,.returns-hero,.access-hero) {
    background: linear-gradient(120deg,#fff,#f7faf6) !important;
    border: 1px solid var(--theme-border) !important;
    border-radius: 18px;
    box-shadow: var(--theme-shadow) !important;
    color: var(--theme-ink);
}
#app :is(.dashboard-hero,.returns-hero,.access-hero) :is(.text-white,.text-white\/90) { color: var(--theme-ink) !important; }
#app :is(.dashboard-hero,.returns-hero,.access-hero) :is(p,.text-white\/75,.text-white\/70,.text-white\/60) { color: #7d8c81 !important; }
#app .dashboard-hero-orb { display: none; }
#app .dashboard-hero .inline-flex { color: #4d7935; background: #edf5e7; border-color: #dcebd3; font-size: 11px; }
#app .dashboard-filter-panel { border: 1px solid var(--theme-border); border-radius: 16px; background: #fff; box-shadow: var(--theme-shadow); }
#app .dashboard-filter-panel .text-white { color: var(--theme-ink); }
#app .dashboard-filter-panel :is(.text-white\/90,.text-white\/70,.text-white\/60) { color: #7d8c81; }
#app .dashboard-filter-panel :is(.bg-white\/10,.bg-white\/8,.bg-white\/6) { background: #f7faf5; border-color: #e0e9db; }
#app .dashboard-filter-grid>button.bg-white { background: var(--theme-primary); color: #fff; border-radius: 10px; }
#app .dashboard-stat-card::after { display: none; }
#app .dashboard-stat-card:nth-child(3n+1)::before { background: var(--brand-green); }
#app .dashboard-stat-card:nth-child(3n+2)::before { background: var(--brand-purple); }
#app .dashboard-stat-card:nth-child(3n)::before { background: var(--brand-magenta); }
#app .access-tab-btn[data-active="1"] { background: var(--theme-primary); color: #fff; box-shadow: 0 2px 5px #2c602015; }
.app-body [id^=app-modal-]>div.relative,.app-body [id^=app-form-modal-]>div.relative { border: 1px solid var(--theme-border); border-radius: 18px; box-shadow: 0 20px 65px #19372830; }
.app-body :is([id^=app-modal-],[id^=app-form-modal-]) h3 { color: var(--theme-ink); font-size: 19px; font-weight: 650; }
.app-body .order-action-menu,.app-body .account-menu-panel { border-color: var(--theme-border); border-radius: 12px; box-shadow: 0 9px 28px #19372818; }
.app-body .mobile-bottom-nav { border-color: #e0e9df; background: #ffffffed; box-shadow: 0 -5px 25px #183b2410; }
.app-body .mobile-nav-link.active,.app-body .mobile-sheet-link-accent { color: var(--theme-primary); background: #edf6e7; }
.app-body .mobile-nav-link-primary { background: var(--theme-primary); color: #fff; box-shadow: none; }
.app-sidebar .desktop-sidebar { background: linear-gradient(155deg,var(--brand-forest),#102d25 65%,#244b31); }
.login-page { background: #f6f9f5 url('/assets/images/operations-waves.svg?v=2') right top / 100% 250px no-repeat !important; }
.login-page .login-brand-panel { background: linear-gradient(150deg,#462166,var(--brand-purple) 55%,var(--brand-magenta)); }
.login-page .login-submit { background: var(--theme-primary); border-radius: 12px; box-shadow: 0 5px 15px #397a2425; }
.login-page .login-submit:hover { background: var(--theme-primary-hover); }
@media(max-width:1100px) {
    .app-topbar .topbar-brand { max-width: 370px; }
    .app-topbar .topbar-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media(max-width:767px) {
    .app-body .app-topbar { height: 62px; min-height: 62px; padding: 0 15px; gap: 10px; }
}
@media(prefers-reduced-motion:reduce) { .app-body * { scroll-behavior: auto; } }

.app-body #progressbar { background: var(--theme-primary); }
#app .upload-guidance { background: linear-gradient(145deg,var(--brand-forest),#244b31); border: 1px solid #3a6044; border-radius: 18px; box-shadow: var(--theme-shadow); }
#app #upload-status { background: linear-gradient(135deg,#15382b,#213b32); border-color: #486647; }
/* Legacy dashboard markup used white labels on dark filter surfaces. */
#app .dashboard-filter-panel,
#app .dashboard-filter-panel .dashboard-customer-picker,
#app .dashboard-filter-panel :is(summary,label,.text-white:not(button):not(a)) { color: var(--theme-ink) !important; }
#app .dashboard-filter-panel [class*="text-white/"] { color: #748477 !important; }
#app .dashboard-filter-panel .dashboard-customer-picker { background: #f7faf4 !important; border-color: #dce7d6 !important; border-radius: 12px; }
#app .dashboard-filter-panel label { color: #748477; }
#app :is(.dashboard-hero,.returns-hero,.access-hero) [class*="text-white/"] { color: #7b8980 !important; }
#app :is(.dashboard-stat-card,.returns-kpi-card) { background: #fff; }

/* Only light dashboard/returns heroes need a dark heading; dark page headers retain their own text colour. */
#app :is(.dashboard-hero,.returns-hero,.access-hero) h1 { color: var(--theme-ink); }
#app .dashboard-stat-value { color: var(--theme-ink); }
#app .returns-hero svg [stroke="white"] { stroke: var(--theme-primary); }

/* Calm workspace hierarchy: canvas -> white surface -> softly tinted table header. */
:root {
    --theme-canvas: #f1f5f3;
    --theme-ink: #20352d;
    --theme-muted: #687970;
    --theme-border: #dee6e1;
    --theme-shadow: 0 2px 8px rgba(28, 51, 38, .025);
    --theme-table-header: #f6f8f7;
    /* Product type scale: rem values respect browser text preferences. */
    --type-caption: .75rem;
    --type-compact: .8125rem;
    --type-body: .875rem;
    --type-subheading: 1rem;
    --type-section: 1.25rem;
    --type-title: clamp(1.5rem, 2vw, 1.875rem);
    --type-metric: 1.75rem;
}
body.app-body { font-family: var(--app-font); font-size: var(--type-body); line-height: 1.5; }
.app-body .app-shell { gap: 0; }
.app-body .app-main-shell { background: var(--theme-canvas); }
.app-body #app { background-image: none; }
#app>section:not(.om-page) { padding: 28px; }
#app h1 { font-size: var(--type-title); font-weight: 700; line-height: 1.22; letter-spacing: -.025em; }
#app :is(h2,h3) { letter-spacing: -.02em; line-height: 1.35; }
#app h2 { font-size: var(--type-section); font-weight: 600; }
#app h3 { font-size: var(--type-subheading); font-weight: 600; }
#app :is(.font-black,.font-extrabold) { font-weight: 700; }
#app :is(.dashboard-hero,.workspace-hero) { padding: 24px 26px; }
#app :is(.dashboard-hero,.workspace-hero) h1 { max-width: 900px; font-size: var(--type-title); line-height: 1.24; }
#app .dashboard-hero h1 { margin-top: 16px; }
#app :is(.dashboard-hero,.workspace-hero) p { max-width: 850px; font-size: var(--type-body); line-height: 1.6; }
#app :is(.dashboard-hero,.returns-hero,.access-hero) p { color: #687970 !important; }
#app .workspace-hero { color: var(--theme-ink); background: #fff !important; border: 1px solid var(--theme-border); border-radius: 16px; box-shadow: var(--theme-shadow); }
#app .workspace-hero p { color: var(--theme-muted); }
#app .workspace-hero svg [stroke="white"] { stroke: #609549; }
#app .workspace-hero svg [fill="white"] { fill: #609549; }
#app :is(.rounded-3xl.bg-white,.bg-white.shadow-soft,.bg-white.shadow-floaty,.orders-table-card,.dashboard-stat-card,.returns-kpi-card,.customer-analytics-surface) { background: #fff; border-color: var(--theme-border); border-radius: 16px; box-shadow: var(--theme-shadow); }
#app :is(.bg-white\/88,.bg-white\/92,.bg-white\/90) { background-color: #fff; border: 1px solid var(--theme-border); box-shadow: var(--theme-shadow); }
#app .dashboard-stat-card { padding: 20px; }
#app .dashboard-stat-card::before { height: 2px; opacity: .6; }
#app .dashboard-stat-label { font-size: var(--type-caption); font-weight: 600; letter-spacing: .045em; color: #687970; }
#app .dashboard-stat-value { margin-top: 10px; font-size: var(--type-metric); line-height: 1.2; font-weight: 700; letter-spacing: -.04em; text-shadow: none; }
#app .dashboard-stat-foot { font-size: 12px; line-height: 1.5; color: var(--theme-muted); }
#app .dashboard-filter-panel { background: #fff; border-radius: 14px; backdrop-filter: none; }
#app .dashboard-filter-grid .dashboard-customer-picker { min-height: 74px; padding: 12px 14px; }
#app .dashboard-filter-grid [class*="tracking-"] { font-size: var(--type-caption); letter-spacing: .05em; font-weight: 600; }
#app .dashboard-filter-grid :is(input,select) { font-size: var(--type-body); }
#app .dashboard-filter-grid> :is(button,a) { min-height: 40px; padding: 10px 16px; font-size: var(--type-compact); font-weight: 600; border-radius: 9px; }
/* Data typography changes without resizing matrix editors or changing status colours. */
#app table { background: #fff; font-variant-numeric: tabular-nums; }
#app table :is(th,td) { font-size: var(--type-body); line-height: 1.5; }
#app table th { background-color: var(--theme-table-header); color: #53655b; font-size: var(--type-body); font-weight: 600; letter-spacing: normal; }
#app table td { border-color: #ebefec; }
#app table tbody>tr { border-color: #ebefec; }
#app table tbody>tr:hover { background-color: #f8fbf7; }
#app table tbody>tr:focus-within { background-color: #f4f9ef; }
#app .summary-table-scroll :is(th,td),#app .driver-performance-table-scroll :is(th,td) { font-size: var(--type-compact); }
#app table table :is(th,td) { font-size: var(--type-caption); }
#app .summary-table-scroll thead th { background-color: var(--theme-table-header); box-shadow: 0 1px 0 var(--theme-border); }
#app .text-zinc-400 { color: var(--theme-muted); }
#app :is(button,a):is(.rounded-xl,.rounded-2xl,.rounded-\[1\.1rem\],.rounded-\[1\.3rem\]) { box-shadow: none; font-weight: 600; }
#app :is(button,a):is(.rounded-xl,.rounded-2xl):hover { transform: none; box-shadow: none; }
#app :is(button,a).rounded-2xl { border-radius: 10px; }
#app :is(button,a).border-zinc-300 { background: #fff; border-color: #dce4de; color: #43554a; }
#app :is(input,select,textarea):not(table *):not(.om-page *) { border-radius: 10px; border-color: #dce4df; }
#app form> :is(input,select):not([type=checkbox]):not([type=radio]):not(.om-page *) { min-height: 40px; }
.app-topbar .topbar-brand { font-size: 12px; border-radius: 10px; }
.app-topbar .account-menu-trigger .text-sm { font-size: 12px; }
.app-topbar .topbar-upload { font-size: 12px; }
#app .customer-analytics-page { background: var(--theme-canvas); }
#app .customer-analytics-header { --customer-header-ink: var(--theme-ink); --customer-header-muted: var(--theme-muted); background: #fff; box-shadow: var(--theme-shadow); border-color: var(--theme-border) !important; }
#app .customer-analytics-header::after { display: none; }
@media(max-width:767px) {
    #app>section:not(.om-page) { padding: 18px 16px; }
    #app :is(.dashboard-hero,.workspace-hero) { padding: 20px; }
    #app h1 { font-size: 24px; }
    #app .dashboard-stat-value { font-size: 25px; }
}
.app-body .mobile-group-title { margin-top: 20px; margin-bottom: 10px; font-size: 10px; font-weight: 650; letter-spacing: .1em; color: #718077; }
#app .customer-analytics-header a:hover { color: var(--theme-primary); }

/* Shared text roles cover utility-based pages and dialogs rendered outside #app. */
.app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"],.account-menu-panel) {
    font-family: var(--app-font);
}
.app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"]) :is(.text-xs,.text-\[9px\],.text-\[10px\],.text-\[11px\]) {
    font-size: var(--type-caption); line-height: 1.5;
}
.app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"]) .text-sm { font-size: var(--type-body); line-height: 1.5; }
.app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"]) :is(input,select,textarea) {
    font-family: var(--app-font); font-size: var(--type-body); line-height: 1.5;
}
.app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"]) button { font-family: var(--app-font); line-height: 1.4; }
#app :is(table,.dashboard-stat-value,.returns-kpi-card,input.matrix-qty) { font-variant-numeric: lining-nums tabular-nums; }
#app table :is(th,td) { overflow-wrap: normal; }
#app table th { line-height: 1.45; }
#app table th :is(.text-xs,.text-sm) { font-size: inherit; }
#app :is(.dashboard-stat-foot,.dashboard-hero .inline-flex,.status-pill) { font-size: var(--type-caption); line-height: 1.5; }
#app .dashboard-filter-grid .dashboard-customer-picker { min-height: 80px; }
#app :is(.dashboard-stat-label,.dashboard-filter-grid label) { letter-spacing: .04em; }
.app-body :is([id^="app-modal-"],[id^="app-form-modal-"]) :is(.font-black,.font-extrabold) { font-weight: 700; }
@media(max-width:767px) {
    /* Prevent automatic input zoom on phones while keeping labels compact. */
    .app-body :is(#app,[id^="app-modal-"],[id^="app-form-modal-"]) :is(input,select,textarea):not([type=checkbox]):not([type=radio]) { font-size: 1rem; }
}

/* Dashboard workspaces: concise title, then a consistent labelled filter bar. */
#app .dashboard-page-header { padding:2px 0 0; }
#app .dashboard-page-header .dashboard-page-category { margin:0 0 7px; color:var(--theme-muted); font-size:var(--type-caption); font-weight:500; }
#app .dashboard-page-header h1 { margin:0; font-size:var(--type-title); line-height:1.25; letter-spacing:-.025em; }
#app .dashboard-page-header>p:last-child { margin:8px 0 0; color:var(--theme-muted); font-size:var(--type-body); line-height:1.5; }
#app .dashboard-filter-toolbar { position:relative; top:auto; z-index:25; margin-top:20px; }
#app .dashboard-filter-panel { padding:18px; }
#app .dashboard-filter-grid { gap:14px; align-items:end; grid-template-columns:minmax(210px,1.3fr) minmax(160px,.85fr) repeat(2,minmax(155px,.8fr)) max-content max-content; }
#app .dashboard-filter-grid--comparison { grid-template-columns:repeat(12,minmax(0,1fr)); }
#app .dashboard-filter-grid--comparison> :nth-child(1) { grid-column:span 4; }
#app .dashboard-filter-grid--comparison> :nth-child(2) { grid-column:span 2; }
#app .dashboard-filter-grid--comparison> :is(:nth-child(3),:nth-child(4),:nth-child(5),:nth-child(6)) { grid-column:span 3; }
#app .dashboard-filter-grid--comparison> :is(:nth-child(7),:nth-child(8),:nth-child(9)) { grid-column:span 2; }
#app .dashboard-filter-grid>label { display:flex; flex-direction:column; gap:7px; }
#app .dashboard-filter-grid>label>span { font-size:var(--type-caption); font-weight:500; letter-spacing:normal; text-transform:none; line-height:18px; }
#app .dashboard-filter-grid>label>:is(input,select) { margin:0 !important; min-height:42px; height:42px; padding:9px 11px !important; border:1px solid var(--theme-border); border-color:var(--theme-border) !important; border-radius:9px; background:#fff; font-size:var(--type-body); }
#app .dashboard-filter-grid>.dashboard-customer-picker { min-height:0; padding:0; border:0; background:transparent !important; border-radius:0; position:relative; }
#app .dashboard-customer-picker summary { position:relative; display:block; padding-top:25px; overflow:visible; }
#app .dashboard-customer-picker summary>div>div:first-child { position:absolute; top:0; left:0; font-size:var(--type-caption); font-weight:500; letter-spacing:normal; text-transform:none; line-height:18px; }
#app .dashboard-customer-picker summary .truncate { height:42px; margin:0; border:1px solid var(--theme-border); background:#fff; border-radius:9px; padding:10px 32px 10px 11px; font-size:var(--type-body); font-weight:500; line-height:20px; }
#app .dashboard-customer-picker summary>span { position:absolute; right:12px; bottom:12px; }
#app .dashboard-customer-picker-menu { top:100%; margin-top:8px; padding:12px; border:1px solid var(--theme-border); border-radius:12px; background:#fff; box-shadow:0 12px 35px #173a2a20; }
#app .dashboard-filter-grid>:is(button,a) { height:42px; min-height:42px; padding:10px 16px; align-self:end; border-radius:9px; font-size:var(--type-compact); }
#app .dashboard-filter-grid>a { border:1px solid var(--theme-border); border-color:var(--theme-border) !important; color:#43554a !important; background:#fff; }
@media(min-width:1800px) { #app .dashboard-filter-grid--comparison { grid-template-columns:minmax(210px,1.2fr) 150px repeat(4,minmax(155px,1fr)) 90px max-content max-content; } #app .dashboard-filter-grid--comparison>* { grid-column:auto; } }
@media(max-width:1250px) { #app .dashboard-filter-grid { grid-template-columns:repeat(3,minmax(0,1fr)); } #app .dashboard-filter-grid>* { grid-column:auto; } }
@media(max-width:900px) { #app .dashboard-filter-grid { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:540px) { #app .dashboard-filter-grid { grid-template-columns:minmax(0,1fr); } #app .dashboard-filter-panel { padding:15px; } #app .dashboard-filter-grid>label>:is(input,select) { font-size:1rem; } }
