:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  color: var(--ink);
  background: var(--canvas);
  --ink: #1e293b;
  --canvas: #f3f6fb;
  --paper: #ffffff;
  --accent: #245edb;
  --accent-hover: #194bb8;
  --on-accent: #ffffff;
  --accent-soft: #edf3ff;
  --accent-line: #b9cff3;
  --muted: #52627a;
  --line: #dce3ee;
  --control-line: #8291a8;
  --focus: #245edb;
  --hover: #e2ebfb;
  --hover-line: #6e94cc;
  --success: #256449;
  --success-soft: #e8f4ed;
  --warning: #775620;
  --warning-soft: #fff2d6;
  --warning-line: #ddc6a0;
  --danger: #a42d37;
  --danger-soft: #fcecee;
  --shadow-soft: #1e3a6010;
  --shadow-modal: #0c172b40;
  --scrim: #0c172b80;
  --radius: 16px;
  --motion-fast: 150ms;
  --motion-panel: 220ms;
  --footer-space: calc(7.25rem + env(safe-area-inset-bottom));
}
/* Follow the OS preference, including changes while the editor is open. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink: #e7edf7;
    --canvas: #101722;
    --paper: #172131;
    --accent: #85b3ff;
    --accent-hover: #accbff;
    --on-accent: #10213c;
    --accent-soft: #1d304e;
    --accent-line: #3a5d8d;
    --muted: #abb9cd;
    --line: #2d3c52;
    --control-line: #7185a2;
    --focus: #9cc2ff;
    --hover: #253b5c;
    --hover-line: #6387ba;
    --success: #86d8ae;
    --success-soft: #193b30;
    --warning: #f1cb82;
    --warning-soft: #3c301e;
    --warning-line: #806638;
    --danger: #ffaaaa;
    --danger-soft: #472a33;
    --shadow-soft: #00000025;
    --shadow-modal: #00000080;
    --scrim: #050a13b3;
  }
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
html { scroll-padding-block: 24px var(--footer-space); }
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--paper); border-radius: 10px; padding: 11px 16px; min-height: 48px; color: inherit; font-weight: 600; }
button:disabled { opacity: .48; cursor: not-allowed; }
.primary, .link-button { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.danger { color: var(--danger); }
a { color: var(--accent); }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
input, textarea, select { background: var(--paper); border: 1px solid var(--control-line); border-radius: 10px; padding: 12px; width: 100%; color: inherit; min-height: 46px; font-size: 16px; }
textarea { resize: vertical; line-height: 1.7; }
input[type="checkbox"] { width: 20px; min-height: 20px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
label { display: block; font-size: .88rem; font-weight: 600; margin: 16px 0 8px; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 2.5rem; font-weight: 650; line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 1.45rem; letter-spacing: -.035em; line-height: 1.25; }
h3 { font-size: 1rem; }
p { line-height: 1.65; }
small, .hint { font-size: .82rem; color: var(--muted); line-height: 1.6; }
.eyebrow { font-size: .8125rem; letter-spacing: .12em; font-weight: 650; color: var(--muted); }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; font-weight: 700; line-height: 1.25; }
.logo { display: grid; place-items: center; width: 42px; height: 46px; border-radius: 12px; background: var(--accent); color: var(--on-accent); flex-shrink: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); padding: 24px; border-radius: 14px; }
.login { max-width: 1180px; margin: auto; padding: 40px 5vw; }
.login-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 7vw; align-items: center; min-height: 75vh; }
.login h1 { font-size: clamp(2.5rem, 4vw, 3.8rem); max-width: 13ch; }
.lead { font-size: 1.1rem; max-width: 440px; color: var(--muted); }
.steps { display: flex; gap: 20px; margin-top: 36px; flex-wrap: wrap; font-size: .8rem; }
.login .primary { width: 100%; margin: 14px 0; }
.login .hint { margin-top: 14px; }
.login-code { font-size: 2rem; letter-spacing: .18em; font-weight: 700; margin: 10px 0; }
.filters { display: flex; gap: 4px; background: var(--canvas); border-radius: 10px; padding: 3px; }
.filters button { font-size: .8125rem; padding: 8px; flex: 1; background: transparent; border-color: transparent; }
.filters button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.dot { display: inline-block; background: var(--success); width: 7px; height: 7px; border-radius: 50%; margin-right: 4px; }
#workspace { margin: 0; padding: 0 40px var(--footer-space); }
.topbar { display: flex; align-items: center; justify-content: space-between; min-height: 76px; max-width: 1120px; margin: 0 auto 26px; border-bottom: 1px solid var(--line); gap: 8px; }
.topbar button { font-size: .83rem; background: transparent; border: 0; padding-inline: 10px; }
.topbar .connection-button { background: var(--accent-soft); color: var(--accent); border-radius: 24px; min-height: 44px; }
#content { max-width: 760px; margin: auto; }
.article-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.article-heading > div { min-width: 0; }
.article-heading .eyebrow { margin: 0 0 6px; }
.article-heading h1 { font-size: 1.35rem; margin: 0; overflow-wrap: anywhere; letter-spacing: -.025em; }
.icon-button { min-width: 44px; border: 0; background: transparent; padding: 8px; }
.workflow-steps { display: flex; margin-bottom: 24px; padding: 5px; background: var(--accent-soft); border-radius: 14px; gap: 5px; }
.workflow-steps button { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 6px; background: transparent; border-color: transparent; color: var(--muted); font-size: .86rem; }
.workflow-steps button[aria-current="step"] { background: var(--paper); color: var(--accent); box-shadow: 0 2px 6px var(--shadow-soft); }
.step-number { width: 25px; height: 25px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--line); color: var(--muted); font-size: .8125rem; flex-shrink: 0; }
[aria-current="step"] .step-number { background: var(--accent); color: var(--on-accent); }
.past .step-number { background: var(--accent-line); color: var(--accent); }
.step-intro { margin-bottom: 20px; }
.step-intro .eyebrow { margin-bottom: 9px; color: var(--accent); }
.step-intro h2 { font-size: 1.7rem; margin-bottom: 9px; }
.step-intro p:last-child { color: var(--muted); font-size: .92rem; margin: 0; }
.workflow-actions { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; padding: 16px 28px max(16px, env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line); z-index: 20; }
.workflow-actions button { min-height: 48px; }
.workflow-actions :is(.primary, .review-next) { width: min(390px, 55%); }
.workflow-actions .secondary { background: transparent; border-color: transparent; font-size: .85rem; }
.source-toolbar { display: flex; gap: 10px; margin-bottom: 18px; }
.source-loaded { display: block; color: var(--success); }
.link-warning { background: var(--warning-soft); border-radius: 9px; padding: 14px; margin: 0 0 16px; }
.link-warning p { font-size: .85rem; margin-bottom: 10px; }
.link-warning p:empty, #link-error:empty, #material-error:empty { display: none; }
.source-toolbar button { flex: 1; font-size: .87rem; }
.source-toolbar span { margin-right: 5px; color: var(--accent); font-size: 1.1rem; }
summary { cursor: pointer; min-height: 48px; line-height: 1.5; }
.note-composer { margin-bottom: 28px; }
.note-composer > summary { font-weight: 650; display: flex; align-items: center; gap: 8px; }
.note-composer > summary::before { content: "+"; color: var(--accent); }
.note-composer[open] > summary::before { content: "−"; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; }
.composer-footer .hint { font-size: .8125rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h3 { margin: 0; }
.sources-heading { margin-bottom: 14px; }
.count { display: inline-block; font-size: .8125rem; background: var(--accent-soft); color: var(--accent); border-radius: 20px; padding: 1px 7px; margin-left: 4px; font-weight: 500; }
.material-item { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: var(--paper); overflow: hidden; }
.material-item summary { display: flex; align-items: flex-start; gap: 14px; padding: 18px; list-style: none; }
summary::-webkit-details-marker { display: none; }
.source-icon { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); width: 40px; height: 44px; border-radius: 9px; font-size: 1.4rem; flex-shrink: 0; }
.source-summary { min-width: 0; flex: 1; }
.source-summary strong { display: block; font-size: .9rem; }
.source-excerpt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: .88rem; margin: 6px 0; line-height: 1.55; }
.source-summary small { font-size: .8125rem; }
.disclosure { color: var(--muted); }
.material-detail { padding: 0 18px 18px; }
.material-item img { width: 100%; max-height: 260px; object-fit: contain; background: var(--accent-soft); border-radius: 8px; margin: 12px 0; }
.material-item audio { width: 100%; margin: 12px 0; }
.source-note { display: flex; align-items: flex-start; gap: 10px; color: var(--muted); margin: 22px 0 0; }
.source-note p { font-size: .8125rem; margin: 0; }
.source-note > span { padding-top: 3px; }
.sources-empty { text-align: center; padding: 28px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); }
.sources-empty > span { font-size: 1.5rem; }
.sources-empty p { margin: 8px 0 2px; font-size: .9rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row button { font-size: .8rem; }
.editor-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--muted); font-size: .8125rem; }
.editor-meta button { background: transparent; border: 0; font-size: .8rem; padding: 8px; white-space: nowrap; }
.writing-surface { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.writing-surface label { color: var(--muted); font-size: .8125rem; margin-top: 0; }
.writing-surface #title { font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 4px 0 18px; margin-bottom: 22px; line-height: 1.4; resize: none; overflow: hidden; font-family: Georgia, "Times New Roman", serif; }
.editor-body { min-height: 340px; border: 0; padding: 0; border-radius: 0; line-height: 1.85; }
.editor-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; gap: 8px; padding-top: 15px; border-top: 1px solid var(--line); }
.editor-footer button { font-size: .8rem; color: var(--accent); }
.ai-box { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; margin-top: 20px; }
.ai-box > summary { display: flex; justify-content: space-between; align-items: center; padding: 16px; gap: 8px; font-size: .9rem; font-weight: 600; color: var(--accent); }
.ai-box > summary .hint { font-size: .8125rem; font-weight: 400; }
.ai-content { padding: 0 16px 18px; }
.ai-content > button { width: 100%; color: var(--accent); }
.ai-content p { margin: 12px 0; }
.quick-prompts { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.quick-prompts button { font-size: .8125rem; padding: 9px 12px; border-color: var(--accent-line); color: var(--accent); border-radius: 22px; }
.ai-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; align-items: start; }
.ai-studio { padding: 20px; border: 1px solid var(--accent-line); border-radius: var(--radius); background: var(--paper); }
.ai-studio-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-studio-heading .eyebrow { color: var(--accent); margin-bottom: 6px; }
.ai-studio-heading h3 { font-size: 1.2rem; margin: 0; letter-spacing: -.025em; }
.ai-chip { padding: 7px 10px; background: var(--paper); border: 1px solid var(--accent-line); border-radius: 20px; font-size: .8125rem; color: var(--accent); white-space: nowrap; }
.ai-result-link { display: inline-flex; align-items: center; gap: 4px; background: transparent; border: 0; padding: 8px 0 8px 8px; color: var(--accent); font-size: .8125rem; text-align: left; }
.ai-studio textarea { line-height: 1.5; background: var(--paper); }
.instruction-save { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 0 16px; }
.instruction-save small { font-size: .8125rem; }
.instruction-save button { background: transparent; border: 0; padding: 6px 0 6px 12px; font-size: .8125rem; color: var(--accent); }
.ai-source-plan { padding: 0; margin: 0; border-top: 1px solid var(--line); }
.ai-source-plan > summary { padding: 13px 0; font-size: .86rem; font-weight: 600; min-height: 48px; }
.ai-source-plan ul { padding: 0; margin: 0 0 12px; list-style: none; }
.ai-source-plan li { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); font-size: .8rem; overflow-wrap: anywhere; }
.ai-source-plan li small { display: block; font-size: .8125rem; margin-top: 3px; }
.ai-source-plan .source-icon { width: 26px; height: 26px; flex-shrink: 0; }
.ai-source-plan > button { margin-bottom: 12px; font-size: .8rem; }
.ai-generate { display: flex; justify-content: center; gap: 10px; width: 100%; margin-top: 12px; padding: 14px; }
.ai-footnote { margin: 12px 0 0; font-size: .8125rem; }
.accumulation-note { margin: 8px 0 0; font-size: .8125rem; }
.request-once { font-size: .8125rem; font-weight: 400; margin: 12px 0; }
.append-instruction { width: 100%; background: transparent; border: 0; color: var(--muted); font-size: .8125rem; margin-top: 4px; }
.ai-result { min-width: 0; }
.ai-report { margin-top: 18px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); }
.ai-report .section-head { margin-bottom: 8px; }
.ai-report h3 { margin: 0; }
.ai-report > .hint { margin-bottom: 12px; font-size: .8125rem; }
.coverage-count { color: var(--success); background: var(--success-soft); padding: 6px 10px; font-size: .8125rem; font-weight: 650; border-radius: 20px; white-space: nowrap; }
.report-details > summary, .report-task > summary { padding: 13px 0; min-height: 48px; font-size: .84rem; font-weight: 600; }
.report-task { border-top: 1px solid var(--line); }
.report-task p { font-size: .84rem; }
.coverage-item { border-top: 1px solid var(--line); padding: 0 0 4px; }
.coverage-item summary { display: flex; align-items: flex-start; gap: 10px; padding: 13px 0; min-height: 48px; font-size: .8rem; line-height: 1.5; overflow-wrap: anywhere; }
.coverage-state { border-radius: 5px; padding: 3px 6px; white-space: nowrap; font-size: .8125rem; }
.coverage-state.used { color: var(--success); background: var(--success-soft); }
.coverage-state.skipped { color: var(--warning); background: var(--warning-soft); }
.coverage-item p { font-size: .83rem; margin: 8px 0; }
.coverage-item blockquote { margin: 0 0 14px; padding: 10px 14px; border-left: 2px solid var(--accent-line); background: var(--accent-soft); font-size: .83rem; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.instruction-note { padding: 14px; background: var(--warning-soft); border-radius: 10px; margin-bottom: 8px; font-size: .83rem; color: var(--warning); }
.instruction-note p { margin: 6px 0 0; }
.report-warning { padding: 10px; background: var(--warning-soft); border-radius: 8px; font-size: .8rem; }
@media (min-width: 1200px) {
  .article-open #content { max-width: 1120px; }
  .ai-workspace { grid-template-columns: 330px minmax(0, 1fr); gap: 24px; }
}
@media (max-width: 600px) {
  .ai-studio { padding: 18px; border-radius: 14px; }
  .ai-studio-heading h3 { font-size: 1.05rem; }
  .ai-report { padding: 16px; }
  .ai-workspace { gap: 22px; }
}
.job { padding: 14px 16px; border-radius: 10px; background: var(--accent-soft); margin-bottom: 22px; font-size: .85rem; line-height: 1.7; overflow-wrap: anywhere; }
.job button { font-size: .8125rem; padding: 8px; margin-left: 5px; }
.job p { margin: 8px 0 0; }
.photo-settings { padding: 16px; margin-bottom: 20px; }
.photo-settings summary { display: flex; align-items: center; gap: 8px; font-size: .9rem; font-weight: 600; }
.photo-settings[open] summary { margin-bottom: 10px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.photo-tile { border-radius: 9px; overflow: hidden; border: 2px solid transparent; background: var(--accent-soft); }
.photo-tile.chosen { border-color: var(--accent); }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; height: auto; object-fit: cover; border-radius: 6px; display: block; }
.photo-tile > button { border: 0; border-radius: 0; padding: 6px; font-size: .8125rem; width: 100%; }
.photo-order { display: flex; }
.photo-order button { border-radius: 0; flex: 1; padding: 4px; font-size: .85rem; }
.reading-preview { box-shadow: 0 4px 24px var(--shadow-soft); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 30px; }
.reading-preview h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; line-height: 1.25; overflow-wrap: anywhere; letter-spacing: -.035em; }
.text-preview { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.85; }
.reading-meta { margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .8125rem; }
.publication-history { margin-top: 28px; }
.version-row { padding: 14px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.version-row p { margin: 0; }
.version-row button { font-size: .8rem; }
.preview-message { border: 1px solid var(--line); background: var(--accent-soft); border-radius: 14px; padding: 18px; margin: 14px 0; }
.preview-message .photo-grid { margin-top: 0; }
.checkline { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .9rem; margin: 18px 0; line-height: 1.5; }
.checkline input { margin-top: 2px; }
dialog { border: 1px solid var(--line); border-radius: 18px; padding: 32px; max-width: 720px; width: calc(100% - 32px); max-height: 90dvh; color: inherit; background: var(--paper); box-shadow: 0 20px 80px var(--shadow-modal); }
dialog h2 { padding-right: 22px; }
dialog::backdrop { background: var(--scrim); }
.dialog-close { position: absolute; right: 10px; top: 8px; font-size: 1.5rem; border: 0; background: transparent; min-width: 44px; }
.dialog-actions { display: flex; gap: 12px; margin-top: 22px; justify-content: flex-end; flex-wrap: wrap; }
.article-menu { display: grid; gap: 10px; }
.article-menu button { text-align: left; }
.article-menu + p { margin: 16px 0 0; }
.link-button { display: inline-flex; text-decoration: none; align-items: center; justify-content: center; padding: 12px 16px; border-radius: 10px; font-weight: 600; min-height: 48px; }
.error-box { padding: 16px; background: var(--warning-soft); border: 1px solid var(--warning-line); border-radius: 10px; margin: 16px 0; font-size: .88rem; line-height: 1.65; }
.error-box ul { padding-left: 20px; margin-bottom: 0; }
#notice:not(:empty) { position: fixed; bottom: calc(92px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 100; width: max-content; max-width: min(90vw, 600px); padding: 14px 20px; background: var(--ink); color: var(--paper); border-radius: 10px; box-shadow: 0 4px 20px var(--shadow-soft); font-size: .9rem; line-height: 1.5; }
.skip { position: absolute; top: -60px; }
.skip:focus { top: 8px; left: 12px; z-index: 200; background: var(--paper); padding: 10px; }
[hidden] { display: none !important; }
@media (max-width: 1100px) and (min-width: 768px) {
  #workspace { padding-inline: 24px; }
}
@media (max-width: 767px) {
  #workspace { margin: 0; padding: 0 16px var(--footer-space); }
  #content, .topbar { max-width: 640px; }
  .topbar { min-height: 68px; margin-bottom: 20px; padding-top: env(safe-area-inset-top); border: 0; }
  .topbar .back-button { padding-left: 0; }
  .article-heading { margin-bottom: 20px; }
  .article-heading h1 { font-size: 1.2rem; line-height: 1.35; }
  .workflow-steps { margin-bottom: 24px; gap: 2px; padding: 4px; }
  .workflow-steps button { font-size: .8125rem; gap: 6px; }
  .step-number { width: 22px; height: 22px; font-size: .8125rem; }
  .step-intro h2 { font-size: 1.6rem; }
  .step-intro p:last-child { font-size: .87rem; }
  .workflow-actions { left: 0; padding: 12px 16px max(12px, env(safe-area-inset-bottom)); gap: 8px; }
  .workflow-actions :is(.primary, .review-next) { flex: 1; max-width: 390px; width: auto; font-size: .85rem; padding-inline: 12px; }
  .workflow-actions .secondary { font-size: .8125rem; padding-inline: 8px; }
  .keyboard-open .workflow-actions { display: none; }
  .keyboard-open #notice:not(:empty) { bottom: 16px; }
  .panel { padding: 18px; }
  .source-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .source-toolbar button { padding-inline: 10px; font-size: .82rem; }
  .material-item summary { padding: 16px; gap: 12px; }
  .writing-surface { padding: 20px; }
  .editor-body { min-height: 310px; }
  .reading-preview { padding: 22px; }
  .reading-preview h2 { font-size: 1.6rem; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login { padding: 24px 20px; }
  .login-grid { display: block; padding-top: 32px; min-height: auto; }
  .login h1 { font-size: 2.2rem; }
  .login .lead { font-size: .94rem; }
  .login .steps { margin: 24px 0; gap: 16px; font-size: .8125rem; }
  .login .panel { margin: 28px 0; }
  dialog { padding: 28px 20px; }
}
@media (max-width: 370px) {
  #workspace { padding-inline: 14px; }
  .workflow-steps button { font-size: .8125rem; gap: 4px; }
  .step-number { width: 20px; height: 20px; }
  .workflow-actions { padding-inline: 10px; gap: 4px; }
  .workflow-actions .secondary { font-size: .8125rem; }
  .workflow-actions :is(.primary, .review-next) { font-size: .8125rem; }
  .ai-box > summary .hint { display: none; }
}


/* Editorial workspace: one visual language for collection, writing and review. */
button, .link-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; touch-action: manipulation; transition: background-color var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast); }
button:active:not(:disabled) { background-color: var(--accent-soft); border-color: var(--control-line); }
.primary:active:not(:disabled) { background-color: var(--accent-hover); }
button:disabled { opacity: .5; }
button[aria-busy="true"]::before { content: ""; width: 14px; height: 14px; flex-shrink: 0; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: waiting 700ms linear infinite; }
@keyframes waiting { to { transform: rotate(360deg); } }
.icon { width: 20px; height: 20px; display: block; flex-shrink: 0; }
[data-icon] { display: inline-flex; }
.logo .icon { width: 26px; height: 26px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
h1, h2, h3 { text-wrap: balance; }
button, summary, .hint, .text-preview { overflow-wrap: anywhere; }
.topbar { margin-bottom: 22px; }
.topbar .connection-button { border: 1px solid var(--accent-line); font-size: .8125rem; padding: 8px 12px; }
.topbar .row { gap: 4px; }
.topbar button[data-action="refresh"] { min-width: 44px; }
.article-index { font-size: .75rem; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.article-state { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .75rem; }
.article-state::before { content: ""; width: 6px; height: 6px; border: 1.5px solid currentColor; border-radius: 50%; }
.article-state.has-text { color: var(--accent); }
.article-state.has-text::before { background: currentColor; }
.library-empty { text-align: center; padding: 40px 12px; color: var(--muted); }
.library-empty .icon { margin: 0 auto 16px; width: 30px; height: 30px; }
.library-empty p { color: var(--ink); margin-bottom: 8px; font-weight: 600; }
.library-empty small { display: block; }
.filters button { font-weight: 500; padding-inline: 4px; overflow-wrap: normal; white-space: nowrap; }
.article-heading h1 { font-size: 1.4rem; }
.step-intro h2 { font-weight: 600; letter-spacing: -.025em; }
.workflow-steps { border: 1px solid var(--line); flex-wrap: wrap; }
.workflow-steps button { font-weight: 600; flex: 1 1 8em; overflow-wrap: normal; }
.workflow-actions { box-shadow: 0 -4px 20px var(--shadow-soft); flex-wrap: wrap; }
.workflow-actions button { overflow-wrap: normal; }
.workflow-actions :is(.primary, .review-next) { flex: 1 1 10em; max-width: 390px; }
.workflow-actions .review-next { background: var(--paper); color: var(--accent); border-color: var(--accent); }
.source-toolbar button { min-height: 56px; background: var(--paper); }
.source-toolbar .icon { color: var(--accent); }
.note-composer { margin-bottom: 12px; padding: 8px 18px; }
.note-composer:not([open]) { display: none; }
.note-composer[open] { padding-bottom: 20px; }
.note-composer > summary { justify-content: space-between; }
.note-composer > summary::before { display: none; }
.note-composer > summary::after { content: "+"; font-size: 1.2rem; color: var(--accent); }
.note-composer[open] > summary::after { content: "−"; }
.sources-heading { margin-top: 28px; }
.source-icon { width: 38px; height: 40px; }
.material-item summary { gap: 12px; }
.material-item[open] { border-color: var(--control-line); }
.material-item[open] .disclosure { transform: rotate(180deg); }
.source-summary strong { font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.source-summary .source-loaded { font-size: .8125rem; }
.source-summary small { line-height: 1.7; }
.ai-studio-heading { margin-bottom: 16px; }
.ai-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ai-title > .icon { color: var(--accent); }
.ai-studio-heading h3 { font-size: 1rem; letter-spacing: -.01em; }
.ai-result-link { white-space: nowrap; font-size: .8125rem; }
.ai-result-link .icon { width: 16px; }
.brief-context { border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: var(--canvas); }
.brief-context summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; list-style: none; font-size: .8125rem; font-weight: 500; padding: 12px 0; }
.brief-context summary > span { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brief-context summary .icon { width: 17px; height: 17px; color: var(--accent); }
.brief-context details[open] > summary > .icon { transform: rotate(180deg); }
.instruction-content label { margin-top: 0; }
.instruction-save { margin-bottom: 8px; }
.instruction-save small { font-size: .8125rem; }
.ai-studio > label { margin-top: 20px; }
.ai-studio #ai-request { background: var(--paper); min-height: 100px; }
.ai-studio .request-memory { margin: 6px 0 8px; font-size: .8125rem; }
.quick-prompts { gap: 8px; padding: 0; }
.quick-prompts button { background: var(--accent-soft); border-color: transparent; font-size: .8125rem; min-height: 44px; padding: 8px 12px; font-weight: 500; }
.request-options .checkline { margin: 6px 0; align-items: center; min-height: 44px; font-size: .8125rem; }
.request-options input { margin-top: 0; }
.ai-secondary-actions { text-align: center; }
.keyboard-hint { margin: 0; text-align: center; font-size: .75rem; }
.paper-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 20px; }
.paper-heading .eyebrow { color: var(--accent); }
.paper-heading .hint { font-size: .75rem; }
.writing-surface { box-shadow: 0 4px 24px var(--shadow-soft); }
.writing-surface #title { font-size: 1.6rem; font-weight: 600; line-height: 1.3; }
.writing-surface label { font-size: .8125rem; }
.editor-body { font-size: 1rem; line-height: 1.85; }
.editor-meta { font-size: .8125rem; }
.editor-footer button { background: var(--accent-soft); border-color: var(--accent-line); }
.report-details > summary, .report-task > summary { display: flex; align-items: center; justify-content: space-between; list-style: none; }
.report-details > summary::after, .report-task > summary::after { content: "+"; font-size: 1.1rem; color: var(--accent); }
.report-details[open] > summary::after, .report-task[open] > summary::after { content: "−"; }
.reading-preview .text-preview { font-family: Georgia, "Times New Roman", serif; font-size: 1.125rem; line-height: 1.85; }
.reading-preview h2 { letter-spacing: -.02em; }
.reading-preview .photo-grid img:only-child { grid-column: 1 / -1; aspect-ratio: auto; max-height: 440px; object-fit: contain; }
.photo-settings:not([open]) { padding: 4px 16px; }
.checkline { min-height: 44px; align-items: center; }
.dialog-close { display: grid; place-items: center; }
dialog { overscroll-behavior: contain; }
dialog[open] { animation: dialog-in var(--motion-panel) ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 1200px) {
  .ai-workspace { gap: 28px; }
  .ai-studio { padding: 18px; }
  .ai-title { align-items: flex-start; }
  .ai-result-link { font-size: .75rem; }
  .ai-studio-heading { gap: 4px; }
  .ai-studio-heading h3 { max-width: 150px; }
  .ai-studio .quick-prompts { gap: 6px; }
  .writing-surface { padding: 28px; }
}
@media (max-width: 767px) {
  .topbar { min-height: 64px; margin-bottom: 12px; }
  .topbar .back-button { font-size: .8125rem; }
  .article-heading { margin-bottom: 16px; }
  .workflow-steps button { font-size: .8125rem; gap: 6px; }
  .step-intro h2 { font-size: 1.5rem; }
  .workflow-actions { padding-inline: 16px; }
  .workflow-actions :is(.primary, .review-next) { max-width: 390px; font-size: .875rem; }
  .workflow-actions .secondary { font-size: .8125rem; }
  .writing-surface { padding: 20px; }
  .reading-preview { padding: 24px 20px; }
  .reading-preview h2 { font-size: 1.85rem; }
  .login h1 { max-width: 16ch; }
  .login-grid { display: flex; flex-direction: column; gap: 28px; padding-top: 28px; }
  .login-grid > .panel { order: -1; width: 100%; margin: 0; }
}
@media (max-width: 480px) {
  .ai-studio { padding: 16px; }
  .ai-studio-heading h3 { font-size: .9375rem; }
  .ai-studio-heading { gap: 4px; }
  .ai-title { gap: 6px; }
  .ai-result-link { font-size: .75rem; }
  .ai-title .icon { width: 18px; }
  .brief-context { padding-inline: 10px; }
  .workflow-steps { gap: 0; }
  .workflow-steps button { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: .75rem; }
  .source-toolbar button { flex-direction: column; gap: 8px; padding: 12px; }
  .source-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .material-item summary { padding: 14px; gap: 10px; }
  .material-detail { padding-inline: 14px; }
  .source-icon { width: 32px; height: 36px; }
  .material-item .disclosure .icon { width: 16px; }
  .section-head { align-items: flex-start; }
  .paper-heading .hint { display: none; }
  .coverage-count { white-space: normal; text-align: center; }
  .coverage-item summary { flex-direction: column; gap: 6px; }
  dialog { max-height: calc(100dvh - 32px); padding: 32px 20px 20px; border-radius: 18px; }
  .dialog-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dialog-actions button { min-width: 0; }
}
@media (hover: none) and (pointer: coarse) { .keyboard-hint { display: none; } }
.step-number { width: 1.75em; height: 1.75em; }
/* ArticlesList is a standalone page; the editor occupies its own screen. */
.article-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 280px); gap: 20px; }
.article-filters label { margin: 0 0 8px; font-size: .75rem; color: var(--muted); }
.article-filters select { font-size: 1rem; min-height: 50px; padding: 9px 12px; }
.list-results { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-height: 32px; }
.list-results small { font-variant-numeric: tabular-nums; font-size: .75rem; }
.list-results button { padding: 8px; min-height: 44px; border-color: transparent; background: transparent; color: var(--accent); font-size: .75rem; }
summary { border-radius: 8px; transition: background-color var(--motion-fast), color var(--motion-fast); }
input, textarea, select { transition: border-color var(--motion-fast), box-shadow var(--motion-fast); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
@media (min-width: 768px) {
  #workspace { padding-bottom: var(--footer-space); }
}
@media (min-width: 768px) and (max-width: 1100px) {
  .source-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workflow-steps button { font-size: .8125rem; flex-basis: 7em; gap: 6px; }
  .workflow-actions { padding-inline: 20px; }
}
#app:not(.article-open) #workspace, .article-open #library { display: none; }
.articles-page { max-width: 1200px; padding: 0 40px 40px; margin: auto; min-height: 100dvh; }
.library-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.library-topbar .brand { font-size: .95rem; }
.library-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin: 40px 0 28px; }
.library-heading h1 { font-size: clamp(2rem, 4vw, 2.5rem); margin: 0 0 10px; }
.library-heading .eyebrow { margin-bottom: 8px; }
.library-heading p:last-child { color: var(--muted); margin-bottom: 0; font-size: .9375rem; }
.library-heading > .primary { flex-shrink: 0; }
.library-controls { margin-bottom: 16px; }
.library-filter-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.library-filter-bar .filters { background: var(--paper); border: 1px solid var(--line); }
.library-filter-bar .filters button { padding-inline: 20px; }
.list-results { gap: 16px; }
#article-list { display: grid; gap: 12px; }
.article-link { display: grid; grid-template-columns: 44px minmax(0, 1fr) minmax(160px, 200px) 20px; gap: 20px; align-items: center; width: 100%; text-align: left; padding: 22px 24px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); line-height: 1.5; }
.article-link .article-index { color: var(--muted); }
.article-name { font-size: 1rem; font-weight: 600; min-width: 0; }
.article-state { font-weight: 400; }
.article-arrow { color: var(--muted); }
.article-arrow .icon, summary .disclosure { transition: transform var(--motion-fast); }
.library-foot { display: flex; flex-wrap: wrap; gap: 8px 24px; border-top: 1px solid var(--line); margin-top: 32px; padding-top: 20px; font-size: .75rem; color: var(--muted); }
.library-foot .dot { background: var(--accent); }
@media (max-width: 767px) {
  .articles-page { padding: 0 20px 28px; }
  .library-topbar { padding-top: max(20px, env(safe-area-inset-top)); }
  .library-heading { align-items: flex-start; flex-direction: column; gap: 20px; margin-top: 28px; }
  .library-heading > .primary { width: 100%; }
  .article-filters { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .library-filter-bar { align-items: stretch; flex-direction: column; gap: 8px; }
  .library-filter-bar .filters button { padding-inline: 8px; }
  .list-results { min-height: 44px; }
  .article-link { grid-template-columns: 26px minmax(0, 1fr) 20px; gap: 8px 12px; padding: 18px; }
  .article-link .article-state { grid-column: 2; }
  .article-arrow { grid-column: 3; grid-row: 1 / 3; align-self: center; }
}
@media (hover: hover) {
  button:hover:not(:disabled), .link-button:hover { background: var(--hover); border-color: var(--hover-line); }
  .primary:hover:not(:disabled), .link-button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); box-shadow: 0 3px 12px var(--shadow-soft); }
  .article-link:hover:not(:disabled) { background: var(--hover); border-color: var(--hover-line); box-shadow: 0 3px 12px var(--shadow-soft); }
  .article-link:hover .article-arrow .icon { transform: translateX(3px); color: var(--accent); }
  .filters button:hover:not(:disabled), .workflow-steps button:hover:not(:disabled) { background: var(--hover); color: var(--accent); }
  .danger:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger); }
  summary:hover { background: var(--hover); color: var(--accent); }
  input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: var(--hover-line); }
  a:not(.link-button):not(.brand):hover { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; }
  .brand:hover { color: var(--accent); }
}
button:active:not(:disabled), summary:active { background: var(--accent-soft); }
.primary:active:not(:disabled), .link-button:active { background: var(--accent-hover); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Recorded AI usage belongs to the article, across all its versions. */
.token-usage { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 6px; }
.token-usage > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 48px; padding: 10px 4px; font-size: .8125rem; }
.token-usage > summary strong { color: var(--accent); font-variant-numeric: tabular-nums; margin-left: auto; }
.token-usage > summary .icon { width: 16px; height: 16px; flex: 0 0 16px; transition: transform var(--motion-fast); }
.token-usage[open] > summary .icon { transform: rotate(180deg); }
.token-usage-content { padding: 8px 4px 0; }
.token-totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 8px; }
.token-totals dt { color: var(--muted); font-size: .75rem; }
.token-totals dd { margin: 4px 0 0; font-size: 1.125rem; font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.token-history { list-style: none; padding: 0; margin: 16px 0; }
.token-history li { padding: 12px 0; border-top: 1px solid var(--line); }
.token-history li > div { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: .8125rem; }
.token-history strong { font-variant-numeric: tabular-nums; }
.token-history small { display: block; color: var(--muted); font-size: .75rem; margin-top: 4px; }
/* Rich-text article editor adapted from dqaztv25; all controls follow app tokens. */
.rich-body-label { font-size: .8125rem; color: var(--muted); font-weight: 600; margin-bottom: 10px; }
.rich-text { border: 1px solid var(--control-line); border-radius: 12px; background: var(--paper); }
.rich-toolbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); background: var(--canvas); border-radius: 12px 12px 0 0; }
.rich-toolbar button { min-width: 44px; min-height: 44px; width: 44px; padding: 8px; border-color: transparent; background: transparent; border-radius: 8px; }
.rich-toolbar button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.rich-toolbar .icon { width: 19px; height: 19px; }
.rich-text-editor { position: relative; min-height: 340px; padding: 18px; outline-offset: -3px; border-radius: 0 0 12px 12px; font-size: 1rem; cursor: text; }
.rich-text-editor:focus-visible { outline: 3px solid var(--focus); }
.rich-text-editor[data-empty="true"]::before { content: attr(data-placeholder); position: absolute; top: 18px; left: 18px; right: 18px; color: var(--muted); pointer-events: none; }
.rich-content { line-height: 1.85; overflow-wrap: anywhere; white-space: normal; }
.rich-content p, .rich-content div { margin: 0 0 1em; }
.rich-content > :last-child { margin-bottom: 0; }
.rich-content h2 { font-family: inherit; font-size: 1.4em; font-weight: 700; margin: 1.3em 0 .6em; line-height: 1.4; letter-spacing: -.015em; }
.rich-content h3 { font-size: 1.15em; margin: 1.1em 0 .5em; }
.rich-content ul, .rich-content ol { padding-left: 1.6em; margin: .75em 0 1em; }
.rich-content li { margin: .3em 0; }
.rich-content blockquote { margin: 1em 0; padding: 12px 18px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.rich-content blockquote > :last-child { margin-bottom: 0; }
.rich-content a { text-decoration: underline; text-underline-offset: 3px; }
.rich-content strong { font-weight: 700; }
.rich-link-panel { padding: 12px 16px 16px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.rich-link-panel label { margin-top: 0; }
.rich-link-panel .row { margin-top: 10px; }
.rich-link-panel .row button { min-height: 44px; }
.rich-error { color: var(--danger); padding: 12px 16px; margin: 0; font-size: .8125rem; }
.reading-preview > .rich-content { font-family: Georgia, "Times New Roman", serif; font-size: 1.125rem; }
@media (hover: hover) {
  .rich-toolbar button:hover:not(:disabled) { background: var(--hover); border-color: var(--hover-line); color: var(--accent); }
}
@media (max-width: 480px) {
  .rich-toolbar { padding: 6px; gap: 4px; }
  .rich-text-editor { padding: 14px; min-height: 310px; }
  .rich-text-editor[data-empty="true"]::before { top: 14px; left: 14px; right: 14px; }
}
