/* Dashboard shell, library screens and editor. */

/* top bar */
.top { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 28px; padding: 0 28px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; color: var(--text); }
.brand .mark { width: 32px; height: 32px; border-radius: 8px; background: var(--navy); display: grid; place-items: center; }
.brand .mark img { width: 19px; height: 19px; display: block; }
.brand .word { font-size: 15px; white-space: nowrap; }
.brand .word b { font-weight: 800; letter-spacing: 0; }
.brand .word span { font-weight: 500; color: var(--text-2); margin-left: 3px; }
.tnav { display: flex; gap: 2px; }
.tnav button { height: 36px; display: flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-weight: 600; color: var(--text-3); }
.tnav button:hover { color: var(--text); background: #f7f8fa; }
.tnav button.active { color: var(--text); background: var(--gray); }
.tnav .n { font-size: 13px; color: var(--text-3); }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.search { width: 240px; height: 40px; margin: 0; display: flex; align-items: center; gap: 8px; padding: 0 12px; background: var(--gray); border-radius: 10px; color: var(--text-3); border: 1px solid transparent; }
.search:focus-within { background: #fff; border-color: var(--navy); color: var(--text); }
.search input[type=search] { flex: 1; min-width: 0; height: auto; margin: 0; padding: 0; border: 0; background: none; font-size: 14px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 36px 28px 80px; }
.sh { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 20px; font-weight: 700; }
.sh .n { color: var(--text-3); }
.sh .right { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; }
.none { padding: 28px 0; color: var(--text-3); }
.selbar { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border-radius: 8px; background: var(--navy-50); color: var(--navy); font-size: 13px; font-weight: 600; }
.selbar button { height: 28px; padding: 0 10px; border: 0; border-radius: 6px; background: #fff; color: var(--navy); font-size: 13px; font-weight: 600; }
.selbar button.danger { color: var(--red); }
.check { position: relative; display: inline-grid; place-items: center; margin: 0; }
.check input { width: 18px; height: 18px; }

/* documents */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(262px, 1fr)); gap: 20px; }
.dcard { position: relative; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; cursor: pointer; background: #fff; transition: border-color 0.15s, box-shadow 0.15s; }
.dcard:hover { border-color: var(--line-2); box-shadow: 0 8px 24px rgba(25, 31, 40, 0.08); }
.dcard.is-selected { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.dthumb { position: relative; height: 216px; background: var(--gray); overflow: hidden; display: flex; justify-content: center; padding-top: 20px; }
.dthumb img, .dthumb .ph { width: 76%; height: auto; align-self: flex-start; background: #fff; box-shadow: 0 0 0 1px rgba(25, 31, 40, 0.05), 0 4px 14px rgba(25, 31, 40, 0.08); }
.dthumb .ph { aspect-ratio: 1 / 1.414; }
.dbody { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.dbody .t { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbody .m { display: flex; justify-content: space-between; margin-top: 3px; font-size: 14px; color: var(--text-3); }
.dcard .more { position: absolute; top: 10px; right: 10px; background: #fff; box-shadow: 0 1px 4px rgba(25, 31, 40, 0.16); opacity: 0; transition: opacity 0.12s; }
.dcard .pick { position: absolute; top: 12px; left: 12px; width: 30px; height: 30px; border-radius: 8px; background: #fff; box-shadow: 0 1px 4px rgba(25, 31, 40, 0.16); opacity: 0; transition: opacity 0.12s; }
.dcard:hover .more, .dcard:focus-within .more, .dcard:hover .pick, .dcard:focus-within .pick, .picking .dcard .pick, .dcard.is-selected .pick { opacity: 1; }
.empty-card { border: 1.5px dashed var(--line-2); border-radius: 14px; padding: 48px 20px; text-align: center; color: var(--text-2); }
.empty-card .btn { margin-top: 14px; }
.done-sec { margin-top: 52px; }
.clist { border-top: 1px solid var(--line); }
.crow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 160px 64px auto; align-items: center; column-gap: 20px; height: 68px; padding: 0 8px 0 6px; border-bottom: 1px solid var(--line); cursor: pointer; }
.crow:hover { background: #fafbfc; }
.crow.is-selected { background: var(--navy-50); }
.crow .t { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; min-width: 0; }
.crow .t span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow .t svg { color: var(--green); width: 20px; height: 20px; }
.crow .c { font-size: 15px; color: var(--text-2); white-space: nowrap; }
.crow .acts { display: flex; gap: 4px; align-items: center; }
.crow .check { opacity: 0; transition: opacity 0.12s; }
.crow:hover .check, .crow:focus-within .check, .crow.is-selected .check, .picking .crow .check { opacity: 1; }
body.editing .toast { bottom: 80px; }
body.dropping::after { content: ""; position: fixed; inset: 60px 0 0; z-index: 15; border: 2px dashed var(--navy); background: rgba(238, 241, 247, 0.6); pointer-events: none; }

/* signatures & stamps */
.md { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 40px; align-items: start; }
.alist { position: sticky; top: 96px; }
.anew { width: 100%; height: 48px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.anew:hover, .anew.active { background: var(--navy-50); border-color: var(--navy-50); }
.agroup { display: flex; align-items: center; justify-content: space-between; font-size: 14px; font-weight: 700; color: var(--text-2); margin: 22px 10px 8px; }
.aitem { position: relative; display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 10px; border-radius: 10px; cursor: pointer; }
.aitem:hover { background: #f9fafb; }
.aitem.active { background: var(--gray); }
.aitem .check { opacity: 0; }
.aitem:hover .check, .aitem.is-selected .check, .picking .aitem .check { opacity: 1; }
.aitem .th { width: 72px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.aitem .th img { max-width: 64px; max-height: 34px; object-fit: contain; }
.aitem b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stagebox { height: 340px; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.stagebox img { max-width: 80%; max-height: 80%; object-fit: contain; }
.ahead { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 18px; }
.ahead h2 { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.ahead .acts { display: flex; gap: 8px; flex: none; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin: 0; }
.facts div { padding-top: 16px; }
.facts dt { font-size: 13px; color: var(--text-3); margin-bottom: 2px; }
.facts dd { margin: 0; font-weight: 600; }

/* asset creator */
.tabs-s { display: inline-flex; padding: 3px; background: var(--gray); border-radius: 10px; margin-bottom: 16px; }
.tabs-s button { height: 34px; padding: 0 14px; border: 0; border-radius: 8px; background: none; font-size: 14px; font-weight: 600; color: var(--text-3); }
.tabs-s button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(25, 31, 40, 0.12); }
.pad { position: relative; aspect-ratio: 900 / 340; border: 1px solid var(--line-2); border-radius: 16px; background: #fff; overflow: hidden; touch-action: none; cursor: crosshair; }
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pad .base { position: absolute; left: 6%; right: 6%; bottom: 27%; border-bottom: 1.5px solid var(--line); pointer-events: none; }
.pad .ph { position: absolute; left: 0; right: 0; top: 44%; text-align: center; color: var(--text-3); font-size: 16px; pointer-events: none; }
.pad.inked .ph { display: none; }
.pngdrop { margin: 0; aspect-ratio: 900 / 340; border: 1.5px dashed var(--line-2); border-radius: 16px; display: grid; place-items: center; cursor: pointer; color: var(--text-2); background: #fafbfc; overflow: hidden; }
.pngdrop:hover { border-color: var(--navy); color: var(--navy); }
.pngdrop img { max-width: 70%; max-height: 82%; object-fit: contain; }
.pngdrop .cta { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.stampprev { aspect-ratio: 900 / 340; border: 1px solid var(--line); border-radius: 16px; display: grid; place-items: center; background: #fff; }
.stampprev canvas { height: 78%; aspect-ratio: 1; }
.kind-toggle { display: inline-flex; padding: 3px; background: var(--gray); border-radius: 10px; margin-top: 12px; }
.kind-toggle button { height: 30px; padding: 0 12px; border: 0; border-radius: 8px; background: none; font-size: 13px; font-weight: 600; color: var(--text-3); }
.kind-toggle button.active { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgba(25, 31, 40, 0.12); }
.newform { display: flex; align-items: flex-end; gap: 10px; margin-top: 18px; }
.newform label { flex: 1; margin: 0; }
.newform .btn, .newform .primary { height: 44px; flex: none; }
dialog.wide { width: min(640px, calc(100vw - 32px)); }

/* trash */
.trow { display: grid; grid-template-columns: 30px minmax(0, 1fr) 100px 120px auto; align-items: center; column-gap: 20px; height: 64px; padding: 0 6px; border-bottom: 1px solid var(--line); }
.trow.is-selected { background: var(--navy-50); }
.trow .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow .c { color: var(--text-2); }

/* menu */
.menu { position: fixed; z-index: 80; min-width: 200px; background: #fff; border-radius: 12px; box-shadow: var(--shadow-float); padding: 6px; }
.menu button, .menu a { width: 100%; height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; text-align: left; display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--gray); }
.menu svg.i { color: var(--text-3); width: 17px; height: 17px; }
.menu .danger, .menu .danger svg.i { color: var(--red); }

/* dialogs used by the dashboard */
.summary { margin: 16px 0; padding: 16px; background: var(--gray); border-radius: 10px; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.summary dt { color: var(--text-3); }
.summary dd { margin: 0; font-weight: 600; text-align: right; }
.dialog-actions.split { display: grid; grid-template-columns: 1fr 2fr; }
.managed-item-name { font-weight: 600; color: var(--text); }
.tline { list-style: none; margin: 16px 0 0; padding: 0; }
.tline li { position: relative; padding: 0 0 16px 24px; }
.tline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--navy); }
.tline li::after { content: ""; position: absolute; left: 8px; top: 20px; bottom: 2px; width: 1px; background: var(--line-2); }
.tline li:last-child::after { display: none; }
.tline b { display: block; font-weight: 600; }
.tline span { display: block; font-size: 14px; color: var(--text-2); }
.hash { display: block; font: 500 12.5px/1.5 ui-monospace, Menlo, monospace; color: var(--text-3); letter-spacing: 0; overflow-wrap: anywhere; }

/* links dialog */
#links-dialog { width: min(520px, calc(100vw - 32px)); }
.link-note { font-size: 14px; }
#created-link { margin-top: 18px; padding: 16px; border-radius: 12px; background: var(--gray); }
#created-link label { margin-top: 0; }
#created-link small { display: block; margin-top: 8px; color: var(--text-2); }
.issued-links { margin-top: 24px; border-top: 1px solid var(--line); padding-top: 18px; }
.issued-links h3 { font-size: 15px; margin-bottom: 8px; }
.issued-link { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.issued-link strong { display: block; font-weight: 600; }
.issued-link small { color: var(--text-3); font-size: 13px; }

/* ---------- editor ---------- */
body.editing .top, body.editing #content { display: none; }
.editor { min-height: 100vh; background: var(--gray); }
.etop { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: 8px; padding: 0 16px 0 12px; background: #fff; border-bottom: 1px solid var(--line); }
.etop h1 { margin-left: 2px; font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 6px; font-size: 13px; font-weight: 600; flex: none; }
.chip.done { background: var(--green-bg); color: var(--green); }
.stepper { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; }
.step { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font-size: 14px; font-weight: 600; color: var(--text-3); white-space: nowrap; }
.step:hover { background: var(--gray); }
.step .no { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; box-shadow: inset 0 0 0 1.5px #c5cbd3; }
.step .no svg { width: 13px; height: 13px; stroke-width: 2.4; }
.step.done { color: var(--text-2); }
.step.done .no { background: var(--navy-50); color: var(--navy); box-shadow: none; }
.step.cur { color: var(--text); }
.step.cur .no { background: var(--navy); color: #fff; box-shadow: none; }
.step-line { width: 20px; height: 1.5px; background: var(--line-2); }
.eact { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.doc-col { --page-w: 680px; padding: 32px 24px 120px; margin: 0 316px 0 300px; display: flex; justify-content: center; }
.doc-col .pdf-panel { width: min(100%, calc(var(--page-w) * var(--zoom, 1))); }
.editor.wide-zoom .doc-col .pdf-panel { width: calc(var(--page-w) * var(--zoom, 1)); max-width: none; }

/* floating panels */
.tpanel, .rpanel { position: fixed; top: 84px; z-index: 8; width: 252px; max-height: calc(100vh - 108px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: var(--shadow-float); }
.tpanel { left: 24px; }
.rpanel { right: 24px; width: 268px; }
.tpanel section, .rpanel section { padding: 16px 14px; }
.tpanel section + section, .rpanel section + section { border-top: 1px solid var(--line); }
.tpanel h3, .rpanel h3 { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 4px 10px; font-size: 14px; font-weight: 700; }
.lnk { border: 0; background: none; padding: 0; font-size: 13px; font-weight: 600; color: var(--navy); }
.lnk:hover { text-decoration: underline; text-underline-offset: 3px; }
.pr { width: 100%; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 10px; background: none; text-align: left; }
.pr:hover { background: #f9fafb; }
.pr.active { background: var(--gray); }
.av { width: 24px; height: 24px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.pr b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pr .ct { margin-left: auto; font-size: 13px; color: var(--text-3); white-space: nowrap; }
.fold { width: 100%; height: 38px; margin-top: 2px; border: 0; border-radius: 10px; background: none; display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.fold:hover { background: #f9fafb; color: var(--text); }
.fold svg.i { width: 15px; height: 15px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tiles .field-tool { height: 68px; flex-direction: column; justify-content: center; gap: 6px; padding: 0; font-size: 13px; font-weight: 600; }
.tiles .field-tool svg { width: 22px; height: 22px; color: var(--text); }
.grp { margin: 16px 4px 6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.rows { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.tiles + .rows { margin-top: 6px; }
.field-tool { height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 13.5px; font-weight: 500; white-space: nowrap; cursor: grab; }
.field-tool svg { width: 17px; height: 17px; color: var(--text-2); flex: none; }
.field-tool:hover { border-color: var(--line-2); background: #fafbfc; }
.field-tool.active { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); background: var(--navy-50); color: var(--navy); }
.field-tool.active svg { color: var(--navy); }
.mine3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mine3 button { height: 52px; border: 1px solid var(--line); border-radius: 10px; background: #fff; display: grid; place-items: center; cursor: grab; overflow: hidden; padding: 4px; }
.mine3 button:hover { border-color: var(--line-2); }
.mine3 button.is-dragging { opacity: 0.4; }
.mine3 img { max-width: 100%; max-height: 40px; object-fit: contain; pointer-events: none; }
.mine3 .addm { color: var(--text-3); border-style: dashed; cursor: pointer; }
.frac { font-size: 13px; font-weight: 600; color: var(--text-3); }
.tbar { height: 6px; border-radius: 3px; background: var(--gray); overflow: hidden; margin: 0 4px 10px; }
.tbar i { display: block; height: 100%; background: var(--green); border-radius: 3px; transition: width 0.2s; }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; }
.checks li:hover { background: #f9fafb; }
.checks li svg.i { width: 18px; height: 18px; color: #c5cbd3; }
.checks li.ok { color: var(--text-3); }
.checks li.ok svg.i { color: var(--green); }
.checks li.cur { background: var(--gray); color: var(--text); font-weight: 600; }
.checks li small { margin-left: auto; color: var(--text-3); font-size: 12px; }
.tfoot { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; }
.tfoot > * { height: 44px; }
.info dl { margin: 0; display: grid; gap: 12px; }
.info dt { font-size: 13px; color: var(--text-3); }
.info dd { margin: 2px 0 0; font-weight: 600; }

/* outline (right panel) */
.outline-party + .outline-party { margin-top: 12px; }
.outline-party-heading { display: flex; align-items: center; gap: 8px; margin: 0 4px 4px; font-size: 13px; font-weight: 700; color: var(--text-2); }
.outline-party-heading i { width: 8px; height: 8px; border-radius: 50%; background: var(--outline-color); }
.outline-party-heading span { margin-left: auto; color: var(--text-3); font-weight: 600; }
.outline-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 10px; border: 0; border-radius: 10px; background: none; text-align: left; }
.outline-item:hover { background: #f9fafb; }
.outline-item.selected { background: var(--gray); }
.outline-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: color-mix(in srgb, var(--outline-color) 10%, #fff); color: var(--outline-color); flex: none; }
.outline-icon svg { width: 16px; height: 16px; }
.outline-item-text { min-width: 0; display: flex; flex-direction: column; }
.outline-item-text strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.outline-item-text small { font-size: 12px; color: var(--text-3); }
.outline-page { margin-left: auto; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.outline-empty-party { margin: 0 4px 6px; font-size: 13px; color: var(--text-3); }
.props label { margin: 12px 0; font-size: 13px; }
.props input:not([type=checkbox]), .props select { height: 40px; font-size: 14px; }
.props .row-between { display: flex; align-items: center; justify-content: space-between; margin: 14px 0; font-size: 13px; font-weight: 600; color: var(--text-2); }
.props .back { display: inline-flex; align-items: center; gap: 4px; }

/* options editor */
.choices-heading { display: flex; justify-content: space-between; margin: 14px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.choices-heading small { color: var(--text-3); }
.choice-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto auto; align-items: start; gap: 6px; margin-bottom: 6px; }
.choice-indicator { width: 14px; height: 14px; margin-top: 13px; border: 1.5px solid var(--line-2); border-radius: 50%; font-size: 10px; line-height: 11px; text-align: center; color: var(--text-3); }
.choice-indicator.is-square { border-radius: 3px; }
.choice-indicator.is-number { border: 0; font-weight: 700; }
.choice-input input { margin: 0; height: 40px; }
.choice-error { display: block; margin-top: 4px; font-size: 12px; color: var(--red); }
.choice-order { display: flex; flex-direction: column; }
.choice-order button, .choice-remove { width: 26px; height: 20px; border: 0; background: none; color: var(--text-3); display: grid; place-items: center; padding: 0; border-radius: 6px; }
.choice-remove { height: 40px; }
.choice-order button:hover, .choice-remove:hover { background: var(--gray); color: var(--text); }
.choice-order svg, .choice-remove svg { width: 14px; height: 14px; }
.add-choice { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--navy); font-size: 13px; font-weight: 600; }
.add-choice svg { width: 15px; height: 15px; }
.add-choice:hover { background: var(--navy-50); }

/* page pill */
.pagepill { position: fixed; bottom: 20px; left: calc(300px + (100vw - 616px) / 2); transform: translateX(-50%); z-index: 9; display: flex; align-items: center; gap: 2px; padding: 4px; background: #fff; border-radius: 10px; box-shadow: var(--shadow-float); font-size: 13px; font-weight: 600; color: var(--text-2); }
.pagepill > span { padding: 0 6px; min-width: 52px; text-align: center; }
.pagepill .icon-btn { width: 30px; height: 30px; }
.pagepill i.bar { width: 1px; height: 16px; background: var(--line); margin: 0 2px; }

/* fields and placements on the page */
.pdf-sheet.drawing-field { cursor: crosshair; }
.pdf-sheet.asset-drop-target { outline: 2px dashed var(--navy); outline-offset: 4px; }
.form-field {
  --party-color: var(--navy);
  position: absolute; z-index: 2; display: flex; align-items: center; justify-content: flex-start; padding: 0 6px; overflow: visible;
  font-size: clamp(9px, 1.05vw, 12px); font-weight: 600; line-height: 1; color: var(--party-color); white-space: nowrap;
  background: color-mix(in srgb, var(--party-color) 9%, #fff); border: 1px solid color-mix(in srgb, var(--party-color) 45%, #fff); border-radius: 4px;
  cursor: move; user-select: none; touch-action: none;
}
.form-field > span { display: flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; }
.form-field > span > span { overflow: hidden; text-overflow: ellipsis; }
.form-field svg { width: 1.1em; height: 1.1em; flex: none; }
.form-field .req { color: var(--red); }
.form-field:hover { background: color-mix(in srgb, var(--party-color) 15%, #fff); }
.form-field.selected { border: 2px solid var(--party-color); z-index: 5; }
.form-field img { width: 100%; height: 100%; object-fit: contain; }
.form-field.has-image { background: transparent; border-color: transparent; }
.form-field.fill-field { cursor: pointer; }
.form-field.fill-field:not(.is-filled) { border-style: dashed; }
.form-field.fill-field.is-filled { background: #fff; color: var(--text); }
.form-field.other-party { --party-color: #b0b8c1 !important; color: #8b95a1; cursor: default; }
.form-field.target { border: 2px solid var(--party-color); box-shadow: 0 0 0 4px color-mix(in srgb, var(--party-color) 18%, transparent); }
.field-resize { position: absolute; right: -5px; bottom: -5px; width: 9px; height: 9px; background: #fff; border: 2px solid var(--party-color); border-radius: 2px; cursor: nwse-resize; display: none; }
.form-field.selected .field-resize { display: block; }
.character-cells { display: grid !important; width: 100%; height: 100%; gap: 0; }
.character-cells i { border-right: 1px solid color-mix(in srgb, var(--party-color) 35%, #fff); display: grid; place-items: center; font-style: normal; color: var(--text); }
.character-cells i:last-child { border-right: 0; }
.field-drawing { position: absolute; z-index: 6; border: 2px dashed var(--navy); background: rgba(28, 41, 76, 0.06); pointer-events: none; }
.placement { position: absolute; z-index: 3; cursor: move; touch-action: none; border-radius: 4px; }
.placement:hover { outline: 1px dashed var(--line-2); }
.placement.selected { outline: 2px solid var(--navy); outline-offset: 3px; }
.placement img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; mix-blend-mode: multiply; }
.fpop { position: absolute; top: calc(100% + 8px); left: -2px; z-index: 6; cursor: default; display: flex; align-items: center; gap: 2px; padding: 4px; background: #fff; border-radius: 10px; box-shadow: var(--shadow-float); font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; line-height: 1; }
.fpop button { height: 32px; padding: 0 10px; border: 0; border-radius: 7px; background: none; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.fpop button:hover { background: var(--gray); }
.fpop .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.fpop i.bar { width: 1px; height: 18px; background: var(--line); margin: 0 2px; }
.fpop svg { width: 15px; height: 15px; color: var(--text-3); }
.fpop .del, .fpop .del svg { color: var(--red); }
.sw { width: 30px; height: 18px; border-radius: 9px; background: #d1d6db; position: relative; transition: background 0.15s; display: inline-block; flex: none; }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.sw.on { background: var(--navy); }
.sw.on::after { transform: translateX(12px); }
.switch-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: none; padding: 0; font-size: 13px; font-weight: 600; color: var(--text-2); }

/* participants step */
.psheet { position: fixed; inset: 60px 0 0; z-index: 12; background: rgba(25, 31, 40, 0.28); display: grid; place-items: start center; padding-top: 72px; }
.pcard { width: min(460px, calc(100vw - 32px)); background: #fff; border-radius: 16px; box-shadow: 0 24px 64px rgba(25, 31, 40, 0.24); padding: 24px; }
.pcard h2 { margin-bottom: 18px; font-size: 20px; font-weight: 700; }
.prows { max-height: 360px; overflow: auto; }
.prow { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 36px; align-items: center; gap: 12px; height: 60px; border-bottom: 1px solid var(--line); }
.prow .av { width: 26px; height: 26px; font-size: 13px; }
.prow input[type=text] { height: 40px; margin: 0 0 0 -10px; border-color: transparent; font-weight: 600; }
.prow input[type=text]:hover { border-color: var(--line); }
.prow input[type=text]:focus { border-color: var(--navy); }
.prow .ct { font-size: 14px; color: var(--text-3); white-space: nowrap; }
.addp { width: 100%; height: 48px; margin-top: 12px; border: 0; border-radius: 10px; background: none; color: var(--navy); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.addp:hover { background: var(--navy-50); }
.pcard footer { margin-top: 16px; }
.pcard footer .primary { width: 100%; height: 48px; font-size: 15px; }

/* value dialog */
#field-value-dialog { width: min(560px, calc(100vw - 32px)); }
#field-value-dialog canvas { width: 100%; display: block; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; touch-action: none; margin-top: 8px; }
.value-party { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.value-image-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.value-image-actions label { margin: 0; }

@media (max-width: 1240px) {
  .rpanel { display: none; }
  .editor.show-rpanel .rpanel { display: block; }
  .doc-col { margin-right: 24px; }
  .pagepill { left: calc(300px + (100vw - 324px) / 2); }
  .crow { grid-template-columns: 30px minmax(0, 1fr) 140px auto; }
  .crow .pages-c { display: none; }
}
@media (max-width: 1100px) {
  .stepper .lb { display: none; }
  .stepper .step.cur .lb { display: inline; }
  .md { grid-template-columns: 260px minmax(0, 1fr); gap: 28px; }
  .search { width: 180px; }
}
@media (max-width: 860px) {
  .top { gap: 14px; padding: 0 16px; }
  .brand .word { display: none; }
  .search { width: 140px; }
  .wrap { padding: 24px 16px 64px; }
  .md { grid-template-columns: 1fr; }
  .alist { position: static; }
  .tpanel { position: static; width: auto; max-height: none; margin: 16px; }
  .doc-col { margin: 0; padding: 16px; }
  .pagepill { left: 50%; }
  .stepper { position: static; transform: none; }
  .etop h1 { display: none; }
}
