/* ==========================================================================
   SOBAT AGENT &bull; MUSE GATEWAY COMPACT OBSIDIAN & EMERALD DESIGN SYSTEM
   Inspired by SOBAT TOKEN Dashboard & Shadcn UI
   ========================================================================== */

:root {
  --bg-main: #080c0a;
  --bg-surface: #0f1512;
  --bg-surface-elevated: #141c18;
  --bg-card: #101613;
  --bg-input: #121915;
  --bg-hover: rgba(255, 255, 255, 0.04);
  
  --border-subtle: rgba(255, 255, 255, 0.07);
  --border-medium: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(16, 185, 129, 0.5);

  --emerald-primary: #10b981;
  --emerald-hover: #059669;
  --emerald-muted: rgba(16, 185, 129, 0.12);
  --emerald-border: rgba(16, 185, 129, 0.25);
  --emerald-glow: 0 0 16px rgba(16, 185, 129, 0.18);

  --text-main: #f3f4f6;
  --text-dim: #9ca3af;
  --text-muted: #6b7280;
  --text-emerald: #34d399;

  --amber-busy: #f59e0b;
  --amber-muted: rgba(245, 158, 11, 0.15);
  --red-error: #ef4444;
  --red-muted: rgba(239, 68, 68, 0.15);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --font-sans: 'Geist', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.45;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================================================
   TOAST NOTIFICATION
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--emerald-border);
  color: var(--text-main);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  z-index: 99999;
  animation: slideInToast 0.2s ease-out;
}
.toast-icon {
  color: var(--emerald-primary);
  font-weight: 700;
}
@keyframes slideInToast {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   LOCK SCREEN (PASSKEY GATEWAY)
   ========================================================================== */
.lock-screen-wrapper {
  position: fixed;
  inset: 0;
  background-color: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.lock-glow {
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.08) 0%, transparent 70%);
  pointer-events: none;
}
.lock-card {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.lock-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.lock-shield-badge {
  width: 38px;
  height: 38px;
  background: var(--emerald-muted);
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--emerald-primary);
  flex-shrink: 0;
}
.lock-title-block h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.lock-title-block p {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.lock-error-alert {
  background: var(--red-muted);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.lock-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lock-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.lock-input-wrap input {
  width: 100%;
  height: 38px;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 0 38px 0 12px;
  color: var(--text-main);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.lock-input-wrap input:focus {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.lock-eye-btn {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.lock-eye-btn:hover {
  color: var(--text-main);
}
.lock-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
}
.remember-check {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  cursor: pointer;
}
.remember-check input {
  accent-color: var(--emerald-primary);
}
.vps-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.lock-btn-primary {
  width: 100%;
  height: 38px;
  background: var(--emerald-primary);
  color: #042f1a;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 4px;
}
.lock-btn-primary:hover {
  background: var(--emerald-hover);
  color: #ffffff;
}

/* ==========================================================================
   APP MAIN SHELL & TOPBAR HEADER
   ========================================================================== */
.app-main {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh;
  width: 100% !important;
  background-color: var(--bg-main);
  position: relative;
}

.app-header {
  position: sticky;
  top: 0;
  height: 52px;
  width: 100% !important;
  background: rgba(13, 19, 16, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-medium);
  z-index: 100;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
.header-inner {
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
}
.brand-emerald-dot {
  width: 8px;
  height: 8px;
  background: var(--emerald-primary);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--emerald-primary);
}
.brand-text {
  display: flex;
  align-items: center;
  gap: 6px;
}
.brand-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}
.brand-sep {
  color: var(--text-muted);
  font-size: 12px;
}
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}
.badge-count {
  background: var(--emerald-muted);
  border: 1px solid var(--emerald-border);
  color: var(--text-emerald);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  font-family: var(--font-mono);
}

/* Center Segmented Tabs */
.nav-segmented-tabs {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.nav-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}
.nav-tab:hover {
  color: var(--text-main);
}
.nav-tab.active {
  background: var(--bg-surface-elevated);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
.nav-tab.active svg {
  stroke: var(--emerald-primary);
}

/* Right Controls */
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.quick-endpoint-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 11px;
  transition: all 0.15s ease;
}
.quick-endpoint-pill:hover {
  border-color: var(--emerald-border);
}
.endpoint-prefix {
  font-size: 9px;
  font-weight: 700;
  color: var(--emerald-primary);
  background: var(--emerald-muted);
  padding: 1px 4px;
  border-radius: 3px;
}
.quick-endpoint-pill code {
  color: var(--text-dim);
  font-size: 11px;
}
.copy-badge {
  font-size: 10px;
  color: var(--text-muted);
}
.btn-primary-compact {
  height: 28px;
  background: var(--emerald-primary);
  color: #042f1a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-primary-compact:hover {
  background: var(--emerald-hover);
  color: #ffffff;
}
.btn-icon-subtle {
  width: 28px;
  height: 28px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-icon-subtle:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* ==========================================================================
   APP BODY & VIEW PANELS
   ========================================================================== */
.app-body {
  flex: 1;
  width: 100% !important;
  max-width: 100% !important;
  padding: 18px 28px;
  display: flex;
  flex-direction: column;
}
.view-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
}

/* ==========================================================================
           VIEW 1: WORKERS & POOL (COMPACT METRICS + TABLE)
   ========================================================================== */
.dashboard-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Slim 4-Card KPI Row (Single Row) */
.kpi-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.kpi-val-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-val {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}
.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.live-dot-pulse {
  width: 6px;
  height: 6px;
  background: var(--emerald-primary);
  border-radius: 50%;
  animation: pulseDot 1.5s infinite;
}
@keyframes pulseDot {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 6px var(--emerald-primary); }
  100% { transform: scale(0.9); opacity: 0.7; }
}

/* Main Table Container Card */
.table-container-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.table-card-head {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.table-card-title h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.table-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}
.btn-secondary-compact {
  height: 26px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-secondary-compact:hover {
  color: var(--text-main);
  border-color: var(--emerald-border);
}

/* High-Density Compact Table */
.table-responsive-wrapper {
  overflow-x: auto;
}
.compact-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.compact-data-table th {
  background: rgba(255, 255, 255, 0.02);
  padding: 8px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
}
.compact-data-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-dim);
  vertical-align: middle;
}
.compact-data-table tr:last-child td {
  border-bottom: none;
}
.compact-data-table tr:hover td {
  background: var(--bg-hover);
}

