/* ==========================================================================
   Workflow Constructor
   Dark corporate theme — same design system as programmable-payments-dashboard
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Variables (Flowt Design System)
   -------------------------------------------------------------------------- */

:root {
  --bg-primary:       #0f1419;
  --bg-secondary:     #1a202c;
  --bg-card:          rgba(255,255,255,0.06);
  --bg-card-hover:    rgba(255,255,255,0.10);
  --border-subtle:    rgba(255,255,255,0.08);
  --border-hover:     rgba(255,255,255,0.15);
  --text-primary:     #f7fafc;
  --text-secondary:   #a0aec0;
  --text-muted:       #718096;
  --accent-green:     #38a169;
  --accent-green-lt:  #68d391;
  --accent-blue:      #3182ce;
  --accent-orange:    #ed8936;
  --accent-purple:    #805ad5;
  --accent-red:       #e53e3e;
  --accent-gray:      #718096;
  --font-heading:     'Space Grotesk', -apple-system, sans-serif;
  --font-mono:        'IBM Plex Mono', 'SFMono-Regular', monospace;
  --font-body:        'Space Grotesk', -apple-system, sans-serif;
  --shadow-card:      0 4px 24px rgba(0,0,0,0.3);
  --shadow-lg:        0 18px 60px rgba(15,23,42,0.4);
  --radius-sm:        6px;
  --radius-md:        12px;
  --radius-lg:        20px;
  --transition:       0.3s cubic-bezier(0.4,0,0.2,1);
  --header-h:         56px;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */

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

html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

body {
  background-color: var(--bg-primary);
  font-family: var(--font-body);
  color: var(--text-primary);
  overflow: hidden;
  height: 100vh;
}

h1, h2, h3 { font-family: var(--font-heading); line-height: 1.2; }

button { cursor: pointer; border: none; font-family: inherit; }

input, textarea, select {
  font-family: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-blue);
}

/* --------------------------------------------------------------------------
   3. Backdrop
   -------------------------------------------------------------------------- */

.backdrop {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 50% at 10% 10%, rgba(49,130,206,0.08), transparent),
    radial-gradient(ellipse 50% 40% at 90% 15%, rgba(128,90,213,0.06), transparent),
    radial-gradient(ellipse 70% 50% at 50% 90%, rgba(56,161,105,0.04), transparent);
}

/* --------------------------------------------------------------------------
   4. View System
   -------------------------------------------------------------------------- */

.view {
  display: none;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.view.active { display: flex; }

/* --------------------------------------------------------------------------
   5. App Header
   -------------------------------------------------------------------------- */

.app-header {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(15,20,31,0.95);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 10;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
}

.brand-mark {
  font-weight: 700;
  font-size: 18px;
  color: var(--accent-green);
  letter-spacing: -0.5px;
}

.header-sep {
  color: var(--text-muted);
  font-size: 14px;
}

.header-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.workflow-name-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workflow-name-input {
  padding: 6px 10px;
  font-size: 13px;
  width: 200px;
  border-radius: var(--radius-sm);
}

.workflow-desc-input {
  width: 180px;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.input-params-bar {
  padding: 8px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255,255,255,0.02);
  flex-shrink: 0;
}

.input-params-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.input-params-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.input-params-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.input-param-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.input-param-input {
  padding: 4px 8px;
  font-size: 11px;
  width: 120px;
}

.input-param-input.param-key {
  width: 100px;
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   6. Buttons
   -------------------------------------------------------------------------- */

.btn-primary {
  background: var(--accent-green);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition), opacity var(--transition);
}

.btn-primary:hover:not(:disabled) { background: var(--accent-green-lt); color: #0f1419; }

.btn-primary:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background var(--transition), border-color var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--accent-red);
  color: #fff;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: background var(--transition), opacity var(--transition);
}
.btn-danger:hover { background: #fc5c65; }

.btn-icon {
  background: transparent;
  color: var(--text-muted);
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
  transition: color var(--transition), background var(--transition);
}

.btn-icon:hover { color: var(--text-primary); background: var(--bg-card-hover); }

.btn-icon.danger:hover { color: var(--accent-red); }

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.btn-sm:hover { background: var(--bg-card-hover); color: var(--text-primary); }

/* --------------------------------------------------------------------------
   7. Constructor Layout (3 columns)
   -------------------------------------------------------------------------- */

.constructor-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  overflow: hidden;
  transition: grid-template-columns 0.2s ease;
}

/* --------------------------------------------------------------------------
   8. Panel
   -------------------------------------------------------------------------- */

.panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border-subtle);
}

.panel:last-child { border-right: none; }

.panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}

.panel-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.panel-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.count-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   9. Palette (left panel)
   -------------------------------------------------------------------------- */

.palette-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.palette-list::-webkit-scrollbar { width: 4px; }
.palette-list::-webkit-scrollbar-track { background: transparent; }
.palette-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.palette-category {
  margin-bottom: 8px;
}

.palette-category-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 6px 6px 4px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
  margin-bottom: 2px;
}

.palette-item:hover { background: var(--bg-card-hover); }

.palette-item:active { background: rgba(255,255,255,0.12); }

.palette-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.9;
}

.palette-item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.palette-item-type {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Palette search */
.palette-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.palette-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.palette-no-matches {
  padding: 20px 12px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* Collapse button */
.btn-collapse {
  background: none;
  color: var(--text-muted);
  font-size: 16px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background var(--transition), color var(--transition);
}

.btn-collapse:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Collapsed panel states */
.panel-palette.collapsed,
.panel-config.collapsed {
  min-width: 0;
}

.panel-palette.collapsed .palette-list,
.panel-palette.collapsed .palette-search-wrap,
.panel-palette.collapsed .panel-subtitle,
.panel-config.collapsed .config-form {
  display: none;
}

.panel-palette.collapsed .panel-header,
.panel-config.collapsed .panel-header {
  writing-mode: vertical-lr;
  text-orientation: mixed;
  padding: 12px 8px;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  height: 100%;
}

.panel-palette.collapsed .panel-title,
.panel-config.collapsed .panel-title {
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   10. Step Builder (center panel)
   -------------------------------------------------------------------------- */

.step-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.step-list::-webkit-scrollbar { width: 4px; }
.step-list::-webkit-scrollbar-track { background: transparent; }
.step-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.step-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  position: relative;
}

.step-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.step-card.selected {
  border-color: var(--accent-blue);
  background: rgba(49,130,206,0.08);
}

.step-card.completed {
  border-color: var(--accent-green);
  background: rgba(56,161,105,0.08);
}

.step-card.failed {
  border-color: var(--accent-red);
  background: rgba(229,62,62,0.08);
}

.step-card.running {
  border-color: var(--accent-orange);
  background: rgba(237,137,54,0.08);
  animation: runningPulse 1.5s ease-in-out infinite;
}

@keyframes runningPulse {
  0%, 100% { border-color: var(--accent-orange); }
  50% { border-color: rgba(237,137,54,0.4); }
}

.step-number {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
  text-align: right;
}

.step-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-card-info { flex: 1; min-width: 0; }

.step-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.step-card-type {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.step-card-status {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

.step-card-status.completed { background: rgba(56,161,105,0.2); color: var(--accent-green-lt); }
.step-card-status.running   { background: rgba(237,137,54,0.2); color: var(--accent-orange); }
.step-card-status.failed    { background: rgba(229,62,62,0.2); color: var(--accent-red); }
.step-card-status.pending   { background: var(--bg-card); color: var(--text-muted); }
.step-card-status.awaiting_confirmation { background: rgba(128,90,213,0.2); color: var(--accent-purple); }

.step-card-actions {
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity var(--transition);
  flex-shrink: 0;
}

.step-card:hover .step-card-actions { opacity: 1; }

.step-card-drag-handle {
  cursor: grab;
  opacity: 0.3;
  font-size: 14px;
  user-select: none;
  flex-shrink: 0;
  transition: opacity var(--transition);
}

.step-card:hover .step-card-drag-handle { opacity: 0.7; }

.step-card.dragging {
  opacity: 0.4;
  border-style: dashed;
}

.step-card.drag-over-above {
  border-top: 2px solid var(--accent-blue);
}

.step-card.drag-over-below {
  border-bottom: 2px solid var(--accent-blue);
}

.step-card.has-errors {
  border-color: var(--accent-red);
  background: rgba(229,62,62,0.06);
}

.field-input.field-error,
.field-textarea.field-error {
  border-color: var(--accent-red);
}

.field-error-msg {
  font-size: 10px;
  color: var(--accent-red);
  margin-top: 3px;
  display: block;
}

/* --------------------------------------------------------------------------
   11. Config Form (right panel)
   -------------------------------------------------------------------------- */

.config-form {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

.config-form::-webkit-scrollbar { width: 4px; }
.config-form::-webkit-scrollbar-track { background: transparent; }
.config-form::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.config-step-header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.config-step-name-input {
  width: 100%;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.config-step-type {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.field-label .required {
  color: var(--accent-red);
  margin-left: 3px;
}

.field-input {
  width: 100%;
  padding: 7px 9px;
  font-size: 12px;
}

select.field-input {
  display: block;
}

.field-textarea {
  width: 100%;
  padding: 7px 9px;
  font-size: 12px;
  resize: vertical;
  min-height: 64px;
  line-height: 1.5;
}

.field-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.field-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--accent-blue);
}

.field-checkbox-label {
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* Variable hint chips */
.var-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.var-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  background: rgba(49,130,206,0.12);
  border: 1px solid rgba(49,130,206,0.25);
  color: var(--accent-blue);
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition);
  user-select: none;
}

.var-chip:hover { background: rgba(49,130,206,0.22); }

/* Outputs builder */
.outputs-builder { }

.outputs-list { margin-bottom: 8px; }

.output-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-bottom: 6px;
  position: relative;
}

.output-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.output-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.output-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.output-field-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 3px;
  display: block;
}

.output-input {
  width: 100%;
  padding: 5px 7px;
  font-size: 11px;
}

.add-output-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  width: 100%;
  justify-content: center;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  transition: border-color var(--transition), color var(--transition);
  cursor: pointer;
  font-family: inherit;
}

.add-output-btn:hover { border-color: var(--accent-blue); color: var(--accent-blue); }

/* --------------------------------------------------------------------------
   12. Empty State
   -------------------------------------------------------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  min-height: 120px;
  text-align: center;
  color: var(--text-muted);
  padding: 20px;
}

.empty-state p {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   13. Run Status
   -------------------------------------------------------------------------- */

.run-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.status-dot.running  { background: var(--accent-orange); animation: statusPulse 1s ease-in-out infinite; }
.status-dot.completed { background: var(--accent-green); }
.status-dot.failed   { background: var(--accent-red); }
.status-dot.pending  { background: var(--text-muted); }

@keyframes statusPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --------------------------------------------------------------------------
   14. Execution Layout
   -------------------------------------------------------------------------- */

.execution-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 340px;
  overflow: hidden;
  gap: 0;
}

