/* =========================================================================
   Halt Group Ops Portal — design system
   Brand green #00A651 · black #111111 · Inter · Tabler icons
   Every class name used by the pages and scripts is kept; ui.js adds the
   shell extras (icons, top-bar title, avatar menu, quick search, toasts).
   Anything that hides an existing control is scoped to body.ui-ready, so
   if ui.js ever fails to load the page still works with its original UI.
   ========================================================================= */

/* Inter is served from the portal itself (no outside requests). */
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url('/fonts/inter-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 400; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url('/fonts/inter-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 500; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url('/fonts/inter-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 600; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url('/fonts/inter-latin-ext-700-normal.woff2') format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 700; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 800; src: url('/fonts/inter-latin-ext-800-normal.woff2') format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-display: swap; font-weight: 800; src: url('/fonts/inter-latin-800-normal.woff2') format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  /* brand */
  --green: #00A651;
  --green-hover: #008F46;
  --green-pressed: #007A3C;
  --green-soft: #E6F6EE;
  --green-ring: rgba(0, 166, 81, 0.22);
  --green-text: #00803F;
  --black: #111111;

  /* surfaces + text */
  --surface: #ffffff;
  --page: #F5F6F8;
  --hover: #F9FAFB;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --text-primary: #111111;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;

  /* status */
  --ok: #0F9D4E;
  --ok-bg: #E8F8EE;
  --low: #B9770E;
  --low-bg: #FFF4E5;
  --info: #4B5563;
  --info-bg: #F3F4F6;
  --out: #B42318;
  --out-bg: #FEF3F2;
  --danger: #D92D20;
  --danger-border: #FDA29B;

  /* shape */
  --radius: 12px;
  --radius-control: 8px;
  --radius-nav: 10px;
  --radius-modal: 16px;
  --shadow-pop: 0 10px 30px rgba(17, 17, 17, 0.12), 0 2px 6px rgba(17, 17, 17, 0.06);
  --sidebar-w: 232px;
  --topbar-h: 64px;

  /* names older page styles still reference */
  --sidebar-bg: #ffffff;
  --sidebar-bg-hover: #F5F6F8;
  --content-bg: #F5F6F8;
  --card-bg: #ffffff;
  --lime: #00A651;
  --lime-text: #ffffff;
  --lavender: #F3F4F6;
  --lavender-text: #4B5563;
  --brand-red: #D92D20;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  font-variant-numeric: tabular-nums;
}

a { color: inherit; }
svg.ti { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
h1, h2, h3 { letter-spacing: -0.01em; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
::selection { background: var(--green-soft); }

/* ---------------------------------------------------------------- shell */

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

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
}

.sidebar .logo { display: flex; align-items: center; gap: 10px; padding: 2px 8px 18px; }
.sidebar .logo .brand-logo-img { height: 30px; width: auto; max-width: 150px; display: block; }

/* brand block built by ui.js */
.rail-brand { display: flex; flex-direction: column; gap: 10px; padding: 0 8px 18px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.rail-wordmark { font-weight: 800; font-size: 21px; letter-spacing: -0.03em; line-height: 1; color: var(--black); }
.rail-wordmark span { color: var(--green); }
.rail-logos { display: flex; align-items: center; gap: 10px; height: 30px; }
.rail-logos img { height: 26px; width: auto; max-width: 90px; object-fit: contain; }
.rail-logos .rail-divider { width: 1px; height: 24px; background: var(--border-strong); transform: rotate(20deg); }

.nav-section { margin-top: 10px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  padding: 6px 12px 8px;
}

.nav-group { margin-top: 6px; }
.nav-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-nav);
  transition: color 0.12s ease;
}
.nav-group-header:hover { color: var(--text-primary); }
.nav-group-header .nav-arrow { font-size: 10px; color: var(--text-muted); transition: transform 0.15s ease; }
.nav-group.expanded .nav-group-header .nav-arrow { transform: rotate(90deg); }
.nav-group-items { max-height: 0; overflow: hidden; transition: max-height 0.2s ease; }
.nav-group.expanded .nav-group-items { max-height: 520px; }
.nav-group.has-active .nav-group-header { color: var(--green-text); }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  margin-bottom: 2px;
  border-radius: var(--radius-nav);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.nav-item .ti { font-size: 19px; color: var(--text-secondary); flex-shrink: 0; transition: color 0.12s ease; }
.nav-item .nav-text { flex: 1; min-width: 0; }
.nav-item:hover { background: var(--page); }
.nav-item.active {
  background: var(--green);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 166, 81, 0.25);
}
.nav-item.active .ti { color: #fff; }
.nav-item .badge-count {
  margin-left: auto;
  background: var(--page);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
}
.nav-item.active .badge-count { background: rgba(255, 255, 255, 0.22); color: #fff; }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px 4px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* -------------------------------------------------------------- top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar-h);
  padding: 10px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { min-width: 0; flex-shrink: 0; max-width: 300px; }
.topbar-title .tt-main { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .tt-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar .search { flex: 1; max-width: 460px; position: relative; }
.topbar .search input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--page);
  font: inherit;
  font-size: 13.5px;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.topbar .search::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='10' cy='10' r='7'/%3E%3Cpath d='m21 21-6-6'/%3E%3C/svg%3E");
  pointer-events: none;
}
.topbar .search:empty::before { display: none; }
.topbar .search input:focus { outline: none; background: #fff; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }
.search-kbd {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: #fff; pointer-events: none;
}

.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.bell {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  cursor: pointer;
}
.bell:hover { background: var(--hover); }
.bell .dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 0 2px #fff; }

.role-pill {
  background: var(--black);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: capitalize;
  white-space: nowrap;
}

.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.user-chip .avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--border);
}
.user-chip .meta { line-height: 1.25; }
.user-chip .name { font-size: 13px; font-weight: 600; }
.user-chip .role { font-size: 11px; color: var(--text-secondary); text-transform: capitalize; }
body.ui-ready .topbar .user-chip .meta { display: none; }
body.ui-ready .topbar #logout-btn { display: none; }

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 300;
  cursor: default;
}
.user-menu .um-head { padding: 10px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.user-menu .um-name { font-weight: 700; font-size: 14px; }
.user-menu .um-sub { font-size: 12px; color: var(--text-secondary); }
.user-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; border: 0; background: none; border-radius: var(--radius-control);
  font: inherit; font-size: 13.5px; color: var(--text-primary); cursor: pointer; text-align: left;
}
.user-menu button .ti { font-size: 17px; color: var(--text-secondary); }
.user-menu button:hover { background: var(--page); }
.user-menu button.um-danger { color: var(--out); }
.user-menu button.um-danger .ti { color: var(--out); }

/* -------------------------------------------------------------- content */

.content { padding: 24px 28px 56px; max-width: 1480px; width: 100%; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}
.page-header h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
.page-header .subtext { color: var(--text-secondary); font-size: 13.5px; margin: 0; max-width: 72ch; }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 { font-size: 15px; font-weight: 700; margin: 0 0 14px; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card { display: flex; flex-direction: column; gap: 6px; position: relative; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.stat-card[onclick]:hover, .stat-card[style*='cursor:pointer']:hover { border-color: var(--green); box-shadow: 0 4px 14px rgba(0, 166, 81, 0.12); }
.stat-card .stat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 600; }
.stat-card .stat-value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; display: flex; align-items: baseline; gap: 8px; }