/* Table Badges & Status */
.badge-slot-name {
  font-weight: 600;
  color: var(--text-main);
  font-size: 12px;
}
.badge-slot-id {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-dim);
}
.status-pill-idle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--emerald-muted);
  border: 1px solid var(--emerald-border);
  color: var(--text-emerald);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}
.status-pill-busy {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--amber-muted);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber-busy);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  text-transform: uppercase;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.compact-data-table td:last-child {
  text-align: right;
  white-space: nowrap;
}

.thread-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 11px;
  max-width: 500px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-link:hover {
  color: var(--emerald-primary);
}

/* Action Buttons in Table */
.btn-action-chat {
  height: 26px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.btn-action-chat:hover {
  border-color: var(--emerald-primary);
  color: var(--emerald-primary);
}
.btn-action-del {
  height: 26px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 6px;
  transition: all 0.15s ease;
}
.btn-action-del:hover {
  background: var(--red-muted);
  border-color: rgba(239, 68, 68, 0.5);
}

/* Collapsible Guide Accordion */
.compact-guide-accordion {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.compact-guide-accordion summary {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.compact-guide-accordion summary:hover {
  color: var(--text-dim);
}
.guide-accordion-body {
  padding: 0 14px 14px 14px;
}
.guide-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.guide-card-mini {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--text-muted);
}
.guide-card-mini strong {
  color: var(--text-dim);
  display: block;
  margin-bottom: 3px;
}
.guide-card-mini code {
  color: var(--emerald-primary);
  font-family: var(--font-mono);
}

/* ==========================================================================
           VIEW 2: PLAYGROUND CHAT & SANDBOX (INTEGRATED SPLIT)
   ========================================================================== */
.chat-workspace-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 14px;
  height: calc(100vh - 84px);
  min-height: 520px;
}

/* Left Slot Selector Column */
.chat-slot-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.slot-sidebar-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}
.worker-sidebar-list, .worker-list {
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.worker-card {
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.worker-card:hover {
  background: var(--bg-hover);
  border-color: var(--border-medium);
}
.worker-card.selected {
  background: var(--emerald-muted);
  border-color: var(--emerald-border);
}
.worker-top {
  display: flex;
  align-items: center;
  gap: 6px;
}
.worker-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.worker-pill {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-input);
  color: var(--text-muted);
}
.pulse-green {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--emerald-primary);
  box-shadow: 0 0 6px var(--emerald-primary);
  flex-shrink: 0;
}
.pulse-yellow {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber-busy);
  box-shadow: 0 0 6px var(--amber-busy);
  animation: pulseDot 1.2s infinite;
  flex-shrink: 0;
}
.pulse-red {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--red-error);
  box-shadow: 0 0 6px var(--red-error);
  flex-shrink: 0;
}
.worker-card.selected .worker-pill {
  background: var(--emerald-primary);
  color: #042f1a;
}
.worker-specs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-family: var(--font-mono);
}
.worker-delete-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
}
.worker-delete-btn:hover {
  color: #f87171;
}

