/* ContEd Hours Tracker palette (2026-08-23, Neil's "should everything feel
   visually connected?"). Every value here is one of the tracker's own design
   tokens converted out of HSL — nwioi-connect/src/index.css is the source of
   truth, and nothing in this file invents a colour that isn't in it. The old
   cream-and-terracotta values are in git if we ever want them back.

   --accent used to be BOTH the brand red and the danger/recording red. The
   tracker's primary is a tan, which is wrong for a record dot, so danger
   split off into its own token rather than following the brand. */
:root {
  --paper: #F9F8F6;        /* tracker --background        40 20% 97%  */
  --ink: #2C3E54;          /* tracker --foreground       213 31% 25%  */
  --accent: #C99B64;       /* tracker --primary           33 48% 59%  */
  --accent-2: #3C4931;     /* tracker --accent (olive)    93 20% 24%  */
  --gold: #AA783C;         /* tracker --chart-4           33 48% 45%  */
  --muted: #5E738D;        /* tracker --muted-foreground 213 20% 46%  */
  --border: #E7E1DA;       /* tracker --border            33 20% 88%  */
  --danger: #DC2828;       /* tracker --destructive        0 72% 51%  */
  --card: #FFFFFF;         /* tracker --card                          */
  --soft: #F2F0ED;         /* tracker --muted             40 15% 94%  */
  --secondary: #E5EBE0;    /* tracker --secondary         93 20% 90%  */
}

@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400;14..32,500;14..32,600;14..32,700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.55;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 32px 20px 80px; }

h1 {
  font-family: "Plus Jakarta Sans", Inter, sans-serif;
  color: var(--ink);
  font-size: 28px;
  margin: 0 0 6px;
}
h2 { font-family: "Plus Jakarta Sans", Inter, sans-serif; font-size: 18px; margin: 28px 0 10px; border-bottom: 1px solid var(--border); padding-bottom: 6px; }
p.dim, div.dim { color: var(--muted); font-size: 14px; }

.panel {
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  margin: 18px 0;
}

label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 5px; }
input[type=text], input[type=email], input[type=number], textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #ccc;
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border: 2px solid var(--ink); }
.btn--danger { background: var(--danger); }
.btn--small { padding: 6px 14px; font-size: 13px; }

.chip {
  display: inline-block;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  margin: 2px 4px 2px 0;
}
.chip--gold { background: var(--gold); }
.chip--green { background: var(--secondary); }

.cka-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cka-grid label {
  display: inline-flex; align-items: center; gap: 6px;
  font-weight: 400; font-size: 13px; margin: 0;
  border: 1px solid #ddd; border-radius: 7px; padding: 6px 10px; cursor: pointer;
}
.cka-grid input { width: auto; }

.list-row {
  display: flex; gap: 10px; align-items: flex-start;
  border: 1px solid #eee; border-radius: 8px; padding: 10px; margin: 8px 0;
}
.list-row > div { flex: 1; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; }
th { background: var(--soft); }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--paper); }

