/* ==========================================================================
   FINICHE v1.0 — PRECISION OBSIDIAN DESIGN SYSTEM
   Reviewed & Approved by 5-Member Independent UX & Architecture Council
   ========================================================================== */

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 11px;
  --radius-pill: 9999px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --transition: 150ms cubic-bezier(0.16, 1, 0.3, 1);

  --sidebar-width: 244px;
  --sidebar-collapsed-width: 68px;
  --topbar-height: 58px;
}

/* ==========================================================================
   THEME 1: OBSIDIAN DARK (Default)
   ========================================================================== */
:root,
html[data-theme="dark"],
html.dark {
  --bg-canvas: #09090b;
  --bg-surface: #111115;
  --bg-elevated: #18181e;
  --bg-hover: #202028;
  --bg-glass: rgba(17, 17, 21, 0.84);

  --border-subtle: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-focus: #6366f1;
  --inner-glow: inset 0 1px 0 0 rgba(255, 255, 255, 0.04);

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-subtle: rgba(99, 102, 241, 0.14);
  --accent-text: #818cf8;

  /* Domain-Separated Semantic Status Colors */
  --emerald-bg: rgba(16, 185, 129, 0.12);
  --emerald-text: #34d399;
  --emerald-border: rgba(16, 185, 129, 0.28);

  --sky-bg: rgba(14, 165, 233, 0.12);
  --sky-text: #38bdf8;
  --sky-border: rgba(14, 165, 233, 0.28);

  --amber-bg: rgba(245, 158, 11, 0.13);
  --amber-text: #fbbf24;
  --amber-border: rgba(245, 158, 11, 0.3);

  --danger-bg: rgba(239, 68, 68, 0.14);
  --danger-text: #f87171;
  --danger-border: rgba(239, 68, 68, 0.32);

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45), var(--inner-glow);
  --shadow-hover: 0 10px 26px -6px rgba(0, 0, 0, 0.65), var(--inner-glow);
}

/* ==========================================================================
   THEME 2: DAYLIGHT HIGH-CONTRAST LIGHT
   ========================================================================== */
html[data-theme="light"],
html.light {
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --bg-elevated: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-glass: rgba(255, 255, 255, 0.88);

  --border-subtle: rgba(15, 23, 42, 0.085);
  --border-strong: rgba(15, 23, 42, 0.18);
  --border-focus: #4f46e5;
  --inner-glow: inset 0 1px 0 0 rgba(255, 255, 255, 0.8);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-subtle: rgba(79, 70, 229, 0.09);
  --accent-text: #4f46e5;

  --emerald-bg: rgba(5, 150, 105, 0.09);
  --emerald-text: #059669;
  --emerald-border: rgba(5, 150, 105, 0.25);

  --sky-bg: rgba(2, 132, 199, 0.09);
  --sky-text: #0284c7;
  --sky-border: rgba(2, 132, 199, 0.25);

  --amber-bg: rgba(217, 119, 6, 0.1);
  --amber-text: #d97706;
  --amber-border: rgba(217, 119, 6, 0.28);

  --danger-bg: rgba(220, 38, 38, 0.09);
  --danger-text: #dc2626;
  --danger-border: rgba(220, 38, 38, 0.25);

  --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-hover: 0 10px 24px -6px rgba(15, 23, 42, 0.1);
}

/* ==========================================================================
   BASE RESET & TYPOGRAPHY
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.48;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.tabular,
.metric-val,
.vel-pill,
.stat-value,
.price-big,
.tab-count,
.hm-cell,
.num-col {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

button,
select,
input,
a {
  font-family: inherit;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.mt-12 {
  margin-top: 12px;
}

.mt-16 {
  margin-top: 16px;
}

.muted {
  color: var(--text-secondary);
  font-size: 12.5px;
}

/* ==========================================================================
   1. ENTERPRISE APP SHELL (LEFT SIDEBAR + MAIN VIEWPORT)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-width) minmax(0, 1fr);
}

.sidebar {
  background: var(--bg-surface);
  border-inline-end: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  overflow: hidden;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding-inline: 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--border-subtle);
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #6366f1, #0ea5e9);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.brand-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.ver-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: var(--accent-subtle);
  color: var(--accent-text);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-group-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0 10px 4px;
}

.main-tabs {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.tab-btn {
  width: 100%;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-align: start;
}

.tab-btn-left {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--accent-subtle);
  color: var(--text-primary);
  border-color: rgba(99, 102, 241, 0.28);
  font-weight: 600;
}

.tab-btn.active .ui-icon {
  color: var(--accent-text);
}

.tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tab-count.accent {
  background: var(--sky-bg);
  color: var(--sky-text);
}

.tab-count.green {
  background: var(--emerald-bg);
  color: var(--emerald-text);
}

.tab-count.warn {
  background: var(--amber-bg);
  color: var(--amber-text);
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border-subtle);
}

.vault-mini-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.vault-mini-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald-text);
  box-shadow: 0 0 8px var(--emerald-text);
}

.vault-mini-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.vault-mini-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.vault-mini-fp {
  font-size: 11px;
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-weight: 600;
  margin-top: 2px;
}

/* Sidebar Collapsed State */
.app-shell.sidebar-collapsed .brand-text,
.app-shell.sidebar-collapsed .nav-group-label,
.app-shell.sidebar-collapsed .tab-btn-left span,
.app-shell.sidebar-collapsed .tab-count,
.app-shell.sidebar-collapsed .sidebar-footer {
  display: none;
}