/* Right Chat Area */
.chat-main-area {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-main-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-target-worker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

/* Messages Stream */
.messages-stream {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.chat-empty-compact {
  margin: auto;
  text-align: center;
  color: var(--text-muted);
  max-width: 320px;
}
.empty-icon {
  font-size: 28px;
  margin-bottom: 8px;
}
.empty-text h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
}
.empty-text p {
  font-size: 11px;
  margin-top: 4px;
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
  animation: fadeInMsg 0.15s ease-out;
}
@keyframes fadeInMsg {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.chat-msg.user {
  align-self: flex-end;
}
.chat-msg.assistant {
  align-self: flex-start;
}
.msg-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.chat-msg.user .msg-bubble {
  background: var(--emerald-muted);
  border: 1px solid var(--emerald-border);
  color: #e6fffa;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.chat-msg.assistant .msg-bubble {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-medium);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.msg-bubble pre {
  background: #060907;
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 10px;
  margin: 8px 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 11px;
}
.msg-bubble code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
}

/* Preset Chips Row */
.preset-chips-row {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.01);
}
.chips-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.chip-compact {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}
.chip-compact:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}

/* Chat Input Bar */
.chat-input-bar {
  padding: 10px 14px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
}
.input-inner-wrapper {
  display: flex;
  align-items: flex-end;
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  gap: 8px;
  transition: border-color 0.15s ease;
}
.input-inner-wrapper:focus-within {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.input-inner-wrapper textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}
.send-btn-compact {
  width: 28px;
  height: 28px;
  background: var(--emerald-primary);
  color: #042f1a;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.send-btn-compact:hover {
  background: var(--emerald-hover);
  color: #ffffff;
}
.chat-input-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
           VIEW 3: OPENAI ENDPOINT & INTEGRATION (COMPACT CARD)
   ========================================================================== */