video { width: 100%; border-radius: 8px; background: #000; }

/* Invite tabs (admin) — the light-theme cousin of the studio's .sec-tab:
   folder tabs over a shared title + editable email template. */
.inv-tabs { display: flex; gap: 6px; margin: 0 0 16px; border-bottom: 2px solid var(--ink); }
.inv-tab {
  background: var(--soft); border: 2px solid var(--border); border-bottom: 2px solid transparent;
  margin-bottom: -2px; border-radius: 8px 8px 0 0; padding: 7px 16px;
  font: inherit; font-size: 14px; cursor: pointer; color: var(--ink); opacity: 0.75;
}
.inv-tab.active {
  background: #fff; border-color: var(--ink); border-bottom: 2px solid #fff;
  opacity: 1; font-weight: 600;
}

.rec-controls { display: flex; gap: 10px; margin: 12px 0; align-items: center; flex-wrap: wrap; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--danger); display: none; }
.rec-dot.on { display: inline-block; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

/* Live mic level in the record modal — a dead meter is the tell for a
 * blocked/silent microphone. */
.mic-meter {
  display: inline-block; width: 90px; height: 8px; border-radius: 4px;
  background: rgba(127, 127, 127, 0.25); overflow: hidden; vertical-align: middle;
}
.mic-meter > span { display: block; height: 100%; width: 0; background: #43a047; transition: width 0.12s linear; }
.mic-warning { color: #b26a00; font-size: 14px; margin: 10px 0 0; }
.theme-studio .mic-warning { color: #ffb74d; }

/* ============ Instructor Studio ============ */

.wrap--wide { max-width: 900px; }

.template-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 12px; }
.template-card {
  border: 2px solid var(--border); border-radius: 10px; padding: 16px;
  cursor: pointer; background: #fff; text-align: left; font-family: inherit; font-size: 14px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.template-card:hover { transform: translateY(-2px); box-shadow: 3px 3px 0 var(--border); }
.template-card .tpl-icon { font-size: 26px; }
.template-card h3 { margin: 8px 0 4px; font-family: "Plus Jakarta Sans", Inter, sans-serif; font-size: 16px; }
.template-card p { margin: 0; color: var(--muted); font-size: 13px; }

.progress-track { background: var(--border); border-radius: 999px; height: 10px; overflow: hidden; min-width: 160px; flex: 1; }
.progress-fill { background: var(--accent-2); height: 100%; border-radius: 999px; transition: width 0.2s ease; }
.progress-fill.done { background: #4a9a4a; }
.progress-fill.over { background: var(--gold); }

.storyboard-empty {
  border: 2px dashed var(--border); border-radius: 9px; color: var(--muted); font-size: 13px;
  display: flex; align-items: center; justify-content: center; padding: 12px 18px; flex: 1;
}

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(26,26,26,0.55); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto;
}
.modal-box {
  background: var(--paper); border: 2px solid var(--border); border-radius: 12px;
  width: 100%; max-width: 760px; padding: 20px 22px; position: relative;
}
.modal-box h2 { margin-top: 0; }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 20px; cursor: pointer; color: var(--muted); }

.region-stage { position: relative; display: inline-block; max-width: 100%; }
.region-stage video { display: block; max-width: 100%; }
.region-overlay { position: absolute; inset: 0; cursor: crosshair; }
.region-rect { position: absolute; border: 2px solid var(--gold); background: rgba(245,200,75,0.15);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35); pointer-events: none; }

.seg-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.upload-bar { background: var(--border); border-radius: 999px; height: 12px; overflow: hidden; margin: 10px 0; }
.upload-bar > div { background: var(--accent-2); height: 100%; transition: width 0.15s linear; }

.bubble-opts { display: flex; gap: 8px; align-items: center; margin: 0 0 10px 26px; font-size: 13px; flex-wrap: wrap; }
.bubble-opts select { font-size: 13px; padding: 5px 8px; }
#rm-selfview {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex: 0 0 64px;
  background: #000; border: 2px solid rgba(255, 255, 255, 0.7);
}
.bubble-drag-overlay { position: absolute; inset: 0; touch-action: none; }
.rm-monitor video { display: block; max-width: 100%; max-height: 200px; }

/* ============ Studio v3 — dark editor theme ============ */
/* Everything below is scoped to body.theme-studio (class.html only) so the
   admin pages keep the cream look. Token overrides first: components that
   use the CSS variables restyle themselves; the rest get explicit overrides. */

/* The studio in the ContEd palette (2026-08-23). It used to be a dark editor
   theme; Neil picked the light one off a side-by-side — "the high contrast" —
   so the studio is a document tool that happens to record video, not a
   miniature Final Cut. The dark values are in git if that's ever regretted.

   The one thing that stayed dark on purpose: video. #main-video and the clip
   thumbnails keep black behind them, because letterboxing video against
   paper looks like a bug. Clip labels stay white-on-shadow for the same
   reason — they sit on top of frames, not on the page. */
body.theme-studio {
  --paper: #F9F8F6;
  --ink: #2C3E54;
  --accent: #C99B64;
  --accent-2: #3C4931;
  --gold: #AA783C;
  --muted: #5E738D;
  --border: #E7E1DA;
  --card: #FFFFFF;
  --panel: #FFFFFF;
  --soft: #F2F0ED;
  --secondary: #E5EBE0;
  --field: #FFFFFF;
  --field-border: #E7E1DA;
  --hover: #F2F0ED;
  background: var(--paper);
}


.theme-studio .panel { background: var(--panel); border: 1px solid var(--border); }
.theme-studio h2 { border-bottom-color: var(--border); }
.theme-studio input[type=text], .theme-studio input[type=email], .theme-studio input[type=number],
.theme-studio textarea, .theme-studio select {
  background: var(--field); border-color: var(--field-border); color: var(--ink);
}
.theme-studio .chip { background: var(--hover); border-color: var(--field-border); }
.theme-studio .chip--gold { background: #F0E2CC; }
.theme-studio .chip--green { background: var(--secondary); }
.theme-studio .template-card { background: var(--panel); border: 1px solid var(--border); color: var(--ink); }
.theme-studio .template-card:hover { box-shadow: 0 2px 10px rgba(44, 62, 84, 0.10); }
.theme-studio .list-row { border-color: var(--border); }
.theme-studio .cka-grid label { border-color: var(--field-border); }
.theme-studio .progress-track, .theme-studio .upload-bar { background: var(--hover); }
.theme-studio .modal-overlay { background: rgba(0, 0, 0, 0.65); }
.theme-studio .modal-box { background: var(--panel); border: 1px solid var(--border); }
.theme-studio .storyboard-empty { border-color: var(--field-border); }

/* --- Editor grid --- */

#editor {
  display: grid;
  grid-template-areas: "top top top" "outline stage library" "tl tl tl";
  grid-template-rows: 52px 1fr 236px;
  grid-template-columns: 264px 1fr 300px;
  height: 100vh;
}
#editor.lib-collapsed { grid-template-columns: 264px 1fr 0; }
#editor.lib-collapsed #library-pane { display: none; }

/* --- Top bar --- */

#topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--panel); border-bottom: 1px solid var(--border);
}
/* Ink, not the tan primary: the wordmark on white measured 2.51:1, and
   high contrast is the whole reason this theme was chosen. */
