:root {
  --blue: #2f80ed; --blue-d: #1f6fdc; --ink: #26364d; --ink-2: #5d6f88; --ink-3: #8fa0b8;
  --line: #e6ebf2; --soft: #f0f3f8; --soft-2: #e6ebf3; --ai: #a95be8; --ai-soft: #f6eefc;
  --danger: #e5484d; --good: #12a594; --warn: #e08a1e; --sticky: #fff776;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: #fff; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 13px; font-weight: 600; color: var(--ink-2); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--blue); text-decoration: none; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.icon { display: inline-flex; flex: none; }
[hidden] { display: none !important; }

.muted { color: var(--ink-2); }
.small-text { font-size: 12px; }
.center-text { text-align: center; }
.error-text { color: var(--danger); font-size: 13px; }
.error-text:empty { display: none; }
.danger-text { color: var(--danger); }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.link { color: var(--blue); font-weight: 500; text-align: left; }
.link:hover { text-decoration: underline; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 0 16px; border-radius: 19px; background: var(--soft); font-weight: 600; white-space: nowrap; transition: background .12s; }
.btn:hover:not(:disabled) { background: var(--soft-2); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--blue-d); }
.btn.ai { background: var(--ai); color: #fff; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #cf3a3f; }
.btn.wide { width: 100%; min-height: 44px; }
.btn.small { min-height: 30px; padding: 0 12px; font-size: 13px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: var(--ink-2); }
.icon-btn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.icon-btn.round { width: 38px; height: 38px; border-radius: 50%; background: var(--soft); }
.input { width: 100%; min-height: 42px; padding: 9px 12px; border: 1.5px solid var(--soft-2); border-radius: 9px; background: #fff; outline: 0; }
.input:focus { border-color: var(--blue); }
textarea.input { resize: vertical; }
.pill { min-height: 36px; padding: 0 16px; border-radius: 18px; background: var(--soft); color: var(--ink-2); font-weight: 500; }

/* Login */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; background: var(--soft); }
.login-card { width: min(360px, 100%); padding: 30px; background: #fff; border-radius: 16px; text-align: center; box-shadow: 0 8px 30px rgba(38, 54, 77, .08); }
.brand.center { justify-content: center; }

/* App shell */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100%; }
.sidebar { display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--ink); font-size: 16px; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 7px; color: var(--ink-2); width: 100%; text-align: left; }
.nav-item:hover { background: var(--soft); }
.nav-item.on { background: var(--soft); color: var(--ink); font-weight: 500; }
.nav-item .count { margin-left: auto; color: var(--ink-3); font-size: 13px; }
.logout { margin-top: auto; color: var(--ink-3); font-size: 13px; }
.main { min-width: 0; }
.content { max-width: 1010px; margin: 0 auto; padding: 56px 24px 80px; display: flex; flex-direction: column; gap: 28px; }

.actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.action { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 22px; min-height: 120px; padding: 20px; border-radius: 10px; background: var(--soft); color: var(--ink-2); font-size: 16px; text-align: left; transition: transform .12s, box-shadow .12s; }
.action:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(38, 54, 77, .1); }
.action-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(38, 54, 77, .06); }
.action.primary { background: var(--blue); color: #fff; font-weight: 600; }
.action.primary .action-icon { background: rgba(255, 255, 255, .22); }
.action.ai { background: var(--ai-soft); color: var(--ai); }
.action.ai .action-icon { background: rgba(169, 91, 232, .14); }

.list-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.view-toggle { display: flex; padding: 3px; background: var(--soft); border-radius: 18px; }
.view-toggle button { display: grid; place-items: center; width: 32px; height: 30px; border-radius: 15px; color: var(--ink-2); }
.view-toggle .on { background: #fff; box-shadow: 0 1px 3px rgba(38, 54, 77, .16); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 32px; }
.project-card { position: relative; height: 296px; padding: 40px 20px 0; overflow: hidden; border-radius: 12px; background: var(--soft); text-align: center; cursor: pointer; border: 2px solid transparent; transition: border-color .12s, background .12s; }
.project-card:hover, .project-card:focus-visible { background: #fff; border-color: var(--soft-2); }
.project-card.pinned { border-color: var(--soft-2); }
.project-card h3 { font-size: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.date { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.status { margin-left: 8px; padding: 1px 8px; border-radius: 10px; background: var(--soft-2); color: var(--ink-2); font-size: 11px; font-weight: 600; white-space: nowrap; }
.gear { position: absolute; top: 10px; right: 10px; opacity: 0; background: #fff; }
.project-card:hover .gear, .project-card:focus-within .gear, .project-row:hover .gear, .project-row:focus-within .gear, .gear:focus-visible { opacity: 1; }
.mini { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); width: 128px; height: 150px; padding: 4px 6px; overflow: hidden; border: 1.5px solid var(--c); border-radius: 8px 8px 0 0; background: #fff; }
.mini-dots { color: var(--c); font-size: 9px; line-height: 8px; text-align: left; }
.mini-title { color: var(--c); font-size: 11px; font-weight: 600; margin: 3px 0 5px; }
.mini-block { padding: 2px 5px; margin-bottom: 3px; border-radius: 2px; color: #fff; font-size: 9px; text-align: left; line-height: 1.3; }
.rows { display: flex; flex-direction: column; }
.project-row { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.project-row:hover { background: #fafbfd; }
.project-row .date { margin: 0 0 0 auto; white-space: nowrap; }
.project-row .gear { position: static; }
.row-icon { display: grid; place-items: center; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; color: var(--blue); flex: none; }
.empty { padding: 50px 0; text-align: center; color: var(--ink-3); }

/* Dialogs, menus, toasts */
.backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; background: rgba(38, 54, 77, .32); overflow: auto; }
.dialog { position: relative; width: min(960px, 100%); padding: 28px; border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(38, 54, 77, .25); }
.dialog.small { width: min(430px, 100%); }
.dialog-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); }
.tabs button { padding: 6px 0; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs .on { color: var(--ink); border-color: #12c2a9; }
.segmented { display: flex; padding: 3px; border-radius: 20px; background: var(--soft-2); }
.segmented button { flex: 1; min-height: 34px; border-radius: 17px; font-weight: 500; color: var(--ink-2); }
.segmented .on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(38, 54, 77, .16); }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-item { min-height: 50px; border-radius: 9px; background: var(--soft); font-weight: 500; color: var(--ink-2); }
.export-item:hover { background: var(--soft-2); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choices.three { grid-template-columns: repeat(3, 1fr); }
.choice { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; border: 2px solid var(--line); border-radius: 9px; color: var(--ink-2); }
.choice.small { padding: 11px 4px; font-size: 13px; }
.choice.on { border-color: #12c2a9; color: var(--ink); }
.popup { position: fixed; z-index: 70; min-width: 180px; max-height: 70vh; overflow: auto; padding: 6px; border-radius: 10px; background: #fff; box-shadow: 0 8px 30px rgba(38, 54, 77, .2); }
.popup-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 6px; color: var(--ink-2); text-align: left; }
.popup-item:hover { background: var(--soft); }
.popup-item.active { background: var(--soft); color: var(--ink); font-weight: 500; }
.popup-item.danger { color: var(--danger); }
.chev { margin-left: auto; }
.swatch { width: 14px; height: 14px; border-radius: 50%; }
#toasts { position: fixed; left: 50%; bottom: 84px; z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 6px 20px rgba(38, 54, 77, .25); }
.toast.error { background: #b4282d; }
.toast .link { color: #9cc6ff; }

/* Editor */
.editor { --bg: #fff; --fg: var(--ink); --card: #fff; --label: var(--ink-3); --section-line: var(--line); position: fixed; inset: 0; display: flex; flex-direction: column; background: var(--bg); color: var(--fg); }
.editor[data-theme="dark"] { --bg: #1f2d42; --fg: #eef3fb; --card: #1f2d42; --label: #8fa3bf; --section-line: #35465f; }
.editor[data-theme="blueprint"] { --bg: #eef2f8; --label: #7b8ea9; --section-line: #d7deea; }
.editor[data-theme="bold"] { --bg: #d7e4f5; --label: #5f7695; --section-line: #bccee5; }
.editor-head { position: relative; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--bg); }
.brand-link { display: flex; align-items: center; gap: 6px; flex: none; color: var(--label); }
.project-name { min-width: 80px; width: min(46vw, 500px); padding: 5px 8px; border: 1.5px solid transparent; border-radius: 7px; background: transparent; color: var(--blue); font-size: 17px; font-weight: 700; outline: 0; }
.project-name:not([readonly]):hover, .project-name:focus { border-color: var(--section-line); }
.editor[data-theme="dark"] .project-name { color: #8ab8ff; }
.save-state { color: var(--label); font-size: 12px; white-space: nowrap; }
.editor-head > .row { margin-left: auto; flex: none; }
.banners { position: relative; z-index: 5; }
.banner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 7px 16px; font-size: 13px; font-weight: 500; }
.banner.info { background: #e6f0fe; color: #1b4f96; }
.banner.warn { background: #fdf0d8; color: #8a5208; }
.banner.ai { background: var(--ai-soft); color: #7c34b8; }
.viewport { position: relative; flex: 1; overflow: hidden; touch-action: none; cursor: grab; outline: 0; user-select: none; }
.viewport:active { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; width: 0; height: 0; }
.edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; pointer-events: none; }
.edges path { fill: none; stroke-width: 1.5; }

.card { position: absolute; width: 150px; padding: 5px 6px 6px; border: 1.5px solid var(--c); border-radius: 9px; background: var(--card); color: var(--c); cursor: pointer; }
.card.page { min-height: 72px; }
.card.static { min-height: 0; }
.card.selected { box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--c) 35%, transparent); }
.card:focus-visible { outline-offset: 3px; }
.card.group { width: auto; max-width: 220px; padding: 3px 8px; border-color: transparent; background: transparent; }
.card.group .card-title { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-mark { height: 9px; font-size: 11px; line-height: 8px; letter-spacing: .5px; }
.frame-mobile { border-top-width: 5px; border-radius: 12px; }
.frame-neutral { padding-top: 8px; }
.card-title { margin: 3px 2px 6px; font-size: 13px; font-weight: 600; line-height: 16px; text-align: center; overflow-wrap: anywhere; }
.block { padding: 4px 7px; margin-top: 3px; border-radius: 3px; color: #fff; font-size: 10.5px; font-weight: 500; line-height: 13px; overflow-wrap: anywhere; }
.title-input { display: block; width: 100%; margin: 2px 0 5px; padding: 2px; border: 1px solid var(--c); border-radius: 4px; background: var(--card); color: var(--c); font-size: 13px; font-weight: 600; text-align: center; outline: 0; resize: none; overflow: hidden; height: 24px; }
.ctl { position: absolute; display: none; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--c); color: #fff; z-index: 3; box-shadow: 0 0 0 2px var(--card); }
.ctl:hover { filter: brightness(.88); }
.card:hover > .ctl, .card:focus-within > .ctl, .card.selected > .ctl { display: flex; }
.ctl.menu { top: -10px; right: -10px; }
.ctl.open { top: 15px; right: -10px; }
.ctl.right { top: 40px; right: -10px; }
.ctl.below { bottom: -11px; left: calc(50% - 24px); }
.ctl.ai { bottom: -11px; left: calc(50% + 2px); background: var(--ai); }
.card:not(:has(.ctl.ai)) > .ctl.below { left: calc(50% - 11px); }
.card.group > .ctl.right { top: 2px; right: -24px; }
.card.group > .ctl.menu { top: 2px; right: -48px; }
.ctl.expand { display: flex; position: absolute; bottom: -11px; left: calc(50% - 15px); width: 30px; font-size: 10px; font-weight: 600; }
.card:hover > .ctl.expand { left: calc(50% + 28px); }
.card.dragging { opacity: .3; }
.card.ghost { z-index: 30; pointer-events: none; opacity: .92; box-shadow: 0 10px 28px rgba(38, 54, 77, .28); transform: rotate(1.5deg); }
.card.ghost .ctl { display: none; }
.drop-indicator { position: absolute; z-index: 25; border-radius: 3px; background: var(--ai); pointer-events: none; }
.drop-indicator.ring { background: rgba(169, 91, 232, .1); border: 2px solid var(--ai); border-radius: 12px; }
.section-line { position: absolute; display: flex; align-items: center; justify-content: center; gap: 8px; height: 30px; }
.section-line::before, .section-line::after { content: ""; flex: 1; height: 1px; background: var(--section-line); }
.section-name { width: 180px; padding: 2px 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: var(--label); font-size: 11px; font-weight: 500; letter-spacing: .08em; text-align: center; text-transform: uppercase; outline: 0; }
span.section-name { width: auto; }
input.section-name:hover, input.section-name:focus { border-color: var(--section-line); }
.mini-btn { color: var(--blue); font-size: 12px; font-weight: 500; white-space: nowrap; }
.mini-btn.quiet { color: var(--label); opacity: 0; }
.section-line:hover .mini-btn.quiet, .mini-btn.quiet:focus-visible { opacity: 1; }
.add-section { position: absolute; left: 0; display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; transform: translateX(-50%); border-radius: 13px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--section-line); color: var(--label); font-size: 12px; white-space: nowrap; }
.add-section:hover { color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.legend { position: absolute; left: 0; display: flex; gap: 26px; transform: translateX(-50%); }
.legend-item { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--label); font-size: 11px; }
.legend-item i { width: 11px; height: 11px; border-radius: 50%; }
.sticky { position: absolute; z-index: 4; display: flex; flex-direction: column; background: var(--sticky); border-radius: 3px; box-shadow: 0 3px 10px rgba(38, 54, 77, .15); color: #2b2b1a; }
.sticky-head { height: 18px; flex: none; cursor: move; display: flex; justify-content: flex-end; }
.sticky-x { width: 18px; height: 18px; display: grid; place-items: center; opacity: 0; }
.sticky:hover .sticky-x, .sticky-x:focus-visible { opacity: .7; }
.sticky textarea { flex: 1; width: 100%; padding: 0 10px 10px; border: 0; background: transparent; resize: none; outline: 0; font-size: 12px; line-height: 1.5; color: inherit; user-select: text; }
.sticky-resize { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 55%, rgba(0, 0, 0, .25) 55%); }
.toolbar { position: absolute; left: 50%; bottom: 22px; z-index: 6; display: flex; align-items: center; gap: 4px; padding: 6px; transform: translateX(-50%); border-radius: 26px; background: #fff; color: var(--ink-2); box-shadow: 0 4px 20px rgba(38, 54, 77, .16); }
.editor.readonly .toolbar { display: none; }
.tool { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; }
.tool:hover { background: var(--soft); color: var(--ink); }
.tool-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }
.zoom { position: absolute; right: 18px; bottom: 22px; z-index: 6; display: flex; align-items: center; height: 38px; border-radius: 19px; background: var(--soft); color: var(--ink-2); }
.zoom button { min-width: 38px; height: 38px; font-size: 17px; }
.zoom .zoom-label { min-width: 54px; font-size: 13px; font-weight: 500; }
.panel { position: absolute; top: 66px; right: 14px; bottom: 14px; z-index: 8; width: 320px; max-width: calc(100vw - 28px); padding: 18px; overflow: auto; display: flex; flex-direction: column; gap: 14px; border-radius: 14px; background: #fff; color: var(--ink); box-shadow: 0 8px 34px rgba(38, 54, 77, .2); }
.panel.wide { width: 370px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-tabs { display: flex; border-bottom: 1px solid var(--line); }
.panel-tabs button { flex: 1; display: grid; place-items: center; padding: 8px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.panel-tabs .on { color: var(--ink); border-color: var(--ink); }
.color-row { display: flex; align-items: center; gap: 8px; }
.color-row input[type="color"] { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; flex: none; }
.color-name { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px; outline: 0; }
.color-name:hover, .color-name:focus { border-color: var(--line); }
.version { padding: 11px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.chip { padding: 1px 8px; border-radius: 9px; font-size: 11px; font-weight: 600; flex: none; }
.chip.internal { background: #e6f0fe; color: #1b4f96; }
.chip.external { background: #fdf0d8; color: #8a5208; }
.version-lines { margin: 2px 0; padding-left: 16px; font-size: 12px; color: var(--ink-2); }

/* Page view */
.page-view { display: grid; grid-template-columns: 1fr 170px; gap: 36px; color: var(--ink); }
.page-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; padding-right: 8px; }
.page-title-row { display: flex; align-items: center; gap: 12px; }
.page-title { flex: 1; min-width: 0; padding: 2px 6px; border: 1.5px solid transparent; border-radius: 6px; background: none; font-size: 26px; font-weight: 700; letter-spacing: -.01em; outline: 0; }
input.page-title:hover, input.page-title:focus { border-color: var(--line); }
.url-input { min-height: 34px; padding: 5px 10px; font-size: 13px; }
.url-link { font-size: 13px; overflow-wrap: anywhere; }
.page-block { border: 2px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; }
.page-block.drop-on { border-color: var(--ai); }
.page-block-head { display: flex; align-items: center; gap: 2px; }
.drag-handle { display: grid; place-items: center; color: var(--ink-3); cursor: grab; margin-left: -6px; }
.block-title { flex: 1; min-width: 0; padding: 2px 4px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--bc); font-size: 15px; font-weight: 600; outline: 0; }
input.block-title:hover, input.block-title:focus { border-color: var(--line); }
.color-dot { width: 16px; height: 16px; margin: 0 7px; border-radius: 50%; flex: none; }
.rte-box { position: relative; }
.rte-bar { display: none; gap: 2px; margin: 4px 0; }
.rte-box:focus-within .rte-bar { display: flex; flex-wrap: wrap; }
.rte-btn { min-width: 26px; height: 24px; border-radius: 5px; background: var(--soft); color: var(--ink-2); font-size: 12px; }
.rte-btn.word { padding: 0 8px; }
.rte-btn:hover { background: var(--soft-2); }
.rte { min-height: 24px; padding: 3px 4px; outline: 0; user-select: text; line-height: 1.55; overflow-wrap: anywhere; }
.rte:empty::before { content: attr(data-placeholder); color: var(--ink-3); }
.rte p, .rte h3, .rte h4, .rte ul, .rte ol { margin: 0 0 6px; }
.rte ul, .rte ol { padding-left: 20px; }
.rte-link { display: flex; gap: 8px; margin-top: 6px; }
.rte-link .input { min-height: 30px; padding: 3px 8px; }
.add-block { display: flex; align-items: center; gap: 7px; width: 100%; padding: 10px 14px; border: 2px dashed var(--line); border-radius: 12px; color: var(--ink-3); }
.add-block:hover { color: var(--blue); border-color: var(--blue); }
.comments { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.comment { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 8px 12px; border-radius: 9px; background: var(--soft); }
.comment p { width: 100%; overflow-wrap: anywhere; }
.page-side { position: relative; padding-top: 22px; }
.card.static { position: static; width: 100%; cursor: default; }

/* Audits */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat { display: flex; flex-direction: column; padding: 14px 16px; border-radius: 10px; background: var(--soft); }
.stat strong { font-size: 24px; font-weight: 700; }
.stat span { color: var(--ink-2); font-size: 12px; }
.stat.good strong { color: var(--good); }
.stat.warn strong { color: var(--warn); }
.stat.bad strong { color: var(--danger); }
.progress { height: 8px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--blue); transition: width .3s; }
.audit-card { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
.audit-card details { border-top: 1px solid var(--line); padding: 9px 0; }
.audit-card summary { cursor: pointer; font-weight: 500; }
.sev { display: inline-block; min-width: 56px; margin-right: 8px; padding: 1px 7px; border-radius: 9px; font-size: 11px; font-weight: 600; text-align: center; }
.sev.high { background: #fde6e6; color: #b4282d; }
.sev.medium { background: #fdf0d8; color: #8a5208; }
.sev.low { background: var(--soft); color: var(--ink-2); }
.audit-pages { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.audit-pages li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 4px 0; overflow-wrap: anywhere; }
.code { margin-left: auto; font-weight: 600; }
.code.s4, .code.s5, .code.s0 { color: var(--danger); }
.code.s3 { color: var(--warn); }

#print-sheet { display: none; }
@media print {
  body > *:not(#print-sheet) { display: none !important; }
  #print-sheet { display: block; }
  #print-sheet img { width: 100%; height: auto; }
}

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex: 1 1 100%; order: 3; overflow-x: auto; }
  .nav-item { width: auto; white-space: nowrap; }
  .logout { margin: 0 0 0 auto; width: auto; }
  .content { padding: 22px 16px 60px; }
  .actions { grid-template-columns: 1fr 1fr; gap: 12px; }
  .action { min-height: 100px; padding: 14px; font-size: 14px; }
  .cards { gap: 16px; grid-template-columns: 1fr; }
  .page-view { grid-template-columns: 1fr; }
  .page-side { display: none; }
  .dialog { padding: 20px 16px; }
  .gear { opacity: 1; }
  .save-state { display: none; }
  .project-name { width: 36vw; }
  .editor-head { padding: 8px 10px; gap: 6px; }
  .panel { top: 56px; }
}

/* Sections on page cards */
.card .block { cursor: pointer; }
.editor:has(.block.dragging) .viewport, .editor:has(.block.dragging) .block { cursor: grabbing; }
.card.static .block { cursor: pointer; }
.block:hover { filter: brightness(.93); }
.block.dragging { opacity: .3; }
.block-ghost { position: absolute; z-index: 30; margin: 0; pointer-events: none; opacity: .95; box-shadow: 0 8px 20px rgba(38, 54, 77, .3); }
.block-input { display: block; width: 100%; margin-top: 3px; padding: 4px 7px; border: 0; border-radius: 3px; color: #fff; font: 500 10.5px/13px var(--font); outline: 2px solid var(--ink); outline-offset: 1px; resize: none; overflow: hidden; height: 21px; }
.ctl.add-block-ctl { top: 15px; left: -10px; }
.side-block { display: block; width: 100%; text-align: left; }
.page-side .card.static { position: sticky; top: 8px; }
.page-block.active { border-color: var(--bc); }
.block-input::placeholder { color: rgba(255, 255, 255, .75); }
.page-block.draft { border-style: dashed; border-color: var(--bc); }

/* Section hover button, and renaming a section in place */
.block { position: relative; }
.block-edit { position: absolute; top: 50%; right: 2px; display: none; place-items: center; width: 18px; height: 18px; transform: translateY(-50%); border-radius: 4px; background: rgba(0, 0, 0, .28); color: #fff; }
.block-edit:hover { background: rgba(0, 0, 0, .5); }
.block:hover > .block-edit, .block-edit:focus-visible { display: grid; }
.block.block-ghost > .block-edit { display: none; }
@media (hover: none) { .block > .block-edit { display: grid; } }
.block.active-block { outline: 2px solid rgba(169, 91, 232, .55); outline-offset: 1px; }
.block-bar { position: fixed; z-index: 15; display: flex; align-items: center; gap: 2px; padding: 4px; border-radius: 10px; background: #fff; color: var(--ink-2); box-shadow: 0 4px 20px rgba(38, 54, 77, .16); }
.block-bar .tool { width: 34px; height: 34px; border-radius: 7px; }
.block-bar .tool.danger { color: var(--danger); }
.block-bar .color-dot { margin: 0; }
.popup:has(.swatch-grid) { min-width: 0; padding: 10px; }
.swatch-grid { display: grid; grid-template-columns: repeat(3, 26px); gap: 10px; }
.swatch-pick { position: relative; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; cursor: pointer; color: var(--ink-2); }
.swatch-pick:hover { filter: brightness(.93); }
.swatch-pick.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink-2); }
.swatch-pick.add:hover { background: var(--soft); filter: none; }
.swatch-pick.add input { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.block-bar .tool.on { background: var(--soft); color: var(--ink); }
.wire { display: block; }
.wire svg { display: block; width: 100%; height: auto; }
.block-wire { margin-top: 4px; pointer-events: none; }
.wire-menu { display: grid; gap: 8px; width: 216px; }
.wire-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.wire-pick { padding: 6px; border-radius: 5px; color: #2F80ED; }
.wire-pick[hidden] { display: none; }
.wire-pick:hover { background: var(--soft); }
.wire-pick.active { background: #2F80ED; color: #fff; }
.wire-clear { justify-content: center; }
.block-rename { cursor: text; }
.block-rename .block-input { margin: 0; padding: 0; height: 13px; background: transparent; outline: 0; }
.block-rename .block-input::selection { background: rgba(255, 255, 255, .35); }
.block-rename { outline: 2px solid var(--ink); outline-offset: 1px; }
.tag-ring { width: 14px; height: 14px; border: 2px solid var(--t); border-radius: 50%; flex: none; }
.tag-new-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); }
.tag-new { flex: 1; min-width: 0; border: 0; background: none; color: var(--ink); outline: 0; }
.tag-new-dot, .tag-new-go { display: none; flex: none; }
.tag-new-row.typing .tag-new-dot { display: block; width: 14px; height: 14px; border-radius: 50%; }
.tag-new-row.typing .tag-new-go { display: grid; place-items: center; color: var(--ink-2); }
.tag-mark { position: absolute; top: 4px; right: 5px; width: 9px; height: 9px; border: 2px solid var(--t); border-radius: 50%; background: #fff; pointer-events: none; }
.block:hover > .tag-mark { right: 23px; }
