/* TASKS interface. Colour, type, spacing, radius and motion come from the OTHDESIGN MYTHOS tokens
   (mythos.tokens.css). Values OTHDESIGN does not define yet are listed in
   docs/architecture/DESIGN-SOURCE-MAP.md. */
/* The canonical token file defines the light status values but does not switch to them
   (COLOR_SYSTEM.md section 4); without this, dark-ground status colours appear on paper. */
:root[data-theme="light"] {
  --mythos-success: var(--mythos-success-light); --mythos-warning: var(--mythos-warning-light);
  --mythos-danger: var(--mythos-danger-light); --mythos-info: var(--mythos-info-light);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --mythos-success: var(--mythos-success-light); --mythos-warning: var(--mythos-warning-light);
    --mythos-danger: var(--mythos-danger-light); --mythos-info: var(--mythos-info-light);
  }
}

* { box-sizing: border-box; }
html { background: var(--mythos-ground); }
body {
  margin: 0; background: var(--mythos-ground); color: var(--mythos-text-primary);
  font: var(--mythos-weight-regular) 16px/1.62 var(--mythos-font-text);
}
h1, h2 { font-family: var(--mythos-font-display); font-weight: var(--mythos-weight-semibold); }
h1 { font-size: 31px; line-height: 1.18; letter-spacing: -.015em; margin: 0 0 var(--mythos-space-6); overflow-wrap: anywhere; }
h2 { font-size: 20px; line-height: 1.32; margin: var(--mythos-space-7) 0 var(--mythos-space-4); }
a { color: var(--mythos-link); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--mythos-focus-ring); outline-offset: 2px; }
.mono { font-family: var(--mythos-font-mono); font-size: 14px; line-height: 1.44; overflow-wrap: anywhere; }
.muted { color: var(--mythos-text-secondary); font-size: 14px; line-height: 1.56; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--mythos-space-5); top: var(--mythos-space-5); background: var(--mythos-surface-card); padding: var(--mythos-space-3); z-index: 10; }

.shell { min-height: 100vh; }
.rail { background: var(--mythos-ground-deep); border-bottom: 1px solid var(--mythos-border-hairline); padding: var(--mythos-space-4) var(--mythos-space-5); }
.wordmark { font-family: var(--mythos-font-display); font-weight: var(--mythos-weight-semibold); letter-spacing: .1em; margin: 0 0 var(--mythos-space-3); }
.rail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--mythos-space-2); }
.rail li a { display: block; padding: var(--mythos-space-3) var(--mythos-space-4); min-height: var(--mythos-size-control-comfortable); text-decoration: none; border-inline-start: 2px solid transparent; }
.rail li a[aria-current="page"] { border-inline-start-color: var(--mythos-accent); background: var(--mythos-surface); }
.account { display: flex; flex-wrap: wrap; gap: var(--mythos-space-3); align-items: center; margin-top: var(--mythos-space-4); }
.account p { margin: 0; flex-basis: 100%; }
main { padding: var(--mythos-space-6) var(--mythos-space-5); max-width: var(--mythos-container-wide); }
@media (min-width: 904px) {
  .shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
  .rail { border-bottom: 0; border-inline-end: 1px solid var(--mythos-border-hairline); padding: var(--mythos-space-6) var(--mythos-space-4); }
  .rail ul { flex-direction: column; }
  main { padding: var(--mythos-space-7) var(--mythos-space-8); }
}

button, .button {
  font: var(--mythos-weight-medium) 14px/1.2 var(--mythos-font-text); min-height: var(--mythos-size-control-comfortable);
  padding: var(--mythos-space-3) var(--mythos-space-5); border-radius: var(--mythos-radius-control); border: 1px solid var(--mythos-accent);
  background: var(--mythos-accent); color: var(--mythos-text-on-accent); cursor: pointer; transition: background var(--mythos-motion-micro);
}
button:hover { background: var(--mythos-accent-hover); }
button.secondary { background: transparent; color: var(--mythos-text-primary); border-color: var(--mythos-border-control); }
button.secondary:hover { background: var(--mythos-surface-card); }
button:disabled { cursor: not-allowed; background: transparent; color: var(--mythos-text-disabled); border-color: var(--mythos-border-hairline); }
input, select, textarea {
  font: inherit; font-size: 16px; color: inherit; background: var(--mythos-surface); border: 1px solid var(--mythos-border-control);
  border-radius: var(--mythos-radius-control); padding: var(--mythos-space-3) var(--mythos-space-4); min-height: var(--mythos-size-control-comfortable); width: 100%;
}
textarea { min-height: 140px; resize: vertical; }
label { display: block; font-size: 12px; line-height: 1.34; letter-spacing: .1em; text-transform: uppercase; font-weight: var(--mythos-weight-medium); color: var(--mythos-text-secondary); margin-bottom: var(--mythos-space-2); }
fieldset { border: 0; margin: 0; padding: 0; }
.field { margin-bottom: var(--mythos-space-5); }
.field .hint { margin: var(--mythos-space-2) 0 0; }
.form { max-width: 560px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--mythos-space-4); margin-bottom: var(--mythos-space-5); align-items: end; }
.actions { display: flex; flex-wrap: wrap; gap: var(--mythos-space-3); margin: var(--mythos-space-4) 0; align-items: center; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--mythos-space-4); }
.card { background: var(--mythos-surface); border: 1px solid var(--mythos-border-hairline); border-radius: var(--mythos-radius-card); padding: var(--mythos-space-5); }
a.card { text-decoration: none; display: block; }
.card .number { display: block; font: var(--mythos-weight-regular) 31px/1.2 var(--mythos-font-mono); }

