/* Coursor — "Studio ink" (owner, 12 Nov): warm paper, ink, one vermilion
   accent, Instrument Serif headings at weight 400, Inter body. Green, red
   and amber appear only on check status: the status dots, the grid cells
   and the checks in the detail. Fonts are served by the app itself. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/inter-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/inter-latin-500-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/inter-latin-600-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-latin-400-normal.woff2) format('woff2');
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/instrument-serif-latin-400-italic.woff2) format('woff2');
}

:root {
  /* The approved .t-b variables. */
  --bg: #f5f1ea;
  --panel: #fffdf9;
  --line: #e7dfd2;
  --chip: #efe8dc;
  --sel: #ffe9e2;
  --text: #1a1714;
  --muted: #6f665c;
  --accent: #ff4f2e;
  --accent2: #ff9a76;
  --ok: #1f8a4c;
  --bad: #d92d20;
  --run: #c27803;
  --font: Inter, system-ui, sans-serif;
  --head: 'Instrument Serif', Georgia, serif;
  --shadow: 0 1px 0 rgba(26, 23, 20, 0.04), 0 10px 30px rgba(26, 23, 20, 0.07);
  --thumb: linear-gradient(135deg, #1a1714, #3b2f2a 60%, #ff4f2e);
  --mark: linear-gradient(135deg, #ff4f2e, #ff9a76);
  --r: 14px;
  --page: 1360px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
}

h1,
h2 {
  font-family: var(--head);
  font-weight: 400;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 44px;
  line-height: 1.05;
}

h2 {
  font-size: 26px;
  line-height: 1.15;
}

h3 {
  font: 600 11px/1.4 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}

h3 .muted {
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-left: 6px;
}

p {
  margin: 0;
}

code,
pre {
  font: 500 12.5px/1.5 ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

code {
  background: var(--chip);
  border-radius: 6px;
  padding: 1px 6px;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  font: 600 11px/1.4 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.eyebrow.is-accent,
.gate-mark {
  color: var(--accent);
}

.lead {
  color: var(--muted);
  font-size: 15px;
  max-width: 60ch;
  margin-top: 10px;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  margin-top: 6px;
}

.empty {
  color: var(--muted);
  padding: 6px 0;
}

/* ---------------------------------------------------------------- shell */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--page);
  margin: 0 auto;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 36px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 400 26px/1 var(--head);
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand img {
  border-radius: 8px;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 40%, transparent);
}

.nav {
  display: flex;
  gap: 24px;
  flex: 1;
  font-size: 13.5px;
  color: var(--muted);
}

.nav a {
  text-decoration: none;
  padding: 6px 0 4px;
  border-bottom: 2px solid transparent;
}

.nav a:hover {
  color: var(--text);
}

.nav a.on {
  color: var(--text);
  font-weight: 500;
  border-bottom-color: var(--accent);
}

.me {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
}

.link-button {
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 0;
}

.link-button:hover {
  color: var(--text);
}

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: 28px 32px 72px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.panel-head,
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin: 12px 0 26px;
}

/* ---------------------------------------------------------------- buttons, pills, forms */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 500 14px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.button:hover {
  background: #fff;
}

.button:active {
  transform: translateY(1px);
}

.button.is-primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 32%, transparent);
}

.button.is-primary:hover {
  background: color-mix(in srgb, var(--accent) 90%, #000);
}

.button.is-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}

.button.is-wide {
  width: 100%;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--chip);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill.is-hot {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

label {
  display: block;
  font-weight: 500;
  margin: 18px 0 8px;
}

label:first-of-type {
  margin-top: 0;
}

textarea,
input[type='password'],
input[type='file'] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
  resize: vertical;
  min-height: 150px;
  line-height: 1.55;
}

textarea:focus,
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
}

input[type='file'] {
  border-style: dashed;
  background: var(--bg);
  padding: 16px 14px;
  cursor: pointer;
}

input[type='file']::file-selector-button {
  font: 500 13px var(--font);
  margin-right: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
}

.form-error {
  border-left: 3px solid var(--accent);
  background: var(--sel);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 26px;
}

