@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,300..900;1,6..12,300..900&display=swap');

/* ==========================================================================
   THEME VARIABLES (Light, Dark, & System Mode)
   ========================================================================== */
:root, [data-theme="light"] {
  --app-header-height: 114px;
  --primary: #CF495D;           /* SexyLiving signature rose/coral button color */
  --primary-hover: #b93b4f;
  --primary-light: #fdf2f4;
  --primary-glow: rgba(207, 73, 93, 0.25);
  --navy-dark: #181b34;
  --navy-hero: #1c1c3b;
  --bg: #f6f7fb;                /* Modern off-white body canvas */
  --surface: #ffffff;
  --surface-subtle: #f1f2f8;
  --surface-hover: #f8fafc;
  --text: #181b34;              /* Deep navy body text */
  --text-muted: #5f657d;
  --border: #e2e4f0;
  --border-focus: #CF495D;
  --card-shadow: 0 1px 4px rgba(24, 27, 52, 0.05);
  --table-th-bg: #f1f2f8;
  --table-border: #e2e4f0;
  --yellow-highlight: #fff2cc;
  --yellow-highlight-text: #181b34;
  --green-highlight: #d9ead3;
  --green-highlight-text: #1e4620;
  --green-badge: #16a34a;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-family: "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

[data-theme="dark"] {
  --app-header-height: 114px;
  --primary: #CF495D;
  --primary-hover: #e05367;
  --primary-light: #2c1a20;
  --primary-glow: rgba(207, 73, 93, 0.4);
  --navy-dark: #0a0c16;
  --navy-hero: #121526;
  --bg: #0c0e1a;                /* Deep midnight dark canvas */
  --surface: #141728;           /* Card / Section surfaces */
  --surface-subtle: #1c2138;
  --surface-hover: #202640;
  --text: #f1f3fa;              /* Crisp white-lavender text */
  --text-muted: #9aa1be;
  --border: #232942;
  --border-focus: #CF495D;
  --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  --table-th-bg: #1c2138;
  --table-border: #242a44;
  --yellow-highlight: #3d2f06;
  --yellow-highlight-text: #fef08a;
  --green-highlight: #0b2e17;
  --green-highlight-text: #86efac;
  --green-badge: #22c55e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme-setting="light"]):not([data-theme-setting="dark"]) {
    --primary: #CF495D;
    --primary-hover: #e05367;
    --primary-light: #2c1a20;
    --primary-glow: rgba(207, 73, 93, 0.4);
    --navy-dark: #0a0c16;
    --navy-hero: #121526;
    --bg: #0c0e1a;
    --surface: #141728;
    --surface-subtle: #1c2138;
    --surface-hover: #202640;
    --text: #f1f3fa;
    --text-muted: #9aa1be;
    --border: #232942;
    --border-focus: #CF495D;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
    --table-th-bg: #1c2138;
    --table-border: #242a44;
    --yellow-highlight: #3d2f06;
    --yellow-highlight-text: #fef08a;
    --green-highlight: #0b2e17;
    --green-highlight-text: #86efac;
    --green-badge: #22c55e;
  }
}

/* ==========================================================================
   INSTANT PRE-PAINT AUTH STATE (Eliminates login page flash on page refresh)
   ========================================================================== */
html.is-authenticated #login-screen {
  display: none !important;
}

html.is-authenticated #app-container {
  display: block !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(24, 27, 52, 0.04) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 15% 15%, rgba(207, 73, 93, 0.045) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(99, 102, 241, 0.04) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 85%, rgba(207, 73, 93, 0.035) 0%, transparent 60%);
  background-size: 24px 24px, 100% 100%, 100% 100%, 100% 100%;
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
  padding-bottom: 70px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

[data-theme="dark"] body {
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    radial-gradient(ellipse 80% 50% at 15% 15%, rgba(207, 73, 93, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 85% 20%, rgba(99, 102, 241, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 85%, rgba(207, 73, 93, 0.06) 0%, transparent 60%);
  background-size: 24px 24px, 100% 100%, 100% 100%, 100% 100%;
  background-attachment: fixed;
}

/* ==========================================================================
   APP HEADER
   ========================================================================== */
.app-header {
  background: var(--surface);
  color: var(--text);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.25s, border-color 0.25s;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  max-width: 1440px;
  margin: 0 auto;
  gap: 16px;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 14px;
}

.site-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
  display: block;
  transition: transform 0.2s;
}

.site-logo:hover {
  transform: scale(1.02);
}

.portal-tag {
  display: flex;
  flex-direction: column;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

.portal-tag-main {
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.portal-tag-sub {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.header-action-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.header-icon-btn {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
}

.header-icon-btn:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Theme Switcher Select */
.theme-switch-wrap {
  display: flex;
  align-items: center;
}

.theme-select {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  height: 34px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.theme-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Team & Counter identity inputs */
.mobile-counter-info {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--text-muted);
  font-weight: 600;
}

.counter-user-input {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 0.84rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
}

.counter-user-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Share QR Button */
.qr-btn {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.2s;
}

.qr-btn:hover {
  background: var(--surface-hover);
}

/* Role Toggle Pill (Stock Takers vs Manager) */
.role-toggle {
  display: flex;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--border);
}

.role-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.2s;
}

.role-btn:hover {
  color: var(--text);
}

.role-btn.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* ==========================================================================
   SUB-NAVIGATION (Entity, Brand & Location Tabs)
   ========================================================================== */
.sub-nav {
  background: var(--surface);
  padding: 8px 20px;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.sub-nav-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 1440px;
  margin: 0 auto;
}

.sub-nav-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.sub-nav-left {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.brand-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
}

.brand-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.global-controls-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.sub-nav-bottom-row {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.location-tabs {
  display: inline-flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.mobile-loc-controls {
  display: none;
}

.loc-tab {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.2s;
}

.loc-tab:hover {
  background: var(--surface-hover);
}

.loc-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 6px var(--primary-glow);
}

/* ==========================================================================
   MAIN CONTAINER & TOOLBARS
   ========================================================================== */
.main-container {
  max-width: 1440px;
  margin: 16px auto;
  padding: 0 16px;
}

.toolbar-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--card-shadow);
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.85rem;
  color: var(--text);
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--text);
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Common Buttons */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px var(--primary-glow);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  background: var(--surface-subtle);
}

