:root { color-scheme: light; font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; --blue: #0878e8; --line: #dedfe4; --muted: #6d7079; --bg: #f5f6f8; --green: #15763a; }
* { box-sizing: border-box; }
body { margin: 0; color: #18191d; background: var(--bg); }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 14px 32px; background: #fff; border-bottom: 1px solid var(--line); }
.brand, .brand > div, nav { display: flex; align-items: center; gap: 11px; }
.brand > div { align-items: flex-start; flex-direction: column; gap: 2px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; color: #fff; background: #111; border-radius: 13px; font-weight: 800; }
.brand strong { font-size: 18px; }
.brand small, .muted { color: var(--muted); }
main { max-width: 1460px; margin: 0 auto; padding: 28px; display: grid; grid-template-columns: minmax(340px, 480px) minmax(0, 1fr); gap: 24px; }
.editor-card, .library-card { background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 12px 36px rgba(20, 30, 50, .05); }
.editor-card { padding: 28px; align-self: start; position: sticky; top: 20px; }
.library-card { padding: 28px; min-height: 560px; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .15em; }
h1 { margin: 7px 0 9px; font-size: 28px; }
h2 { margin: 5px 0 0; font-size: 24px; }
.intro { margin: 0 0 23px; color: var(--muted); line-height: 1.6; }
form { display: grid; gap: 17px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
input, textarea, select { width: 100%; padding: 12px 13px; color: inherit; background: #fff; border: 1px solid #cfd1d8; border-radius: 11px; font: inherit; line-height: 1.5; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(8, 120, 232, .12); }
.button { min-height: 40px; display: inline-grid; place-items: center; padding: 0 16px; border: 0; border-radius: 11px; text-decoration: none; font-weight: 700; cursor: pointer; }
.button.primary { color: #fff; background: var(--blue); }
.button.quiet { color: #333; background: #eeeef2; }
.button.danger { color: #b42318; background: #fff0ee; }
.button.danger.confirm { color: #fff; background: #c52a1f; }
.button:disabled { opacity: .55; cursor: wait; }
.safety-note { padding: 13px 15px; color: #77510b; background: #fff5df; border: 1px solid #f0d393; border-radius: 12px; font-size: 12px; line-height: 1.55; }
.error { margin: 0; color: #b42318; line-height: 1.5; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.library-actions { display: flex; align-items: center; gap: 10px; }
.archive-filter { display: flex; grid-template-columns: auto 1fr; align-items: center; gap: 7px; color: var(--muted); font-weight: 650; white-space: nowrap; }
.archive-filter[hidden] { display: none; }
.archive-filter input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
.template-list { margin-top: 16px; display: grid; gap: 15px; }
.template-card { padding: 19px; border: 1px solid var(--line); border-radius: 16px; }
.template-card.archived { background: #fafafa; border-style: dashed; }
.template-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.template-title h3 { margin: 0 0 5px; font-size: 19px; }
.version { padding: 4px 8px; color: var(--green); background: #e9f7ed; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.summary { margin: 13px 0; line-height: 1.55; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field { padding: 10px 11px; background: #f6f8fb; border-radius: 10px; }
.field strong, .field span { display: block; }
.field span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.script { margin-top: 13px; padding: 12px; color: #24496e; background: #eef6ff; border-radius: 11px; white-space: pre-wrap; line-height: 1.5; }
.script strong, .script span { display: block; }
.script strong { margin-bottom: 4px; color: #496b8d; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.playbook-details { margin-top: 12px; border: 1px solid #dfe5ed; border-radius: 12px; overflow: hidden; }
.playbook-details > summary { padding: 12px 14px; color: #27384a; background: #f8fafc; font-size: 13px; font-weight: 750; cursor: pointer; }
.playbook-details[open] > summary { border-bottom: 1px solid #dfe5ed; }
.playbook-content { padding: 4px 14px 14px; }
.simple-playbook { display: grid; gap: 20px; padding-top: 10px; }
.simple-section + .simple-section { padding-top: 18px; border-top: 1px solid #e7e9ee; }
.simple-heading h4 { margin: 0; font-size: 15px; }
.simple-heading p { margin: 5px 0 11px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.qa-list { display: grid; gap: 9px; }
.qa-card { padding: 13px; border: 1px solid #e2e6ec; border-left: 4px solid #5d87ad; border-radius: 11px; background: #fff; }
.qa-card.action-wait { border-left-color: #8b929b; }
.qa-card.action-request_handoff { border-left-color: #d28a20; }
.qa-card.action-propose_outcome { border-left-color: #28894c; }
.qa-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.qa-top > div { min-width: 0; display: grid; gap: 4px; }
.qa-top small, .qa-response small { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .08em; }
.qa-top strong { font-size: 12px; line-height: 1.5; }
.simple-action-chip { flex: 0 0 auto; padding: 4px 8px; color: #24527d; background: #e7f2fd; border-radius: 999px; font-size: 10px; font-weight: 750; }
.action-wait .simple-action-chip { color: #555d66; background: #eceff2; }
.action-request_handoff .simple-action-chip { color: #7a4b06; background: #fff2d8; }
.action-propose_outcome .simple-action-chip { color: #176637; background: #e6f6eb; }
.qa-response { margin-top: 11px; padding: 10px 11px; background: #f6f8fb; border-radius: 9px; }
.qa-response p { margin: 4px 0 0; font-size: 12px; line-height: 1.55; }
.qa-information { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.45; }
.completion-criteria { padding: 12px 13px; color: #24496e; background: #eef6ff; border-radius: 10px; }
.completion-criteria strong { font-size: 11px; }
.completion-criteria p { margin: 5px 0 0; font-size: 12px; line-height: 1.55; }
.simple-outcomes { margin-top: 9px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.simple-outcome { padding: 11px; border-radius: 10px; background: #f7f8fa; }
.simple-outcome.success { background: #ecf8ef; }
.simple-outcome.failure { background: #fff0ee; }
.simple-outcome.handoff { background: #fff5df; }
.simple-outcome strong { font-size: 11px; }
.simple-outcome ul { margin: 7px 0 0; padding-left: 16px; color: #474b53; font-size: 10px; line-height: 1.55; }
.advanced-playbook { margin-top: 18px; border-top: 1px dashed #d8dde4; }
.advanced-playbook > summary { padding: 14px 0 2px; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.advanced-playbook-content { padding-top: 2px; }
.playbook-section { padding-top: 14px; }
.playbook-section + .playbook-section { margin-top: 14px; border-top: 1px solid #e7e9ee; }
.playbook-section h4 { margin: 0; font-size: 14px; }
.playbook-description { margin: 5px 0 10px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.legacy-note { margin: 0; padding: 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.stage-flow { margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; list-style: none; counter-reset: stage; }
.stage-flow li { position: relative; min-width: 0; padding: 11px; background: #f6f8fb; border-radius: 10px; counter-increment: stage; }
.stage-flow li::before { content: counter(stage); float: left; width: 20px; height: 20px; margin-right: 7px; display: grid; place-items: center; color: #fff; background: #54789b; border-radius: 50%; font-size: 10px; font-weight: 800; }
.stage-flow strong { display: block; min-height: 20px; }
.stage-flow code { display: block; margin: 7px 0 5px; overflow-wrap: anywhere; color: #557085; font-size: 10px; }
.stage-flow p { margin: 0 0 6px; font-size: 12px; line-height: 1.45; }
.stage-flow small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.handler-list { display: grid; gap: 8px; }
.handler { padding: 11px; background: #f7f8fa; border-radius: 10px; }
.handler-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.handler-heading strong { font-size: 12px; line-height: 1.45; }
.action-chip { flex: 0 0 auto; padding: 3px 7px; color: #24527d; background: #e7f2fd; border-radius: 999px; font-size: 10px; font-weight: 750; }
.handler p { margin: 7px 0 5px; font-size: 12px; line-height: 1.5; }
.handler small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.rule-list { margin: 0; padding: 0; display: grid; gap: 7px; list-style: none; }
.rule-list li { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr); gap: 10px; padding: 9px 10px; background: #f7f8fa; border-radius: 9px; font-size: 11px; line-height: 1.5; }
.outcome-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.outcome-grid > div { padding: 10px; background: #f7f8fa; border-radius: 9px; }
.outcome-grid strong { font-size: 11px; }
.outcome-grid ul { margin: 7px 0 0; padding-left: 16px; color: #474b53; font-size: 11px; line-height: 1.5; }
.metadata { margin-top: 11px; color: var(--muted); font-size: 11px; }
.learning-settings { margin-top: 12px; padding: 11px 12px; display: flex; align-items: center; justify-content: space-between; gap: 14px; background: #f7f9fc; border: 1px solid #e3e7ed; border-radius: 11px; }
.learning-settings > div { min-width: 0; display: grid; gap: 3px; }
.learning-settings strong { font-size: 12px; }
.learning-settings small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.learning-mode { width: min(260px, 48%); padding: 8px 10px; font-size: 11px; font-weight: 650; }
.template-actions { margin-top: 14px; display: flex; justify-content: flex-end; gap: 9px; }
.improvement-dialog, .status-dialog { width: min(760px, calc(100% - 28px)); max-height: calc(100vh - 40px); padding: 26px; border: 0; border-radius: 20px; box-shadow: 0 24px 80px rgba(20, 30, 50, .28); }
.status-dialog { width: min(560px, calc(100% - 28px)); }
.improvement-dialog::backdrop, .status-dialog::backdrop { background: rgba(20, 24, 32, .5); }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.close-button { width: 38px; height: 38px; border: 0; border-radius: 10px; background: #eeeef2; font-size: 24px; cursor: pointer; }
.improvement-candidate { margin-top: 22px; display: grid; gap: 16px; }
.improvement-candidate[hidden] { display: none; }
.rationale-box { padding: 14px 16px; color: #24496e; background: #eef6ff; border-radius: 12px; }
.rationale-box p { margin: 6px 0 0; line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.status-dialog-actions { margin-top: 18px; }
@media (max-width: 900px) { .topbar { padding: 12px 16px; } main { grid-template-columns: 1fr; padding: 16px; } .editor-card { position: static; } .fields, .outcome-grid, .simple-outcomes { grid-template-columns: 1fr; } .learning-settings { align-items: stretch; flex-direction: column; } .learning-mode { width: 100%; } }
