/* Sol review workspace — quiet, form-first. ARE black band, blue actions, white writing surfaces. */
@font-face { font-family: "Montserrat"; font-weight: 400; font-display: swap; src: url("/static/fonts/Montserrat-Regular.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 500; font-display: swap; src: url("/static/fonts/Montserrat-Medium.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 600; font-display: swap; src: url("/static/fonts/Montserrat-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "Montserrat"; font-weight: 700; font-display: swap; src: url("/static/fonts/Montserrat-Bold.ttf") format("truetype"); }

:root {
  --black: #000000;
  --blue: #065CBA;
  --blue-hover: #054c9a;
  --blue-tint: #e9f1fb;
  --silver: #A7A9AC;
  --graphite: #807B80;
  --ink: #16161a;
  --ink-2: #4a474b;
  --line: #d9dadc;
  --paper: #ffffff;
  --desk: #eceef1;
  --warn: #7a4f00;
  --warn-bg: #fff5dc;
  --err: #b3261e;
  --err-bg: #fdeceb;
  --ok: #1d6b3a;
  --radius: 6px;
  --band-h: 116px;
  --pane-w: clamp(360px, 32vw, 480px);
  font-family: "Montserrat", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-2); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .78rem; word-break: break-all; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.band :focus-visible { outline-color: #8fb8ea; }

.skip { position: absolute; left: 8px; top: -40px; background: var(--paper); padding: 6px 10px; z-index: 10; border-radius: var(--radius); }
.skip:focus { top: 8px; }

/* -- brand band ------------------------------------------------------------ */
.band {
  background: var(--black); color: #fff; height: var(--band-h);
  display: flex; align-items: center; gap: 20px; padding: 0 24px 0 12px;
}
/* The complete logo file is shown unmodified; its own black margin merges into the band. */
.logo-frame { width: 186px; height: var(--band-h); overflow: hidden; flex: none; }
.logo-frame img { display: block; height: 176px; width: auto; aspect-ratio: 1667 / 1250; margin: -30px 0 0 -25px; }
.band-title { min-width: 0; border-left: 1px solid #3a3a3d; padding-left: 20px; }
.band-title h1 { font-size: 1.25rem; font-weight: 600; letter-spacing: .01em; }
.band-kicker { margin: 0 0 2px; font-size: .78rem; color: var(--silver); letter-spacing: .04em; text-transform: uppercase; }
.band-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.save-status { font-size: .85rem; color: #e6e6e6; max-width: 34ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.save-status::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: var(--graphite); vertical-align: 1px; }
.save-status[data-state="saved"]::before { background: #4caf73; }
.save-status[data-state="saving"]::before { background: #8fb8ea; }
.save-status[data-state="failed"], .save-status[data-state="blocked"], .save-status[data-state="conflict"] { color: #ffd4d0; }
.save-status[data-state="failed"]::before, .save-status[data-state="blocked"]::before, .save-status[data-state="conflict"]::before { background: #ff6b5e; }
.preview-tag { font-size: .72rem; color: var(--silver); border: 1px solid #4a4a4e; border-radius: 999px; padding: 2px 10px; letter-spacing: .03em; }

/* -- buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--silver); background: var(--paper); color: var(--ink);
  border-radius: var(--radius); padding: 8px 14px; font-weight: 500; cursor: pointer;
  text-decoration: none; line-height: 1.2; min-height: 36px;
}
.btn:hover { border-color: var(--graphite); background: #f6f7f8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-lg { padding: 12px 22px; font-size: 1rem; font-weight: 600; }
.btn-small { padding: 6px 10px; font-size: .85rem; min-height: 32px; }
.btn-icon { width: 32px; min-height: 32px; padding: 0; font-size: 1.1rem; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: #f1f2f4; border-color: transparent; }
.btn-outline-dark { background: transparent; color: #fff; border-color: #6d6d72; }
.btn-outline-dark:hover { background: #1b1b1d; border-color: var(--silver); }
.btn-quiet-dark { background: transparent; color: #fff; border-color: #6d6d72; }
.btn-quiet-dark:hover { background: #1b1b1d; }
.toggle[aria-pressed="true"] { background: var(--blue-tint); border-color: var(--blue); color: var(--blue); font-weight: 600; }

/* -- workspace layout -------------------------------------------------------- */
body.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--pane-w); grid-template-rows: minmax(0, 1fr); }

.doc-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--desk); border-right: 1px solid var(--line); }
.doc-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--paper); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.doc-tabs { display: flex; gap: 2px; background: #f1f2f4; border-radius: var(--radius); padding: 3px; flex-wrap: wrap; }
.doc-tab { border: 0; background: transparent; padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.doc-tab:hover { color: var(--ink); background: #e6e8eb; }
.doc-tab[aria-selected="true"] { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.doc-tab-warn { color: var(--err); font-weight: 500; }
.rev-badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--blue); color: var(--blue); background: var(--blue-tint); white-space: nowrap; margin-left: 8px; }
.rev-badge[data-kind="example"] { border-color: var(--graphite); color: var(--ink-2); background: #f3f3f4; }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom-level { min-width: 6.5em; text-align: center; font-size: .85rem; color: var(--ink-2); }
.zoom .btn[aria-pressed="true"] { border-color: var(--blue); color: var(--blue); }

.doc-meta { margin: 0; padding: 6px 16px; font-size: .8rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; border-bottom: 1px solid var(--line); background: #f7f8f9; min-height: 30px; }
.doc-meta .kind { font-weight: 600; color: var(--ink); }
.doc-meta .warn { color: var(--err); font-weight: 600; }
.source-details summary { cursor: pointer; color: var(--blue); }
.source-details dl { margin: 4px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.source-details dl > div { display: contents; }
.source-details dt { font-weight: 600; }
.source-details dd { margin: 0; word-break: break-all; }

.doc-scroll { position: relative; flex: 1; min-height: 0; overflow: auto; padding: 24px; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 6px 24px rgba(0,0,0,.08); flex: none; }
.page canvas { display: block; }
.anchor-layer { position: absolute; inset: 0; cursor: crosshair; }
.pin {
  position: absolute; transform: translate(-50%, -50%); width: 24px; height: 24px; border-radius: 50%;
  border: 2px solid #fff; background: var(--blue); color: #fff; font-size: .7rem; font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer; padding: 0; line-height: 20px;
}
.pin.active { outline: 3px solid rgba(6,92,186,.35); outline-offset: 2px; background: #033f80; }
.pin.draft { background: #fff; border-color: var(--blue); border-style: dashed; }
.doc-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--ink-2); padding: 24px; text-align: center; background: var(--desk); }
.doc-state[data-state="error"] p { color: var(--err); font-weight: 500; max-width: 40ch; }

/* -- writing pane ----------------------------------------------------------- */
.write-pane { display: flex; flex-direction: column; min-height: 0; padding: 20px 22px 12px; gap: 12px; background: var(--paper); overflow-x: hidden; overflow-y: auto; }
/* Fixed-size controls never shrink; on short screens the pane scrolls instead of collapsing them. */
.write-pane > * { flex-shrink: 0; }
#notes-panel { display:flex; flex-direction:column; gap:12px; }
#notes-panel > * { flex-shrink:0; }
.work-modes { display:flex; gap:6px; position:sticky; top:-20px; padding:8px 0; background:white; z-index:3; }
.work-modes [aria-pressed="true"] { background:var(--blue); color:white; border-color:var(--blue); }
#starter-panel { font-size:.86rem; }
#starter-panel h2 {font-size:1.15rem;}
.starter-intro {color:var(--ink-2);margin:8px 0;}
.starter-notice {background:var(--warn-bg);color:var(--warn);padding:10px;border-left:3px solid var(--warn);}
.starter-progress,.starter-place,.starter-save {font-size:.76rem;color:var(--ink-2);}
.starter-card {border-top:1px solid var(--line);padding:12px 0;}
.starter-card > summary {cursor:pointer;font-weight:600;display:flex;flex-direction:column;gap:4px;}
.starter-card > summary small {font-weight:400;color:var(--ink-2);font-size:.73rem;}
.starter-card[open] > summary {color:var(--blue);}
#starter-panel textarea {width:100%;min-height:128px;resize:vertical;padding:10px;border:1px solid var(--silver);border-radius:4px;font-size:.86rem;line-height:1.5;background:white;}
#starter-panel input,#starter-panel select {max-width:100%;padding:8px;border:1px solid var(--silver);background:white;border-radius:4px;}
.starter-actions {display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;}
.starter-actions .btn {font-size:.76rem;}
.starter-connection {margin:12px 0;color:var(--ink-2);}
.starter-connection summary {cursor:pointer;color:var(--blue);font-weight:500;}
.starter-finding {background:#f2f6fb;padding:12px;border-left:3px solid var(--blue);margin-top:12px;}
.starter-finding h3 {font-size:.9rem;}
.starter-finding label {display:flex;flex-direction:column;gap:6px;margin:12px 0;}
.starter-evidence {font-size:.77rem;}
.starter-finding textarea {min-height:90px!important;}
.starter-message,.starter-recovery {padding:10px;background:var(--warn-bg);border:1px solid #d6b870;}
.starter-recovery pre {white-space:pre-wrap;overflow-wrap:anywhere;}
.starter-add {padding:16px 0;border-top:1px solid var(--line);}
.starter-add input,.starter-add textarea,.starter-add select {display:block;margin:10px 0;width:100%;}
.invite h2 { font-size: 1.2rem; font-weight: 700; }
.invite p { margin: 4px 0 0; color: var(--ink-2); }
.scope-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--silver); border-radius: var(--radius); overflow: hidden; }
.scope-tabs [role=tab] { border: 0; border-right: 1px solid var(--silver); background: var(--paper); padding: 8px 6px; cursor: pointer; font-size: .85rem; font-weight: 500; color: var(--ink-2); }
.scope-tabs [role=tab]:last-child { border-right: 0; }
.scope-tabs [role=tab][aria-selected="true"] { background: var(--blue); color: #fff; font-weight: 600; }
.scope-tabs [role=tab]:focus-visible { outline-offset: -3px; }
.target-row { min-height: 40px; display: flex; align-items: center; }
.target-location { display: flex; align-items: center; gap: 10px; width: 100%; }
.target-location label { font-weight: 600; font-size: .9rem; }
.target-location select { flex: 1; min-width: 0; padding: 7px 8px; border: 1px solid var(--silver); border-radius: var(--radius); background: var(--paper); }
.target-desc { font-size: .8rem; color: var(--ink-2); white-space: nowrap; }
.target-general { margin: 0; font-size: .875rem; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #f6f7f8; border-radius: 999px; padding: 4px 11px; font-size: .8rem; cursor: pointer; color: var(--ink); }
.chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-tint); }
.editor-wrap { position: relative; flex: 1 0 auto; min-height: 200px; display: flex; flex-direction: column; }
#editor {
  flex: 1; width: 100%; resize: none; border: 1px solid var(--silver); border-radius: var(--radius);
  padding: 14px 16px; font-size: 1rem; line-height: 1.6; background: var(--paper); min-height: 200px;
}
#editor:focus { border-color: var(--blue); outline: 3px solid rgba(6,92,186,.25); outline-offset: 0; }
#editor[readonly] { background: #f6f7f8; color: var(--ink-2); }
.conflict { position: absolute; left: 8px; right: 8px; bottom: 8px; background: var(--warn-bg); border: 1px solid #e0c27a; border-radius: var(--radius); padding: 10px 12px; font-size: .85rem; box-shadow: 0 4px 14px rgba(0,0,0,.12); max-height: 70%; overflow: auto; }
.conflict p { margin: 0 0 6px; }
.conflict pre { white-space: pre-wrap; font-family: inherit; background: #fff; padding: 6px 8px; border-radius: 4px; margin: 6px 0; }
.conflict-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.save-warning { margin: 0; padding: 8px 10px; font-size: .85rem; line-height: 1.45; color: var(--err); background: var(--warn-bg); border: 1px solid #e0c27a; border-radius: var(--radius); white-space: normal; overflow-wrap: anywhere; }
.editor-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.notes-here { flex: 0 0 34%; min-height: 96px; display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 10px; }
.notes-here h3 { font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.note-list { list-style: none; margin: 0; padding: 0 2px 0 0; overflow: auto; flex: 1; }
.note-list li.empty { color: var(--ink-2); font-size: .85rem; padding: 4px 0; }
.note-item { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: var(--radius); padding: 7px 9px; cursor: pointer; margin-bottom: 2px; }
.note-item:hover { background: #f4f5f7; }
.note-item.current { border-color: var(--blue); background: var(--blue-tint); }
.note-item-head { display: flex; align-items: center; gap: 8px; font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.note-item-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-text { display: block; font-size: .875rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pin-no { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; background: var(--blue); color: #fff; font-size: .65rem; flex: none; }
.flag { font-size: .72rem; font-weight: 600; color: var(--warn); background: var(--warn-bg); border-radius: 4px; padding: 1px 6px; }
.note-state { font-size: .72rem; font-weight: 500; }
.s-failed, .s-blocked, .s-conflict { color: var(--err); }
.s-saving, .s-dirty { color: var(--ink-2); }
.progress { margin: 0; font-size: .8rem; color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 8px; }

/* -- review ------------------------------------------------------------------ */
.review { flex: 1; overflow: auto; padding: 28px clamp(16px, 6vw, 96px) 64px; background: var(--paper); outline: none; }
.review > * { max-width: 920px; }
.rv-head { display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.rv-head h1 { font-size: 1.5rem; }
.rv-head p { margin: 6px 0 0; }
.preview-note { font-size: .8rem; color: var(--ink-2); }
.rv-actions { display: flex; gap: 8px; }
.rv-ready { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 14px 16px; border: 1px solid var(--line); border-left: 4px solid var(--silver); border-radius: var(--radius); background: #f8f9fa; margin-bottom: 8px; }
.rv-ready[data-state="ready"] { border-left-color: var(--ok); }
.rv-ready[data-state="stale"] { border-left-color: #d29a1d; }
.rv-ready p { margin: 0; }
.review section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.review section h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.review section h3 { font-size: .9rem; margin: 14px 0 4px; color: var(--ink-2); }
.review section > .btn { margin-top: 10px; }
.rv-notes { list-style: none; margin: 0; padding: 0; }
.rv-note { padding: 10px 0; border-top: 1px solid #eeeff1; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.rv-meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .78rem; color: var(--ink-2); }
.rv-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-note .btn { align-self: start; }

/* -- recovery + toast --------------------------------------------------------- */
.recovery { position: fixed; right: 20px; bottom: 20px; width: min(640px, calc(100vw - 40px)); max-height: 70vh; overflow: auto; background: var(--paper); border: 1px solid var(--silver); border-top: 4px solid var(--blue); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.25); padding: 16px 18px; z-index: 20; }
.recovery h2 { font-size: 1.05rem; }
.recovery > p { margin: 4px 0 10px; color: var(--ink-2); font-size: .9rem; }
.recovery ol { list-style: none; padding: 0; margin: 0 0 12px; }
.recovery-item { border-top: 1px solid var(--line); padding: 10px 0; }
.rec-head { margin: 0 0 6px; font-weight: 600; font-size: .9rem; }
.rec-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.rec-cols h3 { font-size: .78rem; color: var(--ink-2); margin-bottom: 4px; }
.rec-cols pre { white-space: pre-wrap; font-family: inherit; font-size: .85rem; background: #f6f7f8; border-radius: 4px; padding: 8px; margin: 0; max-height: 160px; overflow: auto; }
.rec-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.rec-actions p { margin: 0; font-size: .85rem; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #16161a; color: #fff; border-radius: var(--radius); padding: 10px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.3); z-index: 30; font-size: .9rem; }

/* -- landing ---------------------------------------------------------------------- */
.landing-main { max-width: 640px; padding: 48px 32px; }
.landing-main h2 { font-size: 1.6rem; margin-bottom: 12px; }
.landing-main p { color: var(--ink-2); }
.landing-main form { margin: 28px 0; }
.fineprint { font-size: .8rem; max-width: 56ch; }

/* -- responsive ------------------------------------------------------------------- */
@media (max-width: 980px) {
  body.app { height: auto; overflow: auto; }
  .band { height: auto; min-height: var(--band-h); flex-wrap: wrap; padding-bottom: 8px; }
  .band-right { margin-left: 0; width: 100%; justify-content: flex-start; padding-left: 12px; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: none; }
  .doc-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .doc-scroll { height: 70vh; flex: none; padding: 12px; }
  .write-pane { overflow: visible; }
  .editor-wrap { min-height: 260px; }
  .notes-here { flex: none; max-height: 320px; }
}
@media (max-width: 560px) {
  .band-title { border-left: 0; padding-left: 0; }
  .scope-tabs [role=tab] { font-size: .78rem; }
  .target-desc { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .band, .doc-pane, .write-pane .chips, .toast, .recovery { display: none !important; }
}