.btn-scan {
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-scan:hover {
  background: var(--surface-hover);
}

/* ==========================================================================
   METRICS GRID (Summary Cards)
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--card-shadow);
}

.metric-card.clickable {
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  position: relative;
}

.metric-card.clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.metric-card.active-filter-discrepancies {
  border: 2px solid #f59e0b !important;
  background: var(--yellow-highlight) !important;
  color: var(--yellow-highlight-text) !important;
}

.metric-card.active-filter-overstock {
  border: 2px solid var(--green-badge) !important;
  background: var(--green-highlight) !important;
  color: var(--green-highlight-text) !important;
}

.metric-card.active-filter-counted {
  border: 2px solid var(--primary) !important;
  background: var(--primary-light) !important;
}

.metric-card.active-filter-all {
  border: 2px solid var(--primary) !important;
}

.filter-pill-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.metric-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin-top: 4px;
}

.metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   ALL-BRANDS MASTER DASHBOARD GRID
   ========================================================================== */
.master-dashboard-box {
  margin-bottom: 20px;
}

.master-section-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.brand-overview-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--card-shadow);
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-overview-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
}

.boc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.boc-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.boc-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--surface-subtle);
  color: var(--text-muted);
}

.boc-badge.complete {
  background: #dcfce7;
  color: #15803d;
}

.progress-bar-wrap {
  background: var(--surface-subtle);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
  margin: 8px 0 12px 0;
}

.progress-bar-fill {
  background: var(--primary);
  height: 100%;
  border-radius: 10px;
  transition: width 0.3s ease;
}

.boc-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.boc-stat-item strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
}

.boc-btn {
  width: 100%;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.boc-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

/* ==========================================================================
   MANAGER DASHBOARD VIEW TOGGLE & YE COUNT DASHBOARD (Image 1)
   ========================================================================== */
.manager-view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  width: 100%;
  box-sizing: border-box;
}

.manager-view-mobile-dropdown-wrap {
  display: none;
  width: 100%;
  margin-bottom: 14px;
}

.mgr-view-tab {
  flex: 1;
  background: transparent;
  border: none;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  text-align: center;
}

.mgr-view-tab:hover {
  color: var(--text);
  background: var(--surface);
}

