:root {
  /* ── Primary Accent — deep indigo (Linear / Vercel energy) ── */
  --color-primary: #4f46e5;
  --color-primary-hover: #4338ca;
  --color-primary-light: #6366f1;
  --color-accent: #06b6d4;
  --color-accent-soft: #67e8f9;

  /* ── Surfaces & Backgrounds ── */
  --bg: #f3f4f8;
  --bg-gradient: linear-gradient(160deg, #f3f4f8 0%, #eef0f6 100%);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #f8f9fb;

  /* ── Text Hierarchy ── */
  --text-primary: #0d1117;
  --text-secondary: #3d4757;
  --text-tertiary: #64748b;
  --text-muted: #9ba8bb;

  /* ── Legacy shorthands (used in older selectors) ── */
  --text: #0d1117;
  --muted: #64748b;
  --border: #e1e5ee;
  --radius: 10px;

  /* ── Borders & Dividers ── */
  --border-light: #e1e5ee;
  --border-medium: #c8d0de;
  --border-strong: #9ba8bb;

  /* ── Semantic Colors ── */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #6366f1;

  /* ── Spacing Scale (8px base) ── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;

  /* ── Border Radius — tighter, more precise ── */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  /* ── Shadows — indigo-tinted for depth ── */
  --shadow-xs: 0 1px 2px rgba(14, 20, 60, 0.05);
  --shadow-sm: 0 1px 4px rgba(14, 20, 60, 0.06), 0 2px 8px rgba(14, 20, 60, 0.04);
  --shadow-md: 0 4px 12px rgba(14, 20, 60, 0.08), 0 1px 4px rgba(14, 20, 60, 0.04);
  --shadow-lg: 0 8px 28px rgba(14, 20, 60, 0.11), 0 2px 8px rgba(14, 20, 60, 0.06);
  --shadow-xl: 0 16px 48px rgba(14, 20, 60, 0.13), 0 6px 20px rgba(14, 20, 60, 0.07);

  /* ── Typography ── */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* ── Transitions ── */
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
  letter-spacing: -0.01em;
}

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.97);
  border-bottom: 1px solid rgba(209, 215, 228, 0.9);
  padding: 0 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(16px) saturate(200%);
  box-shadow: 0 1px 0 rgba(209, 215, 228, 0.6), 0 2px 12px rgba(14, 20, 60, 0.04);
}

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

.brand h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.brand p {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.logo {
  width: 34px;
  height: 34px;
  background: linear-gradient(140deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3), 0 0 0 1px rgba(79, 70, 229, 0.15);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#accountPanel {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.acct-phone {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

/* ── Examples Menu in Header ──────────────────────────────────────── */
.header-examples-menu {
  position: relative;
}

#examplesMenuBtn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

.examples-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  width: max-content;
  min-width: 160px;
  z-index: 1000;
}

.examples-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: none;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.examples-menu-item .examples-menu-label {
  font-size: 12px;
  font-weight: 600;
}

.examples-menu-item .examples-menu-subtext {
  margin-left: auto;
  font-size: 11px;
  color: #6b7280;
}

.examples-menu-item:first-child {
  border-radius: 7px 7px 0 0;
}

.examples-menu-item:last-child {
  border-radius: 0 0 7px 7px;
}

.examples-menu-item:hover {
  background-color: #f3f4f6;
}

.examples-menu-item:active {
  background-color: #e5e7eb;
}

.taskflow-import-trustline {
  margin: -2px 0 10px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #4b5563;
  font-weight: 500;
}

.taskflow-import-trustline a {
  margin-left: 6px;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.taskflow-import-trustline a:hover {
  text-decoration: underline;
}

.taskflow-export-hint {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-tertiary);
  text-align: center;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
  gap: 20px;
  padding: 20px 24px 32px;
  min-height: calc(100vh - 106px);
  align-items: start;
  max-width: 1920px;
  margin: 0 auto;
}

.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 800;
  color: var(--color-primary);
  padding: 6px 12px 14px;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu {
  border: none;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
  border-left: 3px solid transparent;
}

.menu:hover {
  background: rgba(47, 128, 237, 0.07);
}

.menu.active {
  background: rgba(47, 128, 237, 0.11);
  color: var(--color-primary);
  font-weight: 700;
  border-left-color: var(--color-primary);
}

.menu-icon {
  font-size: 15px;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.menu-label {
  flex: 1;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0; /* prevent grid cell from expanding beyond 1fr */
}

/* ── Header-triggered business popup ─────────────────────────────────────── */
.biz-contact-trigger {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-full);
  background: linear-gradient(160deg, #5b56f0 0%, #4f46e5 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 0 16px 0 14px;
  min-width: 148px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.28);
  border: none;
  transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
}

.biz-contact-trigger::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1), rgba(255,255,255,0) 50%);
  pointer-events: none;
}

.biz-contact-trigger::after {
  display: none;
}

.biz-contact-emblem {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: rgba(255,255,255, 0.2);
  border: none;
  box-shadow: none;
}

.biz-contact-emblem svg {
  display: block;
  width: 16px;
  height: 16px;
}

.biz-contact-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.2;
}

.biz-contact-eyebrow {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.biz-contact-label {
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
}

.biz-contact-arrow {
  position: relative;
  z-index: 1;
  margin-left: auto;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
}

.biz-contact-trigger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.38);
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 100%);
  border: none;
}

.biz-contact-trigger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3), 0 4px 12px rgba(37, 99, 235, 0.35);
}

.biz-contact-trigger[aria-expanded="true"] {
  background: linear-gradient(160deg, #4338ca 0%, #3730a3 100%);
  border: none;
}

.biz-contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 85;
  background: rgba(15,23,42,.14);
}

.biz-contact-overlay[hidden] {
  display: none;
}

.biz-contact-card {
  position: absolute;
  top: 78px;
  right: 24px;
  width: 296px;
  max-width: calc(100vw - 32px);
}

.biz-contact-shell {
  position: relative;
  overflow: hidden;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(214, 226, 245, .95);
  background:
    radial-gradient(circle at top right, rgba(77, 142, 255, .18), transparent 34%),
    radial-gradient(circle at left bottom, rgba(14, 165, 233, .10), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(247,250,255,.98) 100%);
  box-shadow: 0 22px 56px rgba(16,33,58,.16), 0 10px 24px rgba(21,94,239,.10);
  backdrop-filter: blur(14px);
}

.biz-contact-shell::before {
  content: '';
  position: absolute;
  inset: auto -26px -34px auto;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(21,94,239,.12) 0%, rgba(21,94,239,0) 70%);
  pointer-events: none;
}

.biz-contact-close {
  position: absolute;
  top: -10px;
  right: -2px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: 1px solid #dbe4f2;
  border-radius: 999px;
  background: rgba(255,255,255,.96);
  color: #5b6b84;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(16,33,58,.10);
}

.biz-contact-close:hover {
  color: #1f2b3d;
  border-color: #bdd2f6;
}

.biz-contact-top {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.biz-contact-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: #eef4ff;
  color: #155eef;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.biz-contact-tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.biz-contact-tag {
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #d8e3f4;
  background: rgba(255,255,255,.82);
  color: #49607e;
  font-size: 10.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
}

.biz-contact-title {
  position: relative;
  z-index: 1;
  margin: 12px 0 6px;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -.035em;
  color: #14253e;
}

.biz-contact-desc {
  position: relative;
  z-index: 1;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #627089;
}

.biz-contact-qr-panel {
  position: relative;
  z-index: 1;
  margin-top: 12px;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid #d8e6fb;
  background: rgba(255,255,255,.88);
}

.biz-contact-qr {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: inset 0 0 0 1px rgba(21,94,239,.08);
}

.biz-contact-qr-note {
  margin-top: 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: #51627c;
  text-align: center;
}


/* Each switchable content panel inside main */
.main-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Ruleset cards ──────────────────────────────────────────────── */
.rs-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

.rs-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
  transition: box-shadow 0.15s;
}

.rs-card:hover {
  box-shadow: 0 2px 12px rgba(47,128,237,0.10);
}

.rs-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.rs-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.rs-card-desc {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}

.rs-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.rs-card-actions {
  display: flex;
  gap: 8px;
}

/* ── Audit log table ────────────────────────────────────────────── */
.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.audit-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}

.audit-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.audit-table tr:last-child td {
  border-bottom: none;
}

.audit-action {
  font-size: 11px;
  background: #eef2ff;
  color: #3730a3;
  border-radius: 4px;
  padding: 2px 6px;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Settings panel ─────────────────────────────────────────────── */
.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.settings-label {
  font-size: 13px;
  color: var(--text);
  min-width: 140px;
  font-weight: 500;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(79, 70, 229, 0.18);
}

/* ── Tools workspace ─────────────────────────────────────────────────────── */
.tools {
  overflow: hidden;
  padding: 14px 16px 16px;
}

.tools-bar {
  display: flex;
  /* vertically center file-zone and actions */
  align-items: center;
  gap: 12px;
}

.tools-bar .file-zone {
  flex: 1;
  min-width: 0;
}

.tools-rule-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.worksection-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.section-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-primary);
  opacity: 0.85;
}
  margin-bottom: 6px;
}

.section-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.section-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.section-inline-tips {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

.section-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  border: 1px solid #cddbff;
  color: #1d4ed8;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}



.tools .row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.input,
.select {
  border: 1px solid var(--border);
  background: white;
  border-radius: 7px;
  padding: 8px 10px;
  min-width: 130px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.input {
  flex: 1;
}

.input.short {
  max-width: 220px;
}

.select.compact {
  min-width: 96px;
}

.btn {
  border: none;
  border-radius: var(--radius-md);
  height: 38px;
  padding: 0 15px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-fast), opacity var(--transition-base);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.15px;
}

.btn:active { 
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: linear-gradient(160deg, #5b56f0 0%, #4f46e5 100%);
  color: white;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3), 0 1px 2px rgba(79, 70, 229, 0.15);
}

.btn--loading {
  opacity: 0.75;
  cursor: not-allowed;
  animation: btn-pulse 1.2s ease-in-out infinite;
}
@keyframes btn-pulse {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.btn-primary:hover { 
  background: linear-gradient(160deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.38), 0 1px 3px rgba(79, 70, 229, 0.15);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover { 
  background: #f5f4ff;
  border-color: rgba(79, 70, 229, 0.3);
  color: var(--color-primary);
  box-shadow: var(--shadow-sm);
}

.btn-success {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.btn-success:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
  transform: translateY(-1px);
}

.meta {
  color: var(--text-tertiary);
  font-size: 13px;
  font-weight: 500;
}

.table-wrap {
  min-height: 420px;
  padding-top: 20px;
}

.view-tools {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.view-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f6f8fb;
  border: 1px solid #e4e9f0;
  border-radius: 6px;
  padding: 3px 8px 3px 6px;
}
.view-group-label {
  font-size: 11px;
  color: #7a8499;
  font-weight: 600;
  white-space: nowrap;
  margin-right: 2px;
  user-select: none;
}
.view-divider {
  width: 1px;
  height: 20px;
  background: #dde3ed;
  flex-shrink: 0;
}

.table-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.table-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.table-head-main {
  min-width: 0;
}

.table-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #10213a;
}

.table-desc {
  max-width: 720px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid #dde4ee;
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.btn-preview-clear {
  height: 34px;
  padding: 0 12px;
  border-color: #f1d5b8;
  background: #fff8ef;
  color: #8a4b16;
  font-size: 12px;
  font-weight: 600;
}

.btn-preview-clear:hover {
  background: #ffeedb;
  border-color: #e8bf95;
}

.table-container {
  overflow: auto;
  max-height: 600px;
  /* Constrain width so horizontal scroll appears here, not on layout */
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  /* Prevent Mac trackpad overscroll from triggering browser back/forward navigation */
  overscroll-behavior-x: none;
}

.tree-container {
  overflow: auto;
  max-height: 600px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fbfdff;
  padding: 12px;
  font-size: 13px;
  overscroll-behavior-x: none;
}

.preview-stage {
  position: relative;
  overflow: hidden;
}

.preview-empty-hint {
  margin-top: 12px;
  padding: 16px 18px;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  background: #fafafa;
  color: #6b7280;
  font-size: 13px;
  line-height: 1.5;
}

.preview-diff-rail {
  position: absolute;
  top: 10px;
  bottom: 10px;
  right: 6px;
  width: 6px;
  box-sizing: border-box;
  border-radius: 3px;
  background: rgba(148, 163, 184, 0.18);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  z-index: 4;
  overflow: hidden;
}

.preview-diff-rail.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.preview-diff-lane {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tree-item-anchor {
  display: block;
}

.preview-col-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preview-col-name {
  min-width: 0;
}

.preview-col-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: linear-gradient(180deg, #fff7ed 0%, #fff 100%);
}

.preview-col-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}

.preview-col-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  cursor: default;
}

.preview-col-badge--added {
  background: #dcfce7;
  color: #166534;
}

.preview-col-badge--changed {
  background: #dbeafe;
  color: #1d4ed8;
}

.preview-col-badge--removed {
  background: #ffedd5;
  color: #c2410c;
}

.preview-col-badge--latest {
  background: #fef3c7;
  color: #92400e;
  outline: 1px solid #f59e0b;
}

th.preview-col-latest {
  background: #fffbeb !important;
}

/* Subtotal rows in append_summary mode (interleaved after each group) */
.preview-subtotal-row td {
  font-weight: 700;
  background: #f0f4ff;
  border-top: 2px solid #c7d2fe;
  color: #1e3a8a;
  font-style: italic;
}

.preview-cell-diff {
  display: grid;
  gap: 6px;
  min-width: 120px;
}

.preview-cell-diff-row {
  display: grid;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 10px;
}

.preview-cell-diff-row--before {
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
  border: 1px solid #d7deea;
}

.preview-cell-diff-row--after {
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #bfdbfe;
}

.preview-cell-diff-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
  text-transform: uppercase;
}

.preview-cell-diff-value {
  color: #0f172a;
  line-height: 1.45;
  word-break: break-word;
}

.preview-cell-diff-arrow {
  font-size: 11px;
  font-weight: 700;
  color: #2563eb;
  text-align: center;
}

.preview-diff-marker {
  appearance: none;
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  transform: translateY(-50%);
  border: none;
  border-radius: 1px;
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  transition: height 0.1s ease, opacity 0.1s ease;
}

/* modified (field value changed) — blue */
.preview-diff-marker--modified {
  background: #3b82f6;
  opacity: 0.85;
}

/* added (new field / new column) — green */
.preview-diff-marker--added {
  background: #22c55e;
  opacity: 0.85;
}

/* removed (row deleted / field removed) — red */
.preview-diff-marker--removed {
  background: #ef4444;
  opacity: 0.85;
}

.preview-diff-marker:hover {
  height: 3px;
  opacity: 1;
}

tbody tr.preview-jump-flash td,
.tree-item-anchor.preview-jump-flash,
.tree-node.preview-jump-flash,
.tree-leaf-row.preview-jump-flash,
.tree-key-removed-entry.preview-jump-flash {
  animation: previewJumpFlash 1s ease;
}

@keyframes previewJumpFlash {
  0% {
    box-shadow: inset 0 0 0 999px rgba(34, 197, 94, 0.2);
  }
  100% {
    box-shadow: inset 0 0 0 999px rgba(34, 197, 94, 0);
  }
}

.tree-node {
  margin-left: 6px;
}

.tree-node details {
  margin: 4px 0;
}

.tree-key {
  color: #1f4f95;
  font-weight: 600;
}

.tree-value {
  color: #334155;
}

.tree-changed {
  color: #d97706;
  font-weight: 700;
  background: #fef3c7;
  padding: 0 4px;
  border-radius: 3px;
}

.tree-key-added {
  color: #16a34a;
  font-weight: 700;
  background: #dcfce7;
  padding: 0 4px;
  border-radius: 3px;
}

.tree-key-removed {
  color: #dc2626;
  text-decoration: line-through;
  opacity: 0.7;
}

.tree-key-removed-entry {
  opacity: 0.6;
}

.tree-key-removed-val {
  color: #dc2626;
  font-style: italic;
}

.tree-removed-badge {
  display: inline-block;
  font-size: 10px;
  background: #fee2e2;
  color: #dc2626;
  padding: 0 4px;
  border-radius: 3px;
  vertical-align: middle;
  font-weight: 600;
  font-style: normal;
}

.tree-orig {
  color: #9ca3af;
  font-size: 11px;
  font-style: italic;
}

/* Column distribution button shown on hover in tree view leaf rows */
.tree-leaf-row {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
}

.tree-analyze-btn,
.tree-recommend-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  padding: 0 2px;
  opacity: 0.9;
  line-height: 1;
  vertical-align: middle;
}