.exec-main {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-subtle);
}

.exec-main .panel {
  border-right: none;
  height: 100%;
}

.exec-sidebar {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.exec-sidebar .panel {
  border-right: none;
}

/* --------------------------------------------------------------------------
   15. Swimlane SVG
   -------------------------------------------------------------------------- */

.swimlane-container {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: rgba(0,0,0,0.1);
}

.swimlane-container::-webkit-scrollbar { width: 6px; height: 6px; }
.swimlane-container::-webkit-scrollbar-track { background: transparent; }
.swimlane-container::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }

.swimlane-svg {
  display: block;
  overflow: visible;
}

/* SVG text styles */
.lane-label { font-family: 'Space Grotesk', sans-serif; }
.step-label { font-family: 'Space Grotesk', sans-serif; }

@keyframes nodeAppear {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes arrowDraw {
  from { stroke-dashoffset: 1000; }
  to   { stroke-dashoffset: 0; }
}

@keyframes nodeGlow {
  0%, 100% { filter: none; }
  50%       { filter: url(#glow); }
}

/* --------------------------------------------------------------------------
   16. Execution Log
   -------------------------------------------------------------------------- */

.exec-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}

.exec-log::-webkit-scrollbar { width: 4px; }
.exec-log::-webkit-scrollbar-track { background: transparent; }
.exec-log::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.log-entry {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 8px;
  overflow: hidden;
  animation: slideIn 0.3s ease;
}

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

.log-entry-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.log-entry-index {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  width: 20px;
  flex-shrink: 0;
}

.log-entry-icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.log-entry-info { flex: 1; min-width: 0; }

.log-entry-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.log-entry-type {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.log-status-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 6px;
  border-radius: 10px;
}

.log-status-chip.completed { background: rgba(56,161,105,0.2); color: var(--accent-green-lt); }
.log-status-chip.running   { background: rgba(237,137,54,0.2); color: var(--accent-orange); }
.log-status-chip.failed    { background: rgba(229,62,62,0.2); color: var(--accent-red); }
.log-status-chip.awaiting_confirmation { background: rgba(128,90,213,0.2); color: var(--accent-purple); }

.log-entry-body {
  padding: 0 10px 10px;
  border-top: 1px solid var(--border-subtle);
}

.log-output {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  margin-top: 8px;
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
  padding: 8px;
}

.log-error {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--accent-red);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
  margin-top: 8px;
  background: rgba(229,62,62,0.08);
  border-radius: 4px;
  padding: 8px;
}

/* --------------------------------------------------------------------------
   17. Tab Navigation
   -------------------------------------------------------------------------- */

.tab-nav {
  display: flex;
  gap: 2px;
  background: rgba(0,0,0,0.25);
  padding: 4px;
  border-radius: var(--radius-sm);
}

.tab-btn {
  padding: 5px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.tab-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}

/* --------------------------------------------------------------------------
   18. Workflows Browser View
   -------------------------------------------------------------------------- */

.workflows-browser-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  overflow: hidden;
}

