:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-alt: #f8fafc;
  --sidebar: #0b1120;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --border: #e5eaf2;
  --border-strong: #d5deea;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --purple: #7c3aed;
  --purple-soft: #f5f3ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.05), 0 6px 16px -4px rgba(15, 23, 42, 0.05);
  --shadow-hover: 0 6px 20px -4px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 24px 54px -12px rgba(15, 23, 42, 0.28);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.55;
}

.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); font-weight: 700; }
.text-danger { color: var(--danger); font-weight: 700; }
.text-warning { color: var(--warning); font-weight: 700; }
.text-primary { color: var(--primary); font-weight: 700; }
.full-width { width: 100%; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-12 { margin-bottom: 14px; }
.loading-box {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-muted);
  font-weight: 500;
}

/* Custom sleek scrollbar */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==================== MODERN SPLIT-SCREEN LOGIN ==================== */
.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #060b18;
  padding: 28px;
  overflow: hidden;
}
.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
  opacity: 0.52;
}
.login-bg-orb.orb-1 {
  width: 560px;
  height: 560px;
  background: radial-gradient(circle, #2563eb 0%, transparent 70%);
  top: -140px;
  left: -120px;
}
.login-bg-orb.orb-2 {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, #0ea5e9 0%, #7c3aed 45%, transparent 72%);
  bottom: -160px;
  right: -120px;
}
.login-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at center, black 35%, transparent 85%);
  pointer-events: none;
}

