/* Lab Sheet Builder — CIS.SFP identity */
@font-face { font-family: 'Raleway'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/raleway-normal-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Raleway'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(/fonts/raleway-normal-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Raleway'; font-style: italic; font-weight: 400 700; font-display: swap; src: url(/fonts/raleway-italic-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f2f4f7; --paper: #fff; --ink: #1a2c4a; --muted: #5b6573; --line: #dde3ea; --soft: #eaf0f6;
  --brand: #0063a3; --navy: #1a2c4a; --sky: #4495ce;
  --ok: #1e8e3e; --bad: #c5221f; --warn: #b26a00;
  --r: 12px; --shadow: 0 1px 2px rgba(26,44,74,.05), 0 4px 18px rgba(26,44,74,.07);
  --font: "Raleway", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --top: 70px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-variant-numeric: lining-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; height: var(--top); padding: 0 1.1rem; background: #fff; border-bottom: 3px solid var(--brand); box-shadow: 0 2px 14px rgba(26,44,74,.08); }
.brand { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.brand img { height: 42px; width: auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; border-left: 1px solid var(--line); padding-left: .8rem; }
.brand-text strong { font-size: 1.05rem; color: var(--navy); }
.brand-text small { color: var(--muted); font-size: .78rem; }
.actions { margin-left: auto; display: flex; gap: .4rem; flex-wrap: wrap; justify-content: flex-end; }
.btn { border: 1px solid var(--line); background: #fff; padding: .45rem .8rem; border-radius: 8px; font-weight: 600; font-size: .88rem; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--soft); border-color: #c8d3df; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #00548b; }
.btn.small { padding: .25rem .55rem; font-size: .8rem; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .6; cursor: progress; }

.tabs { display: none; }

/* workspace */
.workspace { display: grid; grid-template-columns: minmax(420px, 1fr) minmax(480px, 1.05fr); height: calc(100vh - var(--top)); }
.pane { overflow: auto; min-width: 0; }
.editor-pane { border-right: 1px solid var(--line); background: var(--bg); display: flex; flex-direction: column; }
.editor { padding: 1rem 1.1rem 4rem; }
.preview-pane { background: #e4e8ee; }
.preview-note { position: sticky; top: 0; z-index: 2; text-align: center; font-size: .78rem; color: var(--muted); padding: .35rem; background: rgba(228,232,238,.92); backdrop-filter: blur(4px); }

/* formatting bar */
.fmtbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; flex-wrap: wrap; gap: .25rem; padding: .45rem 1.1rem; background: #fff; border-bottom: 1px solid var(--line); }
.fmtbar button { min-width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 6px; font-size: .9rem; padding: 0 .35rem; }
.fmtbar button:hover { background: var(--soft); }
.fmtbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 .25rem; }
.fmtbar .syms { display: contents; }
.fmtbar .syms button { font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif; font-size: 1rem; }
.fmtbar .status { margin-left: auto; font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* editor cards */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); margin-bottom: .8rem; }
.card > summary, .card > .card-h { list-style: none; display: flex; align-items: center; gap: .5rem; padding: .7rem .9rem; cursor: pointer; font-weight: 700; color: var(--navy); }
.card > summary::-webkit-details-marker { display: none; }
.card > summary::before { content: "▸"; color: var(--brand); transition: transform .15s; display: inline-block; }
.card[open] > summary::before { transform: rotate(90deg); }
.card > summary .sum-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card > summary .sum-type { font-weight: 500; font-size: .75rem; color: var(--muted); background: var(--soft); border-radius: 99px; padding: .1rem .5rem; white-space: nowrap; }
.card-b { padding: .2rem .9rem .9rem; border-top: 1px solid var(--soft); }
.tools { display: inline-flex; gap: .2rem; }
.tools button { border: 1px solid transparent; background: transparent; border-radius: 6px; width: 28px; height: 28px; color: var(--muted); font-size: .85rem; }
.tools button:hover { background: var(--soft); border-color: var(--line); color: var(--ink); }
.tools button.del:hover { color: var(--bad); }

.intro-card { padding: .9rem 1rem; background: linear-gradient(135deg, #0063a3, #1a2c4a); color: #fff; border: 0; }
.intro-card h2 { margin: 0 0 .3rem; font-size: 1.05rem; }
.intro-card p { margin: .2rem 0; font-size: .86rem; opacity: .95; }
.intro-card code { background: rgba(255,255,255,.18); padding: 0 .3rem; border-radius: 4px; font-size: .85em; }
.intro-card .close { float: right; background: transparent; border: 0; color: #fff; font-size: 1.1rem; opacity: .8; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .2rem .7rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .2rem .7rem; }
.f { display: block; margin: .55rem 0 0; }
.f > span { display: block; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; margin-bottom: .2rem; }
.f > small { display: block; font-size: .75rem; color: var(--muted); margin-top: .15rem; }
.f input[type=text], .f input[type=number], .f textarea, .f select { width: 100%; border: 1px solid #ccd5df; border-radius: 8px; padding: .45rem .6rem; background: #fff; font-size: .9rem; line-height: 1.45; }
.f textarea { resize: vertical; min-height: 2.6rem; }
.f input:focus, .f textarea:focus, .f select:focus { outline: 2px solid rgba(0,99,163,.25); border-color: var(--brand); }
.f.check { display: flex; align-items: center; gap: .45rem; margin-top: .7rem; }
.f.check > span { margin: 0; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--ink); font-weight: 600; }

.rep { border: 1px dashed #c8d3df; border-radius: 10px; padding: .1rem .7rem .6rem; margin-top: .6rem; background: #fbfcfe; position: relative; }
.rep-h { display: flex; align-items: center; justify-content: space-between; margin-top: .4rem; font-size: .78rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .03em; }
.row-inline { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: .5rem; align-items: end; }
.row-inline .tools { margin-bottom: .2rem; }
.adder { display: flex; gap: .4rem; align-items: center; margin-top: .7rem; flex-wrap: wrap; }
.adder select { border: 1px dashed var(--brand); color: var(--brand); background: #fff; border-radius: 8px; padding: .35rem .5rem; font-weight: 600; font-size: .85rem; }
.blocks-h { margin: 1rem 0 0; font-size: .75rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--navy); border-top: 1px solid var(--soft); padding-top: .6rem; }
.block { border-left: 3px solid var(--sky); background: #fbfcfe; border-radius: 0 10px 10px 0; padding: .2rem .7rem .6rem; margin-top: .6rem; }
.block[data-type=callout] { border-left-color: var(--warn); }
.block[data-type=table] { border-left-color: var(--navy); }
.block-h { display: flex; align-items: center; justify-content: space-between; margin-top: .35rem; font-size: .78rem; font-weight: 700; color: var(--navy); }
.img-thumb { max-height: 90px; border-radius: 6px; border: 1px solid var(--line); margin-top: .4rem; display: block; }

/* modal */
.modal { border: 0; border-radius: 16px; padding: 0; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(26,44,74,.3); color: var(--ink); }
.modal::backdrop { background: rgba(26,44,74,.45); }
.modal .m-h { padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal .m-h h2 { margin: 0; font-size: 1.15rem; color: var(--navy); }
.modal .m-b { padding: 1rem 1.2rem 1.2rem; max-height: 70vh; overflow: auto; }
.modal .m-x { border: 0; background: transparent; font-size: 1.3rem; color: var(--muted); }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .7rem; }
.choice { text-align: left; border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: .9rem; transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.choice b { display: block; color: var(--navy); margin: .3rem 0 .2rem; }
.choice small { color: var(--muted); font-size: .8rem; }
.choice .ico { font-size: 1.5rem; }
.lib { list-style: none; margin: 1rem 0 0; padding: 0; }
.lib li { display: flex; align-items: center; gap: .6rem; padding: .6rem .2rem; border-top: 1px solid var(--soft); }
.lib li.current { background: var(--soft); border-radius: 8px; padding-left: .6rem; }
.lib .t { flex: 1; min-width: 0; }
.lib .t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--navy); }
.lib .t small { color: var(--muted); }
.privacy { font-size: .8rem; color: var(--muted); margin-top: 1rem; background: var(--soft); border-radius: 8px; padding: .6rem .8rem; }

.toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: .6rem 1rem; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); z-index: 50; font-size: .9rem; max-width: 90vw; }
.toast.err { background: var(--bad); }

/* ---------- preview (mimics the Word layout) ---------- */
.preview { padding: .6rem 1.2rem 3rem; }
.sheet { --pb: #0063a3; --pn: #1a2c4a; --pt: #1f2937; --pm: #5b6b7f; --pl: #e8f1f8; --ps: #f6f9fc; --pline: #b7ccE0;
  width: 794px; max-width: 100%; margin: 0 auto; background: #fff; box-shadow: 0 4px 24px rgba(26,44,74,.15); padding: 38px 76px 50px; font-family: Arial, "Liberation Sans", Helvetica, sans-serif; font-size: 13.3px; line-height: 1.38; color: var(--pt); }
.sheet * { font-family: inherit; }
.sheet p { margin: 0 0 5px; }
.s-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--pline); padding-bottom: 6px; margin-bottom: 14px; }
.s-head img { width: 159px; height: auto; }
.s-head .hl { text-align: right; font-size: 11.3px; color: var(--pm); line-height: 1.35; }
.s-head .hl b { color: var(--pn); }
.s-kicker { color: var(--pb); font-weight: 700; font-size: 13.3px; margin: 0; }
.s-title { font-size: 29px; font-weight: 700; color: var(--pn); margin: 0 0 4px; line-height: 1.2; }
.s-info { display: flex; gap: 2px; margin-bottom: 10px; }
.s-info div { background: var(--pl); padding: 4px 8px 6px; flex: 1 1 0; min-width: 0; }
.s-info small { display: block; font-size: 10px; font-weight: 700; color: var(--pb); text-transform: uppercase; }
.s-info span { font-size: 12.6px; color: var(--pn); white-space: pre-line; }
.s-rq { background: var(--pn); color: #fff; padding: 10px 15px; margin-bottom: 6px; }
.s-rq small { display: block; color: #9cc3e6; font-weight: 700; font-size: 10.6px; margin-bottom: 3px; }
.s-rq b { font-size: 16.6px; line-height: 1.3; display: block; }
.s-h1 { font-size: 18.6px; font-weight: 700; color: var(--pb); border-bottom: 1.5px solid var(--pb); padding-bottom: 2px; margin: 18px 0 8px; }
.s-h2 { font-size: 15.3px; font-weight: 700; color: var(--pn); margin: 13px 0 4px; }
.s-h2 .n { color: var(--pb); margin-right: 6px; }
.s-ul, .s-ol { margin: 0 0 6px; padding-left: 26px; }
.s-ul li, .s-ol li { margin-bottom: 3px; }
.s-ol { list-style: none; counter-reset: n var(--start, 0); }
.s-ol li { counter-increment: n; position: relative; }
.s-ol li::before { content: counter(n) "."; position: absolute; left: -26px; font-weight: 700; color: var(--pb); }
.s-cols { display: flex; gap: 2px; margin-bottom: 8px; }
.s-cols > div { flex: 1; background: var(--ps); padding: 6px 9px; }
.s-cols b { display: block; color: var(--pn); margin-bottom: 3px; }
.s-cols p { position: relative; padding-left: 15px; margin: 0 0 2px; font-size: 12.6px; }
.s-cols p::before { content: "▪"; position: absolute; left: 0; color: var(--pb); }
.s-grid { display: grid; gap: 2px; margin-bottom: 8px; }
.s-grid span { background: var(--pl); padding: 3px 7px; font-size: 12.6px; color: var(--pn); }
.s-tbl { width: 100%; border-collapse: collapse; margin-bottom: 8px; table-layout: fixed; }
.s-tbl td, .s-tbl th { border: 1px solid var(--pline); padding: 4px 7px; vertical-align: middle; font-size: 12.6px; text-align: left; }
.s-tbl th { background: var(--pb); color: #fff; font-weight: 700; font-size: 12px; }
.s-tbl th.c, .s-tbl td.c { text-align: center; }
.s-tbl .lab { background: var(--pl); color: var(--pn); font-weight: 700; }
.s-tbl .sh { background: var(--ps); }
.s-tbl.plain td { border: 0; padding: 2px 5px; }
.s-mat { color: var(--pb); margin-right: 5px; }
.s-callout { border-left: 4px solid var(--pb); background: var(--pl); padding: 7px 12px; margin: 4px 0 8px; font-size: 13.3px; }
.s-callout b.t { display: block; color: var(--pb); margin-bottom: 2px; }
.s-callout.warning { border-color: #b26b00; background: #fff4e0; } .s-callout.warning b.t { color: #b26b00; }
.s-callout.safety { border-color: #b42318; background: #fdecec; } .s-callout.safety b.t { color: #b42318; }
.s-callout p { margin: 0 0 2px; }
.s-eq { width: 416px; max-width: 100%; margin: 6px auto 10px; background: var(--pl); border: 1px solid var(--pline); text-align: center; padding: 7px; }
.s-eq b { display: block; font-size: 18.6px; color: var(--pn); }
.s-eq small { color: var(--pm); font-size: 12px; }
.s-strip { display: flex; gap: 2px; margin-bottom: 8px; }
.s-strip span { flex: 1; background: var(--pb); color: #fff; font-weight: 700; text-align: center; padding: 4px; font-size: 13.3px; }
.s-lines div { border-bottom: 1px dotted #9aaabb; height: 32px; }
.s-lines { margin-bottom: 8px; }
.s-img { text-align: center; margin: 4px 0 8px; }
.s-img img { max-width: 100%; }
.s-img small { display: block; color: var(--pm); font-style: italic; font-size: 12px; }
.s-break { border-top: 2px dashed #b7c3d0; margin: 22px -76px 16px; position: relative; height: 0; }
.s-break::after { content: "page break"; position: absolute; left: 50%; top: -9px; transform: translateX(-50%); background: #fff; padding: 0 8px; font-size: 10.5px; color: #8796a8; text-transform: uppercase; letter-spacing: .08em; }
.s-foot { border-top: 1px solid var(--soft); margin-top: 24px; padding-top: 6px; text-align: center; font-size: 10.6px; color: var(--pm); }
.s-check td.cb { text-align: center; color: var(--pb); font-size: 15px; }
.sheet .muted-i { color: var(--pm); font-style: italic; }
.s-empty { color: #a0aab6; font-style: italic; }

@media (max-width: 1000px) {
  :root { --top: auto; }
  .topbar { flex-wrap: wrap; height: auto; padding: .6rem .8rem; }
  .actions { margin-left: 0; justify-content: flex-start; }
  .tabs { display: flex; position: sticky; top: 0; z-index: 25; background: #fff; border-bottom: 1px solid var(--line); }
  .tab { flex: 1; border: 0; background: #fff; padding: .6rem; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; }
  .tab.active { color: var(--brand); border-bottom-color: var(--brand); }
  .workspace { display: block; height: auto; }
  .pane { overflow: visible; }
  .workspace[data-view=edit] .preview-pane, .workspace[data-view=preview] .editor-pane { display: none; }
  .fmtbar { top: 44px; }
  .sheet { padding: 24px 22px 30px; zoom: .9; }
  .grid2, .grid3, .row-inline { grid-template-columns: 1fr; }
}
@media print { .topbar, .tabs, .editor-pane, .preview-note { display: none !important; } .workspace { display: block; height: auto; } .sheet { box-shadow: none; } }
