/* web-pitch UI — design system v2 (refresh).
 *
 * Drops Pico CSS in favor of a small, intentional set of tokens + components.
 * Goals: clear visual hierarchy, branded but restrained, dashboard-first.
 *
 * Layers:
 *   1. Tokens (CSS variables)
 *   2. Reset (minimal)
 *   3. Layout primitives (.app-shell, .container, .stack, .row)
 *   4. Type scale + utilities
 *   5. Components (buttons, cards, badges, tables, forms)
 *   6. Page-specific (dashboard cards, workspace detail, batches)
 */

/* ============================================================
   1. TOKENS
   ============================================================ */

:root {
  /* Surfaces */
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;

  /* Text */
  --text-primary: #18181b;
  --text-secondary: #57534e;
  --text-muted: #a8a29e;

  /* Brand */
  --brand: #d97706;          /* amber-600 — warm, professional */
  --brand-hover: #b45309;
  --brand-tint: #fef3c7;     /* amber-100 backdrop */
  --brand-on: #ffffff;       /* text on brand */

  /* Semantic */
  --success: #15803d;
  --success-tint: #dcfce7;
  --warn: #ca8a04;
  --warn-tint: #fef9c3;
  --danger: #b91c1c;
  --danger-tint: #fee2e2;

  /* Type */
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --font-display: 'Inter Tight', 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;

  /* Spacing scale (4px base) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 22px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ============================================================
   2. RESET
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Inter+Tight:wght@600;700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -0.005em;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.15s var(--ease);
}
a:hover { color: var(--brand); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--text-primary);
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; }

code, pre {
  font-family: var(--font-mono);
  font-size: 0.88em;
}

/* ============================================================
   3. LAYOUT
   ============================================================ */

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 249, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.brand-mark .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
.brand-mark:hover { color: var(--text-primary); }

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.app-nav a {
  font-weight: 500;
  font-size: 14px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
}
.app-nav a:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.app-nav a.active {
  color: var(--text-primary);
  background: var(--surface-2);
}
.app-nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border, #e7e5e4);
  margin: 0 4px;
}
.app-nav-user {
  font-size: 13px;
  color: var(--text-secondary, #57534e);
  font-weight: 500;
  padding: 0 4px;
}
.app-nav-logout {
  margin: 0;
}
.btn-logout {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #71717a);
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: var(--r-sm, 6px);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.btn-logout:hover {
  background: var(--surface-2, #f5f5f4);
  color: var(--text-primary, #18181b);
  border-color: var(--border, #e7e5e4);
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
}

.app-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* Layout primitives */
.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-8); }
.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

/* ============================================================
   4. TYPE + UTILITIES
   ============================================================ */

h1 { font-size: 32px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.2; }
h3 { font-size: 17px; line-height: 1.3; font-weight: 700; }
h4 { font-size: 14px; line-height: 1.3; font-weight: 700; }

.eyebrow {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
}

.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-sm { font-size: 13px; }
.text-mono { font-family: var(--font-mono); font-size: 12.5px; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   5. COMPONENTS
   ============================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  height: 38px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { color: var(--text-primary); background: var(--surface-2); }

.btn-primary {
  background: var(--text-primary);
  color: var(--brand-on);
  border-color: var(--text-primary);
}
.btn-primary:hover {
  background: #000;
  color: var(--brand-on);
}

.btn-brand {
  background: var(--brand);
  color: var(--brand-on);
  border-color: var(--brand);
}
.btn-brand:hover {
  background: var(--brand-hover);
  color: var(--brand-on);
  border-color: var(--brand-hover);
}

.btn-outline {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-outline:hover {
  background: var(--surface-2);
  border-color: var(--text-secondary);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  padding: var(--space-2);
  height: 34px;
  width: 34px;
}
.btn-danger-ghost:hover {
  background: var(--danger-tint);
  color: var(--danger);
}

.btn-sm {
  height: 30px;
  padding: 0 var(--space-3);
  font-size: 13px;
}
.btn-lg {
  height: 46px;
  padding: 0 var(--space-6);
  font-size: 15px;
  font-weight: 700;
}

button.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Legacy Pico-style button classes mapped to new design system.
 * status_table.html + workspace.html use `secondary`, `outline`, `danger`, etc.
 * The :not() chain whitelists the dashboard's clean button types that own
 * their styling (funnel-stat, view-btn, vp-btn, icon-btn, etc.). */
button:not(.btn):not([class*="chip"]):not([type="file"]):not(.funnel-stat):not(.view-btn):not(.vp-btn):not(.icon-btn),
input[type="submit"]:not(.btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  height: 38px;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--text-primary);
  background: var(--text-primary);
  color: var(--brand-on);
  cursor: pointer;
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
button:not(.btn):not([class*="chip"]):not([type="file"]):not(.funnel-stat):not(.view-btn):not(.vp-btn):not(.icon-btn):hover {
  background: #000;
}
button.secondary, .secondary:not(.btn) {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}
button.secondary:hover { background: var(--surface-2) !important; }
button.outline, .outline {
  background: var(--surface) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-strong) !important;
}
button.danger, .danger {
  background: var(--danger) !important;
  color: white !important;
  border-color: var(--danger) !important;
}
button.danger:hover { background: #991b1b !important; }
button.ghost-danger {
  background: transparent !important;
  color: var(--text-muted) !important;
  border-color: transparent !important;
  width: 34px;
  height: 34px;
  padding: 0 !important;
}
button.ghost-danger:hover {
  background: var(--danger-tint) !important;
  color: var(--danger) !important;
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.card-body { padding: var(--space-5); }
.card-padded { padding: var(--space-6); }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.badge-success { background: var(--success-tint); color: var(--success); border-color: transparent; }
.badge-warn    { background: var(--warn-tint);    color: var(--warn);    border-color: transparent; }
.badge-danger  { background: var(--danger-tint);  color: var(--danger);  border-color: transparent; }
.badge-brand   { background: var(--brand-tint);   color: var(--brand-hover); border-color: transparent; }
.badge-running { background: var(--brand-tint); color: var(--brand-hover); border-color: transparent; }
.badge-running::before {
  content: "";
  width: 6px; height: 6px;
  background: var(--brand);
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---- Forms ---- */
.form-stack > * + * { margin-top: var(--space-5); }
.form-field { display: block; }
.form-field > label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: var(--space-2);
  color: var(--text-primary);
}
.form-field > label .hint {
  font-weight: 400;
  color: var(--text-muted);
  margin-left: var(--space-2);
}
input[type="text"], input[type="url"], input[type="email"], input[type="file"],
input[type="number"], select, textarea {
  display: block;
  width: 100%;
  padding: var(--space-3);
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
input[type="text"]:focus, input[type="url"]:focus, input[type="email"]:focus,
input[type="number"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}
textarea { font-family: inherit; min-height: 84px; resize: vertical; }

input[type="file"] {
  padding: var(--space-2);
}
input[type="file"]::file-selector-button {
  margin-right: var(--space-3);
  padding: var(--space-2) var(--space-3);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
}

.form-help {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ---- Tables ---- */
/* Default style for any table; `.data` was the planned modifier but legacy
 * partials use `.agent-table`, `.batch-table`, `.ws-table` — easier to just
 * style raw tables consistently. */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
table th, table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
table tbody tr:last-child td { border-bottom: none; }
table th {
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
}
table tbody tr:hover { background: var(--surface-2); }
table.data, table.agent-table, table.batch-table, table.ws-table {
  /* Aliases for legacy partials — all get the same base style. */
}

/* ---- Banner ---- */
.banner {
  border-radius: var(--r-md);
  padding: var(--space-4) var(--space-5);
  background: var(--brand-tint);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  font-size: 14px;
  color: color-mix(in srgb, var(--brand-hover) 80%, var(--text-primary));
}
.banner strong { color: var(--text-primary); font-weight: 700; }
.banner-warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.banner-danger { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
  border: 2px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.empty-state .empty-icon {
  font-size: 36px;
  margin-bottom: var(--space-3);
  color: var(--text-muted);
  display: flex;
  justify-content: center;
}
.empty-state .empty-icon svg.icon { display: block; }
.empty-state h3 { margin-bottom: var(--space-2); }
.empty-state p { color: var(--text-secondary); margin-bottom: var(--space-6); }

/* ============================================================
   6. PAGE-SPECIFIC
   ============================================================ */

/* ---- Dashboard ---- */
.dashboard-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.dashboard-hero h1 { margin-bottom: var(--space-2); }
.dashboard-hero p {
  color: var(--text-secondary);
  font-size: 14.5px;
  max-width: 56ch;
}
.dashboard-hero-actions { display: flex; gap: var(--space-2); }

.dashboard-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
}
.dashboard-toolbar .search {
  flex: 1;
  min-width: 240px;
  max-width: 360px;
  position: relative;
}
.dashboard-toolbar .search input {
  padding-left: 36px;
}
.dashboard-toolbar .search > svg.icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.filter-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.filter-chips .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  line-height: 1.4;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.filter-chips .chip:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.filter-chips .chip.active {
  background: var(--text-primary);
  color: var(--brand-on, #fff);
  border-color: var(--text-primary);
}
.filter-chips .chip-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 11.5px;
  color: inherit;
  opacity: 0.7;
}
.filter-chips .chip.active .chip-count { opacity: 0.9; }
.filter-chips .chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--dot-color, var(--text-muted));
  flex-shrink: 0;
}
.filter-chips .chip--pendiente  { --dot-color: #a8a29e; }
.filter-chips .chip--enviado    { --dot-color: #d97706; }
.filter-chips .chip--respondio  { --dot-color: #2563eb; }
.filter-chips .chip--interesado { --dot-color: #ea580c; }
.filter-chips .chip--ganado     { --dot-color: #16a34a; }
.filter-chips .chip--perdido    { --dot-color: #dc2626; }

.ws-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
}

.ws-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color 0.15s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
}
.ws-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.ws-card:hover { color: var(--text-primary); }

.ws-card-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #f5f5f4 0%, #e7e5e4 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.ws-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ws-card-thumb-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  text-align: center;
  padding: var(--space-4);
  line-height: 1.1;
}
.ws-card-status {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
}

.ws-card-body {
  padding: var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
}
.ws-card-body h3 {
  font-size: 17px;
  line-height: 1.25;
}
.ws-card-meta {
  display: flex;
  gap: var(--space-2);
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: var(--space-2);
}
.ws-card-meta .dot-sep { color: var(--border-strong); }

.ws-card-foot {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}
.ws-card-foot .quick-actions {
  display: flex;
  gap: var(--space-1);
}
.ws-card-foot .quick-actions a,
.ws-card-foot .quick-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: 30px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s var(--ease);
}
.ws-card-foot .quick-actions a:hover,
.ws-card-foot .quick-actions button:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}
.ws-card-foot .quick-actions form { margin: 0; display: inline; }

.pipeline-mini {
  display: flex;
  gap: 3px;
}
.pipeline-mini .step {
  width: 14px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.pipeline-mini .step.done { background: var(--success); }
.pipeline-mini .step.error { background: var(--danger); }
.pipeline-mini .step.running { background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }

/* ============================================================
   Legacy compat: existing workspace.html still uses these.
   Once the workspace-detail re-architecture lands (PR #2) these
   can be deleted.
   ============================================================ */

.preview { margin-top: var(--space-8); }
.preview h2 { margin-bottom: var(--space-3); }
.preview-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }
.preview-actions a[role="button"],
.preview-actions button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.preview-actions svg.icon { flex-shrink: 0; }
.preview .site-preview {
  width: 100%;
  height: 600px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}

.deploy-card {
  background: var(--success-tint);
  border: 1px solid color-mix(in srgb, var(--success) 22%, transparent);
  border-radius: var(--r-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.deploy-card a { color: var(--success); font-weight: 600; }

.banner-info {
  background: var(--brand-tint);
  border: 1px solid color-mix(in srgb, var(--brand) 20%, transparent);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--r-md);
  margin-bottom: var(--space-4);
}

.review-issues {
  background: var(--warn-tint);
  border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent);
  border-radius: var(--r-md);
  padding: var(--space-5);
  margin: var(--space-6) 0;
}
.review-issues h2 { font-size: 18px; }
.review-issues .issues-list { margin: var(--space-3) 0; }
.review-issues .issue { padding: var(--space-2) 0; border-bottom: 1px dashed color-mix(in srgb, var(--warn) 30%, transparent); }
.review-issues .issue:last-child { border-bottom: none; }
.review-issues .issue-msg { display: block; color: var(--text-secondary); font-size: 13px; }

.lead-editor summary,
.lead-raw summary,
.workspace-op summary {
  cursor: pointer;
  padding: var(--space-3);
  border-radius: var(--r-md);
}
.lead-editor summary:hover, .lead-raw summary:hover, .workspace-op summary:hover {
  background: var(--surface-2);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}

.iteration {
  margin-top: var(--space-8);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-6);
}

.workspace-ops {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--border);
}
.workspace-ops-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Batch tables (kept compat with PR #23 templates) */
.batch-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  margin-bottom: var(--space-3);
}
.batch-actions { display: flex; gap: var(--space-2); align-items: center; }
table.batch-table .truncate {
  max-width: 280px;
}
.job-row.job-running { background: var(--brand-tint) !important; }
.job-row.job-done { background: var(--success-tint) !important; }
.job-row.job-error { background: var(--danger-tint) !important; }
.job-row.job-skipped { color: var(--text-muted); }
small.job-error {
  color: var(--danger);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* Misc compat */
.slug { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.ok { color: var(--success); font-weight: 600; }
.err { color: var(--danger); font-weight: 600; }
.idle { color: var(--text-muted); }
.paused { color: var(--brand); font-weight: 600; }
mark {
  background: var(--brand-tint);
  color: var(--brand-hover);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12.5px;
}
hgroup p { color: var(--text-secondary); margin-top: var(--space-1); }

/* Site-iframe preview */
.site-preview {
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

/* Generic article (for legacy code paths) */
article {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--space-5);
}
article + article { margin-top: var(--space-4); }

/* For htmx polled regions to feel responsive */
section[hx-get] { transition: opacity 0.15s var(--ease); }
.htmx-request section[hx-get] { opacity: 0.7; }

/* Responsive */
@media (max-width: 720px) {
  .container { padding: var(--space-5) var(--space-4) var(--space-10); }
  h1 { font-size: 26px; }
  .dashboard-hero { flex-direction: column; }
  .ws-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Data panel — structured viewer of pipeline outputs
   ============================================================ */

.data-panel {
    margin: 2rem 0;
}
.data-panel-head { margin-bottom: 1rem; }
.data-panel-head h2 { margin: 0 0 0.25rem 0; }
.text-muted { color: var(--pico-muted-color, #6b7280); }
.text-sm { font-size: 0.85em; }

.data-card {
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
    border-radius: var(--pico-border-radius, 8px);
    background: var(--pico-card-background-color, #fff);
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.data-card[open] {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.data-card > summary {
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    user-select: none;
    list-style: none;
    font-weight: 500;
}
.data-card > summary::-webkit-details-marker { display: none; }
.data-card > summary::before {
    content: "▶";
    font-size: 0.7em;
    color: var(--pico-muted-color, #9ca3af);
    transition: transform 0.15s ease;
    width: 0.7em;
}
.data-card[open] > summary::before { transform: rotate(90deg); }
.data-card > summary:hover {
    background: color-mix(in srgb, var(--pico-primary, #d97706) 4%, transparent);
}
.data-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted, #71717a);
    margin-right: 4px;
}
.data-card-icon svg.icon { display: block; }
.data-card-title { font-weight: 700; }
.data-card-body {
    padding: 0.25rem 1.1rem 1.1rem 2rem;
    border-top: 1px solid var(--pico-card-border-color, #e5e7eb);
}
.data-card-raw .data-card-body pre {
    margin: 0.5rem 0 0;
    background: var(--pico-card-background-color, #f9fafb);
    border-radius: 6px;
    padding: 0.75rem;
    font-size: 0.8em;
    max-height: 400px;
    overflow: auto;
}

/* Key-value list for structured fields */
.kv {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.35rem 1.25rem;
    margin: 0.75rem 0;
}
.kv dt {
    font-weight: 600;
    color: var(--pico-muted-color, #6b7280);
    font-size: 0.85em;
    align-self: baseline;
}
.kv dd {
    margin: 0;
    word-break: break-word;
}
.kv code {
    font-size: 0.9em;
    background: color-mix(in srgb, var(--pico-primary, #d97706) 8%, transparent);
    padding: 1px 5px;
    border-radius: 3px;
}

/* Summary paragraph at the top of a card */
.data-summary {
    margin: 0.75rem 0;
    padding: 0.75rem 0.9rem;
    background: color-mix(in srgb, var(--pico-primary, #d97706) 5%, transparent);
    border-left: 3px solid var(--pico-primary, #d97706);
    border-radius: 0 6px 6px 0;
    font-size: 0.95em;
    line-height: 1.5;
}
.quote {
    margin: 0.5rem 0;
    font-style: italic;
    color: var(--pico-muted-color, #4b5563);
    border-left: 2px solid var(--pico-card-border-color, #d1d5db);
    padding-left: 0.75rem;
}
.big-quote {
    margin: 0.75rem 0;
    padding: 1rem 1.25rem;
    font-family: Georgia, serif;
    font-style: italic;
    font-size: 1.05em;
    line-height: 1.5;
    background: color-mix(in srgb, var(--pico-primary, #d97706) 4%, transparent);
    border-left: 3px solid var(--pico-primary, #d97706);
    border-radius: 0 6px 6px 0;
}

/* Chips group */
.data-chips {
    margin: 0.75rem 0;
}
.data-chips > strong {
    display: block;
    font-size: 0.85em;
    color: var(--pico-muted-color, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}
.chip-mini {
    display: inline-block;
    padding: 2px 9px;
    margin: 0 4px 4px 0;
    background: var(--pico-card-background-color, #f3f4f6);
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
    border-radius: 999px;
    font-size: 0.8em;
    font-weight: 500;
}
.chip-mini.accent {
    background: color-mix(in srgb, var(--pico-primary, #d97706) 12%, transparent);
    color: var(--pico-primary, #b45309);
    border-color: transparent;
}
.chip-mini.muted { color: var(--pico-muted-color, #9ca3af); }

.palette-swatch-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid var(--border, #e5e7eb);
    vertical-align: middle;
    margin-right: 4px;
}

/* Brand palette */
.palette-strip {
    display: inline-flex;
    gap: 0;
    border-radius: 999px;
    overflow: hidden;
    height: 18px;
    width: 90px;
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
}
.palette-strip span {
    flex: 1;
    height: 100%;
    display: block;
}
.palette-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.6rem;
    margin: 0.75rem 0;
}
.palette-swatch {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
    border-radius: 8px;
    overflow: hidden;
}
.palette-color {
    height: 56px;
    border-bottom: 1px solid var(--pico-card-border-color, #e5e7eb);
}
.palette-meta {
    padding: 0.45rem 0.65rem;
}
.palette-meta strong {
    display: block;
    font-size: 0.85em;
    color: var(--pico-muted-color, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.palette-meta code {
    font-size: 0.85em;
    background: transparent;
    padding: 0;
}

/* Rating pill in research summary header */
.rating-pill {
    margin-left: auto;
    background: color-mix(in srgb, gold 30%, transparent);
    color: #92400e;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.85em;
    font-weight: 600;
}
.rating-pill small { font-weight: 400; opacity: 0.7; }

/* Section flow (plan) */
.plan-sections { margin: 0.75rem 0; }
.plan-sections > strong {
    display: block;
    font-size: 0.85em;
    color: var(--pico-muted-color, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}
.section-flow {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.section-step {
    display: grid;
    grid-template-columns: max-content max-content 1fr;
    gap: 0.5rem;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--pico-card-background-color, #fafafa);
    border-radius: 6px;
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
}
.section-step code {
    font-weight: 700;
    background: transparent;
    padding: 0;
    font-size: 0.95em;
}
.section-step .section-angle {
    margin: 0;
    font-size: 0.88em;
    color: var(--pico-muted-color, #4b5563);
    grid-column: 3;
}
.section-step.excluded {
    opacity: 0.55;
    background: transparent;
}
.section-step .exclude-rationale {
    grid-column: 3;
    margin: 0.25rem 0 0;
    color: var(--pico-muted-color, #6b7280);
    font-style: italic;
}
.badge-mini {
    font-size: 0.75em;
    font-weight: 600;
    padding: 1px 7px;
    border-radius: 999px;
}
.badge-mini.ok { background: #dcfce7; color: #15803d; }
.badge-mini.muted { background: var(--pico-card-background-color, #f3f4f6); color: var(--pico-muted-color, #9ca3af); }

.bullet-list {
    list-style: disc;
    padding-left: 1.25rem;
    margin: 0.5rem 0;
}
.bullet-list li { margin-bottom: 0.3rem; line-height: 1.5; font-size: 0.92em; }

.nested {
    margin: 0.5rem 0;
    padding-left: 0.75rem;
    border-left: 2px solid var(--pico-card-border-color, #e5e7eb);
}
.nested > summary {
    cursor: pointer;
    font-size: 0.9em;
    color: var(--pico-muted-color, #4b5563);
    font-weight: 500;
    padding: 0.25rem 0;
}
.nested > summary:hover { color: var(--pico-primary, #d97706); }

/* Reviews list */
.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0.5rem 0;
}
.review-quote {
    background: color-mix(in srgb, var(--pico-primary, #d97706) 3%, transparent);
    border-left: 3px solid color-mix(in srgb, var(--pico-primary, #d97706) 40%, transparent);
    margin: 0;
    padding: 0.6rem 0.85rem;
    border-radius: 0 6px 6px 0;
}
.review-quote p { margin: 0; font-size: 0.92em; line-height: 1.5; }
.review-quote footer { margin-top: 0.3rem; }
.review-rating {
    font-size: 0.8em;
    color: #92400e;
    font-weight: 600;
    margin-right: 0.5rem;
}

/* Hours list */
.hours-list {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.2rem 1rem;
    margin: 0.4rem 0;
    font-size: 0.9em;
}
.hours-list dt { font-weight: 600; text-transform: capitalize; }
.hours-list dd { margin: 0; color: var(--pico-muted-color, #4b5563); }

/* Content sections accordions */
.content-sections {
    margin: 0.75rem 0 0.25rem;
}
.content-sections > strong {
    display: block;
    font-size: 0.85em;
    color: var(--pico-muted-color, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.4rem;
}
.content-section-body {
    padding: 0.5rem 0 0.25rem 0.5rem;
    font-size: 0.92em;
    line-height: 1.5;
}
.content-section-body .eyebrow {
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pico-primary, #d97706);
    font-weight: 700;
    margin: 0 0 0.3rem 0;
}

/* ============================================================
   Cost panel — estimated USD per workspace run
   ============================================================ */

.cost-panel {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: color-mix(in srgb, var(--pico-primary, #d97706) 4%, transparent);
    border-radius: var(--pico-border-radius, 8px);
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
}
.cost-panel-head h2 { margin: 0 0 0.25rem 0; font-size: 1.15em; }
.cost-panel-head p {
    margin: 0 0 1rem 0;
    color: var(--pico-muted-color, #6b7280);
    font-size: 0.88em;
    line-height: 1.5;
}
.cost-summary-card {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: var(--pico-card-background-color, #fff);
    padding: 1rem 1.25rem;
    border-radius: 8px;
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
    margin-bottom: 1rem;
}
.cost-summary-amount {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.cost-amount {
    font-size: 2em;
    font-weight: 700;
    color: var(--pico-primary, #d97706);
    line-height: 1;
}
.cost-summary-amount small {
    color: var(--pico-muted-color, #6b7280);
    font-size: 0.85em;
}
.cost-summary-meta {
    color: var(--pico-muted-color, #6b7280);
    text-align: right;
}
.cost-pre-run {
    background: var(--pico-card-background-color, #fff);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    color: var(--pico-muted-color, #6b7280);
    font-size: 0.9em;
}
table.cost-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--pico-card-background-color, #fff);
    border-radius: 6px;
    overflow: hidden;
    margin: 0;
    font-size: 0.9em;
}
table.cost-table th,
table.cost-table td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid var(--pico-card-border-color, #f3f4f6);
    text-align: left;
}
table.cost-table th {
    background: color-mix(in srgb, var(--pico-card-background-color, #fff) 70%, var(--pico-card-border-color, #f3f4f6));
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7em;
    letter-spacing: 0.06em;
    color: var(--pico-muted-color, #6b7280);
}
table.cost-table td.num,
table.cost-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.cost-table tfoot td {
    border-top: 1.5px solid var(--pico-card-border-color, #d1d5db);
    border-bottom: none;
    background: color-mix(in srgb, var(--pico-primary, #d97706) 5%, transparent);
}
.cost-pre-estimate,
.cost-history {
    margin-top: 1rem;
}
.cost-pre-estimate > summary,
.cost-history > summary {
    cursor: pointer;
    padding: 0.55rem 0.85rem;
    background: var(--pico-card-background-color, #fff);
    border: 1px solid var(--pico-card-border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 0.9em;
}
.cost-pre-estimate > summary:hover,
.cost-history > summary:hover {
    background: color-mix(in srgb, var(--pico-primary, #d97706) 5%, transparent);
}
.cost-pre-estimate[open] > summary,
.cost-history[open] > summary {
    border-radius: 6px 6px 0 0;
    border-bottom: none;
}
.cost-pre-estimate[open] table,
.cost-history[open] table {
    border-radius: 0 0 6px 6px;
}

/* ============================================================
   Instagram picker (checkpoint UI — `instagram_picker.html`)
   Restored after PR #26 rewrote styles.css and these rules
   were lost. Adapted to the new design system tokens.
   ============================================================ */

.ig-picker {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--brand-tint, #fef3c7);
    border-radius: var(--r-lg, 14px);
    border: 1px solid var(--border, #e7e5e4);
}
.ig-picker header h2 { margin: 0 0 0.5rem 0; }
.ig-picker header p {
    margin: 0;
    color: var(--text-secondary, #57534e);
}

.ig-bio {
    margin: 0.75rem 0 1rem 0;
    padding: 0.5rem 1rem;
    font-size: 0.9em;
    border-left: 3px solid var(--brand, #d97706);
    background: var(--surface, #ffffff);
    border-radius: 0 var(--r-sm, 6px) var(--r-sm, 6px) 0;
}

.ig-curator-note {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: var(--surface, #ffffff);
    border-radius: var(--r-md, 10px);
    border-left: 3px solid var(--brand, #d97706);
    font-size: 0.9em;
}
.ig-curator-note strong { display: block; margin-bottom: 0.25rem; }
.ig-curator-note p { margin: 0 0 0.3rem 0; }
.ig-curator-note small { color: var(--text-muted, #a8a29e); }

.ig-picker-controls {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 1rem;
    align-items: center;
    flex-wrap: wrap;
}
.ig-picker-controls button { margin: 0; }
.ig-picker-controls .primary { margin-left: auto; }

/* CRITICAL: without grid + aspect-ratio + object-fit, the picker
 * rendered IG photos at their natural ~1080x1080 each, blowing up
 * the page. PR #26 dropped these rules; this brings them back. */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.75rem;
}

.ig-tile {
    position: relative;
    cursor: pointer;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: var(--r-md, 10px);
    border: 2px solid transparent;
    background: var(--surface-2, #f5f5f4);
    margin: 0;
    transition: border-color 0.12s ease, transform 0.12s ease;
}
.ig-tile:hover { transform: translateY(-1px); }
.ig-tile:has(.ig-checkbox:checked) {
    border-color: var(--brand, #d97706);
    box-shadow: 0 0 0 2px var(--brand-tint, #fef3c7);
}

.ig-tile img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity 0.12s ease, filter 0.12s ease;
}
.ig-tile:has(.ig-checkbox:not(:checked)) img {
    opacity: 0.4;
    filter: grayscale(60%);
}

.ig-checkbox {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.5em;
    height: 1.5em;
    z-index: 2;
    cursor: pointer;
    accent-color: var(--brand, #d97706);
}

.ig-pick-badge {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 2;
    background: var(--brand, #d97706);
    color: white;
    padding: 0.18em 0.55em;
    border-radius: 1em;
    font-size: 0.72em;
    line-height: 1;
    pointer-events: none;
}

.ig-tile-curated {
    box-shadow: 0 0 0 2px var(--brand-tint, #fef3c7);
}

.ig-tile-overlay {
    position: absolute;
    inset: auto 0 0 0;
    padding: 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
    color: white;
    font-size: 0.76em;
    opacity: 0;
    transition: opacity 0.12s ease;
    pointer-events: none;
    max-height: 80%;
    overflow: hidden;
}
.ig-tile:hover .ig-tile-overlay { opacity: 1; }

.ig-caption,
.ig-rationale,
.ig-meta {
    display: block;
    color: white;
    margin-bottom: 0.18rem;
    line-height: 1.3;
}
.ig-rationale { font-style: italic; }
.ig-meta { opacity: 0.85; }

/* ============================================================
   Unified photo picker — IG + Maps sections
   ============================================================ */

.picker-source-title {
    margin: 1.5rem 0 0.75rem 0;
    font-size: 1.05em;
    font-weight: 700;
    color: var(--text-primary, #18181b);
    border-top: 1px solid var(--border, #e7e5e4);
    padding-top: 1rem;
}
.picker-source-title:first-of-type {
    border-top: none;
    padding-top: 0;
    margin-top: 0.5rem;
}
.picker-source-title small {
    font-weight: 500;
    color: var(--text-muted, #71717a);
    margin-left: 0.5rem;
}

/* Origin badge on each tile (IG / Maps) */
.ig-source-badge {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    z-index: 2;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: white;
    pointer-events: none;
    line-height: 1;
}
.ig-source-ig {
    background: linear-gradient(135deg, #833AB4, #E1306C, #F77737);
}
.ig-source-maps {
    background: #1A73E8;
}

/* ============================================================
   Preview viewport bar (iframe device-width simulation)
   ============================================================ */

.preview-viewport-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background: var(--surface-2, #f5f5f4);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    margin: 0.75rem 0;
    font-size: 13px;
}
.preview-viewport-bar small.text-muted a {
    color: var(--text-secondary, #57534e);
    text-decoration: underline;
    font-weight: 500;
}
.viewport-toggle {
    display: inline-flex;
    gap: 0.25rem;
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-sm, 6px);
    overflow: hidden;
    background: var(--surface, #fff);
}
.viewport-toggle .vp-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 4px 10px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary, #57534e);
    cursor: pointer;
    border-radius: 0;
    height: auto;
}
.viewport-toggle .vp-btn svg.icon { display: block; }
.viewport-toggle .vp-btn:hover {
    background: var(--surface-2, #f5f5f4);
}
.viewport-toggle .vp-btn.active {
    background: var(--text-primary, #18181b);
    color: var(--brand-on, #fff);
}

/* When iframe is sized to tablet/mobile, center it with a faux device frame */
iframe.site-preview {
    transition: width 0.2s ease, max-width 0.2s ease;
    display: block;
    margin: 0;
}

/* ============================================================
   Sales funnel — dashboard summary + pitch status card
   ============================================================ */

.funnel-summary {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}
.funnel-stat {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    padding: 12px 14px;
    text-align: left;
    transition: border-color 0.15s ease, background 0.15s ease;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 70px;
}
.funnel-stat:hover {
    border-color: var(--border-strong, #d6d3d1);
    background: var(--surface-2, #f5f5f4);
}
.funnel-stat.active {
    border-color: var(--text-primary, #18181b);
    background: var(--surface-2, #fafafa);
    box-shadow: 0 0 0 1px var(--text-primary, #18181b) inset;
}
.funnel-stat-num {
    font-family: var(--font-display, system-ui);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-primary, #18181b);
    font-variant-numeric: tabular-nums;
}
.funnel-stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, #57534e);
    font-weight: 500;
}
.funnel-stat-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--dot-color, var(--text-muted));
    flex-shrink: 0;
}
.funnel-stat--pendiente  { --dot-color: #a8a29e; }
.funnel-stat--enviado    { --dot-color: #d97706; }
.funnel-stat--respondio  { --dot-color: #2563eb; }
.funnel-stat--interesado { --dot-color: #ea580c; }
.funnel-stat--ganado     { --dot-color: #16a34a; }
.funnel-stat--perdido    { --dot-color: #dc2626; }

.chip-divider {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border, #e7e5e4);
    margin: 0 6px;
    user-select: none;
    vertical-align: middle;
}

/* Pitch-status badge that sits BELOW the technical status badge on a card */
.ws-card-pitch-status {
    position: absolute;
    top: calc(var(--space-3) + 28px);  /* tucked under the technical badge */
    right: var(--space-3);
}

/* Pitch status card on the workspace detail page */
.pitch-status-card {
    margin: 2rem 0;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-lg, 14px);
    padding: var(--space-5);
}
.pitch-status-head h2 { margin: 0 0 0.25rem 0; font-size: 1.1em; }
.pitch-status-head p {
    margin: 0 0 1rem 0;
    color: var(--text-muted, #71717a);
    font-size: 0.9em;
}
.pitch-status-form { display: flex; flex-direction: column; gap: 0.75rem; }
.pitch-status-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.pitch-status-row:has(textarea) { align-items: flex-start; }
.pitch-status-label {
    min-width: 80px;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-secondary, #57534e);
}
.pitch-status-select {
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--border-strong, #d6d3d1);
    border-radius: var(--r-sm, 6px);
    background: var(--surface, #fff);
    font-size: 0.95em;
    cursor: pointer;
    min-width: 180px;
}
.pitch-status-form textarea {
    flex: 1;
    min-width: 280px;
}
.pitch-status-form button.btn-brand,
.pitch-status-form button[class*="brand"] {
    background: var(--brand, #d97706);
    color: white;
    border: none;
    padding: 0.5rem 1.1rem;
    border-radius: var(--r-md, 10px);
    font-weight: 600;
    font-size: 0.92em;
    cursor: pointer;
    transition: background 0.15s ease;
}
.pitch-status-form button.btn-brand:hover {
    background: var(--brand-hover, #b45309);
}
.pitch-status-history {
    margin-top: 0.75rem;
    border-top: 1px solid var(--border, #e7e5e4);
    padding-top: 0.75rem;
}
.pitch-status-history > summary {
    cursor: pointer;
    font-size: 0.88em;
    color: var(--text-secondary, #57534e);
    font-weight: 500;
}
.pitch-history-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
    font-size: 0.88em;
    line-height: 1.6;
}
.pitch-history-list li {
    padding: 0.2rem 0;
    border-bottom: 1px dashed var(--border, #e7e5e4);
}
.pitch-history-list li:last-child { border-bottom: none; }

@media (max-width: 720px) {
    .funnel-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* WhatsApp send button — uses Meta's signature green */
.send-btn {
    background: #25D366 !important;
    color: white !important;
    border-color: #25D366 !important;
}
.send-btn:hover {
    background: #128C7E !important;
    color: white !important;
}

/* ============================================================
   Dashboard view toggle (cards / table)
   ============================================================ */

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    overflow: hidden;
    background: var(--surface, #fff);
}
.view-toggle .view-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    border: none;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #57534e);
    cursor: pointer;
    border-radius: 0;
}
.view-toggle .view-btn svg.icon { display: block; }
.view-toggle .view-btn:hover {
    background: var(--surface-2, #f5f5f4);
}
.view-toggle .view-btn.active {
    background: var(--text-primary, #18181b);
    color: var(--brand-on, #fff);
}

/* SVG icons: monochrome, inherit color, default vertical alignment for
   inline use inside buttons / links / list items. */
svg.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Shared icon button — used in card footers, table action columns,
   anywhere a touch-friendly affordance around a small SVG icon is needed. */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 30px;
    width: 30px;
    border-radius: var(--r-sm, 6px);
    color: var(--text-secondary, #57534e);
    text-decoration: none;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
    padding: 0;
}
.icon-btn:hover {
    background: var(--surface-2, #f5f5f4);
    color: var(--text-primary, #18181b);
    border-color: var(--border, #e7e5e4);
}
.icon-btn-danger:hover {
    background: var(--danger-tint, #fee2e2);
    color: var(--danger, #b91c1c);
    border-color: transparent;
}
.icon-btn-brand:hover {
    background: #25D366;
    color: #fff;
    border-color: transparent;
}
.icon-btn svg.icon { display: block; }

/* Pitch-status badge with leading color dot (no emoji, neutral background) */
.pitch-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.pitch-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--dot-color, currentColor);
    flex-shrink: 0;
}
.pitch-badge--pendiente  { --dot-color: #a8a29e; }
.pitch-badge--enviado    { --dot-color: #d97706; }
.pitch-badge--respondio  { --dot-color: #2563eb; }
.pitch-badge--interesado { --dot-color: #ea580c; }
.pitch-badge--ganado     { --dot-color: #16a34a; }
.pitch-badge--perdido    { --dot-color: #dc2626; }

/* Small inline icon-pin in row meta — keeps city label tight */
.row-city {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
}
.row-city svg.icon { opacity: 0.7; }

/* Pitch select tinting — left border in the dot color provides a quick
   visual cue without resorting to emoji prefixes in the option text. */
.row-pitch-select {
    border-left: 3px solid var(--dot-color, var(--border-strong));
}
.row-pitch-select--pendiente  { --dot-color: #a8a29e; }
.row-pitch-select--enviado    { --dot-color: #d97706; }
.row-pitch-select--respondio  { --dot-color: #2563eb; }
.row-pitch-select--interesado { --dot-color: #ea580c; }
.row-pitch-select--ganado     { --dot-color: #16a34a; }
.row-pitch-select--perdido    { --dot-color: #dc2626; }

/* Suggestion / danger-note replace previous emoji-prefixed paragraphs. */
.issue-suggestion {
    display: block;
    color: var(--text-secondary, #57534e);
    margin-top: 2px;
}
.danger-note {
    color: var(--danger, #b91c1c);
    font-weight: 500;
}

.job-notes {
    color: var(--text-secondary, #57534e);
}

/* ============================================================
   Dashboard table view — dense, sortable-feel rows
   ============================================================ */

table.ws-table-view {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-lg, 14px);
    overflow: hidden;
    font-size: 13.5px;
}
table.ws-table-view thead {
    background: var(--surface-2, #f5f5f4);
}
table.ws-table-view th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, #71717a);
    border-bottom: 1px solid var(--border, #e7e5e4);
    white-space: nowrap;
}
table.ws-table-view td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border, #f3f4f6);
    vertical-align: middle;
}
table.ws-table-view tbody tr:last-child td {
    border-bottom: none;
}
table.ws-table-view tbody tr:hover {
    background: var(--surface-2, #fafafa);
}

table.ws-table-view .col-thumb { width: 48px; padding-left: 0.75rem; }
table.ws-table-view .col-name { min-width: 200px; }
table.ws-table-view .col-pipeline { width: 130px; }
table.ws-table-view .col-pitch { width: 145px; }
table.ws-table-view .col-contact { width: 120px; }
table.ws-table-view .col-notes { min-width: 180px; max-width: 280px; }
table.ws-table-view .col-actions { width: 160px; text-align: right; }

.row-thumb {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm, 6px);
    overflow: hidden;
    background: var(--surface-2, #f5f5f4);
    border: 1px solid var(--border, #e7e5e4);
}
.row-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.row-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted, #a8a29e);
    font-size: 14px;
}

.row-name-link {
    text-decoration: none;
    color: var(--text-primary, #18181b);
}
.row-name-link:hover { color: var(--brand, #d97706); }
.row-name-link strong { font-size: 14px; }
.row-meta {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-muted, #a8a29e);
}
.row-meta code.slug {
    background: transparent;
    padding: 0;
    color: var(--text-muted, #a8a29e);
}

.row-state {
    margin-top: 4px;
}

.row-pitch-form { margin: 0; }
.row-pitch-select {
    padding: 0.3rem 0.5rem;
    font-size: 12.5px;
    border: 1px solid var(--border-strong, #d6d3d1);
    border-radius: var(--r-sm, 6px);
    background: var(--surface, #fff);
    cursor: pointer;
    width: 100%;
    max-width: 145px;
}

.contact-when {
    font-weight: 600;
    color: var(--text-primary, #18181b);
}
.contact-method {
    font-size: 11.5px;
    color: var(--text-muted, #71717a);
    margin-top: 1px;
}
.contact-empty {
    font-style: italic;
    color: var(--text-muted, #a8a29e);
    font-size: 12px;
}

.notes-preview {
    color: var(--text-secondary, #57534e);
    font-size: 12.5px;
    line-height: 1.4;
    cursor: help;
}

.row-actions {
    display: flex;
    gap: 2px;
    justify-content: flex-end;
    align-items: center;
}
.row-actions .icon-btn {
    height: 28px;
    width: 28px;
}

@media (max-width: 900px) {
    table.ws-table-view .col-thumb,
    table.ws-table-view .col-pipeline {
        display: none;
    }
}

/* ============================================================
   Kanban view — 6 funnel columns with drag-and-drop
   ============================================================ */

.ws-kanban {
    display: grid;
    grid-template-columns: repeat(6, minmax(180px, 1fr));
    gap: var(--space-3, 12px);
    align-items: start;
}

.kanban-col {
    background: var(--surface-2, #fafafa);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    min-height: 120px;
    display: flex;
    flex-direction: column;
}
.kanban-col-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px 8px;
    border-bottom: 1px solid var(--border, #e7e5e4);
}
.kanban-col-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--col-color, var(--text-muted));
    flex-shrink: 0;
}
.kanban-col-title {
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-primary, #18181b);
    flex: 1;
}
.kanban-col-count {
    font-size: 11.5px;
    color: var(--text-muted, #71717a);
    background: var(--surface, #fff);
    padding: 1px 7px;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
    min-width: 22px;
    text-align: center;
}

.kanban-col--pendiente   { --col-color: #a8a29e; }
.kanban-col--enviado     { --col-color: #d97706; }
.kanban-col--respondio   { --col-color: #2563eb; }
.kanban-col--interesado  { --col-color: #ea580c; }
.kanban-col--ganado      { --col-color: #16a34a; }
.kanban-col--perdido     { --col-color: #dc2626; }

.kanban-col-body {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    transition: background 0.12s ease;
    min-height: 60px;
}
.kanban-col-body.drop-active {
    background: color-mix(in srgb, var(--col-color, var(--text-muted)) 8%, var(--surface-2));
    outline: 2px dashed var(--col-color, var(--text-muted));
    outline-offset: -4px;
}

.kanban-col-empty {
    color: var(--text-muted, #a8a29e);
    text-align: center;
    padding: 12px;
    font-size: 12px;
    pointer-events: none;
}

.kanban-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-sm, 6px);
    padding: 8px 10px;
    cursor: grab;
    transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
    display: flex;
    flex-direction: column;
    gap: 5px;
    user-select: none;
}
.kanban-card:hover {
    border-color: var(--border-strong, #d6d3d1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.kanban-card.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(0.98);
}
.kanban-card-link {
    text-decoration: none;
    color: var(--text-primary, #18181b);
}
.kanban-card-link:hover { color: var(--brand, #d97706); }
.kanban-card-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
}
.kanban-card-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    font-size: 11px;
    color: var(--text-muted, #71717a);
}
.kanban-card-city {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}
.kanban-card-city svg.icon { opacity: 0.6; }
.kanban-card-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 999px;
    background: color-mix(in srgb, #16a34a 12%, transparent);
    color: #15803d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kanban-card-footer {
    font-size: 11px;
    color: var(--text-muted, #a8a29e);
    border-top: 1px dashed var(--border, #e7e5e4);
    padding-top: 4px;
}
.kanban-card-notes {
    font-size: 11.5px;
    color: var(--text-secondary, #57534e);
    line-height: 1.35;
}

@media (max-width: 1100px) {
    .ws-kanban {
        grid-template-columns: repeat(3, minmax(200px, 1fr));
        overflow-x: auto;
    }
}
@media (max-width: 720px) {
    .ws-kanban {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

/* ============================================================
   Proposal preview page (edit-before-send)
   ============================================================ */

.proposal-preview {
    max-width: 720px;
    margin: 0 auto;
}
.proposal-preview-head {
    margin-bottom: var(--space-5, 20px);
}
.proposal-preview-head h1 {
    margin: 6px 0 var(--space-3, 12px);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.01em;
}
.proposal-back {
    color: var(--text-muted, #71717a);
    text-decoration: none;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.proposal-back:hover { color: var(--brand, #d97706); }
.proposal-preview-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.proposal-form {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    padding: var(--space-5, 20px);
    margin: var(--space-4, 16px) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3, 12px);
}
.proposal-form label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary, #18181b);
}
.proposal-form textarea {
    font-family: var(--font-body, system-ui);
    font-size: 14px;
    line-height: 1.55;
    padding: 12px 14px;
    border: 1px solid var(--border-strong, #d6d3d1);
    border-radius: var(--r-sm, 6px);
    resize: vertical;
    min-height: 320px;
    background: var(--surface, #fff);
    color: var(--text-primary, #18181b);
}
.proposal-form textarea:focus {
    outline: 2px solid var(--brand, #d97706);
    outline-offset: -1px;
    border-color: var(--brand, #d97706);
}
.proposal-msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-top: -8px;
}
.proposal-char-count {
    font-variant-numeric: tabular-nums;
    color: var(--text-muted, #a8a29e);
}
.proposal-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    flex-wrap: wrap;
    padding-top: var(--space-3, 12px);
    border-top: 1px solid var(--border, #e7e5e4);
}
.proposal-actions small {
    flex: 1;
    min-width: 200px;
}

/* ============================================================
   Triage gate — pipeline checkpoint after Researcher
   ============================================================ */

.triage-gate {
    background: color-mix(in srgb, #f59e0b 6%, var(--surface, #fff));
    border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--border, #e7e5e4));
    border-radius: var(--r-lg, 14px);
    padding: var(--space-5, 20px);
    margin: var(--space-4, 16px) 0;
}
.triage-head {
    margin-bottom: var(--space-4, 16px);
}
.triage-head h2 {
    margin: 4px 0 8px;
    font-size: 22px;
    letter-spacing: -0.01em;
}
.triage-head .eyebrow {
    font-size: 11px;
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 0;
}
.triage-head p.text-muted {
    margin: 0;
    max-width: 70ch;
    font-size: 13.5px;
    line-height: 1.55;
}

.triage-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4, 16px);
    margin: var(--space-4, 16px) 0;
}
.triage-col {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    padding: var(--space-4, 16px);
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.triage-col-title {
    font-size: 11px;
    color: var(--text-muted, #a8a29e);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin: 0 0 4px;
}
.triage-col .kv {
    font-size: 13px;
}
.triage-col .kv dt {
    color: var(--text-muted, #a8a29e);
    font-size: 11.5px;
    font-weight: 600;
}
.triage-col .kv dd {
    margin: 0 0 6px;
}
.triage-miss {
    color: #b45309;
    font-style: italic;
    font-size: 12.5px;
}

.triage-rating {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border, #e7e5e4);
    margin-bottom: 4px;
}
.triage-rating-big {
    font-family: var(--font-display, system-ui);
    font-size: 32px;
    font-weight: 800;
    color: #b45309;
    line-height: 1;
}
.triage-rating-meta {
    color: var(--text-muted, #71717a);
    font-size: 13px;
}

.triage-summary {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary, #57534e);
    margin: 0 0 6px;
}
.triage-list {
    font-size: 12.5px;
    line-height: 1.5;
    margin: 0;
}
.triage-list strong {
    color: var(--text-muted, #71717a);
    font-weight: 600;
    margin-right: 4px;
}
.triage-no-data {
    color: var(--text-muted, #71717a);
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.triage-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3, 12px);
    flex-wrap: wrap;
    margin-top: var(--space-4, 16px);
    padding-top: var(--space-3, 12px);
    border-top: 1px solid color-mix(in srgb, #f59e0b 20%, var(--border));
}
.triage-actions form {
    margin: 0;
}
.btn-reject:hover {
    background: color-mix(in srgb, var(--danger, #dc2626) 12%, transparent) !important;
    color: var(--danger, #dc2626) !important;
    border-color: var(--danger, #dc2626) !important;
}
.triage-actions small {
    flex: 1;
    min-width: 200px;
}

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

/* ============================================================
   Conversion strip — funnel performance row above the dashboard
   ============================================================ */

.conversion-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3, 12px);
    align-items: stretch;
    padding: var(--space-3, 12px) var(--space-4, 16px);
    margin-bottom: var(--space-4, 16px);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
}
.conv-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 110px;
    padding-right: var(--space-4, 16px);
    border-right: 1px solid var(--border, #e7e5e4);
}
.conv-stat:last-child {
    border-right: none;
    padding-right: 0;
}
.conv-stat-label {
    font-size: 10.5px;
    color: var(--text-muted, #a8a29e);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
}
.conv-stat-value {
    font-family: var(--font-display, system-ui);
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary, #18181b);
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}
.conv-stat-sub {
    font-size: 11.5px;
    color: var(--text-muted, #71717a);
    font-variant-numeric: tabular-nums;
}
.conv-stat--warn .conv-stat-label { color: #b45309; }
.conv-stat--warn .conv-stat-value { color: #b45309; }

@media (max-width: 720px) {
    .conv-stat {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 6px 0;
        min-width: 0;
        flex: 1 1 45%;
    }
}

/* ============================================================
   Next Action panel — the operator's "what do I do now?" hero
   ============================================================
   Adaptive primary CTA based on workspace state. Six variants share
   the same skeleton; per-variant color tints (left-border accent)
   communicate the funnel stage at a glance. */

.next-action {
    display: flex;
    align-items: center;
    gap: var(--space-5, 20px);
    padding: var(--space-4, 16px) var(--space-5, 20px);
    margin-bottom: var(--space-5, 20px);
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-left: 4px solid var(--next-color, var(--brand, #d97706));
    border-radius: var(--r-md, 10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.next-action-body { flex: 1; min-width: 0; }
.next-action-body .eyebrow {
    font-size: 10.5px;
    color: var(--next-color, var(--brand));
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    margin: 0 0 4px;
}
.next-action-body h2 {
    margin: 0 0 8px;
    font-size: 22px;
    letter-spacing: -0.01em;
    line-height: 1.2;
}
.next-action-msg {
    margin: 0;
    color: var(--text-secondary, #57534e);
    font-size: 14px;
    line-height: 1.55;
    max-width: 70ch;
}
.next-action-msg a {
    color: var(--text-primary);
    text-decoration: underline;
    text-decoration-color: var(--border-strong);
    text-underline-offset: 2px;
}
.next-action-cta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.next-action .btn-lg {
    font-size: 14.5px;
    padding: 10px 18px;
    height: auto;
    min-height: 42px;
}

/* Per-state accent color */
.next-action--start    { --next-color: #d97706; }   /* amber — get started */
.next-action--running  { --next-color: #2563eb; }   /* blue — in motion */
.next-action--triage   { --next-color: #ea580c; }   /* orange — decision */
.next-action--blocked  { --next-color: #b45309; }   /* dark amber — caution */
.next-action--error    { --next-color: #dc2626; }   /* red */
.next-action--deploy   { --next-color: #d97706; }   /* amber */
.next-action--send     { --next-color: #16a34a; }   /* green — go */
.next-action--track    { --next-color: #2563eb; }   /* blue — monitoring */

/* When the variant is "send", paint the panel a soft green so it's
   visually unmistakable that it's go-time. */
.next-action--send {
    background: color-mix(in srgb, #16a34a 4%, var(--surface));
}
.next-action--running,
.next-action--triage,
.next-action--blocked,
.next-action--error {
    background: color-mix(in srgb, var(--next-color) 4%, var(--surface));
}

/* Secondary toolbar — smaller buttons after we promoted the Next
   Action primary CTA out of the header. */
.ws-hero-actions--secondary {
    gap: 4px;
    padding-top: 4px;
    border-top: 1px solid var(--border, #e7e5e4);
    margin-top: 12px;
}
.ws-hero-actions--secondary .btn-sm {
    font-size: 12px;
    padding: 4px 10px;
    height: 26px;
    color: var(--text-secondary);
    background: transparent;
}
.ws-hero-actions--secondary .btn-sm:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

@media (max-width: 720px) {
    .next-action {
        flex-direction: column;
        align-items: flex-start;
    }
    .next-action-cta {
        justify-content: flex-start;
        width: 100%;
    }
}

/* ============================================================
   Workspace detail page — compact header
   ============================================================
   Compact replacement for the old hgroup. Three rows: title bar,
   KPI tiles, action bar. Designed to fit in 280px tall so the actual
   landing preview is visible without scrolling. */

.ws-hero {
    margin-bottom: var(--space-6, 24px);
    padding-bottom: var(--space-5, 20px);
    border-bottom: 1px solid var(--border, #e7e5e4);
}
.ws-hero-titlebar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4, 16px);
    margin-bottom: var(--space-4, 16px);
}
.ws-hero-titleblock h1 {
    margin: 0 0 6px 0;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.01em;
}
.ws-hero-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
.ws-hero-chips code.slug {
    background: var(--surface-2, #f5f5f4);
    color: var(--text-muted, #71717a);
    font-size: 12px;
    padding: 2px 8px;
    border-radius: var(--r-sm, 6px);
}
.ws-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-secondary, #57534e);
    padding: 2px 8px;
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: 999px;
    line-height: 1.5;
}
.ws-chip svg.icon { opacity: 0.7; }
.ws-chip-rating {
    color: #b45309;
    border-color: color-mix(in srgb, #b45309 25%, var(--border));
    background: color-mix(in srgb, #b45309 6%, var(--surface));
}
.ws-chip-rating small { opacity: 0.75; margin-left: 2px; }

.btn-sm {
    font-size: 12.5px;
    padding: 4px 10px;
    height: 28px;
    gap: 4px;
}

/* KPI tiles row */
.ws-kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3, 12px);
    margin-bottom: var(--space-4, 16px);
}
.ws-kpi {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-md, 10px);
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    overflow: hidden;
    min-height: 78px;
}
.ws-kpi::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--kpi-color, var(--border-strong, #d6d3d1));
}
.ws-kpi-label {
    font-size: 11px;
    color: var(--text-muted, #a8a29e);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}
.ws-kpi-value {
    font-family: var(--font-display, system-ui);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #18181b);
    line-height: 1.2;
}
.ws-kpi-sub {
    font-size: 11.5px;
    color: var(--text-muted, #71717a);
    line-height: 1.3;
}
.ws-kpi-link {
    color: var(--text-secondary, #57534e);
    text-decoration: none;
}
.ws-kpi-link:hover { color: var(--brand, #d97706); }

/* Per-status accent stripe — left border in funnel color, mirroring
   the dashboard chip dots. */
.ws-kpi--ok          { --kpi-color: #16a34a; }
.ws-kpi--running     { --kpi-color: #2563eb; }
.ws-kpi--error       { --kpi-color: #dc2626; }
.ws-kpi--pending     { --kpi-color: #a8a29e; }
.ws-kpi--pendiente   { --kpi-color: #a8a29e; }
.ws-kpi--enviado     { --kpi-color: #d97706; }
.ws-kpi--respondio   { --kpi-color: #2563eb; }
.ws-kpi--interesado  { --kpi-color: #ea580c; }
.ws-kpi--ganado      { --kpi-color: #16a34a; }
.ws-kpi--perdido     { --kpi-color: #dc2626; }

/* Action bar (primary CTAs) */
.ws-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

@media (max-width: 900px) {
    .ws-kpis { grid-template-columns: repeat(2, 1fr); }
    .ws-hero-titlebar { flex-direction: column; }
}

/* Collapsible sections — used for Pipeline / Iterate / Data / Cost on
   the workspace detail page. Visually neutral when closed (just a line
   with the section name and a stat), expand to show full content. */
.ws-section {
    margin: var(--space-3, 12px) 0;
    border-top: 1px solid var(--border, #e7e5e4);
}
.ws-section > .ws-section-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3, 12px) 0;
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: opacity 0.1s ease;
}
.ws-section > .ws-section-summary::-webkit-details-marker { display: none; }
.ws-section > .ws-section-summary::before {
    content: "▸";
    color: var(--text-muted, #a8a29e);
    font-size: 10px;
    margin-right: 2px;
    transition: transform 0.15s ease;
    display: inline-block;
}
.ws-section[open] > .ws-section-summary::before {
    transform: rotate(90deg);
}
.ws-section > .ws-section-summary:hover {
    opacity: 0.75;
}
.ws-section-title {
    font-family: var(--font-display, system-ui);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #18181b);
    flex: 1;
    letter-spacing: -0.005em;
}
.ws-section-stat {
    font-size: 12.5px;
    color: var(--text-muted, #71717a);
    font-variant-numeric: tabular-nums;
}
.ws-section-stat .ok { color: #16a34a; font-weight: 600; }
.ws-section-stat .err { color: #dc2626; font-weight: 600; }
.ws-section-stat mark {
    background: color-mix(in srgb, #2563eb 12%, transparent);
    color: #2563eb;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 11.5px;
}

/* ─────────────────────────────────────────────────────────────
   Two-column workspace layout
   ─────────────────────────────────────────────────────────────
   Desktop: 55/45 split with sticky preview on the left.
   Mobile (<1100px): single column, preview at the top, no sticky. */
.ws-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(420px, 1fr);
    gap: var(--space-5, 20px);
    align-items: start;
}
.ws-layout-noprev {
    /* No site generated yet — let the side column take the whole row. */
    grid-template-columns: 1fr;
}
.ws-layout-preview {
    position: sticky;
    top: var(--space-4, 16px);
    align-self: start;
}
.ws-layout-preview .preview {
    margin-top: 0;
}
.ws-layout-side {
    min-width: 0; /* allow contents to shrink in a grid track */
}

/* Iframe inside the sticky column: tall enough to be useful, capped so
   it doesn't blow past the viewport. */
.ws-layout-preview .site-preview {
    height: calc(100vh - 140px);
    min-height: 520px;
    max-height: 820px;
}

@media (max-width: 1100px) {
    .ws-layout {
        grid-template-columns: 1fr;
    }
    .ws-layout-preview {
        position: static;
        order: -1; /* preview first on mobile */
    }
    .ws-layout-preview .site-preview {
        height: 560px;
        max-height: 560px;
    }
}

/* The included partial sections (preview, iteration, etc.) inside
   ws-section don't need their own h2 — the summary IS the title. Hide
   visually but keep for screen readers. */
.ws-section .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* When data/cost partials live inside ws-section, drop their own top
   margin so the spacing reads as one block. */
.ws-section > .data-panel,
.ws-section > .cost-panel,
.ws-section > .iteration {
    margin-top: 0;
}

/* ============================================================
   Login page — public-facing, no app shell
   ============================================================ */

.login-body {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(180deg, var(--surface, #fafafa) 0%, var(--surface-2, #f3f4f6) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-shell {
    width: 100%;
    max-width: 420px;
    padding: var(--space-6, 24px);
}
.login-card {
    background: var(--surface, #fff);
    border: 1px solid var(--border, #e7e5e4);
    border-radius: var(--r-lg, 14px);
    padding: var(--space-7, 28px) var(--space-6, 24px) var(--space-6, 24px);
    box-shadow:
        0 1px 3px rgba(0, 0, 0, 0.04),
        0 8px 32px rgba(0, 0, 0, 0.06);
}
.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary, #18181b);
    font-weight: 700;
    margin-bottom: var(--space-5, 20px);
}
.login-brand .dot {
    width: 9px;
    height: 9px;
    background: var(--brand, #d97706);
    border-radius: 999px;
    display: inline-block;
}
.login-title {
    margin: 0 0 var(--space-5, 20px);
    font-size: 22px;
    letter-spacing: -0.01em;
}
.login-error {
    background: color-mix(in srgb, var(--danger, #dc2626) 8%, var(--surface));
    border: 1px solid color-mix(in srgb, var(--danger, #dc2626) 25%, transparent);
    color: color-mix(in srgb, var(--danger, #dc2626) 90%, var(--text-primary));
    padding: 10px 14px;
    border-radius: var(--r-sm, 6px);
    font-size: 13.5px;
    margin-bottom: var(--space-4, 16px);
}
.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-4, 16px);
}
.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.login-field-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary, #57534e);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.login-field input {
    padding: 10px 14px;
    border: 1px solid var(--border-strong, #d6d3d1);
    border-radius: var(--r-sm, 6px);
    background: var(--surface, #fff);
    font-size: 15px;
    font-family: var(--font-body, system-ui);
    color: var(--text-primary, #18181b);
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.login-field input:focus {
    outline: none;
    border-color: var(--brand, #d97706);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 15%, transparent);
}
.login-submit {
    margin-top: 4px;
    width: 100%;
    justify-content: center;
}
.login-footnote {
    margin: var(--space-5, 20px) 0 0;
    padding-top: var(--space-4, 16px);
    border-top: 1px solid var(--border, #e7e5e4);
    font-size: 12.5px;
    color: var(--text-muted, #71717a);
    text-align: center;
    line-height: 1.5;
}
.login-footnote code {
    background: var(--surface-2, #f5f5f4);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11.5px;
}