.tree-leaf-row:hover .tree-analyze-btn,
.tree-leaf-row:hover .tree-recommend-btn {
  display: inline-block;
}

.tree-analyze-btn:hover,
.tree-recommend-btn:hover {
  opacity: 1;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  border-bottom: 1px solid #e8edf5;
  border-right: 1px solid #e8edf5;
  padding: 8px 10px;
  font-size: 13px;
  text-align: left;
}

th:last-child,
td:last-child {
  border-right: none;
}

tbody td {
  cursor: pointer;
}

th {
  position: sticky;
  top: 0;
  background: #f1f5fb;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.1px;
  white-space: nowrap;
  height: 38px;
  vertical-align: middle;
  box-sizing: border-box;
}

tr:hover td {
  background: #f7fbff;
}

@keyframes cellCopied {
  0%   { background: #bbf7d0; }
  100% { background: transparent; }
}
td.cell-copied {
  animation: cellCopied 0.6s ease-out;
}

.changed {
  background: #fff8db;
}

.rules-preview {
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 10px;
  min-height: 72px;
  max-height: 320px;
  overflow-y: auto;
  padding: 10px;
  font-size: 12px;
  color: #445;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.rule-row {
  transition: background-color 150ms ease;
}

.rule-row:hover {
  background-color: #f8f9fb;
  border-radius: 4px;
  padding-left: 4px;
  padding-right: 4px;
  margin-left: -4px;
  margin-right: -4px;
}

.rule-hover-menu {
  position: absolute;
  right: 80px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  z-index: 10;
  white-space: nowrap;
}

.rule-hover-menu-btn {
  padding: 4px 8px;
  font-size: 11px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #f3f4f6;
  color: #374151;
  cursor: pointer;
  transition: all 150ms ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.rule-hover-menu-btn:hover:not(:disabled) {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.rule-hover-menu-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.rule-hover-menu-up {
  color: #3b82f6;
  border-color: #93c5fd;
  background: #eff6ff;
}

.rule-hover-menu-up:hover:not(:disabled) {
  background: #dbeafe;
  border-color: #60a5fa;
}

.rule-hover-menu-down {
  color: #8b5cf6;
  border-color: #d8b4fe;
  background: #faf5ff;
}

.rule-hover-menu-down:hover:not(:disabled) {
  background: #f3e8ff;
  border-color: #c084fc;
}

.rule-hover-menu-edit {
  color: #7c3aed;
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.rule-hover-menu-edit:hover:not(:disabled) {
  background: #ede9fe;
  border-color: #c4b5fd;
}

/* ── DATA PREVIEW empty state ─────────────────────────────────────── */
.data-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  padding: 40px 24px;
  text-align: center;
  color: #9ca3af;
}
.data-preview-empty-icon {
  font-size: 36px;
  line-height: 1;
}
.data-preview-empty-title {
  font-size: 16px;
  font-weight: 600;
  color: #6b7280;
}
.data-preview-empty-body {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.55;
  max-width: 280px;
}

/* ── Rule Library no-data placeholder ────────────────────────────── */
.rule-library-nodata-guide {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 20px;
  text-align: center;
  color: #9ca3af;
}
.rule-library-nodata-icon {
  font-size: 32px;
  line-height: 1;
}
.rule-library-nodata-title {
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
}
.rule-library-nodata-body {
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.55;
  max-width: 220px;
}

/* ── Current Rules empty-state guide card ─────────────────────────── */
.rules-empty-guide {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 18px;
  background: #f8f9fb;
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  margin: 8px 0;
}
.rules-empty-guide-title {
  font-size: 14px;
  font-weight: 600;
  color: #9ca3af;
}
.rules-empty-guide-body {
  font-size: 13px;
  color: #6b7280;
  line-height: 1.55;
}
.rules-empty-guide-tip {
  font-size: 12px;
  color: #4b5563;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 7px 10px;
  margin-top: 4px;
}

/* ── Samples grid in rules empty state ────────────────────────────── */
.rules-empty-samples-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f3f4f6;
}

.example-chip {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: white;
  color: #374151;
  cursor: pointer;
  transition: all 200ms ease;
  white-space: nowrap;
}

.example-chip:hover {
  background: #f9fafb;
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.example-chip:active {
  background: #f3f4f6;
  border-color: #9ca3af;
}

.example-chip-video {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fcd34d;
  color: #78350f;
}

.example-chip-video:hover {
  background: linear-gradient(135deg, #fcd34d 0%, #fbcf33 100%);
  border-color: #f59e0b;
}

.inspector h3 {
  margin-top: 0;
}

/* ── Right-panel sections ─────────────────────────────────────────── */
.panel-section {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.panel-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 10px;
  letter-spacing: 0.1px;
}

.panel-section-head > span {
  min-width: 0;
}

.rule-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.rule-actions > * {
  flex-shrink: 0;
  white-space: nowrap;
}

.inspector {
  position: sticky;
  top: 106px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: #c8d0de transparent;
}

.inspector-summary {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: linear-gradient(150deg, #f5f4ff 0%, #eff0fe 100%);
  border: 1px solid rgba(79, 70, 229, 0.14);
  border-radius: 10px;
}

.inspector-summary-kicker {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: 6px;
}

.inspector-summary-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.inspector-summary-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.rule-tabs {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  white-space: nowrap;
  gap: 1px;
  background: #f4f7fb;
  border-radius: 10px;
  padding: 3px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.rule-tabs::-webkit-scrollbar {
  display: none;
}

.rule-tabs-shell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rule-library-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-library-panel-head {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.rule-library-mode-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.rule-library-searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.rule-library-searchicon {
  flex: 0 0 auto;
  font-size: 14px;
}

.rule-library-searchinput {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  padding: 0;
}

.rule-library-searchinput::placeholder {
  color: #94a3b8;
}

.rule-library-scene-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 10px;
}

.rule-scene-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: #475569;
  transition: all 0.2s ease;
}

.rule-scene-checkbox:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.rule-scene-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex: 0 0 auto;
}

.rule-scene-checkbox input[type="checkbox"]:checked + span {
  color: #0f172a;
  font-weight: 600;
}

.scene-hipaa-badge {
  display: inline-block;
  margin-left: 5px;
  font-size: 10px;
  font-weight: 700;
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  padding: 1px 5px;
  vertical-align: middle;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.rule-library-status {
  display: grid;
  gap: 4px;
}

.rule-library-status-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #64748b;
}

.rule-library-status-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.rule-library-status-desc {
  font-size: 12px;
  line-height: 1.6;
  color: #64748b;
}

.rule-library-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-library-shell[data-mode="scene"] .rule-tabs-shell {
  display: none;
}

.rule-library-shell[data-mode="expert"] .rule-library-scene-selector {
  display: none;
}

.rule-library-shell[data-mode="expert"] .rule-library-mode-badge {
  background: #fff4e6;
  color: #b45309;
}

.rule-tabs-scroll {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid #d7deea;
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.rule-tabs-shell.is-overflowing .rule-tabs-scroll {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.rule-tabs-scroll:disabled {
  opacity: .45 !important;
  transform: scale(0.96);
  pointer-events: none;
}

.rule-tabs-fade {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 18px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .16s ease;
}

.rule-tabs-fade--left {
  left: 31px;
  background: linear-gradient(90deg, #f8fbff 0%, rgba(248,251,255,0) 100%);
}

.rule-tabs-fade--right {
  right: 31px;
  background: linear-gradient(270deg, #f8fbff 0%, rgba(248,251,255,0) 100%);
}

.rule-tabs-shell.can-scroll-left .rule-tabs-fade--left {
  opacity: 1;
}

.rule-tabs-shell.can-scroll-right .rule-tabs-fade--right {
  opacity: 1;
}

.rule-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 6px 7px;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
  flex: 0 0 auto;
}

.rule-tab.active {
  background: #fff;
  color: var(--color-primary);
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(16,33,58,.08);
}

/* ── Rule quick-add popover form ─────────────────────────────────── */
.qa-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qa-label {
  font-size: 12px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
  width: 156px;
  flex-shrink: 0;
}
.qa-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}
.qa-hint {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
  background: var(--bg-hover, rgba(255,255,255,.06));
  border-left: 3px solid var(--accent, #4c8bf5);
  border-radius: 4px;
  padding: 9px 11px;
  margin: 2px 0 4px;
  max-height: none;
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

.qa-hint-line {
  display: inline;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.qa-guidance {
  border: 1px solid #dde3f0;
  border-radius: 10px;
  background: #fbfcff;
  padding: 0;
}
.qa-guidance-summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-size: 13px;
  color: #3451b2;
  font-weight: 700;
  user-select: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.qa-guidance-summary-text {
  flex: 1;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}
.qa-guidance-help {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #5c6ea8;
  border: 1px solid #d4dcf5;
  border-radius: 999px;
  padding: 2px 8px;
  background: #f3f6ff;
  flex-shrink: 0;
}
.qa-guidance-summary::-webkit-details-marker {
  display: none;
}
.qa-guidance-summary::before {
  content: '▸';
  display: inline-block;
  font-size: 16px;
  line-height: 1;
  width: 16px;
  text-align: center;
  transition: transform 0.18s ease;
}
.qa-guidance[open] .qa-guidance-summary::before {
  transform: rotate(90deg);
}
.qa-guidance-body {
  padding: 0 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* ── Formula builder live preview ─────────────────────────────────── */
.fb-preview {
  font-size: 11px;
  border-radius: 4px;
  padding: 4px 8px;
  margin-top: 2px;
  font-family: monospace;
  line-height: 1.5;
  display: none;
}
.fb-preview--ok  { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.fb-preview--warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.fb-preview--err  { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ── Rule library ─────────────────────────────────────────────────── */
.lib-group {
  margin-bottom: 8px;
}

.rule-scene-recommend {
  padding: 12px;
  border: 1px solid #dbe4ff;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfdff, #f8fbff);
}

.rule-scene-recommend-head {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.rule-scene-recommend-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.rule-scene-recommend-desc {
  font-size: 12px;
  line-height: 1.55;
  color: #64748b;
}

.rule-scene-recommend-grid {
  display: grid;
  gap: 8px;
}

.rule-scene-recommend-card {
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.rule-scene-recommend-card.is-smart {
  border-color: #93c5fd;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.rule-scene-recommend-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rule-scene-recommend-line input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.rule-scene-recommend-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  flex: 1;
}

.rule-scene-recommend-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 700;
}

.rule-scene-recommend-actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rule-scene-field-list {
  display: grid;
  gap: 6px;
}

.rule-scene-field-item {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  font-size: 12px;
}

.rule-scene-field-item.is-high {
  border-color: #bfdbfe;
  background: #f8fbff;
}

.rule-scene-field-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.rule-scene-field-name-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.rule-scene-field-name {
  color: #0f172a;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-scene-field-path {
  font-size: 10px;
  color: #94a3b8;
  font-family: monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}

.rule-scene-field-score {
  color: #64748b;
  font-size: 12px;
}

.rule-scene-field-ok {
  color: #16a34a;
  font-size: 12px;
  font-weight: 700;
}

.rule-scene-field-empty {
  font-size: 12px;
  color: #64748b;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f8fafc;
}

.rule-search-section {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff, #fafcff);
}

.rule-search-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.rule-search-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.rule-search-section-meta,
.rule-search-section-desc {
  font-size: 11px;
  color: #64748b;
}

.rule-search-section-desc {
  margin-bottom: 8px;
}

.rule-library-empty {
  padding: 14px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.65;
}

.rule-library-footer {
  padding-top: 4px;
  border-top: 1px solid #e2e8f0;
}

.rule-library-mode-toggle {
  width: 100%;
  justify-content: center;
  min-height: 38px;
  border-radius: 12px;
}
.lib-group-head {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 3px 0;
  margin-bottom: 2px;
}
.lib-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 6px 6px 10px;
  border-radius: 6px;
  gap: 8px;
  transition: background 0.12s;
}
.lib-item:hover {
  background: #f0f5ff;
}
.lib-item-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}
.lib-item-info:hover .lib-item-name { color: var(--color-primary); }
.lib-item-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
}
.lib-item-example {
  font-size: 11.5px;
  font-family: 'SF Mono', 'Consolas', monospace;
  color: #4a6fa5;
  background: rgba(47, 128, 237, 0.07);
  border-radius: 4px;
  padding: 1px 5px;
  margin-top: 3px;
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lib-item-preview-label {
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  margin-right: 1px;
}
.lib-item-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}
.lib-item-actions .btn {
  font-size: 11px;
  padding: 2px 6px;
}

.industry-hub {
  display: grid;
  gap: 10px;
}

.industry-pack-zone {
  border: 1px solid #d7e7f7;
  border-radius: 10px;
  background: linear-gradient(180deg, #f7fbff 0%, #ffffff 100%);
  padding: 10px;
}

.industry-pack-zone-head {
  margin-bottom: 8px;
}

.industry-pack-zone-title {
  font-size: 12px;
  font-weight: 700;
  color: #134a7a;
}

.industry-pack-zone-desc {
  margin-top: 3px;
  font-size: 11px;
  color: #4b647c;
  line-height: 1.45;
}

.industry-pack-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.industry-pack-card {
  border: 1px solid #c8def5;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.industry-pack-card--soon {
  border-style: dashed;
  border-color: #f2cfa5;
  background: linear-gradient(180deg, #fff8ef 0%, #fff 100%);
}

.industry-pack-card--locked {
  border-style: dashed;
  border-color: #d7dce5;
  background: linear-gradient(180deg, #f8f9fc 0%, #ffffff 100%);
}

.industry-pack-card--locked .industry-pack-card-btn {
  background: #eef1f6 !important;
  color: #66758a !important;
  border: 1px solid #d5dce6;
}

.industry-pack-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.industry-pack-card-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #17324d;
}

.industry-pack-card-badge {
  font-size: 10px;
  font-weight: 700;
  color: #9a3412;
  background: #ffedd5;
  border-radius: 999px;
  padding: 2px 7px;
}

.industry-pack-card-desc {
  font-size: 11px;
  line-height: 1.45;
  color: #465d75;
}

.industry-pack-card-example {
  font-size: 11px;
  color: #0f4d8a;
  background: #eef6ff;
  border-radius: 6px;
  padding: 4px 6px;
}

.industry-pack-card-actions {
  display: flex;
  justify-content: flex-start;
}

.industry-pack-card-btn {
  font-size: 11.5px;
  padding: 4px 10px;
}

.industry-capability-fold {
  border: 1px solid #dce3ef;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
}

.industry-capability-fold > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #f8fafd;
}

.industry-capability-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.industry-capability-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  font-size: 14px;
  font-weight: 700;
  color: #42556f;
  border-radius: 999px;
  background: #eaf1fb;
  transform: rotate(-90deg);
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.industry-capability-fold[open] .industry-capability-chevron {
  transform: rotate(0deg);
  color: #25364d;
  background: #dce9fb;
}

.industry-capability-fold > summary::-webkit-details-marker {
  display: none;
}

.industry-capability-title {
  font-size: 12px;
  font-weight: 700;
  color: #35455d;
}

.industry-capability-meta {
  font-size: 10.5px;
  color: #667a93;
  background: #ecf2f9;
  border-radius: 999px;
  padding: 2px 7px;
}

.industry-capability-desc {
  padding: 0 10px 8px;
  font-size: 11px;
  color: #5f7287;
  line-height: 1.45;
}

.industry-capability-list {
  border-top: 1px solid #edf2f8;
  padding: 6px 6px 8px;
}

/* Tooltip that appears when hovering the Current Rules title */
.panel-section-head {
  position: relative; /* ensure tooltip is positioned relative to header */
}
.rule-tooltip {
  display: none;
  position: absolute;
  top: 28px;
  left: 0;
  width: 320px;
  max-width: calc(100% - 12px);
  background: #ffffff;
  border: 1px solid rgba(220,230,244,.95);
  box-shadow: 0 18px 36px rgba(16,33,58,.08);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #334155;
  z-index: 40;
}
.rule-tooltip {
  display: none;
}
#currentRulesTitle:hover + .rule-tooltip,
#currentRulesTitle:focus + .rule-tooltip {
  display: block;
}

.ruleset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 340px;
  overflow: auto;
}

.split-line {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0;
}

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

.audit-head h3 {
  margin: 0;
}

.audit-actions {
  display: flex;
  gap: 6px;
}

.audit-list {
  margin-top: 8px;
  max-height: 320px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.audit-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
}

.audit-item .title {
  font-weight: 600;
  color: #1e3a8a;
}

.ruleset-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: white;
}

.ruleset-item .name {
  font-weight: 600;
}

.ruleset-actions {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-danger {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: #0f1722;
  color: white;
  padding: 10px 14px;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 3000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── 4-step workflow bar ─────────────────────────────────────────── */
.step-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(255,255,255,.84);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  box-shadow: var(--shadow-sm);
}

/* Nested step-bar (when inside unified guidance card) */
.guidance-card-unified .step-bar {
  padding: 0;
  gap: 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  font-size: 11px;
}
.step-bar .step-item {
  display: flex;
  align-items: center;
  gap: 5px;
  opacity: 0.35;
  transition: opacity 0.2s;
}
.step-bar .step-item.done  { opacity: 0.65; }
.step-bar .step-item.active { opacity: 1; }
.step-circle {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #dbe3ee;
  color: #667085;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-item.done  .step-circle { background: #34d399; color: #fff; }
.step-item.active .step-circle { background: var(--color-primary); color: #fff; box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.step-text { color: var(--text-secondary); font-weight: 500; }
.step-item.active .step-text { color: var(--color-primary); font-weight: 700; }
.step-sep { color: #cbd5e1; font-size: 14px; }

/* ── Rule picker tab description ─────────────────────────────────── */
.rule-picker-tab-desc {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: #9aa3b0;
  letter-spacing: 0;
  text-transform: none;
  margin-top: 1px;
}

/* ── Rule Picker popover ── */
.rule-picker-panel {
  position: fixed;
  z-index: 9999;
  background: #fff;
  border: 1px solid #dde1ea;
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.14);
  width: 320px;
  max-height: 480px;
  flex-direction: column;
  overflow: hidden;
  display: none;  /* hidden by default */
}
/* Show when class added - MUST have higher specificity */
.rule-picker-panel.rule-picker-panel--open {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.rule-picker-search {
  padding: 10px 10px 8px;
  border-bottom: 1px solid #eee;
}
.rule-picker-search .input {
  width: 100%;
  box-sizing: border-box;
  font-size: 13px;
}
.rule-picker-list {
  overflow-y: auto;
  flex: 1;
  padding: 4px 0;
}
.rule-picker-tab-head {
  padding: 6px 14px 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: #f6f8fb;
  color: #555;
  border-top: 1px solid #eef0f4;
  text-transform: uppercase;
}
.rule-picker-tab-head:first-child { border-top: none; }

.rule-picker-tab-head--industry {
  background: linear-gradient(90deg, #ecfdf5 0%, #f0f9ff 100%);
  color: #0f5132;
  border-top: 1px solid #d5efe3;
}
.rule-picker-section {
  padding: 3px 14px 1px;
  font-size: 10px;
  color: #aaa;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.rule-picker-item {
  padding: 7px 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rule-picker-item:hover { background: #f0f5ff; }
.picker-name { font-size: 13px; font-weight: 500; color: #1a1a1a; }
.picker-example { font-size: 11px; color: #888; }
.picker-desc { font-size: 10.5px; color: #6b7280; line-height: 1.4; }
.rule-picker-empty { padding: 20px; text-align: center; color: #aaa; font-size: 13px; }

.rule-picker-item--industry {
  border-left: 2px solid #b9e4d0;
  margin: 2px 8px;
  border-radius: 8px;
  background: #fcfffd;
  padding: 8px 10px;
}

.rule-picker-item--industry:hover {
  background: #f1fbf5;
}

.rule-picker-item--coming-soon {
  opacity: 0.8;
  background: #fafafa;
}

.rule-picker-item-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid #ddd;
  background: #fff;
  color: #6b7280;
  font-size: 10px;
  font-weight: 600;
}

@media (min-width: 1600px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 440px;
    gap: 24px;
  }
}

@media (max-width: 1280px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .inspector {
    grid-column: 1 / -1;
    position: static;
    max-height: none;
  }

  .hero-value-grid {
    grid-template-columns: 1fr;
  }

  .walkthrough-body {
    grid-template-columns: 1fr;
  }

  .walkthrough-modal-body {
    grid-template-columns: 1fr;
  }

  .tools-bar {
    grid-template-columns: 1fr;
  }

  .batch-grid,
  .batch-panel-grid {
    grid-template-columns: 1fr;
  }
  
  .batch-top-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .header,
  .workspace-nav,
  .layout {
    padding-left: 14px;
    padding-right: 14px;
  }
  .layout {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .brand {
    width: 100%;
    min-width: 0;
  }
  .brand p {
    white-space: normal;
  }
  .header-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 10px;
  }
  .header-actions > * {
    max-width: 100%;
  }
  .biz-contact-trigger {
    width: 100%;
    justify-content: flex-start;
  }
  .workspace-nav {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    gap: 8px;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .workspace-nav::-webkit-scrollbar {
    display: none;
  }
  .workspace-tab {
    flex: 0 0 auto;
    height: 46px;
    padding: 0 12px;
  }
  .hero-section {
    padding: 18px 18px 14px;
  }
  .walkthrough-section {
    padding: 15px;
  }
  .walkthrough-modal-overlay {
    padding: 14px;
  }
  .walkthrough-modal {
    padding: 18px;
    border-radius: 20px;
  }
  .walkthrough-title {
    font-size: 20px;
  }
  .walkthrough-stage-wrap {
    flex-direction: column;
    align-items: flex-start;
  }
  .walkthrough-screen {
    min-height: 320px;
  }
  .walkthrough-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hero-h2 {
    font-size: 20px;
  }
  .hero-left,
  .hero-right {
    max-width: 100%;
  }
  .hero-proof-list,
  .hero-value-grid {
    grid-template-columns: 1fr;
  }
  .hero-flow-diagram {
    flex-direction: column;
  }
  .hero-flow-arrow {
    transform: rotate(90deg);
  }
  .worksection-head,
  .table-head,
  .guidance-card,
  .tools-bar {
    flex-direction: column;
  }
  .table-head,
  .table-head-main,
  .view-tools,
  .rules-preview,
  .inspector {
    min-width: 0;
  }
  .status-badge {
    align-self: flex-start;
  }
  .table-head-actions {
    width: 100%;
  }
  .rule-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .rule-tabs::-webkit-scrollbar {
    display: none;
  }
  .rule-tab {
    flex: 0 0 auto;
  }
  .rule-tabs-shell {
    gap: 4px;
  }
  .rule-tabs-scroll {
    width: 24px;
    height: 24px;
  }
  .rule-tabs-fade--left {
    left: 29px;
  }
  .rule-tabs-fade--right {
    right: 29px;
  }
  
  .walkthrough-controls {
    align-items: stretch;
  }
  .walkthrough-top,
  .walkthrough-top-actions {
    flex-direction: column;
    align-items: flex-start;
  }
  .walkthrough-modal-head {
    flex-direction: column;
  }
  .walkthrough-step-title {
    font-size: 18px;
  }
  .walkthrough-step-desc {
    max-width: 100%;
  }
  .batch-dropzone-actions,
  .batch-card-head,
  .batch-diagram-head,
  .batch-item-top,
  .batch-progress-meta {
    flex-direction: column;
    align-items: flex-start;
  }
  .batch-dropzone,
  .batch-diagram-card,
  .batch-card,
  .tools,
  .tools-stage {
    padding: 16px;
  }
  .batch-empty {
    min-height: 120px;
  }
  .tools-stage-head {
    flex-direction: column;
    gap: 8px;
  }
  .section-inline-tips {
    width: 100%;
    justify-content: flex-start;
  }
  .tools-rule-actions {
    width: 100%;
  }
  .guidance-cta,
  .walkthrough-toggle,
  .tools-rule-actions .btn,
  .walkthrough-import-btn,
  .walkthrough-expand-btn {
    width: 100%;
    justify-content: center;
  }
  .tools .row,
  .view-tools,
  .taskflow-export-row {
    flex-wrap: wrap;
  }
  .taskflow-export-actions,
  .taskflow-export-format {
    width: 100%;
  }
  .taskflow-export-btn {
    margin-left: 0;
  }
  .step-sep {
    display: none;
  }
  .step-bar {
    flex-wrap: wrap;
  }
  .fze-top {
    flex-direction: column;
    align-items: flex-start;
  }
}


@media (max-width: 1180px) {
  .hero-left,
  .hero-right {
    max-width: 100%;
  }

  .hero-proof-list {
    grid-template-columns: 1fr;
  }
}

/* ===== Mask / Rule Drawer ===== */
#phoneMaskDrawer {
  position: fixed;
  right: 12px;
  top: 12px;
  bottom: 12px;
  width: 440px;
  max-width: min(440px, calc(100vw - 24px));
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(15, 23, 34, 0.14);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}
#phoneMaskDrawer.open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-head strong {
  font-size: 15px;
  color: var(--text);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#phoneMaskDrawer .drawer-body,
#ruleQABody {
  padding-bottom: 112px;
}

/* Each label+input block */
.field-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field-row > label,
.field-row > .field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.2px;
}
.field-row .input,
.field-row .select {
  width: 100%;
  min-width: 0;
}
.hash-salt-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hash-salt-input-wrap .input {
  flex: 1;
}
.hash-salt-generate-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding-left: 12px;
  padding-right: 12px;
}
.field-hint {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.55;
}

/* Radio group inside field-row */
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text, #1f2937);
}
.radio-label input[type="radio"] {
  margin: 0;
  accent-color: var(--primary, #6366f1);
}

/* Two-column pair */
.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Checkbox with label on the right */
.check-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.check-row input[type=checkbox] {
  width: 14px;
  height: 14px;
  margin: 0;
  cursor: pointer;
}

/* Subtle card for parameter groups (Hash / Amount) */
.drawer-section {
  background: #f4f7ff;
  border: 1px solid #dce7ff;
  border-radius: 8px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.drawer-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7eb8;
  margin-bottom: -4px;
}

@media (max-width: 768px) {
  body {
    font-size: 14px;
  }
  .header {
    padding-top: 10px;
    padding-bottom: 10px;
  }
  .biz-contact-trigger {
    display: none;
  }
  .header-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }
  .header-actions > .btn,
  .header-actions > a.btn {
    width: 100%;
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
    font-size: 13px;
  }
  #accountPanel {
    grid-column: 1 / -1;
    width: 100%;
    gap: 8px;
  }
  #accountPanel > .btn,
  #accountPanel > .acct-phone,
  #accountPanel > #exportQuotaBadge {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    justify-content: center;
  }
  .acct-phone {
    min-height: 38px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    justify-content: center;
  }
  .brand {
    gap: 10px;
  }
  .logo {
    width: 36px;
    height: 36px;
  }
  .brand h1 {
    font-size: 17px;
  }
  .brand p {
    font-size: 12px;
  }
  .layout {
    gap: 14px;
  }
  .workspace-nav {
    padding-left: 14px;
    padding-right: 14px;
    min-height: 48px;
    gap: 6px;
  }
  .workspace-tab {
    height: 42px;
    padding: 0 11px;
    border-radius: 999px;
    border-bottom: none;
    background: #f8fafc;
    border: 1px solid var(--border-light);
    font-size: 12px;
  }
  .workspace-tab.active {
    background: #eff6ff;
    border-color: #bfdbfe;
  }
  .biz-contact-trigger {
    grid-column: 1 / -1;
    min-height: 46px;
    height: 46px;
    padding: 0 14px 0 12px;
    border-radius: 16px;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
  }
  .biz-contact-emblem {
    width: 22px;
    height: 22px;
  }
  .biz-contact-copy {
    gap: 4px;
  }
  .biz-contact-eyebrow,
  .biz-contact-label {
    font-size: 12px;
  }
  .table-wrap {
    min-height: 300px;
    padding-top: 14px;
  }
  .table-head h2 {
    font-size: 18px;
  }
  .table-desc {
    font-size: 13px;
  }
  .view-group,
  .status-badge {
    width: 100%;
    justify-content: flex-start;
  }
  .view-group {
    padding: 8px;
    gap: 6px;
    align-items: stretch;
  }
  .view-group .select,
  .view-group .input,
  .view-tools > .select,
  #applyViewBtn {
    width: 100%;
    max-width: 100%;
  }
  .view-divider {
    display: none;
  }
  .inspector {
    padding: 14px;
  }
  .panel-section-head {
    gap: 10px;
  }
  .rule-actions {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .rule-actions > * {
    flex: 1 1 calc(33.333% - 6px);
    justify-content: center;
  }
  .taskflow-rules-actions-row {
    flex-wrap: wrap;
    gap: 6px;
  }
  .taskflow-rules-actions-row .taskflow-rules-action-btn {
    flex: 1 1 calc(50% - 6px);
  }
  .taskflow-rules-actions-row .btn-danger.taskflow-rules-action-btn {
    flex-basis: 100%;
  }
  .lib-group-head {
    font-size: 10px;
    letter-spacing: 0.08em;
  }
  .lib-item {
    padding: 10px 4px 10px 8px;
    gap: 10px;
    align-items: flex-start;
  }
  .lib-item-name {
    font-size: 13px;
    line-height: 1.3;
  }
  .lib-item-example {
    font-size: 11px;
    margin-top: 5px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.45;
  }
  .lib-item-actions .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 12px;
    justify-content: center;
  }
  .panel-section {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }
  .drawer,
  #phoneMaskDrawer {
    width: 100vw;
    max-width: 100vw;
    right: 0;
    top: 0;
    bottom: 0;
    border-radius: 0;
  }
  .drawer-head,
  .drawer-body,
  .drawer-foot {
    padding-left: 14px;
    padding-right: 14px;
  }
  .field-pair {
    grid-template-columns: 1fr;
  }
  .hash-salt-input-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .hash-salt-generate-btn {
    width: 100%;
  }
}

/* Footer: 3-button layout — 2 equal cols on row 1, full-width primary on row 2 */
.drawer-foot {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92) 0%, rgba(255, 255, 255, 0.98) 100%);
  position: sticky;
  bottom: 0;
  z-index: 3;
  box-shadow: 0 -10px 28px rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(10px);
  flex-shrink: 0;
}
.drawer-foot--actions {
  grid-template-columns: 1fr;
  align-items: stretch;
  position: sticky;
  bottom: 12px;
  margin: auto 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px;
  padding: 10px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 252, 0.98) 100%);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}
.drawer-foot--compact {
  gap: 8px;
}
.drawer-foot .btn {
  width: 100%;
  min-height: 44px;
  font-size: 13px;
}
.drawer-action-secondary {
  min-width: 0;
  border-radius: 14px;
  font-weight: 700;
  background: rgba(248, 250, 252, 0.94);
  color: #334155;
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 18px rgba(148, 163, 184, 0.18);
}
.drawer-action-secondary:hover,
.drawer-action-secondary:focus-visible {
  background: #ffffff;
  border-color: rgba(59, 130, 246, 0.28);
  color: #1e3a8a;
}
#drawerAddRule {
  grid-column: 1 / -1;
  min-height: 52px;
  font-weight: 800;
  font-size: 15px;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 48%, #0ea5e9 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.drawer-action-primary,
#ruleQAConfirm {
  min-height: 52px;
  border-radius: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 48%, #0ea5e9 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.drawer-action-primary:hover,
.drawer-action-primary:focus-visible,
#ruleQAConfirm:hover,
#ruleQAConfirm:focus-visible {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 48%, #0284c7 100%);
  box-shadow: 0 18px 36px rgba(29, 78, 216, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

#ruleQASavePreset {
  border-radius: 14px;
}

@media (max-height: 860px) {
  #phoneMaskDrawer {
    top: 8px;
    bottom: 8px;
    right: 8px;
    max-width: min(440px, calc(100vw - 16px));
  }
  .drawer-head {
    height: 50px;
    padding-left: 16px;
    padding-right: 16px;
  }
  .drawer-body {
    padding: 14px 16px;
    gap: 10px;
  }
  .drawer-section {
    padding: 12px;
    gap: 10px;
  }
  .field-row {
    gap: 4px;
  }
  .drawer-foot,
  .drawer-foot--compact {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .drawer-foot--actions {
    bottom: 8px;
    margin-left: 8px;
    margin-right: 8px;
    margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
    border-radius: 18px;
  }
  #phoneMaskDrawer .drawer-body,
  #ruleQABody {
    padding-bottom: 92px;
  }
  .drawer-foot .btn,
  .drawer-action-secondary,
  .drawer-action-primary,
  #drawerAddRule,
  #ruleQAConfirm,
  #ruleQASavePreset {
    min-height: 42px;
    font-size: 13px;
  }
}

@media (max-height: 620px) {
  .drawer-head {
    height: 46px;
  }
  .drawer-head strong {
    font-size: 14px;
  }
  .drawer-body {
    padding-top: 12px;
    padding-bottom: 12px;
    gap: 8px;
  }
  .field-row > label,
  .field-row > .field-label,
  .field-hint {
    font-size: 10.5px;
  }
  .drawer-foot--actions {
    padding: 7px;
  }
  #phoneMaskDrawer .drawer-body,
  #ruleQABody {
    padding-bottom: 84px;
  }
}

#drawerAddRule:hover,
#drawerAddRule:focus-visible {
  background: linear-gradient(135deg, #1e40af 0%, #1d4ed8 48%, #0284c7 100%);
  box-shadow: 0 18px 36px rgba(29, 78, 216, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

/* (lib-item styles consolidated above) */
/* ===== Inline field-picker dropdown (drawer + QA panel) ===== */
.field-picker-wrap {
  position: relative;
  width: 100%;
}
.field-picker-wrap .input {
  width: 100%;
  padding-right: 28px; /* room for caret indicator */
}
.field-picker-dropdown {
  position: absolute;
  left: 0; right: 0;
  top: calc(100% + 4px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.13);
  z-index: 2000;
  max-height: 260px;
  overflow-y: auto;
  font-size: 13px;
}
.fp-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s;
}
.fp-item:last-child { border-bottom: none; }
.fp-item:hover { background: var(--surface-soft); }
.fp-item.fp-active { background: var(--accent-light, #e8f0fe); }
.fp-key { font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-path { font-size: 11px; color: #888; flex: 1.4; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.fp-sample { font-size: 11px; color: #aaa; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Formula builder (compute QA panel) ===== */
.fb-chip-bar { min-height: 24px; }
.fb-chip {
  background: var(--surface-soft, rgba(80,80,80,.08));
  border: 1px solid var(--border, #ddd);
  border-radius: 12px;
  padding: 2px 9px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text);
  line-height: 1.6;
  transition: background 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.fb-chip:hover { background: var(--accent-light, #e8f0fe); border-color: var(--color-primary, #4a90d9); }
.fb-textarea { font-family: monospace !important; font-size: 12px !important; width: 100%; resize: vertical; }
/* Python UDF code editor */
.udf-code-editor {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', 'Menlo', monospace !important;
  font-size: 12.5px !important;
  line-height: 1.6 !important;
  background: #1e1e2e;
  color: #cdd6f4;
  border: 1px solid #45475a;
  border-radius: 6px;
  padding: 10px 12px !important;
  resize: vertical;
  tab-size: 4;
  caret-color: #89b4fa;
}
.udf-code-editor:focus {
  border-color: #89b4fa;
  outline: none;
  box-shadow: 0 0 0 2px rgba(137,180,250,.25);
}
.udf-code-hint { font-size: 11px; color: #64748b; margin-top: 2px; }
/* UDF preview — mirrors .fb-preview states */
.udf-preview {
  font-size: 12px;
  border-radius: 5px;
  padding: 6px 10px;
  margin-top: 2px;
  word-break: break-all;
  white-space: pre-wrap;
  font-family: monospace;
}
.udf-preview--loading { background: #f1f5f9; color: #64748b; }
.udf-preview--ok  { background: #f0fdf4; color: #166534; border-left: 3px solid #22c55e; }
.udf-preview--warn{ background: #fffbeb; color: #92400e; border-left: 3px solid #f59e0b; }
.udf-preview--err { background: #fef2f2; color: #991b1b; border-left: 3px solid #ef4444; }
.fb-ops { margin-top: 2px; }
.fb-ops .fb-op {
  font-family: monospace;
  font-size: 12px;
  min-width: 28px;
  padding: 2px 6px;
}
.fp-empty { padding: 10px 12px; color: #aaa; font-size: 12px; }

/* ===== Taglist (multi-key dedupe widget) ===== */
.taglist-field { align-items: flex-start !important; }
.taglist-wrap  { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.taglist-tags  { display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.tag-item      { display: inline-flex; align-items: center; gap: 3px; background: #e9eeff; border: 1px solid #c7d2fe; border-radius: 12px; padding: 1px 6px 1px 9px; font-size: 12px; color: #3451b2; max-width: 260px; }
.tag-label     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-remove    { background: none; border: none; cursor: pointer; color: #9aa; font-size: 15px; line-height: 1; padding: 0 1px; flex-shrink: 0; }
.tag-remove:hover { color: #e53e3e; }
.taglist-empty { color: #bbb; font-size: 12px; font-style: italic; line-height: 22px; }
.taglist-add-row { display: flex; align-items: center; gap: 4px; }
.taglist-hint  { font-size: 11px; color: #bbb; line-height: 1.4; }

/* ===== Reference file section in compute formula builder ===== */
.fb-ref-section { width:100%; border-top:1px solid var(--border,#ddd); padding-top:6px; margin-top:6px; }
.fb-ref-header { display:flex; align-items:center; gap:6px; margin-bottom:4px; }
.fb-ref-header span { font-size:11px; color:#888; flex:1; }
.fb-ref-header .fb-add-ref { font-size:11px; padding:2px 7px; white-space:nowrap; }
.fb-ref-row { display:flex; align-items:center; gap:4px; margin-bottom:3px; flex-wrap:nowrap; overflow:hidden; }
.fb-ref-badge { background:var(--color-primary,#4a90d9); color:#fff; border-radius:3px; padding:1px 5px; font-size:11px; font-weight:600; flex-shrink:0; }
.fb-ref-fname { font-size:11px; flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#555; }
.fb-ref-eq { font-size:12px; color:#888; flex-shrink:0; padding:0 2px; }
.fb-ref-joinmain, .fb-ref-joinref { font-size:11px !important; max-width:90px; min-width:60px; }
.fb-ref-del { font-size:11px; padding:1px 5px; color:#c00; background:transparent; border:none; cursor:pointer; flex-shrink:0; }
.fb-ref-del:hover { text-decoration:underline; }

/* ===== Aggregate multi-target builder ===== */
.agg-targets-section { width:100%; }
.agg-target-list { width:100%; }
.agg-target-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding:6px 0; border-top:1px solid #f0f0f0; }
.agg-target-row .input, .agg-target-row .select { font-size:12px; }
.agg-add-target {
  font-size:12px;
  padding:2px 8px;
  margin-top:4px;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: left;
  height: auto;
  min-height: 28px;
}

/* ── Workspace navigation tabs ─────────────────────────────────────────── */
.workspace-nav {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(209, 215, 228, 0.8);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 46px;
  backdrop-filter: blur(16px);
  position: sticky;
  top: 60px;
  z-index: 40;
}

.workspace-tab {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  padding: 0 13px;
  height: 46px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: color var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
  border-radius: 6px 6px 0 0;
  letter-spacing: -0.01em;
}

.workspace-tab:hover {
  color: var(--text-primary);
  background: rgba(79, 70, 229, 0.04);
}

.workspace-tab.active {
  color: var(--color-primary);
  font-weight: 600;
  border-bottom-color: var(--color-primary);
  background: rgba(79, 70, 229, 0.04);
}

.wtab-icon {
  font-size: 13px;
}

/* ── Batch processing ───────────────────────────────────────────────────── */
.batch-shell {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── Batch header row ── */
.batch-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.batch-header-main {
  flex: 1 1 0;
  min-width: 0;
}

.batch-header-main .section-kicker {
  margin-bottom: 2px;
}

.batch-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: #0f172a;
  line-height: 1.3;
}

.batch-header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding-top: 2px;
}

.batch-help-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  font-size: 12.5px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
  line-height: 1;
  white-space: nowrap;
  flex-shrink: 0;
}

.batch-help-toggle:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.batch-help-toggle[aria-expanded="true"] {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* ── Batch help panel ── */
.batch-help-panel {
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  overflow: hidden;
  animation: batchHelpSlideIn .18s ease-out;
}

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

.batch-help-inner {
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.batch-help-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.batch-help-section + .batch-help-section {
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.batch-help-section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  letter-spacing: .02em;
}

.batch-help-text {
  margin: 0;
  font-size: 13px;
  color: #475569;
  line-height: 1.65;
}

.batch-help-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 1px 5px;
  background: #e2e8f0;
  border-radius: 4px;
  color: #334155;
}

.batch-help-panel .batch-dropzone-visual {
  margin-top: 4px;
}

/* ── Simplified step label inside card head ── */
.batch-card-step {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0f766e;
}

.batch-grid {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(340px, 1.08fr);
  gap: 16px;
}

/* Batch layout: top row with 2 cards, bottom row with 1 full-width card */
.batch-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.batch-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.batch-card {
  border: 1px solid #d5e1ea;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfefd 100%);
  padding: 24px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
}

.batch-import-card {
  background: linear-gradient(180deg, #fbfffd 0%, #f4faf8 100%);
}

.batch-pairs-card {
  display: flex;
  flex-direction: column;
}

.batch-progress-card {
  width: 100%;
}

.batch-dropzone-kicker,
.batch-diagram-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #0f766e;
}

.batch-card-title {
  margin: 0 0 16px;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -.02em;
  font-weight: 700;
  color: #0f172a;
}
  color: var(--text);
}

.batch-dropzone-desc {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.batch-dropzone-visual {
  margin-top: 14px;
  max-width: 420px;
  border: 1px solid #d8e7e0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px 14px;
}

.batch-visual-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.batch-visual-row:last-of-type {
  margin-bottom: 0;
}

.batch-visual-stack {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.batch-visual-divider {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  padding: 4px 12px;
  background: #f1f5f9;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
}

.batch-visual-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.batch-visual-chip.folder {
  color: #155e75;
  background: #ecfeff;
  border-color: #bae6fd;
}

.batch-visual-chip.data {
  color: #1d4ed8;
  background: #eff6ff;
  border-color: #bfdbfe;
}

.batch-visual-chip.rule {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.batch-visual-chip.ref {
  color: #9333ea;
  background: #faf5ff;
  border-color: #e9d5ff;
}

.batch-visual-arrow {
  margin-top: 10px;
  font-size: 12px;
  color: #4b5563;
}

.batch-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

/* ── Batch settings block (output dir + large-file policy) ─────────────────── */
.batch-settings-block {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #c9e5da;
  background: linear-gradient(160deg, #f4fbf8 0%, #edf7f3 100%);
}

.batch-setting-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #0f172a;
}

.batch-setting-row + .batch-setting-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #d7eee6;
}

.batch-setting-row--threshold {
  align-items: center;
  flex-wrap: wrap;
}

.batch-setting-label {
  flex-shrink: 0;
  min-width: 64px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #0f766e;
}

.batch-output-dir-display {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 12.5px;
  color: #334155;
  background: #fff;
  border: 1px solid #c7d8d0;
  border-radius: 8px;
  padding: 4px 10px;
  min-height: 30px;
  line-height: 22px;
}

.batch-threshold-input {
  width: 92px;
  min-width: 92px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid #c7d8d0;
  background: #fff;
  color: #0f172a;
  font-size: 13px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.03);
}

.batch-setting-inline-note {
  font-size: 12px;
  color: #51606f;
  line-height: 1.5;
}

.batch-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #374151;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}

.batch-radio-label:hover {
  background: rgba(15, 118, 110, .07);
  border-color: #a7d7cf;
}

.batch-radio-label input[type="radio"] {
  accent-color: #0f766e;
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.batch-setting-row--policy {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

/* Compact inline settings rows for the scheduled panel */
.sched-settings-inline-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #0f172a;
  flex-wrap: wrap;
}

.sched-settings-inline-row + .sched-settings-inline-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #d7eee6;
}

.sched-settings-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: #0f766e;
  min-width: 0;
}

.sched-settings-label small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #64748b;
  font-size: 10.5px;
}

.sched-settings-note {
  font-size: 11.5px;
  color: #51606f;
}

.sched-inline-input {
  width: 72px;
  min-width: 72px;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid #c7d8d0;
  background: #fff;
  color: #0f172a;
  font-size: 12.5px;
}

.sched-inline-input--xs {
  width: 58px;
  min-width: 58px;
}

.sched-inline-radio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: #374151;
  cursor: pointer;
  padding: 3px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}

.sched-inline-radio:hover {
  background: rgba(15, 118, 110, .07);
  border-color: #a7d7cf;
}

.sched-inline-radio input[type="radio"] {
  accent-color: #0f766e;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  cursor: pointer;
}

.batch-dropzone-actions,
.batch-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Workbench: hint shown when an Excel file is loaded */
.workbench-xlsx-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  font-size: 12.5px;
  color: #166534;
  margin-top: 10px;
  line-height: 1.55;
}
.workbench-xlsx-hint .wbh-icon { flex-shrink:0; margin-top:1px; }
.workbench-xlsx-hint .wbh-info { flex:1; }
.workbench-xlsx-hint label { display:flex; align-items:center; gap:6px; margin-top:5px; cursor:pointer; color:#0f172a; font-size:12px; }
.workbench-xlsx-hint input[type="number"] { width:72px; padding:2px 6px; border:1px solid #86efac; border-radius:6px; font-size:12px; color:#166534; background:#fff; }

.batch-dropzone-actions {
  margin-top: 16px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid #c9e5da;
  background: linear-gradient(160deg, #f4fbf8 0%, #edf7f3 100%);
}

.batch-dropzone-actions .btn {
  min-height: 34px;
}

.batch-output-config {
  margin-top: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.batch-output-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  min-width: 60px;
}

.batch-output-config .input {
  flex: 1;
  min-width: 220px;
}

.batch-output-note {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
  line-height: 1.6;
}

.batch-selection-summary {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.82);
  border: 1px solid #d8e7e0;
  color: var(--text-secondary);
  font-size: 12.5px;
  line-height: 1.6;
}

.batch-diagram-card {
  background:
    radial-gradient(circle at top left, rgba(14, 165, 233, .1), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #f4fafc 100%);
}

.batch-diagram-head {
  margin-bottom: 12px;
}

.batch-diagram-title-btn {
  margin-top: 6px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: #102a43;
  cursor: pointer;
}

.batch-diagram-title-btn:hover {
  color: #0f766e;
}

.batch-diagram-hint {
  font-size: 12px;
  color: #667085;
}

.batch-diagram-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.batch-diagram-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 16px;
  border: 1px solid #d6e4ea;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.batch-panel-grid {
  display: grid;
  /* match the column widths used by .batch-grid so left/right edges align */
  grid-template-columns: minmax(0, .92fr) minmax(340px, 1.08fr);
  gap: 16px;
}

.batch-issue-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #475467;
  background: #f5f7fb;
  border: 1px solid #dde4ee;
}

.batch-pair-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 200px;
  overflow-y: auto;
}

.batch-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 120px;
}

.batch-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  border: 1px dashed #d7e0ea;
  border-radius: 12px;
  background: #fbfdff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 16px;
}

/* ── Background-execution warning banner ──────────────────────────────────── */
.bg-exec-warning {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-left: 4px solid #f59e0b;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.6;
  color: #78350f;
}
.bg-exec-warning-icon {
  flex-shrink: 0;
  font-size: 16px;
  margin-top: 1px;
}

.batch-pair-item,
.batch-result-item {
  border: 1px solid #e4ebf5;
  border-radius: 12px;
  padding: 12px 14px;
  background: #fbfdff;
}

.batch-pair-item.warn,
.batch-result-item.failed {
  border-color: #fecaca;
  background: #fff7f7;
}

.batch-result-item.success {
  border-color: #bfdbfe;
  background: #f7fbff;
}

.batch-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.batch-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  word-break: break-word;
}

.batch-item-meta,
.batch-item-sub,
.batch-item-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.batch-item-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.batch-item-status.success {
  color: #166534;
  background: #dcfce7;
}

.batch-item-status.failed,
.batch-item-status.warn {
  color: #b42318;
  background: #fee4e2;
}

.batch-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  background: #f5fbf9;
  border: 1px solid #d7e6df;
}

.batch-progress-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: #deebe6;
  overflow: hidden;
}

.batch-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f766e 0%, #0891b2 100%);
  transition: width .22s ease;
}

.batch-progress-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.batch-current-file {
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.batch-actions-row {
  margin-top: 14px;
  justify-content: flex-start;
}

/* Keep important batch actions (run button) visible when scrolling the panel */
.batch-progress-card .batch-actions-row {
  position: sticky;
  bottom: 18px;
  z-index: 30;
  background: linear-gradient(180deg, rgba(255,255,255,0.0) 0%, rgba(255,255,255,0.95) 90%);
  padding-top: 8px;
}

.batch-diagram-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2200;
  padding: 28px;
  background: rgba(10, 17, 30, 0.62);
  backdrop-filter: blur(8px);
}

.batch-diagram-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.batch-diagram-lightbox {
  width: min(1080px, 100%);
  max-height: calc(100vh - 56px);
  border-radius: 24px;
  background: linear-gradient(180deg, #fcfffe 0%, #f4faf8 100%);
  border: 1px solid rgba(214, 228, 234, 0.95);
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  overflow: hidden;
}

.batch-diagram-lightbox-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
}

.batch-diagram-lightbox-title {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -.02em;
  color: #102a43;
}

.batch-diagram-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid #d4dde5;
  background: rgba(255, 255, 255, 0.92);
  color: #344054;
  font-size: 20px;
  cursor: pointer;
}

.batch-diagram-close:hover {
  background: #ffffff;
  color: #0f766e;
}

.batch-diagram-lightbox-body {
  padding: 0 20px 20px;
}

.batch-diagram-lightbox-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 20px;
  border: 1px solid #d6e4ea;
  background: #ffffff;
}

.batch-diagram-open {
  overflow: hidden;
}

.sched-job-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.sched-job-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: var(--shadow-sm);
}

.sched-job-card.disabled {
  opacity: .62;
}

.sched-job-info {
  min-width: 0;
  flex: 1;
}

.sched-job-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sched-job-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.sched-job-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.sched-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-content: flex-start;
  justify-content: flex-end;
}

.sched-job-card.running {
  flex-direction: column;
  background: linear-gradient(180deg, #fafbfc 0%, #f5f7fb 100%);
  border-color: #3b82f6;
}

.sched-job-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-progress-bar {
  height: 6px;
  background: #e5e7eb;
  border-radius: 3px;
  overflow: hidden;
}

.sched-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  width: 0%;
  transition: width 0.3s ease;
}

.sched-progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.sched-progress-text {
  font-weight: 500;
  color: var(--text);
}

.sched-progress-duration {
  font-weight: 600;
  color: #3b82f6;
}

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

.sched-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}

.sched-history-head {
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sched-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-history-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.sched-history-item.is-success {
  border-color: #b7ebc6;
}

.sched-history-item.is-failed {
  border-color: #f2c2c2;
}

.sched-history-title {
  font-size: 13px;
  font-weight: 600;
}

.sched-history-meta,
.sched-history-count {
  color: var(--muted);
  font-size: 12px;
}

.sched-paywall {
  padding: 22px;
  border: 1px dashed #9bb8ff;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(21,94,239,.06), rgba(14,165,233,.08));
}

.sched-paywall-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.sched-paywall-desc {
  margin: 8px 0 14px;
  color: var(--text-secondary);
}

.sched-editor-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2300;
  padding: 28px;
  background: rgba(10, 17, 30, 0.62);
  backdrop-filter: blur(8px);
}

.sched-editor-overlay.open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sched-editor-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 56px);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(214, 228, 234, 0.95);
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  box-shadow: var(--shadow-md);
}

.sched-editor-head,
.sched-editor-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
}

.sched-editor-head h3 {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -.02em;
}

.sched-editor-body {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sched-editor-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sched-editor-field > span {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
}

.sched-editor-field input[type="text"] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.sched-dir-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.sched-dir-name {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.sched-editor-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sched-editor-row {
  display: grid;
  grid-template-columns: 120px 120px 1fr auto;
  gap: 8px;
  align-items: center;
}

.sched-editor-row select,
.sched-editor-row input[type="time"] {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.sched-radio,
.sched-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

@media (max-width: 760px) {
  .rule-scene-grid {
    grid-template-columns: 1fr;
  }

  .sched-job-card {
    flex-direction: column;
  }

  .sched-job-actions {
    justify-content: flex-start;
  }

  .sched-editor-row {
    grid-template-columns: 1fr;
  }

  .sched-editor-overlay {
    padding: 12px;
  }
}

/* ── Hero section (Whole-picture) ────────────────────────────────────────── */
.hero-section {
  background:
    radial-gradient(circle at top left, rgba(22,119,255,.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(14,165,233,.14), transparent 26%),
    linear-gradient(135deg, #f8fbff 0%, #eef4fb 54%, #f4f8ff 100%);
  border: 1px solid #cbdcf5;
  border-radius: var(--radius);
  padding: 22px 22px 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(16,33,58,.08);
}

.hero-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}

.hero-left {
  flex: 1 1 420px;
  min-width: 280px;
  max-width: 44%;
}

.hero-right {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1 1 520px;
  min-width: 300px;
  max-width: 56%;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(21,94,239,.08);
  border: 1px solid rgba(21,94,239,.12);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #155eef;
  margin-bottom: 12px;
}

.hero-h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  color: #10213a;
  font-weight: 800;
  letter-spacing: -.04em;
  max-width: 720px;
}

.hero-summary {
  margin: 14px 0 0;
  max-width: 720px;
  font-size: 15px;
  line-height: 1.75;
  color: #5d708a;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.hero-tag {
  background: rgba(255,255,255,.88);
  color: #155eef;
  border: 1px solid rgba(21,94,239,.2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(21,94,239,.08);
}

.hero-proof-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.hero-proof-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(21,94,239,.1);
  box-shadow: 0 4px 12px rgba(21,94,239,.05);
}

.hero-proof-title {
  font-size: 12px;
  font-weight: 700;
  color: #10213a;
}

.hero-proof-desc {
  font-size: 12px;
  line-height: 1.65;
  color: #6b7a8e;
}

.hero-assurance {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(240,248,255,.85) 0%, rgba(230,244,255,.88) 100%);
  box-shadow: 0 8px 16px rgba(16,33,58,.06);
}

.hero-assurance-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(21,94,239,.08);
  color: #155eef;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hero-assurance-text {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.75;
  color: #6b7a8e;
}

.hero-value-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.hero-value-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 15px;
  border-radius: 14px;
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(201,218,252,.95);
  box-shadow: 0 10px 24px rgba(16,33,58,.05);
}

.hero-value-title {
  font-size: 12px;
  font-weight: 700;
  color: #10213a;
}

.hero-value-desc {
  font-size: 12px;
  color: #6b7a8e;
  line-height: 1.7;
}

.hero-flow {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(240,248,255,.88) 0%, rgba(232,246,255,.9) 55%, rgba(220,242,255,.88) 100%);
  border: 1px solid rgba(21,94,239,.15);
  box-shadow: 0 8px 16px rgba(16,33,58,.06);
}

.hero-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-flow-kicker {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #8b96a8;
}

.hero-flow-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(21,94,239,.08);
  border: 1px solid rgba(21,94,239,.15);
  color: #155eef;
  font-size: 12px;
  font-weight: 600;
}

.hero-flow-diagram {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.hero-flow-item {
  flex: 1;
  min-width: 0;
  padding: 14px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(21,94,239,.1);
  box-shadow: inset 0 1px 0 rgba(21,94,239,.05);
}

.hero-flow-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 10px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background: rgba(21,94,239,.08);
  border: 1px solid rgba(21,94,239,.12);
}

.hero-flow-label {
  font-size: 13px;
  font-weight: 700;
  color: #10213a;
}

.hero-flow-sub {
  font-size: 12px;
  color: #6b7a8e;
  margin-top: 6px;
  line-height: 1.65;
}

.hero-flow-arrow {
  font-size: 20px;
  color: #a5b8d0;
  font-weight: 300;
  align-self: center;
  flex-shrink: 0;
}

.hero-flow-note {
  font-size: 12px;
  line-height: 1.7;
  color: #6b7a8e;
  padding: 12px 13px;
  border-radius: 14px;
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(21,94,239,.1);
}

.hero-collapse-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  transform: none;
  background: rgba(255,255,255,.8);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 999px;
}

.hero-collapse-btn:hover {
  color: var(--color-primary);
  background: rgba(255,255,255,.98);
}

/* when expanded (button shows “展开说明 ▼”), center vertically */
.hero-collapse-btn.centered {
  top: 50%;
  transform: translateY(-50%);
}

/* ── Onboarding walkthrough ──────────────────────────────────────────────── */
.walkthrough-section {
  padding: 16px 18px;
  background:
    radial-gradient(circle at top left, rgba(14,165,233,.1), transparent 26%),
    linear-gradient(135deg, #fbfdff 0%, #f6faff 55%, #f1f7ff 100%);
  border: 1px solid #dbe7f6;
  box-shadow: 0 10px 30px rgba(15,23,42,.04);
  font-family: 'SF Pro Display', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.walkthrough-shell {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.walkthrough-top-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.walkthrough-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2563eb;
}

.walkthrough-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -.04em;
  color: #0f172a;
}

.walkthrough-summary {
  margin: 0;
  max-width: 760px;
  font-size: 13px;
  line-height: 1.7;
  color: #64748b;
}

.walkthrough-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.walkthrough-meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.78);
  border: 1px solid #d5e2f4;
  font-size: 11px;
  font-weight: 600;
  color: #355070;
}

.walkthrough-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.walkthrough-import-btn {
  min-width: 92px;
}

.walkthrough-expand-btn {
  .walkthrough-inline-btn {
    width: 100%;
  }
  border: 1px solid #c8d7eb;
  background: #fff;
  color: #0f172a;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}

.walkthrough-expand-btn:hover {
  border-color: #93c5fd;
  background: #eff6ff;
  color: #1d4ed8;
}

.walkthrough-body {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(420px, 1.22fr);
  gap: 18px;
  align-items: stretch;
}

.walkthrough-section.is-collapsed .walkthrough-body {
  display: none;
}

.walkthrough-copy {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.walkthrough-copy-intro {
  font-size: 13px;
  line-height: 1.7;
  color: #475467;
}

.walkthrough-points {
  display: grid;
  gap: 10px;
}

.walkthrough-point {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(214,227,244,.95);
}

.walkthrough-point-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.walkthrough-point-desc {
  font-size: 12px;
  color: #64748b;
  line-height: 1.65;
}

.walkthrough-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
}

.walkthrough-demo {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.walkthrough-stage-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.walkthrough-stage {
  align-self: flex-start;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,.78);
  color: #f8fafc;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
}

.walkthrough-stage-note {
  font-size: 12px;
  color: #64748b;
  letter-spacing: .02em;
}

.walkthrough-screen {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 560px;
  background: linear-gradient(180deg, rgba(15,23,42,.05), rgba(15,23,42,.01)), #dbeafe;
  border: 1px solid rgba(191,219,254,.9);
  box-shadow: 0 24px 56px rgba(15,23,42,.14);
}

.walkthrough-frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity .45s ease, transform .45s ease;
  pointer-events: none;
}

.walkthrough-frame.is-active {
  opacity: 1;
  transform: scale(1);
}

.walkthrough-frame.is-active img {
  animation: walkthroughFrameDrift 2.2s ease-out both;
}

.walkthrough-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.walkthrough-overlay {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(15,23,42,.12), rgba(15,23,42,.74));
  color: #fff;
  backdrop-filter: blur(10px);
}

.walkthrough-step-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(191,219,254,.9);
}

.walkthrough-step-title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  letter-spacing: -.03em;
}

.walkthrough-step-desc {
  max-width: 74%;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(226,232,240,.92);
}

.walkthrough-hotspot,
.walkthrough-cursor {
  position: absolute;
}

.walkthrough-hotspot {
  left: var(--hotspot-x);
  top: var(--hotspot-y);
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: rgba(255,255,255,.94);
  box-shadow: 0 0 0 8px rgba(59,130,246,.2);
}

.walkthrough-hotspot::before,
.walkthrough-hotspot::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.7);
  animation: walkthroughPulse 1.8s ease-out infinite;
}

.walkthrough-hotspot::after {
  animation-delay: .6s;
}

.walkthrough-cursor {
  left: var(--cursor-x);
  top: var(--cursor-y);
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  border: 3px solid #155eef;
  box-shadow: 0 8px 22px rgba(21,94,239,.28);
  animation: walkthroughCursor 1.8s ease-in-out infinite;
}

.walkthrough-cursor::after {
  content: '';
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: #155eef;
}

.walkthrough-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.walkthrough-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-width: min(100%, 420px);
}

.walkthrough-progress-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid #dbe5f3;
  background: rgba(255,255,255,.84);
  color: #475467;
  cursor: pointer;
  transition: border-color .16s ease, transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.walkthrough-progress-item:hover {
  transform: translateY(-1px);
  border-color: #93c5fd;
}

.walkthrough-progress-item.is-active {
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  border-color: #60a5fa;
  box-shadow: 0 8px 18px rgba(59,130,246,.12);
  color: #0f172a;
}

.walkthrough-progress-index {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #3b82f6;
}

.walkthrough-progress-text {
  font-size: 12px;
  font-weight: 700;
}

.walkthrough-progress-bar {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(148,163,184,.22);
  overflow: hidden;
}

.walkthrough-progress-fill {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%);
}

.walkthrough-progress-item.is-active .walkthrough-progress-fill {
  animation: walkthroughProgressFill 2.4s linear forwards;
}

.walkthrough-modal-overlay.is-paused .walkthrough-progress-item.is-active .walkthrough-progress-fill {
  animation-play-state: paused;
}

.walkthrough-toggle {
  border: 1px solid #cbd5e1;
  background: rgba(255,255,255,.86);
  color: #334155;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.walkthrough-toggle:hover {
  border-color: #94a3b8;
  background: #fff;
}

.walkthrough-brief {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.walkthrough-brief-grid {
  display: grid;
  gap: 10px;
}

.walkthrough-brief-card {
  padding: 16px 16px 15px;
  border-radius: 18px;
  border: 1px solid #dbe5f3;
  background: rgba(255,255,255,.84);
  box-shadow: 0 10px 24px rgba(15,23,42,.04);
}

.walkthrough-brief-intro {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.walkthrough-brief-kicker {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #2563eb;
  margin-bottom: 8px;
}

.walkthrough-brief-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.45;
  color: #0f172a;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.walkthrough-brief-desc {
  font-size: 13px;
  line-height: 1.75;
  color: #64748b;
}

.walkthrough-actions-stacked {
  flex-direction: column;
  margin-top: 4px;
}

.walkthrough-actions-stacked .btn {
  width: 100%;
  justify-content: center;
}

.walkthrough-section.is-collapsed .walkthrough-shell {
  gap: 0;
}

.walkthrough-section.is-collapsed .walkthrough-summary {
  max-width: 640px;
}

@keyframes walkthroughPulse {
  0% {
    transform: scale(.55);
    opacity: .95;
  }
  70% {
    transform: scale(1.25);
    opacity: 0;
  }
  100% {
    transform: scale(1.25);
    opacity: 0;
  }
}

@keyframes walkthroughFrameDrift {
  0% {
    transform: scale(1.04);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes walkthroughCursor {
  0%, 15% {
    transform: translate(14px, 16px) scale(1);
  }
  35%, 55% {
    transform: translate(0, 0) scale(.9);
  }
  70%, 100% {
    transform: translate(0, 0) scale(1);
  }
}

@keyframes walkthroughProgressFill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* ── Guidance card (Next Best Action) ────────────────────────────────────── */
.guidance-card {
  background: linear-gradient(90deg, #ffffff 0%, #f9fbff 100%);
  border: 1px solid var(--border);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: border-left-color 0.3s;
  box-shadow: var(--shadow-sm);
}

.guidance-card[data-state="4"] {
  border-left-color: #4ade80;
}

/* Unified guidance card layout with integrated steps */
.guidance-card-unified {
  gap: 14px;
}

.guidance-card-unified .guidance-body {
  min-width: 140px;
}

.guidance-card-unified .step-bar {
  flex: 1;
  /* make the step bar visually prominent and allow it to expand */
  padding: 8px 14px;
  background: rgba(255,255,255,0.96);
  border: 1px solid var(--border);
  border-radius: 10px;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between; /* spread items to fill space */
  max-width: 680px;
  margin: 0 12px;
}

.guidance-card-unified .step-bar .step-item {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 8px;
  background: transparent;
  border-radius: 8px;
}

.guidance-card-unified .step-bar .step-circle {
  width: 26px; height: 26px; font-size: 13px;
}

.guidance-card-unified .step-bar .step-text {
  display: inline-block;
  color: var(--text-secondary);
  font-weight: 600;
}

/* hide separators when using unified, spacing handles separation */
.guidance-card-unified .step-sep { display: none; }

/* Draw a subtle connector line under the steps; circles sit above the line */
.guidance-card-unified .step-bar {
  position: relative;
}

.guidance-card-unified .step-bar::before {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  top: 50%;
  height: 2px;
  background: linear-gradient(90deg, rgba(99,102,241,0.06), rgba(99,102,241,0.18));
  border-radius: 2px;
  z-index: 0;
}

.guidance-card-unified .step-bar .step-item {
  position: relative;
  z-index: 1;
}

.guidance-card-unified .step-bar .step-circle {
  z-index: 2;
  box-shadow: 0 2px 6px rgba(16,24,40,0.06);
}



.guidance-body {
  flex: 1;
  min-width: 0;
}

.guidance-step-badge {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--color-primary);
  margin-bottom: 6px;
  opacity: 0.7;
}

.guidance-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.guidance-desc {
  font-size: 12.5px;
  color: var(--muted);
}

.guidance-cta {
  white-space: nowrap;
  flex-shrink: 0;
  height: 36px;
}



.guidance-secondary {
  white-space: nowrap;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border-color: #cfe0f7;
  background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
  color: #1d4ed8;
  font-weight: 700;
}

.guidance-secondary:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

/* ── File zone (replaces plain import button row) ────────────────────────── */
.file-zone {
  padding: 12px 14px;
  border: 1px solid #dbe5f1;
  border-radius: 12px;
  background: #fafcff;
  margin-bottom: 0;
}

.file-zone-empty {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.file-zone-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--color-primary), #0ea5e9);
  color: white;
  font-weight: 600;
  font-family: inherit;
  font-size: 13px;
  box-shadow: 0 8px 16px rgba(21,94,239,.16);
  cursor: pointer;
  white-space: nowrap;
  height: 36px;
  border: none;
}

.file-zone-btn:hover {
  background: linear-gradient(135deg, var(--color-primary-hover), #0284c7);
  box-shadow: 0 12px 24px rgba(21,94,239,.24);
}

.file-zone-btn-icon {
  font-size: 15px;
}

.file-zone-hint {
  font-size: 11.5px;
  color: var(--muted);
}

.example-chip-demo {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  color: #1d4ed8;
  font-weight: 700;
}

.example-chip-demo:hover {
  border-color: #60a5fa;
  background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.file-zone-loaded {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #dbe4ef;
  border-radius: 999px;
  padding: 0 12px;
  min-height: 38px;
  font-size: 13px;
}

.file-chip-icon {
  font-size: 14px;
}

.file-chip-name {
  font-weight: 600;
  color: var(--text);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-chip-meta {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.file-change-btn {
  font-size: 12px;
  padding: 0 10px;
  height: 36px;
  line-height: 36px;
}

.walkthrough-inline-btn {
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid #d7e3f2;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #37516f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.walkthrough-inline-btn:hover {
  border-color: #93c5fd;
  color: #1d4ed8;
  background: #eff6ff;
}

@media (max-width: 720px) {
  .guidance-card {
    align-items: flex-start;
  }

  /* Responsive unified guidance card: stack vertically on mobile */
  .guidance-card-unified {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .guidance-card-unified .guidance-body {
    width: 100%;
    min-width: auto;
  }

  .guidance-card-unified .step-bar {
    width: 100%;
    gap: 4px;
    flex-wrap: wrap;
  }

  .guidance-card-unified .step-bar .step-text {
    display: none;
  }

  

  .biz-contact-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15,23,42,.28);
  }

  .biz-contact-card {
    position: relative;
    top: auto;
    right: auto;
    width: min(320px, 100%);
    max-width: 100%;
  }

  .biz-contact-close {
    top: -8px;
    right: -2px;
  }

  .biz-contact-trigger {
    min-width: auto;
    height: 44px;
    padding-right: 10px;
  }

  .biz-contact-eyebrow {
    letter-spacing: .12em;
  }
}

@media (min-width: 1180px) {
  .biz-contact-card {
    right: 24px;
  }
}

.walkthrough-modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15,23,42,.56);
  backdrop-filter: blur(10px);
  z-index: 2200;
}

.walkthrough-modal-overlay.open {
  display: flex;
}

.walkthrough-modal {
  width: min(1320px, 100%);
  max-height: min(92vh, 980px);
  overflow: auto;
  background:
    radial-gradient(circle at top right, rgba(59,130,246,.12), transparent 24%),
    linear-gradient(180deg, #fbfdff 0%, #f5f9ff 100%);
  border: 1px solid #d7e6f7;
  border-radius: 28px;
  box-shadow: 0 28px 90px rgba(15,23,42,.22);
  padding: 26px 28px 28px;
  font-family: 'SF Pro Display', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.walkthrough-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.walkthrough-head-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.walkthrough-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid #d6dfec;
  background: rgba(255,255,255,.9);
  color: #475569;
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
  align-self: flex-start;
}

.walkthrough-modal-close:hover {
  background: #fff;
  color: #0f172a;
}

.walkthrough-modal-body {
  display: grid;
  grid-template-columns: minmax(620px, 1.62fr) minmax(300px, .68fr);
  gap: 24px;
  align-items: start;
}

/* simplified first-rule modal */
.first-rule-modal-simple {
  width: min(960px, 100%);
  background: #ffffff;
  border: 1px solid #e2eaf4;
  border-radius: 24px;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.18);
  padding: 20px 20px 20px;
  font-family: 'SF Pro Display', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

.first-rule-modal-simple-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.first-rule-modal-simple-title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  color: #1e293b;
  letter-spacing: -0.01em;
}

.first-rule-modal-overlay {
  z-index: 2210;
}

.first-rule-video-shell {
  border-radius: 12px;
  overflow: hidden;
  background: #0f172a;
  border: 1px solid #e2eaf4;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
}

.first-rule-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #020617;
}

.first-rule-video-caption {
  font-size: 13px;
  line-height: 1.8;
  color: #7c6750;
}

.first-rule-kicker {
  color: #9a6700;
  letter-spacing: .16em;
}

.first-rule-summary {
  max-width: 760px;
  color: #6f5a45;
  font-size: 15px;
  line-height: 1.8;
}

.first-rule-stage {
  background: linear-gradient(135deg, #3b2c19 0%, #7c5f2d 100%);
  color: #fff8e7;
  box-shadow: 0 12px 28px rgba(80, 57, 14, 0.24);
}

.first-rule-stage-note {
  color: #8a755e;
  font-weight: 600;
}

.first-rule-brief {
  gap: 16px;
}

.first-rule-editorial-card {
  padding: 22px 22px 20px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255,255,255,0.82) 0%, rgba(255,249,235,0.95) 100%);
  border: 1px solid rgba(236, 199, 122, 0.5);
  box-shadow: 0 16px 32px rgba(77, 58, 14, 0.08);
}

.first-rule-editorial-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #b7791f;
  margin-bottom: 10px;
}

.first-rule-editorial-title {
  font-size: 24px;
  line-height: 1.42;
  font-weight: 800;
  color: #2f2417;
  letter-spacing: -.03em;
  margin-bottom: 10px;
}

.first-rule-editorial-desc {
  font-size: 14px;
  line-height: 1.85;
  color: #6d5840;
}

.first-rule-insight-list {
  display: grid;
  gap: 12px;
}

.first-rule-insight-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(233, 213, 168, 0.68);
  background: rgba(255,255,255,0.74);
}