/* List panel */

.wf-list-panel {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.wf-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.wf-list::-webkit-scrollbar { width: 4px; }
.wf-list::-webkit-scrollbar-track { background: transparent; }
.wf-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.wf-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  margin-bottom: 4px;
}

.wf-list-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.wf-list-item.selected {
  background: rgba(49,130,206,0.08);
  border-color: var(--accent-blue);
}

.wf-list-item-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  flex-shrink: 0;
}

.wf-list-item-dot.inactive { background: var(--text-muted); }

.wf-list-item-info { flex: 1; min-width: 0; }

.wf-list-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wf-list-item-meta {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Detail panel */

.wf-detail-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.wf-detail-panel > .empty-state {
  position: absolute;
  inset: 0;
}

.wf-detail {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.wf-detail.visible { display: flex; }

.wf-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}

.wf-detail-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.wf-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wf-name-heading {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0;
}

.wf-meta-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.wf-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 10px;
}

.wf-badge.active   { background: rgba(56,161,105,0.15); color: var(--accent-green); }
.wf-badge.inactive { background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border-subtle); }
.wf-badge.version  { background: var(--bg-card); color: var(--text-secondary); border: 1px solid var(--border-subtle); }
.wf-badge.date     { color: var(--text-muted); }

/* Workflow flow layout (swimlane + sidebar) */

.wf-flow-layout        { flex: 1; display: grid; grid-template-columns: 1fr 300px; overflow: hidden; }
.wf-swimlane-wrap      { display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border-subtle); }
.wf-swimlane-container { flex: 1; overflow: auto; padding: 16px; background: rgba(0,0,0,0.1); }
.wf-flow-sidebar       { display: flex; flex-direction: column; overflow: hidden; }
.wf-sidebar-content    { flex: 1; overflow-y: auto; padding: 12px; }

.wf-swimlane-container::-webkit-scrollbar { width: 6px; height: 6px; }
.wf-swimlane-container::-webkit-scrollbar-track { background: transparent; }
.wf-swimlane-container::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 3px; }

.wf-sidebar-content::-webkit-scrollbar { width: 4px; }
.wf-sidebar-content::-webkit-scrollbar-track { background: transparent; }
.wf-sidebar-content::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

/* Step config key/value rows */
.wf-config-row   { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border-subtle); }
.wf-config-key   { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--text-muted); margin-bottom: 3px; }
.wf-config-value { font-size: 12px; font-family: var(--font-mono); color: var(--text-secondary); word-break: break-all; }

/* Run rows in sidebar */
.wf-run-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); cursor: pointer; margin-bottom: 4px; }
.wf-run-row:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }

.wf-run-status-chip {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}

.wf-run-status-chip.completed { background: rgba(56,161,105,0.2); color: var(--accent-green-lt); }
.wf-run-status-chip.running   { background: rgba(237,137,54,0.2);  color: var(--accent-orange); }
.wf-run-status-chip.failed    { background: rgba(229,62,62,0.2);   color: var(--accent-red); }
.wf-run-status-chip.pending   { background: var(--bg-card);        color: var(--text-muted); border: 1px solid var(--border-subtle); }
.wf-run-status-chip.awaiting_confirmation { background: rgba(128,90,213,0.2); color: var(--accent-purple); }

.wf-run-id {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wf-run-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   18. Toast / Error Banner
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1e2533;
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform 0.3s ease;
  max-width: 480px;
  text-align: center;
}

.toast.visible { transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--accent-red); color: var(--accent-red); }

/* --------------------------------------------------------------------------
   19. Templates Modal
   -------------------------------------------------------------------------- */

.templates-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.templates-modal {
  max-width: 800px;
  width: 90%;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.templates-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.templates-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.templates-modal-body {
  overflow-y: auto;
  padding: 16px 20px;
}

.templates-modal-body::-webkit-scrollbar { width: 4px; }
.templates-modal-body::-webkit-scrollbar-track { background: transparent; }
.templates-modal-body::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

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

.template-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-blue);
  background: var(--bg-card-hover);
}