.mgr-view-tab.active {
  background: var(--primary);
  color: #ffffff !important;
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Status Pills (Matching Image 1 Google Sheet) */
.status-pill-select {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 4px 22px 4px 10px;
  font-size: 0.74rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  text-align: center;
  background-repeat: no-repeat;
  background-position: right 7px center;
  background-size: 8px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}

.status-pill-select:hover {
  transform: scale(1.02);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.status-pill-select option {
  background-color: var(--surface, #ffffff);
  color: var(--text, #181b34);
  padding: 6px 10px;
  font-weight: 600;
}

/* Completed (Soft Green) */
.status-pill-completed {
  background-color: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
}

/* Assigned (Soft Yellow / Amber) */
.status-pill-assigned {
  background-color: #fef9c3 !important;
  color: #854d0e !important;
  border: 1px solid #fef08a !important;
}

/* Not Assigned (Soft Rose / Muted Coral - Gentle on the eyes) */
.status-pill-not-assigned {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
  border: 1px solid #fecaca !important;
}

/* Second count (Soft Sky Blue) */
.status-pill-second-count {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #bae6fd !important;
}

/* Waiting on Overstock (Soft Peach / Warm Orange) */
.status-pill-waiting {
  background-color: #ffedd5 !important;
  color: #c2410c !important;
  border: 1px solid #fed7aa !important;
}

/* N/A (Soft Neutral Slate) */
.status-pill-na {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
}

/* Yes (Soft Green) */
.status-pill-yes {
  background-color: #dcfce7 !important;
  color: #166534 !important;
  border: 1px solid #bbf7d0 !important;
}

/* No (Soft Muted Slate) */
.status-pill-no {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0 !important;
}

/* Dark Mode Overrides for Status Pills */
[data-theme="dark"] .status-pill-select option {
  background-color: #141728;
  color: #f1f3fa;
}

[data-theme="dark"] .status-pill-completed,
[data-theme="dark"] .status-pill-yes {
  background-color: rgba(22, 101, 52, 0.28) !important;
  color: #86efac !important;
  border-color: rgba(74, 222, 128, 0.35) !important;
}

[data-theme="dark"] .status-pill-assigned {
  background-color: rgba(161, 98, 7, 0.28) !important;
  color: #fde047 !important;
  border-color: rgba(234, 179, 8, 0.35) !important;
}

[data-theme="dark"] .status-pill-not-assigned {
  background-color: rgba(153, 27, 27, 0.28) !important;
  color: #fca5a5 !important;
  border-color: rgba(248, 113, 113, 0.35) !important;
}

[data-theme="dark"] .status-pill-second-count {
  background-color: rgba(3, 105, 161, 0.28) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
}

[data-theme="dark"] .status-pill-waiting {
  background-color: rgba(194, 65, 12, 0.28) !important;
  color: #fdba74 !important;
  border-color: rgba(251, 146, 60, 0.35) !important;
}

[data-theme="dark"] .status-pill-na,
[data-theme="dark"] .status-pill-no {
  background-color: rgba(100, 116, 139, 0.22) !important;
  color: #94a3b8 !important;
  border-color: rgba(148, 163, 184, 0.3) !important;
}

/* Perfect Stocktake Pill */
.badge-perfect {
  background-color: #f3e8ff;
  color: #6b21a8;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.76rem;
  display: inline-block;
}

/* Grouping Brand Badge */
.grouping-brand-badge {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.ye-brand-link {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}

.ye-brand-link:hover {
  text-decoration: underline;
  color: var(--primary);
}

.stocktake-no-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 700;
  color: var(--text);
  max-width: 95px;
  text-align: center;
  outline: none;
  transition: all 0.2s;
}

.stocktake-no-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.stocktake-no-input.badge-perfect {
  background-color: #f3e8ff !important;
  color: #6b21a8 !important;
  border-color: #d8b4fe !important;
}

.grouping-input {
  border: 1px solid transparent;
  background: transparent;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: inherit;
  transition: all 0.2s;
}

.grouping-input:hover, .grouping-input:focus {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

/* Multi-tier YE Dashboard Table */
.ye-dashboard-table thead tr:first-child th {
  position: sticky;
  top: 0;
  z-index: 26;
  background: var(--table-th-bg);
  box-sizing: border-box;
}

.ye-dashboard-table thead tr:first-child th[rowspan="2"] {
  top: 0;
  z-index: 28;
  vertical-align: middle;
  border-bottom: 2px solid var(--border);
}

.ye-dashboard-table thead tr:nth-child(2) th {
  position: sticky;
  top: 33px;
  z-index: 25;
  background: var(--table-th-bg);
  box-sizing: border-box;
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

.ye-dashboard-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 29;
  background: var(--table-th-bg);
}

.ye-dashboard-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 10;
  background: var(--surface);
}

.ye-dashboard-table tbody tr:hover td:first-child {
  background-color: var(--surface-hover);
}

.ye-dashboard-table th.th-group-header {
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
  padding: 6px 8px;
  height: 33px;
  line-height: 1.2;
}

.ye-dashboard-table th.th-shelf-hdr {
  background-color: #dbeafe !important;
  color: #1d4ed8 !important;
}

.ye-dashboard-table th.th-overstock-hdr {
  background-color: #d1fae5 !important;
  color: #047857 !important;
}

.ye-dashboard-table th.th-us-overstock-hdr {
  background-color: #fef3c7 !important;
  color: #b45309 !important;
}

[data-theme="dark"] .ye-dashboard-table th.th-shelf-hdr {
  background-color: #172554 !important;
  color: #93c5fd !important;
}

[data-theme="dark"] .ye-dashboard-table th.th-overstock-hdr {
  background-color: #064e3b !important;
  color: #6ee7b7 !important;
}

[data-theme="dark"] .ye-dashboard-table th.th-us-overstock-hdr {
  background-color: #451a03 !important;
  color: #fde68a !important;
}

.ye-dashboard-table tfoot td {
  font-weight: 800;
  background: var(--surface-subtle);
  border-top: 2px solid var(--border);
}

/* ==========================================================================
   DATA TABLES & STICKY HEADERS
   ========================================================================== */
.table-wrapper {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  overflow-y: auto;
  max-height: calc(100vh - 210px);
  min-height: 360px;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  box-shadow: var(--card-shadow);
  position: relative;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
  white-space: nowrap;
}

.data-table thead {
  position: static;
}

.data-table thead th,
.counter-table thead th {
  position: sticky;
  top: 0;
  z-index: 25;
  background: var(--table-th-bg);
  color: var(--text);
  font-weight: 800;
  padding: 10px 12px;
  border-top: 1px solid var(--table-border);
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--table-border);
  text-align: left;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
}

.data-table thead th:first-child,
.counter-table thead th:first-child {
  border-left: 1px solid var(--table-border);
  border-top-left-radius: var(--radius-md);
}

.data-table thead th:last-child,
.counter-table thead th:last-child {
  border-top-right-radius: var(--radius-md);
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-border);
  color: var(--text);
}

.data-table td:first-child {
  border-left: 1px solid var(--table-border);
}

.data-table .num-col {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.counter-table tbody tr:hover, .data-table tbody tr:hover {
  background-color: var(--surface-hover);
}

/* Counter Inputs */
.counter-input-cell {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  background: var(--surface);
  color: var(--text);
  outline: none;
  font-family: inherit;
  transition: all 0.15s ease-in-out;
}

.counter-input-cell:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.counter-input-cell::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

/* Conditional Formatting */
.tr-recount-highlight {
  background-color: var(--yellow-highlight) !important;
  color: var(--yellow-highlight-text) !important;
}

.tr-variance-highlight {
  background-color: var(--yellow-highlight) !important;
  color: var(--yellow-highlight-text) !important;
}

.td-overstock-highlight {
  background-color: var(--green-highlight) !important;
  font-weight: 700;
  color: var(--green-highlight-text) !important;
}

.item-bin {
  background: var(--surface-subtle);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

/* ==========================================================================
   ANIMATED ASK KEE AI ASSISTANT (Happy Minion Animated Character)
   ========================================================================== */
.ask-kee-fab-wrapper,
.jarvis-fab-wrapper {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.ask-kee-fab,
.jarvis-fab {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 50%, #2563eb 100%);
  border: 2.5px solid #facc15;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.35), 0 0 14px rgba(250, 204, 21, 0.35);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  animation: minionHappyBounce 3s infinite ease-in-out;
  padding: 0;
  outline: none;
}

.ask-kee-fab:hover,
.jarvis-fab:hover {
  transform: scale(1.12) translateY(-3px);
  border-color: #fde047;
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.45), 0 0 22px rgba(250, 204, 21, 0.55);
}

.minion-character,
.jarvis-character {
  display: flex;
  align-items: center;
  justify-content: center;
}

.minion-svg {
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.minion-hair {
  animation: minionHairWiggle 3s infinite ease-in-out;
}

.minion-eye-blink {
  animation: minionBlink 4s infinite ease-in-out;
}

@keyframes minionHappyBounce {
  0%, 100% { transform: translateY(0); }
  25% { transform: translateY(-4px) rotate(1.5deg); }
  55% { transform: translateY(0) rotate(-1deg); }
  75% { transform: translateY(-2px) rotate(0.5deg); }
}

@keyframes minionBlink {
  0%, 46%, 52%, 100% { transform: scaleY(1); }
  49% { transform: scaleY(0.12); transform-origin: 32px 24px; }
}

@keyframes minionHairWiggle {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(5deg); transform-origin: 32px 7px; }
  75% { transform: rotate(-5deg); transform-origin: 32px 7px; }
}

.ask-kee-pulse-ring,
.jarvis-pulse-ring {
  position: absolute;
  top: -4px;
  left: -4px;
  right: -4px;
  bottom: -4px;
  border-radius: 50%;
  border: 2px solid rgba(250, 204, 21, 0.55);
  animation: minionPulse 2.5s infinite;
  pointer-events: none;
}

@keyframes minionPulse {
  0% { transform: scale(0.96); opacity: 0.8; }
  60% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}

.ask-kee-badge-label,
.jarvis-badge-label {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--surface);
  color: var(--text);
  padding: 1.5px 8px;
  border-radius: 10px;
  border: 1px solid rgba(250, 204, 21, 0.5);
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  letter-spacing: 0.02em;
  pointer-events: none;
}

/* Quick Tools Bar inside Jarvis */
.jarvis-tools-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.jarvis-tools-bar::-webkit-scrollbar {
  display: none;
}

.jarvis-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.jarvis-tool-btn:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  transform: translateY(-1px);
}

.jarvis-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.jarvis-online-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

/* Editable SKU with cursor */
.editable-sku {
  cursor: pointer;
  border-bottom: 1.5px dashed var(--primary);
  padding-bottom: 1px;
  transition: color 0.15s, border-bottom-color 0.15s;
}

.editable-sku:hover {
  color: var(--primary);
  border-bottom-style: solid;
}

/* Chat Window Modal */
.ai-chat-window {
  position: fixed;
  bottom: 84px;
  right: 24px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.25);
  z-index: 1001;
  display: none;
  flex-direction: column;
  overflow: hidden;
  animation: chatSlideUp 0.25s ease-out;
}

.ai-chat-window.active {
  display: flex;
}

@keyframes chatSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ai-chat-header {
  background: linear-gradient(135deg, #181b34 0%, #1c1c3b 100%);
  color: #ffffff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 800;
}

.ai-status-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px #22c55e;
}

.ai-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-chat-btn-icon {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #ffffff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.ai-chat-btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}

.ai-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  font-size: 0.86rem;
  line-height: 1.45;
}

.ai-msg.bot {
  align-self: flex-start;
}

.ai-msg.user {
  align-self: flex-end;
}

.ai-msg-bubble {
  padding: 10px 14px;
  border-radius: 12px;
  word-break: break-word;
}

.ai-msg.bot .ai-msg-bubble {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-bottom-left-radius: 3px;
}

.ai-msg.user .ai-msg-bubble {
  background: var(--primary);
  color: #ffffff;
  border-bottom-right-radius: 3px;
}

.ai-msg-time {
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 3px;
  padding: 0 4px;
}

.ai-chips-wrap {
  padding: 8px 12px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  white-space: nowrap;
}

.ai-chip {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chip:hover {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.ai-chat-input-bar {
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.ai-chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.ai-chat-send {
  background: var(--primary);
  color: #ffffff;
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-chat-send:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.ai-action-btn {
  display: inline-block;
  margin-top: 8px;
  background: var(--primary);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-action-btn:hover {
  background: var(--primary-hover);
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(3px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.3);
  position: relative;
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

#scanner-video-region {
  width: 100%;
  min-height: 250px;
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* ==========================================================================
   MOBILE TOOLS TRIGGER & DRAWER BASE RULES (Hidden on Desktop)
   ========================================================================== */
.btn-mobile-tools {
  display: none;
}

.mobile-tools-drawer {
  display: none;
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS (Strictly mobile screens <= 768px)
   Desktop layout (> 768px) remains 100% untouched and identical
   ========================================================================== */
@media (max-width: 768px) {
  /* Un-stick the bulky header on mobile so it scrolls naturally */
  .app-header {
    position: relative !important;
    top: auto !important;
    box-shadow: none !important;
    border-bottom: 1px solid var(--border);
  }

  /* Compact top bar (Logo, Role Toggle, ⚙️ Tools, Logout) */
  .header-top {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 6px 10px !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
  }

  .brand-title {
    flex-shrink: 0;
    display: flex;
    align-items: center;
  }

  .site-logo {
    height: 25px !important;
    width: auto !important;
  }

  .portal-tag {
    display: none !important;
  }

  .header-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    width: auto !important;
    flex-wrap: nowrap !important;
  }

  /* Hide bulky desktop items from main header row on mobile (available in ⚙️ Tools drawer) */
  .mobile-counter-info {
    display: none !important;
  }

  .desktop-only-action {
    display: none !important;
  }

  /* Compact role toggle in top bar */
  .role-toggle {
    margin: 0 !important;
    padding: 2px !important;
    background: var(--surface-subtle) !important;
    border-radius: 6px !important;
    display: inline-flex !important;
  }

  .role-toggle .role-btn {
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
    gap: 2px !important;
    font-weight: 700 !important;
    border-radius: 4px !important;
  }

  /* Mobile tools trigger button */
  .btn-mobile-tools {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--surface-subtle);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
  }

  .btn-mobile-tools:hover, .btn-mobile-tools.active {
    background: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
  }

  .btn-header-logout {
    padding: 3px 6px !important;
    font-size: 0.72rem !important;
    height: 30px !important;
    gap: 3px !important;
  }

  /* Mobile Tools Drawer (Popup panel right under header) */
  .mobile-tools-drawer {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 2px solid var(--primary);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
    z-index: 200;
    padding: 12px 14px;
    animation: drawerSlideDown 0.2s ease-out;
  }

  .mobile-tools-drawer.open {
    display: block !important;
  }

  @keyframes drawerSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .mobile-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 6px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border);
  }

  .mobile-tools-close {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
  }

  .mobile-tools-section {
    margin-bottom: 12px;
  }

  .mobile-tools-label {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-bottom: 6px;
  }

  .mobile-counter-info-drawer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 700;
  }

  .mobile-drawer-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .mobile-drawer-btn-grid .btn {
    padding: 8px 10px;
    font-size: 0.78rem;
    font-weight: 700;
    justify-content: center;
    text-align: center;
  }

  /* Sub-Navigation (Entity & Brand Selectors) */
  .sub-nav {
    padding: 4px 10px !important;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }

  .sub-nav-container {
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    width: 100% !important;
  }

  .sub-nav-top-row {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .sub-nav-left {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    align-items: center !important;
  }

  .sub-nav-left .brand-select-wrap {
    flex: 1 !important;
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
  }

  .sub-nav-left .brand-select-wrap label {
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }

  .sub-nav-left select {
    font-size: 0.76rem !important;
    padding: 3px 6px !important;
    height: 30px !important;
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 6px !important;
  }

  .sub-nav-top-row .global-controls-wrap {
    display: none !important;
  }

  /* STICKY LOCATION BAR (Shelf | Overstock | US Overstock + 🔄 Refresh + 💾 Save)
     This is the ONLY sticky element on mobile when scrolling the SKU table! */
  .sub-nav-bottom-row {
    position: sticky !important;
    top: 0 !important;
    z-index: 95 !important;
    background: var(--surface) !important;
    padding: 4px 0 !important;
    margin-left: 0 !important;
    width: 100% !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    border-top: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
  }

  .location-tabs {
    display: flex !important;
    gap: 4px !important;
    flex: 1 !important;
  }

  .loc-tab {
    padding: 4px 6px !important;
    font-size: 0.74rem !important;
    font-weight: 700 !important;
    border-radius: 6px !important;
    flex: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .mobile-loc-controls {
    display: flex !important;
    gap: 5px !important;
    align-items: center !important;
    flex-shrink: 0 !important;
    margin-left: 6px !important;
    width: auto !important;
  }

  .mobile-loc-controls .btn-icon-square {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.9rem !important;
  }

  /* Primary counter view hides ZIP and Reset buttons (accessible via ⚙️ Tools) */
  #btn-export-all-zip,
  #btn-reset-test-data {
    display: none !important;
  }

  /* Main Container & Toolbars */
  .main-container {
    padding: 0 6px !important;
  }

  .toolbar-card {
    padding: 6px 8px !important;
    margin-bottom: 6px !important;
    gap: 6px !important;
    border-radius: var(--radius-sm) !important;
    flex-direction: column !important;
  }

  .search-input-wrap {
    height: 32px !important;
    width: 100% !important;
  }

  .search-input {
    font-size: 0.8rem !important;
    padding: 4px 8px 4px 28px !important;
  }

  .toolbar-card > div:last-child {
    display: flex !important;
    gap: 5px !important;
    width: 100% !important;
  }

  .toolbar-card .btn {
    flex: 1 !important;
    padding: 4px 6px !important;
    font-size: 0.72rem !important;
    height: 28px !important;
    justify-content: center !important;
    white-space: nowrap !important;
  }

  .toolbar-card .btn svg {
    width: 13px !important;
    height: 13px !important;
  }

  /* Blind Count notice compact strip */
  .counter-notice-bar {
    margin-bottom: 6px !important;
    font-size: 0.68rem !important;
    gap: 4px !important;
  }

  /* Table Wrapper & Smooth Scrolling on Mobile */
  .table-wrapper {
    max-height: calc(100dvh - 110px) !important;
    max-height: calc(100vh - 110px) !important;
    min-height: 260px !important;
    border-radius: var(--radius-sm) !important;
    margin-bottom: 8px !important;
    -webkit-overflow-scrolling: touch !important;
    box-shadow: none !important;
  }

  /* STICKY FIRST COLUMN (SKU) IN COUNTER TABLE
     SKU stays frozen on horizontal scroll so counters never lose context */
  .counter-table th:first-child,
  .counter-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 15 !important;
    background: var(--surface) !important;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08) !important;
    font-size: 0.78rem !important;
    padding: 6px 8px !important;
    min-width: 100px !important;
    max-width: 115px !important;
  }

  .counter-table thead th:first-child {
    z-index: 30 !important;
    background: var(--table-th-bg) !important;
  }

  .counter-table tbody tr:hover td:first-child {
    background-color: var(--surface-hover) !important;
  }

  .tr-recount-highlight td:first-child {
    background-color: var(--yellow-highlight) !important;
  }

  /* Compact Product Description in Counter Table */
  .counter-table td:nth-child(2) {
    max-width: 125px !important;
    min-width: 95px !important;
    font-size: 0.74rem !important;
    line-height: 1.25 !important;
    padding: 6px 6px !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: normal !important;
  }

  .counter-table th:nth-child(2) {
    max-width: 125px !important;
    min-width: 95px !important;
    font-size: 0.76rem !important;
    padding: 6px !important;
  }

  /* Compact Bin Column */
  .counter-table td:nth-child(3),
  .counter-table th:nth-child(3) {
    padding: 4px 4px !important;
    font-size: 0.72rem !important;
    min-width: 50px !important;
    text-align: center !important;
  }

  /* Compact Counter Inputs (Touch targets sized for fingers) */
  .counter-table td:nth-child(4),
  .counter-table td:nth-child(5) {
    padding: 4px 4px !important;
    text-align: center !important;
    min-width: 70px !important;
  }

  .counter-input-cell {
    width: 66px !important;
    padding: 5px 2px !important;
    font-size: 0.92rem !important;
    border-radius: 6px !important;
  }

  /* Final Count Value */
  .counter-table td:nth-child(6),
  .counter-table th:nth-child(6) {
    font-size: 0.95rem !important;
    min-width: 48px !important;
    text-align: center !important;
    padding: 4px 4px !important;
  }

  /* ========================================================================
     MANAGER ACCESS ON MOBILE
     ======================================================================== */
  .manager-view-toggle {
    display: none !important;
  }

  .manager-view-mobile-dropdown-wrap {
    display: block !important;
    margin-bottom: 6px !important;
  }

  .manager-view-mobile-dropdown-wrap label {
    font-size: 0.74rem !important;
    margin-bottom: 3px !important;
  }

  .manager-view-mobile-dropdown-wrap select {
    padding: 6px 8px !important;
    font-size: 0.82rem !important;
  }

  /* SUMMARY METRICS GRID: Horizontal Swipeable Carousel of Chips
     Takes only ~55px height on mobile instead of ~300px stacked cards! */
  .metrics-grid {
    display: flex !important;
    overflow-x: auto !important;
    gap: 6px !important;
    padding: 2px 2px 6px 2px !important;
    margin-bottom: 8px !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: thin;
    flex-wrap: nowrap !important;
  }

  .metric-card {
    flex: 0 0 115px !important;
    min-width: 115px !important;
    padding: 6px 8px !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important;
  }

  .metric-card .metric-label {
    font-size: 0.64rem !important;
  }

  .metric-card .metric-value {
    font-size: 1.05rem !important;
    margin-top: 2px !important;
  }

  .metric-card .metric-sub {
    font-size: 0.62rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Manager Toolbar & Filters */
  #manager-toolbar {
    padding: 6px 8px !important;
    margin-bottom: 8px !important;
    flex-direction: column !important;
    gap: 6px !important;
  }

  .toolbar-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 5px !important;
    width: 100% !important;
  }

  .toolbar-filters .checkbox-label {
    font-size: 0.7rem !important;
    padding: 3px 6px !important;
    background: var(--surface-subtle) !important;
    border: 1px solid var(--border) !important;
    border-radius: 12px !important;
    cursor: pointer !important;
  }

  #manager-toolbar > div:last-child {
    display: flex !important;
    gap: 6px !important;
    width: 100% !important;
  }

  #manager-toolbar .btn {
    flex: 1 !important;
    padding: 5px 6px !important;
    font-size: 0.72rem !important;
    justify-content: center !important;
  }

  /* DETAILED SKU RECONCILIATION TABLE
     Freeze Brand and SKU columns on horizontal scroll */
  #reconciliation-view-wrap .data-table th:first-child,
  #reconciliation-view-wrap .data-table td:first-child {
    position: sticky !important;
    left: 0 !important;
    z-index: 15 !important;
    background: var(--surface) !important;
    min-width: 65px !important;
    max-width: 80px !important;
    font-size: 0.74rem !important;
    padding: 5px 6px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #reconciliation-view-wrap .data-table thead th:first-child {
    z-index: 30 !important;
    background: var(--table-th-bg) !important;
  }

  #reconciliation-view-wrap .data-table th:nth-child(2),
  #reconciliation-view-wrap .data-table td:nth-child(2) {
    position: sticky !important;
    left: 65px !important;
    z-index: 14 !important;
    background: var(--surface) !important;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.08) !important;
    min-width: 80px !important;
    max-width: 95px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    padding: 5px 6px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  #reconciliation-view-wrap .data-table thead th:nth-child(2) {
    z-index: 29 !important;
    background: var(--table-th-bg) !important;
  }

  #reconciliation-view-wrap .data-table tbody tr:hover td:first-child,
  #reconciliation-view-wrap .data-table tbody tr:hover td:nth-child(2) {
    background-color: var(--surface-hover) !important;
  }

  #reconciliation-view-wrap .tr-variance-highlight td:first-child,
  #reconciliation-view-wrap .tr-variance-highlight td:nth-child(2) {
    background-color: var(--yellow-highlight) !important;
  }

  #reconciliation-view-wrap .data-table td {
    padding: 5px 6px !important;
    font-size: 0.76rem !important;
  }

  /* Compact styling for other manager tables */
  .ye-dashboard-table th, .ye-dashboard-table td {
    padding: 5px 5px !important;
    font-size: 0.74rem !important;
  }

  #mapping-table td, #teams-table td, #audit-table td {
    padding: 5px 6px !important;
    font-size: 0.75rem !important;
  }

  .brand-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  /* AI Chatbot Floating Button & Chat Window */
  .ai-fab {
    bottom: 12px !important;
    right: 12px !important;
    padding: 7px 12px !important;
    font-size: 0.76rem !important;
    box-shadow: 0 4px 10px rgba(207, 73, 93, 0.35) !important;
  }

  .ai-chat-window {
    bottom: 60px !important;
    right: 8px !important;
    width: calc(100vw - 16px) !important;
    height: 440px !important;
  }
}