.first-rule-insight-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  color: #fffaf0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
}

.first-rule-insight-title {
  font-size: 15px;
  line-height: 1.45;
  font-weight: 800;
  color: #322618;
  margin-bottom: 4px;
}

.first-rule-insight-desc {
  font-size: 13px;
  line-height: 1.75;
  color: #735d46;
}

.tools-rule-actions .btn {
  min-width: 124px;
  height: 36px;
  justify-content: center;
}
/* .tools-actions #applyRulesBtn flex:1 removed — buttons in .tools-rule-actions are now auto-width */


/* ── Export button pulse animation (step-4 guidance highlight) ───────────── */
@keyframes exportPulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 128, 237, 0.5); }
  60%  { box-shadow: 0 0 0 8px rgba(47, 128, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 128, 237, 0); }
}

.export-pulse {
  animation: exportPulse 0.6s ease-out 2;
}

/* ── Drawer live preview strip ───────────────────────────────────────────── */
.drawer-preview-box {
  background: #f4f8ff;
  border: 1px solid #d5e3fa;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-family: 'SF Mono', 'Consolas', 'Menlo', monospace;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 34px;
  margin: 4px 0 0;
  transition: opacity 0.15s;
}
.drawer-preview-box:empty { display: none; }
.drp-label  { color: #9ca3af; font-size: 11px; flex-shrink: 0; font-family: system-ui; }
.drp-before { color: #6b7280; text-decoration: line-through; text-decoration-color: #d1d5db; }
.drp-arrow  { color: #9ca3af; font-size: 14px; flex-shrink: 0; }
.drp-after  { color: #1a5cba; font-weight: 700;
              background: rgba(47,128,237,0.1); border-radius: 4px; padding: 1px 6px; }
.drp-note   { color: #f59e0b; font-size: 11px; font-family: system-ui; }

/* ===== Column Distribution Drawer ===== */
#colDistDrawer {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 440px;
  background: var(--surface);
  box-shadow: -8px 0 40px rgba(15,23,34,0.14);
  z-index: 1200;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.4,0,0.2,1);
}
#colDistDrawer.open { transform: translateX(0); }
.col-analyze-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  font-size: 11px;
  border: none;
  background: none;
  cursor: pointer;
  opacity: 0;
  margin-left: 4px;
  padding: 0;
  border-radius: 3px;
  transition: opacity 0.15s, background 0.15s;
  vertical-align: middle;
  line-height: 1;
}
th:hover .col-analyze-btn { opacity: 0.8; }
th[data-col-field] { cursor: pointer; }
th[data-col-field]:hover { background: #e8edf8; }
.col-analyze-btn:hover { opacity: 1 !important; background: rgba(99,102,241,0.15); }
.cd-section { margin-bottom: 14px; }
.cd-section-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #6b7eb8;
  margin-bottom: 8px;
}
.cd-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.cd-stat {
  background: #f4f7ff;
  border: 1px solid #dce7ff;
  border-radius: 6px;
  padding: 8px 6px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.cd-stat-val { font-size: 15px; font-weight: 700; color: var(--text); line-height: 1; }
.cd-stat-lbl { font-size: 10px; color: #6b7280; margin-top: 2px; }
.cd-top-table {
  width: 100%;
  font-size: 11.5px;
  border-collapse: collapse;
}
.cd-top-table th, .cd-top-table td {
  padding: 4px 6px;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
}
.cd-top-table th { color: #6b7280; font-weight: 600; }
#colDistFoot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════════════════
   ═ TASK FLOW: 四块统一布局 · 响应式 · 无障碍
   ════════════════════════════════════════════════════════════════════════════ */

.taskflow-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(16,33,58,.04);
  animation: fadeInUp 0.35s ease-out;
}

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

.taskflow-header {
  margin-bottom: 28px;
  text-align: center;
}

.taskflow-title {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--text);
  line-height: 1.3;
}

.taskflow-subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.taskflow-trust-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(6, 182, 212, 0.08));
  border: 1px solid rgba(37, 99, 235, 0.14);
  color: #1e293b;
}