.template-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.template-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 10px;
}

.template-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.template-badge {
  font-size: 10px;
  font-family: var(--font-mono);
  padding: 2px 7px;
  border-radius: 10px;
  font-weight: 500;
}

.template-badge.steps {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.template-badge.wallet   { background: rgba(49,130,206,0.15);  color: #3182ce; }
.template-badge.identity { background: rgba(237,137,54,0.15);  color: #ed8936; }
.template-badge.currency { background: rgba(128,90,213,0.15);  color: #805ad5; }
.template-badge.utility  { background: rgba(113,128,150,0.15); color: #718096; }

/* --------------------------------------------------------------------------
   Currencies tab
   -------------------------------------------------------------------------- */

.currencies-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 16px;
}

.currencies-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.currencies-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 1;
}

.currencies-table tbody tr {
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition);
}

.currencies-table tbody tr:hover {
  background: var(--bg-card-hover);
}

.currencies-table tbody td {
  padding: 10px 12px;
  color: var(--text-primary);
  vertical-align: middle;
}

.currency-type-badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: capitalize;
}

.currency-type-native     { background: rgba(56,161,105,0.15);  color: var(--accent-green); }
.currency-type-token      { background: rgba(49,130,206,0.15);  color: var(--accent-blue); }
.currency-type-fractional { background: rgba(128,90,213,0.15);  color: var(--accent-purple); }

.currency-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.currency-supply {
  font-family: var(--font-mono);
  font-size: 12px;
}

.currencies-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.currencies-search {
  width: 180px;
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.currencies-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition);
}

.currencies-table thead th[data-sort]:hover {
  color: var(--text-primary);
}

.sort-arrow {
  font-size: 10px;
  margin-left: 2px;
}

.currencies-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px 0;
  flex-shrink: 0;
}

.currencies-page-info {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Clients Tab
   -------------------------------------------------------------------------- */

.clients-browser-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  overflow: hidden;
}

/* List panel */

.cl-list-panel {
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cl-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.cl-list::-webkit-scrollbar { width: 4px; }
.cl-list::-webkit-scrollbar-track { background: transparent; }
.cl-list::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.cl-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  margin-bottom: 4px;
}

.cl-list-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-subtle);
}

.cl-list-item.selected {
  background: rgba(49,130,206,0.08);
  border-color: var(--accent-blue);
}

.cl-list-item-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cl-list-item-status.pending,
.cl-list-item-status.commitment_sent,
.cl-list-item-status.commitment_confirmed { background: var(--accent-orange); }
.cl-list-item-status.registered            { background: var(--accent-green); }
.cl-list-item-status.failed                { background: var(--accent-red); }

.cl-list-item-info { flex: 1; min-width: 0; }

.cl-list-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cl-list-item-sub {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-top: 2px;
}

/* Detail panel */

.cl-detail-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.cl-detail-panel > .empty-state {
  position: absolute;
  inset: 0;
}

.cl-detail {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.cl-detail.visible { display: flex; }

.cl-detail-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: rgba(255,255,255,0.02);
}

.cl-detail-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.cl-detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cl-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.cl-detail-body::-webkit-scrollbar { width: 4px; }
.cl-detail-body::-webkit-scrollbar-track { background: transparent; }
.cl-detail-body::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

/* Info grid */

.cl-info-section {
  margin-bottom: 24px;
}

.cl-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 0;
}

.cl-info-item-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.cl-info-item-value {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  word-break: break-all;
}

.cl-info-item-value.error {
  color: var(--accent-red);
}

/* Balances */

.cl-balances-section {
  margin-bottom: 24px;
}

.cl-balances-content {
  padding: 12px 0;
}

.cl-balances-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cl-balances-table th {
  text-align: left;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}

.cl-balances-table td {
  padding: 8px 12px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}

.cl-balances-table td:last-child {
  font-family: var(--font-mono);
  text-align: right;
}

.empty-state-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px;
}

/* Client status badge */

.cl-status-badge {
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 2px 8px;
  border-radius: 10px;
}

.cl-status-badge.pending,
.cl-status-badge.commitment_sent,
.cl-status-badge.commitment_confirmed {
  background: rgba(237,137,54,0.15);
  color: var(--accent-orange);
}

