/* Forms module — Settings > Forms list, the full-page builder / Submission Rules / Share pages, and the
 * "Form Responses" sidebar page. Layout follows the Zoho Bigin reference screens (see docs/FORMS_ZOHO_GAP_ANALYSIS.md);
 * colours come from the CRM tokens. Everything is prefixed .fm- so it can't leak into the rest of the app. */

/* ------------------------------------------------------------------ shared bits */
.fm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid var(--border-strong); background: #fff; color: var(--text-primary); font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s; }
.fm-btn:hover { background: var(--bg-hover); }
.fm-btn:disabled { opacity: .55; cursor: not-allowed; }
.fm-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.fm-btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.fm-btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.fm-btn.danger { background: #dc2626; border-color: #dc2626; color: #fff; }
.fm-btn.danger:hover { background: #b91c1c; }
.fm-btn.ghost { border-color: transparent; background: transparent; }
.fm-btn.ghost:hover { background: var(--bg-hover); }
.fm-btn.sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
/* rounded "pill" buttons used in the page headers (Cancel / Previous / Next Step / New Form / Done) */
.fm-pill-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 22px; border-radius: 999px; border: 1px solid #d5dbe3; background: #fff; color: var(--text-primary); font: 600 14px/1 inherit; font-family: inherit; cursor: pointer; white-space: nowrap; }
.fm-pill-btn:hover { background: var(--bg-hover); }
.fm-pill-btn svg { width: 15px; height: 15px; }
.fm-pill-btn.solid { background: var(--brand); border-color: var(--brand); color: #fff; }
.fm-pill-btn.solid:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.fm-pill-btn.outline { border-color: var(--brand); color: var(--brand-hover); }
.fm-pill-btn.outline:hover { background: var(--brand-soft); }
.fm-pill-btn:disabled { opacity: .55; cursor: not-allowed; }
.fm-textbtn { display: inline-flex; align-items: center; gap: 6px; border: none; background: transparent; color: var(--brand-hover); font: 600 13.5px/1 inherit; font-family: inherit; cursor: pointer; padding: 4px 0; }
.fm-textbtn:hover { text-decoration: underline; }
.fm-textbtn svg { width: 16px; height: 16px; }
.fm-iconbtn { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: none; background: transparent; border-radius: 6px; color: var(--text-muted); cursor: pointer; padding: 0; }
.fm-iconbtn:hover { background: var(--bg-active); color: var(--text-primary); }
.fm-iconbtn:disabled { opacity: .35; cursor: default; }
.fm-iconbtn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.fm-iconbtn svg { width: 16px; height: 16px; }
.fm-input, .fm-select, .fm-textarea { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; color: var(--text-primary); font: 400 13.5px/1.2 inherit; font-family: inherit; outline: none; }
.fm-textarea { height: auto; min-height: 76px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.fm-input:focus, .fm-select:focus, .fm-textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-input.bad, .fm-select.bad, .fm-textarea.bad { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.fm-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); margin: 0 0 6px; }
.fm-label .req { color: var(--danger); }
.fm-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }
.fm-row { margin-bottom: 16px; }
.fm-muted { color: var(--text-muted); }
.fm-pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--bg-active); color: var(--text-secondary); white-space: nowrap; }
.fm-pill.green { background: var(--success-soft); color: #047857; }
.fm-pill.amber { background: var(--warning-soft); color: #b45309; }
.fm-pill.teal { background: var(--brand-soft); color: var(--brand-hover); border: 1px solid #99f6e4; }
.fm-modpill { display: inline-block; padding: 4px 12px; border-radius: 6px; font-size: 13px; background: #e5f1fb; color: #1f3a52; }
.fm-av { width: 30px; height: 30px; border-radius: 50%; background: #bfe9c9; color: #14532d; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11.5px; flex-shrink: 0; }

/* toggle switch */
.fm-switch { position: relative; display: inline-block; width: 36px; height: 20px; flex-shrink: 0; vertical-align: middle; }
.fm-switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.fm-switch i { position: absolute; inset: 0; background: #c3cbd6; border-radius: 999px; transition: background .15s; }
.fm-switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.fm-switch input:checked + i { background: var(--brand); }
.fm-switch input:checked + i::after { transform: translateX(16px); }
.fm-switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-switch.sm { width: 30px; height: 17px; }
.fm-switch.sm i::after { width: 13px; height: 13px; }
.fm-switch.sm input:checked + i::after { transform: translateX(13px); }

/* popover menu (row actions, filters, font/size/alignment) */
.fm-menu { position: fixed; z-index: 2500; min-width: 190px; max-width: 290px; background: #fff; border: 1px solid #e1e6ec; border-radius: 10px; box-shadow: 0 8px 30px rgba(15,23,42,.18); padding: 6px; max-height: 70vh; overflow-y: auto; }
.fm-menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 10px 12px; border: none; background: transparent; border-radius: 6px; font: 400 14px/1.2 inherit; font-family: inherit; color: var(--text-primary); text-align: left; cursor: pointer; }
.fm-menu button:hover, .fm-menu button:focus-visible { background: var(--bg-hover); outline: none; }
.fm-menu button.danger { color: #e0414b; }
.fm-menu button.danger:hover { background: #fdeceb; }
.fm-menu button:disabled { opacity: .5; cursor: not-allowed; }
.fm-menu button svg { width: 18px; height: 18px; color: var(--text-secondary); flex-shrink: 0; }
.fm-menu button.danger svg { color: #e0414b; }
.fm-menu .ic { width: 18px; flex-shrink: 0; }
.fm-menu .lb { flex: 1; }
.fm-menu .ck svg { color: var(--brand); width: 16px; height: 16px; }
.fm-menu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.fm-menu .hdr { padding: 6px 12px 4px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* dialogs */
.fm-dlg-ov { position: fixed; inset: 0; z-index: 2000; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.fm-dlg { background: #fff; border-radius: 12px; box-shadow: 0 20px 60px rgba(15,23,42,.35); width: 100%; max-width: 480px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.fm-dlg.wide { max-width: 760px; }
.fm-dlg-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.fm-dlg-h h3 { margin: 0; font-size: 16px; font-weight: 700; }
.fm-dlg-b { padding: 20px; overflow-y: auto; }
.fm-dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: #f8fafc; border-radius: 0 0 12px 12px; }
.fm-radio { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; }
.fm-radio:hover { background: var(--bg-hover); }
.fm-radio input { margin-top: 3px; accent-color: var(--brand); }
.fm-radio.on { border-color: var(--brand); background: var(--brand-soft); }
.fm-radio b { display: block; font-size: 13.5px; }
.fm-radio span { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.fm-seg { display: flex; background: var(--bg-active); padding: 3px; border-radius: 8px; }
.fm-seg button { flex: 1; border: none; background: transparent; padding: 6px 8px; border-radius: 6px; font: 600 12.5px/1 inherit; font-family: inherit; color: var(--text-secondary); cursor: pointer; }
.fm-seg button.on { background: #fff; color: var(--brand-hover); box-shadow: var(--shadow-sm); }
.fm-seg button:disabled { cursor: not-allowed; opacity: .6; }
.fm-search { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.fm-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-muted); pointer-events: none; }
.fm-search input { padding-left: 32px; }
.fm-empty { text-align: center; padding: 56px 20px 64px; }
.fm-empty-ico { color: #94a3b8; margin-bottom: 8px; }
.fm-empty-ico svg { width: 56px; height: 56px; }
.fm-empty h3 { margin: 0 0 6px; font-size: 18px; }
.fm-empty p { margin: 0 auto 18px; color: var(--text-muted); max-width: 440px; font-size: 13.5px; line-height: 1.5; }
.fm-empty .fm-btn + .fm-btn { margin-left: 8px; }

/* ------------------------------------------------------------------ Settings > Forms (the list) */
.fm-lh { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding-bottom: 14px; }
.fm-lh-t h2 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.fm-lh-t p { margin: 0; font-size: 14px; line-height: 1.5; color: #333d49; max-width: 820px; }
.fm-lh-a { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.fm-lh-a .fm-search { min-width: 180px; width: 220px; }
.fm-ltable { border-top: 1px solid #e6e9ee; }
.fm-table2 { width: 100%; border-collapse: collapse; font-size: 14px; }
.fm-table2 th { text-align: left; padding: 0 16px; height: 42px; font-size: 13.5px; font-weight: 500; color: #1f2937; background: #fff; border-bottom: 1px solid #e6e9ee; border-right: 1px solid #eef1f5; white-space: nowrap; user-select: none; }
.fm-table2 th:last-child { border-right: none; }
.fm-table2 th .sortable { cursor: pointer; }
.fm-table2 th .sortable:hover { color: var(--brand-hover); }
.fm-table2 th em { font-style: normal; color: var(--brand); margin-left: 4px; }
.fm-table2 th.hasf { white-space: nowrap; }
.fm-fbtn { border: none; background: transparent; width: 24px; height: 24px; margin-left: 8px; border-radius: 4px; color: #55616f; cursor: pointer; vertical-align: middle; padding: 0; }
.fm-fbtn:hover { background: var(--bg-active); }
.fm-fbtn.on { color: var(--brand); background: var(--brand-soft); }
.fm-fbtn svg { width: 16px; height: 16px; }
.fm-table2 td { padding: 0 16px; height: 62px; border-bottom: 1px solid #eef1f5; vertical-align: middle; }
.fm-table2 tbody tr:hover, .fm-table2 tbody tr.sel { background: #e8f4fb; }
.fm-table2 th.act, .fm-table2 td.act { width: 56px; text-align: right; }
.fm-table2 .ttl { color: var(--text-primary); background: none; border: none; padding: 0; font: 500 14px/1.3 inherit; font-family: inherit; text-align: left; cursor: pointer; }
.fm-table2 .ttl:hover { color: var(--brand-hover); text-decoration: underline; }
.fm-by { display: inline-flex; align-items: center; gap: 10px; }
.fm-by .who { display: flex; flex-direction: column; line-height: 1.25; }
.fm-by .who b { font-weight: 500; font-size: 13.5px; }
.fm-by .who small { color: var(--text-muted); font-size: 12px; }
.fm-resp { border: none; background: none; padding: 0; font: 600 14px/1 inherit; font-family: inherit; color: var(--brand-hover); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.fm-resp:hover { text-decoration: underline; }
.fm-dotbtn { width: 34px; height: 34px; border-radius: 50%; border: none; background: transparent; color: #44505e; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.fm-dotbtn:hover, tr.sel .fm-dotbtn { background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.25); }
.fm-dotbtn svg { width: 18px; height: 18px; }
.fm-table2 tr.empty:hover { background: transparent; }
.fm-table2 tr.empty td { height: auto; border-bottom: none; }
.fm-lempty { text-align: center; padding: 64px 20px 80px; color: #4b5563; font-size: 15px; }
.fm-lempty .ico { color: #1f2937; margin-bottom: 14px; }
.fm-lempty .ico svg { width: 56px; height: 56px; }
.fm-lempty p { margin: 0; }

/* ------------------------------------------------------------------ full pages (builder, Submission Rules, Share) */
.fm-builder, .fm-fullpage { position: fixed; inset: 0; z-index: 450; background: #f4f6f9; display: flex; font-family: inherit; color: var(--text-primary); }
.fm-builder.fm-fullpage, .fm-fullpage { flex-direction: column; }
.fm-ph { height: 62px; flex-shrink: 0; background: #fff; border-bottom: 1px solid #e6e9ee; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.fm-ph h2 { margin: 0; font-size: 19px; font-weight: 500; }
.fm-ph .acts { display: flex; gap: 12px; align-items: center; }
.fm-pbody { flex: 1; overflow-y: auto; background: #f4f6f9; }
.fm-pcol { max-width: 900px; margin: 0 auto; background: #fff; min-height: 100%; border-left: 1px solid #e6e9ee; border-right: 1px solid #e6e9ee; padding: 30px 40px 80px; }

/* ---- builder: left panel */
.fm-lib { width: 360px; flex-shrink: 0; background: #fff; border-right: 1px solid #e0e5eb; display: flex; flex-direction: column; min-height: 0; }
.fm-lib-tabs { display: flex; gap: 6px; padding: 0 20px; height: 54px; align-items: stretch; border-bottom: 1px solid #eef1f5; }
.fm-lib-tabs button { border: none; background: transparent; padding: 0 14px; font: 500 15px/1 inherit; font-family: inherit; color: #3a4553; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.fm-lib-tabs button.on { color: var(--brand-hover); border-bottom-color: var(--brand); }
.fm-lib-top { padding: 14px 20px 0; }
.fm-lib-top .fm-seg { display: inline-flex; background: #fff; border: 1px solid #dfe5ec; border-radius: 999px; padding: 3px; }
.fm-lib-top .fm-seg button { border-radius: 999px; padding: 7px 16px; font: 500 14px/1 inherit; font-family: inherit; color: #3a4553; }
.fm-lib-top .fm-seg button.on { background: var(--brand-soft); color: var(--brand-hover); box-shadow: none; }
.fm-lib-search { position: relative; padding: 14px 20px 8px; }
.fm-lib-search input { width: 100%; height: 40px; border: 1px solid #d8dee6; border-radius: 6px; padding: 0 40px 0 12px; font: 400 14px/1 inherit; font-family: inherit; outline: none; background: #fff; }
.fm-lib-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-lib-search svg { position: absolute; right: 32px; top: 50%; transform: translateY(-30%); width: 17px; height: 17px; color: #3a4553; pointer-events: none; }
.fm-lib-new { margin: 2px 20px 8px; border: 1px dashed #bcd8d5; background: var(--brand-soft); color: var(--brand-hover); border-radius: 6px; height: 34px; font: 600 13px/1 inherit; font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.fm-lib-new:hover { background: #e2f6f3; }
.fm-lib-new svg { width: 14px; height: 14px; }
.fm-lib-list { flex: 1; overflow-y: auto; padding: 4px 18px 20px 6px; }
.fm-lfw { display: flex; align-items: center; margin-bottom: 8px; }
.fm-lfw .grip { width: 14px; height: 24px; color: #b6bfca; cursor: grab; flex-shrink: 0; display: flex; align-items: center; margin-right: 2px; }
.fm-lfw .grip svg { width: 12px; height: 20px; }
.fm-lfw.used .grip { cursor: default; opacity: .4; }
.fm-lfw.dragging { opacity: .5; }
.fm-lf { flex: 1; min-width: 0; display: flex; align-items: center; height: 42px; border: 1px solid #dfe5ec; border-radius: 4px; background: #fff; font-size: 14px; cursor: grab; user-select: none; position: relative; }
.fm-lf:hover { background: #f1f8f7; border-color: #bcd8d5; }
.fm-lf .ti { width: 40px; height: 100%; display: flex; align-items: center; justify-content: center; border-right: 1px solid #dfe5ec; color: #2e3a47; flex-shrink: 0; }
.fm-lf .ti svg { width: 20px; height: 20px; }
.fm-lf .nm { flex: 1; min-width: 0; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-lf .ops { display: none; }
.fm-lf:hover .ops, .fm-lf:focus-within .ops { display: flex; }
.fm-lf .ops .fm-iconbtn { width: 26px; height: 26px; }
.fm-lf .ops .fm-iconbtn svg { width: 14px; height: 14px; }
.fm-lf .add { width: 40px; height: 100%; border: none; background: transparent; color: var(--brand-hover); display: none; align-items: center; justify-content: center; cursor: pointer; padding: 0; flex-shrink: 0; }
.fm-lf:hover .add, .fm-lf:focus-within .add { display: flex; }
.fm-lf .add:hover { background: var(--brand-soft); }
.fm-lf .add:disabled { display: none; }
.fm-lf .add svg { width: 16px; height: 16px; }
.fm-lfw.used .fm-lf { opacity: .5; cursor: default; background: #f8fafc; }
.fm-lfw.used .fm-lf:hover { border-color: #dfe5ec; background: #f8fafc; }
.fm-lib-empty { text-align: center; color: var(--text-muted); font-size: 13px; padding: 24px 10px; }

/* ---- builder: stage (toolbar + canvas) */
.fm-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; position: relative; background: #e9edf2; }
.fm-tb { height: 54px; flex-shrink: 0; background: #fff; border-bottom: 1px solid #e6e9ee; padding: 0 24px; display: flex; align-items: center; gap: 6px; }
.fm-tb .sp { flex: 1; }
.fm-tb .vr { width: 1px; height: 22px; background: #e1e6ec; margin: 0 8px; }
.fm-tbi { width: 38px; height: 38px; border: none; background: transparent; border-radius: 6px; color: #2e3a47; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.fm-tbi:hover { background: var(--bg-hover); }
.fm-tbi svg { width: 22px; height: 22px; }
.fm-tbtn { display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; font: 500 14.5px/1 inherit; font-family: inherit; color: #1f2937; cursor: pointer; padding: 8px 6px; border-radius: 6px; }
.fm-tbtn:hover { background: var(--bg-hover); }
.fm-tbtn svg { width: 20px; height: 20px; }
.fm-canvas-scroll { flex: 1; overflow-y: auto; padding: 0; }
.fm-canvas { min-height: 100%; padding: 28px 24px 56px; box-sizing: border-box; }
.fm-card2 { max-width: 640px; margin: 0 auto; background: #fff; border-radius: 6px; box-shadow: 0 2px 10px rgba(15,23,42,.1); overflow: hidden; }
.fm-card2-body { padding: 26px 28px 18px; }
.fm-canvas-note { max-width: 640px; margin: 14px auto 0; background: #fff; border-radius: 4px; padding: 14px 18px; font-size: 14px; text-align: center; color: #1f2937; box-shadow: 0 1px 4px rgba(15,23,42,.08); }
.fm-blk { border: 1px dashed #dde3ea; border-radius: 4px; padding: 10px 14px; margin-bottom: 14px; min-height: 46px; display: flex; align-items: center; }
.fm-blk:hover { border-color: #c4ccd6; }
.fm-logo-blk, .fm-sectitle-blk { justify-content: center; }
.fm-linkbtn { display: inline-flex; align-items: center; gap: 8px; border: none; background: transparent; color: var(--brand-hover); font: 500 15px/1 inherit; font-family: inherit; cursor: pointer; padding: 4px 8px; }
.fm-linkbtn:hover { text-decoration: underline; }
.fm-linkbtn svg { width: 18px; height: 18px; }
.fm-logo-img { position: relative; display: inline-block; max-width: 100%; }
.fm-logo-img img { max-height: 70px; max-width: 100%; display: block; }
.fm-logo-img .x { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); cursor: pointer; display: none; align-items: center; justify-content: center; padding: 0; color: var(--text-secondary); }
.fm-logo-img:hover .x { display: inline-flex; }
.fm-logo-img .x svg { width: 12px; height: 12px; }
.fm-title-blk { padding: 6px 10px; min-height: 58px; }
.fm-titlewrap { position: relative; width: 100%; }
.fm-title-in { width: 100%; border: 1px solid transparent; border-radius: 4px; padding: 8px 10px; font: inherit; font-size: 1.55em; font-weight: 600; line-height: 1.25; background: transparent; color: inherit; text-align: inherit; outline: none; }
.fm-title-in:hover { background: #fafbfc; }
.fm-title-in:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); background: #fff; }
.fm-title-in::placeholder { color: #9aa3ae; font-weight: 500; }
.fm-title-in.bad { border-color: var(--danger); }
.fm-float-err { position: absolute; left: 4px; top: calc(100% + 8px); z-index: 5; background: #1e293b; color: #fff; font-size: 12.5px; font-weight: 500; padding: 7px 12px; border-radius: 7px; box-shadow: var(--shadow-lg); white-space: nowrap; animation: fm-pop .15s ease-out; text-align: left; }
.fm-float-err::before { content: ''; position: absolute; left: 18px; top: -5px; border: 5px solid transparent; border-top: 0; border-bottom-color: #1e293b; }
@keyframes fm-pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.fm-sec { position: relative; border: 1px dashed #dde3ea; border-radius: 4px; padding: 12px 14px 4px; margin-bottom: 12px; }
.fm-sec:hover { border-color: #c4ccd6; }
.fm-sec.drop { border-color: var(--brand); background: rgba(13,148,136,.04); }
.fm-sec-ops { position: absolute; right: 6px; top: -15px; display: none; gap: 2px; background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; box-shadow: var(--shadow); z-index: 3; }
.fm-sec:hover > .fm-sec-ops, .fm-sec:focus-within > .fm-sec-ops { display: flex; }
.fm-sec-ops .fm-iconbtn { width: 26px; height: 26px; }
.fm-sec-ops .fm-iconbtn svg { width: 14px; height: 14px; }
.fm-sectitle-blk { padding: 6px 10px; margin-bottom: 12px; gap: 6px; background: #fbfcfd; }
.fm-sec-title { flex: 1; min-width: 0; border: 1px solid transparent; border-radius: 4px; padding: 6px 8px; font: inherit; font-size: 1.15em; font-weight: 600; background: transparent; color: inherit; outline: none; text-align: left; }
.fm-sec-title:hover { border-color: var(--border-strong); }
.fm-sec-title:focus { border-color: var(--brand); background: #fff; }
.fm-sec-empty { text-align: center; padding: 22px 10px; margin-bottom: 10px; border: 1px dashed #cbd5e1; border-radius: 6px; color: #64748b; font-size: 13px; background: #f8fafc; }
.fm-addsec { display: flex; width: 100%; align-items: center; justify-content: center; gap: 8px; height: 46px; margin: 0 0 14px; border: none; border-radius: 4px; background: #eef5fb; color: var(--brand-hover); font: 500 15px/1 inherit; font-family: inherit; cursor: pointer; }
.fm-addsec:hover { background: #e2eef8; }
.fm-addsec svg { width: 16px; height: 16px; }
.fm-submit-blk { min-height: 62px; margin-bottom: 4px; }
.fm-submit-in { border: none; background: var(--brand); color: #fff; font: 600 16px/1 inherit; font-family: inherit; text-align: center; padding: 13px 14px; border-radius: 3px; cursor: text; min-width: 90px; outline: none; }
.fm-submit-in:focus { box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-card2-foot { display: flex; align-items: stretch; margin-top: 6px; }
.fm-brandtab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 14px 10px 12px; background: #0f2438; color: #fff; font-size: 12.5px; border-radius: 0 10px 0 0; flex-shrink: 0; min-height: 38px; }
.fm-brandtab.ghost { background: transparent; padding: 0; min-width: 0; }
.fm-brandtab img { height: 18px; background: #fff; border-radius: 3px; padding: 1px 3px; }
.fm-brandtab strong { font-weight: 700; }
.fm-brandstrip { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; background: #fdf0dd; font-size: 14px; color: #1f2937; cursor: pointer; padding: 6px 12px; }

/* field + content blocks inside the canvas */
.fm-it { position: relative; border: 1px solid transparent; border-radius: 4px; padding: 8px 8px 8px 8px; margin-bottom: 6px; background: #fff; }
.fm-it:hover { border-color: #dde3ea; }
.fm-it.sel { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-it.dragging { opacity: .4; }
.fm-it.ins-before::before, .fm-it.ins-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--brand); border-radius: 2px; }
.fm-it.ins-before::before { top: -5px; }
.fm-it.ins-after::after { bottom: -5px; }
.fm-it-bar { position: absolute; right: 6px; top: -15px; display: none; gap: 2px; background: #fff; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; box-shadow: var(--shadow); z-index: 3; align-items: center; }
.fm-it:hover > .fm-it-bar, .fm-it.sel > .fm-it-bar, .fm-it:focus-within > .fm-it-bar { display: flex; }
.fm-it-bar .fm-iconbtn { width: 26px; height: 26px; }
.fm-it-bar .fm-iconbtn svg { width: 14px; height: 14px; }
.fm-it-bar .rq { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 0 6px; color: var(--text-secondary); }
.fm-it-grip { cursor: grab; }
.fm-it-prev { pointer-events: none; }
.fm-it-set { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-strong); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; font-size: 13px; text-align: left; }
.fm-it-set .full { grid-column: 1 / -1; }
.fm-it-set .fm-textarea { min-height: 64px; }
.fm-textblock { width: 100%; border: 1px dashed #cbd5e1; border-radius: 6px; padding: 8px 10px; font: inherit; background: #fff; color: inherit; resize: vertical; min-height: 56px; outline: none; }
.fm-textblock:focus { border-color: var(--brand); }
.fm-headblock { width: 100%; border: 1px solid transparent; border-bottom: 1px solid #e5e7eb; padding: 4px 6px; font: inherit; font-size: 1.15em; font-weight: 600; background: transparent; color: inherit; outline: none; }
.fm-headblock:focus { border-color: var(--brand); background: #fff; }
.fm-hr { border: none; border-top: 1px solid #e5e7eb; margin: 10px 0; }
.fm-canvas * { box-sizing: border-box; }
.fm-canvas .stmf-field { margin: 0; text-align: left; }
.fm-canvas .stmf-label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 1.1em; }
.fm-canvas .stmf-req { color: #dc2626; margin-left: 2px; }
.fm-canvas .stmf-input, .fm-canvas .stmf-select, .fm-canvas .stmf-textarea { width: 100%; padding: 12px 12px; border: 1px solid #cdd5de; border-radius: 3px; font: inherit; background: #fff; color: inherit; }
.fm-canvas .stmf-field.is-req .stmf-input, .fm-canvas .stmf-field.is-req .stmf-select, .fm-canvas .stmf-field.is-req .stmf-textarea { border-left: 3px solid #ef5350; }
.fm-canvas .stmf-textarea { min-height: 90px; resize: none; }
.fm-canvas .stmf-help { font-size: .85em; color: #64748b; margin-top: 4px; }
.fm-canvas .stmf-check { display: flex; gap: 8px; align-items: center; margin: 4px 0; }
.fm-canvas .fm-imgblock { max-width: 100%; max-height: 260px; display: block; }

/* Form Background panel + floating paint-bucket button */
.fm-bgfab { position: absolute; right: 26px; top: 66px; width: 46px; height: 46px; border-radius: 50%; border: none; background: #fff; box-shadow: 0 2px 8px rgba(15,23,42,.25); color: #2e3a47; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 20; padding: 0; }
.fm-bgfab:hover { background: var(--brand-soft); color: var(--brand-hover); }
.fm-bgfab svg { width: 22px; height: 22px; }
.fm-bgpanel { position: absolute; right: 86px; top: 64px; width: 400px; max-width: calc(100% - 52px); max-height: calc(100% - 90px); overflow-y: auto; background: #fff; border-radius: 6px; box-shadow: 0 6px 28px rgba(15,23,42,.28); z-index: 30; }
.fm-bgh { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 12px 22px; border-bottom: 1px solid #eef1f5; position: sticky; top: 0; background: #fff; }
.fm-bgh h3 { margin: 0; font-size: 18px; font-weight: 500; }
.fm-bgb { padding: 18px 22px 24px; }
.fm-bgb h4 { margin: 0 0 12px; font-size: 14px; font-weight: 500; color: #2e3a47; }
.fm-swgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.fm-sw { aspect-ratio: 1.6; border-radius: 4px; border: 1px solid #dde3ea; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; color: #fff; position: relative; background-clip: padding-box; }
.fm-sw:hover { transform: scale(1.04); }
.fm-sw svg { width: 20px; height: 20px; }
.fm-sw.on { box-shadow: 0 0 0 2px var(--brand); }
.fm-sw[data-c="#e9edf2"] svg, .fm-sw[data-c="#ffffff"] svg { color: #2e3a47; }
.fm-sw.custom, .fm-sw.up { background: #fff; color: #5b6673; }
.fm-sw.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.fm-sw.ph { border-color: transparent; }

/* ---- Submission Rules page */
.fm-rules section { margin-bottom: 40px; }
.fm-rules h3 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.fm-psub { margin: -6px 0 18px; font-size: 14px; line-height: 1.5; color: #333d49; }
.fm-rw { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0 24px; align-items: center; margin-bottom: 20px; max-width: 760px; }
.fm-rw > label { text-align: right; font-size: 14px; color: #1f2937; }
.fm-ctl { width: 100%; height: 40px; padding: 0 14px; border: 1px solid #d3dae3; border-radius: 3px; background: #fff; color: #1f2937; font: 400 14px/1 inherit; font-family: inherit; outline: none; }
.fm-ctl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-ctl.req, .fm-linkfield.req { border-left: 3px solid #ef5350; }
.fm-ctl.bad { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.fm-linkfield { display: flex; height: 40px; border: 1px solid #d3dae3; border-radius: 3px; overflow: hidden; background: #fff; }
.fm-linkfield:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-linkfield.bad { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.fm-linkfield .pre { flex: 1 1 55%; min-width: 0; padding: 0 12px; background: #f2f4f7; display: flex; align-items: center; font-size: 14px; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: 1px solid #e1e6ec; }
.fm-linkfield input { flex: 1 1 45%; min-width: 0; border: none; padding: 0 12px; font: 400 14px/1 inherit; font-family: inherit; outline: none; background: #fff; }
.fm-tip { display: inline-flex; vertical-align: middle; color: #5b6673; margin-left: 6px; cursor: help; }
.fm-tip svg { width: 17px; height: 17px; }
.fm-radios { display: flex; gap: 32px; flex-wrap: wrap; margin-bottom: 16px; }
.fm-rd { display: inline-flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; }
.fm-rd input { position: absolute; opacity: 0; width: 0; height: 0; }
.fm-rd i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid #8f99a6; display: inline-block; position: relative; flex-shrink: 0; }
.fm-rd input:checked + i { border-color: var(--brand); }
.fm-rd input:checked + i::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--brand); }
.fm-rd input:focus-visible + i { box-shadow: 0 0 0 3px var(--brand-glow); }
.fm-af-row { display: grid; grid-template-columns: 1fr 1.4fr 36px; gap: 10px; margin-bottom: 10px; align-items: center; }
.fm-af-row .valwrap { display: flex; gap: 6px; }
.fm-hash { width: 40px; flex-shrink: 0; border: 1px solid #d3dae3; border-radius: 3px; background: #fff; font: 700 16px/1 inherit; color: var(--brand-hover); cursor: pointer; }
.fm-hash:hover { background: var(--brand-soft); }
.fm-addbar { display: flex; width: 100%; align-items: center; gap: 8px; height: 48px; padding: 0 18px; border: none; border-radius: 4px; background: #eef5fb; color: var(--brand-hover); font: 500 15px/1 inherit; font-family: inherit; cursor: pointer; }
.fm-addbar:hover { background: #e2eef8; }
.fm-addbar:disabled { opacity: .5; cursor: not-allowed; }
.fm-addbar svg { width: 16px; height: 16px; }

/* ---- Share Your Form page */
.fm-share h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.fm-share h4 { margin: 0; font-size: 16px; font-weight: 600; }
.fm-warn { display: flex; gap: 10px; align-items: flex-start; background: #fff7e6; border: 1px solid #f5d79e; border-radius: 6px; padding: 12px 14px; margin-bottom: 22px; font-size: 13.5px; color: #7a4b00; }
.fm-warn svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.fm-sharetop { display: grid; grid-template-columns: minmax(0, 1fr) 250px; gap: 0; }
.fm-sharetop-l { padding-right: 36px; }
.fm-sharetop-l p { margin: 0 0 16px; font-size: 14px; color: #333d49; line-height: 1.5; }
.fm-linkbar { display: flex; border: 1px solid #dde3ea; border-radius: 3px; overflow: hidden; margin-bottom: 26px; }
.fm-linkbar input { flex: 1; min-width: 0; border: none; padding: 0 14px; height: 46px; font: 400 15px/1 inherit; font-family: inherit; color: #1f2937; background: #fff; outline: none; }
.fm-linkbar button { border: none; background: var(--brand); color: #fff; font: 600 15px/1 inherit; font-family: inherit; padding: 0 28px; cursor: pointer; }
.fm-linkbar button:hover { background: var(--brand-hover); }
.fm-social { display: flex; gap: 14px; margin-top: 14px; }
.fm-soc { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.fm-soc svg { width: 20px; height: 20px; }
.fm-soc.x { background: #000; } .fm-soc.fb { background: #1877f2; } .fm-soc.wa { background: #25d366; }
.fm-soc:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.fm-sharetop-r { border-left: 1px solid #eef1f5; padding-left: 36px; }
.fm-qrh { font-size: 16px; font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.fm-qrh svg { width: 17px; height: 17px; color: #5b6673; }
.fm-qrbox { width: 140px; height: 140px; padding: 8px; background: #fff; border: 1px solid #e1e6ec; border-radius: 4px; display: flex; align-items: center; justify-content: center; margin-bottom: 14px; }
.fm-qrlinks { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.fm-qrlinks button { border: none; background: none; color: var(--brand-hover); font: 500 14.5px/1 inherit; font-family: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 0; }
.fm-qrlinks button:hover { text-decoration: underline; }
.fm-qrlinks button:disabled { opacity: .5; cursor: default; text-decoration: none; }
.fm-qrlinks svg { width: 18px; height: 18px; }
.fm-qrlinks i { color: #c3cbd6; font-style: normal; }
.fm-or { text-align: center; margin: 34px 0 30px; position: relative; }
.fm-or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dotted #b7c0cb; }
.fm-or span { position: relative; background: #fff; padding: 0 18px; font-size: 15px; color: #333d49; }
.fm-embed-sub { margin: 0 0 18px; font-size: 14px; color: #333d49; }
.fm-pilltabs { display: inline-flex; border: 1px solid #d8dee6; border-radius: 999px; padding: 3px; margin-bottom: 26px; }
.fm-pilltabs button { border: none; background: transparent; padding: 8px 18px; border-radius: 999px; font: 500 15px/1 inherit; font-family: inherit; color: #3a4553; cursor: pointer; }
.fm-pilltabs button.on { background: var(--brand-soft); color: var(--brand-hover); }
.fm-codehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.fm-code { width: 100%; height: 190px; font-family: ui-monospace, Consolas, Menlo, monospace; font-size: 13px; line-height: 1.55; background: #f8f9fb; color: #1f2937; border: 1px solid #e3e8ee; border-radius: 3px; padding: 16px; resize: vertical; outline: none; white-space: pre; overflow: auto; }
.fm-note { margin-top: 22px; background: #fdf0dd; border-radius: 4px; padding: 14px 18px; font-size: 14px; color: #1f2937; }
.fm-note ol { margin: 0; padding-left: 20px; line-height: 1.7; }

/* ------------------------------------------------------------------ "Form Responses" sidebar page */
.page-container:has(> .fm-mod) { overflow: hidden !important; padding: 16px 24px 20px !important; }
.page-container > .fm-mod { flex: 1; flex-shrink: 1; min-height: 0; }
.fm-mod { display: flex; gap: 0; height: 100%; min-height: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.fm-nav { width: 260px; flex-shrink: 0; border-right: 1px solid var(--border); background: #f8fafc; display: flex; flex-direction: column; min-height: 0; }
.fm-nav-h { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 8px; font-weight: 700; font-size: 15px; }
.fm-nav-list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.fm-nav-i { display: flex; align-items: center; gap: 8px; width: 100%; border: none; background: transparent; padding: 8px 10px; border-radius: 8px; font: 500 13.5px/1.2 inherit; font-family: inherit; color: var(--text-secondary); text-align: left; cursor: pointer; margin-bottom: 2px; }
.fm-nav-i:hover { background: var(--bg-active); }
.fm-nav-i.on { background: var(--brand-soft); color: var(--brand-hover); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand); }
.fm-nav-i .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-nav-i .ct { font-size: 12px; color: var(--text-muted); }
.fm-nav-i[data-off="1"] .nm { opacity: .6; font-style: italic; }
.fm-nav-i .mo { display: none; }
.fm-nav-i:hover .mo { display: inline-flex; }
.fm-nav-i svg { width: 16px; height: 16px; flex-shrink: 0; }
.fm-nav-sep { padding: 14px 10px 4px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.fm-nav-sep.sp { display: flex; align-items: center; justify-content: space-between; padding-top: 10px; }
.fm-nav-sep .fm-iconbtn { width: 22px; height: 22px; }
.fm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.fm-main-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.fm-main-h h2 { margin: 0; font-size: 18px; font-weight: 700; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.fm-main-h .fm-select { width: auto; }
.fm-forminfo { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; font-size: 13px; }
.fm-forminfo .sp { flex: 1; }
.fm-bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 18px; background: var(--brand-soft); border-bottom: 1px solid #99f6e4; font-size: 13px; }
.fm-bulk b { margin-right: 6px; }
.fm-recs { flex: 1; min-height: 0; overflow: auto; }
.fm-table-wrap { overflow-x: auto; }
.fm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fm-table th { text-align: left; padding: 11px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; background: #f8fafc; border-bottom: 1px solid var(--border); white-space: nowrap; user-select: none; position: sticky; top: 0; z-index: 1; }
.fm-table th.sortable { cursor: pointer; }
.fm-table th.sortable:hover { color: var(--text-primary); }
.fm-table th .arr { color: var(--brand); margin-left: 3px; }
.fm-table td { padding: 11px 14px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.fm-table tbody tr:hover { background: #f8fafc; }
.fm-table tbody tr.sel { background: var(--brand-soft); }
.fm-table td.act { width: 44px; text-align: right; }
.fm-nm { display: flex; align-items: center; gap: 10px; }
.fm-nm b { font-weight: 600; }
.fm-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 18px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.fm-foot .pg { display: flex; gap: 6px; align-items: center; }
.fm-drawer-ov { position: fixed; inset: 0; z-index: 1900; background: rgba(15,23,42,.35); }
.fm-drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 460px; max-width: 100vw; background: #fff; box-shadow: -10px 0 40px rgba(15,23,42,.2); z-index: 1901; display: flex; flex-direction: column; animation: fm-slide .18s ease-out; }
@keyframes fm-slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.fm-drawer-h { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.fm-drawer-h h3 { margin: 0; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-drawer-b { flex: 1; overflow-y: auto; padding: 18px; }
.fm-dh { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.fm-dl { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13.5px; margin: 0; }
.fm-dl dt { color: var(--text-muted); font-weight: 500; }
.fm-dl dd { margin: 0; word-break: break-word; }
.fm-dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fm-dgrid .full { grid-column: 1 / -1; }

.fm-libtoggle { display: none !important; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .fm-lib { width: 300px; }
  .fm-sharetop { grid-template-columns: 1fr; }
  .fm-sharetop-l { padding-right: 0; }
  .fm-sharetop-r { border-left: none; padding-left: 0; margin-top: 26px; }
}
@media (max-width: 900px) {
  .fm-lh { flex-direction: column; gap: 12px; }
  .fm-lh-a { width: 100%; }
  .fm-lh-a .fm-search { flex: 1; width: auto; }
  .fm-ltable { overflow-x: auto; }
  .fm-table2 { min-width: 760px; }
  .fm-lib { position: absolute; z-index: 40; top: 0; bottom: 0; left: 0; width: 320px; max-width: 88vw; transform: translateX(-102%); transition: transform .2s; box-shadow: var(--shadow-lg); }
  .fm-lib.open { transform: none; }
  .fm-libtoggle { display: inline-flex !important; }
  .fm-tb { padding: 0 10px; gap: 2px; }
  .fm-tbtn { font-size: 0; gap: 0; }
  .fm-tb .vr { margin: 0 4px; }
  .fm-pill-btn { padding: 0 14px; height: 34px; font-size: 13.5px; }
  .fm-bgfab { right: 12px; top: 62px; }
  .fm-bgpanel { right: 12px; }
  .fm-it-set { grid-template-columns: 1fr; }
  .fm-nav { width: 210px; }
  .fm-card2-body { padding: 20px 16px 14px; }
  .fm-ph { padding: 0 14px; }
  .fm-pcol { padding: 22px 18px 70px; border: none; }
  .fm-rw { grid-template-columns: 1fr; gap: 6px; }
  .fm-rw > label { text-align: left; }
}
@media (max-width: 640px) {
  .page-container:has(> .fm-mod) { overflow-y: auto !important; padding: 10px !important; }
  .page-container > .fm-mod { flex: 0 0 auto; min-height: 0; flex-direction: column; }
  .fm-nav { width: 100%; max-height: none; border-right: none; border-bottom: 1px solid var(--border); }
  .fm-nav-h { padding: 10px 12px 4px; }
  .fm-nav-list { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; padding: 4px 10px 10px; }
  .fm-nav-i { width: auto; flex: 0 0 auto; white-space: nowrap; margin: 0; border: 1px solid var(--border); background: #fff; border-radius: 999px; padding: 6px 12px; }
  .fm-nav-i.on { box-shadow: none; border-color: var(--brand); }
  .fm-nav-i .mo, .fm-nav-sep:not(.sp) { display: none !important; }
  .fm-main-h { padding: 12px; gap: 8px; }
  .fm-main-h h2 { width: 100%; }
  .fm-main-h .fm-search { flex: 1 1 100%; max-width: none; }
  .fm-main-h .fm-select, .fm-main-h .fm-btn { flex: 1 1 calc(50% - 8px); min-width: 0; padding: 0 10px; }
  .fm-recs { min-height: 260px; max-height: 70vh; }
  .fm-foot { padding: 10px 12px; }
  .fm-drawer { width: 100vw; }
  .fm-dgrid, .fm-dl { grid-template-columns: 1fr; }
  .fm-dlg-ov { padding: 8px; }
  .fm-dlg-b { padding: 16px; }
  .fm-af-row { grid-template-columns: 1fr; }
  .fm-linkbar button { padding: 0 16px; }
  .fm-radios { gap: 14px; flex-direction: column; }
  .fm-ph h2 { font-size: 16px; }
  .fm-bgpanel { width: calc(100% - 24px); }
}

/* pending-approval bar + duplicate handling (Move / Copy to CRM) */
.fm-pendbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 18px; background: #fff7e6; border-bottom: 1px solid #f5d79e; font-size: 13px; color: #7a4b00; }
.fm-pendbar span { display: inline-flex; align-items: center; gap: 8px; }
.fm-pendbar svg { width: 16px; height: 16px; }
.fm-dup-intro { margin: 0 0 10px; font-size: 13.5px; color: var(--text-secondary); }
.fm-dup-help { font-size: 12.5px; color: var(--text-secondary); background: var(--brand-soft); border: 1px solid #99f6e4; border-radius: 8px; padding: 10px 12px; line-height: 1.5; margin-bottom: 12px; }
.fm-dup-all { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; font-weight: 600; }
.fm-dup-all .fm-select { width: auto; min-width: 200px; }
.fm-dup-list { max-height: 46vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.fm-dup { display: grid; grid-template-columns: 1fr 1.2fr 190px; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); }
.fm-dup:last-child { border-bottom: none; }
.fm-dup-l, .fm-dup-m { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 13px; }
.fm-dup-l span, .fm-dup-m > span { color: var(--text-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-dup-why { color: #b45309 !important; font-weight: 600; }
@media (max-width: 760px) { .fm-dup { grid-template-columns: 1fr; } }

/* drop-downs always show their arrow, so they read as choices (not as fixed text) */
select.fm-select, select.fm-ctl, .fm-lh-a select, .fm-dlg select {
  -webkit-appearance: none; appearance: none; cursor: pointer; padding-right: 34px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
select.fm-select:hover, select.fm-ctl:hover { border-color: var(--brand); }
.fm-dup-h { background: #f8fafc; font-size: 11.5px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 8px; padding-bottom: 8px; }
.fm-dup-h span { overflow: visible !important; }
@media (max-width: 760px) { .fm-dup-h { display: none; } }

/* QR Code dialog (Settings > Forms > ? > QR Code) */
.fm-qrdlg { display: flex; flex-direction: column; align-items: center; }
.fm-qrdlg .fm-warn { align-self: stretch; margin-bottom: 14px; }
.fm-qrdlg-box { width: 280px; max-width: 100%; min-height: 280px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; padding: 8px; background: #fff; box-shadow: var(--shadow-sm); }
.fm-qrdlg-note { margin: 14px 0 16px; text-align: center; font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.fm-qrdlg .fm-linkbar { align-self: stretch; margin-bottom: 16px; }
.fm-qrdlg .fm-linkbar input { height: 40px; font-size: 13.5px; }
.fm-qrdlg .fm-linkbar button { font-size: 13.5px; padding: 0 18px; }
.fm-qrdlg-act { display: flex; gap: 10px; }
.fm-qrdlg-act .fm-btn { display: inline-flex; align-items: center; gap: 6px; }
.fm-qrdlg-act .fm-btn svg { width: 16px; height: 16px; }

/* tag filter + column chooser (Form Contacts) */
.fm-checkmenu { min-width: 230px; padding: 6px 4px; }
.fm-chk { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.fm-chk:hover { background: var(--bg-hover); }
.fm-chk input { width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.fm-chk em { font-style: normal; color: var(--text-muted); font-size: 12px; }
.fm-checkmenu .sep { height: 1px; background: var(--border); margin: 5px 2px; }
.fm-checkmenu > button { display: block; width: 100%; padding: 8px 12px; border: none; background: transparent; text-align: left; font: 600 13px/1.2 inherit; font-family: inherit; color: var(--brand-hover); cursor: pointer; border-radius: 6px; }
.fm-checkmenu > button:hover { background: var(--bg-hover); }
.fm-table .tagcell { min-width: 90px; }
.fm-dlg .tagpick { position: relative; }
/* Form Contact history: tabs, log box, timeline */
.fm-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 0 0 14px; }
.fm-tabs button { border: none; background: none; padding: 9px 13px; font: 600 13px/1 inherit; font-family: inherit; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.fm-tabs button:hover { color: var(--text-primary); }
.fm-tabs button.on { color: var(--brand-hover); border-bottom-color: var(--brand); }
.fm-tabn { background: var(--brand-soft); color: var(--brand-hover); border-radius: 999px; font-size: 11px; padding: 2px 7px; }
.fm-tabn.hidden { display: none; }
.fm-logbox { background: #f8fafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.fm-log-oc { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-oc { border: 1px solid var(--border-strong); background: #fff; border-radius: 999px; padding: 6px 12px; font: 500 12.5px/1 inherit; font-family: inherit; color: var(--text-secondary); cursor: pointer; }
.fm-oc:hover { border-color: var(--brand); color: var(--text-primary); }
.fm-oc.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.fm-log-fu { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.fm-log-fu .hidden { display: none; }
.fm-tl { list-style: none; margin: 0; padding: 0; }
.fm-tl-i { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border-subtle); }
.fm-tl-i:first-child { border-top: none; }
.fm-tl-ic { width: 26px; height: 26px; border-radius: 50%; background: #f1f5f9; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0; }
.fm-tl-b { flex: 1; min-width: 0; }
.fm-tl-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.fm-tl-a { margin-left: auto; display: inline-flex; gap: 10px; }
.fm-tl-t { margin-top: 4px; font-size: 13.5px; line-height: 1.5; word-wrap: break-word; }
.fm-tl-event .fm-tl-t, .fm-tl-origin .fm-tl-t { color: var(--text-secondary); }
.fm-link { border: none; background: none; padding: 0; color: var(--brand-hover); font: 600 12px/1 inherit; font-family: inherit; cursor: pointer; }
.fm-link:hover { text-decoration: underline; }
.fm-fu.late { color: #b91c1c; font-weight: 600; }
.fm-drawer .tk-head { margin-top: 0; }
/* narrower lists panel that can be hidden */
.fm-nav { width: 208px; }
.fm-nav-h { padding: 14px 12px 6px; font-size: 14px; }
.fm-nav-hb { display: inline-flex; gap: 2px; }
.fm-nav-list { padding: 4px 6px 12px; }
.fm-nav-i { padding: 7px 9px; font-size: 13px; }
.fm-mod.nav-off .fm-nav { display: none; }
.fm-navopen { display: none; }
.fm-mod.nav-off .fm-navopen { display: inline-flex; }
.fm-main-h h2 { font-size: 17px; }

/* a person as a full page (like a CRM contact) */
.page-container > .fm-detail { flex: 1; min-height: 0; overflow-y: auto; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 22px 26px; }
.fm-dt-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.fm-crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.fm-crumbs i { font-style: normal; opacity: .6; } .fm-crumbs b { color: var(--text-primary); font-weight: 600; }
.fm-dt-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.fm-av-lg { width: 56px; height: 56px; font-size: 20px; border-radius: 50%; }
.fm-dt-id { flex: 1; min-width: 220px; }
.fm-dt-id h1 { margin: 0 0 2px; font-size: 22px; font-weight: 700; }
.fm-dt-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fm-dt-act { display: flex; gap: 8px; flex-wrap: wrap; }
.fm-dt-grid { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 22px; margin-top: 18px; align-items: start; }
.fm-dt-left { display: flex; flex-direction: column; gap: 14px; }
.fm-card { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.fm-card .fm-dl { margin: 0; }
.fm-card .tagcell { min-width: 0; }
.fm-dt-right { min-width: 0; }
@media (max-width: 1000px) { .fm-dt-grid { grid-template-columns: 1fr; } }
/* compact "Log activity" */
.fm-logbox { padding: 10px 12px; margin-bottom: 12px; }
.fm-logbox .fm-dh { margin-bottom: 8px; }
.fm-log-r1 { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.fm-log-r1 .fm-select { width: auto; min-width: 190px; height: 34px; }
.fm-log-r1 .fm-input { flex: 1; min-width: 200px; height: 34px; }
.fm-log .fm-textarea { height: auto; padding: 8px 10px; min-height: 0; resize: vertical; }
.fm-log-fu { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fm-log-fu .fm-select, .fm-log-fu .fm-input { width: auto; height: 34px; }
.fm-log-fu .hidden, .fm-log-r1 .hidden { display: none; }
.fm-log-save { margin-left: auto; height: 34px; padding: 0 18px; }

/* long text stays inside its box */
.fm-dl dt, .fm-dl dd { min-width: 0; overflow-wrap: anywhere; }
.fm-dl .fm-pill { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; border-radius: 10px; line-height: 1.35; padding: 3px 9px; vertical-align: top; }
.fm-card { min-width: 0; overflow: hidden; }
.fm-card .fm-dl { grid-template-columns: minmax(80px, 38%) minmax(0, 1fr); }
.fm-dt-id h1 { overflow-wrap: anywhere; }
.fm-table td { overflow-wrap: anywhere; }
.fm-nav-i .nm { min-width: 0; }