.taskflow-trust-bar-icon {
  font-size: 14px;
}

.taskflow-trust-bar-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.taskflow-trust-bar-link {
  color: #0f4aa3;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid rgba(15, 74, 163, 0.25);
}

.taskflow-trust-bar-link:hover {
  border-bottom-color: rgba(15, 74, 163, 0.7);
}

/* Main grid: responsive auto-fit so 1-4 columns adapt to available space */
.taskflow-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ── Task Flow Card ────────────────────────────────────────────────────────── */
.taskflow-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  transition: background var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base), outline-offset var(--transition-base);
  outline: 2px solid transparent;
  outline-offset: 0;
  box-shadow: var(--shadow-sm);
}

.taskflow-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  box-shadow: var(--shadow-md);
}

.taskflow-card:hover {
  box-shadow: var(--shadow-md);
}

/* Import Card - Blue accent on hover */
.taskflow-card.taskflow-card-import {
  --accent-color: #3b82f6;
}

.taskflow-card.taskflow-card-import:hover {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.2);
}

/* Rules Card - Indigo accent on hover (更专业的深蓝) */
.taskflow-card.taskflow-card-rules {
  --accent-color: #6366f1;
}

.taskflow-card.taskflow-card-rules:hover {
  background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
  border-color: #6366f1;
  box-shadow: 0 4px 16px rgba(99, 102, 241, 0.2);
}