/* ==========================================================================
   MASTER BRAND MAPPING STYLES
   ========================================================================== */
.mapping-input-wrapper {
  position: relative;
  width: 100%;
}

.mapping-brand-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  background-color: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mapping-brand-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background-color: #fff;
}

[data-theme="dark"] .mapping-brand-input:focus {
  background-color: var(--surface-subtle);
}

.status-pill.status-mapped {
  background-color: #dbeafe !important;
  color: #1d4ed8 !important;
  border: 1px solid #bfdbfe;
  font-weight: 700;
}

[data-theme="dark"] .status-pill.status-mapped {
  background-color: #1e3a8a !important;
  color: #93c5fd !important;
  border-color: #1e40af;
}

.status-pill.status-direct {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  border: 1px solid #e2e8f0;
  font-weight: 600;
}

[data-theme="dark"] .status-pill.status-direct {
  background-color: #1e293b !important;
  color: #94a3b8 !important;
  border-color: #334155;
}

/* ==========================================================================
   GLOBAL CONTROLS & ICON BUTTONS (Req 2)
   ========================================================================== */
.btn-icon-square {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.15s ease-in-out;
  padding: 0;
}

.btn-icon-square:hover {
  background: var(--surface-hover);
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon-square:active {
  transform: translateY(0);
}

/* ==========================================================================
   BRAND MULTISELECT DROPDOWN FOR COUNTING TEAMS (Req 6 & 9)
   ========================================================================== */
.brand-multiselect-container {
  position: relative;
  width: 100%;
}

.brand-multiselect-trigger {
  width: 100%;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.brand-multiselect-trigger:hover {
  border-color: var(--primary);
}

.brand-multiselect-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-tag-chip {
  display: inline-flex;
  align-items: center;
  background: var(--primary-subtle);
  color: var(--primary);
  border: 1px solid var(--primary-glow);
  border-radius: 12px;
  padding: 1px 7px;
  font-size: 0.72rem;
  font-weight: 700;
}

[data-theme="dark"] .brand-tag-chip {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.brand-multiselect-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 260px;
  max-width: 320px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  z-index: 100;
  padding: 6px;
  display: none;
}

.brand-multiselect-menu.open {
  display: block;
}

.brand-multiselect-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.1s ease;
}

.brand-multiselect-item:hover {
  background: var(--surface-hover);
}

.brand-multiselect-item.disabled {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: line-through;
}

.brand-multiselect-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   AUDIT TRAIL LOG BADGES (Req 5)
   ========================================================================== */
.audit-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.audit-badge.audit-login {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}

.audit-badge.audit-count {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.audit-badge.audit-status {
  background: #fef3c7;
  color: #b45309;
  border: 1px solid #fde68a;
}

.audit-badge.audit-team {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.audit-badge.audit-auth {
  background: #fee2e2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .audit-badge.audit-login {
  background: rgba(3, 105, 161, 0.2);
  color: #7dd3fc;
  border-color: rgba(3, 105, 161, 0.4);
}

[data-theme="dark"] .audit-badge.audit-count {
  background: rgba(21, 128, 61, 0.2);
  color: #86efac;
  border-color: rgba(21, 128, 61, 0.4);
}

[data-theme="dark"] .audit-badge.audit-status {
  background: rgba(180, 83, 9, 0.2);
  color: #fcd34d;
  border-color: rgba(180, 83, 9, 0.4);
}

[data-theme="dark"] .audit-badge.audit-team {
  background: rgba(109, 40, 217, 0.2);
  color: #c4b5fd;
  border-color: rgba(109, 40, 217, 0.4);
}

[data-theme="dark"] .audit-badge.audit-auth {
  background: rgba(185, 28, 28, 0.2);
  color: #fca5a5;
  border-color: rgba(185, 28, 28, 0.4);
}

/* ==========================================================================
   FULL-SCREEN DEDICATED LOGIN SCREEN
   ========================================================================== */
.login-screen-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(24, 27, 52, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 50% 15%, rgba(207, 73, 93, 0.08), transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 85%, rgba(99, 102, 241, 0.04) 0%, transparent 60%);
  background-size: 24px 24px, 100% 100%, 100% 100%;
  background-attachment: fixed;
  transition: background-color 0.25s ease;
}

[data-theme="dark"] .login-screen-wrapper {
  background-color: var(--bg);
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    radial-gradient(circle at 50% 15%, rgba(207, 73, 93, 0.12), transparent 70%),
    radial-gradient(ellipse 70% 50% at 85% 85%, rgba(99, 102, 241, 0.07) 0%, transparent 60%);
  background-size: 24px 24px, 100% 100%, 100% 100%;
  background-attachment: fixed;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 30px 28px 30px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.08);
  transition: background-color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

[data-theme="dark"] .login-card {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.login-card-header {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  height: 48px;
  max-width: 190px;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
}

.login-subtitle {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 500;
}

.login-field-group {
  margin-bottom: 16px;
}

.login-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.login-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.login-select {
  cursor: pointer;
}

.login-role-tabs {
  display: flex;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 18px;
  gap: 4px;
}

.login-role-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  font-family: inherit;
}

.login-role-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .login-role-tab.active {
  background: var(--surface-hover);
  color: #fff;
}

.login-grid-row {
  display: flex;
  gap: 10px;
}

.login-pw-input {
  padding-right: 42px;
  font-size: 1.05rem;
}

.login-pw-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 1.05rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  line-height: 1;
}

.login-error-banner {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 12px;
  text-align: center;
}

[data-theme="dark"] .login-error-banner {
  background: #450a0a;
  color: #fecaca;
  border-color: #7f1d1d;
}

.login-meta-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  font-size: 0.8rem;
}