#tb-brand { font-family: "Plus Jakarta Sans", Inter, sans-serif; font-weight: 700; color: var(--ink); white-space: nowrap; }
#topbar #tb-title {
  flex: 1; max-width: 520px; background: transparent; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; color: var(--ink); padding: 6px 10px; border-radius: 7px;
}
#topbar #tb-title:hover, #topbar #tb-title:focus { border-color: var(--field-border); background: var(--field); }
#topbar #save-msg { margin-left: auto; font-size: 12px; }
#topbar #tb-title { min-width: 120px; }
#btn-bug, #btn-advanced, #btn-new-class { white-space: nowrap; }
/* The topbar gained two buttons in 2026-07; shed their words before the
   class-title field gets squeezed out. */
@media (max-width: 1240px) { #topbar .tb-label { display: none; } }
@media (max-width: 1080px) { #btn-bug-label { display: none; } }
/* Advanced mode is a sticky toggle, so it reads as pressed while it's on. */
#topbar .btn--on { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

/* Class switcher — the ▾ beside the class name, for instructors with more
   than one class. The menu drops under the title, clip-popover style. */
#tb-class-switch { white-space: nowrap; padding-left: 8px; padding-right: 8px; }
#class-switch-menu {
  position: fixed; z-index: 40; min-width: 240px; max-width: 440px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); font-size: 13px;
}
#class-switch-menu[hidden] { display: none; }
.csw-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; margin: 1px 0;
  border-radius: 7px; border: 0; background: none; color: var(--ink); font: inherit;
}
.csw-title, .csw-meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csw-meta { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
button.csw-item { cursor: pointer; }
button.csw-item:hover { background: var(--hover); }

/* --- Outline sidebar --- */

#outline {
  grid-area: outline; background: var(--card); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
#outline-list { flex: 1; overflow-y: auto; padding: 10px 8px; }
.outline-row {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 2px 0;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; font-size: 13px;
}
.outline-row:hover { background: var(--hover); }
.outline-row.active { background: var(--secondary); border-color: var(--accent-2); }
.outline-row .o-icon { flex: 0 0 auto; }
.theme-studio .outline-row input.o-title {
  flex: 1; min-width: 0; background: transparent; border: none; color: var(--ink);
  font: inherit; font-weight: 600; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis;
}
.theme-studio .outline-row input.o-title:focus { outline: 1px solid var(--field-border); border-radius: 4px; background: var(--field); }
.outline-row .o-meta { font-size: 11px; color: var(--muted); white-space: nowrap; }
.outline-row .o-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.outline-row .o-dot.ok { background: #638547; }
.outline-row .o-tools { display: none; gap: 2px; }
.outline-row:hover .o-tools { display: flex; }
.outline-row .o-tools button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 12px; padding: 2px 4px; border-radius: 4px;
}
.outline-row .o-tools button:hover:not(:disabled) { color: var(--ink); background: var(--field); }
.outline-row .o-tools button:disabled { opacity: 0.3; cursor: default; }
.outline-row--details { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0; padding-top: 12px; }

/* Sections (advanced mode). Nesting is derived from the flat unit order —
   these rules are the only place the tree is "real". */
.outline-row--section { margin-top: 8px; background: var(--soft); }
.outline-row--section .o-icon { opacity: 0.85; }
.theme-studio .outline-row--section input.o-title { font-weight: 700; font-family: "Plus Jakarta Sans", Inter, sans-serif; font-size: 13.5px; }
.outline-row--child { margin-left: 18px; border-left: 2px solid var(--border); border-radius: 0 8px 8px 0; }
.outline-row--child.active { border-left-color: var(--accent-2); }
.outline-row .o-caret {
  flex: 0 0 auto; width: 16px; padding: 0; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 11px; line-height: 1;
}
.outline-row .o-caret:hover { color: var(--ink); }
.outline-empty-section {
  margin: 0 0 4px 20px; padding: 4px 10px; font-size: 11.5px; color: var(--muted); font-style: italic;
}

/* Section tabs above the stage — one per section, "the part I'm working on". */
#section-tabs {
  flex: 0 0 auto; display: flex; gap: 6px; align-items: stretch; overflow-x: auto;
  padding: 8px 14px 0; background: var(--paper); border-bottom: 1px solid var(--border);
}
.sec-tab {
  display: flex; flex-direction: column; gap: 1px; align-items: flex-start; white-space: nowrap;
  padding: 6px 12px; border: 1px solid var(--border); border-bottom: none;
  border-radius: 8px 8px 0 0; background: var(--panel); color: var(--muted);
  cursor: pointer; font: inherit; font-size: 12.5px;
}
.sec-tab:hover { color: var(--ink); }
.sec-tab.active { background: var(--secondary); border-color: var(--accent-2); color: var(--ink); }
.sec-tab .sec-tab-name { font-weight: 600; }
.sec-tab .sec-tab-meta { font-size: 10.5px; opacity: 0.75; font-variant-numeric: tabular-nums; }
.sec-tab--add { justify-content: center; align-items: center; font-size: 15px; padding: 6px 10px; }

