/* app.css — calm, clinical, legible. */
* { box-sizing: border-box; }
:root {
  --ink: #22303c; --muted: #6b7a88; --line: #dde3e9; --bg: #f6f7f9;
  --card: #ffffff; --accent: #2b5876; --accent-soft: #e8eff5;
  --warn-bg: #fff7e6; --warn-line: #e8c98a; --danger: #a33;
}
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#print-view { display: none; }

.bar { display: flex; align-items: center; justify-content: space-between;
  background: var(--accent); color: #fff; padding: 10px 20px; }
.bar .brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 17px; }
.bar nav a { color: #dce8f2; margin-left: 18px; text-decoration: none; }
.bar nav a:hover { color: #fff; }

.page { max-width: 1080px; margin: 0 auto; padding: 18px 20px 80px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.page-head h1 { font-size: 22px; margin: 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin: 14px 0; }
.card h2 { font-size: 15px; margin: 2px 0 8px; color: var(--accent); }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); }

.row { display: flex; align-items: center; gap: 14px; padding: 10px 6px;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--accent-soft); }
.row-name { font-weight: 600; flex: 1; }

.muted { color: var(--muted); } .small { font-size: 12.5px; }
.pill { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 9px; border-radius: 99px; background: #eee; }
.pill.draft { background: #fdeec0; color: #7a5a00; }
.pill.signed { background: #dff1e0; color: #1c6b2d; }

button { font: inherit; border: 0; border-radius: 8px; padding: 8px 14px;
  background: var(--accent); color: #fff; cursor: pointer; }
button:hover { filter: brightness(1.1); }
button.secondary { background: var(--accent-soft); color: var(--accent); }
button.danger { color: #fff; background: var(--danger); }
button.danger.secondary { background: #fbecec; color: var(--danger); }
button.small { padding: 2px 8px; font-size: 12px; }
.btn-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

input, textarea { font: inherit; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; width: 100%; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { width: auto; flex: 1; min-width: 160px; }

.note-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 6px 0; }
.note-meta label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.note-meta input { width: 130px; }

.editor-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.editor-grid:has(#baseline:not([hidden])) { grid-template-columns: 3fr 2fr; }
#baseline { position: sticky; top: 10px; align-self: start; max-height: 85vh; overflow: auto; }
.prior { white-space: pre-wrap; font-size: 12.5px; background: var(--bg);
  border-radius: 8px; padding: 10px; }

/* Document view — the drafted note as readable prose (default). */
.doc-section { background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 16px 12px; margin: 0 0 10px; }
.doc-section.empty { background: transparent; border-style: dashed; padding: 6px 16px; }
.doc-head { display: flex; align-items: center; gap: 10px; }
.doc-head h3 { font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); margin: 4px 0; flex: 1; }
.doc-line { margin: 3px 0; font-size: 14.5px; }
.doc-label { font-weight: 600; }

fieldset.section { border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); margin: 0 0 14px; padding: 10px 14px 14px; }
fieldset.section.editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
fieldset.section legend { font-weight: 700; color: var(--accent); padding: 0 6px; }
fieldset.section:disabled { opacity: .85; }
fieldset.section:disabled .opt { cursor: default; }

.field { margin: 10px 0; }
.field > label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; }
.opt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 12px; font-size: 13px; cursor: pointer; background: #fff; }
.opt input { width: auto; margin: 0; accent-color: var(--accent); }
.opt.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
.detail { margin-top: 6px; font-size: 13px; }

.steps li { margin: 8px 0; }
ol.steps { padding-left: 22px; }

/* On-screen rendering of the printed note (guide page example). */
.paper-preview { background: #fff; border: 1px solid var(--line); border-radius: 6px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08); padding: 26px 32px; margin: 10px 0;
  font: 13px/1.5 Georgia, "Times New Roman", serif; color: #000;
  max-height: 540px; overflow: auto; }
.paper-preview h2 { text-align: center; font-size: 15px; text-transform: uppercase;
  letter-spacing: .06em; margin: 8px 0; color: #000; }
.paper-preview h3 { font-size: 12.5px; margin: 12px 0 3px; border-bottom: 1px solid #000;
  text-transform: uppercase; letter-spacing: .04em; }
.paper-preview .p-head > div:first-child { font-size: 11px; text-align: center; }
.paper-preview .p-line { margin: 2px 0; }
.paper-preview .p-label { font-weight: bold; }
.paper-preview .p-sign { margin-top: 20px; padding-top: 6px; border-top: 1px solid #000;
  display: flex; justify-content: space-between; gap: 12px; font-size: 11px; }

details { margin-top: 10px; }
details summary { cursor: pointer; }
details textarea { margin-top: 8px; }
#unfiled-panel ul { margin: 4px 0; padding-left: 20px; }
#unfiled-panel li { margin: 4px 0; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border-radius: 8px; padding: 10px 18px;
  font-size: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.25); z-index: 50; }

@media (max-width: 760px) {
  .editor-grid:has(#baseline:not([hidden])) { grid-template-columns: 1fr; }
}