/* Export Card - Amber accent on hover (温暖的橙色) */
.taskflow-card.taskflow-card-export {
  --accent-color: #f59e0b;
}

.taskflow-card.taskflow-card-export:hover {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

/* Sample & Walkthrough variants */
.taskflow-card.taskflow-card-sample {
  --accent-color: #06b6d4;
}

.taskflow-card.taskflow-card-sample:hover {
  background: linear-gradient(135deg, #ecfeff 0%, #cffafe 100%);
  border-color: #06b6d4;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.2);
}

.taskflow-card.taskflow-card-walkthrough {
  --accent-color: #f59e0b;
}

.taskflow-card.taskflow-card-walkthrough:hover {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #f59e0b;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

/* Taskflow card button styles */
.taskflow-card-btn {
  width: 100%;
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  text-align: center;
  letter-spacing: -0.2px;
  box-shadow: var(--shadow-sm);
  height: auto;
}

/* Import Button - Modern Blue */
.taskflow-card-import .taskflow-card-btn,
.taskflow-card .btn-primary.taskflow-card-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #ffffff;
}

.taskflow-card-import .taskflow-card-btn:hover,
.taskflow-card .btn-primary.taskflow-card-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
  transform: translateY(-2px);
}

/* Rules Button - Indigo (专业深蓝) */
.taskflow-card-rules .taskflow-card-btn,
.taskflow-card .btn-secondary.taskflow-card-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #ffffff;
}

