:root {
  /* Color System - Refined Blue Palette */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-accent: #06b6d4;
  --color-accent-soft: #67e8f9;
  
  /* Surfaces & Backgrounds */
  --bg: #fafbfc;
  --bg-gradient: linear-gradient(180deg, #ffffff 0%, #f8fafc 50%, #f1f5f9 100%);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #f8fafc;
  
  /* Text Hierarchy */
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #64748b;
  --text-muted: #94a3b8;
  
  /* Borders & Dividers */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-strong: #94a3b8;
  
  /* Semantic Colors */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  
  /* Spacing Scale (8px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;
  
  /* Shadows - Layered Depth */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.1), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-xl: 0 16px 48px rgba(15, 23, 42, 0.12), 0 8px 24px rgba(15, 23, 42, 0.08);
  
  /* Typography */
  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

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

.header {
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 72px;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border-light);
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px) saturate(180%);
  box-shadow: var(--shadow-sm);
}

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

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

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

.logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #fff;
  letter-spacing: -0.5px;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  padding: 24px;
  min-height: calc(100vh - 120px);
  align-items: start;
  max-width: 1600px;
  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: 20px;
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 100%);
  color: #ffffff;
  font-weight: 600;
  padding: 0 16px 0 14px;
  min-width: 160px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
  border: none;
  transition: all 0.2s 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 12px rgba(37, 99, 235, 0.35);
  background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 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(135deg, #1e40af 0%, #1d4ed8 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: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

/* ── 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: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  opacity: 0.9;
}
  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: 40px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  transition: all var(--transition-base);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.1px;
}

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

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

.btn-primary {
  background: var(--color-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.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: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  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: var(--surface-soft);
  border-color: var(--border-strong);
  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-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;
}

.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;
}

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

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

.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: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}

.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 {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  opacity: 0.6;
  line-height: 1;
  vertical-align: middle;
}

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

.tree-analyze-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;
}

.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: 90px;
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  padding: 16px;
}

.inspector-summary {
  padding: 14px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, #f8fbff 0%, #f3f7fd 100%);
  border: 1px solid #d9e4f2;
  border-radius: 12px;
}

.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;
  gap: 2px;
  background: #f4f7fb;
  border-radius: 10px;
  padding: 4px;
  overflow-x: auto;
}

.rule-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  flex: 1;
}

.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: nowrap;
  width: 80px;
  flex-shrink: 0;
}
.qa-checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}
.qa-hint {
  font-size: 11px;
  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: 7px 10px;
  margin: 2px 0 4px;
  max-height: 140px;
  overflow-y: auto;
}
/* ── 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;
}
.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;
}

/* 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: all 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-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; }
.rule-picker-empty { padding: 20px; text-align: center; color: #aaa; font-size: 13px; }

@media (max-width: 1200px) {
  .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 {
    align-items: flex-start;
  }
  .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;
  }
  
  .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%;
  }


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

  .hero-proof-list {
    grid-template-columns: 1fr;
  }
}
  .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 {
    padding: 16px;
  }

  .batch-empty {
    min-height: 120px;
  }

  .tools {
    padding: 16px;
  }
  .tools-stage {
    padding: 16px;
  }
  .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 {
    width: 100%;
    justify-content: center;
  }
  .walkthrough-import-btn,
  .walkthrough-expand-btn {
    width: 100%;
    justify-content: center;
  }
  .tools .row {
    flex-wrap: wrap;
  }
  .step-sep {
    display: none;
  }
  .step-bar {
    flex-wrap: wrap;
  }
  .fze-top {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== Mask / Rule Drawer ===== */
#phoneMaskDrawer {
  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);
}
#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;
}

/* 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;
}
.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;
}

/* 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 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-soft);
  flex-shrink: 0;
}
.drawer-foot .btn {
  width: 100%;
  height: 36px;          /* explicit: same as global .btn */
  font-size: 13px;
}
#drawerAddRule {
  grid-column: 1 / -1;
  font-weight: 600;
}

/* (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; }

/* ── Workspace navigation tabs ─────────────────────────────────────────── */
.workspace-nav {
  background: rgba(255,255,255,.78);
  border-bottom: 1px solid rgba(215,224,234,.85);
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 52px;
  backdrop-filter: blur(14px);
}

.workspace-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  height: 52px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s, background-color 0.15s;
  border-radius: 10px 10px 0 0;
}

.workspace-tab:hover {
  color: var(--color-primary);
  background: rgba(21,94,239,.05);
}

.workspace-tab.active {
  color: var(--color-primary);
  font-weight: 700;
  border-bottom-color: var(--color-primary);
}

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

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

.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;
}

.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) {
  .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;
}

.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;
}

.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;
}

.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; }
.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;
}

/* 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: all 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 {
  transform: translateY(-2px);
}

/* 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: all 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-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 {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}

.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: 640px) {
  .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-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: all 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;
  }
}

/* Mobile / Small screens (1 column) */
@media (max-width: 640px) {
  .taskflow-section {
    padding: 20px 16px;
    margin-bottom: 16px;
    border-radius: 10px;
  }

  .taskflow-header {
    margin-bottom: 20px;
  }

  .taskflow-title {
    font-size: 18px;
    font-weight: 700;
  }

  .taskflow-subtitle {
    font-size: 13px;
  }

  .taskflow-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .taskflow-card {
    padding: 16px 14px;
    gap: 12px;
  }

  .taskflow-card-icon {
    font-size: 24px;
    min-width: 32px;
  }

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

  .taskflow-card-desc {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .taskflow-card-features {
    gap: 3px;
    font-size: 11px;
  }

  .taskflow-card-btn {
    padding: 9px 12px;
    font-size: 12px;
  }

  .taskflow-flow-indicators {
    margin-top: 12px;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  .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;
  }
}
