:root {
  /* warm paper, espresso ink, terracotta accent - OK green and NG red stay distinct from the accent */
  --bg: #f5efe6;
  --panel: #fffcf7;
  --surface-2: #f8f2ea;
  --ink: #2a1f18;
  --ink-2: #5e5045;
  --ink-3: #98877a;
  --line: #e6d9c9;
  --line-2: #efe6da;
  --line-strong: #d6c4ae;
  --accent: #c2410c;
  --accent-strong: #9a3412;
  --accent-soft: #fdeadc;
  --accent-line: #f0bf9c;
  --accent-2: #d97706;
  --dark: #2b1b12;
  --dark-2: #4a2a18;
  --ok: #15803d;
  --ok-soft: #dcf3e1;
  --ng: #b91c1c;
  --ng-soft: #fde2df;
  --warn: #92400e;
  --warn-soft: #fff1d6;
  --grid: rgba(194, 65, 12, 0.05);
  --hover: #f6ece0;
  --mono: Consolas, "Cascadia Mono", Menlo, monospace;
  --sans: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); font-size: 14px; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.boot { padding: 60px; text-align: center; color: var(--ink-2); line-height: 1.8; }

/* ---------- chrome ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 52px;
  padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; user-select: none; white-space: nowrap; }
.brand .logo-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 14px; }
.topbar .spacer { flex: 1; }
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 60px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.danger { color: var(--ng); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 26px; padding: 0 8px; font-size: 12px; }
.btn.icon { width: 28px; padding: 0; height: 26px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }

.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label { font-size: 11px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.input, .textarea, .select { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--panel); }
.input:focus, .textarea:focus, .select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.textarea { resize: vertical; min-height: 60px; line-height: 1.45; }
.code-area { font-family: var(--mono); font-size: 13px; background: var(--surface-2); tab-size: 4; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.ng { background: var(--ng-soft); color: var(--ng); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--accent-soft); color: var(--accent); }
.badge.gray { background: var(--hover); color: var(--ink-2); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.card.pad { padding: 16px; }
.section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin: 26px 0 10px; }

/* ---------- home ---------- */
.hero { padding: 22px; display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.hero h1 { font-size: 22px; margin: 0 0 6px; }
.hero p { margin: 0 0 14px; color: var(--ink-2); line-height: 1.5; }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.import-tile { padding: 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start; transition: border-color .15s; }
.import-tile:hover { border-color: var(--accent); }
.import-tile .ico { font-size: 22px; line-height: 1; }
.import-tile h3 { margin: 0 0 3px; font-size: 14px; }
.import-tile p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.4; }
.wb-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.wb-card { padding: 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.wb-card:hover { border-color: var(--accent); }
.wb-card h4 { margin: 0; font-size: 14px; }
.wb-card .actions { display: flex; gap: 4px; justify-content: flex-end; }

.modal-back { position: fixed; inset: 0; background: rgba(60, 36, 20, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border-radius: 12px; width: min(900px, 100%); max-height: 92vh; display: flex; flex-direction: column; }
.modal header { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; }
.modal header h2 { margin: 0; font-size: 16px; flex: 1; }
.modal .body { padding: 16px 18px; overflow: auto; }
.modal footer { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
pre.guide { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 10px; white-space: pre-wrap; max-height: 390px; overflow: auto; margin: 0; }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 8px 14px; border-radius: 8px; z-index: 200; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.error { background: var(--ng); }

/* ---------- editor layout ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: calc(100vh - 52px); }
.editor.no-side { grid-template-columns: minmax(0, 1fr); }
.sheet-scroll { overflow: auto; padding: 12px 16px 40px; }
.sidebar { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: 0; background: none; padding: 10px 4px; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--ink-2); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.side-body { overflow: auto; padding: 12px; flex: 1; }

.save-state { font-size: 12px; color: var(--ink-3); min-width: 90px; text-align: right; }
.save-state.error { color: var(--ng); }
.title-input { border: 1px solid transparent; border-radius: 6px; padding: 4px 8px; font-weight: 700; font-size: 15px;
  min-width: 120px; max-width: 420px; width: 100%; background: transparent; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { border-color: var(--accent); outline: none; background: var(--panel); }

/* ---------- the sheet ---------- */
.sheet { max-width: 8.5in; margin: 0 auto; background: #fff; border: 1px solid var(--line); box-shadow: 0 2px 12px rgba(60, 36, 20,.08);
  padding: 0.45in 0.55in 0.6in; min-height: 11in;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px), linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 18px 18px; }
.titleblock { border: 1.5px solid var(--ink); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  padding: 8px 10px; margin-bottom: 18px; background: var(--panel); }
.titleblock .tb-left { display: flex; gap: 10px; align-items: center; min-width: 0; }
.titleblock img { max-height: 42px; max-width: 110px; object-fit: contain; }
.titleblock .tb-title { font-weight: 700; font-size: 15px; }
.titleblock .tb-right { display: grid; grid-template-columns: repeat(2, auto); gap: 2px 12px; font-size: 11px; align-content: center; }
.tb-field { display: flex; gap: 6px; align-items: baseline; }
.tb-field span { color: var(--ink-3); min-width: 62px; }
.tb-field input { border: 0; border-bottom: 1px solid var(--line-strong); width: 96px; font-size: 11px; font-weight: 600; padding: 1px 2px; background: transparent; }
.tb-field input:focus { outline: none; border-bottom-color: var(--accent); }
.tb-line input { border: 0; border-bottom: 1px dashed transparent; font-size: 11px; color: var(--ink-2); width: 100%; background: transparent; padding: 1px 0; }
.tb-line input:hover { border-bottom-color: var(--line); }
.tb-line input:focus { outline: none; border-bottom-color: var(--accent); }

.blk { position: relative; border: 1px solid transparent; border-radius: 6px; padding: 5px 8px; margin: 1px -9px; cursor: text; }
.blk:hover { border-color: var(--line-2); background: rgba(255,255,255,.7); }
.blk.selected { border-color: var(--accent-line); background: rgba(253, 234, 220, .35); }
.blk.editing { border-color: var(--accent); background: var(--panel); box-shadow: 0 2px 10px rgba(194, 65, 12,.10); cursor: default; }
.blk.has-error { border-left: 3px solid var(--ng); }
.blk.review { border-left: 3px solid #e0a100; }
.blk .view { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 32%); gap: 12px; align-items: start; }
.blk .view.full { grid-template-columns: minmax(0, 1fr); }
.blk .math { font-size: 15.5px; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.blk .side { text-align: right; font-size: 12px; color: var(--ink-2); font-style: italic; padding-top: 4px; }
.blk .side .ref { font-style: normal; font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
/* the OK / NG wash covers the whole line, however tall the maths is */
.blk.check-ok .math .katex, .blk.check-ng .math .katex { display: inline-block; padding: 3px 8px; border-radius: 3px; }
.blk.check-ok .math .katex { background: var(--ok-soft); }
.blk.check-ng .math .katex { background: var(--ng-soft); }
.blk .msg { font-size: 12px; margin-top: 3px; }
.blk .msg.err { color: var(--ng); font-weight: 600; }
.blk .msg.warn { color: var(--warn); }
.blk .msg.note { color: var(--ink-3); }
/* the line's own toolbar sits above it, clear of what you are typing, and only on the line you picked */
.blk .tools { position: absolute; bottom: calc(100% + 3px); right: 6px; display: none; gap: 2px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 1px; box-shadow: 0 2px 8px rgba(60, 36, 20,.12); z-index: 16; }
.blk.selected .tools, .blk.editing .tools { display: flex; }
/* a region is moved by dragging it anywhere and opened with a double-click, as in Mathcad */
.sheet .blk:not(.editing) { cursor: grab; user-select: none; }
.sheet.dragging, .sheet.dragging * { cursor: grabbing !important; }
.blk .type-tag { font-size: 10px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; padding: 0 4px; align-self: center; }

.md h1, .md h2 { font-size: 17px; margin: 14px 0 4px; border-bottom: 1.5px solid var(--ink); padding-bottom: 2px; }
.md h3 { font-size: 15px; margin: 12px 0 2px; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.md h4, .md h5, .md h6 { font-size: 14px; margin: 10px 0 2px; }
.md p { margin: 3px 0; line-height: 1.5; }
.md ul, .md ol { margin: 3px 0; padding-left: 22px; }
.md figure { margin: 6px 0; text-align: center; }
.md figure img { max-width: 100%; max-height: 360px; }
.md figcaption { font-size: 11px; color: var(--ink-3); }
.md code { font-family: var(--mono); background: var(--surface-2); padding: 0 3px; border-radius: 3px; }
.md-empty { color: var(--ink-3); font-style: italic; }

.py-view .label { font-size: 10px; font-weight: 700; color: var(--warn); letter-spacing: .08em; text-transform: uppercase; }
.py-view pre { font-family: var(--mono); font-size: 12.5px; background: #fafafa; border: 1px solid var(--line-2); border-radius: 4px;
  padding: 6px 8px; margin: 3px 0; white-space: pre-wrap; }
.py-view .outs { display: flex; flex-direction: column; gap: 2px; padding-left: 10px; font-size: 14.5px; }
.py-view pre.stdout { background: var(--panel); color: var(--ink-2); }

.edit-grid { display: grid; gap: 8px; grid-template-columns: 140px minmax(0, 1fr) 120px; }
.edit-grid .span-all { grid-column: 1 / -1; }
.edit-preview { margin-top: 8px; padding: 6px 8px; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 6px; font-size: 15px; overflow-x: auto; }
.edit-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.import-box { margin-top: 8px; padding: 8px; border-radius: 6px; background: var(--warn-soft); font-size: 12px; color: #5c3d00; }
.import-box.okbox { background: var(--surface-2); color: var(--ink-2); }

.quickbar { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.quickbar textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; font-family: var(--mono);
  font-size: 13px; resize: none; min-height: 36px; max-height: 160px; }
.quickbar textarea:focus { outline: none; border-color: var(--accent); }
.quickbar .row { margin-top: 6px; }

/* ---------- sidebar content ---------- */
.var-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.var-table td { padding: 5px 4px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.var-table tr:hover td { background: var(--hover); cursor: pointer; }
.var-table td:first-child { font-family: var(--mono); font-weight: 600; }
.var-table td:last-child { text-align: right; color: var(--accent); }
.qc-item { border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-bottom: 8px; font-size: 12px; }
.qc-item:hover { border-color: var(--accent); cursor: pointer; }
.settings-grid { display: grid; gap: 10px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.graph-box { border: 1px solid var(--line); border-radius: 8px; overflow: auto; background: var(--surface-2); }

/* ---------- review ---------- */
.summary { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 16px; }
.rv-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.rv-item.off { opacity: .45; }
.rv-item .rv-math { font-size: 15px; overflow-x: auto; }
.rv-item .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 4px; font-size: 12px; }
.rv-edit { margin-top: 8px; }

@media (max-width: 980px) {
  .editor { grid-template-columns: minmax(0, 1fr); height: auto; }
  .sidebar { border-left: 0; border-top: 1px solid var(--line); }
  .hero { grid-template-columns: 1fr; }
  .sheet { padding: 16px; min-height: 0; }
  .edit-grid { grid-template-columns: 1fr; }
  .blk .view { grid-template-columns: 1fr; }
  .blk .side { text-align: left; }
}
@media print {
  .topbar, .sidebar, .sheet-tools, .blk .tools { display: none !important; }
  .editor { display: block; height: auto; }
  .sheet-scroll { overflow: visible; padding: 0; }
  .sheet { box-shadow: none; border: 0; background-image: none; padding: 0; }
}

/* ---------- engine banner (browser build) ---------- */
.engine-banner { position: fixed; bottom: 14px; right: 14px; z-index: 300; display: flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 12.5px; max-width: 70vw;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.engine-banner.failed { background: var(--ng); }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tables ---------- */
.tbl-view { width: 100%; }
.tbl-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.tbl-name { font-weight: 700; font-size: 13px; }
.tbl-caption { font-size: 13px; font-weight: 600; }
.tbl-formulas { display: flex; flex-direction: column; gap: 2px; margin: 4px 0 6px; font-size: 14.5px; }
.tbl-scroll { overflow-x: auto; max-width: 100%; }
table.calc-table { border-collapse: collapse; font-size: 12.5px; background: var(--panel); }
table.calc-table th, table.calc-table td { border: 1px solid var(--line); padding: 2px 7px; text-align: right; white-space: nowrap; }
table.calc-table thead th { background: var(--surface-2); font-weight: 600; text-align: center; font-size: 12px; }
table.calc-table thead th .unit { font-size: 10.5px; color: var(--ink-3); font-weight: 400; }
table.calc-table td:first-child, table.calc-table th:first-child { text-align: center; }
table.calc-table td.rownum, table.calc-table th.rownum { color: var(--ink-3); background: var(--surface-2); font-size: 10.5px; padding: 2px 5px; }
table.calc-table td.cell-err { background: var(--ng-soft); color: var(--ng); }
table.calc-table td.cell-ovr { background: #fffdf2; }
table.calc-table tfoot td { border-top: 2px solid var(--ink-3); font-weight: 700; background: var(--surface-2); }
.tbl-sample { margin-top: 6px; padding: 5px 8px; background: var(--surface-2); border-left: 2px solid var(--line); font-size: 14px; }
.tbl-sample > div + div { margin-top: 2px; }
.tbl-editor table.col-defs { width: 100%; border-collapse: collapse; font-size: 12px; }
.tbl-editor table.col-defs th { text-align: left; font-size: 10.5px; color: var(--ink-2); text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 4px; }
.tbl-editor table.col-defs td { padding: 2px 4px; vertical-align: middle; }
.tbl-editor table.col-defs .input { padding: 3px 6px; }
.tbl-editor .nowrap { white-space: nowrap; }
table.grid-edit { border-collapse: collapse; font-size: 12px; }
table.grid-edit th { font-size: 10.5px; color: var(--ink-2); padding: 2px 4px; background: var(--surface-2); border: 1px solid var(--line); }
table.grid-edit td { border: 1px solid var(--line); padding: 0; }
table.grid-edit td.rownum { color: var(--ink-3); padding: 0 5px; background: var(--surface-2); }
.cell-input { border: 0; padding: 3px 6px; width: 92px; font-family: var(--mono); font-size: 12px; background: transparent; }
.cell-input:focus { outline: 2px solid var(--accent-soft); background: var(--panel); }
.cell-input.uses-formula { background: #fcfcf5; }
@media print { .tbl-scroll { overflow: visible; } table.calc-table { font-size: 10.5px; } }

/* ---------- landing page ---------- */
.home .hero2 { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: center;
  background: linear-gradient(135deg, var(--panel) 0%, #fbe9d9 100%); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px 26px 28px; }
.hero2 .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.hero2 h1 { font-size: 26px; line-height: 1.25; margin: 6px 0 8px; letter-spacing: -0.01em; }
.hero2 p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.55; max-width: 46em; }
.start-row { display: flex; gap: 8px; flex-wrap: wrap; }
.start-row .input { min-width: 220px; }
.sample-sheet { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
  box-shadow: 0 10px 28px rgba(60, 36, 20,.10); font-size: 13px; }
.sample-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; margin-bottom: 8px; }
.sample-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 5px 0;
  border-bottom: 1px dashed var(--line-2); }
.sample-line .sample-math { font-size: 14px; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.sample-line .sample-side { font-size: 11px; color: var(--ink-3); font-style: italic; white-space: nowrap; }
.sample-line.ok .sample-math .katex { background: var(--ok-soft); box-shadow: 0 0 0 3px var(--ok-soft); border-radius: 2px; }
.sample-foot { font-size: 11px; color: var(--ink-3); margin-top: 8px; }
.feature-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.feature { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; }
.feature .ico { font-size: 18px; line-height: 1.2; }
.wb-card.tpl { border-style: dashed; }
.empty-state { text-align: center; padding: 26px; }

/* ---------- editor extras ---------- */
.md-toolbar { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; border: 1px solid var(--line);
  border-bottom: 0; border-radius: 6px 6px 0 0; background: var(--surface-2); padding: 2px 4px; }
.md-toolbar + .textarea { border-radius: 0 0 6px 6px; }
.md-toolbar .sep { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.block-options { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px;
  border-top: 1px dashed var(--line-2); padding-top: 6px; }
.block-options .lbl { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.block-options label { display: flex; align-items: center; gap: 4px; }
.select.sm { height: 26px; padding: 0 6px; font-size: 12px; }
.input.sm { height: 26px; padding: 0 6px; font-size: 12px; }
.blk.al-center .view, .blk.al-center .md { text-align: center; }
.blk.al-center .view { grid-template-columns: minmax(0, 1fr); }
.blk.al-right .view .math { text-align: right; }
.blk.sz-small .math, .blk.sz-small .md { font-size: 12.5px; }
.blk.sz-large .math { font-size: calc(var(--math-size, 15px) + 4px); }
.sheet .math { font-size: var(--math-size, 15px); }
.sheet .titleblock { border-color: var(--sheet-accent, var(--ink)); }
.sheet .md h1, .sheet .md h2 { color: var(--sheet-accent, var(--ink)); border-bottom-color: var(--sheet-accent, var(--ink)); }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 900px) { .home .hero2 { grid-template-columns: 1fr; } }

/* ---------- website (hosted mode) ---------- */
.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a { color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.site-nav a:hover { background: var(--hover); color: var(--ink); }
.site-nav a.btn.primary { color: #fff; margin-left: 4px; }
.site-nav a.btn.primary:hover { background: var(--accent-strong); }
.site-nav .avatar { width: 32px; height: 32px; padding: 0; border-radius: 50%; background: var(--accent-soft);
  color: var(--accent); display: grid; place-items: center; font-weight: 700; font-size: 12px; margin-left: 4px; }
.site-footer { max-width: 1100px; margin: 0 auto; padding: 18px 16px 28px; display: flex; gap: 18px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); border-top: 1px solid var(--line); }
.site-footer a { color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer span { margin-right: auto; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
a.btn { text-decoration: none; color: var(--ink); }
a.btn.primary { color: #fff; }
.btn.block { width: 100%; height: 38px; font-weight: 600; }
.badge.big { font-size: 12.5px; padding: 3px 12px; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; }
.linkish:hover { text-decoration: underline; }
.hint { font-size: 11.5px; color: var(--ink-3); }
.opt { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--ink-3); }
.err-text { color: var(--ng); }
.nowrap { white-space: nowrap; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; line-height: 1.4; }
.check input { margin-top: 3px; }
ul.ticks { list-style: none; padding: 0; margin: 10px 0 16px; }
ul.ticks li { position: relative; padding: 3px 0 3px 22px; line-height: 1.4; }
ul.ticks li::before { content: "\2713"; position: absolute; left: 2px; top: 3px; color: var(--ok); font-weight: 700; }

.auth-page { display: grid; place-items: start center; padding-top: 48px; min-height: calc(100vh - 140px); }
.auth-card { width: min(430px, 100%); padding: 26px 26px 22px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: 0 12px 32px rgba(60, 36, 20, .08); }
.auth-card h1 { font-size: 22px; margin: 0; }
.auth-card p { margin: 0; line-height: 1.5; }
.auth-card .input { height: 38px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; color: var(--ink-2); }

.plan-bar { margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.plan-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; }
.plan-row.verify { background: var(--warn-soft); border-color: #f0d58a; }
.usage { display: inline-block; width: 120px; height: 7px; border-radius: 99px; background: var(--line); overflow: hidden; }
.usage > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.usage.full > span { background: var(--warn); }

.guest-pitch { margin-top: 26px; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.step { display: flex; gap: 12px; align-items: flex-start; padding: 14px; }
.step .num { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.pitch-card { margin-top: 12px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; background: linear-gradient(135deg, var(--panel) 0%, #fbe6d2 100%); }
.pitch-card h3 { margin: 0 0 4px; }

.sheet-notice { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; min-height: 40px;
  padding: 6px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--accent-line); font-size: 13px; }
.sheet-notice.warn { background: var(--warn-soft); border-bottom-color: #f0d58a; }
.editor.with-notice { height: calc(100vh - 92px); }

.page-head { margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 24px; }
.account { max-width: 820px; }
.acct-section { margin-bottom: 14px; }
.acct-section h2 { font-size: 15px; margin: 0 0 10px; }
.acct-section p { margin: 0 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; align-items: end; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.danger-zone { border-color: #f3c5bf; }

.pricing-head { text-align: center; max-width: 720px; margin: 10px auto 26px; }
.pricing-head h1 { font-size: 30px; margin: 6px 0 10px; letter-spacing: -0.01em; }
.pricing-head p { color: var(--ink-2); line-height: 1.55; margin: 0; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: stretch; }
.plan { position: relative; padding: 22px; display: flex; flex-direction: column; }
.plan h3 { margin: 0 0 8px; font-size: 16px; }
.plan .price { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 2px; }
.plan .price span { font-size: 14px; font-weight: 500; color: var(--ink-3); margin-left: 2px; }
.plan .price.small-price { font-size: 26px; }
.plan ul.ticks { flex: 1; }
.plan.featured { border: 2px solid var(--accent); box-shadow: 0 14px 36px rgba(194, 65, 12, .14); }
.plan-tag { position: absolute; top: -11px; left: 22px; background: var(--accent); color: #fff; font-size: 11px;
  font-weight: 700; padding: 3px 10px; border-radius: 99px; letter-spacing: .03em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: flex-start; margin-bottom: 4px; }
.seg button { border: 0; background: var(--panel); padding: 5px 14px; cursor: pointer; font-size: 12.5px; }
.seg button.on { background: var(--accent); color: #fff; }
.pricing-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 26px;
  font-size: 13px; color: var(--ink-2); line-height: 1.5; }

.contact-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: start; max-width: 960px; margin: 16px auto 0; }
.contact-grid h1 { font-size: 28px; margin: 6px 0 10px; }
.contact-grid p { line-height: 1.55; }

.admin .stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.setup-note { background: var(--warn-soft); border-color: #f0d58a; margin-bottom: 14px; line-height: 1.6; }
.admin-tabs { margin-bottom: 14px; }
.admin-tabs button { flex: none; padding: 8px 16px; font-size: 13px; }
.code-form { display: grid; grid-template-columns: 1.4fr 1fr 1fr .7fr .7fr .9fr auto; gap: 10px; align-items: end; }
.tbl-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3);
  padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.admin-table tr.off td { color: var(--ink-3); }
.msg-list { display: flex; flex-direction: column; gap: 10px; }
.msg.done { opacity: .6; }
.msg-body { white-space: pre-wrap; margin-top: 8px; line-height: 1.5; }

.legal { max-width: 760px; line-height: 1.6; }
.legal h1 { font-size: 26px; }
.legal h2 { font-size: 16px; margin-top: 22px; }

@media (max-width: 900px) {
  .plan-grid, .contact-grid { grid-template-columns: 1fr; }
  .code-form { grid-template-columns: 1fr 1fr; }
  .site-nav a:not(.avatar):not(.btn) { padding: 6px 6px; }
}
@media (max-width: 600px) {
  .site-nav a[href="#/contact"], .site-nav a[href="#/pricing"] { display: none; }
}
@media print { .site-nav, .site-footer, .sheet-notice, .plan-bar { display: none !important; } }

/* ---------- input values: == sign and a light grey box ---------- */
.sheet.box-inputs .blk.t-input:not(.check-ok):not(.check-ng):not(.editing) .math .katex,
.sample-line.inp .sample-math .katex { display: inline-block; background: #f1f2f4; border: 1px solid var(--line-strong);
  border-radius: 3px; padding: 2px 8px; }
@media print { .sheet.box-inputs .blk.t-input .math .katex { -webkit-print-color-adjust: exact; print-color-adjust: exact; } }
.sheet-notice.tpl { background: #eef6ee; border-bottom-color: #bfe0c6; }
.wb-card.new-tpl { display: flex; flex-direction: column; justify-content: center; border-style: dashed; background: var(--surface-2); }
.wb-card.new-tpl h4 { color: var(--accent); }
.wb-card.tpl.is-default { border-color: var(--accent); border-style: solid; }

/* ---------- landing page: hero art, capability list, closing band ---------- */
.home .hero2 { position: relative; overflow: hidden; background:
    radial-gradient(1100px 380px at 12% -10%, rgba(194, 65, 12, .10), transparent 70%),
    linear-gradient(135deg, var(--panel) 0%, #fdf1e6 55%, #f9e3cf 100%); }
.home .hero2::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .55;
  background-image: linear-gradient(to right, rgba(194, 65, 12, .07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(194, 65, 12, .07) 1px, transparent 1px);
  background-size: 28px 28px;
  -webkit-mask-image: radial-gradient(600px 280px at 20% 0%, #000 20%, transparent 85%);
  mask-image: radial-gradient(600px 280px at 20% 0%, #000 20%, transparent 85%); }
.home .hero2 > * { position: relative; }
.hero2 h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.16; letter-spacing: -0.02em; }
.hero2 h1 em { font-style: normal; background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero2-right { display: flex; flex-direction: column; gap: 10px; }

/* beam, load, reactions and moment diagram */
.beam-art { width: 100%; height: auto; max-height: 190px; }
.beam-art .load-line, .beam-art .load-arrow line { stroke: var(--ink-3); stroke-width: 1.2; }
.beam-art .load-arrow path { fill: var(--ink-3); }
.beam-art .load-arrow { opacity: 0; animation: dropIn .5s ease-out forwards; }
.beam-art .support { fill: var(--ink-2); }
.beam-art .ground, .beam-art .hatch { stroke: var(--ink-3); stroke-width: 1.2; }
.beam-art .dim { stroke: var(--ink-2); stroke-width: 1; fill: var(--ink-2); }
.beam-art .axis { stroke: var(--line-strong); stroke-width: 1; }
.beam-art .beam { filter: drop-shadow(0 3px 6px rgba(60, 36, 20, .25)); }
.beam-art .moment { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round;
  stroke-dasharray: 460; stroke-dashoffset: 460; animation: drawLine 1.5s .6s ease-out forwards; }
.beam-art .moment-fill { opacity: 0; animation: fadeIn .9s 1.5s ease-out forwards; }
.beam-art .art-label { font-family: var(--sans); font-size: 10.5px; fill: var(--ink-2); text-anchor: middle; }
.beam-art .art-label .sub { font-size: 8px; }
.beam-art .art-label.peak { fill: var(--accent); font-weight: 700; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.sample-sheet { animation: riseIn .5s ease-out both; box-shadow: 0 18px 40px rgba(60, 36, 20, .13), 0 2px 6px rgba(60, 36, 20, .06); }
.sample-line { animation: riseIn .45s ease-out both; }
.sample-line:nth-child(2) { animation-delay: .10s; }
.sample-line:nth-child(3) { animation-delay: .20s; }
.sample-line:nth-child(4) { animation-delay: .30s; }
.sample-line:nth-child(5) { animation-delay: .40s; }
.sample-line:nth-child(6) { animation-delay: .50s; }

/* file formats it reads */
.format-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.fs-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); }
.chip b { font-family: var(--mono); font-size: 11.5px; color: var(--accent); }

/* three steps */
.steps-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; margin-top: 14px; }
.step2 { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; position: relative; overflow: hidden; }
.step2::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); opacity: .65; }
.step2 .num { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px; }

/* capability list */
.caps { margin-top: 34px; }
.caps-head { max-width: 640px; }
.caps-head h2 { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -0.01em; margin: 6px 0 0; }
.caps-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 14px; margin-top: 18px; }
.cap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 6px;
  animation: riseIn .5s ease-out both; transition: border-color .15s, box-shadow .15s, transform .15s; }
.cap:hover { border-color: var(--accent-line); box-shadow: 0 10px 26px rgba(60, 36, 20, .08); transform: translateY(-2px); }
.cap header { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line-2); }
.cap header h3 { margin: 0; font-size: 14.5px; letter-spacing: -0.01em; }
.cap-icon { width: 26px; height: 26px; flex: none; padding: 4px; border-radius: 7px; background: var(--accent-soft);
  fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cap ul { list-style: none; margin: 0; padding: 0; }
.cap li { padding: 10px 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; line-height: 1.5; }
.cap li:last-child { border-bottom: 0; }
.cap li b { display: block; font-size: 13px; color: var(--ink); }
.cap li span { color: var(--ink-2); }

/* closing call to action */
.closing { margin-top: 34px; padding: 26px 28px; border-radius: 14px; color: #fbeee2; display: flex; gap: 20px;
  align-items: center; justify-content: space-between; flex-wrap: wrap; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark) 55%, var(--dark-2) 100%); }
.closing::before { content: ""; position: absolute; inset: 0; opacity: .25;
  background-image: linear-gradient(to right, rgba(255, 255, 255, .10) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .10) 1px, transparent 1px); background-size: 26px 26px; }
.closing > * { position: relative; }
.closing h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.closing p { margin: 0; color: #e3c9b3; font-size: 13px; max-width: 46em; }
.closing .btn { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .28); color: #fbeee2; }
.closing .btn:hover { background: rgba(255, 255, 255, .16); border-color: rgba(255, 255, 255, .45); }
.closing .btn.primary { background: var(--panel); border-color: #fff; color: var(--dark); font-weight: 600; }
.closing .btn.primary:hover { background: #fbeee2; }

@media (max-width: 900px) {
  .beam-art { max-height: 150px; }
  .caps-grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .beam-art .load-arrow, .beam-art .moment, .beam-art .moment-fill, .sample-sheet, .sample-line, .cap {
    animation: none !important; opacity: 1 !important; stroke-dashoffset: 0 !important; transform: none !important; }
}
@media print { .format-strip, .steps-band, .caps, .closing, .beam-art { display: none !important; } }

/* ---------- equations sit on the left, and each line can be placed by the user ---------- */
.blk .math .katex-display { margin: 0; text-align: left; }
.blk .math .katex-display > .katex { text-align: left; display: inline-block; }
.blk.al-center .math .katex-display, .blk.al-center .math .katex-display > .katex { text-align: center; }
.blk.al-right .math .katex-display, .blk.al-right .math .katex-display > .katex { text-align: right; }

/* half / third width lines flow next to each other, like regions side by side on a Mathcad sheet */
.blk.w-half, .blk.w-third { display: inline-block; vertical-align: top; }
.blk.w-half { width: calc(50% - 10px); }
.blk.w-third { width: calc(33.33% - 10px); }
.blk.w-half .view, .blk.w-third .view { grid-template-columns: minmax(0, 1fr); }
.blk.w-half .side, .blk.w-third .side { font-size: 11px; }

/* dragging a line to a new place */
.blk .type-tag.drag-handle { cursor: grab; user-select: none; touch-action: none; }
.sheet.dragging { user-select: none; }
.sheet.dragging .blk .type-tag.drag-handle { cursor: grabbing; }
.blk.dragged { opacity: .55; outline: 1px dashed var(--accent); }
.blk.drop-here::before { content: ""; position: absolute; left: 0; right: 0; top: -2px; height: 2px;
  background: var(--accent); border-radius: 2px; }

/* the line's description sits above it, the way a calc pad labels the next step */
.blk .desc-above { font-size: 11.5px; font-style: italic; color: var(--ink-2); margin-bottom: 1px; }
.blk.sz-small .desc-above { font-size: 10.5px; }
.blk .view { grid-template-columns: minmax(0, 1fr) minmax(0, 20%); }

/* a line's description sits above it, the way a calc pad labels the next step */
.blk .desc-above { font-size: 11.5px; font-style: italic; color: var(--ink-2); margin-bottom: 1px; }
.blk.sz-small .desc-above { font-size: 10.5px; }
.blk .view { grid-template-columns: minmax(0, 1fr) minmax(0, 20%); }

/* import section header and the AI category */
.section-head { margin: 26px 0 10px; gap: 12px; }
.format-strip { margin-top: 0; padding: 6px 10px; }
.ai-card { display: flex; gap: 14px; align-items: center; padding: 16px 18px; cursor: pointer;
  background: linear-gradient(135deg, var(--panel) 0%, #fff6e8 100%); border-color: #f2d7ae; transition: border-color .15s, box-shadow .15s; }
.ai-card:hover { border-color: #e2a857; box-shadow: 0 10px 26px rgba(180, 83, 9, .10); }
.ai-card .ico { font-size: 26px; line-height: 1; }
.ai-card h3 { margin: 0 0 3px; font-size: 15px; }
.ai-card p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; max-width: 70em; }
@media (max-width: 760px) { .ai-card { flex-wrap: wrap; } .section-head .format-strip { width: 100%; } }

.beam-art .roller { fill: #fff; stroke: var(--ink-2); stroke-width: 2; }

/* stretchable table columns */
.calc-table th { position: relative; }
.col-grip { position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; touch-action: none; }
.col-grip:hover { background: var(--accent); opacity: .35; }
body.col-resizing { cursor: col-resize; user-select: none; }
body.col-resizing * { cursor: col-resize !important; }
.calc-table { table-layout: auto; }

/* File-type icons on the import tiles: a small document outline with the extension on it. */
.file-icon { width: 27px; height: 33px; display: block; --tone: var(--ink-2); --tone-soft: var(--surface-2); }
.file-icon .sheet { fill: var(--tone-soft); stroke: var(--tone); stroke-width: 1.6; }
.file-icon .fold { fill: var(--tone); opacity: .3; }
.file-icon .tag { fill: var(--tone); font: 700 10px/1 var(--ui-font, system-ui, sans-serif); letter-spacing: .2px; }
.file-icon.mathcad .tag { font-size: 8px; }
.file-icon.pdf { --tone: #c0392b; --tone-soft: #fdf1ef; }
.file-icon.excel { --tone: #1f7a4d; --tone-soft: #eefaf3; }
.file-icon.word { --tone: #2456b8; --tone-soft: var(--accent-soft); }
.file-icon.mathcad { --tone: var(--accent-2); --tone-soft: #fff1dc; }
.file-icon.json { --tone: var(--ink-2); --tone-soft: var(--surface-2); }
.import-tile .ico { display: flex; align-items: center; }

/* Equation numbers sit on the equation's own line, either in front of it or out in the margin,
   and the maths cell keeps a real width so Tex can measure whether one line fits. */
.blk .mrow { display: flex; align-items: baseline; gap: 12px; }
.blk .mcell { flex: 1 1 auto; min-width: 0; }
.blk .eq-no { flex: 0 0 auto; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.blk .eq-no.left { width: 0.4in; }
.blk .desc-side { font-size: 11.5px; font-style: italic; color: var(--ink-2); }

/* Account page: who you are on the left, the sheets and templates you have saved on the right. */
.account-split { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 26px; align-items: start; }
.acct-left { display: flex; flex-direction: column; gap: 14px; }
.acct-left .acct-section { margin: 0; }
.acct-left .form-grid { grid-template-columns: 1fr; }
.acct-left .who { display: flex; align-items: center; gap: 12px; }
.acct-left .who .avatar { width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 18px; }
.acct-right > .row:first-child { margin-top: 0 !important; }
@media (max-width: 900px) { .account-split { grid-template-columns: 1fr; } }
/* KaTeX soft-wraps inline maths mid-expression; keeping it on one line lets Tex see the overflow
   and swap in the stacked version, instead of breaking the equation at an arbitrary operator. */
.blk .tex .katex { white-space: nowrap; }

/* Enterprise plan: seat picker on the pricing page, team code on the account page. */
.plan-tag.alt { background: var(--warn-soft); color: var(--warn); }
.team-plan .seat-picker { margin: 10px 0 4px; }
.team-plan .seat-picker label { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 4px; }
.team-plan .seat-picker .input { width: 84px; text-align: center; }
.team-plan .seat-total { margin-top: 8px; font-size: 18px; font-weight: 700; }
.team-plan .seat-total span { font-size: 12px; font-weight: 400; color: var(--ink-2); }
.team-code { align-items: center; }
.code-chip { font-family: Consolas, Menlo, monospace; font-size: 17px; letter-spacing: .12em; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 12px; }

/* The hero cycles through several worked examples, each with its own sketch. */
.hero-sample { display: flex; flex-direction: column; gap: 10px; }
.hero-slide { display: flex; flex-direction: column; gap: 10px; animation: fadeUp .45s ease-out both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.sample-dots { display: flex; gap: 7px; justify-content: center; }
.sample-dots .dot { width: 8px; height: 8px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--line-strong); transition: background .2s, transform .2s; }
.sample-dots .dot:hover { background: var(--ink-3); }
.sample-dots .dot.on { background: var(--accent); transform: scale(1.35); }

/* extra pieces used by the pile cap, footing and bolted-splice sketches */
.beam-art .art-face { fill: var(--hover); stroke: var(--line-strong); stroke-width: 1.2; }
.beam-art .art-pile { fill: #fff; stroke: var(--ink-2); stroke-width: 2; opacity: 0; animation: dropIn .5s ease-out forwards; }
.beam-art .art-dash { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 6 4; }
.beam-art .art-bolt { fill: var(--line); stroke: var(--ink-2); stroke-width: 1.6; opacity: 0; animation: dropIn .4s ease-out forwards; }
.beam-art .art-bolt-core { fill: var(--ink-2); }
.beam-art .load-arrow.up line, .beam-art .load-arrow.right line { stroke: var(--accent); }
.beam-art .load-arrow.up path, .beam-art .load-arrow.right path { fill: var(--accent); }

/* Mathcad's printed layout: the wording of a line sits in its own column to the left of the maths,
   and the code clause it comes from sits out in the right margin. */
.blk .view.labelled { grid-template-columns: minmax(0, 22%) minmax(0, 1fr) minmax(0, 20%); }
.blk .view.labelled.full { grid-template-columns: minmax(0, 22%) minmax(0, 1fr); }
.blk .desc-left { font-size: 12px; color: var(--ink); line-height: 1.35; padding-top: 3px; }
.blk.sz-small .desc-left { font-size: 11px; }
.blk .side .cite { font-size: 11px; color: var(--ink-2); }
.blk.w-half .view.labelled, .blk.w-third .view.labelled { grid-template-columns: minmax(0, 1fr); }
.blk.w-half .desc-left, .blk.w-third .desc-left { padding-top: 0; }

/* Section headings print as a filled band, the way an issued calc sheet reads. */
.sheet .md h1, .sheet .md h2, .sheet .md h3 { color: #fff; border: 0; border-radius: 2px;
  padding: 3px 8px; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .md h1, .sheet .md h2 { font-size: 15px; margin: 14px 0 6px; background: var(--sheet-accent, var(--ink)); }
.sheet .md h3 { font-size: 13.5px; margin: 12px 0 5px; background: var(--sheet-accent-2, var(--accent-2)); }
.sheet .md h4, .sheet .md h5 { color: var(--sheet-accent, var(--ink)); }

/* ---------------------------------------------------------------- typing a line in place
   The sheet is the editor: click a line and the text that made it appears right there. */
.line-edit { display: flex; align-items: center; gap: 6px; }
.line-input { flex: 1 1 auto; min-width: 0; font-size: 14px; padding: 5px 9px; letter-spacing: .01em; }
.line-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(194, 65, 12, .13); }
.line-busy { color: var(--accent); font-size: 9px; animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }
.sheet { cursor: text; }
.sheet .blk, .sheet .titleblock { cursor: default; }
.empty-sheet { padding: 28px 20px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line);
  border-radius: 8px; cursor: text; }
.empty-sheet:hover { border-color: var(--accent); color: var(--ink-2); }

/* ---------------------------------------------------------------- the bar above the sheet
   One row: the quick line, the menus that open on demand, and how the page is laid out. */
.sheet-tools { position: sticky; top: 0; z-index: 9; max-width: 8.5in; margin: 0 auto 10px; padding: 6px 0 4px;
  background: linear-gradient(to bottom, var(--bg) 78%, transparent); }
.tool-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px; box-shadow: 0 1px 3px rgba(60, 36, 20, .06); }
.quick-line { flex: 1 1 240px; min-width: 0; font-size: 13px; padding: 6px 9px; }
.tool-hint { padding: 4px 8px 0; }
.menu { position: relative; }
.menu-btn { white-space: nowrap; }
.menu.open > .menu-btn { background: var(--accent); border-color: var(--accent); color: #fff; }
.menu-btn .caret { font-size: 9px; opacity: .7; }
.menu-panel { position: absolute; top: calc(100% + 5px); right: 0; z-index: 30; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 28px rgba(60, 36, 20, .16);
  padding: 8px; min-width: 200px; }
/* the Units and Functions palettes hang from the whole bar, so they never run off the screen */
.tool-row { position: relative; }
.menu.wide-menu { position: static; }
.menu-panel.wide { left: 0; right: 0; width: auto; }
.menu-search { width: 100%; margin-bottom: 6px; }
.menu-list { display: flex; flex-direction: column; }
.menu-item { text-align: left; border: 0; background: none; font: inherit; font-size: 13px; padding: 6px 8px;
  border-radius: 6px; cursor: pointer; }
.menu-item:hover { background: var(--hover, var(--hover)); }
.layout-seg { flex: none; margin-bottom: 0; align-self: center; }
.layout-seg button { font-size: 11.5px; padding: 4px 9px; white-space: nowrap; }
.tool-row > a.btn { white-space: nowrap; text-decoration: none; }
.palette-body { display: flex; flex-direction: column; gap: 7px;
  max-height: min(420px, 60vh); overflow-y: auto; }
.palette-group { display: flex; gap: 10px; align-items: baseline; }
.palette-label { flex: 0 0 104px; font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--ink-3); }
@media (max-width: 640px) { .palette-group { flex-direction: column; gap: 3px; } .palette-label { flex: none; } }
.palette-items { display: flex; flex-wrap: wrap; gap: 4px; }
.palette-body .chip { font-family: Consolas, Menlo, monospace; font-size: 11.5px; padding: 3px 8px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; color: var(--ink); }
.palette-body .chip:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.palette-body .chip.fn { font-family: var(--sans); }
.palette-note { flex: 1 0 100%; border-top: 1px dashed var(--line); padding-top: 6px; }
@media print { .sheet-tools { display: none !important; } }

/* ---------------------------------------------------------------- free placement, as in Mathcad */
.canvas.flow { position: static; min-height: 7.5in; padding-bottom: 1in; }   /* room to click below the last line */
.sheet.free .canvas { position: relative; cursor: text; }
.sheet.free .blk { position: absolute; margin: 0; width: max-content; max-width: 7.3in; }
/* the wording column takes the width it needs, capped - not a share of a shrink-to-fit box */
.sheet.free .blk .view.labelled { grid-template-columns: fit-content(1.9in) minmax(0, 1fr); }
.sheet.free .blk .view.labelled:not(.full) { grid-template-columns: fit-content(1.9in) minmax(0, 1fr) minmax(0, 1.4in); }
.sheet.free .blk.t-text { width: 7.3in; }
.sheet.free .blk.editing, .sheet.free .blk.selected { z-index: 15; }
.sheet.free .canvas { overflow: visible; }
.sheet.free .blk.dragged { opacity: .9; z-index: 20; box-shadow: 0 8px 22px rgba(60, 36, 20, .22); }
.sheet.free.dragging .canvas { background-image: radial-gradient(var(--line-2, var(--line)) 1px, transparent 1px);
  background-size: 0.25in 0.25in; }

/* Charts drawn from the sheet's own values. */
.plot-view svg.plot { max-width: 100%; height: auto; display: block; }
.blk.t-plot .view, .plot-view { min-width: 0; }
.sheet.free .blk.t-plot { width: auto; }

/* Areas: a heading can be folded away, and a checked line can be locked. */
.folded { font-size: 11px; font-style: italic; color: var(--ink-3); cursor: pointer;
  border-left: 2px solid var(--line); padding: 2px 0 2px 8px; margin-top: 2px; }
.folded:hover { color: var(--accent); border-left-color: var(--accent); }
.blk.locked { position: relative; }
.blk.locked > .view, .blk.locked > .md { opacity: .92; }
.blk.locked:hover { cursor: default; }
.blk.locked .tools .btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* "Uses another sheet": a quiet line saying where borrowed values come from. */
.ref-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.ref-line .tag { font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--ink-3); border-radius: 3px; padding: 2px 6px; }

/* ---------------------------------------------------------------- quick manual (#/manual) */
.manual { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; align-items: start; }
.man-toc { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.man-toc-title { font-weight: 700; margin-bottom: 6px; color: var(--ink); }
.man-toc a { color: var(--ink-2); text-decoration: none; padding: 5px 8px; border-radius: 6px; }
.man-toc a:hover { background: var(--accent-soft); color: var(--ink); }
.man-body { max-width: 820px; line-height: 1.6; }
.man-body h1 { font-size: 28px; margin: 0 0 6px; }
.man-body .lead { font-size: 15px; color: var(--ink-2); margin-top: 0; }
.man-section { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 20px 14px; margin-top: 16px; scroll-margin-top: 72px; }
.man-section h2 { font-size: 17px; margin: 14px 0 8px; }
.man-section li { margin: 4px 0; }
.man-body code { font-family: var(--mono); font-size: 12.5px; background: var(--hover); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
.man-body kbd { font-family: var(--mono); font-size: 12px; background: var(--panel); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.man-table-wrap { overflow-x: auto; }
.man-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.man-table th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 6px 8px; }
.man-table td { border-bottom: 1px solid var(--line-2); padding: 7px 8px; vertical-align: top; }
.man-table td:first-child code { white-space: pre-wrap; word-break: break-word; }
.man-table.lines { table-layout: fixed; }
.man-table.lines th:nth-child(1) { width: 34%; }
.man-table.lines th:nth-child(2) { width: 30%; }
.man-table.lines td:nth-child(3) { overflow-x: auto; }
.man-table.keys td:first-child { width: 220px; }
.man-table .katex { font-size: 1.05em; white-space: nowrap; }
.man-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin: 8px 0; }
.man-grid > div { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.man-grid.two { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.man-section h3 { font-size: 14.5px; margin: 18px 0 6px; }
.man-figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 14px; margin: 10px 0; }
.man-fig { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.man-fig-art { border-bottom: 1px solid var(--line-2); }
.man-fig-art svg { display: block; width: 100%; height: auto; max-width: none !important; }
.man-fig figcaption { padding: 10px 12px 12px; line-height: 1.45; background: var(--panel); flex: 1; }
.man-fig figcaption .small { color: var(--ink-2); margin-top: 2px; }
.man-fig-results { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0 4px; }
.man-fig-results code { color: var(--accent-strong); }
.man-fig details { margin-top: 6px; }
.man-fig summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.man-fig pre { font-family: var(--mono); font-size: 11.5px; line-height: 1.45; background: var(--hover); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; overflow-x: auto; margin: 6px 0; }
@media (max-width: 800px) {
  .manual { grid-template-columns: 1fr; gap: 12px; }
  .man-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .man-section { padding: 4px 14px 12px; }
  .man-body code { white-space: normal; }
}

.blank-line { min-height: 1.5em; }

/* ---------------------------------------------------------------- landing: hero actions */
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; font-weight: 600; }
.hero-cta { gap: 10px; margin-top: 4px; }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.hero-links a, button.link { color: var(--accent); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; text-decoration: none; }
.hero-links a:hover, button.link:hover { text-decoration: underline; }
.hero-note { margin-top: 8px; }

/* ---------------------------------------------------------------- landing: try it */
.tryit { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 28px; align-items: center;
  margin-top: 30px; padding: 26px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.tryit h2 { font-size: clamp(20px, 2.4vw, 26px); line-height: 1.25; letter-spacing: -0.01em; margin: 6px 0 8px; }
.tryit p { margin: 0 0 16px; color: var(--ink-2); line-height: 1.55; font-size: 13.5px; }
.tryit-slider { display: block; margin-bottom: 12px; font-size: 12.5px; color: var(--ink-2); }
.tryit-slider span { display: flex; justify-content: space-between; margin-bottom: 4px; }
.tryit-slider b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tryit-slider input { width: 100%; accent-color: var(--accent); }
.tryit-units { margin: 2px 0 16px; }
.tryit-mistake { border-top: 1px dashed var(--line); padding-top: 12px; }
.tryit-mistake code { display: inline-block; margin: 6px 0 4px; font-family: var(--mono); font-size: 12.5px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 8px; }
.tryit-mistake .msg-err { font-size: 12px; font-weight: 600; color: var(--ng); }
.tryit-sheet .sample-sheet { margin: 0; }
.tryit-sheet .sample-line { animation: none; }
.sample-line.ng .sample-math .katex { background: var(--ng-soft); box-shadow: 0 0 0 3px var(--ng-soft); border-radius: 2px; }

/* ---------------------------------------------------------------- landing: switching over */
.from { margin-top: 34px; }
.from-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-top: 18px; }
.from-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.from-card header { display: flex; gap: 12px; align-items: center; }
.from-card header .file-icon { width: 30px; height: 38px; flex: none; }
.from-kicker { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.from-card h3 { margin: 2px 0 0; font-size: 15px; letter-spacing: -0.01em; }
.from-card ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6; color: var(--ink); }
.from-card p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.from-card .row { gap: 12px; }

@media (max-width: 760px) {
  .tryit { grid-template-columns: 1fr; padding: 18px 16px; gap: 18px; }
  .hero-cta .btn { flex: 1 1 auto; }
}

/* ---------------------------------------------------------------- warm theme: type and finish */
h1, .caps-head h2, .tryit h2, .closing h2, .man-body h1, .page-head h1, .auth-card h1 {
  font-family: var(--display); font-weight: 600; letter-spacing: -0.015em; }
.hero2 h1 em { background: linear-gradient(115deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand .logo-mark { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-radius: 8px; }
.btn { border-radius: 8px; }
.btn.primary { background: linear-gradient(180deg, #d4561f, var(--accent)); border-color: var(--accent-strong);
  box-shadow: 0 1px 2px rgba(60, 36, 20, .18), inset 0 1px 0 rgba(255, 255, 255, .18); }
.btn.primary:hover { background: var(--accent-strong); }
.card, .cap, .from-card, .tryit, .man-section { border-radius: 14px; }
.topbar { background: rgba(255, 252, 247, .86); backdrop-filter: saturate(1.4) blur(10px); }
.closing { background: radial-gradient(120% 140% at 0% 0%, var(--dark-2), var(--dark) 60%); }
::selection { background: var(--accent-soft); }

/* the app's own confirm / name dialogs */
.dialog-msg { margin: 0 0 12px; line-height: 1.5; color: var(--ink-2); }
.btn.danger-solid { background: var(--ng); border-color: var(--ng); color: #fff; }
.btn.danger-solid:hover { background: #991b1b; }

/* ---------------------------------------------------------------- CalcStamp mark and wordmark */
.brand { gap: 9px; }
.brand .logo-svg { display: block; flex: none; filter: drop-shadow(0 1px 1.5px rgba(60, 36, 20, .28));
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.brand:hover .logo-svg { transform: rotate(10deg) scale(1.06); }
.brand:active .logo-svg { transform: scale(.86); transition-duration: .08s; }     /* pressed like a stamp */
.wordmark { font-family: var(--display); font-size: 20px; font-weight: 700; letter-spacing: -0.025em; color: var(--ink); line-height: 1; }
.wordmark em { font-style: normal; color: var(--accent); }.hero2 h1 { font-size: clamp(34px, 5.2vw, 56px); line-height: 1.02; letter-spacing: -0.03em; margin: 8px 0 14px; }
/* ---------------------------------------------------------------- "show your work": the work appears */
.sample-line.work .sample-math .katex { transition: opacity .3s; }
.sample-line.work.stage-1 .sample-side { color: var(--accent); font-weight: 600; }
.sample-foot .work-key { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: #c2410c;
  vertical-align: -1px; margin-right: 3px; }
.hero2 h1 em { display: inline-block; }

/* ---------------------------------------------------------------- free beta */
.beta-pill { display: inline-block; margin-left: 7px; padding: 2px 7px 3px; border-radius: 999px; vertical-align: 3px;
  font-family: var(--sans); font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-strong); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.beta-page .plan-grid .plan h3 { margin-top: 0; }

/* ---------------------------------------------------------------- load diagram and its CAD window */
.diagram-view .diagram-sum, .diagram-sum { font-size: 12.5px; color: var(--ink-2); margin-top: 4px; }
.diagram-canvas { position: relative; width: 100%; margin: 10px 0 6px; border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; background: #fff; }
.diagram-base svg { display: block; width: 100%; height: auto; max-width: none !important; }
.diagram-overlay { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.diagram-paper { cursor: crosshair; }
.diagram-handle { fill: #fff; stroke: #c2410c; stroke-width: 2.2; cursor: grab; }
.diagram-handle.half { stroke-dasharray: 3 2; }
.diagram-handle:hover { fill: #fde6d6; }
.diagram-lock { fill: #fff; stroke: #98877a; stroke-width: 1.6; cursor: not-allowed; }
.diagram-ghost { fill: rgba(194, 65, 12, .08); stroke: #c2410c; stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.diagram-empty { padding: 30px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line); border-radius: 10px; margin: 10px 0; }
.diagram-points { width: 100%; border-collapse: collapse; margin: 10px 0 6px; font-size: 12.5px; }
.diagram-points th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 3px 4px; border-bottom: 1px solid var(--line); }
.diagram-points td { padding: 3px 4px; }
.diagram-points td:first-child { width: 22px; }
.diagram-points td:last-child { width: 34px; }

.diagram-modes { gap: 10px; margin: 10px 0 2px; }
.diagram-modes .seg { margin: 0; }
.diagram-formula { margin-top: 8px; }

/* ---------------------------------------------------------------- hero: open the calc on show; worked examples */
.sample-foot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.sample-foot-row .sample-dots { margin: 0; }
.open-sample { white-space: nowrap; }
.demos { margin-top: 34px; }
.demo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; margin-top: 18px; }
.demo-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex;
  flex-direction: column; transition: border-color .15s, box-shadow .15s, transform .15s; }
.demo-card:hover { border-color: var(--accent-line); box-shadow: 0 10px 26px rgba(60, 36, 20, .08); transform: translateY(-2px); }
.demo-art { background: linear-gradient(135deg, var(--panel), #fbe9d9); border-bottom: 1px solid var(--line-2); padding: 8px 6px 2px; }
.demo-art .beam-art { display: block; width: 100%; height: auto; }
.demo-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.demo-body h3 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.demo-body p { margin: 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; flex: 1; }
.demo-body .btn { align-self: flex-start; margin-top: 4px; }
.beam-art .art-face.dense { fill: #e7ddcf; }
.beam-art .art-pressure { fill: rgba(194, 65, 12, .16); stroke: #c2410c; stroke-width: 1.4; }

/* ---------------------------------------------------------------- sketch: parametric CAD window */
.sketch-tools { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0; padding: 5px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg-2, #faf6f0); }
.sk-tool { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border: 1px solid transparent; border-radius: 7px;
  background: none; font: 500 12px var(--sans); color: var(--ink-2); cursor: pointer; }
.sk-tool span { font-size: 14px; width: 14px; text-align: center; color: var(--ink-3); }
.sk-tool:hover { background: #fff; border-color: var(--line); }
.sk-tool.on { background: #fff; border-color: var(--accent-line); color: var(--accent-strong); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.sk-tool.on span { color: var(--accent); }
.sketch-canvas { margin-left: auto; margin-right: auto; }
.sk-pending { fill: var(--accent); pointer-events: none; }
.sk-rubber { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 4; pointer-events: none; }
.sk-cursor { fill: none; stroke: var(--accent); stroke-width: 1.5; pointer-events: none; }
.sketch-list { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 6px; max-height: 320px; overflow: auto; }
.sk-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 5px 6px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; }
.sk-kind { align-self: center; min-width: 58px; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); }
.sk-field { display: flex; flex-direction: column; gap: 1px; font-size: 10.5px; color: var(--ink-3); }
.sk-field .input, .sk-field .select { width: 100%; }
.sk-row .btn { margin-left: auto; align-self: center; }
.sketch-view svg { max-width: 100%; height: auto; }

/* ---------------------------------------------------------------- bridge demos */
.demo-group { font-family: var(--sans); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink-3); margin: 26px 0 10px; }
.demo-card.flagship { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line), 0 8px 24px rgba(154, 52, 18, .08); }
.beam-art .art-lane { fill: rgba(194, 65, 12, .14); stroke: #c2410c; stroke-width: 1; }
.beam-art .art-envelope { fill: rgba(194, 65, 12, .10); stroke: none; opacity: 0; animation: fadeIn .9s 1.2s ease-out forwards; }
.beam-art polyline.moment { fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; }
.beam-art .moment.neg { stroke: #1f5fbf; }
.beam-art .roller-tri { fill: #fff; stroke: var(--ink-2); stroke-width: 1.6; }
.beam-art .art-patch { animation: slidePatch 6s ease-in-out infinite alternate; }
.beam-art .art-patch-arrow { stroke: #c2410c; stroke-width: 1.2; }
@keyframes slidePatch { from { transform: translateX(0); } to { transform: translateX(360px); } }
@media (prefers-reduced-motion: reduce) { .beam-art .art-patch { animation: none; } }
.beam-art .moment.dashed { stroke: var(--ink-3); stroke-width: 1.8; }
.beam-art polyline.moment.dashed { stroke-dasharray: 0.01 0.007; stroke-dashoffset: 0; opacity: 0; animation: fadeIn .8s .5s ease-out forwards; }
.beam-art line.moment.dashed { stroke-dasharray: 5 4 !important; }
.demo-subgroup { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font: 600 13.5px var(--sans); color: var(--ink-2); }
.demo-subgroup .span-count { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-strong); font-size: 12px; font-weight: 700; }
.site-nav .nav-start { margin-left: 6px; white-space: nowrap; }
.site-nav .nav-start .short { display: none; }
@media (max-width: 640px) { .site-nav .nav-extra { display: none; } }
@media (max-width: 420px) {
  .site-nav .nav-start .long { display: none; }
  .site-nav .nav-start .short { display: inline; }
  .topbar .beta-pill { display: none; }
  .topbar { gap: 6px; padding: 0 10px; }
  .site-nav { gap: 0; }
  .site-nav a:not(.avatar):not(.btn) { padding: 6px 5px; font-size: 12.5px; }
  .site-nav .nav-start { margin-left: 4px; padding-left: 10px; padding-right: 10px; }
  .brand .wordmark { font-size: 17px; }
}

/* ---------------------------------------------------------------- the examples: their own page, a pointer home */
.examples-band { display: flex; align-items: center; gap: 18px; margin: 26px 0 8px; padding: 18px 22px; text-decoration: none;
  color: inherit; background: linear-gradient(135deg, #fffaf3, var(--accent-soft)); border: 1px solid var(--accent-line); }
.examples-band h3 { margin: 4px 0 4px; font-size: 18px; }
.examples-band p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.examples-band:hover { box-shadow: 0 6px 18px rgba(154, 52, 18, .12); }
.examples-band .btn { flex: none; }
@media (max-width: 640px) { .examples-band { flex-direction: column; align-items: flex-start; } }
.examples-page .demos { margin-top: 18px; }