/* ---------------------------------------------------------------- shared meters and covers */

.cover {
  border-radius: 12px;
  background: var(--thumb);
  color: #fff;
  font: 400 17px/1.1 var(--head);
  display: flex;
  align-items: flex-end;
  padding: 12px 14px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

.cover::after {
  content: '';
  position: absolute;
  top: 10px;
  right: 12px;
  border-left: 9px solid rgba(255, 255, 255, 0.85);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.cover span {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meter,
.progress .bar {
  height: 7px;
  border-radius: 99px;
  background: var(--chip);
  overflow: hidden;
}

.meter i,
.progress .bar i {
  display: block;
  height: 100%;
  width: calc(var(--p) * 1%);
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

/* ---------------------------------------------------------------- status dots (status colours) */

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--chip);
  border: 1px solid var(--line);
  display: inline-block;
}

.dot.is-ok {
  background: var(--ok);
  border-color: transparent;
}

.dot.is-bad {
  background: var(--bad);
  border-color: transparent;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent);
}

.dot.is-run {
  background: var(--run);
  border-color: transparent;
}

.dot.is-yours {
  background: var(--accent);
  border-color: transparent;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.dot.is-off {
  background: transparent;
  border-style: dashed;
}

/* ---------------------------------------------------------------- login */

.is-bare .page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.login {
  width: 100%;
  max-width: 420px;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font: 400 36px/1 var(--head);
  margin-bottom: 26px;
}

.login-brand img {
  border-radius: 12px;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 38%, transparent);
}

.login-card {
  padding: 32px;
}

.login-card h1 {
  font-size: 36px;
}

.login-card > .muted {
  margin: 8px 0 24px;
}

.login-form .button {
  margin-top: 18px;
}

.login-setup pre {
  background: var(--text);
  color: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 12px 0;
}

.login-setup code {
  background: none;
  padding: 0;
}

/* ---------------------------------------------------------------- home */

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r);
  padding: 14px 20px;
  margin-bottom: 18px;
}

.banner strong {
  font-weight: 600;
  color: #fff;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.count {
  min-width: 26px;
  height: 26px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 12.5px;
  display: inline-grid;
  place-items: center;
  padding: 0 8px;
}

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

.turn-item a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: 'what go' 'course go' 'detail go';
  column-gap: 16px;
  padding: 14px 4px;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.turn-item:first-child a {
  border-top: 0;
  padding-top: 4px;
}

.turn-item a:hover .turn-go {
  transform: translateX(3px);
  color: var(--accent);
}

.turn-what {
  grid-area: what;
  font-weight: 600;
}

.turn-what .muted {
  font-weight: 400;
}

.turn-course {
  grid-area: course;
  font: 400 19px/1.25 var(--head);
  margin-top: 2px;
}

.turn-detail {
  grid-area: detail;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.turn-go {
  grid-area: go;
  align-self: center;
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.15s ease;
}

.stack {
  display: grid;
  gap: 18px;
}

.stat-value {
  font: 400 34px/1.1 var(--head);
  margin: 4px 0 10px;
}

.stat-value.is-small {
  font-size: 24px;
  margin-bottom: 6px;
}

.stat-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}

/* One writing team's week on Home: its name, its calls against its budget, its pause. */
.team-line {
  margin-top: 12px;
}

.team-line + .team-line {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.team-name {
  font-size: 13px;
  font-weight: 600;
}

.stat-value.is-team {
  font-size: 26px;
  margin: 2px 0 8px;
}

.team-line.is-off .stat-value,
.team-line.is-off .meter {
  opacity: 0.45;
}

.team-note {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 8px;
}

.team-line.is-paused .team-note {
  color: var(--text);
}

.section {
  margin-top: 36px;
}

.course-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(520px, 1fr));
  gap: 18px;
}

.course-card {
  display: flex;
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 1px 0 rgba(26, 23, 20, 0.04), 0 16px 36px rgba(26, 23, 20, 0.1);
}

.course-card .cover {
  width: 192px;
  height: 108px;
  font-size: 16px;
}

.course-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.course-card h3 {
  font: 400 22px/1.15 var(--head);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  margin: 0;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
}