.cl-status-badge.registered {
  background: rgba(56,161,105,0.15);
  color: var(--accent-green);
}

.cl-status-badge.failed {
  background: rgba(229,62,62,0.15);
  color: var(--accent-red);
}

/* Allocation rows in create modal */

.alloc-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.alloc-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.alloc-row select {
  flex: 1;
  padding: 7px 9px;
  font-size: 12px;
}

.alloc-row input {
  width: 120px;
  padding: 7px 9px;
  font-size: 12px;
}

.alloc-row .btn-icon {
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Define Currency Modal
   -------------------------------------------------------------------------- */

.define-currency-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.define-currency-modal {
  max-width: 520px;
  width: 90%;
  max-height: 80vh;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.define-currency-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.define-currency-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.define-currency-modal-body {
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.define-currency-modal-body::-webkit-scrollbar { width: 4px; }
.define-currency-modal-body::-webkit-scrollbar-track { background: transparent; }
.define-currency-modal-body::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.define-currency-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.dc-basket-section {
  margin-top: 4px;
}

.dc-lookup-wrapper {
  position: relative;
}

.dc-lookup-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-top: none;
  border-radius: 0 0 6px 6px;
  z-index: 100;
}

.dc-lookup-dropdown.open {
  display: block;
}

.dc-lookup-item {
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
}

.dc-lookup-item:hover,
.dc-lookup-item.active {
  background: rgba(128,90,213,0.12);
}

.dc-lookup-empty {
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-tertiary);
}

.dc-basket-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.dc-basket-reserve-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dc-basket-contrib-input {
  width: 140px;
  flex-shrink: 0;
}

.dc-basket-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  background: rgba(128,90,213,0.12);
  border: 1px solid rgba(128,90,213,0.25);
  color: var(--accent-purple);
  padding: 3px 8px;
  border-radius: 4px;
}

.dc-basket-chip button {
  background: none;
  border: none;
  color: var(--accent-purple);
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--transition);
}

.dc-basket-chip button:hover {
  opacity: 1;
}

.distribute-mode-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.distribute-mode-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.distribute-mode-btn.active {
  background: rgba(49, 130, 206, 0.15);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.distribute-mode-btn:hover:not(.active) {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.distribute-total-row {
  margin-bottom: 8px;
}

.distribute-sum {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  margin-top: 6px;
}

.distribute-sum-ok {
  color: #48bb78;
  background: rgba(72, 187, 120, 0.1);
}

.distribute-sum-err {
  color: #fc8181;
  background: rgba(252, 129, 129, 0.1);
}

.dc-prealloc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.dc-prealloc-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dc-prealloc-row .field-input { flex: 1; }
.dc-prealloc-row .field-input.prealloc-amount { max-width: 100px; }

.dc-advanced {
  margin-top: 4px;
}

.dc-advanced-toggle {
  font-size: 12px;
  color: var(--text-tertiary);
  cursor: pointer;
  user-select: none;
}

.dc-advanced-toggle:hover {
  color: var(--text-secondary);
}

.dc-advanced-body {
  margin-top: 8px;
}

.dc-error {
  font-size: 12px;
  color: var(--accent-red);
  padding: 8px 10px;
  background: rgba(229,62,62,0.08);
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.dc-progress {
  margin-top: 12px;
}

.dc-progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.dc-progress-fill {
  height: 100%;
  background: var(--accent-purple);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}

.dc-progress-step {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   API Key Button
   -------------------------------------------------------------------------- */

.api-key-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
  margin-left: auto;
}

.api-key-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.api-key-status {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-red);
}

.api-key-status.connected {
  background: var(--accent-green);
}

/* --------------------------------------------------------------------------
   API Key Gate
   -------------------------------------------------------------------------- */

.api-key-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
}

.api-key-gate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  width: 360px;
  max-width: 90vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.api-key-gate-icon {
  color: var(--text-muted);
}

.api-key-gate-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.api-key-gate-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0;
}

.api-key-gate .field-input {
  width: 100%;
  text-align: center;
}

.api-key-gate .btn-primary {
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Client Picker
   -------------------------------------------------------------------------- */

.client-picker-wrap {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}

.client-picker-btn {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  padding: 4px 7px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.client-picker-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
  color: var(--accent-blue);
}

.client-picker-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  min-width: 220px;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
}

.client-picker-dropdown::-webkit-scrollbar { width: 4px; }
.client-picker-dropdown::-webkit-scrollbar-track { background: transparent; }
.client-picker-dropdown::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 2px; }

.client-picker-item {
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-picker-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
