/* Course Ops Platform — course register shell. */

body { overflow: hidden; }

.login-wrap {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(100%, 460px);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .28);
}

.login-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--r);
  background: var(--indigo-wash);
  color: var(--indigo-ink);
  margin-bottom: 18px;
}

.login-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -.03em;
}

.login-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 22px 0 16px;
}

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

.login-input {
  height: 40px;
  width: 100%;
  padding: 0 12px;
  background: var(--desk);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.login-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash, rgba(99, 102, 241, .18));
}

.login-error {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--red-wash, rgba(239, 68, 68, .12));
  border: 1px solid var(--red);
  color: var(--red);
  font-size: 12px;
  line-height: 1.45;
}

.login-error[hidden] { display: none; }

.login-guide {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.login-guide summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 600;
  list-style: none;
}

.login-guide summary::-webkit-details-marker { display: none; }

.login-guide-list {
  margin: 12px 0 0 18px;
  padding: 0;
  line-height: 1.6;
}

.login-guide-list li + li { margin-top: 4px; }

.login-card .btn {
  width: 100%;
  min-height: 40px;
  justify-content: center;
}

.skip-link { position: fixed; left: 12px; top: -60px; z-index: 20; padding: 9px 12px; background: var(--accent); color: var(--desk); border-radius: var(--r); }
.skip-link:focus { top: 12px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 284px;
  grid-template-rows: 52px minmax(0, 1fr) 28px;
  grid-template-areas: 'top top' 'main rail' 'foot foot';
  height: 100vh;
}

.main { grid-area: main; min-width: 0; padding: 20px 22px 16px; overflow: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 23px; line-height: 1.2; font-weight: 600; letter-spacing: -.03em; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.btn .icon { width: 14px; height: 14px; }
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.search { min-width: 210px; height: 34px; display: flex; align-items: center; gap: 8px; flex: 1; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--quiet); }
.search:focus-within { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.search input { min-width: 0; width: 100%; background: transparent; border: 0; outline: 0; color: var(--ink); font-size: 12px; }
.search input::placeholder { color: var(--quiet); }
.filter { min-height: 34px; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); font-size: 12px; }
.filter:hover { background: var(--high); color: var(--ink); }
.filter.active { color: var(--indigo-ink); background: var(--indigo-wash); border-color: var(--indigo); }
.filter span { color: var(--quiet); font: 12px var(--mono); }
.filter.active span { color: var(--indigo-ink); }
.filter[hidden] { display: none; }
select { min-height: 34px; padding: 6px 28px 6px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); font-size: 12px; }

.pulse { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); min-height: 52px; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.pulse-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-right: 1px solid var(--line); }
.pulse-item:last-child { border-right: 0; }
.pulse-item .icon { color: var(--quiet); }
.pulse-item strong { display: block; font: 600 16px/1.1 var(--mono); letter-spacing: -.04em; }
.pulse-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.pulse-item.amber strong { color: var(--amber); }
.pulse-item.red strong { color: var(--red); }
.pulse-item.green strong { color: var(--green); }

.register { display: flex; flex-direction: column; gap: 12px; }
.course { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.course-header { position: relative; }
.course-head { width: 100%; min-height: 66px; display: flex; align-items: center; gap: 11px; padding: 11px 52px 11px 14px; border: 0; background: transparent; color: inherit; text-align: left; }
.course-head:hover { background: var(--raised); }
.course-head:focus-visible { outline-offset: -3px; }
.course-visibility { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); }
.course-visibility .icon { width: 15px; height: 15px; }
.course[data-hidden='true'] { border-style: dashed; }
.course-glyph { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--indigo); border-radius: var(--r); background: var(--indigo-wash); color: var(--indigo-ink); flex: 0 0 auto; }
.course-glyph.amber { border-color: var(--amber); background: var(--amber-wash); color: var(--amber); }
.course-title { min-width: 0; }
.course-name { display: block; font-size: 14px; font-weight: 600; letter-spacing: -.015em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-meta { display: block; margin-top: 3px; color: var(--quiet); font: 12px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-summary { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.course-stat { text-align: right; }
.course-stat b { display: block; font: 600 12px var(--mono); }
.course-stat small { color: var(--quiet); font-size: 12px; }
.badge .dot { width: 5px; height: 5px; }
.course-body { border-top: 1px solid var(--line); }
.course-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.provenance { margin: 0; padding: 8px 14px; color: var(--quiet); font: 12px var(--mono); }
.source-line { margin: -4px 0 4px; color: var(--quiet); font: 12px var(--mono); }
.scope-line { margin: 0 0 12px; color: var(--ink-3); font: 11px var(--mono); }
.table-link { display: inline-block; margin-top: 4px; color: var(--indigo-ink); font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.table-link:hover { color: var(--indigo); }
.grading-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--nav); }
.grading-stat { padding: 10px 14px; border-right: 1px solid var(--line); }
.grading-stat:last-child { border-right: 0; }
.grading-stat span { display: block; color: var(--quiet); font-size: 12px; }
.grading-stat strong { display: block; margin-top: 3px; font: 600 13px var(--mono); }
.section-scroll { overflow-x: auto; }
.section-table { min-width: 900px; }
.section-head, .section-row { display: grid; grid-template-columns: 1.3fr 1fr .7fr .9fr .8fr 1.2fr; align-items: center; }
.section-head { min-height: 32px; padding: 7px 14px; background: var(--desk); border-bottom: 1px solid var(--line); color: var(--quiet); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.section-head span:not(:first-child) { text-align: center; }
.section-row { min-height: 62px; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.section-row:last-child { border-bottom: 0; }
.section-row:hover { background: var(--raised); }
.section-row[tabindex] { cursor: pointer; }
.section-row[tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.section-row.context-section { background: var(--indigo-wash); outline: 1px solid var(--indigo); outline-offset: -1px; }
.section-name b { display: block; font-size: 12px; font-weight: 600; }
.section-name small { display: block; margin-top: 3px; color: var(--quiet); font-size: 12px; }
.metric { text-align: center; font: 500 13px var(--mono); }
.metric small { display: block; margin-top: 3px; color: var(--quiet); font: 12px var(--sans); }
.metric.review { color: var(--amber); }
.metric.published { color: var(--green); }
.metric.unknown { color: var(--quiet); }
.state { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.course-note { margin: 0; padding: 12px 14px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.register-total { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; min-height: 42px; margin-top: 12px; padding: 9px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); color: var(--muted); font-size: 12px; }
.register-total[hidden] { display: none; }
.register-total strong { color: var(--ink); font: 600 11px var(--mono); }
.register-total .total-label { color: var(--ink); font-weight: 600; }
.register-total .source { margin-left: auto; color: var(--quiet); font: 12px var(--mono); }

.rail { grid-area: rail; min-height: 0; padding: 18px 16px; background: var(--nav); border-left: 1px solid var(--line); overflow: auto; }
.rail-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.rail-head h2 { margin: 0; font-size: 12px; font-weight: 600; }
.rail-head span { color: var(--quiet); font: 12px var(--mono); }
.jobs { display: flex; flex-direction: column; }
.job { position: relative; padding: 0 0 12px 27px; }
.job:not(:last-child)::before { content: ''; position: absolute; left: 8px; top: 15px; bottom: -1px; width: 1px; background: var(--line); }
.job-icon { position: absolute; left: 0; top: 1px; width: 17px; height: 17px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--quiet); }
.job-icon .icon { width: 10px; height: 10px; }
.job.running .job-icon { color: var(--indigo); border-color: var(--indigo); }
.job.done .job-icon { color: var(--green); border-color: var(--green); }
.job.error .job-icon { color: var(--red); border-color: var(--red); }
.job-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.job-top b { font-size: 12px; font-weight: 500; }
.job-meta { margin-top: 4px; color: var(--quiet); font: 12px var(--mono); }
.rail-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.write-safety { padding: 13px; background: var(--green-wash); border: 1px solid var(--green); border-radius: var(--r-lg); }
.write-safety[data-tone='warn'] { background: var(--amber-wash); border-color: var(--amber); }
.write-safety[data-tone='bad'] { background: var(--red-wash); border-color: var(--red); }
.write-safety[data-tone='unknown'] { background: var(--raised); border-color: var(--line); }
.write-title { display: flex; align-items: center; gap: 8px; color: var(--green); font-size: 12px; font-weight: 600; }
.write-safety[data-tone='warn'] .write-title { color: var(--amber); }
.write-safety[data-tone='bad'] .write-title { color: var(--red); }
.write-safety[data-tone='unknown'] .write-title { color: var(--muted); }
.write-title .icon { width: 17px; height: 17px; }
.write-safety p { margin: 9px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.safety-row { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.safety-row b { color: var(--green); font-weight: 500; text-align: right; }
.write-safety[data-tone='warn'] .safety-row b { color: var(--amber); }
.write-safety[data-tone='bad'] .safety-row b,
.write-safety[data-tone='bad'] .safety-foot { color: var(--red); }
.write-safety[data-tone='unknown'] .safety-row b,
.write-safety[data-tone='unknown'] .safety-foot { color: var(--muted); }
.safety-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; color: var(--green); font: 12px var(--mono); }
.write-safety[data-tone='warn'] .safety-foot { color: var(--amber); }
.loading-bar { display: block; width: 42px; height: 2px; margin: 0 auto; background: var(--accent); transform-origin: left; animation: loading 1.2s ease-in-out infinite alternate; }
.error-state .btn { margin-top: 14px; }
@keyframes loading { from { transform: scaleX(.35); opacity: .45; } to { transform: scaleX(1); opacity: 1; } }

@media (max-width: 1180px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 52px auto auto 28px; grid-template-areas: 'top' 'main' 'rail' 'foot'; height: auto; min-height: 100vh; }
  .main, .rail { overflow: visible; }
  .rail { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; border-left: 0; border-top: 1px solid var(--line); }
  .rail-section { margin-top: 0; padding-top: 0; border-top: 0; }
}

@media (max-width: 760px) {
  body { overflow: auto; }
  .shell { display: flex; flex-direction: column; min-height: 100vh; }
  .main { padding: 16px 12px; }
  .page-head { align-items: flex-start; }
  .page-head h1 { font-size: 23px; }
  .head-actions .btn span { display: none; }
  .toolbar { align-items: stretch; }
  .search { flex-basis: 100%; }
  .pulse { grid-template-columns: 1fr 1fr; }
  .pulse-item:nth-child(2) { border-right: 0; }
  .pulse-item:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .course-head { align-items: flex-start; flex-wrap: wrap; }
  .course-title { flex: 1; }
  .course-summary { width: 100%; margin-left: 45px; justify-content: flex-start; }
  .grading-strip { grid-template-columns: 1fr 1fr; }
  .grading-stat:nth-child(2) { border-right: 0; }
  .grading-stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .section-scroll { overflow: visible; }
  .section-table { min-width: 0; }
  .section-head { display: none; }
  .section-row { grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px 14px; }
  .section-name { grid-column: 1 / -1; order: 0; }
  .state { order: 1; }
  .metric { order: 2; }
  .metric, .state { align-items: flex-start; text-align: left; }
  .metric::before, .state::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--quiet); font: 12px var(--sans); }
  .state { grid-column: 1 / -1; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .state::before { width: 100%; }
  .rail { display: flex; flex-direction: column; padding: 16px 12px; }
  .rail-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
}