.login-forgot-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.login-forgot-link:hover {
  text-decoration: underline;
}

.login-security-badge {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.login-submit-btn {
  width: 100%;
  height: 44px;
  margin-top: 18px;
  font-size: 0.98rem;
  font-weight: 800;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.login-footer-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.btn-header-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 5px 12px;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-header-logout:hover {
  border-color: #e11d48;
  color: #e11d48;
  background: #fff1f2;
}

[data-theme="dark"] .btn-header-logout:hover {
  background: #270e13;
  color: #fb7185;
  border-color: #fb7185;
}

/* Maintenance Mode Warning Banner */
.maintenance-warning-banner {
  background: #fef3c7;
  border-bottom: 2px solid #f59e0b;
  color: #92400e;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  position: sticky;
  top: 0;
  z-index: 999;
}

[data-theme="dark"] .maintenance-warning-banner {
  background: #451a03;
  border-bottom: 2px solid #b45309;
  color: #fde68a;
}

.maintenance-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-banner-action {
  background: #dc2626;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-banner-action:hover {
  background: #b91c1c;
}

/* Global Header Icon Button */
.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s ease;
  padding: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.header-icon-btn:hover {
  background: var(--surface-subtle);
  border-color: var(--primary);
  transform: translateY(-1px);
}

/* Maintenance Mode Active Indicator on Header Button */
#btn-toggle-maintenance.maintenance-active {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #b45309;
  animation: pulse-maint-btn 2s infinite ease-in-out;
}

[data-theme="dark"] #btn-toggle-maintenance.maintenance-active {
  background: #78350f;
  border-color: #d97706;
  color: #fef3c7;
}

