:root {
  --blue: #0e1e20;
  --blue-dark: #1b363b;
  --lime: #d4f770;
  --lime-dark: #c7e85a;
  --ink: #0e1e20;
  --muted: #616160;
  --line: #ded8cd;
  --canvas: #f8f5ee;
  --paper: #fffdf8;
  --soft: #f0ece3;
  --green: #2e6b4b;
  --panel-shadow: 0 2px 4px rgb(14 30 32 / 7%);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: "Satoshi", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }

.content { min-height: 100vh; padding: 27px 28px 72px; }
.content-frame { width: min(100%, 1140px); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 50px; }
.brand { display: flex; align-items: center; color: inherit; text-decoration: none; }
.opus-logo { display: block; width: 111px; height: 31px; }
.site-link { color: var(--muted); font-size: 12px; text-decoration: none; }
.site-link:hover { color: var(--ink); }
.heading-copy { max-width: 720px; }
.eyebrow { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.heading-copy h1 { max-width: 650px; margin: 0; font-size: clamp(32px, 4.2vw, 52px); font-weight: 700; letter-spacing: -.06em; line-height: .98; }
.heading-copy > p:last-child { max-width: 640px; margin: 18px 0 0; color: #68706a; font-size: 16px; line-height: 1.55; }

.workspace { display: grid; grid-template-columns: minmax(0, .88fr) minmax(0, 1.12fr); align-items: start; gap: 24px; margin-top: 36px; }
.panel, .history-panel { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: var(--panel-shadow); }
.brief-panel, .preview-panel { min-width: 0; padding: 25px 22px 22px; }
.panel-heading, .preview-heading, .history-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.panel-heading h2, .preview-heading h2, .history-panel h2 { margin: 0; font-size: 20px; letter-spacing: -.045em; line-height: 1.1; }
.text-button { margin-top: 1px; padding: 0; border: 0; background: transparent; color: #355aa9; font-size: 13px; font-weight: 700; white-space: nowrap; }
.text-button:hover { color: var(--blue); }
.panel-lede { margin: 10px 0 22px; color: var(--muted); line-height: 1.5; }
.field { display: grid; gap: 8px; color: #283044; font-size: 13px; font-weight: 500; }
.field b { color: #b34646; }
.field textarea { width: 100%; border: 1px solid #cfc8bb; border-radius: 10px; background: var(--paper); color: var(--ink); outline: 0; resize: vertical; line-height: 1.5; transition: border-color 120ms ease, box-shadow 120ms ease; }
.field textarea { min-height: 104px; padding: 13px 14px; }
.brief-field textarea { min-height: 310px; }
.field textarea::placeholder { color: #a8adb8; }
.field textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(212 247 112 / 32%); }
.context-details { margin-top: 17px; border-top: 1px solid #eee8dc; }
.context-details summary { padding: 16px 0 6px; color: #364346; cursor: pointer; font-size: 13px; font-weight: 700; list-style-position: inside; }
.context-details summary span { float: right; color: #96948e; font-size: 11px; font-weight: 500; }
.context-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 12px 0 3px; }
.context-grid .field textarea { min-height: 104px; }
.panel-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 21px; }
.input-note { margin: 0; color: #8a8982; font-size: 11px; line-height: 1.4; }
.primary-button, .secondary-button { min-height: 40px; padding: 0 15px; border-radius: 7px; font-weight: 700; white-space: nowrap; }
.primary-button { border: 1px solid var(--lime); background: var(--lime); color: var(--blue); }
.primary-button:hover:not(:disabled) { border-color: var(--lime-dark); background: var(--lime-dark); }
.primary-button:disabled { border-color: #bdc49c; background: #bdc49c; color: #f8f5ee; }
.primary-button span { margin-left: 12px; font-size: 19px; vertical-align: -1px; }
.secondary-button { border: 1px solid #d7d9e1; background: #fff; color: #4a5263; }
.secondary-button:hover { background: #f7f8fb; }
.method-note { display: grid; gap: 5px; margin-top: 22px; padding: 14px 15px; border-radius: 10px; background: var(--blue); color: var(--canvas); }
.method-note strong { color: var(--lime); font-size: 12px; }
.method-note span { color: #d9d3c8; font-size: 12px; line-height: 1.45; }

.preview-panel { min-height: 660px; }
.preview-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.empty-preview { display: grid; justify-items: center; min-height: 560px; align-content: center; padding: 30px; text-align: center; }
.empty-mark { display: grid; width: 42px; height: 42px; place-items: center; border: 1px solid #cfc8bb; border-radius: 50%; color: #9d9a91; font-size: 25px; font-weight: 400; }
.empty-preview h3 { margin: 18px 0 7px; font-size: 19px; letter-spacing: -.035em; }
.empty-preview p { max-width: 300px; margin: 0; color: var(--muted); line-height: 1.55; }
.draft-output { margin-top: 22px; }
.print-brand { display: none; }
.edit-note { margin: 10px 0 0; color: #87847c; font-size: 12px; line-height: 1.45; }
.editable-document { margin-top: 10px; padding: 1px 3px 3px; border-radius: 10px; outline: 0; transition: box-shadow 120ms ease, background 120ms ease; }
.editable-document:focus { background: #fffefb; box-shadow: 0 0 0 3px rgb(212 247 112 / 28%); }
.editable-document.editable-plain { padding: 18px 20px; border: 1px solid #e5dfd5; background: #fbfaf5; color: #4e5952; line-height: 1.6; white-space: normal; }
.draft-hero { padding: 22px 20px 20px; border: 1px solid #e5dfd5; border-radius: 12px; background: #fbfaf5; }
.draft-status { display: inline-flex; align-items: center; gap: 6px; color: #65706a; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.draft-hero h3 { margin: 16px 0 9px; font-size: 28px; letter-spacing: -.05em; line-height: 1.05; }
.draft-hero > p { margin: 0; color: #5f665f; line-height: 1.55; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 20px; overflow: hidden; border: 1px solid #ded8cd; border-radius: 8px; background: #ded8cd; }
.detail-cell { min-width: 0; padding: 10px 11px; background: var(--paper); }
.detail-cell span, .section-label { display: block; color: #87847c; font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.detail-cell strong { display: block; margin-top: 4px; color: #313b36; font-size: 12px; line-height: 1.35; }
.draft-section { padding: 20px 3px 0; }
.draft-section h4 { margin: 0 0 9px; font-size: 16px; letter-spacing: -.025em; }
.draft-section p { margin: 0; color: #5f665f; line-height: 1.55; }
.draft-section ul, .questions-callout ul { margin: 0; padding-left: 20px; }
.draft-section li, .questions-callout li { margin: 8px 0; color: #4e5952; line-height: 1.5; }
.responsibility-list { list-style: none; padding-left: 0 !important; }
.responsibility-list li { padding-left: 16px; position: relative; }
.responsibility-list li::before { position: absolute; left: 0; top: 1px; content: "•"; color: var(--green); font-size: 18px; line-height: 1; }
.responsibility-list strong { color: var(--ink); }
.success-section { padding-top: 24px; }
.success-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.success-grid > div { padding: 13px 14px; border: 1px solid #e5dfd5; border-radius: 9px; background: #fbfaf5; }
.success-grid ul { margin-top: 7px; }
.question-list { list-style: decimal; }
.questions-callout { margin-top: 24px; padding: 18px 17px; border-radius: 11px; background: var(--blue); color: var(--canvas); }
.questions-callout .eyebrow { margin-bottom: 6px; color: var(--lime); }
.questions-callout h4 { margin: 0; font-size: 16px; }
.questions-callout > p:not(.eyebrow) { margin: 6px 0 10px; color: #d3ccc0; line-height: 1.45; }
.questions-callout li { color: #f1ece3; }
.draft-footnote { margin-top: 21px !important; color: #8a8982 !important; font-size: 12px; }
.manager-guide { margin-top: 28px; padding: 20px 18px; border-radius: 11px; background: var(--blue); color: var(--canvas); }
.manager-guide .eyebrow { margin-bottom: 6px; color: var(--lime); }
.manager-guide h4 { margin: 0; font-size: 16px; }
.manager-guide h5 { margin: 20px 0 7px; color: var(--lime); font-size: 12px; letter-spacing: .02em; }
.manager-guide-intro { margin: 8px 0 0; color: #d3ccc0; line-height: 1.5; }
.manager-guide ul { margin: 0; padding-left: 20px; }
.manager-guide li { margin: 8px 0; color: #f1ece3; line-height: 1.5; }
.lead-cta { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 24px; padding: 18px; border: 1px solid #dfe7b3; border-radius: 11px; background: #f2f7d8; }
.lead-cta .eyebrow { margin-bottom: 5px; color: #5f6f26; }
.lead-cta h4 { margin: 0; font-size: 16px; }
.lead-cta p:last-child { margin: 6px 0 0; color: #5f665f; line-height: 1.45; }
.cta-button { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 14px; border: 1px solid var(--blue); border-radius: 7px; background: var(--blue); color: var(--canvas); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; }
.cta-button:hover { background: var(--blue-dark); }
.draft-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid #eee8dc; }

.history-panel { margin-top: 24px; padding: 21px 22px; }
.history-heading { align-items: baseline; }
.history-heading > span { color: var(--muted); font-size: 12px; }
.empty-history { color: var(--muted); }
.empty-history p { margin: 8px 0 0; }
.history-list { margin-top: 14px; overflow: hidden; border: 1px solid #e6dfd2; border-radius: 10px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 60px; padding: 11px 13px; border-bottom: 1px solid #eee8dc; }
.history-row:last-child { border-bottom: 0; }
.history-row > div { display: grid; gap: 4px; min-width: 0; }
.history-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row span { color: var(--muted); font-size: 12px; }
.history-open { padding: 6px 10px; border: 0; border-radius: 6px; background: var(--lime); color: var(--blue); font-size: 12px; font-weight: 700; }
.history-open:hover { background: var(--lime-dark); }
.api-note { max-width: 760px; margin: 18px 0 0; color: #87847c; font-size: 12px; line-height: 1.5; }
.toast { position: fixed; top: 18px; right: 20px; z-index: 20; padding: 12px 15px; border: 1px solid #d9d0c1; border-radius: 9px; background: var(--paper); box-shadow: 0 8px 28px rgb(14 30 32 / 16%); color: #273b3d; }

@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .preview-panel { min-height: 0; }
  .empty-preview { min-height: 360px; }
}

@media (max-width: 620px) {
  .content { padding: 20px 14px 60px; }
  .topbar { margin-bottom: 37px; }
  .heading-copy h1 { font-size: 36px; }
  .heading-copy > p:last-child { font-size: 14px; }
  .workspace { gap: 18px; margin-top: 27px; }
  .brief-panel, .preview-panel, .history-panel { padding: 20px 17px; }
  .panel-heading, .preview-heading { display: grid; gap: 10px; }
  .preview-actions { justify-content: flex-start; }
  .brief-field textarea { min-height: 260px; }
  .context-grid, .success-grid { grid-template-columns: 1fr; }
  .panel-actions, .draft-actions { align-items: stretch; flex-direction: column; }
  .panel-actions .primary-button, .draft-actions button { width: 100%; }
  .lead-cta { align-items: stretch; flex-direction: column; }
  .cta-button { justify-content: center; }
  .input-note { order: 2; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .draft-hero h3 { font-size: 24px; }
  .history-row { align-items: flex-start; }
}

@media print {
  body { background: #fff; }
  .content { padding: 0; }
  .content-frame { width: 100%; }
  .topbar, .heading-copy, .brief-panel, .history-panel, .api-note, .preview-heading, .draft-status, .edit-note, .draft-actions, .toast { display: none !important; }
  .workspace { display: block; margin: 0; }
  .preview-panel { min-height: 0; padding: 0; border: 0; box-shadow: none; background: #fff; }
  .draft-output { margin: 0; }
  .print-brand { display: block; margin-bottom: 22px; }
  .editable-document { margin: 0; padding: 0; background: #fff; box-shadow: none; }
  .draft-hero { border: 0; border-bottom: 1px solid #ded8cd; border-radius: 0; background: #fff; }
  .manager-guide { page-break-before: always; border-radius: 0; }
  .lead-cta { border-color: #ded8cd; background: #fff; }
  .cta-button { color: #0e1e20; background: #d4f770; }
}