.progress .bar {
  flex: 1;
}

.card-now {
  font-size: 13px;
}

.card-meta {
  font-size: 12px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  padding: 40px;
}

.empty-state h3 {
  font: 400 26px var(--head);
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
}

.empty-state .button {
  margin-top: 18px;
}

.message {
  max-width: 560px;
  margin: 40px auto;
}

.message p {
  margin-top: 12px;
}

/* ---------------------------------------------------------------- new course */

.new-course {
  max-width: 760px;
  margin: 0 auto;
}

.new-course-form {
  padding: 28px;
}

/* ---------------------------------------------------------------- course header */

.course-head {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 18px;
}

.course-head .cover {
  width: 184px;
  height: 104px;
}

.head-main {
  flex: 1;
  min-width: 0;
}

.head-main h1 {
  font-size: 36px;
  margin-bottom: 10px;
}

.meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 10px;
}

.ring {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--chip) 0);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.ring > span {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--panel);
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1;
}

.ring strong {
  font-size: 16px;
  font-weight: 600;
}

.ring small {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.calls {
  width: 160px;
  flex-shrink: 0;
  padding-right: 6px;
}

.calls .meter {
  margin: 8px 0;
}

.calls-value {
  font-size: 12px;
  color: var(--muted);
}

.calls-value strong {
  color: var(--text);
  font-weight: 600;
}

.calls-roles {
  display: flex;
  gap: 14px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--muted);
}

/* Each role: its name, with its count underneath. */
.calls-roles span {
  display: flex;
  flex-direction: column;
}

.calls-roles strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------------------------------------------------------------- course body: rail */

.course-body {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 12px 10px;
  position: sticky;
  top: 78px;
}

.rail-title {
  font: 600 11px/1.4 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 4px 10px 8px;
}

/* A watched page says it updates by itself (see app.js). */
.live-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
}

.rail .live-note {
  padding: 0 10px 8px;
}

.page-head .live-note {
  margin-top: 10px;
}

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

.rail-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 9px;
  font-size: 13px;
  text-decoration: none;
}

.rail-item:hover {
  background: var(--bg);
}

.rail-item.is-on {
  background: var(--sel);
  font-weight: 600;
}

.rail-item.is-gate {
  color: var(--accent);
  font-weight: 600;
}

.rail-item .gate-mark {
  margin-right: -4px;
  font-size: 11px;
}

.rail-item small {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  white-space: nowrap;
}

.rail-item.is-off .rail-label {
  color: var(--muted);
}

.rail-item.is-off.is-gate .rail-label {
  color: color-mix(in srgb, var(--accent) 70%, var(--muted));
}

/* ---------------------------------------------------------------- course body: grid */

.course-main {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.grid-panel {
  min-width: 0;
  padding: 18px 18px 14px;
}

.course-main.is-course-stage .grid-panel,
.course-main.is-course-stage .voice-section {
  display: none;
}

/* With the pick selected, its card is the detail; the one above the grid hides. */
.course-main.is-pick-stage > .pick-card {
  display: none;
}

.grid-scroll {
  overflow-x: auto;
}

.grid {
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 4px;
  font-size: 12.5px;
  margin: -4px;
  width: calc(100% + 8px);
  min-width: 720px;
}

.grid thead th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
  text-align: center;
  padding: 2px 4px 6px;
  white-space: nowrap;
}

.grid thead th a {
  text-decoration: none;
}

.grid thead th small {
  display: block;
  font-weight: 400;
  font-size: 10.5px;
  opacity: 0.8;
}

.grid thead th.is-hl {
  color: var(--accent);
}

.grid thead th.is-hl a {
  border-bottom: 2px solid var(--accent);
  padding-bottom: 1px;
}

.grid thead th.is-off {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}

.grid .lesson-col {
  text-align: left;
  width: 38%;
  padding-left: 6px;
}

.section-row th {
  text-align: left;
  font: 400 17px/1.2 var(--head);
  padding: 12px 6px 4px;
}

.section-n {
  font: 600 10.5px/1 var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 8px;
}

