
/* ── PCO BUILDER (Build PCO tab) — uses the validator's :root variables ──
   Colours, radii, shadows and motion come from the ece-core token block in
   index.html; this file only maps the builder's pieces onto them. */
#tab-build { --bld-sticky-top: 56px; --bld-editor-h: 0px; }
.bld-spacer { flex: 1; }
.bld-hint { font-size: 12px; color: var(--ink-3); }

/* Buttons: ece-core Button, sm (32px). .bld-btn = secondary, .bld-primary = primary,
   .bld-danger = the solid Danger variant (alert fill, paper text, 90% on hover). */
.bld-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease), opacity var(--ease); }
.bld-btn:hover:not(:disabled) { background: var(--bg-2); }
.bld-btn:disabled { opacity: 0.5; cursor: default; }
.bld-btn.bld-primary { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.bld-btn.bld-primary:hover:not(:disabled) { background: var(--brand-dk); border-color: var(--brand-dk); }
.bld-btn.bld-danger { background: var(--alert); border-color: var(--alert); color: var(--paper); }
.bld-btn.bld-danger:hover:not(:disabled) { background: var(--alert); opacity: 0.9; }

/* Department picker */
.bld-picker { max-width: 440px; margin: 48px auto; padding: 32px; text-align: center; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r-card); display: flex; flex-direction: column; gap: 12px; }
.bld-picker .big-icon { font-size: 36px; line-height: 1; }
.bld-picker h2 { font-size: 20px; font-weight: 600; color: var(--ink); }
.bld-picker p { font-size: 14px; color: var(--ink-3); line-height: 1.5; }
.bld-picker label { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-top: 8px; }
.bld-picker select { height: 40px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font-size: 14px; outline: none; transition: border-color var(--ease), box-shadow var(--ease); }
.bld-picker select:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.bld-picker .bld-btn { height: 40px; padding: 0 16px; font-size: 14px; }

/* Top bar */
.bld-topbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.bld-dept { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--r-chip);
  border: 1px solid var(--brand-lt); background: var(--brand-lt);
  color: var(--brand-dk); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: border-color var(--ease); }
.bld-dept:hover { border-color: var(--brand); }
/* Who enters the PCO into SIS: a two-way toggle beside the department, and in the Submit dialog. */
.bld-sis { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bld-sis-label { margin-right: 4px; font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.bld-dlg-sis { display: flex; flex-direction: column; gap: 4px; }
.bld-dept span { font-weight: 500; font-size: 12px; margin-left: 6px; text-decoration: underline; }

/* Import summary */
.bld-note { position: relative; margin-bottom: 14px; padding: 12px 40px 12px 14px; border-radius: var(--r-card);
  background: var(--brand-tint); border: 1px solid var(--brand-lt); color: var(--ink-2); font-size: 13px; line-height: 1.5; }
.bld-note b { color: var(--ink); }
.bld-note details { margin-top: 6px; }
.bld-note summary { cursor: pointer; color: var(--warn-dk); font-weight: 600; }
.bld-note ul { margin: 6px 0 0 18px; color: var(--ink-3); font-size: 12px; }
.bld-note-close { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border-radius: var(--r-chip);
  background: none; border: none; color: var(--ink-3); cursor: pointer; font-size: 14px;
  transition: background-color var(--ease), color var(--ease); }
.bld-note-close:hover { background: var(--bg-2); color: var(--ink); }

/* Editor — sticky, so it floats over the grid: the one card here that carries the pop shadow */
.bld-editor { position: sticky; top: var(--bld-sticky-top); z-index: 50; margin-bottom: 14px; padding: 14px 16px;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-card); box-shadow: var(--shadow-pop); }
.bld-editor.bld-editing { border-color: var(--brand); }
.bld-editor-title { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px; }
.bld-editor.bld-editing .bld-editor-title { color: var(--brand-dk); }
.bld-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.bld-fields + .bld-fields { margin-top: 10px; }
.bld-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 130px; min-width: 0; }
.bld-field { position: relative; }
.bld-field > span:first-child, .bld-field > label:first-child { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.bld-label { display: flex; align-items: center; gap: 6px; }
.bld-field input:disabled, .bld-field select:disabled { background: var(--bg-2); color: var(--ink-3); cursor: not-allowed; }
/* The small "i" beside a field, and the explanation it opens underneath. */
.bld-info { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 16px; height: 16px; padding: 0;
  border-radius: var(--r-full); border: 1px solid var(--ink-3); background: var(--paper); color: var(--ink-3);
  font: italic 600 11px/1 Georgia, 'Times New Roman', serif; cursor: pointer; transition: color var(--ease), border-color var(--ease); }
.bld-info:hover, .bld-info[aria-expanded="true"] { border-color: var(--brand); color: var(--brand-dk); }
.bld-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; width: 320px; max-width: 86vw; padding: 10px 12px;
  border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--paper); box-shadow: var(--shadow-pop);
  font-size: 12px; font-weight: 400; line-height: 1.5; color: var(--ink-2); }
.bld-pop b { font-weight: 600; color: var(--ink); }
.bld-pop p { margin: 6px 0 0; }
.bld-pop table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.bld-pop td { padding: 3px 0; border-top: 1px solid var(--rule); }
.bld-pop td:last-child { text-align: right; white-space: nowrap; padding-left: 12px; }
.bld-pop tr.total td { font-weight: 600; color: var(--ink); }
.bld-field input, .bld-field select { width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r-chip); border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink); font-size: 14px; outline: none; font-family: inherit;
  transition: border-color var(--ease), box-shadow var(--ease); }
.bld-field input::placeholder { color: var(--ink-3); }
.bld-field input:focus, .bld-field select:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.bld-field input.bld-invalid { border-color: var(--alert); }
.bld-field.w-subj { flex: 0 1 120px; } .bld-field.w-num { flex: 0 1 84px; } .bld-field.w-letter { flex: 0 0 62px; }
.bld-field.w-room { flex: 0 1 120px; } .bld-field.w-instr { flex: 2 1 200px; } .bld-field.w-note { flex: 3 1 240px; }
.bld-editor:not(.bld-editing) .bld-edit-only, .bld-editor.bld-bulk .bld-edit-only { display: none; }
/* Several sections in the form at once: what is changed goes to all of them. */
.bld-bulk-hint { align-self: center; margin-right: 4px; }
.bld-editor.bld-bulk input::placeholder { font-style: italic; }
.bld-with-btn { display: flex; gap: 6px; }
.bld-with-btn .bld-combo { flex: 1 1 auto; min-width: 0; }
.bld-with-btn button { height: 32px; padding: 0 10px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer; transition: background-color var(--ease), color var(--ease); }
.bld-with-btn button:hover:not(:disabled) { color: var(--ink); background: var(--bg-2); }
.bld-with-btn button:disabled, .bld-label .bld-label-act:disabled { opacity: 0.45; cursor: not-allowed; }
.bld-with-btn button { white-space: nowrap; }
/* Something to do, at the end of a field's label line: "+ Co-instructor". */
.bld-label .bld-label-act { margin-left: auto; font-size: 12px; white-space: nowrap; }
.bld-slots { display: flex; gap: 10px; flex-wrap: wrap; }
.bld-slot-row { display: flex; gap: 3px; }
.bld-slot { width: 36px; height: 32px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink-2); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease); }
.bld-slot:hover:not(:disabled) { background: var(--bg-2); color: var(--ink); }
.bld-slot.on { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.bld-slot.on:hover:not(:disabled) { background: var(--brand-dk); color: var(--paper); }
.bld-slot:disabled { opacity: 0.35; cursor: default; }
/* Every day (MT): the T-day period that comes with the M-day one picked. */
.bld-slot.also:disabled { opacity: 1; background: var(--brand-lt); border-color: var(--brand-lt); color: var(--brand-dk); }
.bld-actions { display: flex; gap: 8px; flex: 0 0 auto; }

/* ── Step strip: Build · Validate · Transmit (the masthead band, index.html #step-bar) ──
   Status tiles, not tabs: each says where that part of the PCO stands and jumps to it. */
#step-bar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 16px 12px;
  background: var(--paper); border-bottom: 1px solid var(--rule); }
.bld-step { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; padding: 8px 12px;
  border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--paper); color: var(--ink-3);
  font: inherit; text-align: left; transition: background-color var(--ease), border-color var(--ease); }
button.bld-step, .bld-step-main { cursor: pointer; }
button.bld-step:hover { background: var(--bg-2); }
.bld-step b { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink); }
.bld-step b i { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: var(--r-full);
  background: var(--bg-2); color: var(--ink-2); font-size: 12px; font-style: normal; font-variant-numeric: tabular-nums; }
.bld-step span { max-width: 100%; font-size: 12px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-step.err  { border-color: var(--alert); background: var(--alert-tint); color: var(--alert-dk); }
.bld-step.warn { border-color: var(--warn);  background: var(--warn-tint);  color: var(--warn-dk); }
.bld-step.ok   { border-color: var(--ok);    background: var(--ok-tint);    color: var(--ok-dk); }
.bld-step.info { border-color: var(--brand); background: var(--brand-tint); color: var(--brand-dk); }
.bld-step.err b i  { background: var(--alert); color: var(--paper); }
.bld-step.warn b i { background: var(--warn);  color: var(--paper); }
.bld-step.ok b i   { background: var(--ok);    color: var(--paper); }
.bld-step.info b i { background: var(--brand); color: var(--paper); }
#bld-step-transmit { flex-direction: row; align-items: center; gap: 10px; }
.bld-step-main { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; flex: 1; min-width: 0; padding: 0;
  border: none; background: none; color: inherit; font: inherit; text-align: left; }
#bld-step-transmit .bld-btn { flex-shrink: 0; }
@media (max-width: 760px) {
  #step-bar { grid-template-columns: minmax(0, 1fr); }
  .bld-step span { white-space: normal; }
  /* On a phone the form is taller than the screen: it scrolls with the page instead of
     sticking, and a jump lands just under the header. */
  .bld-editor { position: static; }
  #tab-build { --bld-editor-h: 0px !important; }
}

/* ── The workspace: schedule, with the checks beside it when there is room ── */
.bld-work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-bottom: 18px; }
.bld-work .bld-grid-wrap { margin-bottom: 0; }
.bld-rail { min-width: 0; align-self: start; padding: 12px 14px; border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--paper); }
/* 1400px is where the schedule (1000px at its narrowest) and the rail fit side by side
   without the schedule scrolling sideways; below that the checks flow under it. */
@media (min-width: 1400px) {
  .bld-work { grid-template-columns: minmax(0, 1fr) 320px; }
  /* Stays in view under the sticky editor while a long schedule scrolls. */
  .bld-rail { position: sticky; top: calc(var(--bld-sticky-top) + var(--bld-editor-h) + 12px);
    max-height: calc(100vh - var(--bld-sticky-top) - var(--bld-editor-h) - 24px); overflow-y: auto; }
}
#bld-editor, #bld-checks, #bld-grid-table, .bld-sec { scroll-margin-top: calc(var(--bld-sticky-top) + var(--bld-editor-h) + 12px); }
#bld-editor { scroll-margin-top: calc(var(--bld-sticky-top) + 12px); }

/* Checks */
.bld-count { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: var(--r-full);
  font-size: 12px; font-weight: 500; white-space: nowrap; }
.bld-count.err  { background: var(--alert-lt); color: var(--alert-dk); }
.bld-count.warn { background: var(--warn-lt);  color: var(--warn-dk); }
.bld-count.ok   { background: var(--ok-lt);    color: var(--ok-dk); }
.bld-check-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.bld-check-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.bld-check { border-radius: var(--r-chip); border-left: 3px solid var(--warn); background: var(--warn-tint); }
.bld-check.sev-error { border-left-color: var(--alert); background: var(--alert-tint); }
.bld-check > button { display: flex; gap: 10px; width: 100%; padding: 8px 10px; border: none; background: none; font: inherit;
  font-size: 13px; text-align: left; cursor: pointer; border-radius: 0 var(--r-chip) var(--r-chip) 0; }
.bld-check > button:hover { background: var(--bg-2); }
.bld-check.on { box-shadow: 0 0 0 2px var(--brand); }
.bld-issue-id { flex: 0 0 44px; font-weight: 600; color: var(--warn-dk); font-variant-numeric: tabular-nums; }
.bld-check.sev-error .bld-issue-id { color: var(--alert-dk); }
.bld-check-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bld-check-text b { font-weight: 600; color: var(--ink); }
.bld-check-text span { font-size: 12px; color: var(--ink-3); }
.bld-check-detail { list-style: none; margin: 0; padding: 0 10px 8px 64px; font-size: 12px; color: var(--ink-2); }
.bld-check-detail li { padding: 2px 0; overflow-wrap: anywhere; }
.bld-check-detail b { font-weight: 600; color: var(--ink); }
/* Why an open check is flagged, in a line, and the way to its rule in the guide. */
.bld-check-why { margin: 0; padding: 0 10px 10px 64px; font-size: 12px; line-height: 1.45; color: var(--ink-2); }
.bld-check-why a, .bld-just-about { color: var(--brand-dk); font-weight: 600; white-space: nowrap; }
.bld-just-about { margin-left: auto; padding-left: 12px; font-size: 12px; align-self: flex-start; }
.bld-rules-link a { color: var(--brand-dk); font-weight: 600; }
.bld-check-ok { margin: 0 0 10px; font-size: 13px; color: var(--ok-dk); }
/* The justification each open check needs before the PCO can be submitted. */
.bld-check-text .bld-just-tag { align-self: flex-start; margin-top: 2px; padding: 1px 8px; border-radius: var(--r-full); font-size: 11px; font-weight: 600;
  background: var(--paper); color: var(--warn-dk); border: 1px solid var(--warn-lt); }
.bld-check.sev-error .bld-just-tag { color: var(--alert-dk); border-color: var(--alert-lt); }
.bld-check-text .bld-just-tag.ok { color: var(--ok-dk); border-color: var(--ok-lt); }
.bld-just { display: flex; flex-direction: column; gap: 4px; padding: 0 10px 10px 64px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.bld-just textarea, .bld-just-item textarea { padding: 8px 10px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font: inherit; font-size: 13px; font-weight: 400; line-height: 1.45; outline: none; resize: vertical;
  transition: border-color var(--ease), box-shadow var(--ease); }
.bld-just textarea::placeholder, .bld-just-item textarea::placeholder { color: var(--ink-3); }
.bld-just textarea:focus, .bld-just-item textarea:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.bld-rail > .bld-hint b { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.bld-rail > .bld-hint { display: block; margin: 0 0 10px; line-height: 1.5; }
.bld-passed { font-size: 12px; color: var(--ink-3); }
.bld-passed summary { cursor: pointer; font-weight: 500; }
.bld-passed ul { list-style: none; margin: 6px 0 0; padding: 0; }
.bld-passed li { display: flex; gap: 10px; padding: 2px 0; }
.bld-passed .bld-issue-id { color: var(--ok-dk); }
/* A check picked in the rail: its lines stand out, the rest step back. */
#bld-grid-table .bld-chip.bld-dim { opacity: 0.35; }
#bld-grid-table .bld-chip.bld-hit, #bld-grid-table td.bld-hit { box-shadow: 0 0 0 2px var(--brand); }

/* ── Sections under the schedule: collapsed to one line until wanted ── */
.bld-sec { margin-bottom: 12px; border-radius: var(--r-card); border: 1px solid var(--rule); background: var(--paper); }
.bld-sec[hidden] { display: none; }
.bld-sec > summary { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; cursor: pointer; list-style: none;
  border-radius: var(--r-card); transition: background-color var(--ease); }
.bld-sec > summary::-webkit-details-marker { display: none; }
.bld-sec > summary::before { content: '▸'; color: var(--ink-3); font-size: 12px; transition: transform var(--ease); }
.bld-sec[open] > summary::before { transform: rotate(90deg); }
.bld-sec > summary:hover { background: var(--bg-2); }
.bld-sec > summary h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
.bld-sec > :not(summary) { margin-left: 14px; margin-right: 14px; }
.bld-sec > :last-child:not(summary) { margin-bottom: 14px; }
.bld-sec .bld-lines-wrap { margin-bottom: 0; }
.bld-sec-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.bld-seats-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bld-seats-table th { background: var(--bg-2); color: var(--ink-3); padding: 8px 10px; text-align: left; font-weight: 600; font-size: 12px;
  letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--rule); }
.bld-seats-table td { padding: 6px 10px; border-top: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
.bld-seats-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.bld-seats-table tr.short td:last-child { color: var(--alert-dk); font-weight: 600; }
.bld-seats-table tr.met td:last-child { color: var(--ok-dk); font-weight: 600; }

/* Section headings */
.bld-section-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.bld-section-head h3 { font-size: 16px; font-weight: 600; color: var(--ink); }
#bld-filter { height: 32px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font-size: 14px; width: 200px; outline: none; transition: border-color var(--ease), box-shadow var(--ease); }
#bld-filter::placeholder { color: var(--ink-3); }
#bld-filter:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }

/* Grid */
.bld-grid-wrap, .bld-lines-wrap { overflow-x: auto; border-radius: var(--r-card); border: 1px solid var(--rule);
  background: var(--paper); margin-bottom: 22px; }
#bld-grid-table { width: 100%; min-width: 1000px; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
#bld-grid-table th { background: var(--bg-2); color: var(--ink-3); padding: 8px 4px; text-align: center; font-weight: 600; font-size: 12px;
  letter-spacing: 0.05em; line-height: 1.3; font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--rule); }
#bld-grid-table th span { font-weight: 400; }
#bld-grid-table th.bld-rowhead { width: 176px; text-align: left; padding-left: 12px; text-transform: uppercase; }
#bld-grid-table th.bld-unsched-col { width: 84px; }
#bld-grid-table td { border: 1px solid var(--rule); padding: 3px; vertical-align: top; height: 52px; }
#bld-grid-table tr > :first-child { border-left: none; }
#bld-grid-table tr > :last-child { border-right: none; }
#bld-grid-table tbody tr:last-child td { border-bottom: none; }
#bld-grid-table .bld-daygap { border-left: 2px solid var(--brand-lt); }
#bld-grid-table td.bld-rowhead { background: var(--paper); cursor: pointer; padding: 6px 8px; transition: background-color var(--ease); }
#bld-grid-table td.bld-rowhead:hover { background: var(--bg-2); }
#bld-grid-table td.bld-rowhead { position: relative; }
#bld-grid-table td.bld-rowhead div { padding-left: 8px; padding-right: 24px; display: flex; flex-direction: column; }
/* A row's tick box: every section in the row, to change or delete together. */
.bld-rowsel { position: absolute; right: 8px; top: 9px; width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: var(--brand); }
/* The schedule's heading: the hint wraps within itself, and the Rows choices stay together. */
.bld-grid-hint { flex: 1 1 320px; min-width: 0; line-height: 1.5; }
.bld-rows { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
#bld-grid-table td.bld-rowhead b { font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bld-grid-table td.bld-rowhead span { font-size: 12px; color: var(--ink-3); font-weight: 400; }
#bld-grid-table td.bld-cell { background: var(--paper); cursor: pointer; transition: background-color var(--ease); }
#bld-grid-table td.bld-cell:hover { background: var(--brand-tint); }
#bld-grid-table td.bld-unsched-col { background: var(--bg); }
#bld-grid-table td.bld-drop-ok { background: var(--ok-tint); outline: 2px solid var(--ok); outline-offset: -2px; }
#bld-grid-table td.bld-drop-busy { background: var(--alert-tint); outline: 2px solid var(--alert); outline-offset: -2px; }
#bld-grid-table td.bld-drop-no { cursor: not-allowed; }
.bld-empty { text-align: center; padding: 28px !important; color: var(--ink-3); font-size: 13px; height: auto !important; }
/* Chips: fill / border / text per course from COURSE_COLORS (index.html), same as the validator grid. */
.bld-chip { display: flex; flex-direction: column; gap: 1px; padding: 3px 4px; margin-bottom: 3px; border: 1px solid; border-left-width: 3px;
  border-radius: var(--r-chip); font-size: 11px; line-height: 1.3; cursor: grab; overflow: hidden; user-select: none; }
.bld-chip .sec-code { color: inherit; }
.bld-chip:last-child { margin-bottom: 0; }
.bld-chip:active { cursor: grabbing; }
.bld-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bld-chip .sec-code em { font-style: normal; font-weight: 500; font-size: 10px; opacity: 0.8; margin-left: 5px; }
.bld-chip.bld-dragging { opacity: 0.35; }
.bld-chip.bld-current { box-shadow: 0 0 0 2px var(--brand); }
/* An every-day section's T-day copy: the same section as the one under its M-day period. */
.bld-chip.bld-twin { border-style: dashed; border-left-style: solid; }
.bld-chip.bld-twin.has-error, .bld-chip.bld-twin.has-warning { outline-style: dashed; } /* a check's outline would hide the dashes */
/* A course name, or a co-taught section's "Rivera +1", set a little smaller and closer to fit a narrow chip. */
.bld-chip .sec-room.sec-tight, .bld-chip .sec-instr.sec-tight { font-size: 10px; letter-spacing: -0.03em; word-spacing: -0.1em; }

/* Lines table */
#bld-lines-table { width: 100%; border-collapse: collapse; font-size: 13px; }
#bld-lines-table th { background: var(--bg-2); color: var(--ink-3); padding: 8px 10px; text-align: left; font-weight: 600; font-size: 12px;
  letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--rule); position: sticky; top: 0; }
#bld-lines-table td { padding: 6px 10px; border-top: 1px solid var(--rule); color: var(--ink-2); white-space: nowrap; }
#bld-lines-table tbody tr[data-line] { cursor: pointer; border-left: 3px solid transparent; }
#bld-lines-table tbody tr[data-line]:hover { background: var(--bg-2); }
#bld-lines-table tr.sev-warning { border-left-color: var(--warn); }
#bld-lines-table tr.sev-error { border-left-color: var(--alert); }
#bld-lines-table tr.bld-current { background: var(--brand-tint); }
#bld-lines-table .derived { color: var(--ink-3); }
#bld-lines-table td.blank { color: var(--warn-dk); }

/* Toasts — tone border, -lt fill, -dk text */
#bld-toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px;
  width: 320px; max-width: calc(100vw - 32px); }
.bld-toast { padding: 8px 12px; border-radius: var(--r-card); background: var(--brand-lt); border: 1px solid var(--brand);
  color: var(--brand-dk); font-size: 14px; line-height: 1.45; box-shadow: var(--shadow-toast); }
.bld-toast.success { background: var(--ok-lt); border-color: var(--ok); color: var(--ok-dk); }
.bld-toast.error { background: var(--alert-lt); border-color: var(--alert); color: var(--alert-dk); }

/* ── Registrar connection: sign-in, status, submit, versions, conversation ── */
.bld-picker input { height: 40px; padding: 0 12px; border-radius: var(--r-chip); border: 1px solid var(--rule); background: var(--paper);
  color: var(--ink); font-size: 14px; outline: none; transition: border-color var(--ease), box-shadow var(--ease); }
.bld-picker input::placeholder { color: var(--ink-3); }
.bld-picker input:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.bld-picker-error { min-height: 1.1em; font-size: 13px; color: var(--alert-dk); }
.bld-picker p.bld-picker-note { font-size: 12px; margin-top: -4px; }

/* Status pill (Badge tones, same as the registrar dashboard): neutral / submitted =
   brand / returned = alert / viewed = accent / QC'd = ok */
.bld-pill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: var(--r-full); font-size: 12px; font-weight: 500;
  white-space: nowrap; background: var(--bg-2); color: var(--ink-3); }
.bld-pill.sub  { background: var(--brand-lt);  color: var(--brand-dk); }
.bld-pill.ret  { background: var(--alert-lt);  color: var(--alert-dk); }
.bld-pill.view { background: var(--accent-lt); color: var(--accent-dk); }
.bld-pill.qcd  { background: var(--ok-lt);     color: var(--ok-dk); }

.bld-note.bld-warn { background: var(--warn-tint); border-color: var(--warn-lt); padding-right: 14px; }
.bld-note-actions { display: inline-flex; gap: 8px; margin-left: 10px; }

/* Submit dialog — ece-core Modal: paper panel, 12px radius, ruled header and footer, scrim */
#bld-submit-dlg { margin: auto; padding: 0; border: 1px solid var(--rule); border-radius: var(--r-modal); background: var(--paper);
  color: var(--ink-2); width: min(520px, 92vw); box-shadow: var(--shadow-pop); overflow: hidden; }
#bld-submit-dlg::backdrop { background: var(--scrim); }
.bld-dlg { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.bld-dlg h3 { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.4;
  margin: -16px -20px 0; padding: 12px 20px; border-bottom: 1px solid var(--rule); }
.bld-dlg p { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.bld-dlg p.bld-hint { font-size: 13px; color: var(--ink-3); }
.bld-dlg p b { color: var(--ink); }
.bld-dlg-checks { display: flex; gap: 8px; }
.bld-dlg-block { color: var(--alert-dk) !important; }
.bld-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.bld-dlg input, .bld-dlg textarea, .bld-compose input, .bld-compose textarea { padding: 8px 12px; border-radius: var(--r-chip);
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 400; font-family: inherit;
  outline: none; resize: vertical; transition: border-color var(--ease), box-shadow var(--ease); }
.bld-dlg input, .bld-compose input { height: 40px; padding-top: 0; padding-bottom: 0; }
.bld-dlg input::placeholder, .bld-dlg textarea::placeholder, .bld-compose input::placeholder, .bld-compose textarea::placeholder { color: var(--ink-3); }
.bld-dlg input:focus, .bld-dlg textarea:focus, .bld-compose textarea:focus, .bld-compose input:focus { border-color: var(--brand); box-shadow: var(--shadow-focus); }
.bld-dlg-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin: 4px -20px -16px; padding: 12px 20px;
  border-top: 1px solid var(--rule); }
.bld-dlg-left { margin-right: auto; font-size: 13px; font-weight: 500; color: var(--warn-dk); }
/* The justifications asked for in the dialog: one box per PCO error and broken rule. */
#bld-submit-dlg.bld-dlg-wide { width: min(680px, 94vw); }
#bld-submit-dlg .bld-dlg { max-height: calc(100vh - 40px); overflow-y: auto; }
/* On a short screen the dialog scrolls inside itself; Cancel and Submit stay in reach at its foot. */
#bld-submit-dlg .bld-dlg-actions { position: sticky; bottom: -16px; background: var(--paper); }
.bld-dlg-just { display: flex; flex-direction: column; gap: 8px; }
.bld-dlg-just h4 { font-size: 14px; font-weight: 600; color: var(--ink); }
.bld-dlg-just h4 span { font-weight: 500; color: var(--ink-3); }
.bld-just-list { list-style: none; margin: 0; padding: 2px; display: flex; flex-direction: column; gap: 8px; max-height: min(44vh, 460px); overflow-y: auto; }
.bld-just-item { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: var(--r-chip);
  border-left: 3px solid var(--warn); background: var(--warn-tint); }
.bld-just-item.sev-error { border-left-color: var(--alert); background: var(--alert-tint); }
.bld-just-item.sev-error .bld-issue-id { color: var(--alert-dk); }
.bld-just-head { display: flex; gap: 10px; font-size: 13px; }
/* The justifications a version was filed with, under Versions. */
.bld-versions tr.bld-why td { padding-top: 0; border-top: none; }
.bld-why ul { list-style: none; margin: 0; padding: 8px 10px; display: flex; flex-direction: column; gap: 8px; border-radius: var(--r-chip); background: var(--bg-2); }
.bld-why li { display: flex; gap: 10px; font-size: 13px; }
.bld-why li.sev-error .bld-issue-id { color: var(--alert-dk); }
.bld-why li > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bld-why b { font-weight: 600; color: var(--ink); }
.bld-why-text { color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.bld-why-secs { font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }

.bld-server-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; margin-bottom: 30px; }
@media (max-width: 1000px) { .bld-server-grid { grid-template-columns: 1fr; } }
.bld-panel { padding: 16px 20px; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r-card); min-width: 0; }
.bld-panel.bld-attn { border-color: var(--brand); }
.bld-panel h4 { font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px; }
.bld-versions { width: 100%; border-collapse: collapse; font-size: 13px; }
.bld-versions th { text-align: left; font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); padding: 4px 8px 6px; }
.bld-versions td { padding: 6px 8px; border-top: 1px solid var(--rule); color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* The card is as narrow as half the page or a phone. Under 820px, where the table's seven
   columns no longer sit on one line, it becomes a list: each version a wrapping row with
   its buttons at the end, so nothing is squeezed and nothing leaves the card. */
.bld-versions-wrap { overflow-x: auto; }
.bld-versions tr:not(.bld-why) td:first-child, .bld-nowrap { white-space: nowrap; }
.bld-panel { container-type: inline-size; }
@container (max-width: 820px) {
  .bld-versions thead { display: none; }
  .bld-versions, .bld-versions tbody { display: block; }
  .bld-versions tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-top: 1px solid var(--rule); }
  .bld-versions td { padding: 0; border-top: none; }
  .bld-versions td:nth-child(4)::after { content: ' lines'; }
  .bld-versions tr:not(.bld-why) td:nth-child(5)::before { content: 'SIS: '; }
  .bld-versions .bld-version-acts { margin-left: auto; }
  .bld-versions tr.bld-why { display: block; padding-top: 0; border-top: none; }
  .bld-versions tr.bld-why td { display: block; }
}
.bld-versions td b { color: var(--ink); font-weight: 600; }
.bld-versions .bld-btn { height: 28px; padding: 0 10px; font-size: 12px; }
.bld-thread { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; margin-bottom: 10px; }
/* Department messages (this side) are neutral; the registrar's are brand-tinted, as on the dashboard. */
.bld-msg { max-width: 88%; padding: 8px 12px; border-radius: var(--r-card); font-size: 14px; line-height: 1.45; color: var(--ink-2);
  background: var(--bg); border: 1px solid var(--rule); align-self: flex-end; }
.bld-msg.registrar { background: var(--brand-tint); border-color: var(--brand-lt); align-self: flex-start; }
.bld-msg.returned { background: var(--alert-tint); border-color: var(--alert-lt); }
.bld-msg-head { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.bld-msg-head b { color: var(--ink); font-weight: 600; }
.bld-msg-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bld-event { align-self: center; font-size: 12px; color: var(--ink-3); text-align: center; }
.bld-event b { color: var(--ink-2); font-weight: 600; }
.bld-event q { display: block; font-style: italic; margin-top: 2px; }
.bld-compose { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.bld-compose textarea { flex: 1 1 220px; }

/* ── Course search: suggestions under Subject and Number ── */
.bld-combo { position: relative; display: block; }
.bld-combo-list { position: absolute; top: calc(100% + 4px); left: 0; z-index: 60; min-width: 100%; width: max-content; max-width: 320px;
  max-height: 264px; overflow-y: auto; margin: 0; padding: 4px; list-style: none; background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r-card); box-shadow: var(--shadow-pop); }
.bld-combo-list li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 6px 8px;
  border-radius: var(--r-chip); cursor: pointer; font-size: 14px; color: var(--ink); white-space: nowrap; }
.bld-combo-list li b { font-weight: 500; }
.bld-combo-list li span { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bld-combo-list li:hover, .bld-combo-list li.on { background: var(--bg-2); }

/* Read-only course facts in the form: pre-enrollment and seats still needed */
.bld-ro { display: flex; align-items: baseline; gap: 5px; height: 32px; line-height: 30px; padding: 0 10px; border-radius: var(--r-chip);
  border: 1px solid var(--rule); background: var(--bg-2); color: var(--ink-2); font-size: 14px; font-weight: 500;
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: default; }
.bld-ro small { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.bld-ro.ok { background: var(--ok-tint); border-color: var(--ok); color: var(--ok-dk); }
.bld-ro.warn { background: var(--warn-tint); border-color: var(--warn); color: var(--warn-dk); }
.bld-ro.ok small, .bld-ro.warn small { color: inherit; }
.bld-field.w-pre { flex: 0 1 104px; } .bld-field.w-left { flex: 0 1 148px; }
.bld-ro-wrap { position: relative; display: block; }
.bld-ro-wrap .bld-ro { padding-right: 30px; }
.bld-ro-wrap .bld-info { position: absolute; top: 50%; right: 8px; transform: translateY(-50%); background: transparent; }
.bld-ro.ok + .bld-info { border-color: var(--ok-dk); color: var(--ok-dk); }
.bld-ro.warn + .bld-info { border-color: var(--warn-dk); color: var(--warn-dk); }

/* ── Pre-enrollment: where the counts come from ── */
.bld-enroll-note { display: flex; align-items: center; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 14px; padding: 8px 12px;
  border-radius: var(--radius); border: 1px solid var(--rule); background: var(--paper); font-size: 13px; color: var(--ink-2); }
.bld-enroll-note b { color: var(--ink); }
.bld-enroll-note.warn { background: var(--warn-tint); border-color: var(--warn); color: var(--warn-dk); }
.bld-link { padding: 0; border: none; background: none; font: inherit; font-weight: 500; color: var(--brand-dk); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.bld-link:hover { color: var(--brand); }

/* Versions: reopen one in the builder, or save its spreadsheet */
.bld-version-acts > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.bld-version-acts .bld-btn { white-space: nowrap; }

/* ── The registrar's review: a submitted version, read-only (builder.js bldMountReview) ── */
.bld-review-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 12px 16px;
  border: 1px solid var(--rule); border-radius: var(--r-card); background: var(--paper); }
.bld-review-head > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bld-review-head b { font-size: 16px; font-weight: 600; color: var(--ink); }
.bld-review-tag { margin-left: auto; padding: 3px 10px; border-radius: var(--r-full); background: var(--bg-2); color: var(--ink-2);
  font-size: 12px; font-weight: 500; white-space: nowrap; }
/* The department's justification, under its check. */
.bld-just-read { margin: 0; padding: 0 10px 10px 64px; font-size: 13px; line-height: 1.45; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.bld-just-read.none { color: var(--ink-3); font-style: italic; }
/* Nothing to add, pick or drag. */
.bld-reviewing .bld-rowsel { display: none; }
.bld-reviewing #bld-grid-table td.bld-cell, .bld-reviewing #bld-grid-table td.bld-rowhead { cursor: default; }
.bld-reviewing #bld-grid-table td.bld-cell:hover { background: var(--paper); }
.bld-reviewing .bld-chip { cursor: default; }
.bld-reviewing #bld-lines-table tr[data-line] { cursor: default; }
