/* ============================================================
   COMPONENTS.CSS — Reusable UI components
   ============================================================ */

/* ---- Live indicator ---- */
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success, #10b981);
  margin-left: 6px;
  vertical-align: middle;
  animation: live-pulse 2s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.65); }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap; line-height: 1; text-decoration: none; outline: none;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.btn-primary   { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }
.btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn-danger    { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; border-color: #dc2626; }
.btn-ghost     { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-sm  { padding: 5px 12px; font-size: 12.5px; }
.btn-lg  { padding: 11px 22px; font-size: 15px; }
.btn-icon{ padding: 7px; }

.btn-spinner {
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4); border-top-color: white;
  border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0;
}
.btn-secondary .btn-spinner, .btn-ghost .btn-spinner {
  border-color: rgba(0,0,0,0.15); border-top-color: var(--text-primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 20px 24px; box-shadow: var(--shadow-sm);
}
.card-sm { padding: 14px 18px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title  { font-size: 0.9375rem; font-weight: 600; }

.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 24px; box-shadow: var(--shadow-sm); }
.stat-card-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 8px; }
.stat-card-value { font-size: 1.875rem; font-weight: 700; color: var(--text-primary); line-height: 1; }

/* ---- Tables ---- */
.table-wrapper { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-wrapper-inner { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 10px 16px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); white-space: nowrap; text-align: left; }
tbody td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; font-size: 13.5px; }
tbody tr:hover td { background: var(--bg-hover); }
tbody tr:first-child td { border-top: none; }

.table-agent-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); object-fit: cover; }
.table-agent-icon-placeholder { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--brand-primary-light); display: flex; align-items: center; justify-content: center; color: var(--brand-primary); font-size: 12px; font-weight: 700; flex-shrink: 0; }
.table-link { color: var(--brand-primary); font-weight: 500; cursor: pointer; }
.table-link:hover { text-decoration: underline; }

.table-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--bg-secondary); }
.table-info { font-size: 12.5px; color: var(--text-muted); }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--radius-full); font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1.4; }
.badge-active   { background: var(--success-bg); color: var(--success-text); }
.badge-pending  { background: var(--warning-bg); color: var(--warning-text); }
.badge-disabled { background: var(--danger-bg);  color: var(--danger-text);  }
.badge-info     { background: var(--info-bg);     color: var(--info-text);    }
.badge-neutral  { background: #f1f5f9; color: var(--text-secondary); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; gap: 4px; }
.page-btn { min-width: 32px; height: 32px; padding: 0 8px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; color: var(--text-secondary); font-size: 12.5px; font-weight: 500; cursor: pointer; transition: all var(--transition-fast); }
.page-btn:hover:not(:disabled) { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.page-btn.active { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Modals ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 16px; backdrop-filter: blur(2px); }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius-lg); padding: 28px 32px 32px; width: min(580px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-xl); animation: modal-in 0.18s ease; }
.modal-lg { width: min(780px, 100%); }
.modal-sm { width: min(420px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(-10px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title  { font-size: 1.1rem; font-weight: 700; }
.modal-close  { background: none; border: none; cursor: pointer; padding: 4px; color: var(--text-muted); border-radius: var(--radius-sm); display: flex; align-items: center; transition: all var(--transition-fast); }
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ---- Forms ---- */
.form-group { margin-bottom: 18px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.form-label-optional { font-weight: 400; color: var(--text-muted); font-size: 11.5px; margin-left: 4px; }
.form-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.form-input,
input[type="text"], input[type="url"], input[type="email"], input[type="number"],
input[type="password"], input[type="tel"], input[type="date"], select, textarea {
  display: block; width: 100%; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text-primary); background: white;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast); outline: none;
}
.form-input:focus,
input[type="text"]:focus, input[type="url"]:focus, input[type="email"]:focus,
input[type="number"]:focus, input[type="password"]:focus, input[type="tel"]:focus,
input[type="date"]:focus, select:focus, textarea:focus {
  border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-muted); }
textarea { resize: vertical; min-height: 80px; }
textarea.tall { min-height: 160px; }
select { cursor: pointer; }
.form-input:disabled, input:disabled, select:disabled, textarea:disabled {
  opacity: 0.55; cursor: not-allowed; background: var(--bg-secondary);
}
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

.input-group { position: relative; }
.agent-id-indicator { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 12px; font-weight: 600; }
.agent-id-indicator.available   { color: var(--success); }
.agent-id-indicator.unavailable { color: var(--danger); }
.agent-id-indicator.checking    { color: var(--text-muted); }

/* ---- Tabs ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { flex-shrink: 0; padding: 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--text-secondary); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; cursor: pointer; transition: color var(--transition-fast), border-color var(--transition-fast); white-space: nowrap; }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); font-weight: 600; }
.tab-btn.tab-error { color: var(--danger); border-bottom-color: var(--danger); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---- Skeleton ---- */
@keyframes skeleton-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}
.skeleton {
  background: linear-gradient(90deg, var(--skeleton-base) 25%, var(--skeleton-shine) 50%, var(--skeleton-base) 75%);
  background-size: 1200px 100%; animation: skeleton-shimmer 1.6s infinite linear; border-radius: var(--radius-sm);
}

