:root {
  --bg-page: #1c3130;
  --bg-surface: #243f3a;
  --bg-surface-alt: #2c4f48;
  --text: #f6f8f7;
  --text-dim: #a8c4bc;
  --sage: #6a9a8e;
  --stone: #7a726a;
  --danger: #d17b6e;
  --border: #3d6b61;
  --row: 32px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text);
  font: 13px/1.3 ui-sans-serif, system-ui, sans-serif;
}

button, input, select { font: inherit; color: inherit; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--row);
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

button.primary, .button.primary {
  background: var(--sage);
  border-color: transparent;
  color: var(--bg-page);
}

button.danger {
  background: var(--danger);
  border-color: transparent;
  color: var(--bg-page);
}

button.danger-text {
  height: var(--row);
  border: 0;
  background: transparent;
  color: var(--danger);
}

button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 1px;
}

.status {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.summary { margin: 0; }

.actions, .tile-actions, .dialog-actions, .courses, .tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}

.tabs button[aria-selected="true"], .courses button[aria-pressed="true"] {
  background: var(--bg-surface);
  border-color: var(--sage);
}

.shell {
  display: inline-block;
  min-width: 280px;
  max-width: 100%;
  margin: 12px;
  vertical-align: top;
}

.panel { padding: 8px 0 0; }

.block { margin: 0 0 16px; }

.block h2, .block h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }

.block h3 { margin-top: 10px; color: var(--text-dim); font-weight: 500; }

.note { margin: 8px 0; color: var(--text-dim); }

.tools { margin-bottom: 8px; }

.tools input, .tools select, .dialog input {
  height: var(--row);
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-page);
}

.grid { display: flex; flex-wrap: wrap; gap: 8px; }

.tile {
  width: 168px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.thumb { height: 72px; background: var(--bg-surface-alt); }

.thumb img { display: block; width: 100%; height: 72px; object-fit: cover; }

.tile h3 { margin: 8px; font-size: 13px; font-weight: 600; }

.state-run { color: var(--sage); }

.state-start { color: var(--text-dim); }

.state-spec, .state-idle { color: var(--stone); }

.meta { margin: 0 8px 8px; color: var(--text-dim); }

.tile-actions { padding: 0 8px 8px; }

.now {
  margin-right: 6px;
  padding: 0 4px;
  border-radius: 3px;
  background: var(--sage);
  color: var(--bg-page);
  font-size: 11px;
}

table { width: auto; border-collapse: collapse; }

th, td {
  height: var(--row);
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th { color: var(--text-dim); font-weight: 500; }

.activity {
  display: block;
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
}

.log { margin: 0; padding: 0; list-style: none; }

.log li { display: block; min-height: var(--row); line-height: var(--row); white-space: normal; }

.activity .more { display: none; }

.activity.open .recent { display: none; }

.activity.open .more { display: block; }

.menu { position: relative; }

.menu-pop {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 2;
  min-width: 140px;
  padding: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.menu-pop[hidden] { display: none; }

.menu-pop button { width: 100%; justify-content: flex-start; }

.gate {
  max-width: 360px;
  margin: 48px 16px;
  padding: 16px;
  background: var(--bg-surface);
  border-radius: 6px;
}

.gate h1 { margin: 0 0 8px; font-size: 16px; }

.gate p { margin: 0 0 12px; }

#modal {
  position: fixed;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.45);
}

#modal[hidden] { display: none; }

.dialog {
  width: min(420px, calc(100% - 24px));
  padding: 16px;
  background: var(--bg-surface);
  border-radius: 6px;
}

.dialog p { margin: 0 0 12px; }

.dialog input { width: 100%; margin-bottom: 12px; }

.dialog-actions { justify-content: flex-end; }

#toasts {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toast {
  max-width: 360px;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 4px;
}
