/* ── Tasks page ──────────────────────────────────────────────────────────────── */

.task-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  width: 100%;
}

.task-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  min-height: 54px;
  border-bottom: 1px solid var(--bs-border-color);
  background: var(--bs-tertiary-bg);
  flex-shrink: 0;
}

.task-page-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Empty state ── */

.task-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px;
  color: var(--bs-secondary-color);
}

.task-empty i {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.5;
}

.task-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.task-empty code {
  font-size: 0.82rem;
}

/* ── Grid ── */

.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
  padding: 20px;
  align-content: start;
  overflow-y: auto;
  flex: 1;
}

/* ── Card ── */

.task-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bs-body-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: 10px;
  padding: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.task-card:hover {
  border-color: var(--bs-primary-border-subtle, #9ec5fe);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.task-card--disabled {
  opacity: 0.6;
}

/* ── Card header ── */

.task-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.task-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.task-card-title {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.3;
}

/* ── Badges ── */

.task-badge {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  white-space: nowrap;
}

.task-badge--oneshot {
  background: var(--bs-secondary-bg, #e9ecef);
  color: var(--bs-secondary-color, #6c757d);
}

.task-badge--cron {
  background: rgba(99, 102, 241, 0.12);
  color: var(--bs-primary, #6366f1);
}

.task-badge--sync {
  background: rgba(99, 102, 241, 0.12);
  color: var(--bs-primary, #6366f1);
}

.task-badge--async {
  background: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.task-badge--running {
  background: rgba(34, 197, 94, 0.15);
  color: #15803d;
}

.task-badge--idle {
  background: var(--bs-secondary-bg, rgba(128,128,128,0.12));
  color: var(--bs-secondary-color, #6c757d);
}

.task-badge--disabled {
  background: rgba(220, 53, 69, 0.1);
  color: var(--bs-danger, #dc3545);
}

.task-badge--pending {
  background: rgba(13, 110, 253, 0.12);
  color: var(--bs-primary, #0d6efd);
}

/* ── Delete button ── */

.task-card-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--bs-danger, #dc3545);
  opacity: 0.5;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}

.task-card-delete:hover {
  opacity: 1;
  background: var(--bs-danger-bg-subtle, rgba(220,53,69,0.08));
}

/* ── Card description ── */

.task-card-desc {
  font-size: 0.82rem;
  color: var(--bs-secondary-color);
  line-height: 1.4;
}

/* ── Cron expression box ── */

.task-card-expr {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--bs-tertiary-bg, rgba(0,0,0,0.02));
  border: 1px solid var(--bs-border-color);
  border-radius: 6px;
  padding: 8px 10px;
}

.task-card-expr i {
  color: var(--bs-primary, #0d6efd);
  flex-shrink: 0;
  margin-top: 2px;
}

.task-card-expr-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.task-card-human {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
}

.task-card-raw {
  font-family: var(--bs-font-monospace, monospace);
  font-size: 0.7rem;
  color: var(--bs-secondary-color);
  word-break: break-all;
  line-height: 1.3;
  background: transparent;
  padding: 0;
}

/* ── Meta info ── */

.task-card-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
  font-size: 0.78rem;
}

.task-card-meta-item {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.task-card-meta-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--bs-secondary-color);
}

.task-card-meta-value {
  color: var(--bs-body-color);
}

a.task-card-session-link {
  color: var(--bs-primary);
  text-decoration: none;
  font-family: var(--bs-font-monospace);
}
a.task-card-session-link:hover {
  text-decoration: underline;
}

.task-card-meta-item--full {
  grid-column: 1 / -1;
}

.task-card-select {
  font-size: 0.78rem;
  padding: 2px 6px;
  border: 1px solid var(--bs-border-color);
  border-radius: 4px;
  background: var(--bs-body-bg);
  color: var(--bs-body-color);
  cursor: pointer;
  width: 100%;
  max-width: 220px;
}

/* ── Card footer ── */

.task-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--bs-border-color);
  margin-top: auto;
}

.task-card-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.task-card-toggle-label {
  font-size: 0.78rem;
  font-weight: 500;
  user-select: none;
}

/* ── Running card highlight ── */

.task-card--running {
  border-color: rgba(34, 197, 94, 0.4);
  box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.15);
}

.task-running-elapsed {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(34, 197, 94, 0.07);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 6px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #15803d;
}

.task-running-elapsed i {
  font-size: 0.95rem;
}

.task-running-since {
  font-size: 0.76rem;
  font-weight: 400;
  opacity: 0.7;
  margin-left: auto;
}

/* ── Kill button ── */

.task-kill-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(220, 53, 69, 0.35);
  border-radius: 5px;
  background: transparent;
  color: var(--bs-danger, #dc3545);
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  line-height: 1;
}

.task-kill-btn:hover:not(:disabled) {
  background: rgba(220, 53, 69, 0.1);
  border-color: var(--bs-danger, #dc3545);
}

.task-kill-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
