/* ============================================
   AUTOMATION BUILDER CSS — Modern Compact Design
   Form → Sequence trigger rules page
   ============================================ */

/* ============================================
   DESIGN TOKENS
   ============================================ */
.ab-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
}

.ab-page-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ab-page-title h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: -0.3px;
}

.ab-page-title .material-icons {
  font-size: 24px;
  color: var(--accent-color);
}

.ab-page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.ab-page-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Help Button */
.ab-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s ease;
}

.ab-help-btn:hover {
  border-color: var(--accent-color);
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.05);
}

.ab-help-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

#ab-refresh-btn.is-loading {
  cursor: wait;
  color: var(--accent-color);
  border-color: var(--accent-color);
  background: rgba(99, 102, 241, 0.08);
}

#ab-refresh-btn.is-loading .material-icons {
  animation: ab-orbit-spin 0.75s linear infinite;
}

/* Create Button */
.ab-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  background: var(--accent-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.ab-create-btn:hover {
  background: #5b5ee6;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ab-create-btn:active {
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.ab-create-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3), 0 4px 12px rgba(99, 102, 241, 0.3);
}

.ab-create-btn .material-icons {
  font-size: 16px;
}

#ab-empty-create {
  padding: 10px 18px;
  border-radius: 8px;
}

/* ============================================
   ANALYTICS CARDS
   ============================================ */
.ab-analytics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.ab-stat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 128px;
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-elevated) 150%);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.ab-stat-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

.ab-stat-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ab-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex-shrink: 0;
  background: var(--ab-stat-accent-soft, var(--accent-subtle));
  color: var(--ab-stat-accent, var(--accent-color));
  box-shadow: inset 0 0 0 1px var(--border-subtle);
}

.ab-stat-icon .material-icons {
  font-size: 20px;
}

.ab-stat-data {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  gap: 4px;
}

.ab-stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.05;
  letter-spacing: -0.4px;
}

.ab-stat-title {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.ab-stat-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.2px;
}

.ab-stat-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.ab-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}

.ab-stat-chip.accent {
  background: var(--ab-stat-accent-soft, var(--accent-subtle));
  color: var(--ab-stat-accent, var(--accent-color));
  border-color: transparent;
}

@media (max-width: 1024px) {
  .ab-analytics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .ab-analytics {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   CARDS GRID — COMPACT
   ============================================ */
.ab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

/* ============================================
   AUTOMATION CARD — COMPACT MODERN
   ============================================ */
.ab-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 230px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.05),
    0 4px 8px rgba(0, 0, 0, 0.04);
}

.ab-card:hover {
  border-color: var(--accent-color);
  box-shadow: var(--shadow-md);
}

.ab-card:active {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Card Header */
.ab-card-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  padding-right: 72px;
}

.ab-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.ab-card-meta {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Floating Actions */
.ab-card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 4px;
  z-index: 5;
}

.ab-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ab-action-btn:hover {
  background: var(--accent-subtle, rgba(99, 102, 241, 0.12));
  color: var(--accent-color);
}

.ab-action-btn:active {
  transform: scale(0.95);
}

.ab-action-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ab-action-btn.delete:hover {
  background: rgba(244, 67, 54, 0.12);
  color: #f44336;
}

.ab-action-btn.delete:focus {
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.2);
}

.ab-action-btn .material-icons {
  font-size: 14px;
}

.ab-card-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ab-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.12);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ab-card-icon .material-icons {
  font-size: 18px;
}

.ab-card-info {
  min-width: 0;
  flex: 1;
}

.ab-card-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ab-card-status-stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.ab-status-badge,
.ab-card-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.ab-status-badge.active,
.ab-card-status.active {
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ab-status-badge.paused,
.ab-card-status.paused {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.ab-runtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-secondary);
}

.ab-runtime-badge .material-icons {
  font-size: 11px;
}

.ab-runtime-badge.waiting,
.ab-runtime-badge.triggered {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
  border-color: rgba(245, 158, 11, 0.25);
}

.ab-runtime-badge.running {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border-color: rgba(59, 130, 246, 0.25);
}

.ab-runtime-badge.completed {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
  border-color: rgba(16, 185, 129, 0.25);
}

