@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@500;600;700;800&display=swap');

/* ══════════════════════════════════════════════════════
   GLOBAL VARIABLES & RESET
══════════════════════════════════════════════════════ */
:root {
  --primary:        #2563eb;
  --primary-hover:  #1d4ed8;
  --primary-light:  #eff6ff;
  --primary-border: #bfdbfe;
  --success:        #16a34a;
  --success-light:  #f0fdf4;
  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --purple:         #7c3aed;
  --purple-light:   #f5f3ff;
  --ink:            #0f172a;
  --ink-2:          #334155;
  --ink-3:          #64748b;
  --ink-4:          #94a3b8;
  --line:           #e2e8f0;
  --line-2:         #f1f5f9;
  --bg:             #f8fafc;
  --card-bg:        #ffffff;
  --topbar-h:       46px;
  --sidebar-w:      236px;
  --radius:         10px;
  --radius-sm:      6px;
  --shadow-sm:      0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow:         0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.04);
  --shadow-md:      0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.04);
  --shadow-lg:      0 20px 25px -5px rgb(0 0 0 / 0.1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: none; background: none; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
a { color: inherit; text-decoration: none; }
p { line-height: 1.6; }

/* ══════════════════════════════════════════════════════
   CHROME-STYLE FIXED TOP HEADER
══════════════════════════════════════════════════════ */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #0f172a;
  display: flex;
  align-items: flex-end;
  padding: 0 16px 0 14px;
  z-index: 1000;
  user-select: none;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topbar-left {
  display: flex;
  align-items: center;
  height: 100%;
  padding-bottom: 6px;
  padding-right: 14px;
  flex-shrink: 0;
  gap: 12px;
}

/* Header Active Store Pill Badge */
.header-active-store {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px 4px 6px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 11.5px;
  color: #f8fafc;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  max-width: 320px;
}
.header-active-store:hover {
  filter: brightness(1.18);
  transform: translateY(-1px);
}
.header-active-store .store-badge-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  background: #334155;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.header-active-store .store-badge-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-weight: 700;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.4);
  color: #e2e8f0;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}
.header-active-store .store-badge-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Modal Target Brand Strip */
.qu-target-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 14px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: background-color 0.25s ease;
}
.qu-banner-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

/* Platform Mismatch Shield Warning Card */
.mismatch-shield-card {
  animation: mismatch-pulse 2s infinite ease-in-out;
}
@keyframes mismatch-pulse {
  0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0.4); }
  70% { box-shadow: 0 0 0 8px rgba(225, 29, 72, 0); }
  100% { box-shadow: 0 0 0 0 rgba(225, 29, 72, 0); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brandmark {
  background: var(--primary);
  color: #fff;
  border-radius: 7px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(37,99,235,0.4);
}
.brand-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 800;
  font-size: 14.5px;
  color: #fff;
  letter-spacing: -0.3px;
}
.brand-dot { color: #60a5fa; }

/* Chrome Browser Tabs */
.chrome-tabs {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  flex: 1;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  padding-left: 8px;
}
.chrome-tabs::-webkit-scrollbar { display: none; }

.chrome-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.55);
  cursor: pointer;
  border-radius: 8px 8px 0 0;
  background: transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid transparent;
  border-bottom: none;
}
.chrome-tab:hover {
  color: #ffffff;
  background: rgba(255,255,255,0.08);
}
.chrome-tab.active {
  background: var(--bg);
  color: var(--ink);
  font-weight: 600;
  border-color: rgba(255,255,255,0.12);
  border-bottom: 1px solid var(--bg);
  margin-bottom: -1px;
  z-index: 2;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.15);
}
.chrome-tab svg { width: 14px; height: 14px; opacity: 0.75; }
.chrome-tab.active svg { opacity: 1; color: var(--primary); }

.tab-badge {
  background: #ef4444;
  color: #fff;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
}

/* Header Right Actions */
.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding-bottom: 6px;
  flex-shrink: 0;
}
.cloud-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-right: 4px;
}
.dot {
  width: 6px; height: 6px;
  background: #22c55e;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 2px rgba(34,197,94,0.3);
}
.header-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
}
.header-btn:hover {
  background: rgba(255,255,255,0.16);
  color: #ffffff;
}
.header-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
.header-btn.primary:hover {
  background: var(--primary-hover);
}