@keyframes pulse-maint-btn {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}

/* Item Action Buttons for Unlisted / Unbranded Items */
.item-action-btns {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.btn-row-action {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.2;
  transition: all 0.15s ease;
}

.btn-row-action:hover {
  background: var(--surface-subtle);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-row-action.btn-row-delete {
  color: #e11d48;
  border-color: #fecaca;
  background: #fff1f2;
}

.btn-row-action.btn-row-delete:hover {
  background: #ffe4e6;
  border-color: #e11d48;
}

[data-theme="dark"] .btn-row-action.btn-row-delete {
  background: #450a0a;
  color: #fca5a5;
  border-color: #7f1d1d;
}

[data-theme="dark"] .btn-row-action.btn-row-delete:hover {
  background: #7f1d1d;
  color: #ffffff;
}

/* ==========================================================================
   SORTABLE COLUMN HEADERS
   ========================================================================== */
th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease;
}

th.sortable:hover {
  background-color: var(--surface-hover) !important;
  color: var(--primary);
}

th.sortable .sort-indicator {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.72rem;
  opacity: 0.35;
  transition: opacity 0.15s, transform 0.15s;
}

th.sortable.sorted-asc .sort-indicator,
th.sortable.sorted-desc .sort-indicator {
  opacity: 1;
  color: var(--primary);
  font-weight: 800;
}

/* ==========================================================================
   SPOTLIGHT COMMAND PALETTE (Ctrl+K / Cmd+K)
   ========================================================================== */
.command-palette-card {
  width: 100%;
  max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  animation: paletteScaleIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
}

@keyframes paletteScaleIn {
  from { opacity: 0; transform: scale(0.96) translateY(-10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.command-palette-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.command-palette-input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
}

.command-palette-badge {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.command-palette-results {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
  padding: 8px;
}

.command-palette-group-title {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 10px 4px;
  letter-spacing: 0.04em;
}

.command-palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  font-size: 0.88rem;
  color: var(--text);
}

.command-palette-item:hover,
.command-palette-item.active {
  background: var(--surface-hover);
  color: var(--primary);
}

.command-palette-item.active {
  background: var(--primary-light);
}

.command-palette-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.command-palette-item-icon {
  font-size: 1.05rem;
  width: 22px;
  text-align: center;
}

.command-palette-item-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.command-palette-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   SMART UNDO TOAST NOTIFICATION
   ========================================================================== */
.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 1050;
  background: var(--navy-hero);
  color: #ffffff;
  border-radius: 30px;
  padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  animation: undoSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

@keyframes undoSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-undo {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-undo:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

.undo-toast-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

/* ==========================================================================
   LIVE SYNC STATUS BADGE
   ========================================================================== */
.sync-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
  transition: all 0.2s ease;
}

.sync-status-badge.live {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

[data-theme="dark"] .sync-status-badge.live {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border-color: rgba(34, 197, 94, 0.3);
}

.sync-status-badge.offline {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
  animation: offlineBlink 1.5s infinite ease-in-out;
}

[data-theme="dark"] .sync-status-badge.offline {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.4);
}

@keyframes offlineBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ==========================================================================
   TABLE DENSITY STYLES (Compact vs Comfortable)
   ========================================================================== */
.table-compact .data-table td,
.table-compact .data-table th {
  padding: 4px 8px !important;
  font-size: 0.8rem !important;
}

.table-compact .counter-input-cell {
  padding: 2px 4px !important;
  font-size: 0.85rem !important;
  width: 76px !important;
  height: 28px !important;
}

.table-compact .btn-row-action {
  padding: 1px 4px !important;
  font-size: 0.65rem !important;
}