.login-layout {
  position: relative;
  z-index: 2;
  width: min(1040px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 0.88fr;
  gap: 36px;
  align-items: center;
}

.login-hero {
  color: #f8fafc;
  padding: 12px 8px;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 99px;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(96, 165, 250, 0.28);
  color: #93c5fd;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  margin-bottom: 22px;
}
.hero-badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 10px #38bdf8;
}
.hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.hero-logo-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.45);
}
.hero-brand-name { font-size: 19px; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.hero-brand-sub { font-size: 12px; color: #94a3b8; }

.hero-headline {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lead {
  margin: 0 0 26px;
  font-size: 14px;
  color: #94a3b8;
  max-width: 500px;
  line-height: 1.7;
}

.hero-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 26px;
}
.hero-feat {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 13px 15px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}
.hero-feat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hero-feat-icon.blue { background: rgba(59, 130, 246, 0.18); color: #60a5fa; }
.hero-feat-icon.orange { background: rgba(249, 115, 22, 0.18); color: #fb923c; }
.hero-feat-icon.emerald { background: rgba(16, 185, 129, 0.18); color: #34d399; }
.hero-feat-title { font-size: 13.5px; font-weight: 700; color: #f1f5f9; margin-bottom: 2px; }
.hero-feat-desc { font-size: 12px; color: #94a3b8; line-height: 1.5; }

.hero-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #64748b;
}

.login-card {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  padding: 36px 34px 30px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.login-mobile-brand {
  display: none;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.login-card-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}
.login-card-head p {
  margin: 0 0 24px;
  font-size: 13px;
  color: #64748b;
}
.login-form { display: flex; flex-direction: column; gap: 16px; }
.input-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 13px;
  color: #94a3b8;
  pointer-events: none;
}
.input-icon-wrap input {
  width: 100%;
  padding: 11px 40px 11px 39px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  font-size: 14px;
  transition: all 0.18s var(--ease);
}
.input-icon-wrap input:hover { border-color: #cbd5e1; background: #fff; }
.input-icon-wrap input:focus {
  background: #fff;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.pwd-eye-btn {
  position: absolute;
  right: 10px;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
}
.pwd-eye-btn:hover { color: #334155; background: #f1f5f9; }
.btn-login-submit {
  margin-top: 6px;
  padding: 12px 16px !important;
  font-size: 14.5px !important;
  border-radius: 11px !important;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  box-shadow: 0 8px 20px -4px rgba(37, 99, 235, 0.5);
}
.btn-login-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -4px rgba(37, 99, 235, 0.58);
}
.login-error {
  padding: 10px 12px;
  border-radius: 9px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-size: 12.5px;
  font-weight: 500;
}
.login-card-footer {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 12px;
  color: #94a3b8;
}

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; max-width: 440px; }
  .login-hero { display: none; }
  .login-mobile-brand { display: flex; }
}

/* ==================== APP SHELL & SIDEBAR ==================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #0b1120 0%, #0f172a 65%, #111c34 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}
.brand-title { font-weight: 800; font-size: 15px; color: #fff; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: #94a3b8; margin-top: 1px; }

.nav-section-label {
  padding: 14px 18px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #64748b;
}
.nav-menu {
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}
.nav-item {
  border: none;
  background: transparent;
  color: #cbd5e1;
  padding: 10px 12px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: all 0.16s var(--ease);
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 6px 18px -4px rgba(37, 99, 235, 0.55);
}
.nav-icon {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
}
.nav-badge {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-weight: 700;
}
.nav-badge.warn { background: #f59e0b; color: #0f172a; }
.nav-badge.info { background: #0ea5e9; color: #fff; }
.nav-badge.danger { background: #ef4444; color: #fff; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.mode-box {
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 11px 12px;
}
.mode-box-label { font-size: 11px; color: #94a3b8; margin-bottom: 6px; }
.mode-pill-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  margin-bottom: 10px;
}
.mode-pill-wrap .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}
.mode-pill-wrap.bridge .dot {
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.28);
}

/* ==================== TOPBAR & WORKSPACE ==================== */
.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 13px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}
.topbar-desc { font-size: 12px; color: var(--text-muted); }
.topbar-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.mode-switcher {
  display: inline-flex;
  background: #eef2f7;
  padding: 3px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
}
.mode-seg {
  border: none;
  background: transparent;
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
.mode-seg.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 5px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 600;
}
.user-avatar {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  color: #fff;
  font-size: 11.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.security-banner {
  background: linear-gradient(90deg, #fffbeb, #fef3c7);
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  padding: 9px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  font-weight: 600;
}

.content {
  padding: 20px 26px 40px;
  flex: 1;
}

/* ==================== BUTTONS ==================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.16s var(--ease);
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-xs { padding: 4px 8px; font-size: 11.5px; border-radius: 6px; }
.btn-primary {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.28);
}
.btn-primary:hover {
  background: linear-gradient(180deg, #1d4ed8 0%, #1e40af 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.36);
}
.btn-success {
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.24);
}
.btn-success:hover { background: linear-gradient(180deg, #059669 0%, #047857 100%); }
.btn-warning {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.24);
}
.btn-warning:hover { background: linear-gradient(180deg, #d97706 0%, #b45309 100%); }
.btn-danger {
  background: linear-gradient(180deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.22);
}
.btn-danger:hover { background: #b91c1c; }
.btn-purple {
  background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
  color: #fff;
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.26);
}
.btn-purple:hover { background: #6d28d9; }
.btn-outline {
  background: #fff;
  border-color: var(--border-strong);
  color: #1e293b;
  box-shadow: var(--shadow-xs);
}
.btn-outline:hover { background: #f8fafc; border-color: #94a3b8; }
.btn-ghost-light {
  background: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.12);
}
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.16); }

/* ==================== CARDS & KPIS ==================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.card-title { font-size: 15.5px; font-weight: 800; margin: 0; letter-spacing: -0.01em; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(205px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  opacity: 0.75;
}
.kpi-card:nth-child(2)::before { background: linear-gradient(90deg, #f59e0b, #f97316); }
.kpi-card:nth-child(3)::before { background: linear-gradient(90deg, #0ea5e9, #2563eb); }
.kpi-card:nth-child(4)::before { background: linear-gradient(90deg, #8b5cf6, #ec4899); }
.kpi-card:nth-child(5)::before { background: linear-gradient(90deg, #334155, #64748b); }
.kpi-card:nth-child(6)::before { background: linear-gradient(90deg, #10b981, #059669); }
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.kpi-label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.kpi-val { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
.kpi-sub { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; }
.grid-2-eq { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1120px) { .grid-2, .grid-2-eq { grid-template-columns: 1fr; } }

/* ==================== BADGES & TAGS ==================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2.5px 9px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-blue { background: #eff6ff; color: #1d4ed8; box-shadow: inset 0 0 0 1px #dbeafe; }
.badge-green { background: #ecfdf5; color: #047857; box-shadow: inset 0 0 0 1px #d1fae5; }
.badge-amber { background: #fffbeb; color: #b45309; box-shadow: inset 0 0 0 1px #fde68a; }
.badge-red { background: #fef2f2; color: #b91c1c; box-shadow: inset 0 0 0 1px #fecaca; }
.badge-purple { background: #f5f3ff; color: #6d28d9; box-shadow: inset 0 0 0 1px #ddd6fe; }
.badge-slate { background: #f1f5f9; color: #475569; box-shadow: inset 0 0 0 1px #e2e8f0; }

.tag-chip {
  display: inline-block;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  margin: 2px 3px 2px 0;
  font-weight: 600;
}
.tag-chip.high { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.tag-chip.bat { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.tag-chip.miandan { background: #ecfdf5; color: #047857; border-color: #6ee7b7; font-weight: 700; }
.tag-chip.daka { background: #f5f3ff; color: #6d28d9; border-color: #c4b5fd; font-weight: 700; }

/* ==================== TABS, INPUTS & TABLES ==================== */
.tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tab-btn {
  border: none;
  background: transparent;
  padding: 9px 15px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1px;
  transition: all 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.batch-bar {
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #d5deea;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.batch-count {
  font-weight: 800;
  color: var(--primary);
  padding-right: 10px;
  border-right: 1px solid #cbd5e1;
}

input[type="text"], input[type="number"], input[type="password"], select, textarea {
  border: 1.5px solid #dbe2ec;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #eef2f7; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left;
  padding: 10px 9px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
td {
  padding: 10px 9px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

.prod-mini { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 9px; }
.prod-mini:last-child { margin-bottom: 0; }
.prod-thumb-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  line-height: 0;
}
.prod-qty-corner {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 24px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1;
  background: #1e293b;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.28);
  pointer-events: none;
}
.prod-qty-corner.is-multi {
  background: linear-gradient(135deg, #ea580c, #dc2626);
  font-size: 12px;
  height: 22px;
  padding: 0 7px;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.42);
}
.prod-qty-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.qty-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.3;
  white-space: nowrap;
}
.qty-pill-single {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}
.qty-pill-multi {
  background: linear-gradient(135deg, #fff7ed, #fee2e2);
  color: #b91c1c;
  border: 1.5px solid #f87171;
  box-shadow: 0 1px 3px rgba(220, 38, 38, 0.14);
}
.spec-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prod-thumb {
  width: 78px;
  height: 78px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
  cursor: zoom-in;
}
.prod-thumb:hover {
  transform: scale(1.06);
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}
.prod-thumb-lg {
  width: 96px;
  height: 96px;
  border-radius: 13px;
  border: 1.5px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
  cursor: zoom-in;
}
.prod-thumb-lg:hover {
  transform: scale(1.05);
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}
.prod-thumb-cart {
  width: 86px;
  height: 86px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease), border-color 0.16s var(--ease);
  cursor: zoom-in;
}
.prod-thumb-cart:hover {
  transform: scale(1.06);
  border-color: var(--primary);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}
.offer-thumb {
  width: 68px;
  height: 68px;
  border-radius: 9px;
  border: 1px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  background: #fff;
  cursor: zoom-in;
  transition: transform 0.16s var(--ease), border-color 0.16s var(--ease);
}
.offer-thumb:hover {
  transform: scale(1.06);
  border-color: var(--primary);
}

.img-hover-zoom {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 14px;
  padding: 6px;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.34);
  display: none;
}
.img-hover-zoom img {
  display: block;
  width: 260px;
  height: 260px;
  object-fit: contain;
  border-radius: 10px;
  background: #f8fafc;
}
.img-hover-zoom-cap {
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

/* ==================== ACCOUNT MATRIX & SOURCING CARDS ==================== */
.acc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 12px;
}
.acc-card {
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-shadow: var(--shadow-xs);
  transition: all 0.18s var(--ease);
}
.acc-card:hover {
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.acc-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.acc-code { font-weight: 800; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: #0f172a; }

.sourcing-row {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 15px 16px;
  margin-bottom: 12px;
  background: #fff;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.sourcing-row:hover { border-color: #cbd5e1; box-shadow: var(--shadow); }
@media (max-width: 980px) { .sourcing-row { grid-template-columns: 1fr; } }
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(225px, 1fr));
  gap: 10px;
}
.offer-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.15s var(--ease);
}
.offer-card:hover { border-color: #93c5fd; background: #fff; }
.offer-card.selected {
  border-color: var(--primary);
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}
.offer-price { font-size: 19px; font-weight: 800; color: #ea580c; letter-spacing: -0.02em; }

.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}
.dropzone:hover { border-color: var(--primary); background: #eff6ff; }

/* ==================== MODAL & TOAST ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: #fff;
  border-radius: 16px;
  width: min(760px, 96vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalPop 0.18s var(--ease);
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 16px; font-weight: 800; }
.modal-close {
  border: none;
  background: #f1f5f9;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: #e2e8f0; color: #0f172a; }
.modal-body { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 0 0 16px 16px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 12px; font-weight: 700; color: #334155; }
.form-field.full { grid-column: 1 / -1; }

.toast-container {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: #0f172a;
  color: #fff;
  padding: 11px 16px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.25);
  max-width: 400px;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
.toast.warn { background: #92400e; }

.pipeline-mini-steps {
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.45;
  margin-top: -2px;
}

/* ==================== 4-STAGE AUTO PIPELINE & BOT SCREENING ==================== */
.pipeline-flow {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 1024px) { .pipeline-flow { grid-template-columns: repeat(2, 1fr); } }
.pipeline-step {
  position: relative;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  box-shadow: var(--shadow-xs);
  transition: transform 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
.pipeline-step:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.pipeline-step.step-blue { border-color: #93c5fd; background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%); }
.pipeline-step.step-orange { border-color: #fdba74; background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%); }
.pipeline-step.step-red { border-color: #fca5a5; background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%); }
.pipeline-step.step-green { border-color: #6ee7b7; background: linear-gradient(135deg, #ecfdf5 0%, #ffffff 100%); }
.pipeline-step-num {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.pipeline-step-title { font-size: 14px; font-weight: 800; color: var(--text); }
.pipeline-step-val { font-size: 22px; font-weight: 800; margin: 4px 0 2px; line-height: 1.15; }
.pipeline-step-desc { font-size: 11.5px; color: var(--text-muted); }

.risk-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  margin: 2px 4px 2px 0;
}
.risk-pill.high { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.risk-pill.medium { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.row-flagged td { background: #fff8f8; }
.row-flagged:hover td { background: #fef2f2; }
.row-ready td { background: #f8fffc; }
.row-ready:hover td { background: #ecfdf5; }

.order-link {
  color: #0f172a;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.14s;
}
.order-link:hover { color: var(--primary); text-decoration: underline; }
.prod-link {
  color: #0f172a;
  text-decoration: none;
  transition: color 0.14s;
}
.prod-link:hover { color: var(--primary); text-decoration: underline; }
.mini-ext-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  margin-right: 4px;
}
.mini-ext-link:hover { background: #dbeafe; }
.mini-ext-link.orange { color: #c2410c; background: #fff7ed; border-color: #fed7aa; }
.mini-ext-link.orange:hover { background: #ffedd5; }

.buyer-addr-box {
  margin-top: 4px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  font-size: 11.5px;
  line-height: 1.45;
  color: #334155;
  max-width: 255px;
}
.buyer-email-line {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: #1d4ed8;
  word-break: break-all;
  cursor: pointer;
}
.buyer-email-line:hover { text-decoration: underline; }
.buyer-addr-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* ==================== LIVE 3D GLOBE DATA SCREEN ==================== */
.ds-shell {
  background: radial-gradient(circle at 52% 28%, #0d1f3c 0%, #060d1f 58%, #030712 100%);
  color: #e2e8f0;
  border-radius: 16px;
  padding: 16px 18px 18px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 22px 54px rgba(2, 6, 23, 0.42);
}
.ds-shell.ds-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 300;
  border-radius: 0;
  overflow-y: auto;
  padding: 18px 22px;
}
.ds-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
  margin-bottom: 14px;
}
.ds-live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 2px 9px;
  border-radius: 99px;
  margin-bottom: 4px;
}
.ds-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  display: inline-block;
  flex-shrink: 0;
}
.ds-title { font-size: 20px; font-weight: 800; color: #f8fafc; letter-spacing: -0.02em; }
.ds-sub { font-size: 11.5px; color: #94a3b8; }
.ds-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-seg-group {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 2px;
}
.ds-seg {
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.ds-seg.active { background: #0ea5e9; color: #041322; font-weight: 800; }
.ds-btn {
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
}
.ds-btn:hover { background: rgba(30, 41, 59, 0.92); border-color: #38bdf8; }
.ds-btn.primary { background: linear-gradient(135deg, #0284c7, #2563eb); border-color: #38bdf8; color: #fff; }

.ds-kpi-strip {
  display: grid;
  grid-template-columns: 1.45fr 1fr 1fr 1.15fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 1080px) { .ds-kpi-strip { grid-template-columns: repeat(2, 1fr); } }
.ds-kpi-card {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 12px;
  padding: 13px 16px;
  backdrop-filter: blur(8px);
}
.ds-kpi-card.hero {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2) 0%, rgba(16, 185, 129, 0.14) 100%);
  border-color: rgba(56, 189, 248, 0.42);
}
.ds-kpi-label { font-size: 11.5px; color: #94a3b8; font-weight: 600; }
.ds-kpi-value { font-size: 28px; font-weight: 900; color: #f8fafc; line-height: 1.2; margin: 4px 0 3px; letter-spacing: -0.02em; }
.ds-kpi-value.cyan { color: #38bdf8; text-shadow: 0 0 22px rgba(56, 189, 248, 0.36); }
.ds-kpi-value.emerald { color: #34d399; }
.ds-kpi-foot { font-size: 11.5px; color: #94a3b8; }

.ds-main-grid {
  display: grid;
  grid-template-columns: 330px 1fr 320px;
  gap: 14px;
  align-items: stretch;
}
@media (max-width: 1280px) { .ds-main-grid { grid-template-columns: 1fr; } }
.ds-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ds-panel {
  background: rgba(15, 23, 42, 0.68);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 13px;
  padding: 13px 14px;
  backdrop-filter: blur(10px);
}
.ds-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ds-panel-title { font-size: 13.5px; font-weight: 800; color: #f1f5f9; display: flex; align-items: center; gap: 6px; }
.ds-count-chip {
  font-size: 11px;
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  padding: 1px 7px;
  border-radius: 99px;
}
.ds-mini-tabs { display: inline-flex; gap: 4px; }
.ds-mini-tab {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: transparent;
  color: #94a3b8;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.ds-mini-tab.active { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.55); font-weight: 700; }

.ds-globe-panel { flex: 1; display: flex; flex-direction: column; }
.ds-globe-stage { position: relative; flex: 1; min-height: 410px; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 10px; }
.ds-globe-toast {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(6, 15, 34, 0.88);
  border: 1px solid rgba(52, 211, 153, 0.45);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  color: #f1f5f9;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}
.ds-toast-amt { color: #34d399; font-weight: 800; }

.ds-live-list { display: flex; flex-direction: column; gap: 7px; max-height: 360px; overflow-y: auto; padding-right: 3px; }
.ds-live-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 9px;
  background: rgba(30, 41, 59, 0.48);
  border: 1px solid rgba(148, 163, 184, 0.12);
  cursor: pointer;
  transition: all 0.15s;
}
.ds-live-item:hover { background: rgba(30, 58, 138, 0.36); border-color: rgba(56, 189, 248, 0.45); }
.ds-live-flag { font-size: 18px; flex-shrink: 0; }
.ds-live-thumb { width: 34px; height: 34px; border-radius: 7px; object-fit: cover; flex-shrink: 0; border: 1px solid rgba(148, 163, 184, 0.25); }
.ds-live-mid { flex: 1; min-width: 0; }
.ds-live-loc { font-size: 12px; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-store-tag {
  font-size: 10px;
  background: rgba(59, 130, 246, 0.24);
  color: #93c5fd;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}
.ds-live-meta { font-size: 11px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.ds-ord-link { color: #7dd3fc; text-decoration: none; font-weight: 600; }
.ds-ord-link:hover { text-decoration: underline; }
.ds-live-right { text-align: right; flex-shrink: 0; }
.ds-live-amt { font-size: 12.5px; font-weight: 800; color: #f8fafc; }
.ds-live-st { font-size: 10.5px; color: #34d399; display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; }
.ds-green-dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; display: inline-block; }

.ds-rank-list { display: flex; flex-direction: column; gap: 9px; }
.ds-rank-row { display: flex; align-items: center; gap: 8px; }
.ds-rank-idx {
  width: 20px; height: 20px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; background: rgba(148, 163, 184, 0.16); color: #cbd5e1; flex-shrink: 0;
}
.ds-rank-idx.top-1 { background: linear-gradient(135deg, #f59e0b, #ea580c); color: #fff; }
.ds-rank-idx.top-2 { background: linear-gradient(135deg, #38bdf8, #2563eb); color: #fff; }
.ds-rank-idx.top-3 { background: linear-gradient(135deg, #10b981, #059669); color: #fff; }
.ds-rank-thumb { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }
.ds-rank-info { flex: 1; min-width: 0; }
.ds-rank-name { font-size: 12px; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.ds-rank-bar { height: 5px; border-radius: 99px; background: rgba(148, 163, 184, 0.14); overflow: hidden; }
.ds-rank-bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #0ea5e9, #38bdf8); }
.ds-rank-bar-fill.emerald { background: linear-gradient(90deg, #059669, #34d399); }
.ds-rank-bar-fill.purple { background: linear-gradient(90deg, #6366f1, #38bdf8); }
.ds-rank-val { text-align: right; font-size: 12px; font-weight: 800; color: #f8fafc; flex-shrink: 0; }
.ds-rank-sub { font-size: 10.5px; color: #94a3b8; font-weight: 500; }

.ds-country-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 8px; }
.ds-country-chip {
  background: rgba(30, 41, 59, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.ds-country-chip:hover { border-color: #38bdf8; }
.ds-empty { text-align: center; padding: 26px 10px; color: #64748b; font-size: 12px; }

/* ==================== CLICKABLE TRACKING & LOGISTICS TIMELINE ==================== */
.track-no-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11.5px;
  font-weight: 700;
  color: #1d4ed8;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 2px 7px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  word-break: break-all;
}
.track-no-btn:hover {
  background: #dbeafe;
  border-color: #60a5fa;
  color: #1e40af;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.16);
}
.track-summary-card {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
  border-radius: 11px;
  padding: 13px 15px;
  margin-bottom: 14px;
}
.track-timeline {
  position: relative;
  padding-left: 24px;
  margin: 8px 0 4px;
}
.track-timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 10px;
  width: 2px;
  background: #e2e8f0;
}
.track-step {
  position: relative;
  padding: 0 0 14px 4px;
}
.track-step:last-child { padding-bottom: 2px; }
.track-step-dot {
  position: absolute;
  left: -22px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #cbd5e1;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e2e8f0;
}
.track-step.is-latest .track-step-dot {
  background: #2563eb;
  box-shadow: 0 0 0 3px #bfdbfe;
}
.track-step.is-delivered .track-step-dot {
  background: #10b981;
  box-shadow: 0 0 0 3px #a7f3d0;
}
.track-step.is-exception .track-step-dot {
  background: #ef4444;
  box-shadow: 0 0 0 3px #fecaca;
}
.track-step.is-local .track-step-dot {
  background: #8b5cf6;
  box-shadow: 0 0 0 2px #ddd6fe;
}
.track-step-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: #64748b;
  margin-bottom: 2px;
}
.track-step-desc {
  font-size: 13px;
  color: #0f172a;
  line-height: 1.48;
  word-break: break-word;
}
.track-step.is-latest .track-step-desc {
  font-weight: 700;
  color: #1e3a8a;
}

/* ==================== SERVER SECURITY & ATTACK DETECTION ==================== */
.sec-bar-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 4px;
  align-items: end;
  height: 148px;
  padding: 12px 6px 4px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.sec-bar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  gap: 3px;
}
.sec-bar-stack {
  width: 100%;
  max-width: 18px;
  display: flex;
  flex-direction: column-reverse;
  border-radius: 4px 4px 2px 2px;
  overflow: hidden;
  min-height: 2px;
  background: #e2e8f0;
}
.sec-bar-ssh { background: linear-gradient(180deg, #ef4444, #dc2626); width: 100%; }
.sec-bar-web { background: linear-gradient(180deg, #6366f1, #4f46e5); width: 100%; }
.sec-bar-lbl { font-size: 9.5px; color: #64748b; font-family: monospace; line-height: 1; }
.sec-progress-track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.sec-progress-fill { height: 100%; border-radius: 999px; }
.sec-health-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.sec-health-pill {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 12px;
  color: #334155;
}

/* ==================== ORDER CANCEL / CHARGEBACK & LOGISTICS ALERTS ==================== */
@keyframes pulseAlertDot {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.38); opacity: 0.55; }
}
.global-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 22px;
  background: linear-gradient(90deg, #991b1b 0%, #dc2626 52%, #b91c1c 100%);
  color: #fff;
  border-bottom: 1px solid #7f1d1d;
  font-size: 12.5px;
  box-shadow: 0 3px 12px rgba(185, 28, 28, 0.22);
}
.global-alert-banner.is-soft {
  background: linear-gradient(90deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
  box-shadow: none;
}
.alert-pulse-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fef08a;
  box-shadow: 0 0 0 3px rgba(254, 240, 138, 0.35);
  animation: pulseAlertDot 1.3s ease-in-out infinite;
  flex-shrink: 0;
}
.alert-pill-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  font-weight: 700;
  font-size: 12px;
}
.global-alert-banner.is-soft .alert-pill-chip {
  background: rgba(180, 83, 9, 0.1);
  border-color: rgba(180, 83, 9, 0.26);
  color: #92400e;
}
.row-chargeback td { background: #fff1f2 !important; }
.row-chargeback td:first-child { box-shadow: inset 4px 0 0 #dc2626; }
.row-cancelled td { background: #fef2f2 !important; }
.row-cancelled td:first-child { box-shadow: inset 4px 0 0 #94a3b8; }
.row-log-alert td { background: #fff7ed !important; }
.row-log-alert td:first-child { box-shadow: inset 4px 0 0 #ea580c; }

.chargeback-alert-box {
  margin-top: 5px;
  padding: 6px 8px;
  background: #fef2f2;
  border: 1.5px solid #f87171;
  border-radius: 7px;
  font-size: 11.5px;
  color: #991b1b;
  line-height: 1.48;
}
.cancel-alert-box {
  margin-top: 5px;
  padding: 5px 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-left: 3px solid #ef4444;
  border-radius: 6px;
  font-size: 11.5px;
  color: #475569;
  line-height: 1.45;
}
.track-alert-box {
  margin-top: 5px;
  padding: 6px 8px;
  border-radius: 7px;
  background: #fef2f2;
  border: 1.5px solid #f87171;
  color: #991b1b;
  font-size: 11.5px;
  line-height: 1.45;
}
.track-alert-box.is-warning {
  background: #fffbeb;
  border-color: #fbbf24;
  color: #92400e;
}
.track-alert-box.is-acked {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  color: #64748b;
}
.tag-chip.danger { background: #fef2f2; color: #b91c1c; border-color: #f87171; font-weight: 700; }
.tab-btn.tab-alert { color: #b91c1c; font-weight: 700; }
.tab-btn.tab-alert.active { color: #dc2626; border-bottom-color: #dc2626; }

/* ==================== SOURCE CHANNELS, SKU FREIGHT & INVENTORY PILLS ==================== */
.src-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid transparent;
}
.src-facebook { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.src-instagram { background: #fdf2f8; color: #be185d; border-color: #f9a8d4; }
.src-tiktok { background: #0f172a; color: #f8fafc; border-color: #334155; }
.src-google_ads { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.src-google_organic { background: #ecfdf5; color: #047857; border-color: #6ee7b7; }
.src-youtube { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.src-pinterest { background: #fff1f2; color: #be123c; border-color: #fda4af; }
.src-shop_app { background: #f5f3ff; color: #6d28d9; border-color: #c4b5fd; }
.src-email { background: #ecfeff; color: #0e7490; border-color: #a5f3fc; }
.src-pos { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.src-direct { background: #f1f5f9; color: #475569; border-color: #cbd5e1; }
.src-referral { background: #eef2ff; color: #4338ca; border-color: #c7d2fe; }

.frt-sku-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  white-space: nowrap;
}
.frt-sku-pill.is-billed {
  background: #ecfdf5;
  color: #047857;
  border-color: #6ee7b7;
}
.stock-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.stock-pill.ok { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.stock-pill.low { background: #fffbeb; color: #b45309; border: 1px solid #fcd34d; }
.stock-pill.transit { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.stock-pill.hot { background: linear-gradient(135deg, #fff7ed, #fee2e2); color: #c2410c; border: 1px solid #fb923c; cursor: pointer; }
.fin-sku-mini {
  margin-top: 4px;
  padding: 4px 6px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 10.5px;
  color: #334155;
  line-height: 1.45;
  text-align: left;
}

/* ==================== THERMAL SHIPPING LABEL ==================== */
.label-preview-wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; }
.thermal-label {
  width: 360px;
  border: 2px solid #000;
  background: #fff;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 11px;
  padding: 10px;
  page-break-after: always;
}
.tl-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 6px;
}
.tl-carrier { font-size: 16px; font-weight: 900; }
.tl-country { font-size: 20px; font-weight: 900; border: 2px solid #000; padding: 1px 8px; }
.tl-section { border-bottom: 1.5px solid #000; padding: 6px 0; }
.tl-barcode { text-align: center; padding: 6px 0; border-bottom: 1.5px solid #000; }
.tl-track { font-family: monospace; font-size: 13px; font-weight: 700; letter-spacing: 1px; margin-top: 2px; }
.tl-cn22 { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 10px; }
.tl-cn22 th, .tl-cn22 td { border: 1px solid #000; padding: 3px 4px; }
.print-root { display: none; }

@media print {
  .app-shell, .login-screen, .modal-backdrop, .toast-container { display: none !important; }
  .print-root { display: block !important; }
  body { background: #fff; }
  .thermal-label { width: 96mm; border: 1.5px solid #000; margin: 0 auto 8mm; }
}


/* ==================== ADS MCP & DAILY EXPENSE BREAKDOWN ==================== */
.ad-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.ad-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ad-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.07);
}
.ad-kpi-card.is-hero {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  border-color: #fdba74;
}
.ad-kpi-card.is-wallet {
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 100%);
  border-color: #93c5fd;
}
.ad-kpi-card.is-warn {
  background: linear-gradient(135deg, #fef2f2 0%, #ffffff 100%);
  border-color: #fca5a5;
}
.ad-bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 185px;
  padding: 18px 12px 8px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow-x: auto;
  margin-bottom: 14px;
}
.ad-bar-col {
  flex: 1 0 42px;
  max-width: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  gap: 4px;
  cursor: pointer;
}
.ad-bar-val {
  font-size: 10.5px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}
.ad-bar-track {
  width: 100%;
  max-width: 30px;
  flex: 1;
  display: flex;
  align-items: flex-end;
  background: #f1f5f9;
  border-radius: 6px 6px 2px 2px;
  overflow: hidden;
}
.ad-bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: 6px 6px 0 0;
  background: linear-gradient(180deg, #f97316 0%, #ea580c 100%);
  transition: height 0.25s ease;
}
.ad-bar-fill.is-zero {
  background: #cbd5e1;
}
.ad-bar-fill.is-today {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
}
.ad-bar-date {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
}
.ad-event-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.ad-event-pill.ev-spend { background: #fff7ed; color: #c2410c; border: 1px solid #fdba74; }
.ad-event-pill.ev-recharge { background: #ecfdf5; color: #047857; border: 1px solid #6ee7b7; }
.ad-event-pill.ev-manual { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.ad-event-pill.ev-baseline { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.ad-mcp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.ad-mcp-status-pill.is-online { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.ad-mcp-status-pill.is-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.ad-mcp-status-pill.is-idle { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ==================== DAILY BUSINESS TASKS & RED POPUP REMINDER ==================== */
.daily-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.daily-task-card {
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.daily-task-card.is-incomplete {
  border-color: #fca5a5;
  background: linear-gradient(135deg, #fff5f5 0%, #ffffff 65%);
  box-shadow: 0 2px 10px rgba(220, 38, 38, 0.08);
}
.daily-task-card.is-done {
  border-color: #86efac;
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 65%);
}
.daily-task-card.is-disabled {
  opacity: 0.6;
  background: #f8fafc;
}
.red-progress-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #fee2e2;
  overflow: hidden;
}
.red-progress-track.is-done {
  background: #dcfce7;
}
.red-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626 0%, #ef4444 100%);
  transition: width 0.3s ease;
}
.red-progress-bar.is-done {
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
}
.inc-curve-strip {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.inc-curve-chip {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  font-weight: 600;
}
.inc-curve-chip.is-today {
  background: #dc2626;
  border-color: #b91c1c;
  color: #ffffff;
}

/* High-Visibility Crimson Red Alert Popup Modal */
.red-alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 12000;
  background: rgba(69, 10, 10, 0.68);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.red-alert-backdrop.hidden {
  display: none !important;
}
.red-alert-card {
  width: 100%;
  max-width: 780px;
  max-height: 88vh;
  background: #ffffff;
  border: 3px solid #dc2626;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(153, 27, 27, 0.45), 0 0 0 6px rgba(239, 68, 68, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: redAlertPop 0.22s ease-out;
}
@keyframes redAlertPop {
  from { transform: scale(0.94); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.red-alert-header {
  background: linear-gradient(135deg, #b91c1c 0%, #dc2626 55%, #ef4444 100%);
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.red-alert-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
.red-alert-close {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
}
.red-alert-close:hover {
  background: rgba(255, 255, 255, 0.3);
}
.red-alert-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff5f5;
}
.red-alert-section-title {
  font-size: 13px;
  font-weight: 800;
  color: #991b1b;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.red-alert-item {
  background: #ffffff;
  border: 1.5px solid #fca5a5;
  border-left: 5px solid #dc2626;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.red-alert-footer {
  padding: 12px 20px;
  background: #fef2f2;
  border-top: 1px solid #fecaca;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.kpi-card.is-clickable {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.kpi-card.is-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.10);
  border-color: #93c5fd;
}
.kpi-jump-arrow {
  float: right;
  font-size: 12px;
  color: #94a3b8;
  font-weight: 700;
  transition: transform 0.15s ease, color 0.15s ease;
}
.kpi-card.is-clickable:hover .kpi-jump-arrow {
  color: #2563eb;
  transform: translate(2px, -2px);
}
