/* =====================================================
   Wireframe popover system + low-fi component primitives
   ===================================================== */

/* ---------- Popover container ---------- */
.wf-popover {
  position: fixed;
  z-index: 1000;
  width: 520px;
  max-height: 80vh;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(15,23,42,0.18), 0 4px 12px rgba(15,23,42,0.06);
  padding: 0;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}
.wf-popover.show {
  opacity: 1;
  transform: translateY(0);
}

/* Popover header strip */
.wf-popover-head {
  background: var(--bg-elev);
  border-bottom: 1px solid var(--rule);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.wf-popover-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 600;
}
.wf-popover-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}
.wf-popover-sub {
  margin-left: auto;
  font-size: 11px;
  color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}

/* Popover body — wireframe lives here */
.wf-popover-body {
  padding: 14px;
  background: #FAFBFC;
}

.wf-popover-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--rule);
  font-size: 11px;
  color: var(--ink-mute);
  background: white;
  line-height: 1.5;
}
.wf-popover-foot strong { color: var(--ink-soft); }

/* ---------- Wireframe primitives ---------- */
/* Goal: low-fi, monochrome with one mint accent.
   Convey IA & key elements without committing to a visual design. */

.wf {
  font-family: 'Inter', sans-serif;
  background: white;
  border: 1px solid #D8DDE4;
  border-radius: 6px;
  overflow: hidden;
  font-size: 11px;
  color: #4A5568;
}

