/* ============================================================================
   STUDIO ZEN — the Studio section's single-owner stylesheet (2026-07 rebuild).
   Replaces the Studio2.css + studio-x.css + studio-rebuild.css pile-up with ONE
   coherent system, now that the backend under it is real.

   Layout: NotebookLM's three-zone reading (sources · conversation · studio) with
   a wider, calmer center canvas. Borrowed patterns (cited):
   — NotebookLM: source rail as first-class cards, studio dock on the right,
     product tray under the create tools.
   — Linear: quiet 1px borders, one accent, hover lift, uppercase micro-labels.
   — Notion: the answer typography — real headings/lists/paragraph rhythm inside
     AI replies instead of a text wall; toolkit groups read like a block menu.
   Theme: driven by the app's design-tokens vars (--brand-primary/secondary,
   --bg-*, --text-*, --border-light) → light/dark/galaxy all follow Settings.
   ========================================================================== */

.studio-page {
  --sz-gap: 16px;
  --sz-radius: 16px;
  --sz-panel: color-mix(in srgb, var(--bg-secondary) 88%, transparent);
  --sz-line: var(--border-light);
  --sz-line-2: color-mix(in srgb, var(--border-light) 55%, transparent);
  --sz-accent: var(--brand-primary);
  --sz-accent-2: var(--brand-secondary);
  --sz-grad: var(--brand-gradient, linear-gradient(135deg, var(--brand-primary), var(--brand-secondary)));
  --sz-soft: color-mix(in srgb, var(--brand-primary) 10%, transparent);
  --sz-heading: var(--font-heading, 'Outfit', sans-serif);
  color: var(--text-primary);
}
html:has(.studio-page), .studio-page, .studio-page * { scrollbar-width: none; }
html:has(.studio-page)::-webkit-scrollbar, .studio-page *::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* ───────────────────────── PROJECT HUB ───────────────────────── */
.project-hub { max-width: 1200px; margin: 0 auto; padding: 40px clamp(16px, 2vw, 28px) 80px; }
.hub-header { margin-bottom: 30px; }
.hub-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--sz-accent-2); margin-bottom: 12px;
}
.hub-eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--sz-grad); }
.hub-header h2 {
  font-family: var(--sz-heading) !important; font-size: clamp(28px, 4vw, 40px);
  font-weight: 700; letter-spacing: -.02em !important; line-height: 1.08; margin: 0 0 10px;
}
.hub-subtitle { color: var(--text-primary); font-size: 15.5px; line-height: 1.65; max-width: 680px; }
.project-status { min-height: 22px; font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.project-status[hidden] { display: none; }
.project-status.status-success { color: var(--accent-emerald, #12a875); }
.project-status.status-error { color: var(--accent-rose, #df5b5b); }
.project-status.status-warning { color: var(--accent-amber, #d99828); }

.create-project-v2 {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border: 1px solid var(--sz-line); border-radius: var(--sz-radius);
  background: var(--sz-panel); padding: 14px 16px; margin-bottom: 18px;
}
.create-project-v2.hidden { display: none; }
.create-project-v2 input {
  flex: 1; min-width: 220px; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font: inherit; font-size: 15px;
}
.create-actions { display: flex; gap: 8px; }

.project-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.project-list .project-card, .project-list > div {
  border: 1px solid var(--sz-line); border-radius: var(--sz-radius);
  background: var(--sz-panel); padding: 20px;
  transition: transform .2s cubic-bezier(.2,.7,.2,1), border-color .2s, box-shadow .2s;
  cursor: pointer;
}
.project-list .project-card:hover, .project-list > div:hover {
  transform: translateY(-3px); border-color: color-mix(in srgb, var(--sz-accent) 40%, transparent);
  box-shadow: 0 16px 40px -22px color-mix(in srgb, var(--sz-accent) 45%, transparent);
}
.create-notebook-card {
  min-height: 116px; display: flex; align-items: center; gap: 16px;
  border-style: dashed !important; color: var(--text-primary); text-align: left;
  font: inherit; font-size: 14px; font-weight: 700;
}
.project-list.is-empty { grid-template-columns: minmax(0, min(1120px, 100%)); }
.project-list.is-empty > .create-notebook-card {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) minmax(280px, .92fr) 34px;
  align-items: center; gap: 20px; min-height: 204px; padding: 28px;
  border-style: solid !important;
  background: linear-gradient(112deg, var(--sz-panel) 0%, color-mix(in srgb, var(--sz-accent) 6%, var(--bg-secondary)) 100%);
}
.project-list.is-empty > .create-notebook-card .create-icon-wrap { grid-column: 1; grid-row: 1; }
.project-list.is-empty > .create-notebook-card .create-notebook-copy { grid-column: 2; grid-row: 1; }
.studio-empty-flow {
  grid-column: 3; grid-row: 1; min-width: 0; align-self: stretch;
  display: grid; align-content: center; gap: 9px; padding-left: 20px;
  border-left: 1px solid var(--sz-line);
}
.studio-empty-flow-title {
  color: var(--text-secondary); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; line-height: 1.4; text-transform: uppercase;
}
.studio-empty-flow-steps {
  display: grid; gap: 7px; margin: 0; padding: 0; list-style: none;
}
.studio-empty-flow-steps li {
  min-width: 0; display: grid; grid-template-columns: 27px minmax(0, 1fr);
  align-items: center; gap: 10px; color: var(--text-primary);
  font-size: 13px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere;
}
.studio-flow-index {
  display: grid; place-items: center; width: 25px; height: 25px;
  border: 1px solid color-mix(in srgb, var(--sz-accent-2) 30%, var(--sz-line));
  border-radius: 8px; background: var(--sz-soft); color: var(--sz-accent-2);
  font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.project-list.is-empty > .create-notebook-card .create-notebook-arrow { grid-column: 4; grid-row: 1; }
.create-notebook-copy { display: grid; gap: 6px; min-width: 0; flex: 1; }
.create-notebook-title { color: var(--text-primary); font-size: 16px; font-weight: 700; line-height: 1.35; }
.create-notebook-hint { max-width: 460px; color: var(--text-secondary); font-size: 13px; font-weight: 500; line-height: 1.55; }
.create-notebook-arrow { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border: 1px solid var(--sz-line); border-radius: 50%; color: var(--sz-accent-2); font-size: 18px; transition: transform .16s ease, border-color .16s ease; }
.create-notebook-card:hover .create-notebook-arrow { transform: translateX(3px); border-color: var(--sz-accent-2); }
.create-notebook-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--sz-accent-2) 70%, transparent);
  outline-offset: 3px;
}
.create-icon-wrap, .project-icon-v2 {
  width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 12px; background: var(--sz-soft); color: var(--sz-accent-2); font-size: 20px;
}
.project-list-item { position: relative; min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; }
.project-card-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.project-open-btn {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 12px; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.project-open-btn:focus-visible, .project-options-icon:focus-visible, .dropdown-item:focus-visible {
  outline: 2px solid var(--sz-accent-2); outline-offset: 2px;
}
.project-card-main h3 {
  min-width: 0; max-width: 100%; margin: 0; color: var(--text-primary);
  font-size: 14px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere;
}
.project-options-container { position: absolute; top: 12px; right: 12px; z-index: 20; }
.project-options-icon {
  width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid transparent;
  border-radius: 9px; background: transparent; color: var(--text-secondary); font: inherit;
  font-size: 18px; cursor: pointer;
}
.project-options-icon:hover, .project-options-icon[aria-expanded="true"] { background: var(--sz-soft); color: var(--text-primary); }
.project-options-dropdown {
  position: absolute; top: calc(100% + 5px); right: 0; min-width: 150px; padding: 5px;
  border: 1px solid var(--sz-line); border-radius: 11px; background: var(--sz-panel);
  box-shadow: 0 12px 32px rgba(0,0,0,.28); z-index: 30;
}
.project-options-dropdown.hidden { display: none; }
.dropdown-item {
  display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-primary); font: inherit; font-size: 12.5px;
  text-align: left; cursor: pointer;
}
.dropdown-item:hover { background: var(--sz-soft); }
.dropdown-item.delete-btn { color: #f87171; }
.project-meta-v2 { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 12px; }

/* The previous layered stylesheet supplied these welcome chips. Keep them in
   Studio Zen so browser-default white buttons cannot leak into the dark canvas. */
.notebook-welcome { width: min(100%, 720px); margin: auto; padding: 20px 6px; }
.nw-title { margin: 0 0 6px; color: var(--text-primary); font-family: var(--sz-heading); font-size: clamp(22px, 2.2vw, 28px); line-height: 1.25; letter-spacing: -.02em; }
.nw-sub { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.55; }
.nw-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.nw-chip {
  max-width: 100%; padding: 8px 12px; border: 1px solid var(--sz-line); border-radius: 999px;
  background: var(--sz-panel); color: var(--text-primary); font: inherit; font-size: 12.5px;
  font-weight: 600; line-height: 1.35; text-align: left; cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.nw-chip:hover { border-color: var(--sz-accent-2); background: var(--sz-soft); transform: translateY(-1px); }
.nw-chip:focus-visible { outline: 2px solid var(--sz-accent-2); outline-offset: 2px; }

/* ─────────────────────── WORKBENCH FRAME ─────────────────────── */
.workbench-container.skx { box-sizing: border-box; display: flex; flex-direction: column; height: calc(100vh - 88px); padding: 10px 14px 14px; }
.workbench-container.skx.hidden { display: none; }
.skx-topbar { display: flex; align-items: center; gap: 12px; padding: 6px 6px 12px; }
.skx-back {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--sz-line);
  background: var(--sz-panel); color: var(--text-secondary); cursor: pointer;
  display: grid; place-items: center; transition: border-color .18s, color .18s;
}
.skx-back:hover { border-color: var(--sz-accent-2); color: var(--text-primary); }
.skx-title { font-family: var(--sz-heading); font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin: 0; }
.studio-workbench-status {
  margin: 0 6px 8px; padding: 8px 11px; border: 1px solid var(--sz-line);
  border-radius: 9px; background: var(--sz-panel); color: var(--text-secondary);
  font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere;
}
.studio-workbench-status[hidden] { display: none; }
.studio-workbench-status.status-success { border-color: rgba(18, 168, 117, .32); color: var(--accent-emerald, #12a875); }
.studio-workbench-status.status-error { border-color: rgba(223, 91, 91, .36); color: var(--accent-rose, #df5b5b); }
.studio-workbench-status.status-warning { border-color: rgba(217, 152, 40, .36); color: var(--accent-amber, #d99828); }

/* three zones: sources 290 · conversation flexible · studio 360 */
.skx-body {
  flex: 1; min-height: 0; display: grid;
  grid-template-columns: 290px minmax(0, 1fr) 360px; gap: var(--sz-gap);
}
.skx-zone { min-height: 0; display: flex; }
.skx-panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--sz-line); border-radius: var(--sz-radius);
  background: var(--sz-panel); overflow: hidden;
}
.skx-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
}
.skx-head h3 {
  display: inline-flex; align-items: center; gap: 8px; margin: 0;
  font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-secondary);
}
.skx-head-ic { font-size: 14px; line-height: 1; width: auto; height: auto; }
/* legacy emoji spans picked up a huge glyph size once the old sheets were removed —
   pin them down explicitly */
span.skx-head-ic, span.skx-add-ic { display: inline-grid; place-items: center; width: 18px; height: 18px; font-size: 14px; overflow: hidden; }
.skx-count { font-size: 13px; color: var(--text-secondary); }
.skx-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 12px 14px; }

/* ─────────────────────── ZONE 1 · SOURCES ─────────────────────── */
.skx-add {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px dashed color-mix(in srgb, var(--sz-accent) 45%, var(--sz-line));
  background: var(--sz-soft); color: var(--text-primary);
  border-radius: 12px; padding: 11px; font: inherit; font-size: 13.5px; font-weight: 650;
  cursor: pointer; transition: background .18s, border-color .18s; margin-bottom: 10px;
}
.skx-add:hover { background: color-mix(in srgb, var(--brand-primary) 16%, transparent); border-style: solid; }
.skx-add-ic { font-weight: 400; }

.skx-search {
  position: relative; display: flex; align-items: center; gap: 6px;
  border: 1px solid var(--sz-line); border-radius: 11px; background: var(--bg-primary);
  padding: 3px 3px 3px 10px; margin-bottom: 8px;
}
.skx-search-ic { color: var(--text-muted); flex: 0 0 auto; }
.skx-inp { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--text-primary); font: inherit; font-size: 14px; padding: 6px 0; }
.skx-search-go {
  width: 30px; height: 30px; border-radius: 9px; border: 0; background: var(--sz-grad);
  color: #fff; cursor: pointer; display: grid; place-items: center; flex: 0 0 auto;
}
.skx-search-actions { display: flex; margin-bottom: 10px; }
.skx-toggle {
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px;
  color: var(--text-secondary); background: transparent; border: 1px solid var(--sz-line);
  border-radius: 999px; padding: 5px 11px; cursor: pointer; transition: color .18s, border-color .18s;
}
.skx-toggle.active, .skx-toggle:hover { color: var(--sz-accent-2); border-color: color-mix(in srgb, var(--sz-accent-2) 55%, transparent); }
.skx-create-brief { border: 1px solid var(--sz-line); border-radius: 12px; background: var(--bg-primary); padding: 11px 12px; margin-bottom: 14px; }
.skx-create-brief label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-primary); font-size: 14px; font-weight: 650; margin-bottom: 7px; }
.skx-create-brief .skx-optional { color: var(--text-secondary); font-size: 11px; font-weight: 700; letter-spacing: .06em; }
.skx-create-brief textarea { width: 100%; min-height: 72px; max-height: 144px; resize: vertical; border: 1px solid var(--sz-line); border-radius: 9px; background: var(--sz-panel); color: var(--text-primary); font: inherit; font-size: 14px; line-height: 1.5; padding: 9px 10px; outline: none; }
.skx-create-brief textarea:focus { border-color: var(--sz-accent-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sz-accent-2) 13%, transparent); }
.skx-create-brief textarea::placeholder { color: var(--text-muted); opacity: .92; }
.skx-create-brief p { color: var(--text-secondary); font-size: 12.5px; line-height: 1.5; margin: 7px 1px 0; }
.skx-selectall {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13.5px; line-height: 1.35; color: var(--text-primary); padding: 4px 2px 10px; cursor: pointer;
}
.skx-selectall > span { flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.skx-selectall input { flex: 0 0 auto; margin: 0; }
.skx-selectall input:disabled { cursor: not-allowed; }

/* source cards */
.skx-source-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.source-item {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--sz-line); border-radius: 12px; background: var(--bg-primary);
  padding: 10px 12px; cursor: pointer; transition: border-color .16s, background .16s;
}
.source-item:hover { border-color: color-mix(in srgb, var(--sz-accent) 38%, var(--sz-line)); }
.source-item.active { border-color: var(--sz-accent-2); background: var(--sz-soft); }
.source-item .icon { font-size: 15px; flex: 0 0 auto; }
.source-item img { width: 18px; height: 18px; border-radius: 5px; flex: 0 0 auto; }
.source-item .source-name, .source-item span:not(.icon) { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-item button {
  flex: 0 0 auto; width: 28px; height: 28px; padding: 0; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--text-muted);
  display: inline-grid; place-items: center; cursor: pointer;
  transition: background .16s, color .16s, border-color .16s;
}
.source-item button:hover {
  background: color-mix(in srgb, #ef4444 14%, transparent);
  border-color: color-mix(in srgb, #ef4444 35%, transparent);
  color: #f87171;
}
.source-item input[type="checkbox"] { accent-color: var(--sz-accent); flex: 0 0 auto; }

/* suggested-search group (kept from the search flow) */
.skx-suggested { border: 1px solid color-mix(in srgb, var(--sz-accent-2) 40%, var(--sz-line)); border-radius: 12px; padding: 10px; margin-bottom: 8px; background: var(--sz-soft); }
.skx-sg-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.skx-sg-title { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.skx-sg-dismiss { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; }
.skx-sg-list { display: flex; flex-direction: column; gap: 4px; max-height: 220px; overflow-y: auto; }
.skx-sg-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 6px; border-radius: 8px; cursor: pointer; }
.skx-sg-row:hover { background: color-mix(in srgb, var(--brand-primary) 12%, transparent); }
.skx-sg-fav { width: 16px; height: 16px; border-radius: 4px; }
.skx-sg-fav-dot { background: var(--sz-grad); }
.skx-sg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skx-sg-foot { margin-top: 8px; }
.skx-sg-add { width: 100%; border: 0; border-radius: 10px; background: var(--sz-grad); color: #fff; font: inherit; font-size: 12.5px; font-weight: 650; padding: 8px; cursor: pointer; }

.skx-empty { text-align: center; color: var(--text-muted); padding: 26px 10px; }
.skx-empty.hidden { display: none; }
.skx-empty-ic { opacity: .6; margin-bottom: 8px; font-size: 22px; }
.skx-empty-title { font-weight: 700; color: var(--text-primary); margin: 0 0 5px; font-size: 15px; }
.skx-empty-sub { color: var(--text-secondary); font-size: 13.5px; margin: 0; line-height: 1.55; }

/* ────────────────── ZONE 2 · CONVERSATION CANVAS ────────────────── */
.skx-chat-panel { background: transparent; border: 0; }
.skx-chat-scroll {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px 6px 18px; display: flex; flex-direction: column; gap: 18px;
}

.message { display: flex; }
.message.user { justify-content: flex-end; }
.message.user .message-bubble {
  max-width: 72%; background: var(--sz-grad); color: #fff;
  border-radius: 16px 16px 4px 16px; padding: 11px 15px;
  font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word;
}
/* AI reply = a CONTENT BLOCK, not a bubble (Notion-style reading surface) */
.message.ai { justify-content: flex-start; }
.message.ai .message-bubble {
  max-width: 92%; background: var(--sz-panel);
  border: 1px solid var(--sz-line-2); border-radius: 4px 16px 16px 16px;
  padding: 16px 20px; font-size: 14.5px; line-height: 1.75; color: var(--text-primary);
  word-break: break-word;
}
/* answer typography (renderAnswerHTML output) */
.message-bubble .ans-h {
  font-family: var(--sz-heading); font-size: 15.5px; font-weight: 700; letter-spacing: -.01em;
  margin: 14px 0 6px; color: var(--text-primary);
}
.message-bubble .ans-h:first-child { margin-top: 0; }
.message-bubble p.ans-p { margin: 0 0 10px; }
.message-bubble p.ans-p:last-child { margin-bottom: 0; }
.message-bubble ul.ans-ul { margin: 2px 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.message-bubble ul.ans-ul li::marker { color: var(--sz-accent-2); }
.message-bubble strong { font-weight: 650; color: var(--text-primary); }
.ans-srcs {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px;
  font-size: 12.5px; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
  color: var(--sz-accent-2); border: 1px solid color-mix(in srgb, var(--sz-accent-2) 40%, transparent);
  border-radius: 999px; padding: 4px 10px;
}
.ans-citations {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  margin-top: 14px; padding-top: 11px; border-top: 1px solid var(--sz-line);
}
.ans-citation-label {
  margin-right: 2px; color: var(--text-primary); font-size: 12.5px; font-weight: 650;
}
.ans-citation {
  max-width: min(100%, 300px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 5px 9px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--sz-accent-2) 40%, transparent);
  background: color-mix(in srgb, var(--sz-accent-2) 9%, transparent); color: var(--text-primary);
  font: inherit; font-size: 12px; line-height: 1.4; cursor: pointer;
}
.ans-citation:hover { border-color: var(--sz-accent-2); background: color-mix(in srgb, var(--sz-accent-2) 16%, transparent); }
.ans-citation:disabled { cursor: default; opacity: .62; }
.ans-citation-note {
  margin-top: 12px; padding: 8px 10px; border-left: 2px solid var(--sz-accent-2);
  color: var(--text-secondary); font-size: 13px; line-height: 1.55;
}
.source-citation-highlight { background: color-mix(in srgb, var(--sz-accent-2) 35%, transparent); color: var(--text-primary); border-radius: 3px; }

.skx-composer {
  display: flex; align-items: flex-end; gap: 10px;
  border: 1px solid var(--sz-line); border-radius: 16px; background: var(--sz-panel);
  padding: 8px 8px 8px 16px; transition: border-color .2s, box-shadow .2s;
}
.skx-composer:focus-within {
  border-color: color-mix(in srgb, var(--sz-accent) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--sz-accent) 12%, transparent);
}
.skx-composer-inp {
  flex: 1; resize: none; background: transparent; border: 0; outline: 0;
  color: var(--text-primary); font: inherit; font-size: 14.5px; line-height: 1.5;
  padding: 9px 0; max-height: 160px;
}
.skx-send {
  width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--sz-grad);
  color: #fff; cursor: pointer; display: grid; place-items: center; font-size: 15px;
  transition: filter .15s, transform .1s;
}
.skx-send:hover { filter: brightness(1.08); }
.skx-send:active { transform: translateY(1px); }

/* ──────────────── ZONE 3 · STUDIO DOCK (toolkit + products) ──────────────── */
.skx-dock-tabs { display: flex; gap: 4px; padding: 10px 12px 0; }
.skx-dtab {
  flex: 1; border: 0; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 13px; font-weight: 650; padding: 9px 6px; cursor: pointer;
  border-radius: 10px 10px 0 0; border-bottom: 2px solid transparent; transition: color .16s, border-color .16s;
}
.skx-dtab.active { color: var(--text-primary); border-bottom-color: var(--sz-accent-2); }
.skx-dbadge {
  display: inline-grid; place-items: center; min-width: 17px; height: 17px; margin-left: 6px;
  border-radius: 999px; background: var(--sz-grad); color: #fff; font-size: 10.5px;
}

/* toolkit groups: labeled block-menu (Notion), rows not wall */
.skx-tool-group { margin: 10px 2px 4px; }
.skx-tool-group > h4 {
  margin: 0 0 7px; font-size: 12px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; color: var(--text-secondary);
}
.skx-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.action-pill {
  display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 50px;
  border: 1px solid var(--sz-line); border-radius: 12px; background: var(--bg-primary);
  padding: 8px; cursor: pointer;
  transition: border-color .16s, transform .16s, background .16s;
}
.action-pill:hover {
  border-color: color-mix(in srgb, var(--sz-accent) 42%, var(--sz-line));
  background: var(--sz-soft); transform: translateX(2px);
}
.action-pill .action-icon {
  width: 24px; height: 24px; border-radius: 7px; background: var(--sz-grad);
  color: #fff; display: grid; place-items: center; flex: 0 0 auto;
}
.action-pill .action-icon svg { width: 14px; height: 14px; }
.action-pill .action-main {
  min-width: 0; flex: 1; display: flex; align-items: center; gap: 7px; padding: 0;
  border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.action-pill .action-main:focus-visible { outline: 2px solid var(--sz-accent-2); outline-offset: 2px; border-radius: 8px; }
.action-pill .action-label { flex: 1; min-width: 0; color: var(--text-primary); font-size: 14px; font-weight: 650; line-height: 1.35; overflow-wrap: break-word; word-break: normal; }
.action-pill .action-edit-btn { border: 0; border-radius: 6px; background: transparent; color: var(--text-muted); font: inherit; font-size: 12px; opacity: 0; cursor: pointer; transition: opacity .16s, color .16s, background .16s; }
.action-pill:hover .action-edit-btn { opacity: .8; }
.action-pill .action-edit-btn:focus-visible { opacity: 1; outline: 2px solid var(--sz-accent-2); outline-offset: 2px; }
.action-pill .action-edit-btn:hover { color: var(--text-primary); background: var(--sz-soft); }

/* products tray */
.skx-products { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
.studio-gen-tray { display: flex; flex-direction: column; gap: 8px; }
.gen-job {
  position: relative; display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--sz-line); border-radius: 12px; background: var(--bg-primary);
  padding: 10px 12px; cursor: pointer; overflow: hidden;
}
.gen-job.is-running .gen-job-ring {
  width: 16px; height: 16px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--sz-line); border-top-color: var(--sz-accent-2);
  animation: szspin .8s linear infinite;
}
.gen-job.is-done { border-color: color-mix(in srgb, var(--sz-accent) 45%, var(--sz-line)); }
.gen-job.is-done .gen-job-ring { display: none; }
.gen-job.is-error { border-color: color-mix(in srgb, #e74c3c 55%, var(--sz-line)); }
.gen-job.is-viewing { background: var(--sz-soft); }
.gen-job-icon { font-size: 15px; flex: 0 0 auto; }
.gen-job-body { flex: 1; min-width: 0; }
.gen-job-title { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gen-job-status { font-size: 12.5px; color: var(--text-secondary); }
.gen-job-x { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; flex: 0 0 auto; }
@keyframes szspin { to { transform: rotate(360deg); } }
.skx-addnote {
  margin-top: 10px; width: 100%; border: 1px solid var(--sz-line); border-radius: 12px;
  background: transparent; color: var(--text-secondary); font: inherit; font-size: 13px;
  padding: 10px; cursor: pointer; transition: border-color .16s, color .16s;
}
.skx-addnote:hover { border-color: var(--sz-accent-2); color: var(--text-primary); }
.generated-note-list { display: flex; flex-direction: column; gap: 8px; }
.gen-job.stored-product { width: 100%; color: var(--text-primary); font: inherit; text-align: left; transition: border-color .16s, background .16s; }
.gen-job.stored-product:hover { border-color: var(--sz-accent-2); background: var(--sz-soft); }
.gen-job.stored-product:focus-visible { outline: 2px solid var(--sz-accent-2); outline-offset: 2px; }

/* ─────────────── PRODUCT PREVIEW SHEET + OUTPUT BOARDS ─────────────── */
.skx-preview-shell {
  position: fixed; inset: 0; z-index: 120; display: grid; place-items: center;
  background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(6px);
}
.skx-preview-shell[hidden] { display: none; }
.skx-preview-card {
  width: min(880px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  border: 1px solid var(--sz-line); border-radius: 18px; background: var(--bg-secondary);
  overflow: hidden; box-shadow: 0 40px 120px -40px rgba(0,0,0,.7);
}
.skx-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--sz-line);
  font-size: 11.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted);
}
.skx-preview-close { border: 0; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; }
.skx-preview-body { overflow-y: auto; padding: 18px 20px; }

@media (max-width: 760px) {
  .project-list.is-empty { grid-template-columns: minmax(0, 100%); }
  .project-list.is-empty > .create-notebook-card {
    grid-template-columns: 38px minmax(0, 1fr) 30px; gap: 12px;
    min-height: 0; padding: 18px;
  }
  .project-list.is-empty > .create-notebook-card .create-icon-wrap { grid-column: 1; grid-row: 1; width: 38px; height: 38px; }
  .project-list.is-empty > .create-notebook-card .create-notebook-copy { grid-column: 2; grid-row: 1; }
  .project-list.is-empty > .create-notebook-card .create-notebook-title { font-size: 15px; }
  .project-list.is-empty > .create-notebook-card .create-notebook-hint { font-size: 12px; }
  .project-list.is-empty > .create-notebook-card .create-notebook-arrow { grid-column: 3; grid-row: 1; width: 30px; height: 30px; }
  .studio-empty-flow {
    grid-column: 1 / -1; grid-row: 2; padding: 13px 0 0;
    border-top: 1px solid var(--sz-line); border-left: 0;
  }
  .studio-empty-flow-steps { gap: 6px; }
  .studio-empty-flow-steps li { font-size: 12.5px; }
  .studio-workbench-status { margin-right: 2px; margin-left: 2px; }
}
.output-viewport-minimal.hidden { display: none; }

.studio-export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0 0 12px;
}
.visual-actions > .studio-export-actions { display: contents; }
.studio-export-actions .visual-action-btn {
  min-height: 36px;
  font-size: 12px;
}
@media (max-width: 560px) {
  .studio-export-actions { width: 100%; justify-content: stretch; }
  .studio-export-actions .visual-action-btn { flex: 1 1 140px; }
}

/* output boards — previously defined only in the UNLOADED Home.css → unstyled */
.output-shell-title { font-family: var(--sz-heading); font-size: 18px; font-weight: 700; margin: 0 0 4px; }
/* stats row: the renderer joins spans with '' — without a flex gap the words ran
   together ("8 thẻÔn tập"). Give it real separation + pill styling. */
.visual-stat-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }
.visual-stat {
  font-size: 11px; font-weight: 650; letter-spacing: .04em; color: var(--text-secondary);
  border: 1px solid var(--sz-line); border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.flashcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.flashcard-card { perspective: 900px; min-height: 150px; cursor: pointer; }
.flashcard-card-inner { position: relative; width: 100%; height: 100%; min-height: 150px; transform-style: preserve-3d; transition: transform .5s; }
.flashcard-card.flipped .flashcard-card-inner { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0; backface-visibility: hidden; border: 1px solid var(--sz-line);
  border-radius: 14px; background: var(--sz-panel); padding: 14px; display: flex; flex-direction: column; gap: 8px;
}
.flashcard-face.back { transform: rotateY(180deg); background: var(--sz-soft); }
.flashcard-tag { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sz-accent-2); }
.flashcard-title { font-size: 13.5px; font-weight: 650; line-height: 1.45; }
.flashcard-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }
.presentation-board, .infographic-board, .dashboard-shell, .podcast-stage, .video-stage { display: flex; flex-direction: column; gap: 14px; }
.presentation-stage { border: 1px solid var(--sz-line); border-radius: 14px; padding: 18px; background: var(--sz-panel); }
.datasheet-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.datasheet-table th, .datasheet-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--sz-line); }
.datasheet-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.insight-panel { display: flex; flex-direction: column; gap: 8px; }
.insight-card { border: 1px solid var(--sz-line); border-left: 3px solid var(--sz-accent-2); border-radius: 10px; padding: 10px 12px; font-size: 13px; background: var(--sz-panel); }
.podcast-line { font-size: 13.5px; line-height: 1.65; padding: 6px 0; border-bottom: 1px dashed var(--sz-line-2); }
.podcast-line strong { color: var(--sz-accent-2); }
.podcast-duel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.podcast-voice-card { border: 1px solid var(--sz-line); border-radius: 12px; padding: 12px; background: var(--sz-panel); }
.podcast-voice-card h5 { margin: 0 0 4px; font-size: 13.5px; }
.podcast-voice-card p { margin: 0; font-size: 12px; color: var(--text-secondary); }
.podcast-tts-slot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 8px; }
.podcast-tts-btn { border: 0; border-radius: 10px; background: var(--sz-grad); color: #fff; font: inherit; font-size: 13px; font-weight: 650; padding: 9px 14px; cursor: pointer; }
.podcast-tts-note { font-size: 12px; color: var(--text-muted); }
.video-shot { border: 1px solid var(--sz-line); border-radius: 10px; padding: 10px 12px; font-size: 13px; background: var(--sz-panel); }
.video-timeline { display: flex; flex-direction: column; gap: 8px; }
.video-script-line { font-size: 13.5px; line-height: 1.6; padding: 4px 0; }

/* ───────────────────────── MODALS ───────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 130; display: none; place-items: center;
  background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(6px);
}
.modal-overlay.active { display: grid; }
.modal-content {
  width: min(520px, 92vw); border: 1px solid var(--sz-line); border-radius: 18px;
  background: var(--bg-secondary); overflow: hidden;
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--sz-line); }
.modal-header h2 { margin: 0; font-family: var(--sz-heading); font-size: 17px; font-weight: 700; }
.modal-close { border: 0; background: transparent; color: var(--text-muted); font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; }
.source-methods-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.method-card {
  border: 1px solid var(--sz-line); border-radius: 14px; background: var(--bg-primary);
  padding: 18px 10px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 8px; align-items: center;
  transition: border-color .16s, background .16s, transform .16s;
}
.method-card:hover { border-color: color-mix(in srgb, var(--sz-accent) 42%, var(--sz-line)); background: var(--sz-soft); transform: translateY(-2px); }
.method-icon { font-size: 20px; }
.method-name { font-size: 12.5px; font-weight: 650; }

.source-detail-overlay, .search-staging-overlay {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: center;
  background: color-mix(in srgb, #000 55%, transparent); backdrop-filter: blur(6px);
}
.source-detail-overlay.hidden, .search-staging-overlay.hidden { display: none; }
.source-detail-container, .search-staging-container {
  width: min(680px, 92vw); max-height: 84vh; display: flex; flex-direction: column;
  border: 1px solid var(--sz-line); border-radius: 18px; background: var(--bg-secondary); overflow: hidden;
}
.source-detail-header, .staging-header { display: flex; align-items: center; justify-content: space-between; padding: 15px 20px; border-bottom: 1px solid var(--sz-line); }
.source-detail-header h3, .staging-header h3 { margin: 0; font-size: 15.5px; font-weight: 700; }
.btn-close-source-detail, .btn-close-staging { border: 0; background: transparent; color: var(--text-muted); font-size: 19px; cursor: pointer; }
.source-detail-content, .staging-content { overflow-y: auto; padding: 18px 20px; }
.source-summary-box { border: 1px solid var(--sz-line); border-left: 3px solid var(--sz-accent-2); border-radius: 12px; background: var(--sz-soft); padding: 12px 14px; margin-bottom: 14px; }
.summary-tag { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--sz-accent-2); margin-bottom: 6px; }
.summary-text { font-size: 13.5px; line-height: 1.65; }
.full-content-area h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); margin: 0 0 8px; }
#sourceDetailFullText { font-size: 13.5px; line-height: 1.7; color: var(--text-secondary); white-space: pre-wrap; }
.staging-hint { font-size: 13px; color: var(--text-secondary); margin: 0 0 12px; }
.staging-list { display: flex; flex-direction: column; gap: 8px; }
.staging-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--sz-line); }
.staging-loading.hidden { display: none; }
.shimmer-card { height: 46px; border-radius: 12px; background: linear-gradient(100deg, var(--sz-panel) 40%, var(--sz-soft) 50%, var(--sz-panel) 60%); background-size: 200% 100%; animation: szshimmer 1.2s infinite; margin-bottom: 8px; }
@keyframes szshimmer { to { background-position: -200% 0; } }

/* generic buttons inside the studio scope */
.studio-page .btn { border-radius: 11px; font-weight: 650; font-size: 13.5px; padding: 9px 16px; cursor: pointer; border: 1px solid var(--sz-line); background: var(--bg-primary); color: var(--text-primary); }
.studio-page .btn-primary { background: var(--sz-grad); border: 0; color: #fff; }
.studio-page .btn-secondary:hover { border-color: var(--sz-accent-2); }
.studio-page .btn.disabled { opacity: .5; pointer-events: none; }

/* search shimmer row in the source rail */
.search-searching-shimmer { border-radius: 12px; overflow: hidden; }

/* spinners kept for JS contract */
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: szspin .8s linear infinite; }
.spinner.hidden, .send-icon.hidden { display: none; }

/* ─────────────────────── responsive ─────────────────────── */
@media (max-width: 1180px) { .skx-body { grid-template-columns: 250px minmax(0,1fr) 320px; } }
@media (max-width: 960px) {
  .skx-body { grid-template-columns: 1fr; grid-auto-rows: minmax(220px, auto); }
  .workbench-container.skx { height: auto; }
  .skx-body { overflow-y: auto; }
}
@media (min-width: 961px) {
  /* Embedded tabs have no 88px navbar reservation; let the workbench fill the pane. */
  html.skemi-embed .workbench-container.skx { height: 100vh; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) { .studio-page * { animation: none !important; transition: none !important; } }
/* Source-grounded quiz: one clear decision at a time, with no answer reveal before submit. */
.quiztest-board {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: min(100%, 820px);
  margin: 0 auto;
}
.quiztest-progress-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 650;
}
.quiztest-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-primary) 14%, var(--bg-secondary));
}
.quiztest-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-gradient, linear-gradient(90deg, var(--brand-primary), var(--brand-secondary)));
}
.quiztest-question-card {
  border: 1px solid var(--border-light);
  border-radius: 14px;
  padding: clamp(18px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg-secondary) 94%, transparent);
}
.quiztest-question-card > h5 {
  margin: 0 0 20px;
  color: var(--text-primary);
  font-size: clamp(18px, 2.2vw, 23px);
  line-height: 1.45;
  font-weight: 700;
}
.quiztest-options {
  display: grid;
  gap: 9px;
}
.quiztest-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
}
.quiztest-option:hover:not(:disabled) {
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 6%, var(--bg-primary));
}
.quiztest-option:focus-visible,
.quiztest-primary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand-secondary) 72%, white);
  outline-offset: 2px;
}
.quiztest-option:disabled { cursor: default; opacity: 1; }
.quiztest-option.is-selected {
  border-color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 10%, var(--bg-primary));
}
.quiztest-option.is-correct {
  border-color: #12805c;
  background: color-mix(in srgb, #10b981 12%, var(--bg-primary));
}
.quiztest-option.is-incorrect {
  border-color: #c2413b;
  background: color-mix(in srgb, #ef4444 10%, var(--bg-primary));
}
.quiztest-option-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text-primary) 7%, transparent);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 750;
}
.quiztest-option-mark {
  color: #08794f;
  font-size: 18px;
  font-weight: 800;
}
.quiztest-feedback {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--brand-primary);
  border-radius: 8px;
  background: color-mix(in srgb, var(--brand-primary) 7%, var(--bg-primary));
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.55;
}
.quiztest-feedback.is-correct { border-left-color: #12805c; }
.quiztest-feedback.is-incorrect { border-left-color: #c2413b; }
.quiztest-feedback p { margin: 4px 0 0; color: var(--text-secondary); }
.quiztest-controls { display: flex; justify-content: flex-end; }
.quiztest-primary {
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--brand-primary);
  border-radius: 9px;
  background: var(--brand-primary);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.quiztest-primary:hover:not(:disabled) { filter: brightness(1.08); }
.quiztest-primary:disabled { cursor: not-allowed; opacity: .5; }
.quiztest-empty {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-secondary);
}
.quiztest-empty h5 { margin: 0 0 8px; color: var(--text-primary); font-size: 17px; }
.quiztest-empty p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.quiztest-complete .quiztest-score {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--border-light);
  border-radius: 14px;
  background: color-mix(in srgb, var(--brand-primary) 7%, var(--bg-secondary));
  text-align: center;
}
.quiztest-kicker {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.quiztest-score > strong { color: var(--text-primary); font-size: 38px; line-height: 1.1; }
.quiztest-score > strong span { color: var(--text-secondary); font-size: 20px; }
.quiztest-score > p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.quiztest-review-title { margin: 8px 0 0; color: var(--text-primary); font-size: 17px; }
.quiztest-review-list { display: grid; gap: 10px; }
.quiztest-review-item {
  padding: 13px 15px;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
}
.quiztest-review-item.is-correct { border-left: 3px solid #12805c; }
.quiztest-review-item.is-incorrect { border-left: 3px solid #c2413b; }
.quiztest-review-item h6 { margin: 0 0 7px; font-size: 12px; color: var(--text-secondary); }
.quiztest-review-item p { margin: 5px 0 0; font-size: 13px; line-height: 1.55; }
.quiztest-review-item p span { color: var(--text-secondary); font-weight: 650; }
.quiztest-review-item .quiztest-explanation { color: var(--text-secondary); }
@media (max-width: 600px) {
  .quiztest-question-card { padding: 16px; }
  .quiztest-option { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 9px; padding: 10px; font-size: 13px; }
  .quiztest-option-letter { width: 28px; height: 28px; }
  .quiztest-controls, .quiztest-primary { width: 100%; }
}
/* Product renderers use the generated structure directly and explain missing output. */
.studio-missing-output {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 20px;
  border: 1px solid var(--sz-line);
  border-radius: 12px;
  background: var(--sz-panel);
}
.studio-missing-output h5 { margin: 0 0 7px; color: var(--text-primary); font-size: 16px; }
.studio-missing-output p { margin: 0; color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; }

.podcast-stage, .video-stage { width: min(100%, 900px); margin: 0 auto; }
.podcast-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.podcast-head h4 { margin: 0; color: var(--text-primary); font-size: 17px; }
.podcast-status { color: var(--text-secondary); font-size: 12px; }
.podcast-audio { width: 100%; margin: 8px 0 12px; }
.podcast-lines { display: grid; gap: 8px; }
.podcast-line { padding: 11px 13px; border: 1px solid var(--sz-line); border-radius: 9px; background: var(--sz-panel); color: var(--text-primary); }
.podcast-line strong { display: block; margin-bottom: 3px; color: var(--text-primary); font-size: 12px; }
.podcast-tts-note { color: var(--text-secondary); }

.video-stage { gap: 12px; }
.video-export-panel {
  display: grid; gap: 10px; width: min(100%, 900px); margin: 0 auto 4px;
  padding: 15px 16px; border: 1px solid var(--sz-line); border-radius: 14px;
  background: color-mix(in srgb, var(--bg-secondary) 82%, transparent);
}
.video-export-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.video-export-btn, .video-export-download {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 14px; border: 1px solid color-mix(in srgb, var(--sz-accent-2) 52%, var(--sz-line));
  border-radius: 10px; background: var(--sz-grad); color: #fff; font: inherit; font-size: 13px;
  font-weight: 700; line-height: 1.3; text-decoration: none; cursor: pointer;
}
.video-export-btn:hover:not(:disabled), .video-export-download:hover { filter: brightness(1.07); }
.video-export-btn:disabled { opacity: .62; cursor: wait; }
.video-export-btn:focus-visible, .video-export-download:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--sz-accent-2) 72%, transparent); outline-offset: 2px;
}
.video-export-audio-toggle {
  min-width: 0; display: inline-flex; align-items: flex-start; gap: 9px;
  max-width: 590px; color: var(--text-primary); font-size: 12.5px; font-weight: 550; line-height: 1.5;
  overflow-wrap: anywhere; cursor: pointer;
}
.video-export-audio-toggle input { flex: 0 0 auto; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--sz-accent-2); }
.video-export-note, .video-export-status { margin: 0; color: var(--text-secondary); font-size: 12.5px; line-height: 1.55; }
.video-export-slot { min-width: 0; display: grid; justify-items: start; gap: 10px; overflow-wrap: anywhere; }
.video-export-slot.is-error { color: var(--accent-rose, #e36a72); font-size: 13px; line-height: 1.5; }
.studio-video-player { display: block; width: min(100%, 760px); max-height: 440px; aspect-ratio: 16 / 9; border: 1px solid var(--sz-line); border-radius: 12px; background: #0b0d14; }
.video-script {
  display: grid;
  gap: 9px;
  padding: 18px;
  border: 1px solid var(--sz-line);
  border-radius: 12px;
  background: var(--sz-panel);
  color: var(--text-primary);
}
.video-script h4 { margin: 0 0 4px; color: var(--text-primary); font-size: 16px; }
.video-script-line { padding: 8px 10px; border-left: 2px solid var(--sz-accent-2); color: var(--text-primary); font-size: 14px; line-height: 1.6; }
.video-timeline { display: grid; gap: 9px; }
.video-shot { min-width: 0; padding: 13px 15px; border: 1px solid var(--sz-line); border-radius: 10px; background: var(--sz-panel); color: var(--text-primary); }
.video-shot strong { color: var(--text-secondary); font-size: 12px; }
.video-shot p { margin: 7px 0 4px; color: var(--text-primary); font-size: 14px; font-weight: 700; line-height: 1.5; }
.video-shot small { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }

@media (max-width: 560px) {
  .video-export-panel { padding: 12px; }
  .video-export-controls { align-items: stretch; }
  .video-export-btn { width: 100%; }
  .video-export-audio-toggle { max-width: 100%; }
  .studio-video-player { max-height: 260px; }
}

.comic-studio { display: grid; gap: 16px; width: min(100%, 900px); margin: 0 auto; }
.comic-header { display: grid; gap: 5px; }
.comic-mast { color: var(--text-secondary); font-size: 11px; font-weight: 750; letter-spacing: .1em; }
.comic-title { margin: 0; color: var(--text-primary); font-size: 22px; line-height: 1.3; }
.comic-logline { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.comic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.comic-panel { min-width: 0; overflow: hidden; border: 1px solid var(--sz-line); border-radius: 11px; background: var(--sz-panel); }
.comic-panel-head { min-height: 34px; display: flex; align-items: center; padding: 7px 12px; color: #fff; }
.comic-panel-no { font-size: 11px; font-weight: 750; letter-spacing: .05em; }
.comic-panel-body { display: grid; gap: 8px; padding: 13px; }
.comic-caption { color: var(--text-secondary); font-size: 12px; line-height: 1.5; }
.comic-scene { margin: 0; color: var(--text-primary); font-size: 14px; font-weight: 650; line-height: 1.55; }
.comic-sfx { justify-self: start; padding: 3px 8px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 750; }
.comic-bubbles { display: grid; gap: 6px; }
.comic-bubble { display: grid; gap: 2px; padding: 8px 10px; border: 1px solid var(--sz-line); border-radius: 8px; background: var(--bg-primary); }
.comic-speaker { color: var(--text-secondary); font-size: 11px; font-weight: 700; }
.comic-line { color: var(--text-primary); font-size: 13px; line-height: 1.5; }

.book-studio { display: grid; grid-template-columns: minmax(190px, 260px) minmax(0, 1fr); gap: 18px; width: min(100%, 1000px); margin: 0 auto; align-items: start; }
.book-rail { position: sticky; top: 12px; min-width: 0; }
.book-cover { display: grid; gap: 9px; padding: 18px; border: 1px solid var(--sz-line); border-radius: 12px; background: var(--sz-panel); }
.book-cover-icon { font-size: 22px; }
.book-cover-title { color: var(--text-primary); font-size: 18px; line-height: 1.35; }
.book-cover-subtitle, .book-blurb { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.book-cover-meta { color: var(--text-muted); font-size: 11px; }
.book-blurb { margin: 10px 0; }
.book-toc-label { margin: 15px 0 7px; color: var(--text-secondary); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.book-toc { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.book-toc-item { display: flex; gap: 9px; align-items: flex-start; padding: 8px; border: 1px solid transparent; border-radius: 8px; color: var(--text-secondary); font: inherit; font-size: 12px; line-height: 1.45; cursor: pointer; }
.book-toc-item:hover, .book-toc-item:focus-visible { border-color: var(--sz-line); background: var(--sz-panel); color: var(--text-primary); outline: none; }
.book-toc-no { flex: 0 0 auto; color: var(--text-muted); font-size: 11px; font-weight: 750; }
.book-toc-title { min-width: 0; }
.book-reader { display: grid; gap: 14px; }
.book-chapter { scroll-margin-top: 18px; padding: 20px; border: 1px solid var(--sz-line); border-radius: 12px; background: var(--sz-panel); }
.book-chapter-head { margin-bottom: 14px; }
.book-chapter-no { color: var(--sz-accent-2); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.book-chapter-title { margin: 5px 0 0; color: var(--text-primary); font-family: var(--sz-heading); font-size: 20px; line-height: 1.35; }
.book-chapter-summary { margin: 7px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; }
.book-chapter-body { color: var(--text-primary); font-size: 14px; line-height: 1.8; }
.book-para { margin: 0 0 12px; }
.book-para:last-child { margin-bottom: 0; }
@media (max-width: 760px) {
  .comic-grid { grid-template-columns: 1fr; }
  .book-studio { grid-template-columns: 1fr; }
  .book-rail { position: static; }
}
/* Consistent, readable boards for every authored Studio format. */
.chart-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(190px, .8fr); gap: 14px; width: min(100%, 1080px); margin: 0 auto; align-items: stretch; }
.preview-chart-wrap { min-width: 0; min-height: 300px; padding: 16px; border: 1px solid var(--sz-line); border-radius: 12px; background: var(--sz-panel); }
.preview-chart-canvas { display: block; width: 100% !important; max-height: 360px; }
.insight-panel { display: grid; align-content: start; gap: 9px; min-width: 0; }
.insight-card h5 { margin: 0 0 5px; color: var(--text-primary); font-size: 13px; }
.insight-card p { margin: 4px 0 0; color: var(--text-secondary); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.insight-card p strong { color: var(--text-primary); font-size: 17px; }

.presentation-board, .report-board, .infographic-board, .dashboard-shell { width: min(100%, 1020px); margin: 0 auto; min-width: 0; }
.slide-nav { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.slide-progress { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.presentation-stage { padding: clamp(14px, 2.5vw, 24px); border: 1px solid var(--sz-line); border-radius: 14px; background: var(--sz-panel); }
.slide-shell { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: start; }
.slide-main { min-width: 0; }
.slide-kicker, .section-kicker { color: var(--sz-accent-2); font-size: 11px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.slide-title { margin: 8px 0 16px; color: var(--text-primary); font-family: var(--sz-heading); font-size: clamp(22px, 3vw, 32px); line-height: 1.25; overflow-wrap: anywhere; }
.slide-points { display: grid; gap: 9px; }
.slide-point { padding: 11px 13px; border-left: 2px solid var(--sz-accent-2); border-radius: 0 8px 8px 0; background: var(--bg-primary); color: var(--text-primary); font-size: 14px; line-height: 1.6; }
.slide-side { max-width: 260px; padding: 13px; border: 1px solid var(--sz-line); border-radius: 10px; color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.slide-side p { margin: 7px 0 0; }

.report-board { display: grid; gap: 12px; }
.report-summary, .report-section { padding: 15px 17px; border: 1px solid var(--sz-line); border-radius: 10px; background: var(--sz-panel); }
.report-summary h4 { margin: 0 0 6px; color: var(--text-primary); font-size: 16px; }
.report-summary p { margin: 0; color: var(--text-secondary); font-size: 14px; line-height: 1.65; }
.report-grid { display: grid; gap: 8px; }
.report-section { padding: 0; overflow: hidden; }
.report-section > summary { padding: 13px 16px; color: var(--text-primary); font-size: 14px; line-height: 1.5; font-weight: 700; cursor: pointer; }
.report-section-body { padding: 0 16px 14px; color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.report-section-body p { margin: 8px 0 0; }

.infographic-board { display: grid; }
.infographic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.info-card { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 12px; min-width: 0; padding: 15px; border: 1px solid var(--sz-line); border-radius: 11px; background: var(--sz-panel); }
.info-card-index { align-self: start; color: var(--sz-accent-2); font-size: 11px; font-weight: 750; }
.info-card h5 { margin: 0 0 6px; color: var(--text-primary); font-size: 15px; line-height: 1.4; }
.info-card p { margin: 0; color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; }
.info-card-meta { margin-top: 9px; }
.info-card-metric { color: var(--text-primary); font-size: 12px; font-weight: 700; }

.datasheet-table-wrap { width: 100%; min-width: 0; overflow: hidden; border: 1px solid var(--sz-line); border-radius: 10px; }
.datasheet-table { width: 100%; table-layout: fixed; border-collapse: collapse; color: var(--text-primary); font-size: 13px; }
.datasheet-table th, .datasheet-table td { padding: 9px 10px; border-bottom: 1px solid var(--sz-line); text-align: left; vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
.datasheet-table th { color: var(--text-primary); font-size: 12px; font-weight: 750; background: var(--sz-soft); }
.datasheet-table tbody tr:last-child td { border-bottom: 0; }
.datasheet-table td { color: var(--text-secondary); line-height: 1.5; }
.flashcard-card { outline: none; }
.flashcard-card:focus-visible { border-radius: 14px; outline: 3px solid var(--sz-accent-2); outline-offset: 3px; }
.studio-source-details { width: min(100%, 1020px); margin: 10px auto; border: 1px solid var(--sz-line); border-radius: 10px; background: var(--sz-panel); color: var(--text-primary); }
.studio-source-details > summary { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; min-height: 42px; padding: 9px 13px; color: var(--text-primary); font-size: 13px; font-weight: 700; cursor: pointer; }
.studio-source-details > summary span { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.studio-source-details > summary .studio-source-label { min-width: 0; flex: 0 1 auto; color: var(--text-primary); }
.studio-source-details > summary .studio-citation-status { max-width: 100%; margin-left: auto; padding: 4px 8px; border: 1px solid color-mix(in srgb, var(--sz-accent-2) 40%, var(--sz-line)); border-radius: 999px; color: var(--sz-accent-2); font-size: 11px; line-height: 1.3; text-align: center; white-space: normal; }
.studio-source-details > summary .studio-citation-status.no-citations { border-color: var(--sz-line); color: var(--text-secondary); }
.studio-source-details > summary .studio-source-count { flex: 0 0 auto; }
.studio-citation-coverage { margin: 0 13px 9px; padding: 7px 9px; border-left: 2px solid var(--sz-accent-2); color: var(--text-secondary); font-size: 12px; line-height: 1.45; }
.studio-citation-coverage.no-citations { border-left-color: var(--text-muted); }
.studio-source-list { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 12px 12px; }
.studio-source-link { max-width: 100%; padding: 6px 9px; border: 1px solid var(--sz-line); border-radius: 7px; background: var(--bg-primary); color: var(--text-primary); font: inherit; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; text-align: left; }
button.studio-source-link { cursor: pointer; }
button.studio-source-link:hover, button.studio-source-link:focus-visible { border-color: var(--sz-accent-2); color: var(--sz-accent-2); outline: none; }
.studio-source-link.is-unavailable { color: var(--text-secondary); }
button.studio-source-link:disabled { color: var(--text-muted); cursor: not-allowed; }
.studio-inline-citation { display: inline; margin: 0 2px; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--sz-accent-2) 44%, transparent); border-radius: 5px; background: color-mix(in srgb, var(--sz-accent-2) 12%, var(--bg-primary)); color: var(--sz-accent-2); font: inherit; font-size: .86em; font-weight: 750; line-height: 1.35; vertical-align: baseline; }
button.studio-inline-citation { cursor: pointer; }
button.studio-inline-citation:hover, button.studio-inline-citation:focus-visible { border-color: var(--sz-accent-2); background: color-mix(in srgb, var(--sz-accent-2) 22%, var(--bg-primary)); outline: 2px solid color-mix(in srgb, var(--sz-accent-2) 34%, transparent); outline-offset: 1px; }
.studio-inline-citation.is-unavailable { color: var(--text-secondary); cursor: help; }

/* Readability pass: keep the same layout, but make notebook content and
   controls comfortable to scan on both dark and light themes. */
.studio-page {
  --text-secondary: color-mix(in srgb, var(--text-primary) 86%, var(--bg-primary));
  --text-muted: color-mix(in srgb, var(--text-primary) 68%, var(--bg-primary));
}
.project-status, .create-notebook-hint, .nw-chip, .project-meta-v2,
.studio-workbench-status, .skx-count, .skx-toggle,
.skx-create-brief p, .skx-sg-title, .skx-sg-row, .skx-sg-add,
.skx-empty-sub, .ans-srcs, .ans-citation-label, .ans-citation,
.ans-citation-note, .gen-job-title, .gen-job-status,
.flashcard-title, .flashcard-desc, .insight-card,
.insight-card h5, .insight-card p, .podcast-line,
.video-export-note, .video-export-status, .comic-caption, .comic-line,
.book-toc-item, .book-chapter-summary, .datasheet-table,
.datasheet-table th, .studio-source-details > summary,
.studio-source-details > summary span, .studio-source-link,
.info-card p, .slide-side, .report-summary p,
.report-section > summary, .report-section-body {
  font-size: 14px;
}
.project-card-main h3 { font-size: 16px; }
.output-shell-title { font-size: 18px; }
.dropdown-item { font-size: 14px; }
.studio-empty-flow-steps li { font-size: 14px; }
.skx-head h3 { font-size: 14px; letter-spacing: .045em; }
.skx-add { font-size: 15px; }
.skx-create-brief .skx-optional { font-size: 12px; }
.skx-sg-row { line-height: 1.45; }
.skx-empty-sub { line-height: 1.65; }
.message.user .message-bubble { font-size: 15px; }
.message.ai .message-bubble { font-size: 16px; }
.ans-srcs { font-size: 13px; }
.ans-citation { font-size: 13.5px; }
.ans-citation:disabled { opacity: .78; }
.flashcard-title { font-size: 15px; }
.flashcard-desc { font-size: 14px; }
.datasheet-table th { font-size: 13px; }
.comic-caption, .comic-line, .book-chapter-summary { line-height: 1.65; }
.book-toc-item { line-height: 1.5; }
.studio-source-link { font-size: 13.5px; }
.info-card p, .insight-card p { line-height: 1.65; }
.insight-card h5 { color: var(--text-primary); font-weight: 700; }

@media (max-width: 760px) {
  .project-list.is-empty > .create-notebook-card .create-notebook-hint { font-size: 14px; }
  .studio-empty-flow-steps li { font-size: 14px; }
  .message.ai .message-bubble { font-size: 15px; }
}
@media (max-width: 760px) {
  .chart-layout { grid-template-columns: 1fr; }
  .infographic-grid { grid-template-columns: 1fr; }
  .slide-shell { grid-template-columns: 1fr; }
  .slide-side { max-width: none; }
}
