:root {
  --ink: #18212d;
  --muted: #687384;
  --line: #dfe4ea;
  --panel: #ffffff;
  --workspace: #eef1f4;
  --accent: #f15a3d;
  --accent-dark: #d9472d;
  --accent-soft: #fff0ec;
  --navy: #26394d;
  --shadow: 0 18px 45px rgba(27, 39, 53, .12);
  --page-ratio: 1.4142;
  --canvas-width: 650px;
  --canvas-height: calc(var(--canvas-width) * var(--page-ratio));
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: var(--workspace); }
button, input, textarea, select { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }

/* Identification */
.auth-locked .app-shell { display: none; }
body:not(.auth-locked) .login-page { display: none; }
.login-page { width: 100vw; height: 100vh; min-height: 620px; display: grid; grid-template-columns: minmax(470px, 1.08fr) minmax(430px, .92fr); background: #fff; }
.login-visual { position: relative; overflow: hidden; padding: 42px 54px; color: #fff; background: linear-gradient(145deg, #172b3e 0%, #233f55 52%, #31576c 100%); }
.login-visual:before { content: ""; position: absolute; width: 620px; height: 620px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; right: -300px; top: -280px; box-shadow: 0 0 0 90px rgba(255,255,255,.025), 0 0 0 180px rgba(255,255,255,.018); }
.login-visual:after { content: ""; position: absolute; width: 290px; height: 290px; background: var(--accent); border-radius: 50%; left: -180px; bottom: -180px; opacity: .9; box-shadow: 0 0 0 45px rgba(241,90,61,.08); }
.visual-brand { display: flex; align-items: center; gap: 13px; position: relative; z-index: 2; }
.brand-mark.large { width: 46px; height: 46px; border-radius: 13px 5px 13px 5px; }
.brand-mark.large svg { width: 28px; height: 28px; }
.login-brand { color: #fff; font-size: 20px; }
.login-brand span { color: #ff8169; }
.visual-message { position: relative; z-index: 2; max-width: 520px; margin-top: 11vh; }
.eyebrow.light { color: rgba(255,255,255,.5); }
.visual-message h1 { font: 700 clamp(32px, 3.8vw, 54px)/1.08 "Segoe UI", Arial, sans-serif; letter-spacing: -.04em; margin: 12px 0 20px; }
.visual-message p { color: rgba(255,255,255,.68); font-size: 15px; line-height: 1.65; max-width: 470px; }
.document-stack { position: absolute; width: 300px; height: 250px; right: 8%; bottom: 7%; z-index: 2; transform: rotate(-2deg); }
.stack-sheet { position: absolute; width: 202px; height: 270px; border-radius: 4px; box-shadow: 0 20px 45px rgba(3,12,20,.24); }
.sheet-back { background: #9bb2bf; left: 62px; top: 12px; transform: rotate(12deg); opacity: .5; }
.sheet-middle { background: #dce6eb; left: 34px; top: 6px; transform: rotate(5deg); opacity: .88; }
.sheet-front { background: #fff; padding: 23px 20px; color: var(--navy); left: 0; top: 0; }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 23px; }
.sheet-head i:first-child { width: 27px; height: 27px; background: var(--accent); border-radius: 7px 3px 7px 3px; }
.sheet-head i:last-child { width: 45px; height: 5px; background: #e2e7ea; border-radius: 4px; }
.sheet-title { width: 112px; height: 8px; background: #253c50; border-radius: 5px; margin-bottom: 9px; }
.sheet-line { width: 100%; height: 4px; background: #e6eaed; border-radius: 3px; margin: 8px 0; }
.sheet-line.short { width: 75%; }
.sheet-field { height: 25px; border: 1px solid #ccd6dc; border-radius: 3px; margin: 12px 0; }
.sheet-field.wide { height: 43px; }
.sheet-checks { display: grid; grid-template-columns: 11px 1fr 11px 1fr; gap: 5px; align-items: center; margin-top: 14px; }
.sheet-checks i { width: 10px; height: 10px; border: 1px solid #9babb5; }
.sheet-checks span { height: 3px; background: #dfe5e9; }
.sheet-button { width: 59px; height: 18px; background: var(--accent); border-radius: 3px; margin: 18px 0 0 auto; }
.visual-footer { position: absolute; left: 54px; bottom: 32px; font-size: 10px; color: rgba(255,255,255,.48); z-index: 2; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 55px; background: #fff; }
.login-card { width: min(390px, 100%); }
.mobile-login-brand { display: none; }
.login-card > h2 { font-size: 34px; letter-spacing: -.04em; margin-top: 7px; }
.login-intro { color: var(--muted); font-size: 13px; margin: 9px 0 30px; }
.login-error { background: #fff0ed; border: 1px solid #ffc8bd; color: #b43e29; border-radius: 7px; padding: 10px 12px; margin-bottom: 18px; font-size: 11.5px; line-height: 1.4; }
.login-field { margin-bottom: 18px; }
.login-field > label { display: block; font-size: 11px; font-weight: 700; color: #43505d; margin-bottom: 7px; }
.login-input-wrap { height: 47px; display: flex; align-items: center; gap: 9px; border: 1px solid #d6dce2; border-radius: 7px; padding: 0 12px; transition: .16s ease; background: #fff; }
.login-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(241,90,61,.11); }
.login-input-wrap > svg { width: 18px; color: #87919c; flex: none; }
.login-input-wrap input { flex: 1; min-width: 0; border: 0; outline: 0; height: 100%; font-size: 13px; color: var(--ink); background: transparent; }
.login-input-wrap input::placeholder { color: #a9b0b8; }
.password-toggle { width: 28px; height: 28px; border: 0; background: transparent; color: #87919c; display: grid; place-items: center; cursor: pointer; border-radius: 5px; }
.password-toggle:hover { background: #f2f4f6; color: var(--ink); }
.password-toggle svg { width: 17px; }
.login-submit { width: 100%; height: 47px; margin-top: 8px; justify-content: space-between; padding: 0 17px; }
.login-submit:disabled { opacity: .66; cursor: wait; transform: none !important; }
.login-help { text-align: center; color: #9aa2ab; font-size: 9.5px; margin-top: 17px; }
.login-help code { color: #687481; background: #f2f4f6; padding: 2px 4px; border-radius: 3px; }

.app-shell { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 68px; flex: 0 0 68px; background: #fff; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 260px 1fr auto; align-items: center; padding: 0 20px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 37px; height: 37px; display: grid; place-items: center; background: var(--accent); color: white; border-radius: 11px 4px 11px 4px; transform: rotate(-2deg); }
.brand-mark svg { width: 24px; height: 24px; transform: rotate(2deg); }
.brand-copy { font-family: "Segoe UI", Arial, sans-serif; font-size: 17px; line-height: 1; display: flex; gap: 4px; }
.brand-copy span { color: var(--accent); font-weight: 700; }
.document-title-wrap { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 2px; }
.document-title { border: 1px solid transparent; background: transparent; text-align: center; font-weight: 600; color: var(--ink); width: min(380px, 90%); padding: 3px 8px; border-radius: 5px; }
.document-title:hover, .document-title:focus { border-color: var(--line); outline: none; background: #fafbfc; }
.save-status { color: #84909d; font-size: 10.5px; display: flex; align-items: center; gap: 5px; }
.status-dot { width: 5px; height: 5px; background: #59a66f; border-radius: 50%; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.separator { height: 25px; border-left: 1px solid var(--line); margin: 0 4px; }
.icon-btn, .mini-icon-btn, .danger-icon, .close-btn { background: transparent; border: 0; cursor: pointer; display: grid; place-items: center; border-radius: 7px; }
.icon-btn { width: 34px; height: 34px; color: #667180; }
.icon-btn:hover:not(:disabled) { background: #f0f3f5; color: var(--ink); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.button { border-radius: 7px; border: 1px solid transparent; padding: 9px 15px; height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: .16s ease; }
.button svg { width: 17px; height: 17px; }
.button.primary { background: var(--accent); color: white; box-shadow: 0 5px 14px rgba(241, 90, 61, .22); }
.button.primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.button.secondary { background: #fff; border-color: #d7dde3; }
.button.secondary:hover { border-color: #acb5c0; background: #fafbfc; }
.button.full { width: 100%; margin-top: 18px; }
.user-menu-wrap { position: relative; margin-left: 4px; }
.user-menu-btn { height: 42px; min-width: 146px; border: 1px solid #e1e5e9; background: #fff; border-radius: 8px; padding: 4px 8px 4px 5px; display: grid; grid-template-columns: 30px 1fr 14px; align-items: center; gap: 7px; cursor: pointer; text-align: left; }
.user-menu-btn:hover { background: #f8f9fa; border-color: #cdd3d9; }
.user-menu-btn > svg { width: 14px; color: #8b95a0; }
.user-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--navy); color: #fff; font-size: 11px; font-weight: 700; }
.user-copy { min-width: 0; line-height: 1.12; }
.user-copy strong { display: block; font-size: 9.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 85px; }
.user-copy small { display: block; font-size: 7.5px; color: #8d97a2; margin-top: 2px; }
.user-dropdown { position: absolute; right: 0; top: 48px; width: 205px; background: #fff; border: 1px solid #dfe4e8; border-radius: 8px; box-shadow: 0 13px 32px rgba(22,34,46,.17); padding: 7px; z-index: 80; }
.user-dropdown-info { padding: 7px 9px 11px; border-bottom: 1px solid #e9ecef; margin-bottom: 5px; }
.user-dropdown-info strong, .user-dropdown-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown-info strong { font-size: 11px; }
.user-dropdown-info span { font-size: 9px; color: #8b95a0; margin-top: 3px; }
.user-dropdown button { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; border-radius: 5px; padding: 8px 9px; color: #465362; font-size: 10.5px; cursor: pointer; text-align: left; }
.user-dropdown button:hover { background: #f2f5f7; }
.user-dropdown #logoutBtn { color: #bf4936; border-top: 1px solid #e9ecef; border-radius: 0 0 5px 5px; margin-top: 4px; padding-top: 9px; }
.user-dropdown #logoutBtn:hover { background: #fff0ed; }
.user-dropdown button svg { width: 16px; }

.workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: 230px minmax(460px, 1fr) 270px; }
.left-panel, .right-panel { background: var(--panel); min-height: 0; z-index: 10; }
.left-panel { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.right-panel { border-left: 1px solid var(--line); overflow-y: auto; }
.panel-section { padding: 21px 17px; border-bottom: 1px solid var(--line); }
.section-heading { margin-bottom: 3px; }
.section-heading.row { display: flex; justify-content: space-between; align-items: center; }
.eyebrow { color: #98a1ad; font-size: 9px; letter-spacing: .15em; font-weight: 800; display: block; margin-bottom: 4px; }
h2 { font-family: "Segoe UI", Arial, sans-serif; font-size: 16px; margin: 0; letter-spacing: -.02em; }
.helper-copy { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 7px 0 14px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field-tool { background: #fff; border: 1px solid #e0e4e9; border-radius: 7px; min-height: 68px; padding: 9px 5px 7px; cursor: grab; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; font-size: 10.5px; color: #4e5967; transition: .16s ease; }
.field-tool:hover { border-color: var(--accent); color: var(--accent); background: #fffaf8; transform: translateY(-1px); box-shadow: 0 4px 10px rgba(31, 43, 55, .06); }
.tool-icon { width: 24px; height: 24px; display: grid; place-items: center; color: var(--navy); font: 700 20px "Segoe UI", Arial, sans-serif; }
.field-tool:hover .tool-icon { color: var(--accent); }
.tool-icon.lines { gap: 3px; align-content: center; }
.tool-icon.lines i { height: 1px; width: 21px; display: block; background: currentColor; }
.checkbox-icon, .radio-icon { width: 18px; height: 18px; border: 1.6px solid currentColor; }
.radio-icon { border-radius: 50%; box-shadow: inset 0 0 0 4px #fff; background: currentColor; }
.select-icon { border: 1.5px solid currentColor; font-size: 17px; line-height: 12px; }
.calendar-icon { border: 1.5px solid currentColor; width: 21px; height: 19px; position: relative; }
.calendar-icon:before { content:""; position:absolute; top:4px; left:0; right:0; border-top:1.5px solid; }
.count-badge { font: 600 9px "Segoe UI", Arial, sans-serif; background: #edf0f3; padding: 2px 6px; color: #65707d; border-radius: 10px; vertical-align: 2px; }
.mini-icon-btn { width: 27px; height: 27px; background: var(--accent-soft); color: var(--accent); font-size: 20px; }
.pages-section { min-height: 0; flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.page-list { overflow-y: auto; margin: 9px -5px 0; padding: 0 5px; }
.page-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 9px; padding: 7px; margin-bottom: 5px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.page-item:hover { background: #f7f8fa; }
.page-item.active { border-color: rgba(241,90,61,.48); background: #fff8f6; }
.page-thumb { width: 40px; height: 52px; background: white; border: 1px solid #ccd3db; box-shadow: 0 2px 4px rgba(0,0,0,.08); overflow: hidden; position: relative; }
.page-thumb canvas { width: 100%; height: 100%; object-fit: fill; }
.page-item strong { display: block; font-size: 11.5px; }
.page-item small { color: #8a94a1; font-size: 9.5px; }
.page-menu { border: 0; background: transparent; color: #89929e; padding: 5px; cursor: pointer; font-size: 17px; }
.left-footer { padding: 10px 14px 13px; border-top: 1px solid var(--line); }
.text-action { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; border: 0; background: transparent; padding: 5px 7px; font-size: 11px; color: #52606e; }
.text-action:hover { color: var(--accent); }
.text-action svg { width: 15px; height: 15px; }
.footer-row { border-top: 1px solid #edf0f2; margin-top: 5px; padding-top: 5px; display: flex; }
.text-action.small { font-size: 10px; flex: 1; }

.canvas-area { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--workspace); }
.canvas-toolbar { flex: 0 0 44px; background: rgba(255,255,255,.88); border-bottom: 1px solid #dde2e7; display: flex; align-items: center; justify-content: center; position: relative; backdrop-filter: blur(8px); z-index: 3; }
.zoom-control { display: flex; align-items: center; background: #fff; border: 1px solid #dfe4e8; border-radius: 6px; overflow: hidden; }
.zoom-control button { border: 0; background: #fff; width: 29px; height: 26px; cursor: pointer; color: #5c6673; }
.zoom-control button:hover { background: #f3f5f6; }
.zoom-control span { font-size: 10px; width: 50px; text-align: center; border-left: 1px solid #e7eaed; border-right: 1px solid #e7eaed; }
.canvas-hint { position: absolute; right: 50px; font-size: 9.5px; color: #8a94a1; }
.kbd { border: 1px solid #d3d8dd; border-bottom-width: 2px; background: white; padding: 1px 4px; border-radius: 3px; color: #697482; }
.dot-sep { margin: 0 4px; }
.fit-button { position: absolute; right: 12px; border: 0; background: transparent; color: #77828e; cursor: pointer; padding: 6px; }
.fit-button svg { width: 17px; height: 17px; }
.canvas-scroller { flex: 1; overflow: auto; display: grid; place-items: start center; padding: 35px 50px 60px; }
.page-canvas { width: var(--canvas-width); height: var(--canvas-height); position: relative; background: #fff; box-shadow: var(--shadow); transform-origin: top center; flex: none; outline: none; overflow: hidden; transition: width .15s ease, height .15s ease; }
.page-background { position: absolute; inset: 0; background: #fff; }
.page-background canvas { width: 100%; height: 100%; display: block; }
.field-layer { position: absolute; inset: 0; }
.page-number-chip { position: absolute; bottom: 10px; right: 10px; z-index: 10; background: rgba(29, 40, 53, .72); color: white; font-size: 9px; padding: 3px 8px; border-radius: 10px; pointer-events: none; }
.form-field { position: absolute; border: 1px solid #647b92; background: rgba(255,255,255,.88); min-width: 20px; min-height: 20px; cursor: move; user-select: none; z-index: 2; }
.form-field:hover { border-color: var(--accent); }
.form-field.selected { border: 2px solid var(--accent); box-shadow: 0 0 0 2px rgba(241,90,61,.13); z-index: 4; }
.form-field.required:after { content: "*"; color: var(--accent); font-weight: 700; position: absolute; right: 3px; top: -1px; font-size: 12px; }
.field-render { width: 100%; height: 100%; display: flex; align-items: center; padding: 0 8px; overflow: hidden; color: #465362; font-size: 12px; white-space: nowrap; }
.form-field[data-type="textarea"] .field-render { align-items: flex-start; white-space: normal; padding-top: 6px; }
.form-field[data-type="checkbox"], .form-field[data-type="radio"] { background: transparent; border: 0; }
.form-field[data-type="checkbox"].selected, .form-field[data-type="radio"].selected { box-shadow: 0 0 0 2px rgba(241,90,61,.13); }
.form-field[data-type="checkbox"] .field-render, .form-field[data-type="radio"] .field-render { padding: 0; }
.fake-check { width: 18px; height: 18px; background: #fff; border: 1.5px solid #657789; display: block; }
.fake-radio { width: 18px; height: 18px; background: #fff; border: 1.5px solid #657789; border-radius: 50%; display: block; }
.resize-handle { display: none; position: absolute; width: 8px; height: 8px; background: #fff; border: 2px solid var(--accent); border-radius: 50%; z-index: 8; }
.form-field.selected .resize-handle { display: block; }
.resize-handle.se { right: -5px; bottom: -5px; cursor: se-resize; }
.resize-handle.sw { left: -5px; bottom: -5px; cursor: sw-resize; }
.resize-handle.ne { right: -5px; top: -5px; cursor: ne-resize; }
.resize-handle.nw { left: -5px; top: -5px; cursor: nw-resize; }
.drop-active { outline: 2px dashed var(--accent); outline-offset: -10px; }

.empty-properties { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 35px; color: var(--muted); }
.empty-properties h2 { color: var(--ink); margin: 15px 0 6px; }
.empty-properties p { font-size: 11px; line-height: 1.5; margin: 0; }
.empty-icon { color: #aab3bd; width: 58px; height: 58px; border-radius: 50%; background: #f3f5f7; display: grid; place-items: center; }
.empty-icon svg { width: 31px; height: 31px; }
.properties-panel { padding: 21px 18px 30px; }
.properties-header { display: flex; justify-content: space-between; align-items: center; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 17px; }
.danger-icon { width: 30px; height: 30px; color: #d2584d; }
.danger-icon:hover { background: #fff0ef; }
.danger-icon svg { width: 17px; }
.form-group { margin: 0 0 14px; }
.form-group label { display: flex; justify-content: space-between; font-size: 10.5px; color: #4d5865; font-weight: 600; margin-bottom: 6px; }
.form-group input[type="text"], .form-group input[type="number"], .form-group textarea { width: 100%; border: 1px solid #d9dfe5; border-radius: 6px; padding: 8px 9px; font-size: 11.5px; color: var(--ink); background: white; }
.form-group input:focus, .form-group textarea:focus, .geometry-grid input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,90,61,.11); outline: none; }
.form-group small { display: block; color: #99a1ab; font-size: 9px; margin-top: 4px; }
.form-group input[type="range"] { width: 100%; accent-color: var(--accent); }
.toggle-row { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 14px 0; margin: 5px 0 17px; display: flex; justify-content: space-between; align-items: center; }
.toggle-row strong { display: block; font-size: 10.5px; }
.toggle-row div span { display: block; color: #929ba5; font-size: 8.5px; max-width: 170px; margin-top: 2px; }
.switch input { display: none; }
.switch > span { width: 34px; height: 19px; background: #cbd2d9; border-radius: 12px; display: block; position: relative; cursor: pointer; transition: .2s; }
.switch > span:before { content:""; position:absolute; width:15px; height:15px; background:white; border-radius:50%; top:2px; left:2px; box-shadow:0 1px 3px rgba(0,0,0,.2); transition:.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span:before { transform: translateX(15px); }
.geometry-card { background: #f7f8fa; border: 1px solid #e3e7eb; border-radius: 7px; padding: 11px; }
.geometry-heading { font-size: 8.5px; color: #89929d; font-weight: 700; letter-spacing: .1em; margin-bottom: 9px; }
.geometry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.geometry-grid label { display: flex; align-items: center; gap: 5px; font-size: 9px; color: #7d8792; }
.geometry-grid input { width: 100%; min-width: 0; border: 1px solid #dce1e6; border-radius: 4px; padding: 5px; font-size: 10px; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: grid; gap: 8px; }
.toast { background: #1e2a37; color: #fff; border-radius: 8px; box-shadow: 0 12px 30px rgba(0,0,0,.18); padding: 11px 15px; font-size: 12px; display: flex; align-items: center; gap: 9px; animation: toastIn .22s ease; }
.toast.success:before { content:"✓"; display:grid; place-items:center; width:18px; height:18px; background:#55a66d; border-radius:50%; font-weight:700; }
.toast.error:before { content:"!"; display:grid; place-items:center; width:18px; height:18px; background:#d85a50; border-radius:50%; font-weight:700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.modal { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; }
.modal::backdrop { background: rgba(18, 29, 41, .52); backdrop-filter: blur(3px); }
.modal-card { width: 460px; background: #fff; border-radius: 12px; padding: 24px; box-shadow: 0 25px 70px rgba(0,0,0,.25); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; }
.close-btn { font-size: 25px; color: #7d8792; width: 32px; height: 32px; }
.close-btn:hover { background: #f1f3f5; }
.modal-card > p { color: var(--muted); font-size: 12px; }
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.choice-card { border: 1px solid #dfe4e8; border-radius: 8px; padding: 13px; display: grid; grid-template-columns: 45px 1fr; grid-template-rows: 1fr 1fr; align-items: center; column-gap: 12px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--accent); background: #fff8f6; box-shadow: 0 0 0 2px rgba(241,90,61,.1); }
.choice-card input { display: none; }
.paper-icon { grid-row: 1 / 3; width: 37px; height: 48px; background: white; border: 1.5px solid #99a3ae; box-shadow: 0 2px 4px rgba(0,0,0,.07); }
.paper-icon.letter { height: 45px; }
.choice-card strong { align-self: end; font-size: 13px; }
.choice-card small { color: var(--muted); font-size: 10px; align-self: start; }
.orientation-row { display: flex; gap: 20px; border-top: 1px solid var(--line); padding-top: 16px; font-size: 11px; }
.orientation-row > span { font-weight: 600; margin-right: auto; }
.orientation-row input { accent-color: var(--accent); vertical-align: -2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 25px; }
.preview-modal { width: 100vw; height: 100vh; }
.preview-card { width: min(960px, calc(100vw - 50px)); height: calc(100vh - 50px); margin: 25px auto; background: #f0f2f4; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.preview-card > .modal-header { background: #fff; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.preview-pages { overflow: auto; padding: 35px; display: grid; justify-content: center; gap: 28px; }
.preview-page { width: 650px; position: relative; background: #fff; box-shadow: var(--shadow); overflow: hidden; }
.preview-page .preview-bg, .preview-page .preview-fields { position: absolute; inset: 0; }
.preview-page canvas { width: 100%; height: 100%; display: block; }
.preview-field { position: absolute; }
.preview-field input[type="text"], .preview-field textarea, .preview-field select { width:100%; height:100%; border:1px solid #78899a; padding:4px 7px; background:rgba(255,255,255,.94); font:inherit; }
.preview-field textarea { resize: none; }
.preview-field.check-preview { display:flex; align-items:center; gap:6px; font-size:11px; }
.preview-field.check-preview input { width:18px; height:18px; accent-color:var(--accent); }

/* Gestion des utilisateurs */
.users-modal { width: 100vw; height: 100vh; }
.users-card { width: min(1040px, calc(100vw - 48px)); height: min(760px, calc(100vh - 48px)); margin: 24px auto; background: #fff; border-radius: 13px; box-shadow: 0 25px 70px rgba(0,0,0,.25); display: flex; flex-direction: column; overflow: hidden; }
.users-header { padding: 21px 24px 17px; border-bottom: 1px solid var(--line); }
.users-persistence-status { min-height: 34px; padding: 9px 24px; background: #f5f8fa; border-bottom: 1px solid var(--line); color: #647180; font-size: 10.5px; }
.users-persistence-status.warning { color: #8b5c17; background: #fff8e8; }
.users-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(310px, .85fr) minmax(410px, 1.15fr); }
.users-list-panel { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #f7f9fa; }
.users-toolbar { display: flex; gap: 9px; padding: 16px; border-bottom: 1px solid var(--line); background: #fff; }
.users-toolbar .button { white-space: nowrap; height: 36px; padding: 8px 12px; }
.users-search { flex: 1; min-width: 0; height: 36px; display: flex; align-items: center; gap: 7px; border: 1px solid #d8dee4; border-radius: 7px; padding: 0 9px; background: #fff; color: #89939e; }
.users-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,90,61,.1); }
.users-search input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 11.5px; color: var(--ink); }
.users-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.user-list-item { width: 100%; border: 1px solid transparent; background: transparent; border-radius: 8px; padding: 10px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; cursor: pointer; text-align: left; }
.user-list-item:hover { background: #fff; border-color: #e0e5e9; }
.user-list-item.active { background: #fff8f6; border-color: rgba(241,90,61,.45); box-shadow: 0 3px 10px rgba(31,43,55,.05); }
.user-list-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.user-list-copy { min-width: 0; }
.user-list-copy strong, .user-list-copy span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-list-copy strong { font-size: 11.5px; color: var(--ink); }
.user-list-copy span { margin-top: 3px; color: #8b95a0; font-size: 9.5px; }
.role-badge { display: inline-flex; align-items: center; border-radius: 12px; padding: 3px 8px; background: #edf1f4; color: #66717d; font-size: 8.5px; font-weight: 700; }
.role-badge.admin { background: #fff0ed; color: #b44835; }
.users-list-empty { padding: 35px 18px; text-align: center; color: var(--muted); font-size: 11px; }
.user-editor-panel { min-height: 0; overflow-y: auto; padding: 24px 28px; }
.user-editor-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.user-editor-empty h2 { color: var(--ink); margin: 15px 0 6px; }
.user-editor-empty p { font-size: 11px; margin: 0; }
.user-form { max-width: 560px; margin: 0 auto; }
.user-form-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 18px; margin-bottom: 19px; border-bottom: 1px solid var(--line); }
.user-form .form-group { margin-bottom: 16px; }
.user-form .form-group input[type="text"], .user-form .form-group input[type="password"], .user-form .form-group select { width: 100%; height: 38px; border: 1px solid #d9dfe5; border-radius: 6px; padding: 8px 9px; font-size: 11.5px; color: var(--ink); background: #fff; }
.user-form .form-group input:focus, .user-form .form-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(241,90,61,.11); outline: none; }
.user-form .form-group input:disabled { color: #8d96a0; background: #f3f5f6; }
.managed-password-wrap { display: grid; grid-template-columns: 1fr auto; }
.managed-password-wrap input { border-radius: 6px 0 0 6px !important; }
.managed-password-wrap button { border: 1px solid #d9dfe5; border-left: 0; border-radius: 0 6px 6px 0; padding: 0 10px; background: #f7f8fa; color: #596673; cursor: pointer; font-size: 10px; }
.managed-password-wrap button:hover { background: #eef1f3; }
.user-form-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; border-top: 1px solid var(--line); margin-top: 22px; padding-top: 18px; }
.button.danger { color: #bc4838; border-color: #e4bbb5; background: #fff; }
.button.danger:hover { background: #fff0ed; border-color: #d99187; }
.users-footer { min-height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 24px; border-top: 1px solid var(--line); background: #fbfcfc; }
.users-footer p { margin: 0; color: #7c8792; font-size: 10px; }
.users-footer .button { height: 35px; }

@media (max-width: 1000px) {
  .workspace { grid-template-columns: 205px minmax(400px, 1fr) 240px; }
  .topbar { grid-template-columns: 210px 1fr auto; }
  .canvas-hint { display: none; }
  .user-menu-btn { min-width: 40px; grid-template-columns: 30px; padding: 4px; }
  .user-menu-btn .user-copy, .user-menu-btn > svg { display: none; }
  .document-stack { opacity: .68; transform: scale(.8) rotate(-2deg); transform-origin: bottom right; }
}
@media (max-width: 780px) {
  html, body { overflow: auto; }
  .app-shell { min-width: 720px; }
  .right-panel { display: none; }
  .workspace { grid-template-columns: 205px minmax(500px, 1fr); }
  .topbar { grid-template-columns: 200px 1fr; }
  .document-title-wrap { align-items: flex-start; }
  .top-actions { grid-column: 1 / -1; position: fixed; bottom: 0; left: 0; right: 0; background:#fff; padding:8px; justify-content:center; border-top:1px solid var(--line); z-index:50; }
  .login-page { min-width: 0; display: block; background: #f3f5f7; padding: 30px 18px; }
  .login-visual { display: none; }
  .login-panel { min-height: calc(100vh - 60px); padding: 35px 26px; border-radius: 12px; box-shadow: 0 15px 35px rgba(25,39,53,.11); }
  .mobile-login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 48px; }
  .users-card { min-width: 690px; }
}