/* Layout: full app shell */
.wf-shell { display: grid; grid-template-columns: 80px 1fr; min-height: 280px; }
.wf-shell.no-sidebar { grid-template-columns: 1fr; }
.wf-shell-sidebar {
  background: #F4F5F7;
  border-right: 1px solid #E5E7EB;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.wf-shell-main {
  display: flex;
  flex-direction: column;
}
.wf-shell-topbar {
  height: 30px;
  border-bottom: 1px solid #E5E7EB;
  background: white;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.wf-shell-content {
  padding: 14px 16px;
  flex: 1;
  background: #FCFCFC;
}

/* Sidebar nav items — gray bars */
.wf-nav { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 3px; }
.wf-nav.active { background: #D1FAE5; }
.wf-nav.active .wf-bar { background: #10B981; }
.wf-nav.active .wf-icon { background: #10B981; }
.wf-nav-cta { background: #10B981; color: white; padding: 5px 8px; border-radius: 4px; font-size: 9px; font-weight: 600; text-align: center; margin-bottom: 6px; }

/* Generic gray bar (text placeholder) */
.wf-bar { background: #CBD5E0; height: 6px; border-radius: 2px; flex: 1; }
.wf-bar.short { max-width: 40%; }
.wf-bar.med { max-width: 65%; }
.wf-bar.tall { height: 9px; }
.wf-bar.dark { background: #94A3B8; }

/* Icon placeholder — small box */
.wf-icon { width: 14px; height: 14px; background: #94A3B8; border-radius: 3px; flex-shrink: 0; }
.wf-icon.sm { width: 10px; height: 10px; }
.wf-icon.lg { width: 22px; height: 22px; }
.wf-icon.mint { background: #10B981; }
.wf-icon.circle { border-radius: 50%; }

/* Topbar primitives */
.wf-search {
  background: #F4F5F7;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  padding: 4px 8px;
  flex: 1;
  font-size: 10px;
  color: #94A3B8;
  display: flex;
  align-items: center;
  gap: 6px;
}
.wf-avatar { width: 18px; height: 18px; background: #10B981; border-radius: 50%; color: white; font-size: 8px; display: flex; align-items: center; justify-content: center; font-weight: 600; }

/* Headings inside content */
.wf-h1 { font-size: 16px; font-weight: 600; color: #1E293B; margin: 0 0 4px; }
.wf-h2 { font-size: 13px; font-weight: 600; color: #1E293B; margin: 0 0 4px; }
.wf-mute { font-size: 10px; color: #94A3B8; margin: 0 0 12px; }

/* Buttons */
.wf-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid #D8DDE4;
  color: #1E293B;
  font-size: 10px;
  padding: 5px 10px;
  border-radius: 4px;
  font-weight: 500;
}
.wf-btn.primary { background: #10B981; color: white; border-color: #10B981; }
.wf-btn.ghost { border-color: transparent; background: transparent; color: #64748B; }
.wf-btn.sm { font-size: 9px; padding: 3px 7px; }

/* Inputs */
.wf-input {
  background: white;
  border: 1px solid #D8DDE4;
  border-radius: 4px;
  padding: 6px 9px;
  font-size: 10px;
  color: #94A3B8;
  width: 100%;
  display: block;
}
.wf-input.tall { padding: 9px 11px; }
.wf-textarea {
  background: white;
  border: 1px solid #D8DDE4;
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 10px;
  color: #94A3B8;
  min-height: 60px;
  width: 100%;
}

/* Cards */
.wf-card {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 5px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.wf-card.tinted { background: #ECFDF5; border-color: #BBF7D0; }
.wf-card.hover { border-color: #10B981; }

/* Tags / pills / badges */
.wf-tag {
  display: inline-block;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #F4F5F7;
  color: #64748B;
  font-weight: 500;
}
.wf-tag.mint { background: #D1FAE5; color: #047857; }
.wf-tag.warn { background: #FEF3C7; color: #B45309; }
.wf-tag.crit { background: #FEE2E2; color: #B91C1C; }
.wf-tag.live::before { content: '●'; color: #10B981; margin-right: 4px; }

/* Layout helpers */
.wf-row { display: flex; align-items: center; gap: 8px; }
.wf-row.between { justify-content: space-between; }
.wf-col { display: flex; flex-direction: column; gap: 6px; }
.wf-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wf-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.wf-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.wf-stack { display: flex; flex-direction: column; gap: 8px; }
.wf-stack.tight { gap: 4px; }
.wf-stack.lg { gap: 12px; }
.wf-divider { height: 1px; background: #E5E7EB; margin: 4px 0; }
.wf-hr-vert { width: 1px; background: #E5E7EB; align-self: stretch; }

/* KPI tile */
.wf-kpi {
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 5px;
  padding: 8px 10px;
}
.wf-kpi .label { font-size: 8px; text-transform: uppercase; letter-spacing: 0.12em; color: #94A3B8; }
.wf-kpi .val { font-size: 16px; font-weight: 700; color: #0F172A; font-family: 'JetBrains Mono', monospace; }
.wf-kpi .delta { font-size: 8px; color: #10B981; }
.wf-kpi .delta.neg { color: #DC2626; }

/* Sparkline-ish */
.wf-spark {
  width: 100%;
  height: 22px;
  background: linear-gradient(180deg, transparent 0%, #ECFDF5 100%);
  border-radius: 3px;
  position: relative;
  overflow: hidden;
}
.wf-spark::after {
  content: '';
  position: absolute;
  bottom: 6px; left: 0; right: 0;
  height: 1px;
  background: #10B981;
  clip-path: polygon(0 0, 8% 30%, 16% 10%, 24% 50%, 32% 25%, 40% 60%, 48% 35%, 56% 70%, 64% 40%, 72% 80%, 80% 50%, 88% 90%, 100% 65%, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #10B981 0%, transparent 100%);
}

/* Table */
.wf-table {
  width: 100%;
  background: white;
  border: 1px solid #E5E7EB;
  border-radius: 4px;
  overflow: hidden;
}
.wf-thead {
  background: #F4F5F7;
  display: grid;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 600;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  gap: 8px;
  border-bottom: 1px solid #E5E7EB;
}
.wf-tr {
  display: grid;
  padding: 6px 8px;
  font-size: 10px;
  gap: 8px;
  border-bottom: 1px solid #F4F5F7;
  align-items: center;
}
.wf-tr:last-child { border-bottom: none; }
.wf-tr:nth-child(even) { background: #FCFCFC; }
.wf-num { font-family: 'JetBrains Mono', monospace; color: #0E84B8; font-weight: 500; }

/* Chat bubble */
.wf-bubble {
  background: #F4F5F7;
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 10px;
  color: #4A5568;
  max-width: 75%;
}
.wf-bubble.user { background: #10B981; color: white; align-self: flex-end; }
.wf-bubble.ai { align-self: flex-start; background: white; border: 1px solid #E5E7EB; }

/* Step indicator (for execution flow) */
.wf-steps { display: flex; align-items: center; gap: 4px; }
.wf-step {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  flex: 1;
}
.wf-step-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #E5E7EB; color: #94A3B8;
  font-size: 8px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.wf-step.done .wf-step-dot { background: #10B981; color: white; }
.wf-step.active .wf-step-dot { background: #10B981; color: white; box-shadow: 0 0 0 3px #ECFDF5; animation: pulse 1.6s ease-in-out infinite; }
.wf-step-line { height: 1px; background: #E5E7EB; flex: 1; margin-top: 8px; }
.wf-step-line.done { background: #10B981; }
.wf-step-label { font-size: 8px; color: #64748B; text-align: center; }

/* Canvas / node-based */
.wf-canvas {
  background:
    radial-gradient(circle, #E5E7EB 1px, transparent 1px) 0 0 / 14px 14px,
    white;
  border: 1px dashed #D8DDE4;
  border-radius: 5px;
  padding: 14px;
  min-height: 130px;
  position: relative;
}
.wf-node {
  background: white;
  border: 1px solid #D8DDE4;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 9px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
}
.wf-node.input { border-color: #10B981; background: #ECFDF5; }
.wf-node.output { border-color: #0E84B8; background: #E0F2FE; }

/* File chip */
.wf-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #F4F5F7;
  border: 1px solid #E5E7EB;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 9px;
}

/* Empty state placeholder */
.wf-empty {
  text-align: center;
  padding: 16px 8px;
  color: #94A3B8;
}
.wf-empty .wf-icon { margin: 0 auto 8px; }

/* Toggle switch */
.wf-switch {
  display: inline-block;
  width: 22px; height: 12px;
  background: #10B981;
  border-radius: 8px;
  position: relative;
}
.wf-switch::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  background: white;
  border-radius: 50%;
  top: 2px; right: 2px;
}
.wf-switch.off { background: #CBD5E0; }
.wf-switch.off::after { right: auto; left: 2px; }

/* Misc */
.wf-strong { color: #0F172A; font-weight: 600; }
.wf-muted { color: #94A3B8; }
.wf-mint { color: #10B981; font-weight: 600; }
.wf-tabs { display: flex; gap: 8px; border-bottom: 1px solid #E5E7EB; padding: 0 0 0 0; margin: 0 0 8px 0; }
.wf-tab { padding: 4px 8px; font-size: 10px; color: #64748B; border-bottom: 2px solid transparent; }
.wf-tab.active { color: #10B981; border-bottom-color: #10B981; font-weight: 600; }