table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.56; }
th, td { text-align: start; padding: var(--mythos-space-3) var(--mythos-space-4); border-bottom: 1px solid var(--mythos-border-hairline); vertical-align: top; overflow-wrap: anywhere; }
th { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; font-weight: var(--mythos-weight-medium); color: var(--mythos-text-secondary); white-space: nowrap; }
@media (max-width: 599px) {
  thead { position: absolute; left: -999px; }
  tr { display: block; border: 1px solid var(--mythos-border-hairline); border-radius: var(--mythos-radius-card); margin-bottom: var(--mythos-space-4); padding: var(--mythos-space-3); }
  td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--mythos-space-3); border: 0; padding: var(--mythos-space-2) var(--mythos-space-3); }
  td::before { content: attr(data-label); color: var(--mythos-text-secondary); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
}

/* status is never colour alone: a mark, a word and a colour */
.state { display: inline-flex; align-items: center; gap: var(--mythos-space-3); white-space: nowrap; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: var(--mythos-radius-pill); background: var(--mythos-text-secondary); }
.state.completed, .state.ok { color: var(--mythos-success); } .state.completed::before, .state.ok::before { background: var(--mythos-success); }
.state.failed, .state.down { color: var(--mythos-danger); } .state.failed::before, .state.down::before { background: var(--mythos-danger); border-radius: 0; }
.state.running, .state.dispatching { color: var(--mythos-info); } .state.running::before, .state.dispatching::before { background: var(--mythos-info); }
.state.blocked, .state.scheduled { color: var(--mythos-warning); } .state.blocked::before, .state.scheduled::before { background: transparent; border: 2px solid var(--mythos-warning); }

.banner { border: 1px solid var(--mythos-warning); background: var(--mythos-warning-dim); padding: var(--mythos-space-4) var(--mythos-space-5); border-radius: var(--mythos-radius-card); margin: 0 0 var(--mythos-space-5); }
.banner.error { border-color: var(--mythos-danger); background: var(--mythos-danger-dim); }
.empty { color: var(--mythos-text-secondary); padding: var(--mythos-space-6); border: 1px dashed var(--mythos-border-strong); border-radius: var(--mythos-radius-card); }
.skeleton { color: var(--mythos-text-secondary); background: var(--mythos-surface); padding: var(--mythos-space-6); border-radius: var(--mythos-radius-card); }
dl.facts { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr); gap: var(--mythos-space-2) var(--mythos-space-5); margin: 0; }
dl.facts dt { color: var(--mythos-text-secondary); font-size: 14px; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }
ol.timeline { list-style: none; padding: 0; margin: 0; border-inline-start: 1px solid var(--mythos-border-strong); }
ol.timeline li { padding: 0 0 var(--mythos-space-4) var(--mythos-space-5); }
pre { background: var(--mythos-ground-deep); border: 1px solid var(--mythos-border-hairline); padding: var(--mythos-space-5); overflow: auto; max-height: 360px; font: 14px/1.44 var(--mythos-font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }
progress { width: 100%; accent-color: var(--mythos-accent); }
.graph { display: flex; gap: var(--mythos-space-6); overflow-x: auto; align-items: flex-start; padding-bottom: var(--mythos-space-4); }
.graph .column { display: flex; flex-direction: column; gap: var(--mythos-space-4); min-width: 220px; }
dialog { background: var(--mythos-surface-card); color: inherit; border: 1px solid var(--mythos-border-strong); border-radius: var(--mythos-radius-overlay); box-shadow: var(--mythos-shadow-overlay); max-width: min(480px, 92vw); padding: var(--mythos-space-6); }
dialog::backdrop { background: rgba(11, 11, 10, 0.6); }
dialog h2 { margin-top: 0; }

body.message main { max-width: 560px; margin: 0 auto; padding: var(--mythos-space-9) var(--mythos-space-6); }

@media (forced-colors: active) {
  button { border: 2px solid ButtonText; }
  button.secondary { border-style: dashed; }
}
