/* Schedule workspace */

.sched-main {
  padding: var(--gutter) var(--page-x) 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Hero strip */
.sched-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  flex-wrap: wrap;
}
.hero-meta { display: flex; flex-direction: column; gap: 4px; }
.hero-eyebrow {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  font-weight: 600;
}
.hero-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-md);
  color: var(--text);
}
.hero-state-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 0 transparent;
}
.hero-state-dot.on { background: var(--primary-bright); box-shadow: 0 0 8px var(--primary-line); }
.hero-state-dot.off { background: var(--warning); }
.hero-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--text-mute); }
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.hero-actions .hero-label {
  font-size: var(--fs-sm);
  color: var(--text-2);
  margin-right: 4px;
}

/* Two-up grid */
.sched-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 900px) {
  .sched-grid { grid-template-columns: 1fr; }
}

/* Card */
.sched-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.sc-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-md);
  font-weight: 600;
}
.sc-title .icon { color: var(--text-3); }
.sc-count {
  background: var(--surface-3);
  padding: 2px 9px;
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  color: var(--text-2);
}
.sc-actions { display: flex; align-items: center; gap: 10px; }
.sc-search-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 5px 10px;
}
.sc-search-wrap input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: var(--fs-sm);
  width: 180px;
}
.sc-body { padding: 14px 18px; flex: 1; }
.sc-foot {
  padding: 10px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}
.sc-help { color: var(--text-3); font-size: var(--fs-xs); margin: 0; }
.sc-empty {
  color: var(--text-3);
  font-size: var(--fs-sm);
  text-align: center;
  padding: 24px;
}

/* Due-list rows */
.due-list { display: flex; flex-direction: column; gap: 6px; }
.due-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.due-name { font-size: var(--fs-sm); display: flex; flex-direction: column; gap: 2px; }
.due-name b { font-family: var(--mono); font-size: var(--fs-xs); }
.due-name .dim { color: var(--text-3); font-size: var(--fs-xs); }
.due-meta { color: var(--text-3); font-size: var(--fs-xs); }
.due-empty { padding: 18px; text-align: center; color: var(--text-3); }
.dim { color: var(--text-3); }

/* Schedule table */
.sched-table-card .sc-body.sched-table-body { padding: 0; }
.sched-table {
  width: 100%;
  border-collapse: collapse;
}
.sched-table thead th {
  text-align: left;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  font-weight: 600;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.sched-table thead th.th-actions { text-align: right; }
.sched-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s ease;
}
.sched-table tbody tr:hover { background: var(--surface-2); }
.sched-table tbody td {
  padding: 10px 14px;
  font-size: var(--fs-sm);
  vertical-align: middle;
}
.sched-table tbody td.td-actions {
  text-align: right;
  white-space: nowrap;
}
.sched-table tbody td.td-actions .ghost-btn { margin-left: 4px; }
.sj-name { font-size: var(--fs-sm); }
.sj-desc { color: var(--text-3); font-size: var(--fs-xs); margin-top: 2px; }
.cron-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: var(--fs-xs);
  background: var(--surface-3);
  color: var(--text-3);
}
.cron-chip.chip-on {
  background: var(--primary-soft);
  color: var(--primary-bright);
  border: 1px solid var(--primary-line);
}

#refresh-btn.spinning .icon { animation: spin .5s linear; }
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Modal */
.sched-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.66);
  backdrop-filter: blur(4px);
}
.sm-dialog {
  position: relative;
  width: 480px;
  max-width: calc(100% - 32px);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 24px 60px rgba(0,0,0,.6);
  overflow: hidden;
}
.sm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.sm-head h2 { margin: 0; font-size: var(--fs-md); font-weight: 600; }
.sm-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 22px;
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 4px;
}
.sm-close:hover { background: var(--surface-2); color: var(--text); }
.sm-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sm-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.sm-saved-pill {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--primary-bright, #1ed760);
  background: rgba(83, 224, 118, .12);
  border: 1px solid rgba(83, 224, 118, .32);
  border-radius: 999px;
  animation: toast-in .2s cubic-bezier(.16,1,.3,1);
}

/* Run-report modal */
.sr-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.sr-stat {
  padding: 12px 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
}
.sr-stat.ok { border-color: rgba(83, 224, 118, .32); }
.sr-stat.warn { border-color: rgba(255, 200, 107, .32); }
.sr-stat.err { border-color: rgba(255, 120, 120, .42); background: rgba(255, 120, 120, .06); }
.sr-stat-num { font-size: 22px; font-weight: 700; color: var(--text); line-height: 1.1; }
.sr-stat-lbl { font-size: var(--fs-xs); color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.sr-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 6px;
}
.sr-row.ok { border-left-color: var(--primary-bright, #1ed760); }
.sr-row.err { border-left-color: #ff7878; }
.sr-row-name { font-size: var(--fs-sm); color: var(--text); font-weight: 500; }
.sr-row-meta { font-size: var(--fs-xs); color: var(--text-3); }

/* Wide modal — for the full rules editor */
.sm-dialog-wide { width: 620px; }
.sm-body-scroll {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}
.sm-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface-2);
}
.sm-section > legend {
  padding: 0 8px;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  font-weight: 700;
}
.sg-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.sm-section textarea,
.sm-section input[type="text"],
.sm-section input[type="number"],
.sm-section input[type="date"],
.sm-section select {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: var(--fs-sm);
  font-family: inherit;
}
.sm-section textarea { resize: vertical; min-height: 60px; }
.sm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--fs-sm);
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.sm-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-bright, #1ed760);
  cursor: pointer;
}