.taskflow-card-rules .taskflow-card-btn:hover,
.taskflow-card .btn-secondary.taskflow-card-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  transform: translateY(-2px);
}

/* Export Button - Amber (温暖橙色) */
.taskflow-card-export .taskflow-card-btn,
.taskflow-card .btn-success.taskflow-card-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
}

.taskflow-card-export .taskflow-card-btn:hover,
.taskflow-card .btn-success.taskflow-card-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
  transform: translateY(-2px);
}

.taskflow-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.taskflow-card-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
  min-width: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: iconBounce 0.5s ease-out;
}

@keyframes iconBounce {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.taskflow-card-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  line-height: 1.3;
}

.taskflow-card-rules-head {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.taskflow-card-rules-title-row .taskflow-card-header {
  width: 100%;
  align-items: center;
  justify-content: flex-start;
}

.taskflow-rules-actions-row {
  width: 100%;
  margin-left: 0;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: nowrap;
}

.taskflow-rules-action-btn {
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.taskflow-rules-actions-row .taskflow-rules-action-btn {
  flex: 1 1 0;
}

.taskflow-card-desc {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* Features list */
.taskflow-card-features {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.taskflow-card-features li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.taskflow-card-features li::before {
  content: '✓';
  font-weight: 700;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
  color: currentColor;
  opacity: 0.7;
}

/* ── Taskflow Import Card: Samples subsection ── */
.taskflow-import-samples {
  padding: 10px 0;
  border-top: 1px solid rgba(0,0,0,0.05);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin: 8px 0;
}

.taskflow-import-samples-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.taskflow-import-samples-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.taskflow-import-video-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(100%, 232px);
  width: fit-content;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  background: rgba(239, 246, 255, 0.96);
  color: #1d4ed8;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.08);
}

.taskflow-import-video-link:hover {
  background: #dbeafe;
  border-color: rgba(37, 99, 235, 0.28);
}

.taskflow-import-video-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-size: 9px;
}

.taskflow-import-video-link-text {
  white-space: normal;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.order-add-row-btn {
  white-space: normal;
  text-align: left;
  line-height: 1.35;
  height: auto;
  min-height: 28px;
}

.taskflow-import-samples-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ── Taskflow Export Card: Samples subsection ── */
.taskflow-export-samples {
  padding: 10px 0;
  border-top: 1px solid rgba(0,0,0,0.05);
  border-bottom: 1px solid rgba(0,0,0,0.05);
  margin: 8px 0;
}

.taskflow-export-samples-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.taskflow-export-samples-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* ── Taskflow Export Actions: Format selector + button ── */
.taskflow-export-actions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  /* Keep export controls close to the description instead of forcing them to the card bottom */
  margin-top: 6px;
  align-items: center;
}

.taskflow-export-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.taskflow-export-actions {
  flex: 1 1 auto;
}

.taskflow-export-spacer {
  height: 8px;
}

.taskflow-export-format {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.taskflow-export-format-select {
  /* increase selector width for balance; remain responsive on small screens */
  flex: 0 0 320px;
  min-width: 220px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

@media (max-width: 768px) {
  .taskflow-export-actions { flex-direction: column; gap: 8px; }
  .taskflow-export-format-select { flex: 1; min-width: 0; }
}

.taskflow-export-btn {
  margin-left: auto;
  align-self: center;
  white-space: nowrap;
}

.taskflow-export-format {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.taskflow-export-format-label {
  display: block;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.taskflow-export-format-select {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.taskflow-export-btn {
  width: 100%;
  padding: 12px 16px !important;
  font-size: 14px !important;
  font-weight: 600 !important;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25) !important;
}

.taskflow-export-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3) !important;
}

.taskflow-export-btn-disabled,
.taskflow-export-btn:disabled {
  background: #e5e7eb !important;
  color: #9ca3af !important;
  box-shadow: none !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}

.taskflow-export-btn-disabled:hover,
.taskflow-export-btn:disabled:hover {
  background: #e5e7eb !important;
  box-shadow: none !important;
}

.taskflow-card-btn {
  margin-top: auto;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.2px;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base), transform var(--transition-base);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.taskflow-card-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.taskflow-card-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Button variants per card type */
.taskflow-card-import .taskflow-card-btn {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
}

.taskflow-card-import .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.taskflow-card-rules .taskflow-card-btn {
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
}

.taskflow-card-rules .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.taskflow-card-export .taskflow-card-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}

.taskflow-card-export .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.taskflow-card-sample .taskflow-card-btn {
  background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
  color: #fff;
}

.taskflow-card-sample .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.35);
}

.taskflow-card-walkthrough .taskflow-card-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}