.lesson-cell {
  text-align: left;
  font-weight: 400;
  padding: 6px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.lid {
  display: inline-block;
  font: 600 10.5px/1 var(--font);
  letter-spacing: 0.04em;
  color: var(--muted);
  background: var(--chip);
  border-radius: 6px;
  padding: 4px 6px;
  margin-right: 8px;
}

.cell {
  text-align: center;
  border-radius: 8px;
  background: var(--chip);
  color: var(--muted);
  padding: 0;
  height: 36px;
  transition: box-shadow 0.12s ease;
}

.cell a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 34px;
  padding: 0 6px;
  text-decoration: none;
  white-space: nowrap;
}

.cell:hover {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text) 25%, transparent);
}

.voice-section {
  min-width: 0;
  padding: 18px;
}

.voice-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow-wrap: anywhere;
}

.voice-card + .voice-card { margin-top: 12px; }
.voice-card h3 { margin: 0 0 12px; }

.voice-card audio {
  display: block;
  min-width: 0;
  width: 100%;
}

.voice-checks {
  list-style: none;
  margin: 12px 0;
  padding: 0;
  overflow-wrap: anywhere;
}

.voice-check + .voice-check {
  margin-top: 6px;
}

.voice-check.is-pass .voice-status { color: var(--ok); }
.voice-check.is-warn .voice-status { color: var(--run); }
.voice-check.is-fail .voice-status { color: var(--bad); }
.voice-delivery { color: var(--muted); margin-bottom: 0; }

.cell.is-ok {
  background: color-mix(in srgb, var(--ok) 16%, transparent);
  color: var(--ok);
  font-weight: 600;
  font-size: 14px;
}

.cell.is-bad {
  background: color-mix(in srgb, var(--bad) 16%, transparent);
  color: var(--bad);
  font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--bad);
}

.cell.is-run {
  background: color-mix(in srgb, var(--run) 16%, transparent);
  color: var(--run);
  font-weight: 600;
}

.cell.is-queued {
  background: var(--chip);
  color: var(--text);
}

.cell.is-off {
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 5px,
    color-mix(in srgb, var(--chip) 55%, transparent) 5px 10px
  );
}

.cell.is-col:not(.is-ok):not(.is-bad):not(.is-run) {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.cell.is-sel,
.cell.is-sel:hover {
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent);
}

/* ---------------------------------------------------------------- course body: pick card */

.pick-card {
  padding: 26px 28px;
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.pick-card h2 {
  font-size: 34px;
}

.pick-card .subtitle {
  color: var(--muted);
  font-size: 16px;
  margin: 6px 0 14px;
}

.pick-body {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  margin-top: 6px;
}

.pick-body p {
  line-height: 1.6;
}

.market {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
}

.market div {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg);
}

.market dt {
  font-size: 12px;
  color: var(--muted);
}

.market dd {
  margin: 2px 0 0;
  font: italic 400 17px/1.3 var(--head);
}

.pick-outline ol {
  margin: 0;
  padding-left: 20px;
}

.pick-outline > ol > li {
  margin-bottom: 10px;
}

.pick-outline > ol > li > strong {
  font-weight: 600;
}

.pick-outline ol ol {
  color: var(--muted);
  padding-left: 18px;
  margin-top: 4px;
  list-style: lower-alpha;
}

.pick-form {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  border-top: 1px solid var(--line);
  margin-top: 22px;
  padding-top: 20px;
}

.type-choice {
  border: 0;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 10px;
}

.type-choice legend {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  padding: 0;
}

.choice {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 400;
  background: var(--panel);
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--sel);
}

.choice input {
  accent-color: var(--accent);
  margin: 0;
}

.choice span {
  display: grid;
  line-height: 1.25;
}

.choice small {
  color: var(--muted);
  font-size: 12px;
}

/* ---------------------------------------------------------------- course body: detail */

.detail {
  min-height: 120px;
}

/* The pick card as the pick's own detail: the detail panel is its frame. */
.detail > .pick-card {
  border: 0;
  box-shadow: none;
  padding: 0;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.state-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  white-space: nowrap;
}

