/* HeroSource — dense Linear/terminal-inspired theme (light + dark) */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #FAFAF7;
  --bg-2: #F2F1EC;
  --bg-3: #ECEAE2;
  --surface: #FFFFFF;
  --ink: #15140F;
  --ink-2: #44423B;
  --ink-3: #8A877D;
  --ink-4: #B8B5AC;
  --line: #E5E3DC;
  --line-2: #D8D5CC;
  --accent: #0F8A6F;
  --accent-2: #0B6E58;
  --accent-soft: #E1F1EB;
  --ok: #0F8A6F;
  --warn: #C68A1C;
  --danger: #C8412E;
  --winner-bg: #F1F8F4;
  --winner-line: #0F8A6F;
  --hi: #FFF5DC;
  --shadow-1: 0 1px 0 rgba(0,0,0,0.04);
  --shadow-2: 0 1px 2px rgba(20,20,15,0.06), 0 0 0 1px var(--line);

  --font-sans: 'Geist', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --sidebar-w: 232px;
  --topbar-h: 44px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

#root { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }
.hs-mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; letter-spacing: -0.01em; }
.hs-tabular { font-variant-numeric: tabular-nums; }
.hs-muted { color: var(--ink-3); }
.hs-micro { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 500; }

/* ============ APP SHELL ============ */
.hs-app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}
.hs-app.sidebar-icon { --sidebar-w: 56px; }
.hs-app.sidebar-hidden { --sidebar-w: 0px; }

.hs-topbar {
  grid-area: topbar;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 12px;
  z-index: 10;
}
.hs-brand {
  display: inline-flex; align-items: center;
  height: 32px;
  padding: 0 4px;
  flex-shrink: 0;
  cursor: pointer;
  background: transparent;
  border: 0;
  font-family: inherit;
}
.hs-brand-logo { display: block; height: 22px; width: auto; }
.hs-app.sidebar-icon .hs-brand-logo { max-width: 32px; object-fit: cover; object-position: left; }

.hs-search-wrap {
  flex: 1; max-width: 560px; min-width: 0;
  display: flex; align-items: center;
  background: var(--bg-2);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 8px;
  height: 28px;
  gap: 8px;
  transition: border-color 0.1s;
}
.hs-search-wrap:focus-within { border-color: var(--line-2); background: var(--surface); }
.hs-search-wrap input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: transparent;
  font-family: inherit; font-size: 13px;
  color: var(--ink);
}
.hs-search-wrap input::placeholder { color: var(--ink-3); }
.hs-kbd {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 3px; color: var(--ink-3);
  box-shadow: 0 1px 0 var(--line);
}

.hs-topbar-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.hs-icon-btn {
  width: 28px; height: 28px;
  border: 0; background: transparent; border-radius: 5px;
  display: grid; place-items: center;
  color: var(--ink-2);
  position: relative;
}
.hs-icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.hs-bell-dot { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface); }
.hs-user-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 3px; border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
}
.hs-avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white; font-weight: 600; font-size: 10px;
  display: grid; place-items: center;
}

/* mobile sidebar toggle */
.hs-menu-btn { display: none; }

/* ============ SIDEBAR ============ */
.hs-sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  padding: 8px 0 12px;
  display: flex; flex-direction: column;
}
.hs-app.sidebar-hidden .hs-sidebar { display: none; }
.hs-nav-section { padding: 0 8px; }
.hs-nav-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); padding: 10px 16px 4px; font-weight: 500;
}
.hs-nav-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 5px;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 12.5px;
  cursor: pointer;
  border: 0; background: transparent; width: 100%; text-align: left;
  font-family: inherit;
  position: relative;
  min-height: 28px;
}
.hs-nav-item:hover { background: var(--bg-2); color: var(--ink); }
.hs-nav-item.active { background: var(--bg-2); color: var(--ink); font-weight: 500; }
.hs-nav-item.active::before {
  content: ""; position: absolute; left: -8px; top: 4px; bottom: 4px; width: 2px;
  background: var(--accent); border-radius: 2px;
}
.hs-nav-icon { width: 16px; flex-shrink: 0; color: var(--ink-3); display: inline-flex; }
.hs-nav-item.active .hs-nav-icon { color: var(--ink); }
.hs-nav-count {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px;
  color: var(--ink-3);
  background: var(--bg-2);
  padding: 1px 5px; border-radius: 3px;
}
.hs-nav-item.active .hs-nav-count { background: var(--surface); }
.hs-nav-badge {
  margin-left: auto;
  background: var(--danger); color: white;
  font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 3px;
}

.hs-app.sidebar-icon .hs-nav-label { display: none; }
.hs-app.sidebar-icon .hs-nav-item { justify-content: center; padding: 7px; }
.hs-app.sidebar-icon .hs-nav-text,
.hs-app.sidebar-icon .hs-nav-count,
.hs-app.sidebar-icon .hs-nav-badge { display: none; }

.hs-sidebar-footer {
  margin-top: auto;
  padding: 12px 12px 4px;
  border-top: 1px solid var(--line);
  margin: 12px 8px 0;
}
.hs-sync-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--ink-3);
  padding: 4px 4px;
}
.hs-app.sidebar-icon .hs-sidebar-footer .hs-sync-status span { display: none; }