/* ══════════════════════════════════════════════════════
   APP LAYOUT (LEFT SIDEBAR + RIGHT WORKSPACE)
══════════════════════════════════════════════════════ */
.app-layout {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h) - 38px);
}

/* ─── LEFT: PLATFORM SIDEBAR ─── */
.platform-sidebar {
  position: fixed;
  top: var(--topbar-h);
  left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: #1e293b;
  border-right: 1px solid rgba(255,255,255,0.08);
  display: flex;
  flex-direction: column;
  z-index: 900;
  overflow: hidden;
}

.ps-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
.ps-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.4);
}
.ps-add-btn {
  background: rgba(37,99,235,0.25);
  border: 1px solid rgba(37,99,235,0.45);
  color: #93c5fd;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: 600;
  transition: all 0.15s;
}
.ps-add-btn:hover {
  background: var(--primary);
  color: #fff;
}

.platform-list {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.platform-list::-webkit-scrollbar { width: 4px; }
.platform-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

/* Platform Tab Items */
.platform-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  transition: all 0.15s ease;
  position: relative;
  user-select: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.platform-item:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}
.platform-item.active {
  background: rgba(37,99,235,0.22);
  color: #fff;
  border-left: 3px solid var(--primary);
  font-weight: 600;
}
.platform-item.active::after {
  content: '';
  position: absolute;
  right: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #60a5fa;
}

.p-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 13px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.p-icon.all      { background: #334155; color: #f8fafc; font-size: 14px; }
.p-icon.Amazon   { background: #ea580c; color: #fff; }
.p-icon.Flipkart { background: #2563eb; color: #fff; }
.p-icon.Meesho   { background: #a21caf; color: #fff; }
.p-icon.Myntra   { background: #e11d48; color: #fff; }
.p-icon.custom   { background: #475569; color: #cbd5e1; }

.p-details {
  flex: 1;
  min-width: 0;
}
.p-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.p-meta {
  font-size: 10px;
  color: rgba(255,255,255,0.4);
  display: flex;
  gap: 6px;
  margin-top: 1px;
}
.p-meta span { color: #86efac; font-weight: 500; }

.p-delete {
  opacity: 0;
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.15s;
}
.platform-item:hover .p-delete { opacity: 1; }
.p-delete:hover { color: #f87171; background: rgba(239,68,68,0.2); }

/* Platform Sidebar Footer */
.ps-footer {
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.07);
}
.ps-stat-box {
  background: rgba(0,0,0,0.25);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
}
.ps-stat-label { font-size: 10px; color: rgba(255,255,255,0.4); display: block; }
.ps-stat-val { font-size: 14px; font-weight: 700; color: #93c5fd; }
.ps-quick-btn {
  display: block;
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11px;
  text-align: center;
  transition: all 0.15s;
}
.ps-quick-btn:hover {
  background: rgba(255,255,255,0.14);
  color: #fff;
}

/* ─── RIGHT: MAIN WORKSPACE ─── */
.main-workspace {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  padding: 20px 28px 40px;
}

/* ══════════════════════════════════════════════════════
   STORE SUB-TABS STRIP (TOP HORIZONTAL STORE SWITCHER)
══════════════════════════════════════════════════════ */
.store-subtabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  position: relative;
}

.store-subtabs-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
}

.store-subtabs-brand-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding-right: 10px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  user-select: none;
}
.store-subtabs-brand-tag .mkt-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
}

.store-subtabs-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.store-subtabs-nav::-webkit-scrollbar {
  display: none;
}

.store-subtab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.18s ease;
  user-select: none;
  text-decoration: none;
}
.store-subtab-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}
.store-subtab-btn.active {
  background: #ffffff;
  font-weight: 700;
  border-width: 1.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.store-subtab-btn .subtab-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5.5px;
  border-radius: 4px;
  letter-spacing: 0.3px;
  background: #e2e8f0;
  color: #475569;
}

.store-subtab-btn.active .subtab-id {
  color: #ffffff;
}

.store-subtab-btn .subtab-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-subtab-btn .subtab-meta {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
  margin-left: 2px;
}
.store-subtab-btn.active .subtab-meta {
  opacity: 0.85;
}

.store-subtabs-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.store-subtab-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #475569;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.store-subtab-add-btn:hover {
  background: #f1f5f9;
  border-color: var(--primary);
  color: var(--primary);
}

/* ══════════════════════════════════════════════════════
   GLOBAL TIME HORIZON BAR (DATE RANGE SWITCHER)
══════════════════════════════════════════════════════ */
.time-horizon-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.th-left {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  flex: 1;
  min-width: 320px;
}

.th-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding-right: 10px;
  border-right: 1px solid var(--line);
  flex-shrink: 0;
  user-select: none;
}

