/* ============================================================
   SAITAMA DASHBOARD — Centro de Mando
   Tema claro, moderno, responsive
   ============================================================ */

:root {
  --bg-primary: #f4f6f9;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f0f2f5;
  --text-primary: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8e8ea0;
  --accent: #00897b;
  --accent-hover: #00695c;
  --accent-light: rgba(0,137,123,0.08);
  --success: #2e7d32;
  --success-light: rgba(46,125,50,0.1);
  --warning: #ef6c00;
  --warning-light: rgba(239,108,0,0.1);
  --danger: #c62828;
  --danger-light: rgba(198,40,40,0.1);
  --border: #e0e4ea;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 1.5rem;
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(0,137,123,0.25);
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: white;
}

.logo-sub {
  font-weight: 400;
  color: rgba(255,255,255,0.8);
  font-size: 0.875rem;
  margin-left: 0.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.health-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.health-badge.healthy { background: rgba(255,255,255,0.2); color: #b9f6ca; }
.health-badge.degraded { background: rgba(255,255,255,0.2); color: #ffe0b2; }
.health-badge.critical { background: rgba(255,255,255,0.2); color: #ffcdd2; }

.last-update {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.7);
}

/* ============================================================
   TABS
   ============================================================ */

.tabs {
  display: flex;
  gap: 0;
  padding: 0 1.5rem;
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.tab {
  padding: 0.75rem 1.25rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
}

.tab:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   TAB CONTENT
   ============================================================ */

.tab-content {
  display: none;
  padding: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.tab-content.active {
  display: block;
}

/* ============================================================
   STATS GRID
   ============================================================ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ============================================================
   SECTIONS
   ============================================================ */

.section {
  margin-bottom: 2rem;
}

.section h2 {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
}

/* ============================================================
   AGENTS GRID (Overview)
   ============================================================ */

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.agent-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.agent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-dot.online { background: var(--success); box-shadow: 0 0 8px rgba(46,125,50,0.4); }
.agent-dot.offline { background: #bdbdbd; }
.agent-dot.degraded { background: var(--warning); box-shadow: 0 0 8px rgba(239,108,0,0.4); }
.agent-dot.error { background: var(--danger); box-shadow: 0 0 8px rgba(198,40,40,0.4); }

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

.agent-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.agent-status-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   AGENTS DETAIL GRID
   ============================================================ */

.agents-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.agent-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.agent-detail-card:hover {
  box-shadow: var(--shadow-md);
}

.agent-detail-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}

.agent-detail-row:last-child {
  border-bottom: none;
}

.agent-detail-label {
  color: var(--text-muted);
}

.agent-detail-value {
  font-weight: 600;
  color: var(--text-primary);
}

.agent-trigger-btn {
  margin-top: 0.75rem;
  width: 100%;
  padding: 0.5rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.2s;
}

.agent-trigger-btn:hover {
  background: var(--accent-hover);
}

/* ============================================================
   ACTIONS GRID
   ============================================================ */

.actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 0.75rem;
}

.action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.action-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.action-icon {
  font-size: 1.5rem;
}

/* ============================================================
   JOBS LIST
   ============================================================ */

.jobs-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.jobs-controls select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  font-size: 0.875rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.jobs-controls select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s;
}

.job-card:hover {
  box-shadow: var(--shadow-md);
}

.job-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.job-topic {
  font-weight: 600;
  font-size: 0.9rem;
}

.job-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.job-badge.pending { background: var(--accent-light); color: var(--accent); }
.job-badge.processing { background: var(--warning-light); color: var(--warning); }
.job-badge.approved { background: var(--success-light); color: var(--success); }
.job-badge.rejected { background: var(--danger-light); color: var(--danger); }
.job-badge.dead { background: var(--danger-light); color: var(--danger); }
.job-badge.published { background: var(--success-light); color: var(--success); }

.job-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.job-content {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ============================================================
   ERRORS / DIAGNOSTICS
   ============================================================ */

.errors-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.error-type-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.error-type-count {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--danger);
}

.error-type-name {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.sources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

.source-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow);
  font-weight: 500;
}

.errors-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.error-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--danger);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  box-shadow: var(--shadow);
}

.error-item-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.error-item-agent {
  font-weight: 600;
}