.endpoint-container {
  display: flex;
  justify-content: center;
  padding: 10px 0;
}
.endpoint-card-compact {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  width: 100%;
  max-width: 800px;
}
.endpoint-head h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
}
.endpoint-head p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  margin-bottom: 16px;
}
.api-fields-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.api-field-box {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.api-field-box label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}
.copy-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.copy-input-row code {
  color: var(--text-main);
  font-size: 11px;
}
.btn-copy-mini {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: pointer;
}
.btn-copy-mini:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}
.code-preview-block {
  background: #050806;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.code-preview-header {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}
.code-preview-block pre {
  padding: 12px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #e5e7eb;
}

/* ==========================================================================
           MODAL: TAMBAH WORKER / AKUN (COMPACT DIALOG)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}
.modal-card-compact {
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  animation: modalPop 0.18s ease-out;
}
@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}
.modal-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header-icon {
  font-size: 20px;
}
.modal-title-wrap h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}
.modal-title-wrap p {
  font-size: 11px;
  color: var(--text-muted);
}
.modal-close-icon {
  background: transparent;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close-icon:hover {
  color: var(--text-main);
}
.modal-tabs-row {
  display: flex;
  padding: 8px 16px;
  background: var(--bg-input);
  border-bottom: 1px solid var(--border-subtle);
  gap: 6px;
}
.modal-tab-btn {
  flex: 1;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.15s ease;
  font-family: inherit;
}
.modal-tab-btn:hover {
  color: var(--text-main);
}
.modal-tab-btn.active {
  background: var(--bg-surface-elevated);
  border-color: var(--border-subtle);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.modal-card-body {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.form-item label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}
.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.badge-mini {
  font-size: 9px;
  font-family: var(--font-mono);
  background: var(--emerald-muted);
  color: var(--text-emerald);
  padding: 1px 5px;
  border-radius: 3px;
}
.form-item input, .form-item textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-main);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}
.form-item textarea {
  font-family: var(--font-mono);
  font-size: 11px;
  resize: vertical;
}
.form-item input:focus, .form-item textarea:focus {
  border-color: var(--emerald-primary);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.15);
}
.form-note {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.callout-mini {
  background: var(--emerald-muted);
  border: 1px solid var(--emerald-border);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #a7f3d0;
  line-height: 1.4;
}
.modal-alert-box {
  background: var(--red-muted);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  line-height: 1.4;
}
.modal-alert-box.success {
  background: var(--emerald-muted);
  border-color: var(--emerald-border);
  color: #a7f3d0;
}
.modal-alert-box.error {
  background: var(--red-muted);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* Automated Onboarding Pipeline Status Box */
.modal-pipeline-box {
  background: #061510;
  border: 1px solid var(--emerald-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.pipeline-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #6ee7b7;
  border-bottom: 1px solid rgba(16, 185, 129, 0.15);
  padding-bottom: 8px;
}
.pipeline-spin-icon {
  font-size: 14px;
  animation: spinSlow 3s linear infinite;
}
@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.pipeline-steps-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.pipeline-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: var(--text-muted);
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}
.pipeline-step-item .pipe-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.pipeline-step-item .pipe-text {
  flex: 1;
  word-break: break-word;
}
.pipeline-step-item.active {
  color: #ffffff;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
.pipeline-step-item.active .pipe-icon {
  background: var(--emerald-primary);
  border-color: var(--emerald-primary);
  color: #042f1a;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  animation: pulseDot 1s infinite alternate;
}
.pipeline-step-item.done {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.05);
}
.pipeline-step-item.done .pipe-icon {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}
.pipeline-step-item.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
}
.pipeline-step-item.error .pipe-icon {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.guide-grid-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.modal-card-footer {
  padding: 10px 16px;
  background: var(--bg-input);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.btn-modal-cancel {
  height: 30px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  font-size: 12px;
  cursor: pointer;
}
.btn-modal-cancel:hover {
  color: var(--text-main);
  border-color: var(--border-medium);
}
.btn-modal-submit {
  height: 30px;
  background: var(--emerald-primary);
  color: #042f1a;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-modal-submit:hover {
  background: var(--emerald-hover);
  color: #ffffff;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 900px) {
  .kpi-metrics-row {
    grid-template-columns: 1fr 1fr;
  }
  .chat-workspace-grid {
    grid-template-columns: 1fr;
  }
  .chat-slot-sidebar {
    height: 140px;
  }
  .api-fields-grid {
    grid-template-columns: 1fr;
  }
}