.th-pills-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.th-pills-wrap::-webkit-scrollbar {
  display: none;
}

.th-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}
.th-pill:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.th-pill.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}

.th-pill.month-pill {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}
.th-pill.month-pill:hover {
  background: #dcfce7;
  border-color: #86efac;
}
.th-pill.month-pill.active {
  background: #16a34a;
  border-color: #15803d;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.28);
}

.th-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.th-custom-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.th-date-input {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  font-family: inherit;
}
.th-date-input:focus {
  border-color: var(--primary);
}

.th-apply-btn {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.th-apply-btn:hover {
  filter: brightness(1.1);
}

.th-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.th-reset-btn:hover {
  background: #fecaca;
  color: #991b1b;
}

.th-active-tag {
  font-size: 11.5px;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 3px 9px;
  border-radius: 6px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* Monthly Ledger Table */
.monthly-ledger-card {
  margin-top: 20px;
}
.monthly-ledger-card .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btn-view-month {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-light);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-view-month:hover {
  background: var(--primary);
  color: #fff;
}

/* ══════════════════════════════════════════════════════
   PLATFORM BANNER & 4 QUICK UPLOAD CARDS
══════════════════════════════════════════════════════ */
.platform-banner {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.pb-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.pb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.pb-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.pb-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}
.pb-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* KPI Mini Strip */
.pb-kpis {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  padding: 12px 14px;
  background: var(--line-2);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.pb-kpi-item {
  display: flex;
  flex-direction: column;
}
.pb-kpi-label { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.pb-kpi-val { font-size: 16px; font-weight: 800; color: var(--ink); margin-top: 2px; }
.pb-kpi-val.positive { color: var(--success); }
.pb-kpi-val.warn { color: var(--warning); }
.pb-kpi-val.danger { color: var(--danger); }
.pb-kpi-sub {
  font-size: 9.5px;
  color: var(--ink-4);
  margin-top: 3px;
  font-weight: 500;
  line-height: 1.25;
}

/* 4 Dedicated Upload Cards */
.upload-cards-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.upload-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.upload-card {
  border: 1.5px dashed var(--line);
  background: #fafcf9;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  text-align: left;
}
.upload-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.uc-icon {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 16px;
  flex-shrink: 0;
}
.uc-icon.orders      { background: #eff6ff; color: #2563eb; }
.uc-icon.returns     { background: #fef2f2; color: #dc2626; }
.uc-icon.ads         { background: #f5f3ff; color: #7c3aed; }
.uc-icon.settlements { background: #f0fdf4; color: #16a34a; }
.uc-icon.catalog     { background: #fffbeb; color: #d97706; }

.uc-text { flex: 1; min-width: 0; }
.uc-title { font-size: 12.5px; font-weight: 700; color: var(--ink); display: block; }
.uc-desc { font-size: 10.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.uc-btn-hint {
  font-size: 10px;
  font-weight: 600;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 6px;
}

/* ══════════════════════════════════════════════════════
   CONTENT CONTAINER & VIEWS
══════════════════════════════════════════════════════ */
.content-container {
  max-width: 1600px;
  margin: 0 auto;
}

/* Page Headings */
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 14px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 4px;
}
h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
  margin-bottom: 3px;
}
h2 { font-size: 14px; font-weight: 700; color: var(--ink); }
h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.subtitle { font-size: 12.5px; color: var(--ink-3); }

/* Common Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 550;
  white-space: nowrap;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--line-2); border-color: #cbd5e1; }
.btn.primary { background: var(--primary) !important; color: #ffffff !important; border-color: var(--primary) !important; font-weight: 600; }
.btn.primary:hover { background: var(--primary-hover) !important; color: #ffffff !important; border-color: var(--primary-hover) !important; }
.btn.danger { background: var(--danger) !important; color: #ffffff !important; border-color: var(--danger) !important; font-weight: 600; }
.btn.danger:hover { background: #b91c1c !important; color: #ffffff !important; border-color: #b91c1c !important; }
.btn.success { background: #16a34a !important; color: #ffffff !important; border-color: #16a34a !important; font-weight: 600; }
.btn.success:hover { background: #15803d !important; color: #ffffff !important; border-color: #15803d !important; }
.btn svg { width: 14px; height: 14px; }
.text-btn { color: var(--primary); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: var(--danger) !important; }
.text-btn.danger:hover { color: #b91c1c !important; text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   STAT CARDS (OVERVIEW)
══════════════════════════════════════════════════════ */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 500;
  margin-bottom: 8px;
}
.stat-icon {
  width: 26px; height: 26px;
  background: var(--line-2);
  border-radius: 6px;
  display: grid; place-items: center;
  font-size: 12px;
  color: var(--ink-3);
}
.stat-value {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.1;
}
.stat-note { font-size: 10.5px; color: var(--ink-4); }
.stat-note strong { color: var(--success); font-weight: 600; }

.stat.highlight {
  background: var(--primary);
  border-color: var(--primary-hover);
  color: #fff;
}
.stat.highlight .stat-label { color: rgba(255,255,255,0.7); }
.stat.highlight .stat-icon { background: rgba(255,255,255,0.15); color: #fff; }
.stat.highlight .stat-value { color: #fff; }
.stat.highlight .stat-note { color: rgba(255,255,255,0.7); }
.stat.highlight .stat-note strong { color: #bfdbfe; }

/* Calculation Formula Notes */
.calc-formula {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-4);
  margin-top: 2.5px;
  line-height: 1.25;
}
.stat-note .calc-formula {
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 500;
}
.stat.highlight .stat-note .calc-formula {
  color: #dbeafe;
}
.pnl-calc {
  display: block;
  font-size: 10.5px;
  color: var(--ink-4);
  font-weight: 400;
  margin-top: 2px;
}

/* ══════════════════════════════════════════════════════
   SERVER DATA FETCHING: BLURRED SHIMMER ANIMATION
   ══════════════════════════════════════════════════════ */
@keyframes serverDataBlurPulse {
  0% {
    filter: blur(5px);
    opacity: 0.35;
  }
  50% {
    filter: blur(3px);
    opacity: 0.85;
  }
  100% {
    filter: blur(5px);
    opacity: 0.35;
  }
}

@keyframes shimmerBg {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.blurred-data-val {
  display: inline-block;
  min-width: 70px;
  filter: blur(5px);
  opacity: 0.7;
  animation: serverDataBlurPulse 1.8s ease-in-out infinite, shimmerBg 2.5s linear infinite;
  user-select: none;
  pointer-events: none;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.18) 25%, rgba(99, 102, 241, 0.35) 50%, rgba(148, 163, 184, 0.18) 75%);
  background-size: 200% 100%;
  padding: 0 6px;
  letter-spacing: 2px;
}

.stat.highlight .blurred-data-val {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.2) 25%, rgba(255, 255, 255, 0.45) 50%, rgba(255, 255, 255, 0.2) 75%);
  background-size: 200% 100%;
  color: #fff;
}

.blurred-data-note {
  display: inline-block;
  filter: blur(3.5px);
  opacity: 0.6;
  animation: serverDataBlurPulse 2s ease-in-out infinite;
  user-select: none;
  pointer-events: none;
  letter-spacing: 0.8px;
}

.blurred-row td {
  position: relative;
  overflow: hidden;
}

.blurred-row strong,
.blurred-row span,
.blurred-row small,
.blurred-row .calc-formula {
  filter: blur(4.5px);
  opacity: 0.55;
  animation: serverDataBlurPulse 2s ease-in-out infinite;
  user-select: none;
}

.blurred-chart {
  position: relative;
  overflow: hidden;
}

.chart-shimmer-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 10;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  border-radius: var(--radius);
}

.blurred-bar {
  filter: blur(3px);
  animation: serverDataBlurPulse 1.6s ease-in-out infinite;
}

.server-fetch-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 12.5px;
  line-height: 1.4;
  box-shadow: var(--shadow-sm);
}

.server-fetch-alert.info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.server-fetch-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.server-fetch-alert .alert-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: alertSpinner 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes alertSpinner {
  to { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════
   CARDS & GRIDS
══════════════════════════════════════════════════════ */
.card {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line-2);
}
.card-head p { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

.grid-two    { display: grid; grid-template-columns: 1.65fr 1fr; gap: 16px; margin-bottom: 16px; }
.bottom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.section-gap { margin-top: 16px; }

/* Chart */
.legend { display: flex; gap: 12px; font-size: 11px; color: var(--ink-3); align-items: center; }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.chart { height: 195px; padding: 10px 18px 26px 40px; position: relative; }
.chart-grid {
  position: absolute;
  inset: 10px 18px 26px 40px;
  display: flex; flex-direction: column;
  justify-content: space-between;
}
.chart-grid div { border-top: 1px dashed var(--line); position: relative; }
.chart-grid span { position: absolute; left: -40px; top: -7px; font-size: 9px; color: var(--ink-4); }
.chart-bars {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 100%; gap: 4px;
}
.bar-group { height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 4px; position: relative; width: 10%; }
.bar { width: 13px; border-radius: 3px 3px 0 0; background: var(--primary); min-height: 2px; }
.bar.profit { background: #86efac; }
.bar-group span { position: absolute; bottom: -18px; font-size: 9px; color: var(--ink-4); white-space: nowrap; }
.chart-summary {
  padding: 10px 18px;
  background: var(--line-2);
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
  font-size: 10px; color: var(--ink-3);
}
.chart-summary b { color: var(--primary); font-weight: 600; }

/* Market List */
.market-list { padding: 0 18px 6px; }
.market-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-2);
}
.market-row:last-child { border: 0; }
.market-logo {
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  flex-shrink: 0;
}
.market-info { flex: 1; min-width: 0; }
.market-info strong { display: block; font-size: 12px; font-weight: 600; }
.market-info small { font-size: 10px; color: var(--ink-4); }
.market-money { text-align: right; font-size: 12.5px; font-weight: 700; }
.market-money small { display: block; font-size: 9.5px; font-weight: 400; color: var(--ink-4); margin-top: 1px; }
.progress { height: 4px; background: var(--line); margin-top: 6px; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* ══════════════════════════════════════════════════════
   TABLES
══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th {
  background: var(--line-2);
  color: var(--ink-3);
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
}
td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-2);
  font-size: 12px; color: var(--ink-2);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafc; }
td strong { font-weight: 600; color: var(--ink); }
.table-foot {
  display: flex; justify-content: space-between;
  padding: 10px 16px;
  font-size: 11px; color: var(--ink-4);
  border-top: 1px solid var(--line-2);
  background: var(--line-2);
}

.product-cell { display: flex; gap: 8px; align-items: center; }
.product-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--line-2);
  color: var(--ink-3);
  display: grid; place-items: center;
  font-size: 13px; flex-shrink: 0;
  border: 1px solid var(--line);
}
.product-cell small { display: block; color: var(--ink-4); font-size: 9.5px; margin-top: 1px; }

/* Pills */
.pill {
  display: inline-flex; align-items: center;
  padding: 2.5px 7px;
  border-radius: 999px;
  font-size: 10px; font-weight: 600;
  background: #dcfce7; color: #15803d;
}
.pill.warn   { background: #fef3c7; color: #b45309; }
.pill.gray   { background: var(--line-2); color: var(--ink-3); }
.pill.danger { background: #fee2e2; color: #b91c1c !important; font-weight: 600; }

/* Toolbar */

/* ══════════════════════════════════════════════════════
   SMART TOOLBAR & QUICK CHIPS
══════════════════════════════════════════════════════ */
.table-controls-wrapper {
  background: var(--card-bg);
  border-bottom: 1px solid var(--line-2);
}
.quick-chips-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line-2);
  overflow-x: auto;
}
.quick-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: #ffffff;
  border: 1px solid var(--line);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}
.quick-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}
.quick-chip.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.25);
}
.quick-chip.chip-danger.active {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
  color: #ffffff !important;
}
.quick-chip.chip-warn.active {
  background: #d97706;
  border-color: #d97706;
  color: #ffffff;
}
.quick-chip .chip-count {
  background: rgba(0, 0, 0, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
}
.quick-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}
.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  align-items: center;
  background: var(--card-bg);
  flex-wrap: wrap;
}
.toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.filter-select:focus {
  border-color: var(--primary);
}
.filter-date-input {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  padding: 0 6px;
  font-size: 11px;
  color: var(--ink);
  outline: none;
}
.filter-date-input:focus {
  border-color: var(--primary);
}
.btn-reset-filters {
  height: 32px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}