.standing {
  margin-top: 8px;
  color: var(--muted);
}

.failure {
  display: flex;
  gap: 12px;
  align-items: baseline;
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--bad) 7%, var(--panel));
  border: 1px solid color-mix(in srgb, var(--bad) 22%, var(--line));
}

.failure-label {
  flex-shrink: 0;
  font: 600 11px/1.4 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--bad);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.raise-cap label {
  margin: 0;
}

.raise-cap input[type='number'] {
  width: 110px;
  font: inherit;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
}

.detail-cols {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 28px;
}

.checks {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.checks th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  padding: 0 10px 6px 0;
  border-bottom: 1px solid var(--line);
}

.checks td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.checks tr:last-child td {
  border-bottom: 0;
}

.check-status {
  white-space: nowrap;
  font-weight: 600;
  width: 70px;
}

.check.is-pass .check-status {
  color: var(--ok);
}

.check.is-fail .check-status,
.check.is-fail .check-measured {
  color: var(--bad);
}

.check.is-warn .check-status {
  color: var(--run);
}

.check-id {
  font: 500 12px/1.5 ui-monospace, 'SFMono-Regular', Menlo, monospace;
  color: var(--muted);
  white-space: nowrap;
}

.check-measured {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.check-threshold {
  color: var(--muted);
  font-size: 12.5px;
}

.request {
  margin-top: 14px;
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--bg);
  border-radius: 0 10px 10px 0;
  font: italic 400 18px/1.4 var(--head);
}