.error-item-time {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.error-item-msg {
  color: var(--text-secondary);
}

/* ============================================================
   CONFIG EDITOR
   ============================================================ */

.config-editor {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.config-field {
  margin-bottom: 1rem;
}

.config-field label {
  display: block;
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
  font-weight: 500;
}

.config-field input,
.config-field textarea,
.config-field select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.config-field input:focus,
.config-field textarea:focus,
.config-field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.config-field textarea {
  min-height: 80px;
  resize: vertical;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: var(--shadow);
}

.btn:hover { background: var(--bg-hover); box-shadow: var(--shadow-md); }

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 6px rgba(0,137,123,0.3);
}

.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(0,137,123,0.35); }

/* ============================================================
   MODAL
   ============================================================ */

.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  max-width: 420px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-content h2 {
  margin-bottom: 0.5rem;
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.modal-content input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  margin-bottom: 0.75rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.modal-content input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.modal-content .btn-primary {
  width: 100%;
  padding: 0.6rem;
}

.modal-hint {
  color: var(--text-muted) !important;
  font-size: 0.75rem !important;
  margin-top: 0.75rem !important;
  margin-bottom: 0 !important;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  animation: slideIn 0.3s ease;
  max-width: 350px;
  color: var(--text-primary);
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 0.75rem;
}

/* ============================================================
   JOB CONTENT DISPLAY
   ============================================================ */

.job-content-full {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.content-section {
  margin-bottom: 0.75rem;
}

.content-section label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.content-value {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-primary);
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border-radius: var(--radius);
  border: 1px solid #eee;
}

.content-hook {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--accent-light);
  border-color: rgba(0,137,123,0.15);
}

.content-cta {
  font-style: italic;
  color: var(--accent);
  background: var(--accent-light);
  border-color: rgba(0,137,123,0.15);
}