.btn-reset-filters:hover {
  background: #fee2e2;
  border-color: #f87171;
}
.th-sortable {
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.th-sortable:hover {
  background: var(--line-2);
}
.th-sort-icon {
  display: inline-block;
  margin-left: 4px;
  font-size: 10px;
  color: var(--ink-4);
}
.th-sortable.active-sort .th-sort-icon {
  color: var(--primary);
  font-weight: 700;
}

.search-input {
  width: 220px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line-2);
  padding: 0 12px;
  font-size: 12px;
  color: var(--ink);
  transition: all 0.15s;
}
.search-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
  outline: none;
}

/* ══════════════════════════════════════════════════════
   EMPTY STATES & ALERTS
══════════════════════════════════════════════════════ */
.empty { padding: 48px 20px; text-align: center; }
.empty-icon { font-size: 32px; margin-bottom: 10px; color: var(--ink-4); display: block; }
.empty h2 { font-size: 15px; color: var(--ink-2); margin-bottom: 6px; }
.empty p { font-size: 12.5px; color: var(--ink-3); margin-bottom: 14px; }

.status-banner {
  display: flex; align-items: center; gap: 8px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  color: #92400e; font-size: 12px;
  margin-bottom: 16px;
}
.notice {
  display: flex; gap: 12px; align-items: center;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.notice > span { font-size: 18px; }
.notice h3 { font-size: 12.5px; margin-bottom: 2px; }
.notice p { font-size: 11.5px; color: var(--ink-3); margin: 0; }
.notice .btn { margin-left: auto; }

/* ══════════════════════════════════════════════════════
   IMPORT CENTER & MODALS
══════════════════════════════════════════════════════ */
.import-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.form-body { padding: 18px 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.upload-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px 18px;
  text-align: center;
  background: var(--line-2);
  margin-top: 14px;
  transition: all 0.2s;
}
.upload-zone:hover { border-color: var(--primary); background: var(--primary-light); }
.upload-zone h3 { margin: 8px 0 4px; font-size: 13px; }
.upload-zone p { font-size: 11.5px; color: var(--ink-3); }

/* Steps */
.steps { padding: 8px 18px 16px; }
.step { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.step:last-child { border: 0; }
.step-num {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700;
  flex-shrink: 0;
}
.step h3 { font-size: 11.5px; margin-bottom: 2px; }
.step p { font-size: 10.5px; color: var(--ink-3); margin: 0; }

/* Mapping */
.mapping { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.issue {
  padding: 9px 12px;
  background: var(--danger-light); color: var(--danger);
  border-radius: 6px; margin: 5px 0; font-size: 11.5px;
  border-left: 3px solid var(--danger);
}
.success {
  padding: 10px 12px;
  background: var(--success-light); color: var(--success);
  border-radius: 6px; font-size: 12px;
  border-left: 3px solid var(--success);
}

/* Modals */
dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 520px; max-width: 95vw;
  padding: 22px;
  box-shadow: var(--shadow-lg);
  background: var(--card-bg);
}
dialog::backdrop { background: rgba(15,23,42,0.55); backdrop-filter: blur(3px); }
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px; padding-bottom: 12px;
  border-bottom: 1px solid var(--line-2);
}
.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-2);
}