.findings {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.findings li {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 13px;
}

.source {
  font: 600 10.5px/1.4 var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.file {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 9px;
  background: var(--chip);
  border: 1px solid var(--line);
  text-decoration: none;
}

.file:hover {
  border-color: var(--accent);
}

.file small {
  color: var(--muted);
  font-size: 11px;
}

.lesson-states {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.lesson-states a {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-decoration: none;
}

.lesson-states a > span:nth-child(2) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-states .state-chip {
  padding: 3px 9px;
}

.htmx-request.detail,
.htmx-request #detail {
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

/* ---------------------------------------------------------------- research */

.small {
  font-size: 12.5px;
}

.crumbs {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 4px;
}

.crumbs a {
  text-decoration: none;
}

.crumbs a:hover {
  color: var(--text);
}

/* What an action left for the page it returned to, shown once. */
.notice {
  border-left: 3px solid var(--text);
  background: var(--panel);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.notice.is-error {
  border-left-color: var(--accent);
  background: var(--sel);
}

.research-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.research-stats .stat-value.is-small {
  font-size: 22px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter {
  font-size: 12.5px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
}

.filter:hover {
  color: var(--text);
}

.filter.on {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.pill.is-small {
  font-size: 11px;
  padding: 4px 8px;
}

.pill.feas {
  font-weight: 500;
}

.pill.feas.is-no {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.pill.feas.is-partly {
  background: var(--panel);
}

input[type='checkbox'] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

input[type='checkbox']:disabled {
  cursor: not-allowed;
}

.topic-panel {
  padding: 6px 0 0;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

.topic-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

.topic-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.topic-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.topic-table tbody tr:last-child td {
  border-bottom: 0;
}

.topic-table .tick-col {
  width: 40px;
  padding-left: 20px;
}

.topic-table td.tick-col {
  padding-top: 17px;
}

.topic-col {
  min-width: 220px;
  max-width: 300px;
}

.topic-col .pill {
  margin-left: 6px;
  vertical-align: 2px;
}

.topic-col p {
  margin-top: 4px;
}

.topic-name {
  font: 400 19px/1.2 var(--head);
  text-decoration: none;
}

.topic-name:hover {
  color: var(--accent);
}

.trend {
  white-space: nowrap;
  font-weight: 500;
}

.market-col {
  min-width: 230px;
}

.feas-col {
  min-width: 190px;
  max-width: 260px;
}

.feas-col p {
  margin-top: 6px;
}

.num {
  text-align: right;
  white-space: nowrap;
}

.topic-table td.num {
  font: 400 20px/1.1 var(--head);
}

.counts {
  white-space: nowrap;
}

.counts span {
  display: block;
  font-size: 12.5px;
}

/* A topic or card judged not feasible: greyed, its reason still readable. */
.topic-table tr.is-no td,
.rcard.is-no .rcard-body,
.run-topics .is-no {
  color: var(--muted);
}

.topic-table tr.is-no td:not(.feas-col),
.rcard.is-no .rcard-body > :not(.rcard-feas) {
  opacity: 0.6;
}

.topic-table tr.is-no .topic-name {
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.mini-market {
  margin: 0;
  display: grid;
  gap: 6px;
}

.mini-market dt {
  font-size: 11px;
  color: var(--muted);
}

.mini-market dd {
  margin: 0;
  font-size: 12.5px;
}

.sources {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 5px;
  font-size: 12.5px;
}

.sources a {
  text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent);
  text-underline-offset: 2px;
}

.sources a:hover {
  color: var(--accent);
}

.approve-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

.approve-bar.is-sticky {
  position: sticky;
  top: 66px;
  z-index: 5;
  justify-content: flex-start;
  border-top: 1px solid var(--line);
  margin-bottom: 18px;
}

.approve-bar.is-sticky .button {
  margin-left: auto;
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tick-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
}

.theme {
  margin-top: 26px;
}

.theme-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.theme-head h2 {
  font-size: 24px;
}

.theme-head .tick-label {
  font-weight: 400;
}

.rcards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
  gap: 14px;
}

.rcard {
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.rcard:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--sel) 45%, var(--panel));
}

.rcard.is-no {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
}

.rcard.is-built {
  background: color-mix(in srgb, var(--chip) 40%, var(--panel));
}

.rcard-tick {
  width: 16px;
  flex-shrink: 0;
  padding-top: 4px;
}

.rcard-body {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.rcard-title {
  font: 400 21px/1.15 var(--head);
  letter-spacing: -0.01em;
}

.rcard-subtitle {
  color: var(--muted);
}

.rcard-scope {
  line-height: 1.55;
}

.rcard-sections {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12.5px;
}

.rcard-feas {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
}

.pill.is-built {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  text-decoration: none;
}

.run-list {
  list-style: none;
  margin: 0;
  padding: 6px 20px;
}

.run-item a {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) auto minmax(0, 1.6fr) auto;
  align-items: baseline;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
}

.run-item:first-child a {
  border-top: 0;
}

.run-item a:hover .run-what {
  color: var(--accent);
}

.run-what {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-what strong {
  font-weight: 600;
}

.run-note {
  color: var(--muted);
  font-size: 12.5px;
  overflow-wrap: anywhere;
}

.run-when {
  font-size: 12px;
  white-space: nowrap;
}

.run-facts {
  display: grid;
  gap: 10px;
}

.run-facts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.run-facts h3 {
  margin-bottom: 0;
}

.run-facts .request {
  margin-top: 0;
}

.run-findings summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
}

.run-findings .findings {
  margin-top: 10px;
}

.run-topics {
  list-style: none;
  margin: 0;
  padding: 10px 20px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 8px 18px;
}

.run-topics li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
}

.topic-pills {
  margin-top: 14px;
}

.topic-facts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 28px;
}

.topic-facts h3 {
  margin-top: 0;
}

.page-head form .hint {
  max-width: 220px;
}

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 1080px) {
  .course-body,
  .home-grid,
  .research-stats,
  .topic-facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .run-item a {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .rail {
    position: static;
  }
  .course-head {
    flex-wrap: wrap;
  }
  .pick-body,
  .detail-cols {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .page,
  .topbar-inner {
    padding-left: 16px;
    padding-right: 16px;
  }
  .topbar-inner {
    gap: 16px;
  }
  h1 {
    font-size: 34px;
  }
  .page-head,
  .pick-form {
    flex-direction: column;
    align-items: stretch;
  }
  .course-head .cover {
    display: none;
  }
  .course-cards,
  .rcards {
    grid-template-columns: minmax(0, 1fr);
  }
  .approve-bar.is-sticky {
    flex-wrap: wrap;
  }
}