.taskflow-card-walkthrough .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

.taskflow-card-export .taskflow-card-btn {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #fff;
}

.taskflow-card-export .taskflow-card-btn:hover {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  box-shadow: 0 6px 20px rgba(245, 158, 11, 0.35);
}

/* Flow indicators (arrows between cards) */
.taskflow-flow-indicators {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
  text-align: center;
  font-size: 18px;
  color: var(--border);
  font-weight: 300;
  opacity: 0.5;
}

.taskflow-flow-arrow {
  display: none;
}

/* ════════════════════════════════════════════════════════════════════════════
   ═ RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════════════════════════ */

/* Tablet / Medium screens (2 columns) */
@media (max-width: 1024px) {
  .taskflow-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }

  .taskflow-flow-indicators {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .taskflow-card {
    padding: 20px 16px;
  }

  .taskflow-card-icon {
    font-size: 28px;
  }

  .taskflow-card-title {
    font-size: 16px;
  }

  .taskflow-section {
    padding: 24px 20px;
  }

  .taskflow-title {
    font-size: 20px;
  }

  .taskflow-trust-bar {
    width: 100%;
    border-radius: 18px;
  }
}

/* Mobile / Small screens (1 column) */
@media (max-width: 768px) {
  .qa-hint {
    font-size: 11.5px;
  }

  .taskflow-section {
    padding: 16px 14px;
    margin-bottom: 16px;
    border-radius: 14px;
  }

  .taskflow-header {
    margin-bottom: 14px;
  }

  .taskflow-title {
    font-size: 17px;
    font-weight: 700;
  }

  .taskflow-subtitle {
    font-size: 12px;
  }

  .taskflow-trust-bar {
    justify-content: flex-start;
  }

  .taskflow-import-samples-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .taskflow-import-video-link {
    max-width: none;
  }

  .taskflow-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .taskflow-card {
    padding: 14px 12px;
    gap: 10px;
    border-radius: 14px;
  }

  .taskflow-card-icon {
    font-size: 22px;
    min-width: 28px;
  }

  .taskflow-card-title {
    font-size: 15px;
  }

  .taskflow-card-desc {
    font-size: 12px;
    line-height: 1.5;
    margin-bottom: 4px;
  }

  .taskflow-card-features {
    gap: 3px;
    font-size: 11px;
  }

  .taskflow-import-samples {
    padding: 8px 0;
    margin: 6px 0;
  }

  .taskflow-import-samples-label {
    font-size: 10px;
  }

  .taskflow-card-btn {
    padding: 10px 12px;
    font-size: 12px;
    min-height: 40px;
  }

  .taskflow-import-video-link {
    padding: 4px 8px;
    font-size: 10px;
  }

  .taskflow-import-video-link-text {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .example-chip {
    padding: 5px 9px;
    font-size: 11px;
  }

  .taskflow-export-format-label {
    margin-bottom: 4px;
    font-size: 11px;
  }

  .taskflow-export-format-select {
    min-height: 38px;
    font-size: 13px;
  }

  .taskflow-export-btn {
    width: 100%;
    align-self: stretch;
  }

  .taskflow-flow-indicators {
    margin-top: 12px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .header-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .biz-contact-trigger {
    grid-column: 1 / -1;
  }

  .taskflow-section {
    padding: 16px 12px;
  }

  .taskflow-title {
    font-size: 16px;
  }

  .taskflow-subtitle {
    font-size: 12px;
  }

  .taskflow-card-icon {
    font-size: 20px;
  }

  .taskflow-card-title {
    font-size: 14px;
  }

  .taskflow-card-desc {
    font-size: 11.5px;
  }

  .taskflow-card-btn {
    padding: 8px 10px;
    font-size: 11px;
  }
}

/* Override: stack export select above button and align button to select's right edge */
.taskflow-export-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.taskflow-export-actions {
  width: 100%;
}

.taskflow-export-format {
  justify-content: flex-start;
}

.taskflow-export-format-select {
  flex: 0 0 320px;
  max-width: 100%;
}

.taskflow-export-btn {
  width: auto;
  margin-left: 0;
  align-self: flex-end;
  white-space: nowrap;
  /* Ensure export button stays within card flow (override margin-top:auto from .taskflow-card-btn) */
  margin-top: 8px !important;
  display: inline-flex;
}

@media (min-width: 1200px) {
  .taskflow-export-row { flex-direction: row; align-items: center; }
  .taskflow-export-actions { flex: 1 1 auto; }
  .taskflow-export-btn { margin-left: auto; align-self: center; }
}

/* ════════════════════════════════════════════════════════════════════════════
   ═ DARK MODE SUPPORT (if implemented in future)
   ════════════════════════════════════════════════════════════════════════════ */

@media (prefers-color-scheme: dark) {
  .taskflow-section {
    background: /* var(--surface-dark, #1e293b) */;
    border-color: /* var(--border-dark, #475569) */;
  }

  .taskflow-card {
    background: /* linear-gradient(135deg, rgba(30,41,59,0.6), rgba(30,41,59,0.3)) */;
  }
}

/* Stronger export layout override: stack select above button and keep both inside card */
/* Make export area follow the same vertical layout as the Rules card */
.taskflow-export-row { display: block !important; }
.taskflow-export-actions { display: block !important; width: 100%; }
.taskflow-export-format { display: block; margin: 0 0 6px; }
.taskflow-export-format-select { width: 100% !important; min-width: 0 !important; box-sizing: border-box; }
.taskflow-export-btn { width: 100% !important; margin-top: 10px !important; margin-left: 0 !important; }

/* High contrast mode support */
@media (prefers-contrast: more) {
  .taskflow-card {
    border-width: 2px;
  }

  .taskflow-card-btn {
    font-weight: 700;
  }
}

/* ── Mode badge tooltip ─────────────────────────────────────────── */
.rule-mode-badge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Pulse ring for first-time users */
.rule-mode-badge-wrap.qx-badge-pulse .rule-library-mode-badge::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid #1d4ed8;
  animation: qxBadgePulse 1.6s ease-out infinite;
  pointer-events: none;
}
.rule-library-mode-badge {
  position: relative; /* needed for ::after pulse ring */
}

@keyframes qxBadgePulse {
  0%   { opacity: 0.8; transform: scale(1); }
  60%  { opacity: 0;   transform: scale(1.5); }
  100% { opacity: 0;   transform: scale(1.5); }
}

.rule-mode-tip {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16,33,58,.10);
  padding: 10px 12px;
  z-index: 200;
  pointer-events: none;
}

