:root {
  --p-bg: var(--sv-color-canvas);
  --p-surface: var(--sv-color-surface);
  --p-line: var(--sv-color-border);
  --p-line-strong: var(--sv-color-border-strong);
  --p-text: var(--sv-color-text);
  --p-muted: var(--sv-color-text-muted);
  --p-faint: var(--sv-color-text-faint);
  --p-accent: var(--sv-color-brand);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1040px; background: var(--p-bg); color: var(--p-text); }
button, input, textarea, select { font: inherit; }
.schedules-shell {
  min-height: 100vh;
  padding: 34px 42px 52px 102px;
  background: var(--p-bg);
}
.schedules-hero, .schedules-stats, .schedules-tabs, .schedules-panel {
  width: min(1540px, 100%);
  margin-inline: auto;
}
.schedules-hero {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
}
.eyebrow, .panel-head p, .schedule-dialog header p {
  margin: 0 0 7px;
  color: var(--p-accent);
  font: 700 10px/1.2 var(--sv-font-mono);
  letter-spacing: .13em;
  text-transform: uppercase;
}
.schedules-hero h1 {
  margin: 0;
  font-size: var(--sv-font-size-title);
  font-weight: 600;
  line-height: 1.28;
  letter-spacing: -0.01em;
}
.schedules-hero > div > p:last-child {
  margin: 8px 0 0;
  color: var(--p-muted);
  font-size: 13px;
  max-width: 52ch;
  line-height: 1.5;
}
.primary-action, .secondary-action, .panel-head button, .schedule-job-actions button {
  min-height: 40px;
  border: 1px solid var(--p-line-strong);
  border-radius: 11px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 12px;
  text-decoration: none;
  background: var(--sv-color-surface-strong);
  color: var(--p-text);
  cursor: pointer;
}
.primary-action { border-color: var(--p-accent); background: var(--p-accent); color: var(--sv-color-on-brand); font-weight: 750; }
.primary-action span { margin-right: 6px; font-size: 18px; font-weight: 400; }
.hero-actions { display: flex; align-items: center; gap: 9px; }
.sync-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--p-muted);
  font-size: 12px;
}
.sync-state i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--p-accent);
  box-shadow: 0 0 0 4px rgba(var(--sv-brand-rgb), .08);
}

.schedules-stats {
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.schedules-stats article {
  min-height: 105px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-content: center;
  gap: 7px 14px;
  border: 1px solid var(--p-line);
  border-radius: 15px;
  background: var(--sv-color-surface);
}
.schedules-stats span { color: var(--p-muted); font-size: 12px; }
.schedules-stats strong {
  grid-row: span 2;
  align-self: center;
  color: var(--p-text);
  font: 500 31px/1 var(--sv-font-mono);
}
.schedules-stats small { color: var(--p-faint); font-size: 10px; }

.schedules-tabs {
  min-height: 54px;
  margin-bottom: 14px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--p-line);
  border-radius: 14px;
  background: rgba(16,18,16,.82);
}
.schedules-type-tabs { min-width: 0; display: flex; align-items: center; gap: 4px; }
.schedules-tabs button {
  height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--p-muted);
  font-size: 12px;
  cursor: pointer;
}
.schedules-tabs button:hover { color: var(--p-text); }
.schedules-tabs button.active { background: rgba(245,242,234,.08); color: var(--p-text); }
.schedules-tabs label {
  width: min(300px, 28vw);
  height: 38px;
  margin-left: auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--p-line);
  border-radius: 9px;
  background: var(--sv-color-surface-subtle);
}
.schedules-tabs svg { width: 16px; fill: none; stroke: var(--p-faint); stroke-width: 1.7; }
.schedules-tabs input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--p-text);
}

.schedules-panel {
  border: 1px solid var(--p-line);
  border-radius: 18px;
  background: var(--sv-color-surface);
  overflow: hidden;
}
.panel-head {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--p-line);
}
.panel-head h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
#scheduleListSummary { color: var(--p-faint); font-size: 12px; }

.schedule-list { display: grid; gap: 0; }
.schedule-job {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--p-line);
}
.schedule-job:last-child { border-bottom: 0; }
.schedule-job.disabled { opacity: .62; }
.schedule-job-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font: 800 11px/1 var(--sv-font-mono);
  letter-spacing: .04em;
  border: 1px solid var(--p-line-strong);
  background: rgba(255,255,255,.03);
}
.schedule-job-mark.source-agent { color: var(--sv-color-brand); }
.schedule-job-mark.source-butler { color: #60cde8; }
.schedule-job-mark.source-collector { color: #ffb84d; }
.schedule-job-mark.source-ai_hot { color: #ff8d6b; }
.schedule-job header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 4px;
}
.schedule-job header span {
  font: 700 10px/1 var(--sv-font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--p-accent);
}
.schedule-job header small { color: var(--p-faint); font-size: 11px; }
.schedule-job h3 { margin: 0; font-size: 15px; font-weight: 700; }
.schedule-job p { margin: 6px 0 0; color: var(--p-muted); font-size: 12px; line-height: 1.45; }
.schedule-job-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.schedule-job-actions button, .schedule-job-actions a {
  min-height: 34px;
  padding: 0 12px;
  font-size: 11px;
}
.schedule-job-actions a {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--p-line-strong);
  border-radius: 11px;
  background: var(--sv-color-surface-strong);
  color: var(--p-text);
  text-decoration: none;
}
.schedule-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--p-muted);
  font-size: 13px;
  line-height: 1.6;
}

.schedule-dialog {
  width: min(720px, calc(100vw - 48px));
  padding: 0;
  border: 1px solid var(--p-line-strong);
  border-radius: 18px;
  background: var(--sv-color-surface);
  color: var(--p-text);
}
.schedule-dialog::backdrop { background: rgba(0,0,0,.62); }
.schedule-dialog form { padding: 22px; }
.schedule-dialog header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
}
.schedule-dialog h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: var(--p-text);
  cursor: pointer;
}
.schedule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field { display: grid; gap: 7px; }
.field[hidden] { display: none !important; }
.field.span-2 { grid-column: span 2; }
.field span { color: var(--p-muted); font-size: 12px; }
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--p-line);
  border-radius: 11px;
  padding: 11px 12px;
  background: var(--sv-color-surface-subtle);
  color: var(--p-text);
  color-scheme: dark;
}
.field select option { background: var(--sv-color-surface-strong); color: var(--sv-color-text); }
#scheduleRuntime {
  color: var(--sv-color-text) !important;
  -webkit-text-fill-color: var(--sv-color-text);
  font-weight: 620;
  opacity: 1;
}
#scheduleRuntime option {
  color: var(--sv-color-text);
  -webkit-text-fill-color: var(--sv-color-text);
  background-color: var(--sv-color-surface-strong);
}
.field textarea { resize: vertical; min-height: 120px; }
.field-hint { color: var(--p-faint); font-size: 11px; }
.risk-confirm {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}
.form-message { min-height: 18px; margin: 12px 0 0; color: #ff8d6b; font-size: 12px; }
.schedule-dialog footer {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.schedules-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--p-line-strong);
  background: var(--sv-color-surface-strong);
  color: var(--p-text);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s ease;
  z-index: 40;
}
.schedules-toast.show { opacity: 1; transform: none; }

/* Light-mode semantic adapter. */
html[data-theme="light"] .schedules-tabs { background:var(--sv-color-canvas-raised); }
html[data-theme="light"] .schedules-tabs button.active { background:var(--sv-color-surface); color:var(--sv-color-text); box-shadow:var(--sv-shadow-card); }
html[data-theme="light"] .scope-filter select { color-scheme:light; }