/* Section overview (stage panel for a selected section header) */
.sec-kid {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px 10px; margin: 4px 0; font: inherit; font-size: 13px; cursor: pointer;
  background: var(--field); border: 1px solid var(--field-border); border-radius: 8px; color: var(--ink);
}
.sec-kid:hover { border-color: var(--ink); }
.sec-kid .sec-kid-name { flex: 1; font-weight: 600; }

/* Library "this section / all takes" filter (advanced mode) */
#lib-filter { display: flex; gap: 6px; align-items: center; margin: 0 0 8px; }
.lib-chip {
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px; font: inherit; font-size: 11.5px; cursor: pointer;
  background: var(--field); border: 1px solid var(--field-border); color: var(--muted);
}
.lib-chip:hover { color: var(--ink); }
.lib-chip.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }

#outline-add { padding: 8px; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 6px; }
#outline-add button {
  background: var(--hover); border: 1px solid var(--field-border); color: var(--ink);
  border-radius: 6px; padding: 4px 9px; font-size: 12px; cursor: pointer;
}
#outline-add button:hover { border-color: var(--ink); }
#outline-footer { padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
#outline-footer .progress-track { min-width: 0; margin-top: 6px; height: 6px; }
#outline-footer a { color: var(--accent-2); }

/* --- Stage --- */

#stage { grid-area: stage; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
#stage-player { flex: 1; display: flex; flex-direction: column; padding: 16px 20px 8px; min-height: 0; }
#player-frame { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; }
#main-video { width: 100%; height: 100%; object-fit: contain; background: #000; border-radius: 6px; }
#player-hud { display: flex; align-items: center; gap: 12px; padding: 10px 2px 4px; color: var(--muted); font-size: 13px; }
#btn-play {
  width: 36px; height: 36px; border-radius: 50%; background: var(--hover);
  border: 1px solid var(--field-border); color: var(--ink); cursor: pointer; font-size: 13px;
}
#btn-play:hover:not(:disabled) { border-color: var(--ink); }
#btn-play:disabled { opacity: 0.4; cursor: default; }
#player-time { font-variant-numeric: tabular-nums; }
#stage-form { flex: 1; overflow-y: auto; padding: 22px; }
#stage-form .panel { max-width: 760px; margin: 0 auto 18px; }
.stage-form-head { max-width: 760px; margin: 0 auto 4px; display: flex; align-items: baseline; gap: 10px; }
.stage-form-head h2 { border: none; margin: 0; }