.ab-runtime-badge.issue,
.ab-runtime-badge.setup {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.22);
}

.ab-runtime-badge.paused {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
  border-color: rgba(107, 114, 128, 0.24);
}

/* ============================================
   LINKED SECTION — COMPACT FLOW
   ============================================ */
.ab-linked-section {
  padding: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
}

.ab-linked-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.ab-linked-header .material-icons {
  font-size: 12px;
  color: var(--accent-color);
}

.ab-linked-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 12px;
}

.ab-linked-row .material-icons {
  font-size: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.ab-linked-row span:not(.material-icons) {
  color: var(--text-primary);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ab-linked-row .ab-linked-arrow {
  color: var(--text-tertiary);
  font-weight: 400;
  font-size: 11px;
  margin: 0 2px;
}

/* ============================================
   STATS GRID — COMPACT
   ============================================ */
.ab-card-stats,
.ab-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.ab-stat-item {
  text-align: center;
}

.ab-stat-val {
  font-weight: 800;
  font-size: 13px;
  color: var(--text-primary);
}

.ab-stat-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 1px;
  letter-spacing: 0.3px;
}

/* ============================================
   PROGRESS BAR — MINIMAL
   ============================================ */
.ab-progress-mini {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.ab-progress-track {
  height: 4px;
  background: var(--bg-elevated, rgba(0, 0, 0, 0.06));
  border-radius: 2px;
  overflow: hidden;
}

.ab-progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.ab-progress-bar.high { background: #10b981; }
.ab-progress-bar.medium { background: #f59e0b; }
.ab-progress-bar.low { background: #ef4444; }

.ab-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  font-weight: 700;
  color: var(--text-tertiary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Toggle Switch */
.ab-toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.ab-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.ab-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--border-color);
  transition: 0.2s;
  border-radius: 20px;
}

.ab-toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.ab-toggle-switch input:checked + .ab-toggle-slider {
  background: var(--accent-color);
}

.ab-toggle-switch input:checked + .ab-toggle-slider:before {
  transform: translateX(16px);
}

.ab-toggle-switch input:focus-visible + .ab-toggle-slider {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

/* ============================================
   EMPTY STATE
   ============================================ */
.ab-empty-v3 {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.ab-empty-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
}

.ab-empty-icon-bg {
  position: absolute;
  inset: 0;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(129, 140, 248, 0.08) 100%);
}

.ab-empty-icon-wrap .material-icons {
  position: relative;
  font-size: 32px;
  color: var(--accent-color);
  z-index: 1;
}

.ab-empty-orbit {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1px dashed rgba(99, 102, 241, 0.2);
  animation: ab-orbit-spin 12s linear infinite;
}

.ab-empty-orbit-dot {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-color);
  opacity: 0.5;
}

.ab-empty-orbit-dot:nth-child(1) { top: -3px; left: 50%; transform: translateX(-50%); }
.ab-empty-orbit-dot:nth-child(2) { bottom: -3px; right: 10%; }
.ab-empty-orbit-dot:nth-child(3) { top: 40%; left: -3px; }

@keyframes ab-orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .ab-empty-orbit { animation: none; }
}

.ab-empty-v3 h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.ab-empty-v3 p {
  font-size: 14px;
  margin: 0 0 24px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
  color: var(--text-secondary);
}

.ab-empty-flow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.02));
  border-radius: 8px;
  margin-bottom: 24px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.ab-empty-flow-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
}

.ab-empty-flow-step .material-icons {
  font-size: 14px;
  color: var(--accent-color);
}

.ab-empty-flow-arrow {
  color: var(--text-tertiary);
  font-size: 14px;
}

/* ============================================
   MODAL
   ============================================ */
.ab-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  animation: abFadeIn 0.2s ease;
  backdrop-filter: blur(4px);
}

@keyframes abFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ab-modal {
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 24px;
  width: 460px;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  animation: abSlideUp 0.25s ease;
}

@keyframes abSlideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.ab-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.ab-modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.ab-modal-title .material-icons {
  font-size: 20px;
  color: var(--accent-color);
}