.app-shell.sidebar-collapsed .tab-btn {
  justify-content: center;
  padding: 10px;
}

/* ==========================================================================
   2. CLEAN TOP COMMAND BAR (MAX 4 CONTROL CLUSTERS, NO LINE WRAP)
   ========================================================================== */
.main-viewport {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-height);
  padding-inline: 22px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.workspace-context {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.workspace-title {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.workspace-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.global-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.context-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 4px 8px;
  height: 34px;
}

.context-pill:hover {
  border-color: var(--border-strong);
}

.muted-icon {
  color: var(--text-muted);
}

.ctrl-select-clean {
  background: transparent;
  color: var(--text-primary);
  border: none;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  max-width: 195px;
}

.ctrl-select-clean option {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* Unified Language Capsule (EN/VI + 20 Locales) */
.lang-capsule {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  height: 34px;
  padding: 2px;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.lang-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.lang-btn.active {
  background: var(--accent);
  color: #ffffff;
}

.capsule-divider {
  width: 1px;
  height: 16px;
  background: var(--border-subtle);
  margin-inline: 5px;
}

.lang-dropdown {
  max-width: 132px;
  padding-inline-end: 4px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-primary,
.btn-outline {
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding-inline: 12px;
  border-radius: var(--radius-md);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
  border: 1px solid var(--accent);
}

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

.btn-outline {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-outline:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
}

.btn-ghost-sm,
.btn-ghost-xs {
  background: transparent;
  color: var(--accent-text);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost-sm:hover,
.btn-ghost-xs:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
}

/* ==========================================================================
   3. WORKSPACE CANVAS, KPI STRIP & UNIFIED FILTER BAR
   ========================================================================== */
.workspace {
  padding: 20px 24px 48px;
  max-width: 1640px;
  width: 100%;
  margin: 0 auto;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* KPI Summary Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 13px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.kpi-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.kpi-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.kpi-tag.emerald {
  background: var(--emerald-bg);
  color: var(--emerald-text);
}

.kpi-tag.sky {
  background: var(--sky-bg);
  color: var(--sky-text);
}

.kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
}

.emerald-text {
  color: var(--emerald-text);
}

.sky-text {
  color: var(--sky-text);
}

.kpi-foot {
  font-size: 11.5px;
  color: var(--text-muted);
}

.kpi-progress-track {
  width: 100%;
  height: 5px;
  background: var(--bg-elevated);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-top: 4px;
}

.kpi-progress-bar {
  height: 100%;
  background: var(--emerald-text);
  border-radius: var(--radius-pill);
  transition: width 300ms var(--ease-out);
}

/* Unified Filter Card */
.filter-bar-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.platform-pills,
.filter-chips,
.profile-group-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.filter-chips-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.pill,
.chip {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill:hover,
.chip:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.pill.active,
.chip.active {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border-color: rgba(99, 102, 241, 0.45);
  font-weight: 600;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.chip-dot.emerald { background: var(--emerald-text); }
.chip-dot.sky { background: var(--sky-text); }
.chip-dot.indigo { background: var(--accent-text); }
.chip-dot.danger { background: var(--danger-text); }

.search-sort-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-box-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  inset-inline-start: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input,
.ctrl-select {
  height: 34px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding-inline: 10px;
  font-size: 12.5px;
  outline: none;
}

.search-input.with-icon {
  padding-inline-start: 32px;
  min-width: 240px;
}

.search-input.full {
  flex: 1;
  width: 100%;
}

.view-switcher {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  height: 34px;
}

.view-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-radius: var(--radius-sm);
  padding-inline: 9px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.view-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* ==========================================================================
   4. 4-LAYER SCANNABLE PRODUCT CARDS (MAX 2 BADGES ON FACE)
   ========================================================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 15px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 11px;
  cursor: pointer;
  position: relative;
}

.product-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

/* Layer 1: Platform + Region + Velocity Pill */
.p-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.p-top-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.plat-tag {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.vel-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--sky-bg);
  color: var(--sky-text);
  border: 1px solid var(--sky-border);
}

.vel-pill.hot {
  background: var(--emerald-bg);
  color: var(--emerald-text);
  border-color: var(--emerald-border);
}

/* Layer 2: Clamped Title + Prominent Price */
.p-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.p-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em;
}

.p-price-col {
  text-align: end;
  flex-shrink: 0;
}

.p-price {
  font-family: var(--font-mono);
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.p-age {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

/* Layer 3: 3-Col Tabular Metrics + Integrated Gradient Area Sparkline */
.p-metrics-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.p-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.metric-lbl {
  font-size: 10.5px;
  color: var(--text-muted);
}

.metric-val {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.sparkline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 5px;
  border-top: 1px dashed var(--border-subtle);
}

.fresh-label {
  font-size: 10.5px;
  color: var(--text-muted);
}

/* Layer 4: Max 2 Status Badges + Subtle Inspect Trigger */
.p-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.badge-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.badge.sky-badge {
  background: var(--sky-bg);
  color: var(--sky-text);
  border-color: var(--sky-border);
}

.badge.tm-safe {
  background: var(--emerald-bg);
  color: var(--emerald-text);
  border-color: var(--emerald-border);
}

.badge.tm-danger {
  background: var(--danger-bg);
  color: var(--danger-text);
  border-color: var(--danger-border);
}

.badge.tm-warn {
  background: var(--amber-bg);
  color: var(--amber-text);
  border-color: var(--amber-border);
}

.inspect-hint {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-text);
  white-space: nowrap;
}

/* ==========================================================================
   5. CARDS, TABLES, HEATMAP MATRIX & DIAGNOSTICS
   ========================================================================== */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}

.card-header-row,
.section-banner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.section-banner {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 14px;
}

.section-title {
  font-size: 16px;
  font-weight: 700;
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.arb-grid,
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.three-col-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(440px, 1fr));
  gap: 16px;
}

.two-col-asymmetric {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 15px 18px;
  box-shadow: var(--shadow-card);
}

.stat-card.emerald-accent { border-inline-start: 3px solid var(--emerald-text); }
.stat-card.indigo-accent { border-inline-start: 3px solid var(--accent); }
.stat-card.sky-accent { border-inline-start: 3px solid var(--sky-text); }

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 21px;
  font-weight: 800;
  margin: 5px 0 3px;
}

.stat-value.green { color: var(--emerald-text); }
.stat-value.mono { font-size: 16.5px; color: var(--accent-text); }

.stat-note {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Data Tables & Heatmap Cells */
.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  text-align: start;
}

.data-table th {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--bg-elevated);
}