/* Input Fields */
input[type=text], input[type=email], input[type=password],
input[type=number], input[type=date], select, textarea {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 11px;
  color: var(--ink);
  font-size: 12.5px;
  transition: all 0.15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37,99,235,0.12);
  outline: none;
}
label { display: block; font-size: 11.5px; font-weight: 550; color: var(--ink-2); margin-bottom: 5px; }

/* Toast */
#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  z-index: 99999;
  font-size: 12.5px;
  font-weight: 500;
  display: none;
  opacity: 0;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 90vw;
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
#toast.toast-success {
  background: #064e3b;
  border-color: #059669;
}
#toast.toast-error {
  background: #7f1d1d;
  border-color: #dc2626;
}
#toast.toast-info {
  background: #0f172a;
  border-color: #3b82f6;
}
#toast.toast-loading {
  background: #1e293b;
  border-color: #475569;
}
#toast .toast-icon {
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Footer */
.app-footer {
  margin-left: var(--sidebar-w);
  padding: 12px 28px;
  color: var(--ink-4);
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  background: var(--card-bg);
}

/* Helper classes */
.muted    { color: var(--ink-3); font-size: 11.5px; }
.danger:not(.btn):not(.pill):not(.quick-chip):not(.header-btn) { color: var(--danger); }
.negative { color: var(--danger); font-weight: 600; }
.summary-note { padding: 10px 16px; color: var(--ink-3); font-size: 11px; border-top: 1px solid var(--line-2); background: var(--line-2); }
.file-name { word-break: break-all; }