/* ---- Toast ---- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; background: white; border: 1px solid var(--border); border-left: 3px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); font-size: 13.5px; max-width: 360px; pointer-events: all; animation: toast-in 0.22s ease; }
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger);  }
.toast.info    { border-left-color: var(--info);    }
.toast.warning { border-left-color: var(--warning); }
@keyframes toast-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
.toast-icon  { flex-shrink: 0; margin-top: 1px; }
.toast-body  { flex: 1; }
.toast-title { font-weight: 600; color: var(--text-primary); }
.toast-msg   { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.toast-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0 0 0 8px; font-size: 16px; line-height: 1; flex-shrink: 0; }

/* ---- Empty & Error states ---- */
.empty-state, .error-state { padding: 48px 24px; text-align: center; }
.empty-state-icon, .error-state-icon { width: 48px; height: 48px; margin: 0 auto 16px; color: var(--text-muted); opacity: 0.5; }
.empty-state-title, .error-state-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-msg, .error-state-msg { font-size: 13px; color: var(--text-muted); max-width: 320px; margin: 0 auto; }

/* ---- Multi-step form ---- */
.steps-indicator { display: flex; align-items: center; margin-bottom: 32px; overflow-x: auto; scrollbar-width: none; }
.steps-indicator::-webkit-scrollbar { display: none; }
.step-item { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.step-circle { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); background: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-muted); transition: all var(--transition-base); }
.step-item.active .step-circle    { border-color: var(--brand-primary); background: var(--brand-primary); color: white; }
.step-item.completed .step-circle { border-color: var(--success); background: var(--success); color: white; }
.step-label { font-size: 12.5px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.step-item.active .step-label    { color: var(--brand-primary); font-weight: 600; }
.step-item.completed .step-label { color: var(--success); }
.step-connector { flex: 1; min-width: 20px; height: 2px; background: var(--border); margin: 0 6px; flex-shrink: 0; transition: background var(--transition-base); }
.step-connector.completed { background: var(--success); }
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ---- Markdown editor ---- */
.md-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.md-editor:focus-within { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); }
.md-toolbar { display: flex; gap: 2px; padding: 6px 8px; background: var(--bg-secondary); border-bottom: 1px solid var(--border); }
.md-tab-btn { padding: 4px 12px; font-size: 12px; font-weight: 500; border: none; background: none; border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); transition: all var(--transition-fast); }
.md-tab-btn.active { background: white; color: var(--brand-primary); font-weight: 600; box-shadow: var(--shadow-sm); }
.md-tab-btn:hover:not(.active) { background: var(--bg-hover); color: var(--text-primary); }
.md-editor textarea { border: none !important; border-radius: 0 !important; box-shadow: none !important; min-height: 120px; resize: vertical; font-family: 'SFMono-Regular', Consolas, monospace; font-size: 13px; }
.md-editor textarea:focus { box-shadow: none !important; border-color: transparent !important; }
.md-preview { display: none; padding: 12px 16px; min-height: 120px; font-size: 13.5px; line-height: 1.7; }
.md-preview.active { display: block; }
.md-preview h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 12px; }
.md-preview h2 { font-size: 1.1rem; font-weight: 600; margin: 16px 0 8px; }
.md-preview h3 { font-size: 0.95rem; font-weight: 600; margin: 12px 0 6px; }
.md-preview p  { margin: 0 0 10px; }
.md-preview ul { padding-left: 20px; margin-bottom: 10px; list-style: disc; }
.md-preview ol { padding-left: 20px; margin-bottom: 10px; list-style: decimal; }
.md-preview li { margin-bottom: 4px; }
.md-preview code { background: var(--bg-secondary); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12px; }
.md-preview pre { background: var(--bg-secondary); padding: 12px 16px; border-radius: var(--radius-sm); overflow-x: auto; font-family: monospace; font-size: 12.5px; margin-bottom: 10px; border: 1px solid var(--border); }
.md-preview pre code { background: none; padding: 0; }
.md-preview strong { font-weight: 700; }
.md-preview em { font-style: italic; }
.md-preview hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.md-preview blockquote { border-left: 3px solid var(--border-strong); padding-left: 12px; color: var(--text-secondary); margin: 0 0 10px; }
.md-preview a { color: var(--brand-primary); }

