/* ── SCHEDULED TASKS ─────────────────────────────────────────── */
.btn-new-scheduled {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  background: var(--zen-primary); color: #fff;
  border: none; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: background .15s;
}
.btn-new-scheduled:hover { background: var(--zen-primary-dark); }

.scheduled-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }

.scheduled-card {
  background: #ffffff; border: 1px solid #e2e8f0;
  border-radius: 16px; padding: 16px 18px;
  display: flex; align-items: flex-start; gap: 14px;
  transition: box-shadow .15s, transform .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
}
.scheduled-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.10); transform: translateY(-1px); }

.scheduled-card-icon {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, #41b89c, #2e9e84); color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 18px;
  box-shadow: 0 2px 8px rgba(65,184,156,.35);
}
.scheduled-card-body { flex: 1; min-width: 0; }
.scheduled-card-title {
  font-weight: 700; font-size: 15px; color: #1a2530;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.scheduled-card-prompt {
  font-size: 13px; color: #4a5568; margin-top: 2px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; background: #f8fafc; border-radius: 8px;
  padding: 6px 10px; border-left: 3px solid #41b89c;
}
.scheduled-card-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap;
}
.scheduled-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600;
  letter-spacing: .01em;
}
.scheduled-badge.freq { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.scheduled-badge.active { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.scheduled-badge.paused { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.scheduled-badge.agent { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

.scheduled-card-actions { display: flex; gap: 6px; flex-shrink: 0; align-items: flex-start; padding-top: 2px; }
.scheduled-action-btn {
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 12px; color: #64748b;
  transition: all .15s;
}
.scheduled-action-btn:hover { background: #f1f5f9; color: #334155; border-color: #cbd5e1; }
.scheduled-action-btn.danger:hover { background: #fef2f2; color: #c62828; border-color: #fecaca; }

.scheduled-runs { margin-top: 12px; background: #f8fafc; border-radius: 10px; padding: 10px 12px; }
.scheduled-runs-title {
  font-size: 11px; font-weight: 700; color: var(--zen-text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between;
}
.scheduled-runs-all-btn {
  background: none; border: none; cursor: pointer; font-size: 11px;
  color: var(--zen-primary); font-weight: 600; padding: 0;
  text-transform: none; letter-spacing: 0;
}
.scheduled-runs-all-btn:hover { text-decoration: underline; }
.scheduled-run-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px 10px; border-radius: 8px; font-size: 12px;
  background: #ffffff; margin-bottom: 4px;
  border: 1px solid #e8edf2;
}
.scheduled-run-item.clickable { cursor: pointer; transition: background .1s; }
.scheduled-run-item.clickable:hover { background: var(--zen-border); }
.scheduled-run-body { flex: 1; min-width: 0; }
.scheduled-run-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scheduled-run-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; margin-top: 4px; }
.scheduled-run-dot.ok { background: #4caf50; }
.scheduled-run-dot.err { background: #f44336; }
.scheduled-run-dot.pending { background: #f59e0b; }
.scheduled-run-date { color: var(--zen-text-muted); font-size: 11px; }
.scheduled-run-trigger { font-size: 10px; background: #eef1fb; color: #3949ab; padding: 1px 5px; border-radius: 4px; }
.scheduled-run-open { font-size: 11px; color: var(--zen-primary); font-weight: 600; white-space: nowrap; }
.scheduled-run-pending { font-size: 11px; color: #f59e0b; font-weight: 600; }
.scheduled-run-preview { color: var(--zen-text); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scheduled-no-run { font-size: 12px; color: var(--zen-text-muted); font-style: italic; padding: 6px 0; }
.scheduled-next-run { font-size: 11px; color: #64748b; margin-top: 10px; padding: 6px 8px; border-radius: 6px; background: #f1f5f9; display: inline-block; }
.sm-slot-item { display:flex;align-items:center;gap:6px;padding:8px 10px;background:var(--zen-bg);border:1px solid var(--zen-border);border-radius:9px;flex-wrap:wrap; }
.sm-slot-item select { padding:3px 6px;border-radius:6px;border:1px solid var(--zen-border);font-size:12px;background:var(--zen-card-bg); }
.sm-slot-badge { font-size:11px;font-weight:700;color:var(--zen-primary);white-space:nowrap; }
.sm-slot-remove { background:none;border:none;cursor:pointer;color:#ef4444;font-size:14px;padding:0 4px;margin-left:auto; }

/* Modal */
.scheduled-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; animation: fadeIn .15s;
}
.scheduled-modal {
  background: #ffffff; border-radius: 16px;
  padding: 28px 28px 24px; width: 520px; max-width: 95vw;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  color: #1a2530;
}
.scheduled-modal h3 { margin: 0 0 20px; font-size: 17px; font-weight: 700; color: #1a2530; }
.scheduled-modal label {
  display: block; font-size: 12px; font-weight: 600; color: #637280;
  margin-bottom: 5px; margin-top: 14px;
}
.scheduled-modal label:first-of-type { margin-top: 0; }
.scheduled-modal input, .scheduled-modal textarea, .scheduled-modal select {
  width: 100%; box-sizing: border-box;
  border: 1.5px solid #dde3e9; border-radius: 9px;
  padding: 10px 12px; font-size: 13px; color: #1a2530;
  background: #f7f9fb; transition: border-color .15s, background .15s;
  font-family: inherit; appearance: auto;
}
.scheduled-modal input::placeholder, .scheduled-modal textarea::placeholder { color: #aab4be; }
.scheduled-modal input:focus, .scheduled-modal textarea:focus, .scheduled-modal select:focus {
  outline: none; border-color: #41b89c; background: #fff;
}
.scheduled-modal textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
.scheduled-modal-row { display: flex; gap: 12px; }
.scheduled-modal-row > div { flex: 1; min-width: 0; }
.scheduled-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #eef1f4; }
.btn-modal-cancel {
  padding: 9px 18px; border-radius: 9px; border: 1.5px solid #dde3e9;
  background: #fff; cursor: pointer; font-size: 13px; color: #637280; font-weight: 500;
  transition: all .15s;
}
.btn-modal-cancel:hover { background: #f7f9fb; border-color: #c5cdd5; }
.btn-modal-save {
  padding: 9px 22px; border-radius: 9px; border: none;
  background: #41b89c; color: #fff; cursor: pointer;
  font-size: 13px; font-weight: 600; transition: background .15s;
}
.btn-modal-save:hover { background: #339980; }

.scheduled-empty {
  text-align: center; padding: 60px 20px; color: var(--zen-text-muted);
}
.scheduled-empty svg { opacity: .3; margin-bottom: 12px; }
.scheduled-empty h3 { font-size: 15px; color: var(--zen-text); margin: 0 0 6px; }
.scheduled-empty p { font-size: 13px; margin: 0; }

/* Badges triggers dans les cards */
.scheduled-badge.trigger { background: #e8eaf6; color: #3949ab; border: 1px solid #c5cae9; }
.scheduled-badge.trigger-sep { background: none; color: var(--zen-text-muted); border: none; padding: 2px 2px; }
.scheduled-badge.trigger-label { background: none; color: var(--zen-text-muted); border: none; padding: 2px 4px; font-style: italic; }
.scheduled-badge.run-ok { background: #e8f5e9; color: #2e7d32; }
.scheduled-badge.run-err { background: #ffebee; color: #c62828; }

/* Modal élargi */
.scheduled-modal-wide { width: 620px !important; }

/* Section titre dans modal */
.sm-section-title {
  display: flex; align-items: center; gap: 7px;
  margin: 22px 0 10px; font-size: 11px; font-weight: 700;
  color: #1a2530; text-transform: uppercase; letter-spacing: .06em;
  padding-top: 16px; border-top: 1px solid #eef1f4;
}
.sm-section-hint {
  font-size: 11px; color: #8fa0ad; font-weight: 400;
  text-transform: none; letter-spacing: 0; flex: 1;
}

/* Liste des triggers ajoutés */
.sm-no-trigger {
  font-size: 12px; color: #8fa0ad; font-style: italic;
  padding: 9px 12px; border: 1.5px dashed #dde3e9; border-radius: 9px;
  margin-bottom: 10px; background: #f7f9fb;
}
.sm-trigger-chip {
  display: flex; align-items: center; justify-content: space-between;
  background: #eef1fb; border: 1px solid #c5cae9; border-radius: 9px;
  padding: 8px 12px; font-size: 12px; color: #3949ab; margin-bottom: 6px;
}
.sm-trigger-chip button {
  background: none; border: none; cursor: pointer; color: #9fa8da;
  font-size: 14px; padding: 0 0 0 10px; line-height: 1; flex-shrink: 0;
}
.sm-trigger-chip button:hover { color: #c62828; }

/* Ligne ajout trigger */
.sm-add-trigger-row {
  display: flex; gap: 8px; margin-bottom: 8px;
}
.sm-add-trigger-row select { flex: 1; }
.sm-btn-add-trigger {
  padding: 9px 14px; border-radius: 9px; border: 1.5px solid #41b89c;
  background: #fff; color: #41b89c; cursor: pointer;
  font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  transition: all .15s;
}
.sm-btn-add-trigger:hover { background: #41b89c; color: #fff; }

/* Boîte paramètres trigger */
.sm-trigger-param-box {
  background: #f7f9fb; border: 1.5px solid #dde3e9;
  border-radius: 10px; padding: 14px 14px 10px; margin-bottom: 10px;
}
.sm-trigger-param-box label { color: #637280; font-size: 11px; margin-top: 10px; }
.sm-trigger-param-box label:first-child { margin-top: 0; }
.sm-trigger-param-box input, .sm-trigger-param-box select {
  background: #fff !important;
}