/* ══════════════════════════════════════════════════════
   RESPONSIVE DESIGN
══════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .upload-card-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-two { grid-template-columns: 1fr; }
  .bottom-grid { grid-template-columns: 1fr; }
  .pb-kpis { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 60px; }
  .p-name, .p-meta, .ps-title-row span, .ps-stat-box, .ps-quick-btn { display: none; }
  .ps-title-row { justify-content: center; }
  .platform-item { justify-content: center; padding: 10px 0; }
  .platform-item.active::after { display: none; }
  .chrome-tab span { display: none; }
  .upload-card-grid { grid-template-columns: 1fr; }
  .pb-kpis { grid-template-columns: repeat(2, 1fr); }
  .main-workspace { padding: 14px 14px 30px; }
  .app-footer { margin-left: var(--sidebar-w); padding: 10px 14px; }
}

/* ══════════════════════════════════════════════════════
   AUTH MODAL & ADMIN PANEL ENHANCEMENTS
══════════════════════════════════════════════════════ */
.auth-nav {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin: -6px 0 18px;
}
.auth-nav-tab {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  transition: all 0.15s;
}
.auth-nav-tab:hover { color: var(--ink); }
.auth-nav-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrap input {
  padding-right: 40px !important;
}
.toggle-pwd-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink-3);
  padding: 4px;
  display: grid;
  place-items: center;
  user-select: none;
}
.toggle-pwd-btn:hover { color: var(--ink); }