/* --- Library pane --- */

#library-pane {
  grid-area: library; background: var(--card); border-left: 1px solid var(--border);
  overflow-y: auto; padding: 12px 14px; min-height: 0;
}
#library-pane h3 { margin: 4px 0 6px; font-family: "Plus Jakarta Sans", Inter, sans-serif; font-size: 15px; }
#library-pane .dim { font-size: 12px; }

.lib-card {
  display: flex; gap: 10px; align-items: center; padding: 8px;
  border: 1px solid var(--border); border-radius: 8px; margin: 8px 0;
  background: var(--panel); cursor: grab;
}
.lib-card:active { cursor: grabbing; }
.lib-card .lib-thumb {
  position: relative; flex: 0 0 96px; height: 54px; border-radius: 6px; overflow: hidden;
  background: var(--soft); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.lib-card .lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.lib-card .lib-thumb .tl-dur { top: auto; bottom: 3px; right: 4px; }
.lib-card .lib-glyph { font-size: 20px; opacity: 0.7; }
.lib-card .lib-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lib-card .lib-label {
  font-weight: 600; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lib-card .lib-meta { font-size: 11px; color: var(--muted); }
.lib-card .lib-actions { display: flex; flex-direction: column; gap: 4px; }
.lib-card .lib-actions .btn { padding: 2px 9px; font-size: 12px; }
.lib-card .lib-actions .btn--export { background: var(--accent-2); color: #fff; }
.lib-bring { display: flex; flex-wrap: wrap; gap: 6px; }

/* "＋ From another class…" picker: a class list on the left, that class's
   ready takes on the right. Same card anatomy as the library so a take looks
   the same before and after it is brought over. */
.imp-box { display: grid; grid-template-columns: 200px 1fr; gap: 14px; min-height: 260px; }
.imp-classes { display: flex; flex-direction: column; gap: 4px; }
.imp-class {
  text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: none; color: var(--ink); cursor: pointer; font: inherit; font-size: 13px;
}
.imp-class:hover { background: var(--hover); }
.imp-class.active { border-color: var(--accent-2); background: var(--accent-2); color: #fff; }
.imp-class .imp-meta { display: block; font-size: 11px; opacity: 0.75; margin-top: 2px; }
.imp-takes { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.imp-takes .lib-card { cursor: default; }
.imp-takes .lib-card:active { cursor: default; }
.imp-takes .lib-actions .btn--added { background: var(--accent-2); color: #fff; }
@media (max-width: 720px) { .imp-box { grid-template-columns: 1fr; } }
.theme-studio .chip--err { background: #F7DADA; color: #7A1F1F; }

/* --- Timeline dock --- */

#timeline {
  grid-area: tl; background: var(--panel); border-top: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
#tl-toolbar {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  border-bottom: 1px solid var(--hover); flex-wrap: wrap; font-size: 13px; color: var(--muted);
}
#tl-toolbar .tl-spacer { margin-left: auto; }
/* Which section/unit the record buttons are pointing at. */
#tl-toolbar .tl-crumb {
  padding: 3px 9px; border-radius: 999px; background: var(--field); border: 1px solid var(--field-border);
  color: var(--ink); font-size: 12px; font-weight: 600; max-width: 320px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
#tl-toolbar .tl-crumb .tl-crumb-sep { color: var(--muted); font-weight: 400; }
#tl-scroll { flex: 1; overflow-x: auto; overflow-y: hidden; padding: 6px 12px 10px; display: flex; flex-direction: column; gap: 4px; }
#tl-ruler {
  height: 12px; flex: none; position: relative; cursor: ew-resize; touch-action: none;
  background: repeating-linear-gradient(to right, #202C3C 0 1px, transparent 1px 60px);
  border-bottom: 1px solid var(--hover); min-width: 100%;
}
#tl-playhead {
  position: absolute; top: -17px; bottom: 0; left: 0; width: 2px; background: var(--ink);
  pointer-events: none; z-index: 5; box-shadow: 0 0 4px rgba(0, 0, 0, 0.8);
}
#tl-playhead::before {
  content: ""; position: absolute; top: 0; left: -4px; border: 5px solid transparent;
  border-top-color: var(--ink); border-bottom-width: 0;
}
#tl-track { position: relative; flex: 1; min-height: 0; display: flex; gap: 8px; align-items: stretch; min-width: 100%; width: max-content; }
.tl-hint { color: var(--muted); font-size: 13px; display: flex; align-items: center; justify-content: center; flex: 1; }

/* Timeline clips (gap above must stay in sync with TL.GAP in studio.js) */
.tl-clip {
  position: relative; height: 100%; border-radius: 8px; overflow: hidden;
  background: var(--soft); border: 2px solid var(--border); cursor: pointer; user-select: none;
}
.tl-clip:hover { border-color: var(--accent); }
.tl-clip.selected { border-color: var(--accent-2); box-shadow: 0 0 0 2px rgba(61, 143, 224, 0.35); }
.tl-clip .tl-thumbs { position: absolute; inset: 0; display: flex; }
.tl-clip .tl-thumbs img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; pointer-events: none; }
.tl-clip .tl-label {
  position: absolute; left: 6px; right: 6px; bottom: 4px; font-size: 11px; font-weight: 600;
  color: #fff; text-shadow: 0 1px 2px #000; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  pointer-events: none;
}
.tl-clip .tl-dur {
  position: absolute; top: 4px; right: 5px; font-size: 10px; color: #fff;
  background: rgba(0, 0, 0, 0.55); padding: 1px 5px; border-radius: 4px; pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.tl-clip .tl-trim-flag {
  position: absolute; top: 4px; left: 5px; font-size: 10px; color: #fff;
  background: rgba(0, 0, 0, 0.55); padding: 1px 5px; border-radius: 4px; pointer-events: none;
}
.tl-clip .tl-glyph { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 22px; opacity: 0.7; }
.tl-clip.processing { border-style: dashed; opacity: 0.75; }
.tl-handle {
  position: absolute; top: 0; bottom: 0; width: 12px; cursor: ew-resize; z-index: 4;
  background: rgba(61, 143, 224, 0.85); display: flex; align-items: center; justify-content: center;
  touch-action: none;
}
.tl-handle::after { content: ""; width: 2px; height: 40%; background: var(--ink); border-radius: 2px; }
.tl-handle--l { left: 0; border-radius: 6px 0 0 6px; }
.tl-handle--r { right: 0; border-radius: 0 6px 6px 0; }

/* Clip inspector popover */
#clip-popover {
  position: fixed; z-index: 40; width: 388px; background: var(--panel);
  border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); font-size: 13px;
}
#clip-popover[hidden] { display: none; }
.ci-head { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.ci-head input { flex: 1; }
.ci-head .modal-close { position: static; }
.ci-section { border-top: 1px solid var(--hover); padding: 10px 0 6px; }
#ci-monitor video { width: 100%; margin-top: 8px; border-radius: 6px; background: #000; }
.tl-clip.dragging { opacity: 0.4; }
.tl-clip.drop-before { box-shadow: -4px 0 0 var(--accent-2); }
.tl-clip.drop-after { box-shadow: 4px 0 0 var(--accent-2); }

/* ---- Grace-backed block editor (public/js/studio.js renderGraceEditor) ---- */
.list-field { border: 1px solid var(--line, var(--border)); border-radius: 8px; padding: .6rem; }
/* `display: block` undoes the older admin-side `.list-row { display: flex }`
   near the top of this file. That rule laid sub-fields out in a row, which
   looked fine for a 2-field rubric and collapsed into overlapping labels the
   moment a block had four (resources: title, link, type, description). */
.list-row {
  display: block; border: none; padding: 0;
  border-bottom: 1px solid var(--line, var(--border)); padding-bottom: .5rem; margin-bottom: .5rem;
}
.list-row:last-of-type { border-bottom: none; margin-bottom: .25rem; padding-bottom: 0; }
.list-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .3rem; }
.list-row-head span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .7; }
.field-errors { margin: .6rem 0 0; padding-left: 1.1rem; color: #B42318; font-size: 13px; }
.embed-verdict { margin: .6rem 0 0; font-size: 13px; }

/* Upload control under a Resources row's Link field (studio.js
   attachmentPicker). Sits with the input, not beside it, so the pair reads as
   "paste a link, or upload one". */
.attach-pick { display: flex; align-items: center; gap: .5rem; margin-top: .35rem; flex-wrap: wrap; }
.attach-pick .muted { font-size: 12px; opacity: .75; word-break: break-all; }

/* ---- Partnership picker (public/js/partnership.js) ---- */
.partnership-card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin: 0 0 8px; font: inherit;
  /* Explicit dark ink: the studio theme's body text is LIGHT, and
     color:inherit put it on this white card — white-on-white. */
  color: #2a2620;
}
.partnership-card .dim { color: #6f6857; }
/* The card is white in BOTH themes, so everything inside it stays light-theme.
   `.theme-studio .chip` repaints chips dark for the dark studio chrome, and
   inside this card that landed dark-on-dark (#2a2620 ink on a #26282c chip) —
   the "Choose" affordance was invisible. Same trap as the white-on-white note
   above: a card that opts out of the theme has to opt its children out too. */
.theme-studio .partnership-card .chip {
  background: var(--soft);
  border-color: var(--border);
  color: #2a2620;
}
.partnership-card:hover { border-color: #c9a227; }
.partnership-card.chosen { border-color: #c9a227; box-shadow: inset 0 0 0 1px #c9a227; }
.partnership-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 3px; }
.partnership-card .dim { font-weight: 400; font-size: 13px; margin-top: 2px; }
.partnership-terms { margin: 6px 0 8px; padding-left: 18px; font-size: 13px; font-weight: 400; }
.partnership-terms li { margin: 2px 0; }
.partnership-table {
  border-collapse: collapse; margin: 4px 0 6px; font-size: 13px; font-weight: 400;
  /* The guide's example table is small on purpose — it illustrates, it does
     not forecast. Keep it from reading like a revenue projection. */
  min-width: 220px;
}
.partnership-table th, .partnership-table td {
  border: 1px solid var(--border); padding: 2px 10px; text-align: right;
}
.partnership-table th { background: var(--soft); font-weight: 600; font-size: 12px; }
.partnership-table td:first-child, .partnership-table th:first-child { text-align: left; }

/* ---- Planning Ahead (public/js/studio.js renderPlanningAhead) ---- */
.planning-ahead-row {
  display: block; font-size: 14px; font-weight: 400; margin: 4px 0;
  cursor: pointer;
}
.planning-ahead-row input { margin-right: 6px; }

/* ---- bug board (studio modal + admin panel), 2026-11-16 ---- */
.bug-tabs { display: flex; gap: 6px; margin: 0 0 14px; border-bottom: 2px solid var(--border); }
.bug-tab { border: none; background: none; padding: 8px 12px; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.bug-tab.active { color: var(--ink, #1A1A1A); border-bottom-color: var(--accent-2); }
.btn--attention { box-shadow: 0 0 0 2px var(--gold); }
.bug-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin: 0 0 12px; background: #fff; }
.bug-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; }
.bug-msg { white-space: pre-wrap; margin: 8px 0 6px; font-size: 14px; }
.bug-thread { margin: 6px 0 0; }
.bug-c { border-left: 3px solid var(--border); padding: 4px 10px; margin: 6px 0; font-size: 13px; }
.bug-c p { margin: 2px 0 0; white-space: pre-wrap; }
.bug-c--team { border-left-color: var(--accent-2); background: var(--soft); border-radius: 0 8px 8px 0; }
.bug-who { font-weight: 600; font-size: 12px; color: var(--muted); }
.bug-reply { margin-top: 8px; }
.bug-reply textarea { font-size: 13px; min-height: 0; }
.bug-reply-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.bug-ctx { font-size: 11px; color: var(--muted); background: var(--soft); border: 1px dashed var(--border); border-radius: 6px; padding: 8px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
#bugs-panel { overflow-x: auto; }
#bugs-table { table-layout: fixed; }
#bugs-table td { vertical-align: top; overflow-wrap: anywhere; }
#bugs-table .chip { white-space: nowrap; }
#bugs-table th:nth-child(1) { width: 4%; }
#bugs-table th:nth-child(2), #bugs-table th:nth-child(7) { width: 11%; }
#bugs-table th:nth-child(3) { width: 15%; }
#bugs-table th:nth-child(4) { width: 12%; }
#bugs-table th:nth-child(5) { width: 30%; }
#bugs-table th:nth-child(6) { width: 9%; }
#bugs-table th:nth-child(8) { width: 8%; }
.bug-cell-report { white-space: pre-wrap; }
.bug-row-detail td { background: var(--soft); }