.content-hashtags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.hashtag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.content-score {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.score-bar {
  flex: 1;
  height: 8px;
  background: #eee;
  border-radius: 4px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.content-score span {
  font-size: 0.85rem;
  font-weight: 700;
  min-width: 35px;
}

.content-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.btn-copy {
  background: var(--accent-light) !important;
  color: var(--accent) !important;
  border-color: rgba(0,137,123,0.2) !important;
  font-weight: 600 !important;
}

.btn-copy:hover {
  background: var(--accent) !important;
  color: white !important;
}

.job-content-empty {
  margin-top: 0.75rem;
  padding: 1rem;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  color: #f57f17;
  font-size: 0.85rem;
  text-align: center;
}

.job-content-error {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: var(--danger-light);
  border: 1px solid rgba(198,40,40,0.2);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 0.85rem;
}

/* ============================================================
   PUBLISH TAB
   ============================================================ */

.publish-intro {
  background: linear-gradient(135deg, var(--accent), #26a69a);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem 2rem;
  margin-bottom: 1rem;
}

.publish-intro h2 {
  color: white;
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
}

.publish-intro p {
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
}

.publish-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.publish-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.publish-category {
  background: var(--accent);
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Media Gallery */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}

.media-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.media-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.media-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: #fafbfc;
  border-bottom: 1px solid var(--border);
}

.media-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.media-status.approved { background: var(--success-light); color: var(--success); }
.media-status.review_pending { background: #fff8e1; color: #f57f17; }
.media-status.pending { background: #e3f2fd; color: #1565c0; }

.media-images {
  display: flex;
  gap: 0;
}

.media-image-wrap {
  flex: 1;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: #f5f5f5;
}

.media-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.media-image-wrap:hover img {
  transform: scale(1.05);
}

.media-image-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.35rem 0.5rem;
  text-align: center;
}

.media-info {
  padding: 0.75rem 1rem;
}

.media-topic {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.media-hook {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.media-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.media-actions {
  display: flex;
  gap: 0.35rem;
  padding: 0.75rem;
  background: #fafbfc;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.btn-publish {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.btn-publish:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-publish.tiktok { background: #000; color: white; border-color: #000; }
.btn-publish.tiktok:hover { background: #1a1a1a; }

.btn-publish.instagram { background: linear-gradient(45deg, #833ab4, #fd1d1d, #fcb045); color: white; border: none; }
.btn-publish.instagram:hover { opacity: 0.9; }

.btn-publish.twitter { background: #1da1f2; color: white; border-color: #1da1f2; }
.btn-publish.twitter:hover { background: #0c8de4; }

.btn-publish.facebook { background: #1877f2; color: white; border-color: #1877f2; }
.btn-publish.facebook:hover { background: #0d6efd; }

/* Empty state steps */
.empty-steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
  max-width: 350px;
  margin-left: auto;
  margin-right: auto;
}

.empty-step {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-primary);
}

.empty-step span {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
}

/* Lightbox */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(8px);
  z-index: 2000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.lightbox.active {
  display: flex;
}

.lightbox-content {
  position: relative;
  max-width: 500px;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-content img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #111;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-close:hover { background: rgba(0,0,0,0.8); }

.lightbox-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
}

.lightbox-info {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.lightbox-info strong {
  color: var(--text-primary);
}

.lightbox-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ============================================================
   PROGRESS MODAL
   ============================================================ */

.progress-bar-container {
  width: 100%;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin: 1rem 0;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  width: 0%;
}

.progress-animate {
  animation: progressAnim 8s ease-in-out forwards;
}

@keyframes progressAnim {
  0% { width: 0%; }
  20% { width: 30%; }
  50% { width: 60%; }
  80% { width: 85%; }
  100% { width: 95%; }
}

.progress-status {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.progress-result {
  padding: 1rem;
  border-radius: var(--radius);
  margin-top: 0.75rem;
}

.progress-result.success {
  background: var(--success-light);
  border: 1px solid rgba(46,125,50,0.2);
}

.progress-result.error {
  background: var(--danger-light);
  border: 1px solid rgba(198,40,40,0.2);
}

.progress-result h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.progress-result pre {
  font-size: 0.75rem;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

.result-item {
  padding: 0.35rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.result-item:last-child { border-bottom: none; }

.result-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

/* ============================================================
   TUTORIAL
   ============================================================ */

.tutorial-hero {
  background: linear-gradient(135deg, var(--accent), #26a69a);
  color: white;
  border-radius: var(--radius-lg);
  padding: 2rem 2.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 4px 16px rgba(0,137,123,0.2);
}

.tutorial-hero h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: white;
  border: none;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
}

.tutorial-hero p {
  font-size: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.9);
}

.tutorial-section {
  margin-bottom: 2.5rem;
}

.tutorial-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
}

/* Pipeline visual */
.tutorial-pipeline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.pipeline-step {
  text-align: center;
  padding: 1rem 1.5rem;
  background: var(--accent-light);
  border-radius: var(--radius);
  min-width: 130px;
  transition: transform 0.2s;
}

.pipeline-step:hover { transform: translateY(-3px); }

.pipeline-icon { font-size: 2rem; margin-bottom: 0.35rem; }
.pipeline-label { font-weight: 700; font-size: 0.9rem; color: var(--text-primary); }
.pipeline-desc { font-size: 0.75rem; color: var(--text-secondary); margin-top: 0.15rem; }

.pipeline-arrow {
  font-size: 1.5rem;
  color: var(--accent);
  font-weight: 700;
}

/* Agent cards grid */
.tutorial-agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.tutorial-agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s, transform 0.2s;
}

.tutorial-agent-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.tutorial-agent-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.tutorial-agent-icon { font-size: 1.25rem; }

.tutorial-agent-card p {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}

.tutorial-endpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tutorial-tag {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  font-family: monospace;
}

.tutorial-detail {
  background: #fafbfc;
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.75rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tutorial-detail span {
  font-weight: 600;
  color: var(--text-primary);
}

/* AI Flow */
.ai-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ai-flow-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #f0f2f5;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.ai-flow-step:last-child { border-bottom: none; }

.ai-flow-num {
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
}

.tutorial-guide-card code {
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-family: monospace;
}

/* Guide cards */
.tutorial-guide-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.tutorial-guide-card h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.tutorial-guide-card ul {
  list-style: none;
  padding: 0;
}

.tutorial-guide-card li {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  border-bottom: 1px solid #f0f2f5;
}

.tutorial-guide-card li:last-child { border-bottom: none; }
.tutorial-guide-card li strong { color: var(--text-primary); }

.tutorial-guide-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Step by step */
.tutorial-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.tutorial-step {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom: none;
  transition: background 0.2s;
}

.tutorial-step:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.tutorial-step:last-child { border-bottom: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.tutorial-step:hover { background: var(--accent-light); }

.step-number {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.step-content {
  flex: 1;
}

.step-content strong {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.step-content p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  .header { flex-direction: column; gap: 0.5rem; text-align: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .agents-grid { grid-template-columns: 1fr; }
  .actions-grid { grid-template-columns: 1fr; }
  .tab-content { padding: 1rem; }
  .tutorial-agents-grid { grid-template-columns: 1fr; }
  .tutorial-pipeline { gap: 0.25rem; }
  .pipeline-step { min-width: 90px; padding: 0.75rem; }
  .pipeline-arrow { font-size: 1rem; }
  .tutorial-hero { padding: 1.5rem; }
}