.ab-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ab-modal-close:hover {
  background: var(--bg-secondary, rgba(0, 0, 0, 0.05));
  color: var(--text-primary);
}

.ab-modal-close:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.ab-modal-close .material-icons {
  font-size: 20px;
}

/* Form Elements */
.ab-form-group {
  margin-bottom: 16px;
}

.ab-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.ab-form-input,
.ab-form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.ab-form-input:hover,
.ab-form-select:hover {
  border-color: var(--text-tertiary);
}

.ab-form-input:focus,
.ab-form-select:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.ab-form-hint {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 6px;
}

/* Modal Actions */
.ab-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.ab-btn {
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.ab-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.ab-btn:focus {
  outline: none;
}

.ab-btn-secondary {
  background: var(--bg-secondary, rgba(0, 0, 0, 0.05));
  color: var(--text-primary);
}

.ab-btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

.ab-btn-secondary:focus {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}

.ab-btn-primary {
  background: var(--accent-color);
  color: white;
}

.ab-btn-primary:hover {
  background: #5b5ee6;
  transform: translateY(-1px);
}

.ab-btn-primary:active {
  transform: translateY(0);
}

.ab-btn-primary:focus {
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3);
}

.ab-btn.is-loading {
  pointer-events: none;
}

.ab-spin {
  display: inline-flex;
  margin-right: 6px;
  animation: ab-orbit-spin 0.8s linear infinite;
}

/* ============================================
   DETAIL MODAL
   ============================================ */
.ab-detail-modal {
  width: 480px;
}

.ab-detail-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ab-detail-status-row .ab-card-status {
  font-size: 11px;
  padding: 4px 10px;
}

.ab-detail-date {
  font-size: 12px;
  color: var(--text-tertiary);
}

.ab-detail-flow {
  margin-bottom: 20px;
}

.ab-detail-flow .ab-flow {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.02));
  border-radius: 10px;
}

.ab-detail-flow .ab-flow-trigger,
.ab-detail-flow .ab-flow-action {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  flex: 1;
}

.ab-detail-flow .ab-flow-trigger {
  background: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.ab-detail-flow .ab-flow-action {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.ab-detail-flow .ab-flow-arrow {
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
}

.ab-detail-flow .ab-flow-arrow .material-icons {
  font-size: 20px;
}

.ab-detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.ab-detail-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px;
  background: var(--bg-secondary, rgba(0, 0, 0, 0.02));
  border-radius: 10px;
  text-align: center;
}

.ab-detail-stat .material-icons {
  font-size: 22px;
}

.ab-detail-stat-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.ab-detail-stat-label {
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
}

.ab-detail-actions {
  display: flex;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.ab-detail-actions .ab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

@media (max-width: 480px) {
  .ab-detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================
   VALIDATION ERRORS
   ============================================ */
.ab-input-error {
  border-color: #f44336 !important;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.15) !important;
}

.ab-field-error {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
  color: #f44336;
  animation: ab-shake 0.4s ease;
}

@keyframes ab-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 640px) {
  .ab-page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .ab-page-header-actions {
    width: 100%;
  }
  
  .ab-create-btn {
    flex: 1;
    justify-content: center;
  }
  
  .ab-grid {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   DARK MODE
   ============================================ */
[data-theme="dark"] .ab-stat-card,
[data-theme="dark"] .ab-card,
[data-theme="dark"] .ab-modal {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .ab-stat-card:hover,
[data-theme="dark"] .ab-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .ab-linked-section,
[data-theme="dark"] .ab-card-footer {
  background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .ab-progress-track {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .ab-empty-icon-bg {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(129, 140, 248, 0.10) 100%);
}

[data-theme="dark"] .ab-empty-flow-step {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .ab-help-btn,
[data-theme="dark"] .ab-form-input,
[data-theme="dark"] .ab-form-select {
  background: var(--bg-surface);
  border-color: var(--border-color);
}

[data-theme="dark"] .ab-help-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}

[data-theme="dark"] .ab-action-btn:hover {
  background: rgba(99, 102, 241, 0.15);
}

[data-theme="dark"] .ab-modal-overlay {
  background: rgba(0, 0, 0, 0.7);
}