.auth-sub-link {
  font-size: 11.5px;
  color: var(--primary);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
.auth-sub-link:hover { text-decoration: underline; }

/* Approval Pending Screen */
.approval-card {
  max-width: 520px;
  margin: 60px auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px 30px;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.ac-icon {
  font-size: 46px;
  display: block;
  margin-bottom: 14px;
}
.approval-card h2 {
  font-size: 20px;
  margin-bottom: 10px;
  color: var(--ink);
}
.approval-card p {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.6;
  margin-bottom: 24px;
}
.ac-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

/* Admin Panel */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 700;
}
.role-badge.admin {
  background: #fef3c7;
  color: #b45309;
}
.role-badge.member {
  background: var(--line-2);
  color: var(--ink-3);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.status-badge.approved {
  background: #dcfce7;
  color: #15803d;
}
.status-badge.pending {
  background: #fef3c7;
  color: #d97706;
}
.status-badge.rejected {
  background: #fee2e2;
  color: #dc2626;
}


/* ══════════════════════════════════════════════════════
   INLINE CATALOG EDITING INPUTS
══════════════════════════════════════════════════════ */
.inline-input {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 12px;
  color: var(--ink);
  background: #ffffff;
  transition: all 0.15s;
}
.inline-input:focus {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
  outline: none;
}
.inline-input.edited {
  border-color: #2563eb;
  background: #eff6ff;
}
.inline-input.inline-cost, .inline-input.inline-pack {
  width: 80px;
}
.inline-input.inline-master {
  width: 140px;
}

/* ══════════════════════════════════════════════════════
   HIGH-SPEED SERVER-SIDE PAGINATION
══════════════════════════════════════════════════════ */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--card-bg);
  border-top: 1px solid var(--line-2);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-current {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  padding: 0 6px;
}
.pagination-buttons .btn {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
}

/* ══════════════════════════════════════════════════════
   MULTI-STORE HIERARCHY & ACCOUNT SUB-ITEMS
══════════════════════════════════════════════════════ */
.platform-group {
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden;
}
.platform-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.15s ease;
  user-select: none;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.platform-group-header:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}
