/* ── Schedules Surface ───────────────────── */

.ext-schedules-app {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  color: var(--text);
}

.ext-schedules-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.ext-schedules-header h1 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.ext-schedules-body {
  flex: 1;
  overflow: auto;
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.ext-schedules-count {
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ── Table ────────────────────────────────── */

.ext-schedules-list__loading,
.ext-schedules-list__empty {
  padding: var(--sp-10) var(--sp-4);
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
}

.ext-schedules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.ext-schedules-table th {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
}

.ext-schedules-table td {
  padding: var(--sp-3) var(--sp-3);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.ext-schedules-row:hover {
  background: var(--bg-hover);
}

.ext-schedules-row__name { min-width: 160px; }

.ext-schedules-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
  padding: 0;
  text-align: left;
}
.ext-schedules-link:hover { text-decoration: underline; }

.ext-schedules-row__desc {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

.ext-schedules-row__cron { white-space: nowrap; }

.ext-schedules-cron-badge {
  font-family: monospace;
  font-size: 0.8rem;
  background: var(--bg-raised);
  padding: 2px var(--sp-2);
  border-radius: 4px;
  color: var(--text-2);
}

.ext-schedules-cron-human {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

.ext-schedules-row__next {
  font-size: 0.8rem;
  color: var(--text-2);
  white-space: nowrap;
}

.ext-schedules-row__actions {
  display: flex;
  gap: var(--sp-1);
  white-space: nowrap;
}

/* ── Toggle button ────────────────────────── */

.ext-schedules-toggle-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px var(--sp-3);
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.ext-schedules-toggle-btn--on {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

.ext-schedules-toggle-btn--off {
  background: var(--bg-raised);
  color: var(--text-3);
}

.ext-schedules-toggle-btn:hover { opacity: 0.85; }

/* ── Action buttons ───────────────────────── */

.ext-schedules-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.ext-schedules-btn:hover { background: var(--bg-hover); }

.ext-schedules-btn--sm {
  padding: 3px var(--sp-2);
  font-size: 0.8rem;
}

.ext-schedules-btn--danger:hover {
  background: var(--danger-dim);
  color: var(--danger);
  border-color: var(--danger);
}

/* ── Form ─────────────────────────────────── */

.ext-schedules-form { display: flex; flex-direction: column; gap: var(--sp-3); }
.ext-schedules-form__row { display: flex; align-items: center; gap: var(--sp-3); }
.ext-schedules-form__actions { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-2); }

.ext-schedules-cron-input {
  font-family: monospace;
}

.ext-schedules-cron-preview {
  font-size: 0.8rem;
  color: var(--accent);
  margin-top: var(--sp-1);
  font-style: italic;
}

.ext-schedules-script {
  font-family: monospace;
  font-size: 0.85rem;
  resize: vertical;
}

.ext-schedules-toggle {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ── Logs panel ───────────────────────────── */

.ext-schedules-logs {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.ext-schedules-logs__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.ext-schedules-logs__loading,
.ext-schedules-logs__empty {
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  color: var(--text-3);
  font-size: 0.8rem;
}

.ext-schedules-log-entry {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.ext-schedules-log-entry:last-child { border-bottom: none; }

.ext-schedules-log-entry__status {
  font-weight: 700;
  width: 18px;
  text-align: center;
}
.ext-schedules-log-entry__status--ok   { color: var(--success); }
.ext-schedules-log-entry__status--fail { color: var(--danger); }

.ext-schedules-log-entry__time {
  color: var(--text-2);
  white-space: nowrap;
}

.ext-schedules-log-entry__duration {
  color: var(--text-3);
  font-family: monospace;
  font-size: 0.75rem;
}

.ext-schedules-log-entry__error {
  color: var(--danger);
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

/* ── Responsive ───────────────────────────── */

@media (max-width: 768px) {
  .ext-schedules-table th:nth-child(3),
  .ext-schedules-table td:nth-child(3) {
    display: none;
  }
  .ext-schedules-body { padding: var(--sp-2); }
}
