@import url('/css/ai-chat.css');
body { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
#app { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ed-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; background: var(--surface); border-bottom: 1px solid var(--border); flex: none; }
.ed-toolbar .tools { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.ed-toolbar .sep { width: 1px; height: 30px; background: var(--border); margin: 0 4px; flex: none; }
.ed-toolbar .tbtn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 42px; flex: none; white-space: nowrap; padding: 6px 4px 5px; border: 0; background: none; color: var(--text-2); border-radius: 6px; cursor: pointer; font: inherit; font-size: 11px; font-weight: 500; }
.ed-toolbar .tbtn .i { width: 17px; height: 17px; }
.ed-toolbar .tbtn:hover { background: var(--surface-2); color: var(--text); }
.ed-toolbar .tbtn.active { background: var(--accent-soft); color: var(--accent-text); }
.ed-toolbar .tbtn:disabled { opacity: .4; cursor: default; }
.ed-toolbar .grow { flex: 1; }
.ed-toolbar .zoom { display: flex; align-items: center; gap: 2px; font-variant-numeric: tabular-nums; }
.ed-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 170px 1fr 260px; position: relative; }
.ed-pages { background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; }
.ed-pages .pthumb { position: relative; margin-bottom: 12px; cursor: pointer; text-align: center; border-radius: 6px; padding: 4px; }
.ed-pages .pthumb:hover { background: var(--surface-2); }
.ed-pages .pthumb.current { background: var(--accent-soft); }
.ed-pages .pthumb.current canvas { border-color: var(--accent); }
.ed-pages .pthumb canvas, .ed-pages .pthumb .blank { width: 100%; height: auto; display: block; background: #fff; border: 1px solid var(--border); border-radius: 3px; transition: transform .2s; }
.ed-pages .pthumb .blank { aspect-ratio: 1/1.414; display: grid; place-items: center; color: #999; font-size: 12px; }
.ed-pages .pthumb .lbl { font-size: 11px; color: var(--muted); }
.ed-pages .pthumb .acts { position: absolute; top: 6px; right: 6px; display: none; flex-direction: column; gap: 3px; }
.ed-pages .pthumb:hover .acts { display: flex; }
.ed-pages .pthumb .acts button { background: var(--surface); border: 1px solid var(--border); border-radius: 5px; padding: 2px; display: grid; cursor: pointer; color: var(--text); }
.ed-pages .pthumb.drop { box-shadow: 0 -3px 0 var(--accent); }
.ed-pages .rot-badge { position: absolute; bottom: 22px; left: 8px; background: var(--accent); color: var(--on-accent); font-size: 10px; border-radius: 4px; padding: 0 4px; }
.ed-canvas { background: var(--canvas-bg); overflow: auto; position: relative; }
.ed-canvas .pages { display: flex; flex-direction: column; align-items: safe center; gap: 22px; padding: 26px; } /* a wider page scrolls on its own instead of pushing the others off centre */
.page-wrap { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(16,24,40,.12), 0 0 0 1px rgba(16,24,40,.04); flex: none; }
.page-wrap canvas.pdf { position: absolute; inset: 0; }
.page-wrap .layer { position: absolute; inset: 0; }
.page-wrap .page-label { position: absolute; top: -18px; left: 0; font-size: 11px; color: var(--muted); }
.page-wrap.blank-page { display: grid; place-items: center; color: #aaa; }
.text-layer span { position: absolute; color: transparent; white-space: pre; cursor: text; transform-origin: 0 0; line-height: 1; border-radius: 2px; }
.text-layer span:hover { background: rgba(17,24,39,.10); outline: 1px dashed var(--accent); }
.text-layer { pointer-events: none; }
.mode-edittext .text-layer { pointer-events: auto; }
.forms-layer { pointer-events: none; }
.forms-layer > * { pointer-events: auto; position: absolute; box-sizing: border-box; background: rgba(37,99,235,.08); border: 1px solid rgba(37,99,235,.45); border-radius: 2px; font: 12px Arial, sans-serif; color: #000; padding: 0 3px; }
.forms-layer textarea { resize: none; min-height: 0; }
.forms-layer input[type=checkbox], .forms-layer input[type=radio] { margin: 0; accent-color: var(--accent); }
.obj-layer { cursor: default; }
.mode-create .obj-layer { cursor: crosshair; }
.obj { position: absolute; box-sizing: border-box; user-select: none; }
.obj.selected { outline: 1.5px solid var(--accent); outline-offset: 1px; }
.obj.text { white-space: pre; line-height: 1.2; padding: 0; min-width: 4px; min-height: 1em; cursor: move; color: #000; }
.obj.text[contenteditable="true"] { cursor: text; outline: 1.5px dashed var(--accent); user-select: text; }
.obj img { width: 100%; height: 100%; display: block; pointer-events: none; }
.obj.redact { background: #111; opacity: .82; }
.obj.redact::after { content: 'REDACT'; color: #fff; font: 700 10px Arial; position: absolute; top: 2px; left: 4px; opacity: .7; }
.obj.link { border: 1.5px dashed #2563eb; background: rgba(37,99,235,.08); }
.obj.note { width: 24px; height: 24px; background: #fbbf24; border-radius: 4px 4px 4px 0; display: grid; place-items: center; color: #78350f; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.obj svg { position: absolute; inset: 0; overflow: visible; width: 100%; height: 100%; }
.handle { position: absolute; width: 10px; height: 10px; background: #fff; border: 1.5px solid var(--accent); border-radius: 50%; z-index: 5; }
.handle.nw { left: -6px; top: -6px; cursor: nwse-resize; } .handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; } .handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }
.handle.n { left: calc(50% - 5px); top: -6px; cursor: ns-resize; } .handle.s { left: calc(50% - 5px); bottom: -6px; cursor: ns-resize; }
.handle.w { top: calc(50% - 5px); left: -6px; cursor: ew-resize; } .handle.e { top: calc(50% - 5px); right: -6px; cursor: ew-resize; }
.page-wrap.has-bg canvas.pdf { mix-blend-mode: multiply; }
.marquee { position: absolute; border: 1px solid var(--accent); background: rgba(37,99,235,.08); pointer-events: none; z-index: 6; }
.obj.locked.selected { outline-style: dashed; }
.obj .bd { position: absolute; pointer-events: none; box-sizing: border-box; }
.obj.rect, .obj.ellipse { overflow: visible; }
.obj.text .li { display: flex; }
.obj.text .li .mk { flex: none; white-space: pre; }
.obj.text .li .tx { flex: 1; min-width: 0; white-space: inherit; }
.mode-match .text-layer { pointer-events: auto; }
.mode-match .text-layer span, .mode-match .obj { cursor: copy; }
.draft-box { position: absolute; border: 1.5px dashed var(--accent); background: rgba(17,24,39,.05); pointer-events: none; }
.ed-props { background: var(--surface); border-left: 1px solid var(--border); overflow-y: auto; padding: 16px; }
.ed-props h4 { margin: 0 0 14px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.ed-props input[type=number], .ed-props select { height: 32px; }
.ed-props .row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.ed-props .row > label { flex: 1; font-size: 12.5px; }
.ed-props .seg { display: flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.ed-props .seg button { border: 0; border-right: 1px solid var(--border); background: var(--surface); padding: 5px 9px; cursor: pointer; color: var(--text-2); font-weight: 600; font-size: 12.5px; }
.ed-props .seg button:last-child { border-right: 0; }
.ed-props .seg button.on { background: var(--accent-soft); color: var(--accent-text); }
.ed-props .pp-sec { border-top: 1px solid var(--border); padding: 12px 0 4px; }
.ed-props h4 + .pp-sec { border-top: 0; padding-top: 0; }
.ed-props .pp-sec h5 { margin: 0 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ed-props .row { flex-wrap: wrap; }
.ed-props .color-field { display: grid; gap: 6px; }
.ed-props .cf-main { display: flex; align-items: center; gap: 6px; }
.ed-props .cf-main input[type=color] { width: 32px; height: 30px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); cursor: pointer; }
.ed-props .cf-main .hex { width: 78px; height: 30px; font: 12.5px ui-monospace, monospace; padding: 0 6px; }
.ed-props .cf-none { margin: 0; font-size: 12px; }
.ed-props .cf-sw { display: flex; flex-wrap: wrap; gap: 4px; }
.ed-props .cf-sw button { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.18); cursor: pointer; padding: 0; }
.ed-props .cf-sw button.on { box-shadow: 0 0 0 2px var(--accent); }
.ed-props .pp-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.ed-props .pp-ib { width: 32px; height: 32px; min-height: 32px; padding: 0; }
.ed-props .pp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; }
.ed-props .pp-actions .btn { justify-content: center; padding: 0 8px; font-size: 12.5px; }
.ed-props .row.stops input[type=color] { width: 32px; height: 30px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 6px; }
.ed-props .seg { flex-wrap: wrap; }
.font-picker { position: relative; width: 100%; }
.font-pick { width: 100%; height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 15px; }
.font-pick .fp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-pop { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; }
.fp-search { width: 100%; height: 32px; margin-bottom: 6px; }
.fp-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; }
.fp-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 8px 4px; }
.fp-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item:hover, .fp-item.on { background: var(--accent-soft); }
.fp-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.ed-props .tip { font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 11px 12px; margin-top: 16px; line-height: 1.5; }
.ed-start { flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.ed-start-inner { width: min(640px, 100%); text-align: center; }
.ed-start .dropzone { padding: 56px 20px; }
.ed-start-feats { display: flex; justify-content: center; gap: 22px; flex-wrap: wrap; margin-top: 20px; color: var(--muted); font-size: 13px; font-weight: 500; }
.ed-start-feats span { display: inline-flex; align-items: center; gap: 7px; }
.ed-busy { position: absolute; inset: 0; background: rgba(0,0,0,.25); display: grid; place-items: center; z-index: 30; }
.mode-edittext .obj-layer { pointer-events: none; }

/* ---------- Responsive editor ---------- */
.panel-toggle, .ed-scrim { display: none; }
.ed-toolbar .btn.more .ic { display: none; }
.obj, .handle { touch-action: none; }
.mode-create .obj-layer { touch-action: none; }

@media (max-width: 1000px) {
  .ed-body { grid-template-columns: 1fr 240px; }
  .pages-toggle { display: flex; }
  .ed-pages { position: absolute; z-index: 25; top: 0; bottom: 0; left: 0; width: 190px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .ed-body.show-pages .ed-pages { transform: none; }
  .ed-body.show-pages .ed-scrim { display: block; }
  .ed-scrim { position: absolute; inset: 0; z-index: 20; background: rgba(16,24,40,.35); }
}

@media (max-width: 760px) {
  .ed-body { grid-template-columns: 1fr; }
  .props-toggle { display: flex; }
  .ed-props { position: absolute; z-index: 25; left: 0; right: 0; bottom: 0; max-height: 60%; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .2s ease; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .ed-props::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: -4px auto 14px; }
  .ed-body.show-props .ed-props { transform: none; }
  .ed-body.show-props .ed-scrim { display: block; }
  .ed-toolbar { padding: 4px 6px 0; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
  .ed-toolbar .tools { order: 2; flex-basis: 100%; border-top: 1px solid var(--border); padding: 2px 0; margin: 0 -6px; padding-left: 4px; }
  .ed-toolbar .tools > .sep:first-of-type { display: none; }
  .ed-toolbar .tbtn { min-width: 44px; font-size: 10.5px; }
  .ed-toolbar .zoom > span, .ed-toolbar .zoom .fit { display: none; }
  .ed-toolbar .btn .lbl { display: none; }
  .ed-toolbar .btn.more .ic { display: inline-flex; }
  .ed-toolbar .btn.more, .ed-toolbar .btn.dl { width: 38px; padding: 0; }
  .ed-toolbar .btn.dl { margin-left: 2px !important; }
  .ed-toolbar .sep { margin: 0 2px; }
  .ed-canvas .pages { padding: 14px 10px; gap: 16px; }
  .ed-start { padding: 18px 14px; }
  .ed-start h1 { font-size: 24px; }
  .ed-start-feats { gap: 10px 16px; }
}

/* Object layer only captures clicks on objects (or while creating), so form fields underneath stay usable */
.obj-layer { pointer-events: none; }
.obj-layer > .obj, .mode-create .obj-layer { pointer-events: auto; }
.obj-layer > .obj.line { pointer-events: none; }
@media (hover: none) { .ed-pages .pthumb .acts { display: flex; } }

/* Landscape phones: keep one toolbar row, settings become a sheet so the page gets the width */
@media (pointer: coarse) and (max-height: 520px) and (min-width: 761px) {
  .ed-body { grid-template-columns: 1fr; }
  .props-toggle { display: flex; }
  .ed-props { position: absolute; z-index: 25; left: max(0px, calc(50% - 300px)); right: max(0px, calc(50% - 300px)); bottom: 0; max-height: 85%; border-left: 0; border-top: 1px solid var(--border);
    border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); transform: translateY(105%); transition: transform .2s ease; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .ed-body.show-props .ed-props { transform: none; }
  .ed-body.show-props .ed-scrim { display: block; }
  .ed-toolbar { padding: 2px 8px; }
  .ed-toolbar .tbtn { padding: 4px 4px 3px; }
  .ed-toolbar .zoom > span, .ed-toolbar .zoom .fit, .ed-toolbar .btn .lbl { display: none; }
  .ed-toolbar .btn.more .ic { display: inline-flex; }
  .ed-toolbar .btn.more, .ed-toolbar .btn.dl { width: 44px; padding: 0; }
}

/* ---------- AI side panel ---------- */
.ed-main { flex: 1; min-height: 0; display: flex; position: relative; }
.ed-main > .ed-body { flex: 1; min-width: 0; }
.ed-toolbar .tbtn.ai-toggle { color: var(--accent-text); }
.ed-toolbar .tbtn.ai-toggle.active { background: var(--accent-soft); }
.ed-ai { flex: none; display: flex; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); position: relative; z-index: 4; }
.ed-ai-rail { display: none; width: 48px; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
.ed-ai.closed .ed-ai-rail { display: flex; }
.ed-ai.closed .ed-ai-panel { display: none; }
.ed-ai-railbtn { width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; border-radius: 10px; color: var(--text-2); cursor: pointer; }
.ed-ai-railbtn:hover { background: var(--surface-2); color: var(--text); }
.ed-ai-railbtn.main { background: var(--accent); color: var(--on-accent); margin-bottom: 6px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.14); }
.ed-ai-railbtn.main:hover { background: var(--accent-hover); color: var(--on-accent); }
.ed-ai-panel { width: 384px; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.ed-ai-grip { display: none; }
.ed-ai-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 8px 8px 4px 14px; }
.ed-ai-brand { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.ed-ai-credits { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 1px 8px; white-space: nowrap; }
.ed-ai-credits[hidden] { display: none; }
.ed-ai-logo { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); }
.ed-ai-hbtn { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: none; border-radius: 9px; color: var(--text-2); cursor: pointer; }
.ed-ai-hbtn:hover { background: var(--surface-2); color: var(--text); }
.ed-ai-hbtn[hidden] { display: none; }
.ed-ai-tabs { flex: none; display: flex; gap: 2px; margin: 4px 12px 0; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); }
.ed-ai-tab { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; min-width: 0; }
.ed-ai-tab:hover { color: var(--text); }
.ed-ai-tab.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }
.ed-ai-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ed-ai-body > .cx { flex: 1; height: auto; }
.ed-ai-loading { margin: auto; }
.ed-ai-pane { flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; }
.ed-ai-pane .field { margin: 0; }
.ed-ai-hint { margin: 0; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.ed-ai-fine { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.45; }
.ed-ai-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ed-ai-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ed-ai-input { min-height: 0; resize: vertical; font-size: 14.5px; line-height: 1.5; }
.ed-ai-ctx { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: var(--surface-2); display: grid; gap: 6px; }
.ed-ai-ctx p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.45; }
.ed-ai-ctx blockquote { margin: 0; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 140px; overflow-y: auto; }
.ed-ai-ctx-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ed-ai-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.ed-ai-quick .cx-chip { padding: 6px 11px; font-size: 12.5px; min-height: 32px; }
.ed-ai-resultcard { border: 1px solid var(--accent); border-radius: 12px; padding: 10px 12px; display: grid; gap: 8px; background: var(--surface); box-shadow: 0 0 0 3px var(--ring); }
.ed-ai-resultcard .ed-ai-ctx-label { color: var(--accent-text); }
.ed-ai-result { min-height: 0; resize: vertical; font-size: 14px; line-height: 1.5; }
.ed-ai-upgrade { border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: grid; gap: 8px; justify-items: start; background: var(--surface); }
.ed-ai-upgrade p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.ed-ai-upgrade-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.ed-ai-pane.builder { padding-bottom: 0; }
.ed-ai-sticky { position: sticky; bottom: 0; margin: auto -14px 0; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); display: grid; gap: 4px; }
.ed-ai-state { font-size: 12px; color: var(--muted); }
.ed-ai-state.pending { color: var(--warning); font-weight: 600; }
.ed-ai-scrim { display: none; }

/* Document builder (compact) */
.bld { display: grid; gap: 10px; }
.bld .card { padding: 12px; border-radius: 12px; }
.bld-meta { display: grid; gap: 8px; }
.bld .field { margin: 0; }
.bld-meta summary { cursor: pointer; font-weight: 600; font-size: 13px; padding: 4px 0; }
.bld-meta details[open] > * + * { margin-top: 8px; }
.bld-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bld-blocks { display: grid; gap: 8px; }
.bld-block { display: grid; gap: 6px; }
.bld-block textarea { resize: vertical; min-height: 0; }
.bld-block-head { display: flex; align-items: center; justify-content: space-between; }
.bld-block-type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bld-block-actions { display: flex; gap: 0; }
.bld-block-actions .btn { width: 30px; height: 30px; min-height: 30px; }
.bld-row { display: flex; gap: 6px; }
.bld-row input { flex: 1; min-width: 0; }
.bld-row select { width: auto; }
.bld-table { display: grid; gap: 6px; }
.bld-add { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 4px 0 8px; }
.bld-add .chip { height: 32px; padding: 0 10px; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 99px; color: var(--text-2); font-weight: 600; cursor: pointer; }
.bld-add .chip:hover { border-color: var(--accent); color: var(--accent-text); }
.bld .check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; min-height: 30px; }
.bld .small { font-size: 12.5px; }

@media (max-width: 1180px) { .ed-ai-panel { width: 340px; } }
/* AI panel open on laptop widths: page thumbnails become a drawer so the page keeps its room */
@media (min-width: 1001px) and (max-width: 1440px) {
  body.ai-open .ed-body { grid-template-columns: 1fr 240px; }
  body.ai-open .pages-toggle { display: flex; }
  body.ai-open .ed-pages { position: absolute; z-index: 25; top: 0; bottom: 0; left: 0; width: 190px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  body.ai-open .ed-body.show-pages .ed-pages { transform: none; }
  body.ai-open .ed-body.show-pages .ed-scrim { display: block; position: absolute; inset: 0; z-index: 20; background: rgba(16,24,40,.35); }
}
@media (max-width: 1000px) { .ed-ai-panel { width: 320px; } .ed-ai-tab span { display: none; } .ed-ai-tab.on span { display: inline; } }
@media (max-width: 760px) {
  .ed-ai { position: absolute; z-index: 27; left: 0; right: 0; bottom: 0; height: 82%; border-left: 0; border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg);
    transform: translateY(105%); visibility: hidden; transition: transform .22s ease, visibility .22s; overflow: hidden; }
  .ed-ai.open { transform: none; visibility: visible; }
  .ed-ai.closed .ed-ai-rail { display: none; }
  .ed-ai.closed .ed-ai-panel { display: flex; }
  .ed-ai-panel { width: 100%; }
  .ed-ai-grip { display: block; flex: none; width: 40px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 8px auto 0; }
  .ed-ai-head { padding-top: 4px; }
  .ed-ai-scrim.show { display: block; position: absolute; inset: 0; z-index: 26; background: rgba(16,24,40,.35); }
  .ed-ai-tab span { display: inline; }
}
@media (pointer: coarse) and (max-height: 520px) and (min-width: 761px) { .ed-ai-panel { width: 320px; } }

.ed-landing { max-width: 960px; margin: 48px auto 0; text-align: left; }