/* ---- Custom Multi-select ---- */
.multiselect { position: relative; }
.multiselect-trigger { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; font-size: 13.5px; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: space-between; transition: border-color var(--transition-fast); user-select: none; }
.multiselect-trigger:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); outline: none; }
.multiselect-trigger.has-value { color: var(--text-primary); }
.multiselect.open .multiselect-trigger { border-color: var(--border-focus); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.multiselect-dropdown { display: none; position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid var(--border-focus); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 200px; overflow-y: auto; }
.multiselect.open .multiselect-dropdown { display: block; }
.multiselect-option { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; font-size: 13.5px; transition: background var(--transition-fast); }
.multiselect-option:hover { background: var(--bg-hover); }
.multiselect-option input[type="checkbox"] { width: auto; padding: 0; margin: 0; cursor: pointer; }
.multiselect-option.selected { background: var(--brand-primary-light); }
.multiselect-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pill { display: inline-flex; align-items: center; gap: 5px; background: var(--brand-primary-light); color: var(--brand-primary-dark); padding: 3px 8px 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 500; }
.pill-remove { background: none; border: none; cursor: pointer; padding: 0; color: var(--brand-primary); font-size: 14px; line-height: 1; display: flex; align-items: center; }
.pill-remove:hover { color: var(--brand-primary-dark); }

/* ---- Tag input (autocomplete) ---- */
.tag-input-wrap { position: relative; }
.tag-input-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-input-pills:empty { margin-top: 0; }
.tag-input-field { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; background: white; transition: border-color var(--transition-fast); }
.tag-input-field:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(99,102,241,0.12); outline: none; }
.tag-input-dropdown { display: none; position: absolute; left: 0; right: 0; background: white; border: 1px solid var(--border-focus); border-top: none; border-radius: 0 0 var(--radius-sm) var(--radius-sm); box-shadow: var(--shadow-md); z-index: 50; max-height: 200px; overflow-y: auto; }
.tag-input-option { padding: 8px 12px; cursor: pointer; font-size: 13.5px; transition: background var(--transition-fast); }
.tag-input-option:hover { background: var(--bg-hover); }
.tag-input-option:first-child { background: var(--bg-hover); }
.tag-input-custom { color: var(--brand-primary); }