.delta { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.delta.up { background: var(--ok-bg); color: var(--ok); }
.delta.down { background: var(--low-bg); color: var(--low); }

.section-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-bottom: 20px; }
@media (max-width: 900px) { .section-grid { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- donut + ranks */

.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 128px; height: 128px; border-radius: 50%; flex-shrink: 0; -webkit-mask: radial-gradient(circle, transparent 37px, #000 38px); mask: radial-gradient(circle, transparent 37px, #000 38px); }
.donut-legend { display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; flex: 1; min-width: 0; }
.donut-legend .row { display: flex; align-items: center; gap: 8px; }
.donut-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .label { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.donut-legend .val { font-weight: 700; }

.rank-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.rank-row .rname { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { background: #EFF1F3; border-radius: 999px; height: 6px; overflow: hidden; }
.rank-fill { height: 100%; border-radius: 999px; background: var(--green); }
.rank-row .rval { text-align: right; font-weight: 700; white-space: nowrap; }

/* --------------------------------------------------------------- tables */

.table-card { padding: 0; overflow-x: auto; }
.table-card .table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.table-card .table-head h3 { margin: 0; }

table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFC;
  white-space: nowrap;
}
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr { transition: background 0.12s ease; }
table.data-table tbody tr:hover td { background: var(--hover); }
table.data-table th.num, table.data-table td.num { text-align: right; }

/* While a script is still filling a table, show a quiet shimmer instead
   of a blank card (stops by itself after a few seconds). */
table.data-table tbody:empty::after {
  content: '';
  display: block;
  height: 132px;
  margin: 12px 16px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent 0, rgba(255,255,255,.65) 50%, transparent 100%) 0 0 / 40% 100% no-repeat,
    repeating-linear-gradient(#F1F2F4 0 14px, transparent 14px 33px);
  animation: ui-shimmer 1.1s ease-in-out 3;
}
@keyframes ui-shimmer { from { background-position: -40% 0, 0 0; } to { background-position: 140% 0, 0 0; } }

/* ------------------------------------------------------------ menus etc */

.action-menu {
  position: fixed;
  z-index: 500;
  min-width: 170px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.action-menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: none; background: none; border-radius: 6px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-primary); }
.action-menu button:hover { background: var(--page); }
.action-menu button.danger { color: var(--out); }
.action-menu button.danger:hover { background: var(--out-bg); }

.switch { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; transition: background 0.15s ease; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform 0.15s ease; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.switch input:checked + .switch-track { background: var(--green); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--green-ring); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.ok { background: var(--ok-bg); color: var(--ok); }
.status-badge.low { background: var(--low-bg); color: var(--low); }
.status-badge.out { background: var(--out-bg); color: var(--out); }
.status-badge.info { background: var(--info-bg); color: var(--info); }

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 16px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease, transform 0.06s ease;
}
a.btn { text-decoration: none; }
.btn .ti { font-size: 18px; }
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.btn.primary:active { background: var(--green-pressed); border-color: var(--green-pressed); }
.btn.dark { background: var(--black); border-color: var(--black); color: #fff; }
.btn.dark:hover { background: #2a2a2a; border-color: #2a2a2a; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--page); }
.btn.danger { background: #fff; border-color: var(--danger-border); color: var(--out); }
.btn.danger:hover { background: var(--out-bg); border-color: var(--danger); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.lg { min-height: 48px; padding: 12px 20px; font-size: 15px; }
.btn.sm { min-height: 30px; padding: 4px 10px; font-size: 12.5px; gap: 6px; }
.btn.icon { width: 34px; height: 34px; min-height: 34px; padding: 0; }
.btn.selected { background: var(--green-soft); border-color: var(--green); color: var(--green-text); }

/* --------------------------------------------------------------- inputs */

.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-row input, .form-row select, .form-row textarea,
.content input[type='text'], .content input[type='number'], .content input[type='search'], .content input[type='email'],
.content input[type='password'], .content input[type='date'], .content input[type='tel'], .content input:not([type]),
.content select, .content textarea,
.app-modal input[type='text'], .app-modal input[type='number'], .app-modal input[type='password'], .app-modal input:not([type]), .app-modal select, .app-modal textarea {
  padding: 9px 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-primary);
  font: inherit;
  font-size: 13.5px;
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.form-row input, .form-row select, .form-row textarea { width: 100%; }
.content select, .form-row select, .app-modal select, select.selector, select.period-select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  background: #fff no-repeat right 12px center / 12px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus,
.content input:focus, .content select:focus, .content textarea:focus,
.app-modal input:focus, .app-modal select:focus, .app-modal textarea:focus,
select.selector:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-ring);
}
input[type='checkbox'], input[type='radio'] { accent-color: var(--green); }
input::placeholder, textarea::placeholder { color: var(--text-muted); }

select.period-select, select.selector {
  height: 40px;
  padding: 0 34px 0 12px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
}

/* ---------------------------------------------------------- pills / tabs */

.pill-tabs { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.pill-tab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.pill-tab:hover { color: var(--text-primary); border-color: var(--border-strong); }
.pill-tab.active { background: var(--green); color: #fff; border-color: var(--green); }

.brand-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.brand-pill { font-size: 13px; font-weight: 500; padding: 8px 14px; border-radius: 999px; background: #fff; color: var(--text-primary); border: 1px solid var(--border); cursor: pointer; white-space: nowrap; transition: all 0.12s ease; }
.brand-pill:hover { border-color: var(--green); color: var(--green-text); }
.brand-pill .pill-count { color: var(--text-secondary); font-weight: 400; }

/* ------------------------------------------------------------- messages */

.msg { padding: 10px 14px; border-radius: var(--radius-control); font-size: 13px; margin-bottom: 14px; border: 1px solid transparent; }
.msg.error { background: var(--out-bg); color: var(--out); border-color: #FECDCA; }
.msg.success { background: var(--ok-bg); color: var(--ok); border-color: #BBF0D0; }
.msg.warning { background: var(--low-bg); color: var(--low); border-color: #FDE3B5; }

.text-muted { color: var(--text-muted); font-size: 12.5px; }
.hidden { display: none !important; }

/* --------------------------------------------------------------- modals */
/* common.js injects its own modal styles; these more specific rules
   bring them onto the design system. */
#app-modal-root.app-modal-overlay { background: rgba(17, 17, 17, 0.45); backdrop-filter: blur(2px); }
#app-modal-root .app-modal { border-radius: var(--radius-modal); box-shadow: 0 24px 60px rgba(17, 17, 17, 0.25); max-width: 480px; animation: ui-pop 0.16s ease-out; }
#app-modal-root .app-modal-header { padding: 20px 22px 0; }
#app-modal-root .app-modal-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
#app-modal-root .app-modal-body { color: var(--text-secondary); font-size: 13.5px; }
#app-modal-root .app-modal-footer { border-top: 1px solid var(--border); margin-top: 12px; padding: 14px 22px; }
#app-modal-root .app-modal-footer button {
  min-height: 38px; padding: 8px 16px; border-radius: var(--radius-control);
  border: 1px solid var(--border); background: #fff; color: var(--text-primary);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
#app-modal-root .app-modal-footer button:hover { background: var(--hover); }
#app-modal-root .app-modal-footer button.am-primary { background: var(--green); border-color: var(--green); color: #fff; }
#app-modal-root .app-modal-footer button.am-primary:hover { background: var(--green-hover); }
#app-modal-root .app-modal-footer button.am-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
#app-modal-root .app-modal-footer button:disabled { opacity: 0.45; cursor: not-allowed; }
@keyframes ui-pop { from { transform: translateY(6px) scale(0.985); opacity: 0; } to { transform: none; opacity: 1; } }

/* --------------------------------------------------------------- toasts */

.toast-stack { position: fixed; top: calc(var(--topbar-h) + 12px); right: 20px; z-index: 3000; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  max-width: 380px;
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--black);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: ui-toast-in 0.18s ease-out;
}
.toast .ti { font-size: 18px; color: #3DDC84; flex-shrink: 0; }
.toast.warn .ti { color: #F5B547; }
.toast.err .ti { color: #FF8A80; }
.toast.leaving { opacity: 0; transform: translateY(-4px); transition: opacity 0.18s ease, transform 0.18s ease; }
@keyframes ui-toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------- quick search */

.palette-overlay { position: fixed; inset: 0; background: rgba(17, 17, 17, 0.35); z-index: 4000; display: flex; justify-content: center; align-items: flex-start; padding: 12vh 16px 16px; }
.palette {
  width: 100%; max-width: 620px;
  background: #fff;
  border-radius: var(--radius-modal);
  box-shadow: 0 24px 60px rgba(17, 17, 17, 0.28);
  overflow: hidden;
  animation: ui-pop 0.14s ease-out;
}
.palette-input-wrap { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.palette-input-wrap .ti { font-size: 20px; color: var(--text-muted); }
.palette input { flex: 1; height: 56px; border: 0; outline: none; font: inherit; font-size: 16px; background: transparent; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 11.5px; font-weight: 600; color: var(--text-muted); padding: 10px 12px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius-control); cursor: pointer; }
.palette-item .ti { font-size: 18px; color: var(--text-secondary); width: 22px; text-align: center; }
.palette-item .pi-text { flex: 1; min-width: 0; }
.palette-item .pi-title { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-sub { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item.active { background: var(--green-soft); }
.palette-item.active .ti, .palette-item.active .pi-title { color: var(--green-text); }
.palette-empty { padding: 26px 16px; text-align: center; color: var(--text-secondary); font-size: 13.5px; }
.palette-foot { display: flex; gap: 16px; padding: 9px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-muted); }
.palette-foot kbd { font: inherit; font-weight: 600; border: 1px solid var(--border); border-radius: 5px; padding: 0 5px; margin-right: 4px; color: var(--text-secondary); }

/* ------------------------------------------------- full-screen scan mode */

.scan-mode-btn .ti { font-size: 18px; }
body.scan-mode .sidebar, body.scan-mode .topbar { display: none !important; }
body.scan-mode .content { max-width: 1100px; margin: 0 auto; padding-top: 18px; }
body.scan-mode .page-header { margin-bottom: 14px; }
body.scan-mode #batch-scan-input, body.scan-mode #scan-input, body.scan-mode .scan-big-input {
  font-size: 26px !important;
  height: 72px;
  padding: 0 22px !important;
  border-width: 2px !important;
  border-color: var(--green) !important;
  border-radius: 14px !important;
}
body.scan-mode .btn { min-height: 48px; font-size: 15px; padding: 10px 20px; }
body.scan-mode .btn.sm { min-height: 40px; font-size: 14px; }
body.scan-mode #batch-scan-feedback { font-size: 16px !important; }
.scan-exit { display: none; }
body.scan-mode .scan-exit { display: inline-flex; position: fixed; top: 14px; right: 18px; z-index: 70; }

/* ---------------------------------------------------------- empty state */

.ui-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; color: var(--text-secondary); text-align: center; }
.ui-empty .ti { font-size: 34px; color: var(--text-muted); }

/* ---------------------------------------------------------------- login */

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); background: #fff; }
.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 44px 56px 0;
  background: var(--page);
  border-right: 1px solid var(--border);
}
.login-brand .rail-wordmark { font-size: 24px; }
.login-lockup { display: flex; align-items: center; gap: 22px; margin-top: auto; }
.login-lockup img { height: 64px; width: auto; }
.login-lockup .rail-divider { width: 2px; height: 56px; background: var(--border-strong); transform: rotate(20deg); }
.login-headline { font-size: clamp(30px, 3.4vw, 46px); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; margin: 28px 0 14px; max-width: 15ch; }
.login-lede { font-size: 15px; color: var(--text-secondary); max-width: 46ch; margin: 0 0 36px; }
.login-barcode { display: block; width: calc(100% + 112px); margin: auto -56px 0; height: 120px; }
.login-barcode rect { fill: var(--black); }
.login-barcode rect.g { fill: var(--green); }
.login-barcode text { font: 600 13px 'Inter', sans-serif; letter-spacing: 0.32em; fill: var(--text-secondary); }

.login-side { display: flex; align-items: center; justify-content: center; padding: 40px 28px; background: var(--black); }
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-modal);
  padding: 34px 32px 30px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
.login-card .brand-logo-img { height: 34px; width: auto; margin-bottom: 18px; display: block; }
.login-card h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
.login-card p.sub { color: var(--text-secondary); font-size: 13.5px; margin: 0 0 22px; }
.login-card .btn.primary { min-height: 46px; font-size: 15px; width: 100%; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 64px !important; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--green-text); cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.pw-toggle:hover { background: var(--green-soft); }
.login-foot { margin-top: 18px; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1280px) {
  :root { --sidebar-w: 208px; }
  .content { padding: 20px 20px 48px; }
}

/* Tablets: the rail folds to an icon column. */
@media (max-width: 1024px) and (min-width: 821px) {
  body.ui-ready { --sidebar-w: 76px; }
  body.ui-ready .sidebar { padding: 16px 10px; align-items: stretch; }
  body.ui-ready .rail-wordmark span, body.ui-ready .rail-logos, body.ui-ready .nav-label,
  body.ui-ready .nav-group-header, body.ui-ready .sidebar-footer, body.ui-ready .nav-item .nav-text,
  body.ui-ready .nav-item .badge-count { display: none; }
  body.ui-ready .rail-brand { align-items: center; padding: 0 0 14px; }
  body.ui-ready .rail-wordmark { font-size: 18px; }
  body.ui-ready .nav-group-items { max-height: none; }
  body.ui-ready .nav-item { justify-content: center; padding: 0; min-height: 52px; }
  body.ui-ready .nav-item .ti { font-size: 21px; }
  .topbar-title { max-width: 200px; }
}

/* Phones (and iPad portrait): the rail becomes a scrolling top strip. */
@media (max-width: 820px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 65;
    flex-direction: row;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .logo, .rail-brand { display: none; }
  .nav-section { margin-top: 0; display: flex; gap: 4px; flex-shrink: 0; }
  .nav-group { margin-top: 0; display: flex; flex-shrink: 0; }
  .nav-group-header { display: none; }
  .nav-group-items { max-height: none; display: flex; gap: 4px; }
  .nav-label, .sidebar-footer { display: none; }
  .nav-item { white-space: nowrap; min-height: 40px; padding: 0 12px; margin: 0; }
  .topbar { position: static; height: auto; flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .topbar-title { order: 1; flex: 1; max-width: none; }
  .topbar-right { order: 2; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .topbar .search:empty { display: none; }
  .role-pill { display: none; }
  .content { padding: 16px 12px 40px; }
  .page-header h1 { font-size: 21px; }
  .form-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
  .stat-card .stat-value { font-size: 24px; }
  .btn { min-height: 40px; }
  .brand-tile { padding: 12px 8px; }
  .form-row input, .form-row select, .form-row textarea, input[type='text'], input[type='number'], input[type='email'],
  input[type='password'], input[type='date'], input[type='search'], input:not([type]), select, textarea { font-size: 16px; }
  #alert-panel { right: 10px !important; left: 10px; width: auto !important; top: 70px !important; }
  #reminder-toast-stack { left: 10px; right: 10px; max-width: none !important; }
  .toast-stack { left: 12px; right: 12px; top: 12px; }
  .toast { max-width: none; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { padding: 28px 20px 0; border-right: 0; min-height: auto; }
  .login-lockup { margin-top: 24px; }
  .login-lockup img { height: 42px; }
  .login-headline { margin-top: 18px; }
  .login-lede { margin-bottom: 18px; }
  .login-barcode { width: calc(100% + 40px); margin: 0 -20px; height: 70px; }
  .login-side { padding: 24px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

@media print {
  .sidebar, .topbar, .toast-stack, .scan-exit { display: none !important; }
  body { background: #fff; }
  .content { padding: 0; max-width: none; }
  .card { border-color: #ccc; }
}

/* ------------------------------------------------- small page fixes */
#scan-input, #batch-scan-input { width: 100%; }
table.data-table td[colspan].text-muted { text-align: center; padding: 30px 20px !important; color: var(--text-secondary); }
table.data-table td[colspan].text-muted::before {
  content: '';
  display: block;
  width: 30px;
  height: 30px;
  margin: 0 auto 8px;
  background: var(--text-muted);
  -webkit-mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z'/%3E%3Cpath d='M4 13h3l3 3h4l3 -3h3'/%3E%3C/svg%3E");
  mask: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z'/%3E%3Cpath d='M4 13h3l3 3h4l3 -3h3'/%3E%3C/svg%3E");
}

/* ------------------------------------------- live updates + camera scan */
.toast.has-action { pointer-events: auto; }
.toast-action { margin-left: 8px; background: #fff; color: #111; border: 0; border-radius: 6px; padding: 5px 10px; font: 600 12.5px/1 Inter, system-ui, sans-serif; cursor: pointer; flex-shrink: 0; }
.toast-action:hover { background: #E8F7EF; }
.toast-action:focus-visible { outline: 2px solid #3DDC84; outline-offset: 2px; }
body.live-on .role-pill::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #00A651; margin-left: 6px; vertical-align: middle; box-shadow: 0 0 0 3px rgba(0,166,81,.18); }
.cam-btn { margin-top: 8px; }
.cam-btn .ti { font-size: 18px; }
.cam-overlay { position: fixed; inset: 0; z-index: 4000; background: rgba(17,17,17,.82); display: flex; align-items: center; justify-content: center; padding: 16px; }
.cam-box { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 100%; overflow: auto; padding: 14px; }
.cam-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.cam-head strong { display: inline-flex; align-items: center; gap: 8px; font-size: 16px; }
.cam-reader { width: 100%; min-height: 240px; background: #111; border-radius: 8px; overflow: hidden; }
.cam-reader video { width: 100% !important; display: block; }
.cam-last { margin-top: 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; color: #111; }
.cam-last .ti { color: #00A651; font-size: 20px; flex-shrink: 0; }
.cam-last.err .ti { color: #B42318; }
.cam-overlay.cam-hidden { display: none; }

/* ===================================================== Release 4: dashboard */
.ov-root { margin-bottom: 26px; }
.ov-h2 { font-size: 17px; font-weight: 800; margin: 6px 0 12px; letter-spacing: -0.01em; }
.ov-hero { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(260px, 1fr); gap: 16px; margin-bottom: 14px; }
.ov-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.ov-big { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-top: 4px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ov-mid { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin-top: 2px; }
.ov-sub { font-size: 12px; margin-top: 4px; }
.ov-delta { font-size: 12.5px; font-weight: 700; letter-spacing: 0; white-space: nowrap; }
.ov-big .ov-delta { font-size: 15px; }
.ov-delta.up { color: var(--ok); }
.ov-delta.down { color: var(--out); }
.ov-chains { display: flex; gap: 22px; flex-wrap: wrap; margin: 14px 0 6px; }
.ov-chain { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary); }
.ov-chain strong { color: var(--text-primary); }
.ov-chip { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.ov-chip.halt { background: #008f46; }
.ov-chip.bbi { background: #2a78d6; }
.ov-chart { height: 210px; position: relative; }
.ov-side { display: grid; grid-template-rows: auto auto 1fr; gap: 16px; }
.ov-risk { cursor: pointer; transition: border-color 0.12s ease; }
.ov-risk:hover, .ov-pill:hover { border-color: var(--green); }
.ov-risk:focus-visible, .ov-pill:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.ov-risk-lines { display: grid; gap: 3px; margin-top: 8px; font-size: 12.5px; color: var(--text-secondary); }
.ov-risk-lines span { display: flex; justify-content: space-between; gap: 10px; }
.ov-risk-lines strong { color: var(--text-primary); font-weight: 600; }
.ov-link { margin-top: 10px; font-size: 12.5px; font-weight: 600; color: var(--green-text); }
.ov-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.ov-pill { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color 0.12s ease; }
.ov-pill strong { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.ov-table td { vertical-align: middle; }
.ov-bottom { margin-top: 16px; grid-template-columns: 1fr 1fr; }
.ov-brands { height: 280px; position: relative; }
.ov-mini td { padding: 8px 6px; }
.ov-empty h3 { margin-top: 0; }
.wa-btn { color: #128C7E; border-color: #B7E4C7; white-space: nowrap; }
.wa-btn:hover { background: #E9FBF0; border-color: #25D366; color: #075E54; }
.wa-btn .ti { font-size: 16px; }
.league-bar { display: inline-block; width: 80px; height: 6px; background: #EEF0F2; border-radius: 3px; vertical-align: middle; margin-right: 8px; overflow: hidden; }
.league-bar span { display: block; height: 100%; border-radius: 3px; }
.tasks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.task-card { padding: 16px; }
.task-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.task-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--p) * 1%), #EEF0F2 0); display: grid; place-items: center; flex-shrink: 0; }
.task-ring span { width: 36px; height: 36px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.task-list { list-style: none; margin: 0; padding: 0; }
.task-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.task-list li > span:nth-child(2) { flex: 1; }
.task-tick { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid var(--border-strong); flex-shrink: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; margin-top: 1px; }
.task-list li.done .task-tick { background: var(--green); border-color: var(--green); }
.task-meta { display: block; font-size: 11.5px; margin-top: 2px; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.recovery-codes code { background: var(--page); border: 1px solid var(--border); border-radius: 6px; padding: 8px; text-align: center; font-size: 15px; letter-spacing: 1px; }
.qr-box svg { width: 200px; height: 200px; }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.health-dot.ok { background: var(--ok); }
.health-dot.warn { background: #eda100; }
.health-dot.bad { background: var(--out); }
.stat-head .health-dot { margin-right: auto; order: -1; }
@media (max-width: 1100px) {
  .ov-hero { grid-template-columns: 1fr; }
  .ov-side { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: none; }
  .ov-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .ov-side, .ov-bottom { grid-template-columns: 1fr; }
  .ov-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ov-big { font-size: 32px; }
}

/* ============================================ Release 4: store-side screens */
.spot-list { display: grid; gap: 10px; }
.spot-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.spot-item.counted { border-color: #B7E4C7; background: #F6FCF8; }
.spot-item.hit { box-shadow: 0 0 0 3px var(--green-ring); border-color: var(--green); }
.spot-item .spot-name { flex: 1; min-width: 0; }
.spot-item .spot-name strong { display: block; font-size: 14px; }
.spot-item input { width: 90px; font-size: 18px; text-align: center; padding: 8px; }
.spot-item.mismatch { border-color: var(--danger-border); background: var(--out-bg); }
.pc-result { display: grid; grid-template-columns: 120px 1fr; gap: 18px; align-items: start; }
.pc-img { width: 120px; height: 120px; border-radius: 10px; border: 1px solid var(--border); object-fit: contain; background: #fff; }
.pc-price { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.pc-batches td { padding: 6px 8px; }
.store-task { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 8px; }
.store-task.done { background: #F6FCF8; border-color: #B7E4C7; }
.store-task .st-body { flex: 1; min-width: 0; }
.store-task .st-body strong { display: block; font-size: 14px; }
.store-task .task-tick { width: 26px; height: 26px; font-size: 15px; }
.store-task.done .task-tick { background: var(--green); border-color: var(--green); }
@media (max-width: 560px) {
  .pc-result { grid-template-columns: 1fr; }
  .spot-item { flex-wrap: wrap; }
}
.ov-table td:first-child { min-width: 170px; }
.ov-bottom { align-items: start; }
.stat-head:has(.health-dot) { justify-content: flex-start; }
.mix-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.mix-head h3 { margin: 0; }
.mix-tabs .pill-tab { padding: 5px 12px; font-size: 12.5px; }
.mix-legend .row { align-items: flex-start; }
.mix-legend .label, .mix-legend .val { display: flex; flex-direction: column; }
.mix-legend .val { text-align: right; align-items: flex-end; }
.mix-sub { display: block; font-size: 11.5px; color: var(--text-secondary); font-weight: 400; margin-top: 1px; }
.mix-prod { padding: 7px 0; border-bottom: 1px solid var(--border); }
.mix-prod:last-child { border-bottom: 0; }
.mix-prod-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.mix-prod-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mix-prod .rank-track { height: 6px; }

/* ---- spot check builder (admin) */
.spot-builder { margin-bottom: 18px; border: 1px solid var(--green, #00A651); }
.sb-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sb-head h3 { margin: 0; font-size: 16px; }
.sb-grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(280px, 1.4fr); gap: 22px; }
@media (max-width: 860px) { .sb-grid { grid-template-columns: 1fr; } }
.sb-step { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; margin-bottom: 10px; }
.sb-num { width: 22px; height: 22px; border-radius: 50%; background: #00A651; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex: none; }
.sb-stores { max-height: 340px; overflow-y: auto; border: 1px solid #e5e7eb; border-radius: 8px; padding: 6px 10px; }
.sb-group-head { font-size: 11.5px; font-weight: 600; color: #6b7280; margin: 8px 0 4px; }
.sb-store { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; cursor: pointer; font-size: 13.5px; }
.sb-store input { margin-top: 3px; width: auto; }
.sb-store.off { opacity: .5; cursor: not-allowed; }
.sb-store .mix-sub, .sb-prod .mix-sub { display: block; }
.sb-hint { display: block; font-size: 11.5px; margin-top: 4px; }
.sb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.sb-chips:empty { display: none; }
.sb-chip { display: inline-flex; align-items: center; gap: 4px; background: #e6f6ee; color: #006b34; border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 500; }
.sb-chip button { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; cursor: pointer; padding: 0 5px; border-radius: 50%; }
.sb-chip button:hover, .sb-chip button:focus-visible { background: rgba(0,0,0,.08); }
.sb-preview { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; }
.sb-preview p { margin: 4px 0; }
.sb-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sb-pill { background: #f3f4f6; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.sb-pill.zero { color: #9ca3af; }
.sb-pill.warn { background: #fff4e0; color: #8a5a00; }
.sb-list { max-height: 300px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 16px; }
.sb-prod { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; font-size: 13px; cursor: pointer; }
.sb-prod input { margin-top: 3px; width: auto; }
.sb-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.sb-foot .btn { white-space: nowrap; }

/* ---- store spot check list */
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--out); color: #fff; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: 1px; }
.spot-group { font-size: 14px; margin: 4px 0 10px; }
.spot-card { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; margin-bottom: 10px; }
.spot-card:hover { border-color: var(--green); }
.spot-card:focus-visible { outline: 3px solid var(--green-ring); outline-offset: 1px; }
.spot-card.open { border-left: 4px solid var(--green); }
.spot-card-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.spot-card-main strong { font-size: 15px; }
.spot-card-main .text-muted { font-size: 12.5px; }
.spot-card .btn { flex: none; pointer-events: none; }
.spot-note { background: #FFF8E6; border-radius: 8px; padding: 6px 10px; font-size: 13px; margin: 6px 0 0; color: #5c4400; }
.spot-head { margin-bottom: 14px; }
.spot-head h2 { margin: 10px 0 0; font-size: 18px; }
.spot-head #spot-back { margin-bottom: 2px; }

/* ======================================================= Release 5 */
.neg { color: var(--out); }
.pos { color: inherit; }
button.pill-tab { font-family: inherit; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); text-decoration: none; margin-bottom: 10px; }
.back-link:hover { color: var(--text-primary); }

/* segmented period picker */
.period-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 16px; }
.period-label { font-size: 12.5px; color: var(--text-secondary); font-weight: 600; }
.pill-tabs.seg { gap: 0; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px; flex-wrap: nowrap; }
.pill-tabs.seg .pill-tab { height: 30px; border: 0; background: transparent; padding: 0 13px; font-size: 12.5px; }
.pill-tabs.seg .pill-tab.active { background: var(--green); color: #fff; }
.pill-tabs.seg .pill-tab:focus-visible { outline: 2px solid var(--green); outline-offset: 1px; }
.period-custom { display: flex; align-items: center; gap: 6px; }
.period-custom input { width: auto; height: 34px; padding: 4px 8px; }
.period-err { color: var(--out); font-size: 12.5px; }
@media (max-width: 640px) {
  .pill-tabs.seg { overflow-x: auto; max-width: 100%; }
}

/* dashboard: profit card + stores table */
.ov-profit .ov-mid { font-size: 28px; }
.ov-profit.neg .ov-mid { color: var(--out); }
.ov-stores .table-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ov-group td { background: #F9FAFB; font-size: 12px; font-weight: 700; color: var(--text-primary); padding-top: 8px; padding-bottom: 8px; }
.ov-group .ov-chip { margin-right: 7px; vertical-align: -1px; }
.ov-group .text-muted { font-weight: 500; }
.ov-row { cursor: pointer; }
.ov-row:hover td { background: var(--hover); }
.ov-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.ov-go { color: var(--text-muted); font-size: 20px; text-align: right; width: 24px; }
.ov-row:hover .ov-go { color: var(--green-text); }
.ov-foot { font-size: 12px; margin: 10px 16px 14px; }

/* operations block */
.ops-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 28px 0 12px; }
.ops-range { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ops-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.ops-tiles { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.ops-tile { padding: 12px 14px; gap: 2px; cursor: pointer; border-left: 3px solid var(--border); }
.ops-tile.hot { border-left-color: var(--low); }
.ops-tile:hover { border-color: var(--green); border-left-color: var(--green); }
.ops-tile:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.ops-l { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ops-n { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.ops-n.money { font-size: 20px; }
.ops-tile:not(.hot) .ops-n { color: var(--text-secondary); }
.ops-tile:last-child .ops-n, .ops-tile:nth-last-child(2) .ops-n { color: var(--text-primary); }
.ops-s { font-size: 11.5px; color: var(--text-muted); }
.ops-tile.hot .ops-s { color: var(--green-text); font-weight: 600; }
.ops-list h3 { margin: 0 0 6px; font-size: 14.5px; }
.ops-item { padding: 9px 0 9px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; border-left: 3px solid transparent; margin-left: -10px; }
.ops-item:last-child { border-bottom: 0; }
.ops-item .text-muted { margin-top: 2px; }
.ops-item.warn { border-left-color: var(--low); }
.ops-item.link { cursor: pointer; border-radius: 4px; }
.ops-item.link:hover { background: var(--hover); }
.report-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.report-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: inherit; padding: 14px 16px; transition: border-color 0.12s ease; }
.report-link strong { font-size: 14px; }
.report-link span { font-size: 12.5px; color: var(--text-secondary); }
.report-link:hover { border-color: var(--green); }
@media (max-width: 1250px) {
  .ops-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .ops-grid, .report-links { grid-template-columns: 1fr; }
  .ops-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* store profit page */
.sp-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.sp-net { border-top: 3px solid var(--green); }
.sp-net.neg { border-top-color: var(--out); }
.sp-net.neg .ov-mid { color: var(--out); }
.sp-split { margin-bottom: 14px; }
.sp-split-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.sp-split-head h3 { margin: 0; font-size: 14.5px; }
.sp-split-head .text-muted { font-size: 12px; }
.sp-bar { display: flex; height: 18px; border-radius: 6px; overflow: hidden; background: #F3F4F6; gap: 2px; }
.sp-bar .seg { display: block; height: 100%; min-width: 0; }
.sp-bar .seg:not([style*="width:0%"]) { min-width: 2px; }
.cogs { background: #9CA3AF; }
.exp { background: #eb6834; }
.net { background: #008f46; }
.sp-legend { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; color: var(--text-secondary); }
.sp-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.sp-legend strong { color: var(--text-primary); margin-left: 4px; }
.sp-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 14px; align-items: start; margin-bottom: 14px; }
.sp-side { display: grid; gap: 14px; }
.sp-chart { height: 240px; position: relative; margin-bottom: 8px; }
.sp-months td { padding-top: 7px; padding-bottom: 7px; }
.sp-cats { display: grid; gap: 8px; }
.sp-cat { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; gap: 10px; font-size: 12.5px; }
.sp-cat-bar { height: 8px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.sp-cat-bar i { display: block; height: 100%; background: #eb6834; border-radius: 4px; }
.sp-form .form-row { margin-bottom: 10px; }
.sp-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 2px 0 10px; cursor: pointer; }
.sp-check input { width: auto; }
@media (max-width: 1000px) {
  .sp-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-grid { grid-template-columns: 1fr; }
}

/* customers */
.cust-card { margin-bottom: 18px; }
.cust-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.cust-filters { display: grid; grid-template-columns: minmax(220px, 2.2fr) repeat(4, minmax(120px, 1fr)); gap: 8px; margin-bottom: 10px; }
.cust-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin-bottom: 6px; }
.cust-stats strong { color: var(--text-primary); }
.cust-row { cursor: pointer; }
.cust-row:hover td { background: var(--hover); }
.cust-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.cust-table td { vertical-align: top; }
.cust-buys { font-size: 12px; max-width: 300px; }
.cust-contact a { display: block; white-space: nowrap; }
.cust-contact a + a { font-size: 12px; color: var(--text-secondary); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cust-store { font-size: 12.5px; min-width: 120px; }
.cust-buys div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cust-pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 12px; }
.cust-pager:empty { display: none; }
.cust-detail-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cust-detail-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); padding-bottom: 12px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.cust-detail-stats strong { color: var(--text-primary); }
.cust-bills { display: grid; gap: 10px; max-height: 55vh; overflow-y: auto; }
.cust-bill { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.cust-bill-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.cust-bill-total { margin-left: auto; }
.cust-line { display: grid; grid-template-columns: 1fr auto 90px; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.cust-line span:last-child, .cust-line span:nth-child(2) { text-align: right; }
@media (max-width: 900px) {
  .cust-filters { grid-template-columns: 1fr 1fr; }
  .cust-filters input { grid-column: 1 / -1; }
}

/* label inventory: search + sortable columns */
.sku-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sku-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.sku-tools input { width: 300px; max-width: 100%; }
.sku-tools select { width: auto; }
.sku-table th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.sku-table th[data-sort]:hover { color: var(--text-primary); }
.sku-table th[data-sort]::after { content: attr(data-arrow); margin-left: 4px; color: var(--green-text); }
.sku-table th[data-sort]:not(.sorted)::after { content: '↕'; color: var(--border-strong); }
.sku-table th.num, .sku-table td.num { text-align: right; }

/* monthly sales report reminder (stores) */
.sales-reminder { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--low-bg); border: 1px solid #F5C77E; color: #5c3d00; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.sales-reminder .btn { margin-left: auto; }
#sales-upload-card.due { border-color: #F5C77E; box-shadow: 0 0 0 3px rgba(245, 199, 126, 0.25); }
.sales-month-status .status-badge { white-space: normal; }
.ov-reports { margin-bottom: 14px; border-left: 3px solid var(--low); font-size: 13px; }
.ov-report-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ov-report-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 999px; padding: 3px 4px 3px 12px; font-size: 12.5px; font-weight: 600; }
.ov-report-chip .text-muted { font-weight: 400; }

/* ======================================================= UI refresh (all pages) */
/* compact, single-line action buttons inside tables */
table.data-table td .btn { min-height: 28px; padding: 3px 10px; font-size: 12px; }
table.data-table td > div[style*="flex-wrap:wrap"] { flex-wrap: nowrap !important; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }
table.data-table td .status-badge { white-space: nowrap; }
table.data-table th { white-space: nowrap; }
.page-header .subtext { max-width: 74ch; }

/* brand monograms: each brand gets its own steady colour */
.logo-circle.mono { background: hsl(var(--mono-h, 150) 55% 93%) !important; color: hsl(var(--mono-h, 150) 45% 30%) !important; font-weight: 800 !important; letter-spacing: 0.02em; font-size: 15px; }
.brand-tile { transition: box-shadow 0.15s ease, transform 0.15s ease, border-color 0.15s ease !important; }
.brand-tile:hover { border-color: var(--green) !important; }
.brand-tile:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* catalog: view switch, toolbar, totals, stock */
.wcat-views { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 3px; display: inline-flex !important; gap: 2px !important; }
.wcat-views .btn { border: 0; border-radius: 999px; min-height: 32px; padding: 0 16px; font-size: 13px; background: transparent; box-shadow: none; }
.wcat-views .btn.primary { background: var(--green); color: #fff; }
.wcat-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.wcat-toolbar input { width: 260px; max-width: 100%; }
.wcat-stats { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-secondary); margin-right: auto; }
.wcat-stats strong { color: var(--text-primary); }
.wcat-out-link { border: 0; background: none; padding: 0; font: inherit; color: var(--out); cursor: pointer; }
.wcat-out-link strong { color: var(--out); }
.wcat-out-link:hover { text-decoration: underline; }
.wcat-add-forms { animation: wcatIn 0.16s ease-out; }
@keyframes wcatIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .wcat-add-forms { animation: none; } }
.wcat-qty.zero strong { color: var(--out); }
#wcat-product-table td:nth-child(3), #del-warehouse-upload-table td:first-child { min-width: 240px; }
@media (max-width: 640px) {
  .wcat-toolbar input { width: 100%; }
  .wcat-views { display: flex !important; width: 100%; }
  .wcat-views .btn { flex: 1; padding: 0 8px; }
}
/* store catalog: the two upload cards side by side */
.store-upload-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; align-items: stretch; }
.store-upload-row > .card { margin-bottom: 0 !important; }
@media (max-width: 900px) { .store-upload-row { grid-template-columns: 1fr; } }
/* upload / import progress */
.import-progress { margin-top: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: #fff; }
.import-line { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-bottom: 8px; }
.import-line span { color: var(--text-secondary); }
.import-bar { height: 8px; border-radius: 4px; background: #EEF0F2; overflow: hidden; position: relative; }
.import-bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width 0.2s ease; }
.import-bar.busy i { width: 35%; position: absolute; animation: importBusy 1.2s ease-in-out infinite; }
@keyframes importBusy { 0% { left: -35%; } 100% { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .import-bar.busy i { animation: none; width: 100%; opacity: 0.5; } }

/* ---- Dashboard: sales breakdown (admin-explore.js) ---- */
.ex-root { margin-top: 16px; transition: opacity 0.15s ease; }
.ex-root.ex-loading { opacity: 0.55; pointer-events: none; }
.ex h3 { margin: 0; }
.ex-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ex-head p { margin: 4px 0 0; font-size: 12.5px; }
.ex-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-top: 16px; padding: 14px; background: #F7F8F9; border: 1px solid var(--border); border-radius: 10px; }
.ex-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ex-flabel { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.ex-chain { margin: 0; }
.ex-field select, .ex-field input { min-width: 220px; max-width: 100%; }
.ex-brand-wrap { position: relative; display: inline-flex; }
.ex-brand-wrap input { padding-right: 30px; }
.ex-x { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); border: 0; background: none; font-size: 18px; line-height: 1; color: var(--text-secondary); cursor: pointer; padding: 4px 6px; border-radius: 6px; }
.ex-x:hover { color: var(--text-primary); background: #ECEEF0; }
.ex-err { font-size: 12px; color: var(--out); max-width: 260px; }
.ex-reset { align-self: flex-end; }
.ex-showing { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: 13px; color: var(--text-secondary); }
.ex-showing strong { color: var(--text-primary); }
.ex-chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--text-primary); }
.ex-chip:hover { border-color: var(--out); color: var(--out); }
.ex-kpis { display: grid; grid-template-columns: minmax(0, 1.7fr) repeat(5, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.ex-kpi { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.ex-kpi-main { background: #F4FBF7; border-color: #CBEBD9; }
.ex-v { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; margin-top: 4px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ex-kpi-main .ex-v { font-size: 28px; }
.ex-of { font-size: 13px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0; }
.ex-s { font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.ex-mid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; margin-top: 12px; }
.ex-chart-card, .ex-find-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.ex-sub-h { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.ex-chart { height: 240px; position: relative; }
.ex-findings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.ex-f { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; line-height: 1.45; padding: 7px 8px; border-radius: 8px; }
.ex-f[role="button"] { cursor: pointer; }
.ex-f[role="button"]:hover, .ex-f[role="button"]:focus-visible { background: #F4F5F6; outline: none; }
.ex-ic { flex: 0 0 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 800; margin-top: 1px; }
.ex-f.up .ex-ic { background: var(--ok-bg); color: var(--ok); }
.ex-f.down .ex-ic { background: var(--out-bg); color: var(--out); }
.ex-f.warn .ex-ic { background: #FFF4E5; color: #B54708; }
.ex-f.idea .ex-ic { background: #EAF2FD; color: #1D5FB8; }
.ex-f.info .ex-ic { background: #F0F1F3; color: var(--text-secondary); }
.ex-more-btn { margin-top: 6px; }
.ex-chains { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.ex-chainrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 10px 14px; font: inherit; font-size: 13px; cursor: pointer; text-align: left; flex: 1 1 280px; }
.ex-chainrow:hover { border-color: var(--green); }
.ex-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.ex-tabs { margin: 0; }
.ex-count { font-weight: 500; opacity: 0.75; margin-left: 2px; }
.ex-hint { font-size: 12px; }
.ex-table-wrap { margin-top: 10px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ex { min-width: 0; }
.ex-table th.num, .ex-table td.num { text-align: right; white-space: nowrap; }
.ex-sort { border: 0; background: none; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; padding: 0; text-transform: inherit; letter-spacing: inherit; }
.ex-sort.on { color: var(--green-text); }
.ex-row { cursor: pointer; }
.ex-row:hover td, .ex-row:focus-visible td { background: #F6FAF8; }
.ex-row:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.ex-small { font-size: 11.5px; }
.ex-flag { color: #B54708; font-weight: 700; margin-left: 2px; cursor: help; }
.ex-share { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.ex-share-bar { width: 64px; height: 6px; background: #EEF0F2; border-radius: 3px; overflow: hidden; display: inline-block; }
.ex-share-bar span { display: block; height: 100%; background: var(--green); border-radius: 3px; }
.ex-more-row { padding: 10px 0 2px; text-align: center; }
.ex-foot { font-size: 11.5px; margin: 12px 0 0; line-height: 1.5; }
@media (max-width: 1280px) {
  .ex-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ex-kpi-main { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .ex-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ex-kpi-main { grid-column: 1 / -1; }
  .ex-mid { grid-template-columns: 1fr; }
  .ex-field, .ex-field select, .ex-field input, .ex-brand-wrap { width: 100%; min-width: 0; }
  .ex-brand-field { flex: 1 1 100%; }
}
@media (max-width: 520px) {
  .ex-share-bar { display: none; }
}

/* =========================================================================
   Look v2 — calmer, softer, quicker-feeling. Only appearance and motion:
   no element is moved or hidden here, every page keeps the same controls.
   Grey canvas, borderless white cards with big corners, black pills for
   "you are here", brand green for actions-that-matter and good numbers.
   ========================================================================= */
:root {
  --page: #EEF0F3;
  --content-bg: #EEF0F3;
  --hover: #F6F7F9;
  --border: #E8EAEE;
  --border-strong: #D5D8DE;
  --radius: 18px;
  --radius-control: 12px;
  --radius-nav: 12px;
  --radius-modal: 20px;
  --line: #EFF1F4;
  --ink: #111111;
  --card-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 1px rgba(16, 24, 40, 0.02);
  --lift-shadow: 0 10px 24px -8px rgba(16, 24, 40, 0.16), 0 2px 6px rgba(16, 24, 40, 0.05);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --lime: #111111; /* older pages use this for "selected" */
}
body { background: var(--page); }

/* ---- shell: the rail sits on the canvas, no hard lines */
.sidebar { background: var(--page); border-right: 0; padding: 20px 14px; }
.rail-brand { border-bottom: 0; padding-bottom: 14px; }
.nav-group-header { font-size: 11px; letter-spacing: 0.08em; padding: 12px 12px 6px; }
.nav-group.has-active .nav-group-header { color: var(--ink); }
.nav-item { min-height: 40px; border-radius: 999px; color: #2B2F36; transition: background 0.16s var(--ease), color 0.16s var(--ease); }
.nav-item:hover { background: rgba(17, 17, 17, 0.05); }
.nav-item.active { background: var(--ink); color: #fff; box-shadow: 0 6px 14px -6px rgba(17, 17, 17, 0.45); }
.nav-item.active .ti { color: #fff; }
.sidebar-footer { border-top: 0; }
.topbar { background: rgba(238, 240, 243, 0.82); border-bottom: 0; backdrop-filter: saturate(1.5) blur(12px); }
.topbar .search input { background: #fff; box-shadow: var(--card-shadow); }
.topbar .search input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08); }
.bell { border: 0; box-shadow: var(--card-shadow); }
.user-chip .avatar { box-shadow: 0 0 0 2px #fff; }
.page-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.03em; }
.page-header .subtext { font-size: 13.5px; }

/* ---- cards */
.card { border: 1px solid rgba(17, 17, 17, 0.035); box-shadow: var(--card-shadow); }
.card h3 { font-size: 15.5px; letter-spacing: -0.015em; }
.table-card .table-head { border-bottom-color: var(--line); padding: 18px 22px; }
.stat-card .stat-value { font-size: 30px; letter-spacing: -0.035em; }
.stat-card[onclick]:hover, .stat-card[style*='cursor:pointer']:hover { border-color: rgba(17, 17, 17, 0.035); box-shadow: var(--lift-shadow); transform: translateY(-2px); }
.stat-card { transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }

/* ---- tables: lighter lines, quieter header */
table.data-table th { background: transparent; color: #7A808A; font-weight: 600; font-size: 11px; letter-spacing: 0.06em; border-bottom-color: var(--line); padding: 12px 16px; }
table.data-table td { border-bottom-color: var(--line); padding: 13px 16px; }
table.data-table tbody tr:hover td { background: #F8F9FB; }

/* ---- buttons: pills; primary = ink */
.btn { border-radius: 999px; padding: 8px 18px; transition: background 0.15s var(--ease), border-color 0.15s var(--ease), color 0.15s var(--ease), transform 0.12s var(--ease), box-shadow 0.15s var(--ease); }
.btn.sm { padding: 4px 12px; }
.btn.icon { padding: 0; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--ink); border-color: var(--ink); box-shadow: 0 6px 14px -8px rgba(17, 17, 17, 0.6); }
.btn.primary:hover { background: #2A2D33; border-color: #2A2D33; }
.btn.primary:active { background: #000; border-color: #000; }
.btn.selected { background: #F1F2F4; border-color: var(--ink); color: var(--ink); }
#app-modal-root .app-modal-footer button { border-radius: 999px; }
#app-modal-root .app-modal-footer button.am-primary { background: var(--ink); border-color: var(--ink); }
#app-modal-root .app-modal-footer button.am-primary:hover { background: #2A2D33; }

/* ---- inputs */
.form-row input, .form-row select, .form-row textarea,
.content input[type='text'], .content input[type='number'], .content input[type='search'], .content input[type='email'],
.content input[type='password'], .content input[type='date'], .content input[type='tel'], .content input:not([type]),
.content select, .content textarea, select.period-select, select.selector {
  border-radius: var(--radius-control);
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus,
.content input:focus, .content select:focus, .content textarea:focus,
.app-modal input:focus, .app-modal select:focus, .app-modal textarea:focus, select.selector:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}
:focus-visible { outline-color: var(--ink); }

/* ---- pills, tabs, segmented controls: black = selected */
.pill-tab { border-color: var(--border); transition: background 0.16s var(--ease), color 0.16s var(--ease), border-color 0.16s var(--ease); }
.pill-tab.active, .pill-tabs.seg .pill-tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.pill-tabs.seg { border: 0; box-shadow: var(--card-shadow); }
.pill-tabs.seg .pill-tab:focus-visible { outline-color: var(--ink); }
.brand-pill:hover { border-color: var(--ink); color: var(--ink); }

/* ---- dashboard */
.ov-big { font-size: 46px; letter-spacing: -0.045em; }
.ov-mid { font-size: 28px; letter-spacing: -0.035em; }
.ov-pill { border: 1px solid rgba(17, 17, 17, 0.035); box-shadow: var(--card-shadow); border-radius: 16px; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.ov-risk { transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.ov-risk:hover, .ov-pill:hover { border-color: rgba(17, 17, 17, 0.035); box-shadow: var(--lift-shadow); transform: translateY(-2px); }
/* the one coloured card: profit */
.ov-profit { background: linear-gradient(140deg, #00B259 0%, #008A43 58%, #006E36 100%); border-color: transparent; color: #fff; box-shadow: 0 16px 32px -18px rgba(0, 120, 60, 0.75); position: relative; overflow: hidden; }
.ov-profit::after { content: ''; position: absolute; right: -60px; top: -70px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 70%); pointer-events: none; }
.ov-profit .ov-label, .ov-profit .ov-sub, .ov-profit .ov-risk-lines, .ov-profit .text-muted { color: rgba(255, 255, 255, 0.82); }
.ov-profit .ov-risk-lines strong, .ov-profit .ov-mid, .ov-profit .neg { color: #fff; }
.ov-profit.neg { background: linear-gradient(140deg, #3A3F47 0%, #1E2126 100%); box-shadow: 0 16px 32px -18px rgba(0, 0, 0, 0.7); }
.ov-chip { border-radius: 50%; }
.ov-reports { border-left: 0; }
.ex-kpi, .ex-chart-card, .ex-find-card { border-color: var(--line); border-radius: 14px; }
.ex-kpi-main { background: #F2FAF5; border-color: #D6EFE0; }
.ex-filters { background: #F6F7F9; border: 0; border-radius: 14px; }
.ex-chainrow { border-color: var(--line); border-radius: 14px; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
.ex-chainrow:hover { border-color: var(--line); box-shadow: var(--lift-shadow); transform: translateY(-1px); }
.ex-sort.on { color: var(--ink); }
.ex-share-bar span { background: var(--ink); }
.ex-chip:hover { border-color: var(--ink); color: var(--ink); }

/* ---- tiles that open something lift a little */
.brand-tile, .ops-tile, .catalog-card { transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease), border-color 0.18s var(--ease); }
.brand-tile { border-color: rgba(17, 17, 17, 0.035) !important; box-shadow: var(--card-shadow); border-radius: var(--radius) !important; }
.brand-tile:hover { box-shadow: var(--lift-shadow) !important; transform: translateY(-3px) !important; }

/* ---- motion: pages ease in, content fades in as it arrives */
@keyframes v2-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes v2-fade { from { opacity: 0; } to { opacity: 1; } }
section[id^='section-']:not(.hidden) { animation: v2-enter 0.26s var(--ease) both; }
.ov-root > *, .ex > * { animation: v2-fade 0.3s var(--ease) both; }
.ov-root > :nth-child(2) { animation-delay: 0.03s; }
.ov-root > :nth-child(3) { animation-delay: 0.06s; }
.ov-root > :nth-child(4) { animation-delay: 0.09s; }

/* ---- loading placeholders instead of "Loading…" text */
.v2-skel { display: grid; gap: 16px; }
.v2-skel-row { display: grid; grid-template-columns: 1.75fr 1fr; gap: 16px; }
.v2-skel-block { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow); padding: 22px; display: grid; gap: 12px; align-content: start; }
.v2-skel-line { height: 12px; border-radius: 999px; background: linear-gradient(90deg, #EEF0F3 0%, #F7F8FA 40%, #EEF0F3 80%) 0 0 / 300% 100%; animation: v2-shimmer 1.4s ease-in-out infinite; }
.v2-skel-line.big { height: 34px; width: 46%; border-radius: 10px; }
.v2-skel-line.w60 { width: 60%; }
.v2-skel-line.w40 { width: 40%; }
.v2-skel-line.chart { height: 190px; border-radius: 12px; }
@keyframes v2-shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (max-width: 900px) { .v2-skel-row { grid-template-columns: 1fr; } }

/* ---- phones & tablets keep their layouts; just the softer surface */
@media (max-width: 820px) {
  .sidebar { background: rgba(238, 240, 243, 0.92); backdrop-filter: saturate(1.5) blur(12px); border-bottom: 0; }
  .topbar { background: transparent; }
  .page-header h1 { font-size: 23px; }
  .ov-big { font-size: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  section[id^='section-']:not(.hidden), .ov-root > *, .ex > * { animation: none; }
  .v2-skel-line { animation: none; }
}
.ov-root { transition: opacity 0.18s var(--ease); }
.ov-root.ov-loading { opacity: 0.55; pointer-events: none; }
.wcat-views { border: 0; box-shadow: var(--card-shadow); }
.wcat-views .btn.primary { background: var(--ink); color: #fff; box-shadow: none; }
/* the sales card fills its column, the chart takes the spare height */
.ov-sales { display: flex; flex-direction: column; }
.ov-sales .ov-chart { flex: 1 1 auto; min-height: 210px; }
/* orders & warehouse tiles: a small amber dot instead of a side stripe */
.ops-tile { border-left: 1px solid rgba(17, 17, 17, 0.035); position: relative; border-radius: 16px; }
.ops-tile.hot { border-left-color: rgba(17, 17, 17, 0.035); }
.ops-tile.hot::after { content: ''; position: absolute; top: 14px; right: 14px; width: 8px; height: 8px; border-radius: 50%; background: #F59E0B; box-shadow: 0 0 0 3px #FEF3C7; }
.ops-tile:hover { border-color: rgba(17, 17, 17, 0.035); border-left-color: rgba(17, 17, 17, 0.035); box-shadow: var(--lift-shadow); transform: translateY(-2px); }
.ops-tile:focus-visible { outline-color: var(--ink); }
.ov-reports { background: #FFFBF0; border-color: #FBE7BE; }

/* =========================================================================
   Look v3 — rail + top tabs (built by ui.js on body.v3). Same pages, same
   controls; only where they sit and how they look changes. If ui.js does
   not run, none of this applies and the old sidebar stays.
   ========================================================================= */
:root {
  --sel: #078A45;
  --sel-hover: #06753B;
  --sel-soft: #E3F5EA;
  --sel-ring: rgba(7, 138, 69, 0.22);
  --deep: #0D3322;
  --page: #ECF0EE;
  --content-bg: #ECF0EE;
  --radius: 20px;
  --rail-w: 84px;
  --lime: #078A45;
  --green-ring: rgba(7, 138, 69, 0.22);
}
body { background: var(--page); }

/* ---------- desktop shell */
@media (min-width: 821px) {
  body.v3 .sidebar { width: var(--rail-w); padding: 14px 0 18px; align-items: center; gap: 14px; background: transparent; overflow: visible; border: 0; z-index: 80; }
  body.v3 .rail-brand, body.v3 .sidebar .logo, body.v3 .sidebar-footer, body.v3 .nav-label { display: none !important; }
  body.v3 .v3-mark { display: grid; }
  body.v3.v3-wing .sidebar { width: 0; padding: 0; }
  body.v3.v3-wing .v3-mark { display: none; }

  /* admin rail: two white capsules of round icon buttons */
  body.v3-admin .sidebar > .nav-section, body.v3-admin .v3-stack {
    margin: 0; background: #fff; border-radius: 28px; padding: 8px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  }
  body.v3-admin .sidebar > .nav-section .nav-item, body.v3-admin .nav-group-header {
    width: 48px; height: 48px; min-height: 48px; padding: 0; margin: 0; border-radius: 50%; justify-content: center;
    position: relative; color: #4A505B; background: transparent; box-shadow: none; font-weight: 600;
  }
  body.v3-admin .sidebar > .nav-section .nav-item .nav-text, body.v3-admin .nav-group-header > span, body.v3-admin .sidebar > .nav-section .badge-count { display: none; }
  body.v3-admin .sidebar > .nav-section .nav-item .ti, body.v3-admin .nav-group-header .v3-gicon { font-size: 21px; color: inherit; display: inline-block; }
  body.v3-admin .sidebar > .nav-section .nav-item:hover, body.v3-admin .nav-group-header:hover { background: #F1F4F2; color: #111; }
  body.v3-admin .sidebar > .nav-section .nav-item.active, body.v3-admin .nav-group.v3-shown .nav-group-header, body.v3-admin .nav-group.has-active .nav-group-header {
    background: var(--sel); color: #fff; box-shadow: 0 8px 18px -8px rgba(7, 138, 69, 0.75);
  }
  body.v3-admin .nav-group { margin: 0; }
  body.v3-admin .nav-group-header .nav-arrow { display: none; }
  body.v3-admin [data-tip]:hover::after, body.v3-admin [data-tip]:focus-visible::after {
    content: attr(data-tip); position: absolute; left: 60px; top: 50%; transform: translateY(-50%); background: var(--deep); color: #fff;
    font-size: 12px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; pointer-events: none; z-index: 200; letter-spacing: 0; text-transform: none;
  }
  body.v3 .main { padding-left: 4px; }
  body.v3.v3-wing .main { padding-left: 0; }
}
.v3-mark { display: none; width: 48px; height: 48px; border-radius: 16px; background: var(--deep); color: #fff; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: -0.04em; flex-shrink: 0; }
.v3-mark i { font-style: normal; color: #3DDC84; }

/* the tabs: the current area's own menu items, shown as pills in the top bar */
body.v3 .nav-group-items { display: none; max-height: none; overflow: visible; }
body.v3 .v3-tabs-src {
  display: flex !important; position: fixed; z-index: 75; top: var(--tabs-t, 14px); height: var(--tabs-h, 48px);
  left: calc(var(--tabs-l, 300px) + var(--tabs-w, 600px) / 2); transform: translateX(-50%); width: max-content; max-width: var(--tabs-w, 600px);
  align-items: center; gap: 2px; padding: 4px; margin: 0; background: #fff; border-radius: 999px; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
body.v3 .v3-tabs-src::-webkit-scrollbar { display: none; }
body.v3 .v3-tabs-src .nav-item {
  min-height: 0; height: 100%; padding: 0 16px; margin: 0; border-radius: 999px; white-space: nowrap; gap: 6px;
  font-size: 13.5px; font-weight: 600; color: #4A505B; background: transparent; box-shadow: none; flex-shrink: 0;
}
body.v3 .v3-tabs-src .nav-item .ti { display: none; }
body.v3 .v3-tabs-src .nav-item .nav-text { flex: none; }
body.v3 .v3-tabs-src .nav-item:hover { background: #F1F4F2; color: #111; }
body.v3 .v3-tabs-src .nav-item.active { background: var(--sel); color: #fff; box-shadow: none; }
body.v3 .v3-tabs-src .nav-item.active .nav-badge, body.v3 .v3-tabs-src .nav-item.active .badge-count { background: rgba(255, 255, 255, 0.25); color: #fff; }
body.v3 .v3-tabs-src .nav-item.hidden { display: none !important; }
body.v3 .v3-tabs-src .nav-label { display: none; }

/* ---------- top bar */
body.v3 .topbar { height: 76px; padding: 14px 28px 14px 12px; gap: 16px; background: rgba(236, 240, 238, 0.88); border: 0; backdrop-filter: saturate(1.4) blur(14px); }
body.v3.v3-wing .topbar { padding-left: 28px; }
body.v3 .topbar-title { display: flex; align-items: center; gap: 12px; max-width: none; flex-shrink: 0; }
body.v3 .topbar-title .v3-logos { display: flex; align-items: center; gap: 8px; }
body.v3 .topbar-title .v3-logos img { height: 24px; width: auto; max-width: 96px; object-fit: contain; display: block; }
body.v3 .topbar-title .v3-sep { width: 1px; height: 20px; background: #CDD3CF; }
body.v3 .topbar-title .tt-main { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
body.v3 .topbar-title .tt-sub { display: none !important; }
body.v3 .v3-tabs-slot { flex: 1 1 auto; min-width: 0; height: 48px; }
body.v3 .role-pill { display: none; }
body.v3 .topbar .search { flex: 0 0 auto; max-width: none; }
body.v3 .topbar .search[data-ui-done] { width: 48px; }
body.v3 .topbar .search[data-ui-done] input { width: 48px; height: 48px; padding: 0; border-radius: 50%; color: transparent; cursor: pointer; background: #fff; border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .topbar .search[data-ui-done] input::placeholder { color: transparent; }
body.v3 .topbar .search[data-ui-done]::before { left: 50%; transform: translate(-50%, -50%); width: 18px; height: 18px; z-index: 1; }
body.v3 .topbar .search[data-ui-done] .search-kbd { display: none; }
body.v3 .topbar .search:not([data-ui-done]) { width: 260px; }
body.v3 .topbar .search:not([data-ui-done]) input { height: 46px; background: #fff; border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .bell { width: 48px; height: 48px; border: 0; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .topbar .user-chip { background: #fff; border-radius: 999px; padding: 5px 16px 5px 5px; gap: 10px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .topbar .user-chip .avatar { width: 38px; height: 38px; background: var(--sel-soft); color: var(--sel); box-shadow: none; }
body.v3.ui-ready .topbar .user-chip .meta { display: block; }
body.v3 .user-chip .name { font-size: 13px; font-weight: 700; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.v3 .user-chip .role { font-size: 11.5px; color: #8A909B; }
body.v3 .topbar select.selector { height: 46px; border-radius: 999px; border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .content { padding: 18px 28px 64px 12px; max-width: none; }
body.v3.v3-wing .content { padding-left: 28px; max-width: 1560px; margin: 0 auto; }

/* ---------- surfaces & controls in green */
body.v3 .card { border-radius: var(--radius); border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .page-header { margin: 6px 0 20px; align-items: flex-end; }
body.v3 .page-header h1 { font-size: 32px; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 6px; }
body.v3 .page-header .subtext { color: #7B828C; }
body.v3 .btn.primary, body.v3 .btn.dark { background: var(--sel); border-color: var(--sel); color: #fff; box-shadow: 0 8px 18px -10px rgba(7, 138, 69, 0.85); }
body.v3 .btn.primary:hover, body.v3 .btn.dark:hover { background: var(--sel-hover); border-color: var(--sel-hover); }
body.v3 .btn.primary:active, body.v3 .btn.dark:active { background: #05652F; border-color: #05652F; }
body.v3 .btn { border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), inset 0 0 0 1px #E3E7E5; }
body.v3 .btn.danger { box-shadow: inset 0 0 0 1px var(--danger-border); }
body.v3 .btn.selected { background: var(--sel-soft); color: var(--sel); box-shadow: inset 0 0 0 1.5px var(--sel); }
body.v3 #app-modal-root .app-modal-footer button.am-primary { background: var(--sel); border-color: var(--sel); }
body.v3 .pill-tab.active, body.v3 .pill-tabs.seg .pill-tab.active { background: var(--sel); border-color: var(--sel); color: #fff; }
body.v3 .pill-tabs.seg { background: #fff; padding: 4px; }
body.v3 .pill-tabs.seg .pill-tab { height: 34px; padding: 0 15px; font-size: 13px; }
body.v3 .wcat-views .btn.primary { background: var(--sel); }
body.v3 .switch input:checked + .switch-track { background: var(--sel); }
body.v3 input[type='checkbox'], body.v3 input[type='radio'] { accent-color: var(--sel); }
body.v3 .form-row input:focus, body.v3 .form-row select:focus, body.v3 .form-row textarea:focus,
body.v3 .content input:focus, body.v3 .content select:focus, body.v3 .content textarea:focus { border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel-ring); }
body.v3 :focus-visible { outline-color: var(--sel); }
body.v3 .ex-share-bar span { background: var(--sel); }
body.v3 .ex-sort.on { color: var(--sel); }
body.v3 table.data-table th { color: #7B828C; text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; }
body.v3 .stat-card .stat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.04em; }
body.v3 .stat-card .stat-head { color: #7B828C; font-weight: 600; }

/* brand tiles (catalog & store ordering): left-aligned cards with a monogram badge */
body.v3 .brand-tile { text-align: left; padding: 18px !important; border-radius: 20px !important; display: flex; flex-direction: column; gap: 10px; min-height: 150px; }
body.v3 .brand-tile .logo-circle { margin: 0 !important; border-radius: 14px !important; width: 50px !important; height: 50px !important; }
body.v3 .brand-tile:hover { transform: translateY(-3px); }

/* ---------- motion */
body.v3 .v3-tabs-src .nav-item { transition: background 0.18s var(--ease), color 0.18s var(--ease); }

/* ---------- phones: menu becomes a bottom dock */
@media (max-width: 820px) {
  body.v3 .app-shell { flex-direction: column; }
  body.v3 .topbar { position: sticky; top: 0; z-index: 70; height: auto; flex-wrap: wrap; padding: 10px 14px 8px; gap: 10px; }
  body.v3 .topbar-title { order: 1; flex: 1; min-width: 0; }
  body.v3 .topbar-title .tt-main { display: none; }
  body.v3 .topbar-title .v3-sep { display: none; }
  body.v3 .topbar-right { order: 2; gap: 8px; }
  body.v3 .topbar .search { order: 2; }
  body.v3 .topbar .search:not([data-ui-done]) { order: 4; width: 100%; flex-basis: 100%; }
  body.v3 .v3-tabs-slot { order: 3; flex: 0 0 100%; height: 44px; }
  body.v3.v3-wing .v3-tabs-slot { display: none; }
  body.v3 .topbar .user-chip { padding: 3px; }
  body.v3.ui-ready .topbar .user-chip .meta { display: none; }
  body.v3 .bell, body.v3 .topbar .search[data-ui-done], body.v3 .topbar .search[data-ui-done] input { width: 42px; height: 42px; }
  body.v3 .topbar .user-chip .avatar { width: 36px; height: 36px; }
  body.v3 .content { padding: 12px 14px 112px; }
  body.v3 .v3-tabs-src { left: var(--tabs-l, 14px); transform: none; max-width: var(--tabs-w, calc(100vw - 28px)); height: var(--tabs-h, 44px); }
  body.v3 .v3-tabs-src .nav-item { padding: 0 13px; font-size: 13px; }

  /* the dock */
  body.v3.v3-admin .sidebar, body.v3.v3-wing .v3-tabs-src {
    position: fixed; left: 10px; right: 10px; bottom: 10px; top: auto; transform: none; width: auto; max-width: none; height: 68px;
    z-index: 90; display: flex !important; flex-direction: row; align-items: center; gap: 4px; padding: 8px; margin: 0;
    background: var(--deep); border: 0; border-radius: 26px; overflow-x: auto; overflow-y: hidden; box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.55);
  }
  body.v3.v3-admin .sidebar .rail-brand, body.v3.v3-admin .sidebar-footer, body.v3 .v3-mark { display: none !important; }
  body.v3.v3-admin .sidebar > .nav-section, body.v3.v3-admin .v3-stack { display: flex; flex-direction: row; gap: 4px; margin: 0; padding: 0; background: none; flex-shrink: 0; }
  body.v3.v3-admin .sidebar > .nav-section .nav-item, body.v3.v3-admin .nav-group-header {
    width: 52px; height: 52px; min-height: 52px; padding: 0; margin: 0; border-radius: 50%; justify-content: center; color: rgba(255, 255, 255, 0.72); background: none; flex-shrink: 0;
  }
  body.v3.v3-admin .sidebar > .nav-section .nav-item .nav-text, body.v3.v3-admin .nav-group-header > span { display: none; }
  body.v3.v3-admin .nav-group-header .v3-gicon, body.v3.v3-admin .sidebar > .nav-section .nav-item .ti { font-size: 22px; display: inline-block; color: inherit; }
  body.v3.v3-admin .sidebar > .nav-section .nav-item.active, body.v3.v3-admin .nav-group.v3-shown .nav-group-header, body.v3.v3-admin .nav-group.has-active .nav-group-header { background: #fff; color: var(--sel); }
  body.v3.v3-admin .nav-group { margin: 0; display: block; }
  body.v3.v3-wing .v3-tabs-src .nav-item { flex-direction: column; justify-content: center; gap: 3px; min-width: 66px; height: 52px; padding: 0 8px; border-radius: 18px; color: rgba(255, 255, 255, 0.72); font-size: 10.5px; font-weight: 600; }
  body.v3.v3-wing .v3-tabs-src .nav-item .ti { display: inline-block; font-size: 21px; color: inherit; }
  body.v3.v3-wing .v3-tabs-src .nav-item .nav-text { max-width: 76px; overflow: hidden; text-overflow: ellipsis; }
  body.v3.v3-wing .v3-tabs-src .nav-item.active { background: #fff; color: var(--sel); }
  body.v3 .page-header h1 { font-size: 25px; }
  body.v3 .toast-stack { bottom: 92px; top: auto; }
}
@media print {
  body.v3 .v3-tabs-src, body.v3 .sidebar { display: none !important; }
}
body.v3 .v3-hidden-nav { display: none !important; }
body.v3 .v3-vendor-tabs { margin: 0; flex-wrap: nowrap; }
body.v3 .v3-tabs-src .pill-tab {
  height: 100%; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; white-space: nowrap; flex-shrink: 0;
  font-size: 13.5px; font-weight: 600; color: #4A505B; display: inline-flex; align-items: center; gap: 6px;
}
body.v3 .v3-tabs-src .pill-tab .ti { display: none; }
body.v3 .v3-tabs-src .pill-tab:hover { background: #F1F4F2; color: #111; }
body.v3 .v3-tabs-src .pill-tab.active { background: var(--sel); color: #fff; }
.v3-subtabs { display: none; }
body.v3 .v3-subtabs.v3-tabs-src button, body.v3 .v3-subtabs.v3-tabs-src a {
  height: 100%; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; white-space: nowrap; flex-shrink: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; font-weight: 600; color: #4A505B; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
body.v3 .v3-subtabs.v3-tabs-src button:hover { background: #F1F4F2; color: #111; }
body.v3 .v3-subtabs.v3-tabs-src button.on { background: var(--sel); color: #fff; }
.v3-subtabs .v3-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #FDE7E3; color: #B42318; font-size: 11px; font-weight: 700; }
.v3-subtabs button.on .v3-badge { background: rgba(255, 255, 255, 0.25); color: #fff; }
@media (max-width: 820px) {
  body.v3.v3-wing .v3-tabs-src .pill-tab { flex-direction: column; justify-content: center; gap: 3px; min-width: 76px; height: 52px; padding: 0 8px; border-radius: 18px; color: rgba(255, 255, 255, 0.72); font-size: 10.5px; }
  body.v3.v3-wing .v3-tabs-src .pill-tab .ti { display: inline-block; font-size: 21px; }
  body.v3.v3-wing .v3-tabs-src .pill-tab.active { background: #fff; color: var(--sel); }
  body.v3 .v3-subtabs.v3-tabs-src { left: var(--tabs-l, 14px); transform: none; }
}
.v3-mark { display: none; }
body.v3 .v3-mark { align-items: center; justify-content: center; }
@media (min-width: 821px) { body.v3-admin .v3-mark { display: flex; } }
body.v3 .v3-tabs-src.v3-overflow { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%); }
@media (min-width: 821px) and (max-width: 1360px) {
  body.v3 .v3-tabs-src .nav-item, body.v3 .v3-tabs-src .pill-tab, body.v3 .v3-subtabs.v3-tabs-src button { padding: 0 12px; font-size: 13px; }
  body.v3 .topbar-title .v3-logos img + img { display: none; }
}
@media (max-width: 820px) {
  body.v3.v3-admin .nav-group-header { display: flex; }
  body.v3.v3-admin .v3-stack .nav-group { display: block; }
}

/* ---------- v3 dashboard */
#section-dashboard:not([data-dtab='overview']) [data-dpane='overview'],
#section-dashboard:not([data-dtab='stores']) [data-dpane='stores'],
#section-dashboard:not([data-dtab='breakdown']) [data-dpane='breakdown'],
#section-dashboard:not([data-dtab='ops']) [data-dpane='ops'],
#section-dashboard[data-dtab='ops'] [data-dhide='ops'] { display: none !important; }
#section-dashboard [data-dpane] { animation: v2-fade 0.28s var(--ease) both; }
.v3-grid1 { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.v3-grid2 { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.v3-col { display: grid; gap: 16px; align-content: start; min-width: 0; }
body.v3 .ov-hero.v3-grid1 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr) minmax(0, 1fr); }
.v3-hero {
  background: radial-gradient(120% 140% at 0% 0%, #22C873 0%, #06A04F 38%, #05783B 100%) !important; color: #fff; padding: 24px 24px 12px !important;
  display: flex; flex-direction: column; min-height: 360px; position: relative; overflow: hidden; box-shadow: 0 22px 44px -26px rgba(5, 120, 59, 0.85) !important;
}
.v3-hero::after { content: ''; position: absolute; right: -90px; top: -110px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 70%); pointer-events: none; }
.v3-hero .ov-label { color: rgba(255, 255, 255, 0.82); }
.v3-hero .ov-big { color: #fff; font-size: 54px; font-weight: 800; letter-spacing: -0.05em; margin-top: 8px; }
.v3-hero .ov-sub { color: rgba(255, 255, 255, 0.86); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.v3-hchip { background: rgba(255, 255, 255, 0.2); color: #fff; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; }
.v3-hero-top { display: flex; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.v3-split { display: flex; gap: 22px; text-align: right; flex-shrink: 0; }
.v3-split-i small { display: block; color: rgba(255, 255, 255, 0.75); font-size: 11.5px; font-weight: 600; }
.v3-split-i strong { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.v3-split-i .v3-g { color: #fff; opacity: 0.9; }
.v3-hero .ov-chart { flex: 1 1 auto; min-height: 200px; margin: 14px -8px 0; position: relative; z-index: 1; }
.v3-k { display: flex; flex-direction: column; gap: 4px; }
.v3-k-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.v3-k-head .ti { color: var(--sel); font-size: 19px; opacity: 0.85; }
.v3-k .ov-mid { font-size: 31px; font-weight: 800; letter-spacing: -0.04em; margin-top: 4px; }
.v3-k .ov-mid.neg, .v3-k .ov-mid .neg { color: var(--out); }
.v3-k-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.v3-ring { width: 66px; height: 66px; flex-shrink: 0; }
.v3-ring text { font: 700 13px Inter, sans-serif; fill: #111; }
.v3-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; vertical-align: 1px; }
.v3-k .ov-risk-lines span { align-items: center; }
.v3-k .ov-risk-lines span > :first-child { margin-right: auto; }
.v3-stackbar { display: flex; gap: 3px; height: 8px; margin: 10px 0 4px; border-radius: 999px; overflow: hidden; }
.v3-stackbar span { border-radius: 999px; min-width: 4px; }
.v3-chip { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.v3-chip.amber { background: #FEF3DB; color: #A35F00; }
.v3-chip.green { background: var(--sel-soft); color: var(--sel); }
body.v3 .ov-profit { background: #fff; color: inherit; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .ov-profit::after { display: none; }
body.v3 .ov-profit .ov-label, body.v3 .ov-profit .ov-sub, body.v3 .ov-profit .ov-risk-lines, body.v3 .ov-profit .text-muted { color: var(--text-secondary); }
body.v3 .ov-profit .ov-risk-lines strong { color: var(--text-primary); }
body.v3 .ov-profit .ov-mid { color: var(--text-primary); }
body.v3 .ov-profit.neg { background: #fff; }
.v3-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.v3-card-h h3 { margin: 0 !important; font-size: 16px; letter-spacing: -0.02em; }
.v3-link { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--sel); cursor: pointer; padding: 4px 6px; border-radius: 8px; }
.v3-link:hover { background: var(--sel-soft); }
.v3-rk { display: grid; grid-template-columns: minmax(0, 1fr) 30% auto; gap: 12px; align-items: center; font-size: 13.5px; padding: 8px 8px; margin: 0 -8px; border-radius: 12px; cursor: pointer; }
.v3-rk:hover, .v3-rk:focus-visible { background: #F4F7F5; outline: none; }
.v3-rk b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v3-bar { height: 7px; background: #EFF2F0; border-radius: 999px; overflow: hidden; }
.v3-bar span { display: block; height: 100%; border-radius: 999px; }
.v3-rk em { font-style: normal; font-weight: 700; text-align: right; white-space: nowrap; }
.v3-g { font-size: 11.5px; font-weight: 700; }
.v3-g.up { color: #0E9F50; }
.v3-g.down { color: var(--out); }
.v3-today { display: flex; flex-direction: column; gap: 10px; }
.v3-today .v3-card-h { margin-bottom: 2px; }
.v3-td { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 16px; background: #F4F7F5; cursor: pointer; transition: background 0.16s var(--ease), transform 0.16s var(--ease); }
.v3-td:hover, .v3-td:focus-visible { background: #EAF4EE; outline: none; transform: translateX(2px); }
.v3-tic { width: 38px; height: 38px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: var(--sel); flex-shrink: 0; }
.v3-tic .ti { font-size: 19px; }
.v3-tx { flex: 1; min-width: 0; }
.v3-tx b { display: block; font-size: 13.5px; }
.v3-tx small { color: var(--text-secondary); font-size: 12px; }
.v3-val { font-size: 21px; font-weight: 800; letter-spacing: -0.03em; }
.v3-val small { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.v3-val.red { color: var(--out); }
.v3-find .ex-f { font-size: 13.5px; }
.v3-find .v2-skel-line { height: 14px; }
@media (max-width: 1280px) {
  .v3-grid1, body.v3 .ov-hero.v3-grid1 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .v3-grid1 .v3-hero { grid-column: 1 / -1; }
  .v3-grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .v3-grid2 .v3-today { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  .v3-grid1, body.v3 .ov-hero.v3-grid1, .v3-grid2 { grid-template-columns: 1fr; }
  .v3-hero { min-height: 0; }
  .v3-hero .ov-big { font-size: 40px; }
  .v3-hero-top { flex-direction: column; }
  .v3-split { text-align: left; }
  .v3-hero .ov-chart { min-height: 170px; }
}
.v3-k .ov-risk-lines span { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; align-items: center; justify-content: stretch; }
.v3-k .ov-risk-lines span > :first-child { margin-right: 0; }
.v3-hero .v3-split-i .v3-g, .v3-hero .v3-split-i .v3-g.down, .v3-hero .v3-split-i .v3-g.up { color: rgba(255, 255, 255, 0.9); }

/* ---------- v3: store ordering & wholesale buying */
body.v3 .cart-fab {
  left: 50%; right: auto; bottom: 24px; transform: translateX(-50%); background: var(--deep); color: #fff; padding: 15px 26px; border-radius: 999px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, 0.55); font-size: 14.5px; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
body.v3 .cart-fab::after { content: '›'; margin-left: 12px; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: var(--deep); font-weight: 800; vertical-align: middle; }
body.v3 .cart-fab:hover { transform: translateX(-50%) translateY(-2px); }
body.v3 .cart-overlay { background: rgba(13, 51, 34, 0.35); backdrop-filter: blur(2px); }
body.v3 .cart-panel { border-radius: 26px 0 0 26px; padding: 26px; box-shadow: -20px 0 50px -20px rgba(0, 0, 0, 0.35); animation: v3-slide 0.24s var(--ease); }
@keyframes v3-slide { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
body.v3 .cart-line { border-bottom-color: #EEF1EF; }
body.v3 .cart-totals-row.grand { font-size: 18px; font-weight: 800; border-top-color: #EEF1EF; }
body.v3 .brand-group { border: 0; border-radius: 20px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
body.v3 .brand-group > summary { background: #fff; padding: 16px 20px; font-size: 15px; }
body.v3 .category-group { border-top-color: #EEF1EF; }
body.v3 .order-table th, body.v3 .catalog-product-table th { text-transform: none; font-size: 12px; font-weight: 600; color: #7B828C; letter-spacing: 0; }
body.v3 .order-table td, body.v3 .catalog-product-table td { border-top-color: #EEF1EF; padding-top: 11px; padding-bottom: 11px; }
body.v3 .order-table input.qty-input, body.v3 .catalog-product-table input.qty-input, body.v3 .product-card .add-row input {
  border-radius: 999px; border: 0; background: #F1F4F2; height: 38px; font-weight: 700; font-size: 14px; box-shadow: inset 0 0 0 1px #E3E8E5;
}
body.v3 .order-table input.qty-input:focus, body.v3 .catalog-product-table input.qty-input:focus { background: #fff; box-shadow: 0 0 0 3px var(--sel-ring), inset 0 0 0 1.5px var(--sel); }
body.v3 .submit-bar { border-top: 0; border-radius: 20px; box-shadow: 0 -10px 30px -18px rgba(16, 24, 40, 0.3); margin-top: 16px; }
body.v3 .brand-tile .logo-circle { background: #F1F4F2; }
body.v3 .brand-tile .brand-name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
body.v3 .brand-tile .brand-count { font-size: 12px; }
body.v3 .brand-tile.inactive { background: #F4F6F5; }
body.v3 .brand-pill { background: #fff; border: 0; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06), inset 0 0 0 1px #E3E8E5; }
body.v3 .brand-pill:hover { box-shadow: inset 0 0 0 1.5px var(--sel); color: var(--sel); }

/* wholesale */
body.v3 .brand-grid { gap: 16px; }
body.v3 .brand-card { border: 0; border-radius: 22px; padding: 12px; text-align: left; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
body.v3 .brand-card:hover, body.v3 .brand-card.active { transform: translateY(-3px); box-shadow: 0 18px 34px -18px rgba(16, 24, 40, 0.35); background: #fff; }
body.v3 .brand-card.active { box-shadow: 0 0 0 2px var(--sel), 0 18px 34px -18px rgba(16, 24, 40, 0.35); }
body.v3 .brand-card .logo-box { height: 118px; background: #F4F7F5; border-radius: 16px; margin-bottom: 12px; padding: 14px; }
body.v3 .brand-card .logo-fallback { background: var(--sel-soft); color: var(--sel); border-radius: 18px; }
body.v3 .brand-card { font-size: 15px; font-weight: 700; padding-bottom: 16px; }
body.v3 .brand-card .brand-count { padding-left: 2px; }
body.v3 .product-grid { gap: 14px; }
body.v3 .product-card { border: 0; border-radius: 22px; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); padding: 10px; transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease); }
body.v3 .product-card:hover { transform: translateY(-2px); box-shadow: 0 18px 34px -20px rgba(16, 24, 40, 0.35); }
body.v3 .product-card .img-wrap { aspect-ratio: 4 / 3; border-radius: 16px; overflow: hidden; background: linear-gradient(160deg, #F4F7F5, #E8EEEA); }
body.v3 .product-card .img-wrap img { object-fit: contain; padding: 10px; }
body.v3 .product-card .body { padding: 12px 6px 4px; gap: 5px; }
body.v3 .product-card .pname { font-size: 14.5px; letter-spacing: -0.01em; }
body.v3 .product-card .pprice { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
body.v3 .product-card .pprice small { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
body.v3 .product-card .scheme-badge { background: var(--sel-soft); color: var(--sel); font-size: 11.5px; padding: 3px 10px; }
body.v3 .product-card .add-row input { width: 74px; }
body.v3 .product-card .add-row .btn { border-radius: 999px; }
/* the sidebar must never become the frame its fixed children are placed in */
body.v3 .sidebar { backdrop-filter: none !important; -webkit-backdrop-filter: none !important; transform: none !important; filter: none !important; }
@media (max-width: 820px) {
  body.v3.v3-wing .sidebar { position: static; height: 0; min-height: 0; padding: 0; margin: 0; border: 0; overflow: visible; background: none; }
  body.v3.v3-wing .sidebar .logo, body.v3.v3-wing .sidebar .rail-brand, body.v3.v3-wing .sidebar-footer, body.v3.v3-wing .sidebar .nav-label { display: none !important; }
}
@media (max-width: 820px) {
  body.v3.v3-wing .v3-tabs-src.v3-overflow { -webkit-mask-image: none; mask-image: none; }
  body.v3.v3-wing .v3-tabs-src .nav-item .nav-text { max-width: 84px; }
}
[id$='drilldown-header'] .logo-circle { margin: 0 !important; }
body.v3 [id$='drilldown-header'] .logo-circle { border-radius: 14px; }
body.v3 [id$='drilldown-header'] h2 { font-size: 22px !important; letter-spacing: -0.03em; }
body.v3 .pill-tabs.seg { width: max-content; max-width: 100%; }
body.v3 .topbar .search:not([data-ui-done]) { width: 220px; }
body.v3 .bell > span:first-child:not(.dot) { font-size: 0; }
body.v3 .bell > span:first-child:not(.dot)::before { content: '🔔'; font-size: 15px; }
@media (min-width: 821px) and (max-width: 1500px) {
  body.v3.v3-wing .v3-tabs-src .nav-item, body.v3.v3-wing .v3-tabs-src .pill-tab { padding: 0 12px; font-size: 13px; }
}
body.v3 .store-upload-row .card { padding: 20px !important; }
body.v3 .store-upload-row .card strong { font-size: 14.5px !important; }
@media (min-width: 821px) {
  body.v3.v3-admin.ui-ready .nav-group-header { display: flex; }
  body.v3.ui-ready .sidebar { padding: 14px 0 18px; }
  body.v3.v3-wing.ui-ready .sidebar { padding: 0; }
}

/* store order page: stock + recommendation notes (never a bare dash) */
.stock-note { display:block; font-size:11px; font-weight:500; color:var(--text-secondary, #6B7280); line-height:1.3; margin-top:2px; }
td > .stock-note:first-child { margin-top:0; font-size:12px; }
.stock-zero { color:#B45309; }

/* "Back to dashboard" — same green pill on every admin page */
.back-dash, .back-dash.back-link {
  display:inline-flex; align-items:center; gap:8px;
  margin:0 0 14px; padding:9px 18px 9px 14px;
  font-family:inherit; font-size:14px; font-weight:600; line-height:1.2; letter-spacing:.01em; min-height:36px;
  color:#fff; background:var(--sel, #078A45);
  border:0; border-radius:999px; cursor:pointer;
  box-shadow:0 1px 2px rgba(7,138,69,.25);
  transition:background .15s, transform .15s;
}
.back-dash span { font-size:16px; line-height:1; }
.back-dash:hover { background:var(--deep, #0D3322); color:#fff; }
.back-dash:active { transform:translateY(1px); }
.back-dash:focus-visible { outline:3px solid rgba(7,138,69,.35); outline-offset:2px; }

/* Indent */
.in .ex-head { align-items: flex-start; }
.in-dl { display:flex; gap:8px; flex-wrap:wrap; }
.in-kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.in-kpi-buy { background: #EAF6EF; border-color: rgba(7,138,69,.25); }
.in-kpi-buy .ex-v { color: var(--sel, #078A45); }
.in-note { margin: 10px 0 4px; padding: 10px 14px; border-radius: 12px; background: #FFF7E6; border: 1px solid #F6D58E; font-size: 13px; line-height: 1.45; }
.in-ratio { font-variant-numeric: tabular-nums; font-weight: 600; }
.in-ratio.in-hi { color: #B45309; }
.in-ratio.in-lo { color: #2563EB; }
.in-warn { color: #B45309; font-weight: 600; font-size: 12.5px; }
.in-table td.num, .in-table th.num { white-space: nowrap; }
.in-prod.open td { background: #F3F8F5; }
.in-split td { background: #F3F8F5; padding-top: 4px !important; }
.in-split-list { display:flex; flex-wrap:wrap; gap:6px 14px; font-size:12.5px; }
.in-split-list span { background:#fff; border:1px solid var(--border); border-radius:999px; padding:3px 10px; }
.in-brand-xlsx { min-width: 34px; font-size: 15px !important; line-height: 1; }
.in-mix { margin-top: 16px; }

/* =====================================================================
   Warehouse Sales & Payments (ws.js) — admin + warehouse + wholesale
   ===================================================================== */
.wsx { --ws-ink: #10231A; --ws-mut: #5B6B62; --ws-line: #E3EAE6; --ws-green: var(--sel, #078A45); --ws-deep: var(--deep, #0D3322); --ws-mint: #EAF6EF; --ws-late: #B42318; --ws-warn: #A15C00; }
.wsx-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 2px 0 16px; flex-wrap: wrap; }
.wsx-title { font-size: 26px; letter-spacing: -0.02em; margin: 0 0 4px; }
.wsx-top p { margin: 0; max-width: 70ch; }
.wsx-top-a { display: flex; gap: 8px; flex-wrap: wrap; }
.wsx-card { padding: 18px 20px; margin-bottom: 16px; }
.wsx-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 14px; }
.wsx-filters input[type=search] { min-width: 220px; flex: 1 1 220px; max-width: 320px; }
.wsx-filters input, .wsx-filters select { height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font: inherit; font-size: 13px; }
.wsx-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.wsx-grow { flex: 1 1 auto; }
.wsx-seg { width: max-content; max-width: 100%; overflow-x: auto; }
.wsx-seg .pill-tab { white-space: nowrap; }
.wsx-sumline { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 13px; color: var(--text-secondary); margin: 0 2px 10px; }
.wsx-sumline strong { color: var(--text-primary, #111); font-variant-numeric: tabular-nums; }
.wsx-tw { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.wsx .data-table td.num, .wsx .data-table th.num, .wsx-drawer .data-table td.num, .wsx-drawer .data-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wsx-rows tbody tr { cursor: pointer; }
.wsx-rows tbody tr:hover td { background: #F4F8F6; }
.wsx-rows tbody tr:focus-visible { outline: 2px solid var(--sel, #078A45); outline-offset: -2px; }
.wsx-sm { font-size: 12px; }
.wsx-faded td { opacity: 0.55; }
.wsx-cut td, .wsx-cut { text-decoration: line-through; text-decoration-color: rgba(0,0,0,.35); color: var(--text-secondary); }
.wsx-late, .wsx-latec { color: #B42318; }
.wsx-warnc { color: #A15C00; }
.wsx-up { color: #067A3E; font-weight: 600; }
.wsx-down { color: #B42318; font-weight: 600; }
.wsx-ok { color: #067A3E; font-weight: 600; font-size: 12.5px; }
.status-badge.wsx-due { background: #FDECEA; color: #B42318; }
.wsx-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 2px 0; font-size: 12.5px; }
.wsx-empty { padding: 34px 10px; text-align: center; }
.wsx-empty p { margin: 4px 0; }
.wsx-link { background: none; border: 0; padding: 0; color: var(--sel, #078A45); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.wsx-link:hover { color: var(--deep, #0D3322); }
.wsx-hint { display: block; font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }
.wsx-req { font-size: 11px; color: #A15C00; font-weight: 600; }
.wsx-span2 { grid-column: 1 / -1; }
.wsx-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.wsx-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 0 10px; cursor: pointer; }
.wsx-check input { width: 16px; height: 16px; accent-color: var(--sel, #078A45); }

/* side panel */
body.wsx-open { overflow: hidden; }
.wsx-ov { position: fixed; inset: 0; z-index: 1900; background: rgba(13, 51, 34, 0); transition: background .18s ease; display: flex; justify-content: flex-end; }
.wsx-ov.in { background: rgba(13, 51, 34, 0.32); }
.wsx-drawer { width: min(620px, 100%); height: 100%; background: var(--page, #F4F7F5); box-shadow: -12px 0 40px rgba(13,51,34,.18); display: flex; flex-direction: column; transform: translateX(24px); opacity: 0; transition: transform .2s ease, opacity .2s ease; }
.wsx-drawer.wide { width: min(920px, 100%); }
.wsx-ov.in .wsx-drawer { transform: none; opacity: 1; }
.wsx-dh { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 18px 22px 14px; background: #fff; border-bottom: 1px solid var(--border); }
.wsx-dh h2 { margin: 0; font-size: 19px; letter-spacing: -0.01em; }
.wsx-dh p { margin: 3px 0 0; font-size: 12.5px; }
.wsx-db { padding: 18px 22px 0; overflow-y: auto; flex: 1; }
.wsx-db > :last-child { margin-bottom: 22px; }
.wsx-x { width: 34px; height: 34px; flex: none; border-radius: 999px; border: 1px solid var(--border); background: #fff; font-size: 20px; line-height: 1; cursor: pointer; color: var(--text-secondary); }
.wsx-x:hover { background: #F1F4F2; color: #111; }
.wsx-x.sm { width: 26px; height: 26px; font-size: 16px; }
.wsx-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin: 16px 0 0; flex-wrap: wrap; }
.wsx-actions.wsx-sticky { position: sticky; bottom: 0; background: linear-gradient(to top, var(--page, #F4F7F5) 75%, rgba(244,247,245,0)); padding: 18px 0 16px; margin: 6px 0 0; z-index: 2; }
.wsx-total-pre { margin-right: auto; font-size: 14px; }
.wsx-total-pre strong { font-size: 18px; color: var(--deep, #0D3322); }
.wsx-sec { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.wsx-sec h3 { margin: 0 0 10px; font-size: 14px; }
.wsx-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.wsx-sec-h h3 { margin: 0; }
.wsx-drawer .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.wsx-drawer .form-row textarea { width: 100%; }
.wsx-h3 { font-size: 14px; margin: 20px 0 8px; }
.wsx-m:empty { display: none; }
.wsx-m { margin-top: 10px; }
.wsx-look { margin: 8px 0; padding-left: 18px; }
.wsx-look li { margin: 4px 0; }

/* pickers */
.wsx-pick, .wsx-prod-cell { position: relative; }
.wsx-pick-in { width: 100%; }
.wsx-pick-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; background: #fff; border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 30px rgba(16,35,26,.14); max-height: 300px; overflow-y: auto; padding: 4px; min-width: 280px; }
.wsx-pick-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; }
.wsx-pick-list button:hover, .wsx-pick-list button:focus { background: var(--ws-mint, #EAF6EF); outline: none; }
.wsx-pick-list strong { display: block; font-size: 13px; }
.wsx-pick-list span { display: block; font-size: 11.5px; color: var(--text-secondary); }
.wsx-pick-none { padding: 10px; font-size: 12.5px; }
.wsx-newcust { margin-top: 6px; font-size: 12.5px; }
.wsx-lines-wrap { overflow-x: auto; }
.wsx-lines { min-width: 760px; }
.wsx-lines td { padding: 6px 6px !important; vertical-align: top; }
.wsx-lines input, .wsx-lines select { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 13px; background: #fff; }
.wsx-lines td.num input { text-align: right; }
.wsx-lines td:nth-child(2) { width: 70px; } .wsx-lines td:nth-child(3) { width: 110px; } .wsx-lines td:nth-child(4) { width: 90px; } .wsx-lines td:nth-child(5) { width: 74px; }
.wsx-lines .wsx-lt { padding-top: 14px !important; font-weight: 600; }
.wsx-stockchip { display: inline-block; margin-top: 4px; font-size: 11px; color: #067A3E; background: var(--ws-mint, #EAF6EF); padding: 1px 8px; border-radius: 999px; }
.wsx-ro { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.wsx-ro input { width: 80px; height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; text-align: right; }
.wsx-apply input { width: 110px; height: 32px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; text-align: right; }

/* detail panels */
.wsx-head-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wsx-tile { background: #fff; border: 1px solid var(--border); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.wsx-tile span { font-size: 12px; color: var(--text-secondary); }
.wsx-tile strong { font-size: 20px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.wsx-tile em { font-style: normal; font-size: 12px; color: var(--text-secondary); }
.wsx-tile.due { background: #FFF8EC; border-color: #F3D9A6; }
.wsx-tile.late { background: #FDEFEC; border-color: #F2C3BB; }
.wsx-tile.late strong { color: #B42318; }
.wsx-tile.done { background: var(--ws-mint, #EAF6EF); border-color: #CDE9D9; }
.wsx-tile.done strong { color: #067A3E; }
.wsx-btnrow { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 6px; }
.wsx-file { cursor: pointer; }
.wsx-sums { margin: 10px 0 0 auto; max-width: 300px; font-size: 13px; }
.wsx-sums div { display: flex; justify-content: space-between; padding: 3px 0; color: var(--text-secondary); }
.wsx-sums strong { color: var(--text-primary, #111); font-variant-numeric: tabular-nums; }
.wsx-sums .t { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; font-size: 15px; }
.wsx-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin: 10px 0 14px; }
.wsx-dl dt { font-size: 11.5px; color: var(--text-secondary); }
.wsx-dl dd { margin: 1px 0 0; font-size: 13.5px; white-space: pre-line; word-break: break-word; }
.wsx-hist { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid #D6E7DD; }
.wsx-hist li { position: relative; padding: 0 0 12px 6px; font-size: 13px; }
.wsx-hist li::before { content: ''; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--sel, #078A45); }
.wsx-cos { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: -4px 0 12px; font-size: 12.5px; }
.wsx-cos span { background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; }
.wsx-ctab { margin-top: 12px; }
.wsx-ledger .wsx-bf td { background: #F4F8F6; font-weight: 500; }

/* overview */
.wsx-kpis { display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.wsx-k { background: #fff; border-radius: 20px; padding: 16px 18px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wsx-k span { font-size: 12.5px; color: var(--text-secondary); }
.wsx-k strong { font-size: 26px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.wsx-k em { font-style: normal; font-size: 12.5px; color: var(--text-secondary); }
.wsx-k em b { font-weight: 600; }
.wsx-k.hero { background: var(--deep, #0D3322); color: #fff; background-image: radial-gradient(120% 140% at 100% 0%, rgba(7,138,69,.55) 0%, rgba(7,138,69,0) 60%); }
.wsx-k.hero span, .wsx-k.hero em, .wsx-k.hero .text-muted { color: rgba(255,255,255,.78) !important; }
.wsx-k.hero strong { font-size: 32px; }
.wsx-k.hero .wsx-up { color: #8FE3B4; } .wsx-k.hero .wsx-down { color: #FFB4A8; }
.wsx-k.late strong { color: #B42318; }
.wsx-alert { display: block; width: 100%; text-align: left; font: inherit; font-size: 13.5px; background: #FFF6E5; border: 1px solid #F3D59B; color: #6B4200; border-radius: 14px; padding: 12px 16px; margin: 0 0 14px; cursor: pointer; }
.wsx-alert:hover { background: #FFEFD0; }
.wsx-grid2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }
.wsx-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.wsx-grid2 > .wsx-card, .wsx-grid3 > .wsx-card { margin-bottom: 14px; min-width: 0; }
.wsx-ch { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.wsx-ch h3 { margin: 0; font-size: 15px; }
.wsx-chart { position: relative; height: 240px; }
.wsx-age { display: flex; height: 18px; border-radius: 999px; overflow: hidden; background: #EEF2EF; gap: 2px; margin: 6px 0 12px; }
.wsx-age span { display: block; min-width: 4px; }
.wsx-agel { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.wsx-agel li { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #F0F3F1; }
.wsx-agel i { width: 10px; height: 10px; border-radius: 3px; }
.wsx-agel strong { font-variant-numeric: tabular-nums; }
.wsx-rank { list-style: none; margin: 0; padding: 0; counter-reset: r; }
.wsx-rank li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid #F0F3F1; font-size: 13px; cursor: pointer; border-radius: 8px; }
.wsx-rank li:hover { background: #F4F8F6; }
.wsx-rank.wsx-plain li { cursor: default; }
.wsx-rank.wsx-plain li[data-inv], .wsx-rank.wsx-plain li[data-pay] { cursor: pointer; }
.wsx-rank li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.wsx-rank li em { display: block; font-style: normal; font-size: 11.5px; color: var(--text-secondary); }
.wsx-rank li strong { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* import */
.wsx-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.wsx-steps span { font-size: 12.5px; padding: 5px 12px; border-radius: 999px; background: #EEF2EF; color: var(--text-secondary); }
.wsx-steps span.on { background: var(--sel, #078A45); color: #fff; font-weight: 600; }
.wsx-steps span.done { background: var(--ws-mint, #EAF6EF); color: #067A3E; }
.wsx-map select { min-width: 200px; height: 34px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; }
.wsx-sample { max-width: 320px; }
.wsx-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.wsx-chips span { padding: 6px 12px; border-radius: 999px; font-size: 13px; background: #EEF2EF; }
.wsx-chips span.ok { background: var(--ws-mint, #EAF6EF); color: #067A3E; }
.wsx-chips span.out { background: #FDECEA; color: #B42318; }
.wsx-checkrows { max-height: 460px; overflow: auto; }
.wsx-done { padding: 10px 0; }
.wsx-done h3 { margin: 0 0 6px; font-size: 18px; color: var(--deep, #0D3322); }

/* settings */
.wsx-co { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; background: #fff; }
.wsx-co summary { cursor: pointer; font-size: 13.5px; }
.wsx-co .form-grid { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.wsx-newm { flex: 1; height: 34px; border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; }
.wsx-dupg { border: 1px solid var(--border); border-radius: 14px; padding: 10px 14px; margin-bottom: 8px; }
.wsx-dupc { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13px; flex-wrap: wrap; }

/* payments bulk tick */
.wsx-tick { width: 34px; }
.wsx-tick input { width: 17px; height: 17px; accent-color: var(--sel, #078A45); }
.wsx-bulk { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--ws-mint, #EAF6EF); border-radius: 12px; padding: 8px 12px; margin-bottom: 10px; font-size: 13px; }

/* warehouse wing sub-tabs, wholesale order bill box */
.wsx-subnav { margin: 0 0 16px; }
.wsx-billed { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--ws-mint, #EAF6EF); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }

#wsx-toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; z-index: 2600; background: var(--deep, #0D3322); color: #fff; padding: 11px 18px; border-radius: 999px; font-size: 13.5px; box-shadow: 0 10px 30px rgba(13,51,34,.3); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100% - 32px); }
#wsx-toast.show { opacity: 1; transform: translate(-50%, 0); }
#wsx-toast.warn { background: #7A4B00; }

@media (prefers-reduced-motion: reduce) { .wsx-ov, .wsx-drawer, #wsx-toast { transition: none; } }
@media (max-width: 1100px) { .wsx-kpis { grid-template-columns: 1fr 1fr; } .wsx-grid3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) { .wsx-grid2, .wsx-grid3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .wsx-kpis { grid-template-columns: 1fr; }
  .wsx-drawer, .wsx-drawer.wide { width: 100%; }
  .wsx-db { padding: 14px 16px 0; }
  .wsx-dh { padding: 14px 16px 12px; }
  .wsx-drawer .form-grid, .wsx-co .form-grid, .wsx-dl { grid-template-columns: 1fr; }
  .wsx-filters input[type=search] { max-width: none; }
  .wsx-title { font-size: 22px; }
  .wsx-card { padding: 14px; }
  .wsx-total-pre { width: 100%; }
}
.wsx-drawer .data-table td:not(:first-child), .wsx .wsx-rows td:first-child { white-space: nowrap; }

/* Flavour groups — store order page and Indent */
.catalog-product-table tr.cat-group { cursor: pointer; background: #F6F8F7; }
.catalog-product-table tr.cat-group:hover { background: #EEF3F0; }

.cat-caret, .in-caret { display: inline-block; transition: transform .15s ease; color: #5B6470; font-size: 11px; width: 12px; }
tr.open .cat-caret, tr.open .in-caret { transform: rotate(90deg); }
.cat-flav-count, .in-flav-count { display: inline-block; font-size: 11.5px; font-weight: 600; color: #0B5D32; background: #E3F2E9; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.catalog-product-table tr.cat-variant td:first-child, .in-table tr.in-variant td:first-child { padding-left: 34px; }
.cat-variant-name { font-weight: 600; }
.cat-variant-full { font-size: 11px; margin-top: 2px; }
.cat-group-cart { font-size: 12px; color: #0B5D32; font-weight: 600; white-space: nowrap; }
.in-table tr.in-variant { background: #FAFBFA; }
.in-table tr.in-variant td { font-size: 13px; }
@media (prefers-reduced-motion: reduce) { .cat-caret, .in-caret { transition: none; } }

/* Uploads page — who's up to date */
.upx { padding: 18px 20px; }
.upx-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.upx-head h3 { margin: 0 0 4px; }
.upx-head p { margin: 0; max-width: 70ch; font-size: 13px; }
.upx-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.upx-filter { margin: 4px 0 12px; flex-wrap: wrap; }
.upx-rules { background: var(--hover); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 14px 16px; margin-bottom: 12px; }
.upx-rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 18px; }
.upx-rules-grid .form-row { margin: 0; display: grid; grid-template-columns: 1fr; gap: 4px; }
.upx-rules-grid .form-row span { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.upx-rules-grid input { width: 96px; }
.upx-rules-foot { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.upx-msg { font-size: 12.5px; }
.upx-msg.ok { color: var(--ok); }
.upx-msg.err { color: var(--out); }
.upx-wrap { overflow-x: auto; }
.upx-table { min-width: 760px; }
.upx-table.upx-wh { min-width: 420px; }
.upx-table thead th { white-space: nowrap; vertical-align: bottom; }
.upx-th-sub { display: block; font-weight: 400; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.upx-table th.upx-store { text-align: left; font-weight: 600; white-space: nowrap; vertical-align: middle; font-size: 13px; }
.upx-mail { margin-left: 6px; font-size: 11px; color: var(--text-muted); }
.upx-td { padding: 5px 6px !important; vertical-align: top; }
.upx-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; min-height: 74px; text-align: left; font: inherit; color: inherit; background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: 10px; padding: 8px 10px; cursor: pointer; transition: border-color .12s ease, box-shadow .12s ease; }
.upx-cell:hover { box-shadow: 0 2px 8px rgba(17, 17, 17, .08); }
.upx-cell:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.upx-cell.upx-ok { border-left-color: var(--ok); }
.upx-cell.upx-due { border-left-color: var(--low); background: #FFFBF3; }
.upx-cell.upx-overdue { border-left-color: var(--out); background: #FFF8F7; }
.upx-cell.upx-never { border-left-color: var(--out); background: #FFF8F7; }
.upx-l1 { font-size: 12.5px; font-weight: 600; color: var(--text-primary); }
.upx-l2 { font-size: 11.5px; color: var(--text-secondary); }
.upx-rem { font-size: 11px; font-weight: 600; color: var(--low); }
.upx-section-title { font-size: 17px; margin: 26px 0 2px; }
.upx-section-sub { margin: 0 0 12px; font-size: 13px; max-width: 80ch; }
.upx-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 13px; }
.upx-facts dt { color: var(--text-secondary); }
.upx-facts dd { margin: 0; color: var(--text-primary); }
.upx-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.upx-row input { flex: 1; min-width: 180px; }
.upx-email { margin: 14px 0 0; }
.upx-file { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upx-file input[type=file] { flex: 1; min-width: 200px; }
.upx-hist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.upx-hist li { padding: 8px 0; border-top: 1px solid var(--border); }
.upx-hist li:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 640px) {
  .upx { padding: 14px; }
  .upx-head-actions { width: 100%; }
  .upx-head-actions .btn { flex: 1; }
  .upx-facts { grid-template-columns: 1fr; gap: 2px; }
  .upx-facts dd { margin-bottom: 8px; }
}

/* Upload reminders — store and warehouse logins */
.upr-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--out-bg); border: 1px solid var(--danger-border); color: #7A271A; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; font-size: 13px; }
.upr-banner .btn { margin-left: auto; }
.upr-bell { position: relative; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 16px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.upr-bell:hover { background: var(--hover); }
.upr-bell:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.upr-count { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.upr-flash { box-shadow: 0 0 0 3px var(--green-ring), 0 0 0 1px var(--green) !important; transition: box-shadow .3s ease; }
/* Uploads page on phones: cards never wider than the screen */
.section-grid > * { min-width: 0; }
#upload-history > div { flex-wrap: wrap; gap: 8px; }
#upload-history .text-muted { overflow-wrap: anywhere; }
#upload-form input[type=file] { max-width: 100%; }

/* Store profit: who pays, folded expense list, expense sheet upload */
.sp-who { border: 0; padding: 0; margin: 0 0 8px; }
.sp-who legend { font-size: 12.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; padding: 0; }
.sp-who .sp-check { margin: 2px 0 6px; align-items: flex-start; line-height: 1.35; }
.sp-who .sp-check input { margin-top: 2px; }
.sp-who-hint { font-size: 12px; margin: 0 0 6px 24px; }
.sp-months-wrap { max-height: 520px; overflow-y: auto; }
.sp-months-wrap thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.sp-all-exp { padding: 0; margin-bottom: 14px; }
.sp-all-exp-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; cursor: pointer; list-style: none; font-size: 15px; }
.sp-all-exp-sum::-webkit-details-marker { display: none; }
.sp-all-exp-sum::before { content: '▸'; color: var(--text-secondary); font-size: 12px; margin-right: 2px; transition: transform .15s ease; }
.sp-all-exp[open] .sp-all-exp-sum::before { transform: rotate(90deg); }
.sp-all-exp-sum > span:first-child { flex: 1; }
.sp-all-exp-sum .text-muted { font-size: 12.5px; font-weight: 400; margin-left: 6px; }
.sp-all-exp-hint { font-size: 12.5px; font-weight: 600; color: var(--green-text); }
.sp-all-exp-sum:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; border-radius: var(--radius); }
.sp-all-exp-note { margin: 0 20px 10px; font-size: 12.5px; }
.sp-sheet { margin-bottom: 14px; }
.sp-sheet-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.sp-sheet-row .form-row span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 4px; }
.sp-sheet-row select { width: auto; min-width: 110px; }
.sp-sheet-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin: 14px 0 8px; }
.sp-sheet-sum > div { background: var(--hover); border: 1px solid var(--border); border-radius: var(--radius-control); padding: 10px 12px; display: grid; gap: 2px; }
.sp-sheet-sum strong { font-size: 16px; }
.sp-sheet-sum .text-muted { font-size: 12px; }
.sp-sheet-grid { max-height: 460px; overflow: auto; }
.sp-sheet-grid table { min-width: 720px; font-variant-numeric: tabular-nums; }
.sp-sheet-grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; white-space: nowrap; }
.sp-sheet-total td { border-top: 2px solid var(--border-strong); }
.sp-sheet-errs ul { margin: 6px 0 0 18px; padding: 0; }
.sp-sheet-h { margin: 18px 0 6px; font-size: 13.5px; }
.sp-sheet-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.sp-sheet-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--border); }
.sp-sheet-list .text-muted { font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .sp-all-exp-sum::before { transition: none; } }
.sp-exp-table tr.sp-exp-month td { background: var(--hover); font-size: 13px; padding-top: 9px; padding-bottom: 9px; }

/* Stock count close-out steps (admin) */
.scx-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 14px 0 0; background: var(--surface, #fff); }
.scx-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.scx-step { display: flex; gap: 8px; align-items: flex-start; min-width: 0; color: var(--text-secondary); font-size: 13px; }
.scx-step strong { color: var(--text-secondary); font-weight: 600; }
.scx-step.done strong { color: var(--text-primary); }
.scx-dot { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; border: 1.5px solid var(--border); color: var(--text-secondary); }
.scx-step.done .scx-dot { background: var(--ok-bg); border-color: var(--ok); color: var(--ok); }
.scx-step.next .scx-dot { border-color: var(--text-primary); color: var(--text-primary); }
.scx-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; }
.scx-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sc-edited { font-size: 11px; font-weight: 600; color: var(--low); white-space: nowrap; }
.sc-history { margin-top: 14px; }
.sc-history summary { cursor: pointer; font-weight: 600; font-size: 13.5px; }
.sc-history ul { list-style: none; margin: 8px 0 0; padding: 0; }
.sc-history li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.sc-history li:last-child { border-bottom: 0; }
@media (max-width: 700px) { .scx-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Every-Monday spot check status (admin) */
.spw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.spw-store { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; min-width: 0; font-size: 13px; }

/* Shown on every admin page while all emails are paused */
.email-pause-strip { background: var(--low-bg); color: var(--low); border: 1px solid currentColor; border-radius: 10px; padding: 8px 12px; margin: 0 0 12px; font-size: 13px; font-weight: 600; }
.email-pause-strip a { color: inherit; text-decoration: underline; margin-left: 6px; }