.platform-group-header.active {
  background: rgba(37, 99, 235, 0.25);
  color: #fff;
  border-left: 3px solid var(--primary);
  font-weight: 600;
}
.sub-account-list {
  padding: 2px 0 4px;
}
.platform-sub-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 36px;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11.5px;
  transition: all 0.15s;
  position: relative;
  user-select: none;
  width: 100%;
  text-align: left;
}
.platform-sub-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
.platform-sub-item.active {
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  font-weight: 600;
}
.platform-sub-item.active::after {
  content: '';
  position: absolute;
  right: 10px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #60a5fa;
}
.sub-dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  flex-shrink: 0;
}
.platform-sub-item.active .sub-dot {
  background: #60a5fa;
}
.sub-meta {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.4);
  margin-left: auto;
  padding-right: 4px;
}
.sub-meta span {
  color: #86efac;
}

/* Store ID Pill Badges */
.store-id-pill {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: inline-block;
  line-height: 1.3;
  flex-shrink: 0;
}
.platform-sub-item.active .store-id-pill {
  background: #2563eb;
  color: #ffffff;
  border-color: #3b82f6;
}
.store-id-pill.banner {
  font-size: 11px;
  padding: 2px 7px;
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #334155;
  margin-left: 8px;
  vertical-align: middle;
}
.store-id-pill.light {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}


/* ══════════════════════════════════════════════════════
   LAZY LOADING SPINNERS & PROGRESS FEEDBACK SYSTEM
══════════════════════════════════════════════════════ */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Circular Spinners */
.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.75s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  vertical-align: middle;
}
.spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}
.spinner-lg {
  width: 34px;
  height: 34px;
  border-width: 3px;
}
.spinner-primary {
  border-color: rgba(37, 99, 235, 0.2);
  border-top-color: var(--primary);
}
.spinner-dark {
  border-color: rgba(15, 23, 42, 0.15);
  border-top-color: var(--ink);
}

/* Button Loading States */
.btn.loading {
  position: relative;
  pointer-events: none !important;
  opacity: 0.85;
  cursor: wait !important;
}
.btn.loading .btn-text {
  opacity: 0.9;
}

/* Top Indeterminate Progress Bar */
#top-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2.5px;
  z-index: 99999;
  background: transparent;
  pointer-events: none;
  display: none;
}
#top-progress-bar.active {
  display: block;
  background: linear-gradient(90deg, #3b82f6, #60a5fa, #2563eb, #3b82f6);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}

/* Cloud Header Indicator Syncing State */
.cloud-indicator .dot.syncing {
  background: #3b82f6 !important;
  animation: pulse-glow 0.8s infinite ease-in-out;
}

/* Table Loading Overlay */
.table-loading-wrap {
  position: relative;
}
.table-loading-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 40;
  border-radius: var(--radius);
  animation: fadeIn 0.15s ease-out;
}
.table-loading-overlay .loading-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.table-loading-overlay .loading-sub {
  font-size: 11px;
  color: var(--ink-4);
}

/* Shimmer Skeleton */
.skeleton {
  background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}


/* ══════════════════════════════════════════════════════
   RESTRICTED ACCESS AUTH LOCKSCREEN GATE
══════════════════════════════════════════════════════ */
.auth-lockscreen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(circle at 50% 25%, #1e293b 0%, #0f172a 60%, #020617 100%);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  backdrop-filter: blur(10px);
}

.lockscreen-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: fadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.lockscreen-head {
  text-align: center;
  margin-bottom: 20px;
}

.lockscreen-icon-wrap {
  width: 52px;
  height: 52px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 12px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.lockscreen-brand {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
}
.lockscreen-brand .brandmark {
  font-size: 18px;
  color: var(--primary);
}
.lockscreen-brand .brand-name {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
}
.lockscreen-brand .brand-dot {
  color: var(--primary);
}

.lockscreen-head h2 {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
}
.lockscreen-head p {
  font-size: 12px;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

.lockscreen-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 18px;
  border: 1px solid #e2e8f0;
}
.lockscreen-tab {
  flex: 1;
  text-align: center;
  padding: 7px 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
.lockscreen-tab.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.lockscreen-alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 12px;
  margin-bottom: 16px;
  line-height: 1.4;
}
.lockscreen-alert.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
}
.lockscreen-alert.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.lockscreen-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 16px;
}

.lockscreen-submit-btn {
  width: 100%;
  height: 40px;
  font-size: 13.5px;
  font-weight: 600;
}

.lockscreen-footer {
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid #f1f5f9;
  margin-top: 20px;
  padding-top: 14px;
}
.ls-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: #94a3b8;
}