/* ---- Function cards ---- */
.function-cards-row { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.function-card { flex-shrink: 0; width: 260px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-sm); }
.function-card-name { font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.function-card-meta { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.function-card-add { flex-shrink: 0; width: 120px; min-height: 100px; background: var(--bg-secondary); border: 2px dashed var(--border-strong); border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 16px; cursor: pointer; color: var(--text-muted); font-size: 12.5px; transition: all var(--transition-fast); }
.function-card-add:hover { border-color: var(--brand-primary); color: var(--brand-primary); background: var(--brand-primary-light); }

/* ---- Chart container ---- */
.chart-container { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); }
.chart-title { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 12px; }
canvas.bar-chart { width: 100% !important; display: block; }
.charts-grid { display: grid !important; grid-template-columns: repeat(2, 1fr) !important; gap: 20px; }
@media (max-width: 700px) { .charts-grid { grid-template-columns: 1fr; } }

/* ---- Agent hero ---- */
.agent-hero { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm); }
.agent-hero-inner { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.agent-hero-icon { width: 64px; height: 64px; border-radius: var(--radius-md); flex-shrink: 0; background: var(--brand-primary-light); display: flex; align-items: center; justify-content: center; color: var(--brand-primary); font-size: 24px; font-weight: 700; }
.agent-hero-info { flex: 1; min-width: 200px; }
.agent-hero-name { font-size: 1.25rem; font-weight: 700; }
.agent-hero-id   { font-size: 12.5px; color: var(--text-muted); font-family: monospace; margin-top: 2px; }
.agent-hero-meta { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 12px; }
.agent-hero-stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.agent-hero-stat-value { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-top: 2px; }

/* ---- Health badge (small inline pill next to the agent name) ---- */
.health-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 9999px;
  border: 1px solid transparent;
  vertical-align: middle;
  white-space: nowrap;
  cursor: help;
}
.health-badge i { font-size: 10px; }
.health-badge--warned   { background: rgba(245,158,11,0.12); color: #f59e0b; border-color: rgba(245,158,11,0.35); }
.health-badge--disabled { background: rgba(239, 68, 68,0.12); color: #ef4444; border-color: rgba(239, 68, 68,0.35); }

/* ---- Health panel (right column of the agent hero card) ---------------------
   Fills the empty right side of the basic-info card with a focused warning
   block instead of a banner above the card. Two variants share the layout:
     .agent-health-panel--warned  → amber, "heads up" pre-suspension
     .agent-health-panel--disabled → red, post-suspension
   On narrow screens it wraps below the info column via the parent's
   flex-wrap. */
.agent-health-panel {
  flex: 0 0 280px;
  margin-left: auto;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12.5px;
  line-height: 1.45;
}
.agent-health-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.agent-health-panel-title i { font-size: 14px; }
.agent-health-panel-msg     { margin: 0; }
.agent-health-panel-reason  { margin: 0; font-style: italic; opacity: 0.85; }
.agent-health-panel-action  { margin: 0; font-size: 12px; opacity: 0.9; }
.agent-health-panel-action a { color: inherit; text-decoration: underline; }
.agent-health-panel-action code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.12);
}
.agent-health-panel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px 10px;
  margin: 4px 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.85);
}
.agent-health-panel-stats div { display: flex; flex-direction: column; }
.agent-health-panel-stats dt {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.75;
}
.agent-health-panel-stats dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.agent-health-panel--warned {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.35);
  color: #f59e0b;
}
.agent-health-panel--disabled {
  background: rgba(239, 68, 68,0.08);
  border-color: rgba(239, 68, 68,0.35);
  color: #ef4444;
}

/* ---- Version list ---- */
.version-list { display: flex; flex-direction: column; gap: 10px; }
.version-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); cursor: pointer; transition: all var(--transition-fast); gap: 12px; }
.version-row:hover { border-color: var(--brand-primary); box-shadow: var(--shadow-md); }
.version-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--brand-primary-light); color: var(--brand-primary-dark); padding: 4px 12px; border-radius: var(--radius-full); font-size: 12.5px; font-weight: 600; font-family: monospace; }
.version-meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.version-meta-item { font-size: 12.5px; color: var(--text-secondary); }