.rule-mode-badge-wrap:hover .rule-mode-tip {
  display: block;
}

.rule-mode-tip-main {
  font-size: 12px;
  font-weight: 700;
  color: #1e3a5f;
  margin-bottom: 4px;
  line-height: 1.4;
}

.rule-mode-tip-sub {
  font-size: 11px;
  color: #64748b;
  line-height: 1.5;
}

/* Expert-mode variant colouring */
.rule-library-shell[data-mode="expert"] .rule-mode-tip {
  border-color: #fde68a;
}
.rule-library-shell[data-mode="expert"] .rule-mode-tip-main {
  color: #92400e;
}

/* ── Beginner Guide Widget ──────────────────────────────────────── */
.qx-guide {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 260px;
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(16,33,58,.12), 0 2px 8px rgba(16,33,58,.06);
  padding: 14px 16px 12px;
  z-index: 500;
  animation: qxGuideSlideIn 0.35s cubic-bezier(.22,.68,0,1.2) both;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.qx-guide.qx-guide-hidden {
  opacity: 0;
  transform: translateY(12px) scale(0.97);
  pointer-events: none;
}

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

.qx-guide-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.qx-guide-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #1d4ed8;
}

.qx-guide-close {
  background: none;
  border: none;
  padding: 0 2px;
  line-height: 1;
  font-size: 16px;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 4px;
  transition: color 0.15s;
}
.qx-guide-close:hover { color: #334155; }

.qx-guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.qx-guide-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12.5px;
  color: #64748b;
  padding: 6px 8px;
  border-radius: 8px;
  transition: background 0.2s, color 0.2s;
  counter-increment: none;
}

.qx-guide-step-icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1.3;
  opacity: 0.5;
  transition: opacity 0.2s;
}

.qx-guide-step-text {
  line-height: 1.45;
}

/* Active step */
.qx-guide-step.qx-step-active {
  background: #eef4ff;
  color: #1e3a5f;
  font-weight: 600;
}
.qx-guide-step.qx-step-active .qx-guide-step-icon {
  opacity: 1;
}

/* Done step */
.qx-guide-step.qx-step-done {
  color: #94a3b8;
}
.qx-guide-step.qx-step-done .qx-guide-step-text {
  text-decoration: line-through;
}
.qx-guide-step.qx-step-done .qx-guide-step-icon {
  opacity: 0.4;
}
.qx-guide-step.qx-step-done::after {
  content: '✓';
  margin-left: auto;
  color: #22c55e;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.qx-guide-hint {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #e2e8f0;
  font-size: 11px;
  color: #94a3b8;
  line-height: 1.5;
}