/* ============ MAIN ============ */
.hs-main {
  grid-area: main;
  overflow: auto;
  background: var(--bg);
  min-width: 0;
}
.hs-page-header {
  padding: 14px 24px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.hs-page-title { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.hs-page-subtitle { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.hs-page-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.hs-breadcrumbs {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; color: var(--ink-3);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.hs-breadcrumbs a { color: var(--ink-3); text-decoration: none; cursor: pointer; }
.hs-breadcrumbs a:hover { color: var(--ink); }
.hs-breadcrumbs .sep { color: var(--ink-4); }

/* ============ BUTTONS ============ */
.hs-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 12px; font-weight: 500;
  border-radius: 5px;
  font-family: inherit;
  transition: background 0.1s;
  min-height: 28px;
}
.hs-btn:hover { background: var(--bg-2); }
.hs-btn-primary {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.hs-btn-primary:hover { background: #000; }
.hs-btn-accent {
  background: var(--accent); color: white; border-color: var(--accent);
}
.hs-btn-accent:hover { background: var(--accent-2); }
.hs-btn-ghost {
  border-color: transparent; background: transparent;
}
.hs-btn-ghost:hover { background: var(--bg-2); }
.hs-btn-sm { padding: 3px 7px; font-size: 11px; min-height: 24px; }

/* ============ TABLE ============ */
.hs-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.hs-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px;
}
.hs-table thead th {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 10px;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 500;
  white-space: nowrap;
  position: sticky; top: 0; z-index: 2;
}
.hs-table thead th.hs-num { text-align: right; }
.hs-table tbody td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.hs-table tbody td.hs-num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.hs-table tbody tr:hover { background: var(--bg-2); cursor: pointer; }
.hs-table tbody tr.selected { background: var(--accent-soft); }

.hs-cell-product {
  display: flex; align-items: center; gap: 10px;
}
.hs-cell-glyph {
  width: 36px; height: 28px;
  background: var(--bg-2);
  border-radius: 3px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.hs-cell-title { font-weight: 500; color: var(--ink); line-height: 1.25; }
.hs-cell-sku { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

.hs-spec-line {
  font-size: 11px; color: var(--ink-2);
  display: flex; gap: 6px; flex-wrap: wrap;
}
.hs-spec-line .sep { color: var(--ink-4); }

/* ============ CONFIDENCE BADGE ============ */
.hs-conf {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono); font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid;
  letter-spacing: 0;
  vertical-align: middle;
}
.hs-conf-label { font-weight: 500; opacity: 0.7; }
.hs-conf-num { font-weight: 600; }
.hs-conf-high { color: var(--accent-2); border-color: #BFE0D2; background: var(--accent-soft); }
.hs-conf-mid { color: #8A6116; border-color: #EBD9A8; background: #FBF4DF; }
.hs-conf-low { color: #8C2E1E; border-color: #ECC9C0; background: #F8E5DF; }
.hs-conf-compact { padding: 0 4px; font-size: 9.5px; }

/* ============ DIFF / STATUS ============ */
.hs-diff-pos { color: var(--danger); }
.hs-diff-neg { color: var(--accent); }
.hs-diff-pct { font-size: 10.5px; opacity: 0.85; }

.hs-status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ============ CARDS / PANELS ============ */
.hs-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.hs-panel-header {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-2); font-weight: 500;
}
.hs-panel-header .right { margin-left: auto; }
.hs-panel-body { padding: 12px; }

.hs-row-tight { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 0; gap: 8px; }
.hs-row-tight + .hs-row-tight { border-top: 1px solid var(--line); }
.hs-row-tight .label { color: var(--ink-3); font-size: 11.5px; }
.hs-row-tight .val { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; }

/* ============ FILTER PANEL ============ */
.hs-list-layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: calc(100vh - var(--topbar-h));
}
.hs-filter-panel {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
  padding: 12px 14px;
}
.hs-filter-group { margin-bottom: 14px; }
.hs-filter-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 500; margin-bottom: 6px;
  display: flex; justify-content: space-between; align-items: center;
}
.hs-filter-group-title .clear { color: var(--accent); cursor: pointer; font-size: 10px; text-transform: none; letter-spacing: 0; }
.hs-filter-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0;
  font-size: 12px;
  cursor: pointer;
  min-height: 22px;
}
.hs-filter-row input[type=checkbox] { accent-color: var(--accent); margin: 0; width: 14px; height: 14px; }
.hs-filter-row .count { margin-left: auto; color: var(--ink-3); font-family: var(--font-mono); font-size: 10.5px; }
.hs-filter-row.disabled { color: var(--ink-4); }
.hs-filter-row.disabled .count { color: var(--ink-4); }

.hs-list-body { display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.hs-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 2px 4px 2px 8px;
  border-radius: 12px;
  font-size: 11.5px;
}
.hs-chip .x { width: 14px; height: 14px; display: grid; place-items: center; border-radius: 50%; background: transparent; border: 0; cursor: pointer; }
.hs-chip .x:hover { background: var(--bg-3); }

/* ============ PRODUCT DETAIL ============ */
.hs-detail-grid {
  display: grid;
  grid-template-columns: 280px 1fr 420px;
  gap: 16px;
  padding: 16px 24px 32px;
  align-items: start;
}
.hs-product-image {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  aspect-ratio: 4/3;
  display: grid; place-items: center;
  max-width: 100%;
}
.hs-product-image svg { width: 60%; height: 60%; }

.hs-spec-grid {
  display: grid; grid-template-columns: 120px 1fr;
  gap: 0; font-size: 12px;
}
.hs-spec-grid .k { color: var(--ink-3); padding: 5px 0; border-bottom: 1px solid var(--line); }
.hs-spec-grid .v { padding: 5px 0; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 12px; font-weight: 500; word-break: break-word; }
.hs-spec-grid .k:last-of-type, .hs-spec-grid .v:last-of-type { border-bottom: 0; }

/* Supplier rows in detail */
.hs-supplier-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.hs-supplier-row:last-child { border-bottom: 0; }
.hs-supplier-row.winner {
  background: var(--winner-bg);
  position: relative;
}
.hs-supplier-row.winner::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 2px; background: var(--winner-line);
}
.hs-supplier-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500; font-size: 12.5px;
}
.hs-supplier-meta { font-size: 10.5px; color: var(--ink-3); }
.hs-stock-badge {
  font-family: var(--font-mono); font-size: 11.5px;
  background: var(--bg-2); padding: 2px 6px; border-radius: 3px;
  color: var(--ink-2);
  white-space: nowrap;
}
.hs-stock-badge.low { color: var(--warn); background: #FBF4DF; }
.hs-stock-badge.zero { color: var(--ink-4); background: var(--bg-2); text-decoration: line-through; }
.hs-price-cell {
  text-align: right;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.hs-price-cell .price { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.hs-price-cell .margin { font-size: 10.5px; color: var(--accent); }

/* ============ TABS ============ */
.hs-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  background: var(--surface);
  overflow-x: auto;
}
.hs-tab {
  padding: 8px 14px;
  border: 0; background: transparent;
  font-family: inherit; font-size: 12.5px; color: var(--ink-3);
  cursor: pointer; position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  min-height: 36px;
}
.hs-tab:hover { color: var(--ink); }
.hs-tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.hs-tab .count {
  margin-left: 6px; font-family: var(--font-mono); font-size: 10px;
  background: var(--bg-2); padding: 1px 5px; border-radius: 3px;
  color: var(--ink-3);
}

/* ============ DASHBOARD ============ */
.hs-stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 16px 24px 0;
}
.hs-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px;
}
.hs-stat .label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.hs-stat .val { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin-top: 2px; }
.hs-stat .delta { font-size: 11px; color: var(--accent); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.hs-stat .delta.neg { color: var(--danger); }

.hs-dash-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 16px 24px;
}
.hs-dash-grid.three { grid-template-columns: 1fr 1fr 1fr; }

/* ============ FORM CONTROLS ============ */
.hs-select, .hs-input {
  height: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 4px;
  font-family: inherit;
  font-size: 12px;
  padding: 0 8px;
  color: var(--ink);
  outline: 0;
}
.hs-select:focus, .hs-input:focus { border-color: var(--accent); }

/* ============ MISC ============ */
.hs-recommend {
  background: linear-gradient(135deg, #FFF9E8 0%, var(--surface) 50%);
  border: 1px solid #EBD9A8;
  border-left: 2px solid var(--warn);
  padding: 10px 12px;
  border-radius: 5px;
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.hs-recommend .icon { color: var(--warn); flex-shrink: 0; margin-top: 1px; }
.hs-recommend .body { flex: 1; }
.hs-recommend strong { font-weight: 600; }

.hs-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
  flex-wrap: wrap;
}
.hs-toolbar .right { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

.hs-empty {
  text-align: center; padding: 40px;
  color: var(--ink-3);
}

.hs-divider { height: 1px; background: var(--line); margin: 12px 0; }

.hs-tag {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg);
  color: var(--ink-2);
  font-family: var(--font-mono);
  letter-spacing: 0;
}
.hs-tag.foxway { color: #1B4D8C; border-color: #C2D6EC; background: #ECF3FB; }
.hs-tag.syapro { color: #6B2A82; border-color: #DCC6E7; background: #F4ECF7; }
.hs-tag.scraper { color: #555; border-color: var(--line); background: var(--bg-2); }
.hs-tag.shopify { color: #2E7048; border-color: #C9E2D2; background: #E8F3EC; }

.hs-status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 6px; border-radius: 3px;
  font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.hs-status-pill.umatched { background: #F8E5DF; color: #8C2E1E; }
.hs-status-pill.suggested { background: #FBF4DF; color: #8A6116; }
.hs-status-pill.conflict { background: #F2E1F2; color: #7A2A82; }
.hs-status-pill.normalize_error { background: var(--bg-2); color: var(--ink-3); }

/* Sparkline / chart */
.hs-chart {
  width: 100%;
  height: 180px;
  position: relative;
}

/* ============ STUB PAGE ============ */
.hs-stub {
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}
.hs-stub-card {
  background: var(--surface);
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  padding: 24px;
}
.hs-stub h2 { margin: 0 0 4px; font-size: 16px; font-weight: 600; letter-spacing: -0.015em; }
.hs-stub p { margin: 0; color: var(--ink-3); font-size: 13px; line-height: 1.5; }
.hs-stub ul { margin: 8px 0 0; padding-left: 16px; color: var(--ink-2); font-size: 12.5px; }
.hs-stub li { padding: 2px 0; }

/* ============ TWEAKS PANEL ============ */
.hs-tweaks-toggle {
  position: fixed;
  right: 12px; bottom: 12px;
  z-index: 80;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  cursor: pointer;
  min-height: 36px;
}
.hs-tweaks-toggle:hover { background: #000; }

.hs-tweaks {
  position: fixed;
  right: 12px; bottom: 60px;
  z-index: 81;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.18);
  width: 320px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  display: none;
}
.hs-tweaks.open { display: block; }
.hs-tweaks-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.hs-tweaks-section:last-child { border-bottom: 0; }
.hs-tweaks-section-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 500; margin-bottom: 8px;
}
.hs-radio-row {
  display: flex; flex-wrap: wrap; gap: 4px;
}
.hs-radio-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  min-height: 28px;
}
.hs-radio-btn:hover { border-color: var(--line-2); }
.hs-radio-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-2);
  font-weight: 500;
}
.hs-toggle-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
}
.hs-toggle-row label { flex: 1; cursor: pointer; }
.hs-toggle-switch {
  width: 32px; height: 18px;
  border-radius: 999px;
  background: var(--line-2);
  position: relative;
  transition: background 0.15s;
  flex-shrink: 0;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.hs-toggle-switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  transition: transform 0.15s;
}
.hs-toggle-switch.on { background: var(--accent); }
.hs-toggle-switch.on::after { transform: translateX(14px); }

.hs-quick-nav { display: flex; flex-direction: column; gap: 4px; }
.hs-quick-nav button {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 5px;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  min-height: 28px;
}
.hs-quick-nav button:hover { background: var(--bg-2); color: var(--ink); }

/* ============ DARK MODE ============ */
body.theme-dark {
  --bg: #0d0e0a;
  --bg-2: #15170f;
  --bg-3: #1c1e15;
  --surface: #131510;
  --line: #232619;
  --line-2: #303322;
  --ink: #e9eadf;
  --ink-2: #b8baad;
  --ink-3: #6f7163;
  --ink-4: #4a4c40;
  --accent: #41a87f;
  --accent-2: #66c094;
  --accent-soft: rgba(65,168,127,0.12);
  --warn: #d4a14c;
  --danger: #e57256;
  --winner-bg: rgba(65,168,127,0.08);
}

body.theme-dark .hs-recommend {
  background: linear-gradient(135deg, rgba(212,161,76,0.12) 0%, var(--surface) 60%);
  border-color: rgba(212,161,76,0.32);
  border-left-color: var(--warn);
  color: var(--ink);
}

body.theme-dark .hs-tag.foxway   { background: rgba(91,141,200,0.14); border-color: rgba(91,141,200,0.32); color: #9CC0EE; }
body.theme-dark .hs-tag.syapro   { background: rgba(176,113,196,0.14); border-color: rgba(176,113,196,0.32); color: #D5AEE2; }
body.theme-dark .hs-tag.shopify  { background: rgba(85,160,108,0.14); border-color: rgba(85,160,108,0.32); color: #9FCFB1; }
body.theme-dark .hs-tag.scraper  { background: var(--bg-2); border-color: var(--line); color: var(--ink-2); }

body.theme-dark .hs-status-pill.umatched    { background: rgba(229,114,86,0.14); color: #F0A493; }
body.theme-dark .hs-status-pill.suggested   { background: rgba(212,161,76,0.14); color: #E5C079; }
body.theme-dark .hs-status-pill.conflict    { background: rgba(176,113,196,0.14); color: #D5AEE2; }
body.theme-dark .hs-status-pill.normalize_error { background: var(--bg-2); color: var(--ink-3); }

body.theme-dark .hs-conf-high { color: #8AD0AD; border-color: rgba(65,168,127,0.32); background: rgba(65,168,127,0.10); }
body.theme-dark .hs-conf-mid  { color: #E5C079; border-color: rgba(212,161,76,0.32); background: rgba(212,161,76,0.10); }
body.theme-dark .hs-conf-low  { color: #F0A493; border-color: rgba(229,114,86,0.32); background: rgba(229,114,86,0.10); }

body.theme-dark .hs-stock-badge.low  { color: #E5C079; background: rgba(212,161,76,0.12); }
body.theme-dark .hs-stock-badge.zero { color: var(--ink-4); background: var(--bg-2); }

/* ============ RESPONSIVE — mobile-first hardblock ============ */
@media (max-width: 1100px) {
  .hs-detail-grid { grid-template-columns: 1fr 1fr; }
  .hs-detail-grid .hs-detail-col-left { grid-column: 1 / -1; }
  .hs-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .hs-dash-grid, .hs-dash-grid.three { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --sidebar-w: 0px; }
  .hs-app { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .hs-sidebar {
    position: fixed;
    top: var(--topbar-h); left: 0; bottom: 0;
    width: 240px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.18s ease-out;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }
  .hs-app.menu-open .hs-sidebar { transform: translateX(0); }
  .hs-app.menu-open::after {
    content: "";
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(20,20,15,0.36);
    z-index: 49;
  }
  .hs-menu-btn {
    display: grid;
    place-items: center;
    width: 32px; height: 32px;
    background: transparent; border: 0;
    color: var(--ink-2);
    border-radius: 5px;
  }
  .hs-menu-btn:hover { background: var(--bg-2); }
  .hs-brand { width: auto; min-width: 0; }
  .hs-detail-grid { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .hs-stat-grid { padding: 12px; }
  .hs-dash-grid { padding: 12px; }
  .hs-page-header { padding: 12px; }
  .hs-toolbar { padding: 10px 12px; }
  .hs-list-layout { grid-template-columns: 1fr; height: auto; }
  .hs-filter-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 220px;
  }
  .hs-supplier-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .hs-supplier-row .hs-stock-badge { grid-column: 1; }
  .hs-supplier-row .hs-price-cell { grid-column: 2; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .hs-search-wrap { display: none; }
  .hs-stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hs-user-chip span { display: none; }
  .hs-user-chip { padding: 3px; }
  .hs-spec-grid { grid-template-columns: 110px 1fr; }
  .hs-tweaks { right: 8px; left: 8px; bottom: 56px; width: auto; }
  .hs-tweaks-toggle { right: 8px; bottom: 8px; }
}

@media (max-width: 380px) {
  .hs-stat-grid { grid-template-columns: 1fr; }
  .hs-page-header { gap: 8px; }
  .hs-page-actions { width: 100%; }
}

/* Touch target minimum (mobile) — links/buttons in tables stay tap-friendly */
@media (pointer: coarse) {
  .hs-nav-item { min-height: 44px; }
  .hs-btn { min-height: 44px; padding: 10px 14px; }
  .hs-btn-sm { min-height: 36px; padding: 8px 12px; }
  .hs-tab { min-height: 44px; padding: 12px 14px; }
  .hs-icon-btn { width: 44px; height: 44px; }
  .hs-menu-btn { width: 44px; height: 44px; }
  .hs-table tbody td { padding: 12px 10px; }
  .hs-filter-row { padding: 10px 0; min-height: 44px; }
  .hs-tweaks-toggle { min-height: 44px; padding: 10px 16px; }
  .hs-radio-btn, .hs-quick-nav button { min-height: 40px; padding: 10px 12px; }
  /* Prevent iOS auto-zoom on focus by ensuring inputs are >=16px */
  .hs-search-wrap input, .hs-select, .hs-input {
    font-size: 16px;
  }
  .hs-search-wrap { height: 40px; }
  .hs-select, .hs-input { height: 40px; }
}

/* ============ MODAL ============ */
.hs-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,15,0.36);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: grid; place-items: center;
  padding: 20px;
}
.hs-modal {
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(0,0,0,0.24);
  max-height: calc(100vh - 40px);
  width: 100%; max-width: 720px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.hs-modal-header {
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; gap: 12px;
}
.hs-modal-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hs-modal-body { flex: 1; overflow: auto; padding: 16px 18px; }
.hs-modal-footer {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg);
  flex-wrap: wrap;
}

.hs-match-summary {
  display: flex; align-items: center; gap: 16px;
  padding: 8px 0 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.hs-match-table-wrap {
  border: 1px solid var(--line); border-radius: 6px; overflow: auto;
}
.hs-match-table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 580px; }
.hs-match-table thead th {
  background: var(--bg);
  text-align: left;
  padding: 6px 10px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 500;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.hs-match-table tbody td { padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.hs-match-table tbody tr:last-child td { border-bottom: 0; }
.hs-match-table tbody tr.miss td { background: rgba(200,65,46,0.03); }
.hs-match-field { font-weight: 500; color: var(--ink-2); font-size: 11.5px; }

.hs-mb {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px; font-weight: 700;
}
.hs-mb-exact { background: var(--accent-soft); color: var(--accent-2); }
.hs-mb-alias { background: #E8F0FA; color: #1B4D8C; }
.hs-mb-fuzzy { background: #FBF4DF; color: #8A6116; }
.hs-mb-miss  { background: #F8E5DF; color: #8C2E1E; }
.hs-conf.clickable { cursor: pointer; }
.hs-conf.clickable:hover { filter: brightness(0.96); }

body.theme-dark .hs-mb-exact { background: rgba(65,168,127,0.16); color: #8AD0AD; }
body.theme-dark .hs-mb-alias { background: rgba(91,141,200,0.16); color: #9CC0EE; }
body.theme-dark .hs-mb-fuzzy { background: rgba(212,161,76,0.16); color: #E5C079; }
body.theme-dark .hs-mb-miss  { background: rgba(229,114,86,0.16); color: #F0A493; }

/* ============ DRAWER (notifications) ============ */
.hs-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(20,20,15,0.18);
  z-index: 90;
}
.hs-drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 420px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 32px rgba(0,0,0,0.08);
  z-index: 91;
  display: flex; flex-direction: column;
  animation: hs-slidein 0.18s ease-out;
}
@keyframes hs-slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
.hs-drawer-header {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.hs-drawer-title { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.hs-drawer-tabs {
  display: flex; gap: 0; padding: 0 14px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.hs-drawer-tab {
  padding: 8px 10px;
  border: 0; background: transparent;
  font-family: inherit; font-size: 11.5px; color: var(--ink-3);
  cursor: pointer; position: relative;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
}
.hs-drawer-tab:hover { color: var(--ink); }
.hs-drawer-tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }
.hs-drawer-tab .count {
  font-family: var(--font-mono); font-size: 9.5px;
  background: var(--bg-2); padding: 0 4px; border-radius: 3px;
  color: var(--ink-3);
}
.hs-drawer-body { flex: 1; overflow-y: auto; padding: 4px 0; }
.hs-drawer-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.hs-link {
  color: var(--accent); cursor: pointer; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none; background: transparent; border: 0;
  font-family: inherit;
}
.hs-link:hover { text-decoration: underline; }

.hs-notif {
  display: flex; gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  font-family: inherit;
}
.hs-notif:hover { background: var(--bg-2); }
.hs-notif-icon {
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.hs-notif-icon-info   { background: var(--bg-2); color: var(--ink-2); }
.hs-notif-icon-warn   { background: #FBF4DF; color: var(--warn); }
.hs-notif-icon-danger { background: #F8E5DF; color: var(--danger); }
body.theme-dark .hs-notif-icon-warn   { background: rgba(212,161,76,0.16); color: #E5C079; }
body.theme-dark .hs-notif-icon-danger { background: rgba(229,114,86,0.16); color: #F0A493; }

.hs-notif-body { flex: 1; min-width: 0; }
.hs-notif-head { display: flex; gap: 8px; align-items: baseline; }
.hs-notif-head strong { font-size: 12.5px; font-weight: 500; flex: 1; line-height: 1.3; }
.hs-notif-time { font-size: 10.5px; color: var(--ink-3); flex-shrink: 0; font-family: var(--font-mono); }
.hs-notif-text { font-size: 11.5px; color: var(--ink-3); line-height: 1.4; margin-top: 3px; }

/* ============ COMPETITOR / KPI ============ */
.hs-kpi-grid { display: grid; gap: 12px; }
.hs-kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 12px;
}
.hs-kpi-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.hs-kpi-val { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 2px; }
.hs-kpi-sub { font-size: 11px; color: var(--ink-3); }

.hs-pos-bar {
  display: flex;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.hs-pos-bar-seg {
  display: grid; place-items: center;
  color: white; font-size: 11px; font-weight: 600; font-family: var(--font-mono);
  min-width: 24px;
}
.hs-pos-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 6px 16px;
  margin-top: 12px;
}
.hs-pos-leg-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.hs-pos-leg-item .dot { width: 8px; height: 8px; border-radius: 2px; }
.hs-pos-leg-item .lbl { flex: 1; color: var(--ink-2); }

.hs-stack-bar {
  position: relative;
  background: var(--bg-2); border-radius: 3px;
  height: 18px; min-width: 80px;
  font-size: 10.5px; font-family: var(--font-mono);
  display: flex; align-items: center;
  padding: 0 6px;
  overflow: hidden;
}
.hs-stack-bar-fill {
  position: absolute; top: 0; bottom: 0; left: 0;
  border-radius: 3px;
}
.hs-stack-bar-fill.ok   { background: rgba(15,138,111,0.18); border-right: 2px solid var(--accent); }
.hs-stack-bar-fill.warn { background: rgba(198,138,28,0.18); border-right: 2px solid var(--warn); }
.hs-stack-bar span { position: relative; z-index: 2; color: var(--ink-2); }

/* ============ FORM ROWS (settings) ============ */
.hs-form-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.hs-form-row > label {
  width: 200px; color: var(--ink-2); flex-shrink: 0;
}
.hs-form-row .hs-muted { font-size: 11px; }
.hs-channel-chip {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--bg-2); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 3px;
  font-size: 10.5px; color: var(--ink-2);
}

/* ============ ROLE TAG / CHIPS ============ */
.hs-role-tag {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10.5px; font-weight: 500;
  border-radius: 3px;
  background: var(--bg-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.hs-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ============ DASHBOARD WIDGETS ============ */
.hs-spark { width: 100%; height: 60px; display: block; }
.hs-heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.hs-heatmap-cell { aspect-ratio: 1; border-radius: 2px; background: var(--bg-2); }

@media (max-width: 1100px) {
  .hs-kpi-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .hs-kpi-grid.cols-4 { grid-template-columns: 1fr; }
  .hs-modal { max-width: 100%; }
  .hs-drawer { width: 100%; }
}

/* ============ PRICING RULES ============ */
.hs-rules-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - var(--topbar-h) - 60px);
}
.hs-rules-list {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.hs-rules-list-head { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.hs-rule-item {
  width: 100%; text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  padding: 10px 14px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent;
  font-family: inherit;
  cursor: pointer;
  position: relative;
}
.hs-rule-item:hover { background: var(--bg-2); }
.hs-rule-item.active { background: var(--accent-soft); }
.hs-rule-item.active::before {
  content: ""; position: absolute; left: 0; width: 2px; top: 0; bottom: 0;
  background: var(--accent);
}
.hs-rule-item.status-paused { opacity: 0.6; }
.hs-rule-item.status-draft { opacity: 0.5; }
.hs-rule-item-head { display: flex; align-items: center; gap: 8px; }
.hs-rule-prio {
  width: 18px; height: 18px;
  background: var(--bg-2); color: var(--ink-2);
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
  border-radius: 3px;
  flex-shrink: 0;
}
.hs-rule-name { font-weight: 500; font-size: 12.5px; flex: 1; }
.hs-rule-status {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600;
  padding: 1px 5px; border-radius: 3px;
}
.hs-rule-status.status-active { background: var(--accent-soft); color: var(--accent-2); }
.hs-rule-status.status-paused { background: #FBF4DF; color: var(--warn); }
.hs-rule-status.status-draft  { background: var(--bg-2); color: var(--ink-3); }
body.theme-dark .hs-rule-status.status-active { background: rgba(65,168,127,0.14); color: #8AD0AD; }
body.theme-dark .hs-rule-status.status-paused { background: rgba(212,161,76,0.14); color: #E5C079; }

.hs-rule-item-meta {
  display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--ink-3);
  padding-left: 26px;
  flex-wrap: wrap;
}

.hs-rule-editor { overflow-y: auto; padding: 16px 24px 32px; }
.hs-rule-editor-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.hs-rule-name-input {
  flex: 1; min-width: 200px;
  font-size: 18px; font-weight: 600; letter-spacing: -0.015em;
  border: 0; background: transparent;
  font-family: inherit; outline: 0;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  color: var(--ink);
}
.hs-rule-name-input:focus { border-bottom-color: var(--accent); }

.hs-rule-section { margin-bottom: 16px; }
.hs-rule-section .hs-micro { margin-bottom: 6px; }

.hs-chip-add {
  border: 1px dashed var(--line-2); background: transparent;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; color: var(--ink-3);
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.hs-chip-add:hover { border-color: var(--accent); color: var(--accent); }

.hs-rule-conds { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.hs-rule-cond { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hs-rule-op-and {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em;
  background: var(--bg-2); padding: 2px 6px; border-radius: 3px;
  color: var(--ink-3); font-weight: 600;
}
.hs-rule-then { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hs-checkbox { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.hs-checkbox input { accent-color: var(--accent); margin: 0; }

@media (max-width: 820px) {
  .hs-rules-grid { grid-template-columns: 1fr; height: auto; }
  .hs-rules-list { max-height: 320px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ============ FEJLLISTE-DETAIL ============ */
.hs-fld-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  padding: 0 24px 24px;
}
.hs-fld-row {
  display: grid; grid-template-columns: 110px 1fr;
  padding: 6px 12px;
  font-size: 12px; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.hs-fld-row:last-child { border-bottom: 0; }
.hs-fld-row.match { background: rgba(15,138,111,0.04); }
.hs-fld-row.miss  { background: rgba(200,65,46,0.04); }
.hs-fld-row .k { color: var(--ink-3); font-size: 11px; }
.hs-fld-row .v { font-family: var(--font-mono); font-size: 11.5px; word-break: break-word; }
body.theme-dark .hs-fld-row.match { background: rgba(65,168,127,0.06); }
body.theme-dark .hs-fld-row.miss  { background: rgba(229,114,86,0.06); }

@media (max-width: 820px) {
  .hs-fld-grid { grid-template-columns: 1fr; padding: 0 12px 16px; }
}

/* ============ MAPPING (drag-drop + transformations) ============ */
.hs-map-tabs {
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  display: flex; background: var(--surface);
}
.hs-map-tab {
  padding: 10px 16px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
}
.hs-map-tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 500; }

.hs-map-grid {
  display: grid;
  grid-template-columns: 260px 1fr 360px;
  height: calc(100vh - var(--topbar-h) - 78px - 41px);
}
.hs-map-col {
  overflow-y: auto;
  padding: 12px;
}
.hs-map-col.middle { padding: 0; }
.hs-map-col.left { border-right: 1px solid var(--line); }
.hs-map-col.right { border-left: 1px solid var(--line); background: var(--bg-2); padding: 12px 14px; }

.hs-mapfield {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: grab;
  transition: border-color 0.1s, background 0.1s;
  user-select: none;
}
.hs-mapfield:hover { border-color: var(--accent); background: var(--accent-soft); }
.hs-mapfield:active { cursor: grabbing; }
.hs-mapfield.mapped { opacity: 0.45; }

.hs-master-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}
.hs-master-row:hover { background: var(--bg-2); }
.hs-master-row.active { background: var(--accent-soft); border-left: 2px solid var(--accent); padding-left: 14px; }
.hs-master-row.over { background: rgba(15,138,111,0.1); outline: 2px dashed var(--accent); outline-offset: -4px; }
body.theme-dark .hs-master-row.over { background: rgba(65,168,127,0.16); }

.hs-step-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11.5px;
}
.hs-step-num {
  display: inline-grid; place-items: center;
  width: 18px; height: 18px;
  background: var(--bg-2);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  font-weight: 500;
  flex-shrink: 0;
}
.hs-trace-row {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 6px;
  border-bottom: 1px dashed var(--line);
  font-size: 11px;
}
.hs-trace-num {
  display: inline-grid; place-items: center;
  width: 16px; height: 16px;
  background: var(--bg-2);
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-3);
  flex-shrink: 0;
}

@media (max-width: 1100px) {
  .hs-map-grid { grid-template-columns: 220px 1fr 320px; }
}
@media (max-width: 820px) {
  .hs-map-grid { grid-template-columns: 1fr; height: auto; }
  .hs-map-col.left, .hs-map-col.right { border-right: 0; border-left: 0; max-height: 300px; border-bottom: 1px solid var(--line); }
}

/* ============ SCRAPER ============ */
.hs-scraper-grid {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: calc(100vh - var(--topbar-h) - 78px);
}
.hs-scraper-list {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.hs-scraper-target {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  border-left: 2px solid transparent;
}
.hs-scraper-target.active { background: var(--bg-2); border-left-color: var(--accent); }
.hs-scraper-target:hover { background: var(--bg-2); }

.hs-pick-label {
  position: absolute;
  top: -18px; left: -2px;
  font-size: 9px;
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.04em;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
  font-family: var(--font-mono);
}

@media (max-width: 820px) {
  .hs-scraper-grid { grid-template-columns: 1fr; height: auto; }
  .hs-scraper-list { max-height: 240px; border-right: 0; border-bottom: 1px solid var(--line); }
}

/* ============ ONBOARDING ============ */
.hs-onb-stepper {
  display: flex; align-items: center;
  padding: 16px 0 24px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.hs-onb-step {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-3);
  flex-shrink: 0;
}
.hs-onb-step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bg-2); color: var(--ink-3);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; font-family: var(--font-mono);
}
.hs-onb-step.active .hs-onb-step-num {
  background: var(--ink); color: var(--bg); border-color: var(--ink);
}
.hs-onb-step.done .hs-onb-step-num {
  background: var(--accent); color: white; border-color: var(--accent);
}
.hs-onb-step.active span { color: var(--ink); font-weight: 500; }
.hs-onb-step.done span { color: var(--ink-2); }
.hs-onb-step-line {
  height: 1px; background: var(--line);
  flex: 1; margin: 0 12px;
  min-width: 16px;
}
.hs-onb-step-line.done { background: var(--accent); }

.hs-radio-cards { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; }
.hs-radio-card {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  flex: 1; min-width: 180px;
  color: var(--ink);
}
.hs-radio-card:hover { border-color: var(--line-2); }
.hs-radio-card.active { border-color: var(--accent); background: var(--accent-soft); }
.hs-radio-card-dot {
  width: 14px; height: 14px;
  border: 1.5px solid var(--ink-4);
  border-radius: 50%;
  margin-top: 2px;
  flex-shrink: 0;
}
.hs-radio-card.active .hs-radio-card-dot {
  border-color: var(--accent);
  background: radial-gradient(circle at center, var(--accent) 0 4px, transparent 4.5px);
}

.hs-quality-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.hs-quality-row:last-child { border-bottom: 0; }

.hs-kind-card {
  display: flex;
  gap: 16px;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.1s, transform 0.1s, box-shadow 0.1s;
}
.hs-kind-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

/* ============ BULK ACTIONS ============ */
.hs-bulk-bar {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  padding: 6px 8px 6px 14px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.24);
  z-index: 50;
  font-size: 12.5px;
  min-width: 480px;
  max-width: calc(100vw - 24px);
  flex-wrap: wrap;
}
.hs-bulk-bar-count { font-weight: 500; flex-shrink: 0; }
.hs-bulk-bar .hs-btn {
  background: rgba(255,255,255,0.08);
  color: var(--bg);
  border-color: rgba(255,255,255,0.14);
}
.hs-bulk-bar .hs-btn:hover { background: rgba(255,255,255,0.16); }
.hs-bulk-bar .hs-btn-primary { background: var(--accent); border-color: var(--accent); }
.hs-bulk-bar .hs-btn-primary:hover { background: var(--accent-2); }
.hs-bulk-bar .hs-btn-ghost { background: transparent; border-color: transparent; }
.hs-bulk-bar .hs-muted { color: rgba(255,255,255,0.4); }
body.theme-dark .hs-bulk-bar { background: var(--bg-3); border: 1px solid var(--line-2); }

.hs-bulk-summary {
  background: var(--bg);
  border-radius: 4px;
  padding: 4px 12px;
}
.hs-bulk-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.hs-bulk-row:last-child { border-bottom: 0; }
.hs-warn { color: var(--warn); }

.hs-spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--bg-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: hs-spin 0.8s linear infinite;
}
@keyframes hs-spin { to { transform: rotate(360deg); } }

@media (max-width: 560px) {
  .hs-bulk-bar { min-width: 0; left: 8px; right: 8px; transform: none; bottom: 8px; }
}

/* High-contrast print fallback */
@media print {
  .hs-sidebar, .hs-topbar, .hs-tweaks-toggle, .hs-tweaks { display: none; }
  .hs-app { display: block; height: auto; overflow: visible; }
  .hs-main { overflow: visible; }
}