/* ---- Notifications ---- */
.notification-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 10px; cursor: pointer; transition: all var(--transition-fast); display: flex; gap: 14px; align-items: flex-start; }
.notification-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.notification-card.unread { background: #fafbff; border-left: 3px solid var(--brand-primary); }
.notification-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand-primary); flex-shrink: 0; margin-top: 5px; }
.notification-read-dot   { width: 8px; height: 8px; flex-shrink: 0; }
.notification-body   { flex: 1; }
.notification-title  { font-weight: 600; font-size: 13.5px; }
.notification-msg    { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; line-height: 1.5; }
.notification-time   { font-size: 11.5px; color: var(--text-muted); flex-shrink: 0; margin-top: 2px; }

/* ---- Payout cards ---- */
.payout-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.payout-card-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--brand-primary-light); display: flex; align-items: center; justify-content: center; color: var(--brand-primary); flex-shrink: 0; }
.payout-card-type   { font-weight: 600; font-size: 13.5px; text-transform: capitalize; }
.payout-card-number { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; font-family: monospace; }

/* ---- Editable table ---- */
.editable-table { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.editable-table table { margin: 0; }
.editable-table td { padding: 8px 10px; }
.editable-table input, .editable-table select { padding: 6px 8px; font-size: 12.5px; }
.remove-row-btn { background: none; border: none; cursor: pointer; color: var(--danger); padding: 4px; border-radius: var(--radius-sm); display: flex; align-items: center; transition: background var(--transition-fast); }
.remove-row-btn:hover { background: var(--danger-bg); }

/* ---- File upload ---- */
.file-upload-zone { border: 2px dashed var(--border-strong); border-radius: var(--radius-md); padding: 24px; text-align: center; cursor: pointer; transition: all var(--transition-fast); background: var(--bg-secondary); }
.file-upload-zone:hover, .file-upload-zone.drag-over { border-color: var(--brand-primary); background: var(--brand-primary-light); }
.file-upload-zone input[type="file"] { display: none; }
.file-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; }
.file-item-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item-status           { font-size: 11.5px; color: var(--text-muted); }
.file-item-status.uploading { color: var(--warning); }
.file-item-status.done      { color: var(--success); }
.file-item-status.error     { color: var(--danger);  }

/* ---- Confirm dialog ---- */
.confirm-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.5); display: none; align-items: center; justify-content: center; z-index: 2000; padding: 16px; }
.confirm-overlay.open { display: flex; }
.confirm-box { background: white; border-radius: var(--radius-lg); padding: 28px 32px; width: min(420px, 100%); box-shadow: var(--shadow-xl); text-align: center; }
.confirm-icon    { color: var(--warning); margin: 0 auto 12px; }
.confirm-title   { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.confirm-msg     { font-size: 13.5px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.alert-success { background: var(--success-bg); color: var(--success-text); border: 1px solid #a7f3d0; }
.alert-error   { background: var(--danger-bg);  color: var(--danger-text);  border: 1px solid #fca5a5; }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-bg);    color: var(--info-text);    border: 1px solid #93c5fd; }

/* ---- Auth card ---- */
.auth-card { background: white; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: min(440px, 100%); box-shadow: var(--shadow-md); }
.auth-logo     { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 28px; }
.auth-title    { font-size: 1.375rem; font-weight: 700; text-align: center; margin-bottom: 6px; }
.auth-subtitle { font-size: 13.5px; color: var(--text-secondary); text-align: center; margin-bottom: 28px; }
.auth-divider  { text-align: center; font-size: 12.5px; color: var(--text-muted); margin: 16px 0; position: relative; }
.auth-divider::before, .auth-divider::after { content: ''; position: absolute; top: 50%; width: calc(50% - 24px); height: 1px; background: var(--border); }
.auth-divider::before { left: 0; } .auth-divider::after { right: 0; }

.oauth-btn { width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: white; font-size: 14px; font-weight: 500; color: var(--text-primary); cursor: pointer; transition: all var(--transition-fast); text-decoration: none; margin-bottom: 10px; }
.oauth-btn:last-of-type { margin-bottom: 0; }
.oauth-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); text-decoration: none; }
.oauth-btn-icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ---- Inline spinner ---- */
.inline-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--brand-primary); border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; vertical-align: middle; }

/* ---- Divider ---- */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }
