/* Teaching surfaces: the teacher portal and the education admin's teaching pages.
   Calm and table-first, after the approved teacher-portal concept: hairline tables,
   one-line notices, plain-text tabs, few containers. Uses the tokens in styles.css. */

:root {
  --tp-side: color-mix(in srgb, var(--story-background) 72%, var(--background));
  --tp-side-hover: color-mix(in srgb, var(--story-background) 100%, #b89a63 14%);
  --tp-line: color-mix(in srgb, var(--border) 60%, var(--background));
  --tp-line-strong: var(--border);
  --tp-wait: #6a537c;
  --tp-admin: #315b78;
  --tp-warn: #9a6218;
  --tp-done: #2f6b58;
}

:root[data-theme="dark"] {
  --tp-side: #221e1a;
  --tp-side-hover: #2e2822;
  --tp-line: #3a3530;
  --tp-line-strong: #5a534c;
  --tp-wait: #c3a8d1;
  --tp-admin: #94bcd6;
  --tp-warn: #e2bb77;
  --tp-done: #8dc8b3;
}

.teaching { font-size: 14px; line-height: 1.45; color: var(--text-primary); }
.teaching button,
.teaching input,
.teaching select,
.teaching textarea { font: inherit; color: inherit; }
.teaching a { color: inherit; }
.teaching b,
.teaching h1,
.teaching h2,
.teaching h3 { font-family: "Avenir-Heavy", "Avenir Next", Avenir, sans-serif; font-weight: 800; }
.teaching .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.teaching .icon { width: 17px; height: 17px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.teaching .muted { color: var(--text-tertiary); }
.teaching .small { font-size: 12px; }
.teaching .accent-text { color: var(--accent); }
.teaching .warn { color: var(--tp-warn); }
.teaching .done { color: var(--tp-done); }
.teaching .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Page heading */
.teaching .page { max-width: 1120px; }
.teaching .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.teaching .page-kicker { margin: 0 0 4px; color: var(--text-secondary); font-size: 13px; }
.teaching .page-kicker a { text-decoration: none; }
.teaching .page-kicker a:hover { color: var(--accent); }
.teaching .page-head h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -0.01em; }
.teaching .page-meta { max-width: 680px; margin: 6px 0 0; color: var(--text-secondary); font-size: 14px; }
.teaching .page-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; }

/* Buttons */
.teaching .button { min-height: 32px; padding: 0 13px; border: 1px solid var(--tp-line-strong); border-radius: 7px; background: transparent; color: var(--text-primary); font-size: 13px; cursor: pointer; white-space: nowrap; }
.teaching .button:hover:not(:disabled) { background: color-mix(in srgb, var(--text-primary) 5%, transparent); }
.teaching .button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-family: "Avenir-Heavy", "Avenir Next", Avenir, sans-serif; font-weight: 800; }
.teaching .button.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, #000); }
.teaching .button:disabled { opacity: .45; cursor: not-allowed; }
.teaching .text-button { padding: 0; border: 0; background: none; color: var(--text-primary); font-size: 13px; cursor: pointer; white-space: nowrap; }
.teaching .text-button:hover:not(:disabled) { text-decoration: underline; }
.teaching .text-button:disabled { opacity: .45; cursor: not-allowed; }
.teaching .text-button.accent,
.teaching .text-button.danger { color: var(--accent); }
.teaching .text-button.muted { color: var(--text-tertiary); }

/* Tabs and filters: plain text, one underline */
.teaching .tabs { display: flex; gap: 22px; margin-bottom: 18px; overflow-x: auto; border-bottom: 1px solid var(--tp-line); }
.teaching .tabs button { position: relative; padding: 8px 0 10px; border: 0; background: none; color: var(--text-secondary); cursor: pointer; white-space: nowrap; }
.teaching .tabs button span,
.teaching .filters button span { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.teaching .tabs button[aria-selected="true"] { color: var(--text-primary); }
.teaching .tabs button[aria-selected="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--text-primary); content: ""; }
.teaching .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; min-height: 40px; margin-bottom: 4px; }
.teaching .toolbar.is-bulk { padding: 0 10px; border-radius: 7px; background: var(--tp-side); }
.teaching .toolbar-end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.teaching .filters { display: flex; flex-wrap: wrap; gap: 4px; }
.teaching .filters button { padding: 3px 9px; border: 0; border-radius: 6px; background: none; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.teaching .filters button:hover { color: var(--text-primary); }
.teaching .filters button[aria-selected="true"] { background: var(--tp-side); color: var(--text-primary); }
.teaching .search input,
.teaching .inline-select select { height: 30px; padding: 0 10px; border: 1px solid var(--tp-line); border-radius: 7px; background: var(--background); font-size: 13px; }
.teaching .search input { width: 220px; }

/* Notices: one quiet line each, at the top of the place they concern */
.teaching .notices { display: grid; gap: 6px; margin-bottom: 16px; }
.teaching .notice { display: flex; align-items: baseline; justify-content: space-between; gap: 18px; padding: 9px 12px; border-left: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 5%, transparent); font-size: 13px; }
.teaching .notice p { margin: 0; }
.teaching .notice-actions { display: flex; flex: 0 0 auto; gap: 14px; }

/* Tables: hairlines only */
.teaching .table { width: 100%; border-collapse: collapse; font-size: 13px; }
.teaching .table th { padding: 8px 10px; border-bottom: 1px solid var(--tp-line-strong); color: var(--text-secondary); font-weight: 400; text-align: left; white-space: nowrap; }
.teaching .table td { padding: 9px 10px; border-bottom: 1px solid var(--tp-line); vertical-align: middle; }
.teaching .table th:first-child,
.teaching .table td:first-child { padding-left: 0; }
.teaching .table th:last-child,
.teaching .table td:last-child { padding-right: 0; }
.teaching .table tbody tr:hover td { background: color-mix(in srgb, var(--text-primary) 2.5%, transparent); }
.teaching .row-link { cursor: pointer; }
.teaching .cell-title { text-decoration: none; }
.teaching .cell-title .code { display: inline-block; min-width: 76px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.teaching .row-link:hover .cell-title { color: var(--accent); }
.teaching .check { width: 28px; }
.teaching .check input { accent-color: var(--accent); }
.teaching .person { display: flex; align-items: baseline; gap: 8px; padding: 0; border: 0; background: none; text-align: left; text-decoration: none; }
.teaching .person b { color: var(--text-primary); font-family: inherit; font-weight: 400; }
.teaching .person span { color: var(--text-tertiary); font-size: 12px; }
.teaching a.person:hover b { color: var(--accent); }
.teaching .row-actions { text-align: right; white-space: nowrap; }
.teaching .row-actions .text-button + .text-button { margin-left: 14px; }
.teaching .status i { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: currentColor; vertical-align: 1px; }
.teaching .s-invited { color: var(--text-secondary); }
.teaching .s-requested { color: var(--accent); }
.teaching .s-waitlisted { color: var(--tp-wait); }
.teaching .s-pendingAdmin { color: var(--tp-admin); }
.teaching .empty { padding: 30px 0 !important; color: var(--text-tertiary); text-align: center; }
.teaching tr.is-selected td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
/* Positioned so visually hidden headers can't escape the horizontal scroll. */
.teaching .table-scroll { position: relative; }
.teaching .after-table { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; color: var(--text-tertiary); font-size: 12px; }

/* Sections and settings */
.teaching .columns { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 48px; align-items: start; }
.teaching .narrow { max-width: 680px; }
.teaching .block { padding: 18px 0; border-top: 1px solid var(--tp-line); }
.teaching .block:first-child { padding-top: 4px; border-top: 0; }
.teaching .block h2,
.teaching .aside-notes h2 { margin: 0 0 10px; font-size: 14px; }
.teaching .setting { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 10px 0; }
.teaching .setting + .setting { border-top: 1px solid var(--tp-line); }
.teaching .setting p { margin: 2px 0 0; color: var(--text-secondary); font-size: 13px; }
.teaching .setting > .small { flex: 0 0 auto; white-space: nowrap; }
.teaching .aside-notes { padding-left: 24px; border-left: 1px solid var(--tp-line); color: var(--text-secondary); font-size: 13px; }
.teaching .aside-notes h2 { color: var(--text-primary); }
.teaching .aside-notes h2:not(:first-child) { margin-top: 22px; }
.teaching .aside-notes ol,
.teaching .aside-notes ul { margin: 0; padding-left: 18px; }
.teaching .aside-notes li + li { margin-top: 6px; }
.teaching .line { display: flex; align-items: baseline; gap: 10px; margin: 0; padding: 7px 0; }
.teaching .line-end { margin-left: auto; text-align: right; }
.teaching .prose { max-width: 600px; margin: 0 0 12px; color: var(--text-secondary); }
.teaching .lead { margin: 0 0 10px; font-size: 15px; }
.teaching .meter { display: flex; height: 5px; overflow: hidden; border-radius: 3px; background: var(--tp-line); }
.teaching .meter span:nth-child(1) { background: var(--text-tertiary); }
.teaching .meter span:nth-child(2) { background: var(--accent); }
.teaching .meter span:nth-child(3) { background: var(--tp-admin); }
.teaching .meter + p { margin-top: 8px; }
.teaching .radio-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.teaching .radio-row input { margin-top: 3px; accent-color: var(--accent); }
.teaching .radio-row > span { display: grid; gap: 1px; }
.teaching .radio-row > span > span { color: var(--text-secondary); font-size: 13px; }
.teaching .sub-list { margin: 2px 0 10px 24px; padding-left: 14px; border-left: 1px solid var(--tp-line); }

/* Fields */
.teaching .field { display: grid; grid-template-columns: 140px 1fr; align-items: center; gap: 14px; padding: 6px 0; }
.teaching .field > span,
.teaching .field-label { color: var(--text-secondary); font-size: 13px; }
.teaching .field input,
.teaching .field select,
.teaching .field textarea { width: 100%; min-height: 32px; padding: 5px 10px; border: 1px solid var(--tp-line); border-radius: 7px; background: var(--background); font-size: 13px; }
.teaching .field textarea { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.6; resize: vertical; }
.teaching .field input:focus,
.teaching .field select:focus,
.teaching .field textarea:focus,
.teaching .search input:focus,
.teaching .inline-select select:focus { border-color: var(--tp-line-strong); outline: 2px solid var(--focus-ring); outline-offset: 0; }
.teaching .form-actions { display: flex; gap: 10px; padding-top: 8px; }

/* Switch */
.teaching .switch { position: relative; flex: 0 0 auto; width: 34px; height: 20px; cursor: pointer; }
.teaching .switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.teaching .switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--tp-line-strong); transition: background 140ms ease; pointer-events: none; }
.teaching .switch span::after { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); content: ""; transition: transform 140ms ease; }
.teaching .switch input:checked + span { background: var(--tp-done); }
.teaching .switch input:checked + span::after { transform: translateX(14px); }
.teaching .switch input:focus-visible + span { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.teaching .switch input:disabled + span { opacity: .45; }

/* Dialog sheet */
.teaching-sheet { width: min(100% - 32px, 540px); padding: 0; border: 1px solid var(--tp-line-strong); border-radius: 12px; background: var(--background); color: var(--text-primary); box-shadow: 0 24px 60px rgba(40, 30, 20, .22); }
.teaching-sheet::backdrop { background: rgba(40, 30, 20, .28); }
.teaching-sheet form { display: grid; gap: 10px; padding: 20px 22px; }
.teaching-sheet header { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.teaching-sheet h2 { margin: 0; font-size: 18px; }
.teaching-sheet header p { margin: 3px 0 0; font-size: 13px; }
.teaching-sheet .field { grid-template-columns: 1fr; gap: 4px; padding: 0; }
.teaching-sheet .field-label { display: flex; justify-content: space-between; }
.teaching-sheet footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.teaching-sheet .error { margin: 0; color: var(--accent); font-size: 13px; }
.teaching .field-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 12px; }
.teaching .close { width: 28px; height: 28px; flex: 0 0 auto; border: 0; border-radius: 6px; background: none; color: var(--text-tertiary); font-size: 20px; line-height: 1; cursor: pointer; }
.teaching .close:hover { background: var(--tp-side); color: var(--text-primary); }
.teaching .check-line { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.teaching .check-line input,
.teaching .choices input { accent-color: var(--accent); }
.teaching .choices { display: grid; gap: 5px; margin: 4px 0 0; padding: 0; border: 0; font-size: 13px; }
.teaching .choices legend { margin-bottom: 4px; color: var(--text-secondary); }
.teaching .plain-list { margin: 0; padding-left: 18px; color: var(--text-secondary); font-size: 13px; }
.teaching .plain-list li + li { margin-top: 4px; }

.teaching-toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: min(380px, calc(100vw - 40px)); padding: 9px 13px; border-radius: 8px; background: var(--text-primary); color: var(--background); font-size: 13px; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.teaching-toast.is-error { background: var(--accent); color: var(--on-accent); }
.teaching .loading-line { margin: 0; padding: 24px 0; color: var(--text-tertiary); }

@media (max-width: 1000px) {
  .teaching .columns { grid-template-columns: 1fr; gap: 24px; }
  .teaching .aside-notes { padding: 18px 0 0; border-top: 1px solid var(--tp-line); border-left: 0; }
}

@media (max-width: 820px) {
  .teaching .person span { display: none; }
  .teaching .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .teaching .page-actions { flex-wrap: wrap; }
  .teaching .toolbar-end { width: 100%; margin-left: 0; }
  .teaching .search { flex: 1; }
  .teaching .search input { width: 100%; }
  .teaching .table-scroll { overflow-x: auto; }
  .teaching .table-scroll .table { min-width: 560px; }
  .teaching .field { grid-template-columns: 1fr; gap: 2px; }
  .teaching .notice { flex-direction: column; gap: 6px; }
  .teaching .setting { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .teaching .switch span,
  .teaching .switch span::after { transition: none; }
}