.data-table tbody tr:hover {
  background: var(--bg-hover);
}

.data-table .num-col {
  text-align: end;
}

.data-table .center-col {
  text-align: center;
}

.hm-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-weight: 700;
}

.hm-zero {
  background: var(--emerald-bg);
  color: var(--emerald-text);
  border: 1px solid var(--emerald-border);
}

.hm-low {
  background: var(--sky-bg);
  color: var(--sky-text);
  border: 1px solid var(--sky-border);
}

.hm-high {
  background: var(--amber-bg);
  color: var(--amber-text);
  border: 1px solid var(--amber-border);
}

/* Browser Profiles & Tabbed Security Diagnostics */
.profile-list,
.check-list,
.risk-list,
.defense-layer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item-row {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 13px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-row.shop-profile {
  border-inline-start: 3px solid var(--emerald-text);
}

.item-row.spy-profile {
  border-inline-start: 3px solid var(--sky-text);
}

.item-row.blocked-profile {
  border-inline-start: 3px solid var(--danger-text);
}

.prof-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.diag-tabs-header {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.diag-tab-btn {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.diag-tab-btn.active {
  background: var(--accent-subtle);
  color: var(--accent-text);
  border-color: rgba(99, 102, 241, 0.4);
}

.diag-subpanel {
  display: none;
}

.diag-subpanel.active {
  display: block;
}

.inspector-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Trademark Scanner */
.field-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.tm-input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tm-quick-btns,
.fleet-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.preset-label {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-inline-end: 4px;
}

.tm-result-box {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  font-size: 13px;
}

.layer-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.layer-num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-text);
  background: var(--accent-subtle);
  padding: 3px 7px;
  border-radius: var(--radius-xs);
}

/* Pricing Cards */
.pricing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pricing-card.popular {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.35);
}

.price-big {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-text);
}

.feat-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ==========================================================================
   6. CONTEXTUAL RIGHT SLIDE-OVER INSPECTOR DRAWER
   ========================================================================== */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.68);
  backdrop-filter: blur(4px);
  z-index: 90;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(480px, 94vw);
  height: 100vh;
  background: var(--bg-surface);
  border-inline-start: 1px solid var(--border-strong);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.5);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.drawer-title {
  font-size: 15.5px;
  font-weight: 700;
  margin-top: 6px;
  line-height: 1.35;
}

.drawer-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.qa-link {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  text-decoration: none;
}

.qa-link:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.toast {
  position: fixed;
  inset-block-end: 22px;
  inset-inline-end: 22px;
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--accent);
  padding: 11px 16px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-hover);
  font-weight: 600;
  z-index: 120;
}

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .kpi-strip {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-col-asymmetric {
    grid-template-columns: 1fr;
  }
  .workspace-subtitle {
    display: none;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: static;
    height: auto;
  }
  .topbar {
    height: auto;
    padding: 10px 14px;
    flex-wrap: wrap;
  }
}
