/*
 * Shared form, editor, upload, attachment, and modal primitives.
 * Extracted from app.css to keep authoring surfaces isolated from page layout.
 */

.form-wrap { padding: 20px; overflow: auto; }
.editor-shell { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden; }
.editor-toolbar { display: flex; gap: 3px; align-items: center; flex-wrap: wrap; padding: 6px 7px; border-bottom: 1px solid var(--border); background: var(--bg); }
.editor-toolbar button, .editor-toolbar label.tool { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 4px 7px; min-width: 30px; color: var(--text); cursor: pointer; }
.editor-toolbar input[type=color] { width: 32px; height: 30px; padding: 2px; }
.editor { min-height: 420px; padding: 16px; outline: none; line-height: 1.6; }
.editor table { border-collapse: collapse; width: 100%; margin: 12px 0; resize: both; overflow: auto; }
.editor td, .editor th { border: 1px solid var(--border); padding: 8px; min-width: 64px; resize: both; overflow: auto; }
.editor td.is-selected, .editor th.is-selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.editor img, .detail img, .editor video, .detail video { max-width: 100%; height: auto; }

.app-upload-dropzone { box-sizing:border-box; position:relative; display:grid; grid-template-columns:36px minmax(0,1fr); align-items:center; gap:10px; width:100%; min-height:74px; padding:12px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface-subtle); color:var(--muted); cursor:pointer; transition:border-color .15s,background .15s,box-shadow .15s; }
.app-upload-dropzone:hover,.app-upload-dropzone.is-dragover { border-color:var(--accent); background:var(--accent-soft); }
.app-upload-dropzone:focus-visible { outline:0; border-color:var(--accent); box-shadow:0 0 0 3px var(--focus-ring); }
.app-upload-dropzone.has-files { border-color:var(--border-strong); background:var(--surface); }
.app-upload-dropzone > input[type=file] { position:absolute !important; width:1px !important; height:1px !important; opacity:0 !important; pointer-events:none !important; }
.app-upload-icon { display:grid; width:34px; height:34px; place-items:center; border:1px solid color-mix(in srgb,var(--accent) 22%,var(--border)); border-radius:var(--radius); background:var(--surface); color:var(--accent); font-size:20px; line-height:1; }
.app-upload-icon svg { width:18px; height:18px; }
.app-upload-dropzone > span:nth-child(2) { display:grid; gap:2px; }
.app-upload-dropzone > span:nth-child(2) strong { color:var(--text); font-size:var(--text-sm); }
.app-upload-dropzone > span:nth-child(2) small { color:var(--faint); font-size:var(--text-xs); }
.app-upload-files { grid-column:1 / -1; display:grid; gap:6px; }
.app-upload-files:empty { display:none; }
.app-upload-files > span { min-width:0; min-height:34px; padding:5px 5px 5px 8px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); color:var(--text); display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:7px; font-size:var(--text-xs); }
.app-upload-files > span strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:inherit; }
.app-upload-files > span small { color:var(--faint); white-space:nowrap; }
.app-upload-file-remove { width:26px; min-width:26px; height:26px; min-height:26px; padding:0; color:var(--muted); }
.app-upload-file-remove svg { width:14px; height:14px; }
.app-upload-file-remove:hover,.app-upload-file-remove:focus-visible { color:var(--danger); border-color:color-mix(in srgb,var(--danger) 38%,var(--border)); background:color-mix(in srgb,var(--danger) 7%,var(--surface)); }

.memo-editor { container-type:inline-size; overflow:hidden; border:1px solid var(--border-strong); border-radius:var(--radius-lg); background:var(--surface); }
.memo-editor.is-dragover { outline:2px solid var(--accent); outline-offset:2px; }
.memo-editor-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:4px; min-height:42px; padding:5px 7px; border-bottom:1px solid var(--border); background:var(--surface-subtle); }
.memo-toolbar-row { display:inline-flex; align-items:center; gap:4px; min-width:0; }
.memo-toolbar-group { display:inline-flex; align-items:center; gap:3px; }
.memo-editor-toolbar button { display:inline-flex; align-items:center; justify-content:center; gap:4px; min-width:32px; min-height:28px; padding:3px 6px; border:1px solid transparent; background:transparent; color:var(--muted); }
.memo-editor-toolbar button:hover { border-color:var(--border); background:var(--surface); color:var(--text); }
.memo-editor-toolbar button.is-active { border-color:color-mix(in srgb,var(--accent) 28%,var(--border)); background:var(--accent-soft); color:var(--accent); }
.memo-editor-toolbar svg { width:14px; height:14px; }
.memo-toolbar-separator { width:1px; height:18px; margin:0 2px; background:var(--border); }
.memo-toolbar-select { display:inline-flex; min-width:0; }
.memo-toolbar-select select { width:auto; min-width:82px; min-height:30px; padding:3px 26px 3px 7px; border:1px solid var(--border); border-radius:var(--radius); background-color:var(--surface); color:var(--text); font-size:var(--text-xs); }
.memo-toolbar-font select { min-width:98px; }
.memo-table-picker { position:relative; display:inline-flex; }
.memo-table-popover { position:fixed; z-index:calc(var(--z-overlay) + 20); width:228px; display:none; gap:8px; padding:12px; border:1px solid var(--border-strong); border-radius:var(--radius-lg); background:var(--surface); box-shadow:0 14px 36px rgba(16,24,40,.18); }
.memo-table-picker.is-open .memo-table-popover { display:grid; }
.memo-table-popover > strong { color:var(--text); font-size:var(--text-xs); font-weight:700; }
.memo-table-grid { display:grid; grid-template-columns:repeat(10,16px); gap:4px; }
.memo-editor-toolbar .memo-table-grid button { width:16px; min-width:16px; height:16px; min-height:16px; padding:0; border:1px solid var(--border-strong); border-radius:2px; background:var(--surface-subtle); }
.memo-editor-toolbar .memo-table-grid button:hover,
.memo-editor-toolbar .memo-table-grid button.is-selected { border-color:color-mix(in srgb,var(--accent) 58%,var(--border)); background:var(--accent-soft); }
.memo-table-tools { position:fixed; z-index:calc(var(--z-overlay) + 24); display:grid; width:max-content; max-width:calc(100vw - 20px); gap:7px; padding:8px; border:1px solid var(--border-strong); border-radius:var(--radius-lg); background:var(--surface); box-shadow:0 12px 32px rgba(16,24,40,.2); }
.memo-table-tools[hidden] { display:none !important; }
.memo-table-tools-head { display:flex; align-items:center; gap:5px; min-height:28px; }
.memo-table-tools-head > strong { margin-right:auto; color:var(--text); font-size:var(--text-2xs); }
.memo-editor-toolbar .memo-table-tools-head > button { min-height:27px; padding:3px 7px; font-size:var(--text-2xs); }
.memo-editor-toolbar .memo-table-tools-head > .memo-table-tools-close { width:27px; min-width:27px; padding:0; font-size:18px; line-height:1; }
.memo-table-actions,.memo-cell-colors { display:flex; align-items:center; flex-wrap:wrap; gap:3px; }
.memo-editor-toolbar .memo-table-actions button { min-width:32px; padding-inline:6px; font-size:var(--text-2xs); font-weight:750; }
.memo-editor-toolbar .memo-cell-color { width:24px; min-width:24px; height:24px; min-height:24px; padding:3px; border-color:var(--border); border-radius:50%; background-clip:content-box; }
.memo-editor-toolbar .memo-cell-color.is-clear { background-color:var(--surface); background-image:linear-gradient(135deg,transparent 45%,var(--danger) 46%,var(--danger) 54%,transparent 55%); }
.memo-editor-toolbar .memo-cell-color.is-lightgray { background-color:#edf0f4; }
.memo-editor-toolbar .memo-cell-color.is-gray { background-color:#aab2bf; }
.memo-editor-toolbar .memo-cell-color.is-yellow { background-color:#f5d84b; }
.memo-editor-toolbar .memo-cell-color.is-green { background-color:#5ec887; }
.memo-editor-toolbar .memo-cell-color.is-blue { background-color:#6ca6ec; }
.memo-editor-toolbar .memo-cell-color.is-red { background-color:#ef7a74; }
.memo-editor-toolbar .memo-cell-color.is-active { outline:2px solid var(--text); outline-offset:1px; }
.memo-editor-surface { min-height:300px; max-height:52vh; overflow:auto; padding:20px; outline:0; color:var(--text); font-size:var(--rich-text-base); line-height:var(--rich-text-line-height); letter-spacing:0; }
.memo-editor-surface:focus { box-shadow:inset 0 0 0 2px color-mix(in srgb,var(--accent) 20%,transparent); }
.memo-editor-surface:empty::before { content:"내용을 입력하세요"; color:var(--faint); }
.memo-editor-surface h2 { margin:18px 0 8px; font-size:var(--rich-text-xl); letter-spacing:0; }
.memo-editor-surface h3 { margin:16px 0 7px; font-size:var(--rich-text-lg); letter-spacing:0; }
.memo-editor-surface p,.generated-form-memo p { margin:0; }
.memo-editor-surface :is(ul,ol),.generated-form-memo :is(ul,ol) { margin:.35em 0; padding-left:1.55em; }
.memo-editor-surface li + li,.generated-form-memo li + li { margin-top:.3em; }
.memo-editor-surface blockquote,.generated-form-memo blockquote { margin:12px 0; padding:9px 13px; border-left:3px solid var(--border-strong); background:var(--surface-subtle); color:var(--muted); }
.memo-editor-surface table,.generated-form-memo table,.workspace-document-body table { width:100%; margin:10px 0; border-collapse:collapse; table-layout:fixed; }
.memo-editor-surface th,.memo-editor-surface td,.generated-form-memo th,.generated-form-memo td,.workspace-document-body th,.workspace-document-body td { min-width:64px; padding:6px 8px; border:1px solid var(--border-strong); vertical-align:top; line-height:var(--rich-text-table-line-height); }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body) :is(th,td) > p { margin:0; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body) :is(th,td) > p + p { margin-top:.35em; }
.memo-editor-surface td.is-editor-selected,.memo-editor-surface th.is-editor-selected { position:relative; outline:2px solid var(--accent); outline-offset:-2px; }
.memo-editor-surface hr,.generated-form-memo hr,.workspace-document-body hr { margin:20px 0; border:0; border-top:1px solid var(--border-strong); }
.memo-editor-surface img,.memo-editor-surface video,.generated-form-memo img,.generated-form-memo video { display:block; width:auto; max-width:100%; height:auto; max-height:min(72vh,720px); margin:10px auto; border-radius:var(--radius); object-fit:contain; }
.memo-editor-surface figure,.generated-form-memo figure { max-width:100%; margin:12px 0; }
.memo-editor-surface figcaption,.generated-form-memo figcaption { margin-top:5px; overflow-wrap:anywhere; color:var(--faint); font-size:var(--text-xs); text-align:center; }
.memo-pending-media-placeholder { display:flex; min-height:112px; align-items:center; justify-content:center; padding:20px; border:1px dashed var(--border-strong); border-radius:var(--radius); background:var(--surface-subtle); color:var(--muted); font-weight:700; }
.memo-editor-status { margin:0; padding:8px 12px; border-top:1px solid var(--border); background:var(--surface-subtle); color:var(--muted); font-size:var(--text-xs); }
.memo-editor-status.is-error { background:var(--danger-soft); color:var(--danger); }
.memo-editor-status.is-success { background:var(--success-bg); color:var(--success-text); }
.memo-editor-status.is-loading { display:flex; align-items:center; gap:8px; color:var(--text); }
.dynamic-form-runtime.is-loading, [data-form-runtime].is-loading { min-height:180px; display:grid; place-items:center; }
.dynamic-form-loading, .dynamic-form-error { width:100%; padding:32px 20px; border:1px solid var(--border); border-radius:6px; background:var(--surface-subtle); color:var(--muted); text-align:center; }
.dynamic-form-error { color:var(--danger); }
.memo-editor-status.is-loading:before { content:""; width:14px; height:14px; flex:0 0 14px; border:2px solid var(--border-strong); border-top-color:var(--brand); border-radius:50%; animation:editor-saving-spin .72s linear infinite; }
.editor-saving-notice { position:fixed; z-index:calc(var(--z-modal) + 30); top:calc(env(safe-area-inset-top,0px) + 78px); left:50%; display:grid; grid-template-columns:auto auto; align-items:center; gap:2px 9px; min-width:250px; max-width:calc(100vw - 32px); padding:12px 16px; border:1px solid var(--border-strong); border-radius:8px; background:var(--surface); color:var(--text); box-shadow:0 16px 42px rgba(16,24,40,.2); transform:translateX(-50%); }
.editor-saving-notice[hidden] { display:none; }
.editor-saving-notice > strong { font-size:var(--text-sm); }
.editor-saving-notice > span:last-child { grid-column:2; color:var(--muted); font-size:var(--text-xs); }
.editor-saving-spinner { grid-row:1 / span 2; width:20px; height:20px; border:2px solid var(--border-strong); border-top-color:var(--brand); border-radius:50%; animation:editor-saving-spin .72s linear infinite; }
.is-editor-saving { cursor:progress; }
.is-editor-saving button[type="submit"].is-loading { position:relative; opacity:.72; pointer-events:none; }
@keyframes editor-saving-spin { to { transform:rotate(360deg); } }
.generated-form-memo { min-height:80px; color:var(--text); font-size:var(--rich-text-base); line-height:var(--rich-text-line-height); letter-spacing:0; }
.memo-editor.is-source-mode .memo-editor-surface { display:none; }
.memo-editor.is-source-mode .html-area { display:block; min-height:300px; max-height:52vh; overflow:auto; }

.mention-popover { position:fixed; z-index:calc(var(--z-overlay) + 40); overflow:hidden; border:1px solid var(--border-strong); border-radius:var(--radius-lg); background:var(--surface); box-shadow:0 16px 42px rgba(16,24,40,.2); }
.mention-popover > header { display:flex; align-items:center; justify-content:space-between; gap:10px; min-height:42px; padding:8px 11px; border-bottom:1px solid var(--border); background:var(--surface-subtle); }
.mention-popover > header strong { color:var(--text); font-size:var(--text-xs); }
.mention-popover > header span { color:var(--faint); font-size:var(--text-2xs); }
.mention-popover > div { max-height:238px; overflow:auto; padding:4px; }
.mention-popover button { width:100%; min-height:48px; display:grid; grid-template-columns:32px minmax(0,1fr) auto; align-items:center; gap:9px; padding:6px 8px; border:0; border-radius:var(--radius); background:transparent; color:var(--text); text-align:left; }
.mention-popover button:hover,.mention-popover button.is-active { background:var(--accent-soft); }
.mention-popover button > span:nth-child(2) { min-width:0; display:grid; gap:1px; }
.mention-popover button strong,.mention-popover button small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mention-popover button strong { font-size:var(--text-xs); }
.mention-popover button small { color:var(--muted); font-size:var(--text-2xs); }
.mention-popover button em { color:var(--accent); font-size:var(--text-2xs); font-style:normal; }
.mention-avatar { width:30px; height:30px; display:grid; place-items:center; border-radius:50%; background:var(--icon-muted-bg); color:var(--icon-muted); font-size:var(--text-xs); font-weight:750; }

:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-text-sm { font-size:var(--rich-text-sm)!important; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-text-base { font-size:var(--rich-text-base)!important; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-text-lg { font-size:var(--rich-text-lg)!important; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-text-xl { font-size:var(--rich-text-xl)!important; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-align-left { text-align:left; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-align-center { text-align:center; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-align-right { text-align:right; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-align-justify { text-align:justify; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) li.gw-list-marker-bold::marker { font-weight:700; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) li.gw-list-marker-italic::marker { font-style:italic; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) li:is(.gw-align-center,.gw-align-right) { list-style-position:inside; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-lightgray { background:#f2f4f7; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-gray { background:#d0d5dd; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-yellow { background:#fff7cc; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-green { background:#e9f8ef; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-blue { background:#eaf2ff; }
:where(.memo-editor-surface,.generated-form-memo,.workspace-document-body,.detail) .gw-cell-red { background:#fff0ef; }

.unified-preview-dialog .workspace-modal-body { display:flex; min-height:0; padding:0; overflow:hidden; background:var(--bg); }
.unified-preview-dialog iframe { display:block; flex:1 1 auto; width:100%; height:100%; min-height:0; border:0; background:var(--bg); }
.html-area { display: none; width: 100%; min-height: 360px; border: 0; border-top: 1px solid var(--border); border-radius: 0; padding: 14px; background: var(--surface); color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.form-stack { display: grid; gap: 12px; width: 100%; max-width: none; }
.attachments { margin-top: 24px; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.attachments li { margin: 7px 0; }
.compose-attachments { margin-top: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-subtle); }
.compose-attachments-head { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.compose-attachments-head span { color: var(--muted); font-size: var(--text-2xs); }
.compose-attachments ul { display: grid; margin: 0; padding: 0; list-style: none; }
.compose-attachments li { min-width: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; }
.compose-attachments li + li { border-top: 1px solid var(--border); }
.compose-attachments li a { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); text-decoration: none; }
.compose-attachments li a:hover { background: var(--surface); }
.compose-attachments li a > span:last-child { min-width: 0; display: grid; gap: 2px; }
.compose-attachments li strong { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.compose-attachments li small { color: var(--muted); font-size: var(--text-3xs); }
.compose-attachment-actions { min-width:max-content; display:flex; align-items:center; gap:6px; padding-right:12px; }
.compose-attachment-download { width:32px; min-width:32px; height:32px; min-height:32px; padding:0!important; color:var(--icon-muted); }
.compose-attachment-download svg { width:16px; height:16px; }
.compose-attachment-remove { display: inline-flex; align-items: center; margin-right: 12px; cursor: pointer; }
.compose-attachment-actions .compose-attachment-remove { margin-right:0; }
.compose-attachment-remove input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.compose-attachment-remove > span { min-height: 30px; display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); color: var(--muted); font-size: var(--text-2xs); font-weight: 650; }
.compose-attachment-remove input:checked + span { border-color: color-mix(in srgb,var(--danger) 38%,var(--border)); background: var(--danger-soft); color: var(--danger); }
.compose-attachment-remove svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.compose-attachments li.is-remove-pending > a { opacity:.48; text-decoration:line-through; }
.compose-attachment-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 6px; background: var(--icon-muted-bg); color: var(--icon-muted); }
.compose-attachment-icon svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; }
.compose-upload-field { margin-top: 14px; }
.compose-upload-field small { display: block; margin-top: 5px; color: var(--muted); font-size: var(--text-3xs); }
input[type="file"] { line-height:1.35; }
.compose-upload-field input[type="file"],
.app-form-dialog input[type="file"] { min-height:44px; padding:6px 8px; font-size:16px !important; line-height:1.35; }
.compose-upload-field input[type="file"]::file-selector-button,
.app-form-dialog input[type="file"]::file-selector-button { height:34px; min-height:34px; margin:0 10px 0 0; padding:0 12px; border:1px solid var(--border-strong); border-radius:var(--radius); background:var(--surface-subtle); color:var(--text); font-size:14px; font-weight:650; line-height:1; vertical-align:middle; }
.document-attachments { padding: 20px 4px 24px; border-bottom: 1px solid var(--border); }
.document-attachments > header > div { display: flex; align-items: baseline; gap: 8px; margin-bottom: 11px; }
.document-attachments h2 { margin: 0; font-size: var(--text-control); }
.document-attachments header span { color: var(--muted); font-size: var(--text-2xs); }
.document-attachment-list { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-subtle); }
.document-attachment-list > a, .document-attachment-row { min-width: 0; min-height: 52px; display: grid; grid-template-columns: minmax(0,1fr); align-items: center; border-bottom: 1px solid var(--border); }
.document-attachment-list > a:last-child, .document-attachment-row:last-child { border-bottom: 0; }
.document-attachment-list > a, .document-attachment-row > a { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px 11px; color: var(--text); text-decoration: none; }
.document-attachment-list > a:hover, .document-attachment-row > a:hover { background: var(--surface); }
.document-attachment-list a > span:nth-child(2) { min-width: 0; display: grid; gap: 2px; }
.document-attachment-list strong { overflow: hidden; font-size: var(--text-xs); text-overflow: ellipsis; white-space: nowrap; }
.document-attachment-list small { color: var(--muted); font-size: var(--text-3xs); }
.attachment-open { display: inline-flex !important; grid-auto-flow: column; align-items: center; gap: 4px; margin-left: auto; color: var(--muted); font-size: var(--text-3xs); white-space: nowrap; }
.attachment-open svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.document-attachment-row > form { margin: 0 10px 0 0; }
.document-attachment-row > form .icon-btn { width: 32px; height: 32px; min-height: 32px; padding: 0; }
.attachment-preview-action { width:100%; min-width:0; min-height:52px; display:grid; grid-template-columns:32px minmax(0,1fr) 34px; align-items:center; gap:10px; padding:9px 11px; border:0; border-radius:0; background:transparent; color:var(--text); text-align:left; box-shadow:none; }
.attachment-preview-action:hover { background:var(--surface-hover); }
.attachment-preview-action > span:nth-child(2) { min-width:0; display:grid; gap:2px; }
.attachment-preview-action strong, .attachment-preview-action small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.attachment-preview-action small { color:var(--muted); font-size:var(--text-xs); }
.attachment-preview-icon { width:32px; height:32px; display:grid; place-items:center; color:var(--icon-muted); }
.attachment-preview-icon svg { width:18px; height:18px; stroke:currentColor; fill:none; stroke-width:1.8; }
.attachment-preview-action:hover .attachment-preview-icon { color:var(--accent); }
.preview-btn { margin-left: 8px; padding: 4px 7px; }
.modal { position: fixed; inset: 0; background: rgba(31,35,40,.42); display: none; z-index: var(--z-overlay); }
.modal.open { display:grid; place-items:start center; padding:16px; overflow:auto; }
.modal-box { width: min(1480px, calc(100vw - 24px)); height: min(940px, calc(100vh - 24px)); background: var(--surface); border-radius: 8px; box-shadow: 0 22px 80px rgba(0,0,0,.28); display: flex; flex-direction: column; }
.modal.open .modal-box { width:min(1480px,100%); height:calc(100vh - var(--modal-viewport-block-inset)); margin:0 auto; }
.attachment-preview-box { overflow:hidden; border:1px solid var(--border); }
.attachment-preview-box .workspace-modal-head { flex:0 0 auto; }
.app-attachment-dialog .workspace-modal-head { grid-template-columns:44px minmax(0,1fr) auto; }
.attachment-dialog-head-actions { display:flex; align-items:center; }
.attachment-dialog-head-actions .attachment-external-open { min-height:36px; padding:0 12px; white-space:nowrap; }
.attachment-dialog-head-actions .attachment-external-open svg { width:16px; height:16px; }
.attachment-dialog-head-actions .attachment-download { width:36px; min-width:36px; height:36px; min-height:36px; padding:0; display:grid; place-items:center; }
.attachment-dialog-head-actions .attachment-download svg { width:16px; height:16px; }
.attachment-pdf-mode-switch { display:inline-flex; align-items:center; overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); }
.attachment-pdf-mode-switch.is-hidden { display:none; }
.attachment-pdf-mode-switch button { min-height:34px; padding:0 10px; border:0; border-right:1px solid var(--border); background:transparent; color:var(--muted); font-size:var(--text-xs); font-weight:700; }
.attachment-pdf-mode-switch button:last-child { border-right:0; }
.attachment-pdf-mode-switch button.is-active { background:var(--surface-subtle); color:var(--accent); }
.workspace-modal.app-attachment-dialog { width:min(1320px,calc(100vw - var(--modal-viewport-inset))); height:calc(100vh - var(--modal-viewport-block-inset)); }
.app-attachment-body { min-height:0; padding:0; overflow:hidden; background:#e9edf2; }
.app-attachment-body > [data-attachment-file-frame] { display:block; width:100%; height:100%; min-width:0; min-height:0; border:0; background:#e9edf2; }
.app-attachment-body > [hidden] { display:none!important; }
.app-attachment-body.has-review-pane > .universal-preview-status { grid-column:1; grid-row:1; }
@media (max-width:720px) {
  .app-attachment-body.has-review-pane > .universal-preview-status { grid-column:1; grid-row:2; }
  .app-attachment-dialog[data-attachment-tab="memo"] .universal-preview-status { display:none; }
}
.app-attachment-dialog.is-expanded { width:calc(100vw - 16px); max-width:none; height:calc(100dvh - 16px); max-height:none; }
.app-attachment-dialog.is-expanded .app-attachment-body.has-review-pane { grid-template-columns:minmax(0,3fr) minmax(300px,1fr); }
.app-attachment-pdf-viewer,.app-attachment-image-viewer { min-width:0; min-height:0; height:100%; display:grid; grid-template-rows:auto minmax(0,1fr); background:#35383c; }
.app-attachment-pdf-viewer[hidden],.app-attachment-image-viewer[hidden] { display:none!important; }
.app-attachment-viewer-toolbar { min-width:0; min-height:48px; display:flex; align-items:center; justify-content:center; padding:6px 10px; overflow-x:auto; border-bottom:1px solid #202328; background:#2d3034; color:#fff; }
.app-attachment-viewer-toolbar-inner { min-width:max-content; display:flex; align-items:center; justify-content:center; gap:12px; margin-inline:auto; }
.app-attachment-viewer-tool-group { display:inline-flex; align-items:center; gap:6px; white-space:nowrap; }
.app-attachment-viewer-toolbar button { min-width:36px; min-height:34px; display:inline-flex; align-items:center; justify-content:center; gap:5px; padding:0 9px; border:1px solid #555b62; border-radius:5px; background:#3b3f44; color:#fff; white-space:nowrap; }
.app-attachment-viewer-toolbar button:hover,.app-attachment-viewer-toolbar button.is-active { border-color:#8ea1b8; background:#50565d; }
.app-attachment-viewer-toolbar label { display:flex; align-items:center; gap:5px; white-space:nowrap; }
.app-attachment-viewer-toolbar input { width:54px; min-height:34px; padding:4px 6px; border:1px solid #555b62; background:#202328; color:#fff; text-align:center; }
.app-attachment-viewer-toolbar .toolbar-divider { width:1px; height:24px; flex:0 0 1px; background:#697078; }
.app-attachment-pdf-scroll { position:relative; min-width:0; min-height:0; overflow:auto; overscroll-behavior:contain; touch-action:pan-x pan-y; background:#4b4e52; }
.app-attachment-pdf-scroll.is-hand-enabled { cursor:grab; }
.app-attachment-pdf-scroll.is-dragging { cursor:grabbing; user-select:none; }
.app-attachment-pdf-pages { width:max-content; min-width:100%; display:grid; justify-items:center; gap:18px; padding:18px; }
.app-attachment-pdf-page { width:max-content; line-height:0; contain:layout paint style; background:#fff; box-shadow:0 3px 14px rgba(0,0,0,.34); }
.app-attachment-pdf-page.is-pending { background:linear-gradient(110deg,#f4f5f6 8%,#fff 18%,#f4f5f6 33%); background-size:200% 100%; animation:attachment-pdf-pending 1.4s linear infinite; }
.app-attachment-pdf-page canvas { display:block; max-width:none; }
@keyframes attachment-pdf-pending { to { background-position-x:-200%; } }
.app-attachment-image-scroll { position:relative; min-width:0; min-height:0; display:grid; place-items:start center; overflow:auto; overscroll-behavior:contain; touch-action:pan-x pan-y; padding:18px; background:#4b4e52; }
.app-attachment-image-scroll.is-hand-enabled { cursor:grab; }
.app-attachment-image-scroll.is-dragging { cursor:grabbing; user-select:none; }
.app-attachment-image-stage { position:relative; flex:0 0 auto; }
.app-attachment-image-scroll img { position:absolute; top:50%; left:50%; display:block; max-width:none; height:auto; background:#fff; box-shadow:0 3px 14px rgba(0,0,0,.34); transform-origin:center; translate:-50% -50%; }
.app-attachment-print-frame { position:fixed; width:1px; height:1px; inset:auto 0 0 auto; border:0; opacity:.01; pointer-events:none; }
.app-attachment-pdf-status { position:absolute; inset:50% auto auto 50%; transform:translate(-50%,-50%); margin:0; padding:10px 14px; border-radius:6px; background:rgba(24,27,31,.86); color:#fff; font-size:var(--text-xs); text-align:center; }
.modal-body { padding: 18px; }
.modal-head { height: var(--list-head-height); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); padding: 0 14px; }
.modal-frame, .admin-frame { min-height: 0; border: 0; flex: 1; width: 100%; background: var(--surface); overscroll-behavior: contain; }
.workspace-modal { width: min(var(--modal-width-md),calc(100vw - var(--modal-viewport-inset))); max-width: none; height:auto; max-height: calc(100dvh - var(--modal-viewport-block-inset)); margin: auto; padding: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); box-shadow: 0 24px 68px rgba(16,24,40,.28); }
.workspace-modal[open] { display: flex; flex-direction: column; }
dialog.workspace-modal[open],
dialog.app-form-dialog[open] {
  position:fixed;
  inset:auto;
  top:50%;
  left:50%;
  margin:0;
  transform:translate(-50%,-50%);
}
.workspace-modal::backdrop { background: rgba(18,24,33,.48); backdrop-filter: blur(2px); touch-action:none; overscroll-behavior:none; }
.workspace-modal-large { width: min(var(--modal-width-lg),calc(100vw - var(--modal-viewport-inset))); height: calc(100vh - var(--modal-viewport-block-inset)); }
.workspace-modal-head { min-height:var(--modal-head-height); display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:16px; padding:17px 24px; border-bottom:1px solid var(--border); background:var(--surface); }
.workspace-modal-head h2 { margin:0; font-size:var(--text-lg); }
.workspace-modal-head p { margin:5px 0 0; color:var(--muted); font-size:var(--text-xs); line-height:1.5; }
.workspace-modal-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 7px; background: var(--icon-muted-bg); color: var(--icon-muted); }
.workspace-modal-icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2; }
.app-dialog-head-actions { min-width:0; display:inline-flex; align-items:center; justify-content:flex-end; gap:10px; color:var(--text); }
.app-dialog-head-action-group { min-width:0; display:inline-flex; align-items:center; gap:4px; }
.app-dialog-head-actions [hidden] { display:none!important; }
.app-dialog-head-actions .icon-btn,
.workspace-modal-head > .icon-btn:last-child,
.workspace-modal-head > a.icon-btn:last-child { width:var(--icon-button-size); min-width:var(--icon-button-size); height:var(--icon-button-size); min-height:var(--icon-button-size); padding:0; border:0!important; border-radius:var(--radius); background:transparent!important; color:var(--text); box-shadow:none!important; }
.app-dialog-head-actions .icon-btn:hover,
.app-dialog-head-actions .icon-btn:focus-visible,
.workspace-modal-head > .icon-btn:last-child:hover,
.workspace-modal-head > .icon-btn:last-child:focus-visible,
.workspace-modal-head > a.icon-btn:last-child:hover,
.workspace-modal-head > a.icon-btn:last-child:focus-visible { border:0!important; background:var(--surface-hover)!important; color:var(--text); }
.app-dialog-head-actions .icon-btn svg,
.workspace-modal-head > .icon-btn:last-child svg { width:20px; height:20px; }
.app-dialog-head-divider { width:1px; height:28px; flex:0 0 1px; background:var(--border-strong); opacity:.72; }
.app-dialog-head-actions:not(:has(.app-dialog-head-utility > :not([hidden]))) .app-dialog-head-divider { display:none; }
.workspace-modal-body { flex:1; min-height:0; padding:24px; overflow:auto; overscroll-behavior:contain; }
/* Attachment content is edge-to-edge in every asset profile. This selector
   intentionally follows the generic modal body rule so Files does not depend
   on Approval's later stylesheet to remove the body inset. */
.app-attachment-dialog .app-attachment-body { padding:0; }
.workspace-modal-actions { min-height: calc(var(--control-height) + 20px); display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }

/* Shared create/edit dialog pattern. Work registration is the reference shell. */
.app-form-dialog { min-width:0; max-width:100%; max-height:calc(100dvh - var(--modal-viewport-block-inset)); overflow:hidden; border-radius:8px; }
.app-form-dialog.workspace-modal-large,
.app-form-dialog.company-document-compose-dialog,
.app-form-dialog.board-compose-dialog {
  height:auto;
  max-height:calc(100dvh - var(--modal-viewport-block-inset));
}
.app-form-dialog[open] { display:flex; flex-direction:column; }
.app-form-dialog.absence-dialog[open] { display:block; }
.app-form-dialog > form { width:100%; min-width:0; max-width:100%; flex:0 1 auto; min-height:0; max-height:inherit; display:flex; flex-direction:column; overflow-x:hidden; }
.app-form-dialog.absence-dialog > form { flex:0 1 auto; height:auto; min-height:0; }
.app-form-dialog .app-form-dialog-head { flex:0 0 auto; min-height:var(--modal-head-height); display:grid; grid-template-columns:44px minmax(0,1fr) auto; align-items:center; gap:16px; padding:17px 24px; border-bottom:1px solid var(--border); background:var(--surface); }
.app-form-dialog .app-form-dialog-head h2,
.app-form-dialog .app-form-dialog-head h3 { margin:0; color:var(--text); font-size:var(--text-lg); line-height:1.35; font-weight:750; }
.app-form-dialog .app-form-dialog-head p { overflow:hidden; margin:5px 0 0; color:var(--muted); font-size:var(--text-xs); line-height:1.5; text-overflow:ellipsis; white-space:nowrap; }
.app-form-dialog .app-form-dialog-head > [class*="icon"]:first-child { width:40px; height:40px; display:grid; place-items:center; border-radius:7px; background:var(--accent-soft); color:var(--accent); }
.app-form-dialog .app-form-dialog-head > [class*="icon"]:first-child svg { width:19px; height:19px; stroke:currentColor; fill:none; stroke-width:2; }
.app-form-dialog .app-form-dialog-head > .icon-btn:last-child,
.app-form-dialog .app-form-dialog-head > a.icon-btn:last-child { width:var(--icon-button-size); height:var(--icon-button-size); min-height:var(--icon-button-size); padding:0; border:0; background:transparent; color:var(--text); }
.app-form-dialog .app-form-dialog-body { flex:1; min-width:0; max-width:100%; min-height:0; padding:24px; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; }
.app-form-dialog .app-form-dialog-body-form { flex:0 1 auto; padding:0; overflow:hidden; }
.app-form-dialog .app-form-dialog-body-form > form { box-sizing:border-box; width:100%; height:auto; min-height:0; max-height:calc(100dvh - var(--modal-head-height) - var(--modal-viewport-block-inset)); overflow:auto; overscroll-behavior:contain; padding:24px 24px 0; }
.app-form-dialog .app-form-dialog-body-form > form > .app-form-dialog-footer { position:relative; z-index:1; margin:24px -24px 0; }
.app-form-dialog .app-form-dialog-structured-body { flex:1 1 auto; display:flex; flex-direction:column; }
.app-form-dialog .app-form-dialog-body-form > .app-form-dialog-structured-form { flex:1 1 0; width:100%; height:100%; max-height:none; display:flex; flex-direction:column; overflow:hidden; padding:0; }
.app-form-dialog .app-form-dialog-scroll-content { flex:1 1 auto; min-width:0; max-width:100%; min-height:0; display:flex; flex-direction:column; gap:var(--section-gap); padding:24px; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; }
.app-form-dialog .app-form-dialog-scroll-content > * { flex:0 0 auto; }
.app-form-dialog .app-form-dialog-scroll-content > :last-child { margin-bottom:0; }
.app-form-dialog .app-form-dialog-body-form > .app-form-dialog-structured-form > .app-form-dialog-footer { flex:0 0 auto; margin:0; }
.app-form-dialog.app-form-dialog-tall,
.app-form-dialog.employee-form-dialog,
.app-form-dialog.vendor-editor-dialog { height:calc(100dvh - var(--modal-viewport-block-inset)); }
.app-form-dialog .app-form-dialog-body > :first-child { margin-top:0; }
.app-form-dialog .field { gap:7px; margin-bottom:14px; }
.app-form-dialog .field > label,
.app-form-dialog .field > span,
.app-form-dialog .field > legend { color:var(--muted); font-size:var(--text-xs); font-weight:650; }
.app-form-dialog input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.app-form-dialog select { min-height:var(--control-height-lg); box-sizing:border-box; width:100%; min-width:0; max-width:100%; }
.app-form-dialog input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="file"]):not([type="hidden"]),
.app-form-dialog select { height:var(--control-height-lg); }
.app-form-dialog textarea { min-height:96px; line-height:1.55; }
.app-form-dialog .app-form-dialog-footer { flex:0 0 auto; min-height:calc(var(--control-height) + 24px); display:flex; align-items:center; justify-content:flex-end; gap:8px; padding:11px 18px; border-top:1px solid var(--border); background:var(--surface-subtle); }
.app-form-dialog .app-form-dialog-footer > span { margin-right:auto; color:var(--muted); font-size:var(--text-xs); }
.app-form-dialog .app-form-dialog-footer .actions { justify-content:flex-end; margin-left:auto; }
.app-form-dialog .app-form-dialog-footer button,
.app-form-dialog .app-form-dialog-footer .btn { min-width:92px; }
.app-form-dialog > .app-form-dialog-footer { position:relative; z-index:5; width:100%; margin:0; padding-inline:24px; }
.app-form-dialog .msg:first-child + .app-form-dialog-head { margin-top:0; }
.app-form-dialog .radio-options label > span { min-height:var(--list-head-height); }
.app-form-dialog .workspace-panel { border-radius:7px; box-shadow:none; }
.app-form-dialog .workspace-head { min-height:var(--list-head-height); }
.app-form-dialog .editor-toolbar { min-height:40px; }
.app-form-dialog .compose-upload-field small { color:var(--muted); font-size:var(--text-2xs); }
.app-form-dialog-compact { width:min(var(--modal-width-sm),calc(100vw - var(--modal-viewport-inset))); height:auto; min-height:0; }
.app-library-destination-dialog { width:min(520px,calc(100vw - var(--modal-viewport-inset))); }
.app-library-destination-body { display:flex; flex-direction:column; gap:14px; }
.app-library-destination-body .field { margin:0; }
.app-library-destination-summary { margin:0; padding:11px 12px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); color:var(--text); font-size:var(--text-sm); font-weight:700; }
.app-library-destination-divider { position:relative; display:flex; align-items:center; justify-content:center; min-height:18px; color:var(--muted); font-size:var(--text-2xs); }
.app-library-destination-divider::before { content:""; position:absolute; inset:auto 0 50%; border-top:1px solid var(--border); }
.app-library-destination-divider > span { position:relative; padding:0 9px; background:var(--surface); }
.app-library-destination-help { margin-top:-7px; color:var(--muted); font-size:var(--text-2xs); line-height:1.5; }
.app-library-destination-dialog[aria-busy="true"] .app-form-dialog-body { opacity:.68; pointer-events:none; }

/* Shared selectable-card fieldset used by module forms. */
.choice-card-group {
  --choice-card-columns:3;
  min-width:0;
  display:grid;
  grid-template-columns:repeat(var(--choice-card-columns),minmax(0,1fr));
  gap:8px;
  margin:0;
  padding:0;
  border:0;
}
.choice-card-group > legend { grid-column:1 / -1; margin-bottom:7px; color:var(--muted); font-size:var(--text-xs); font-weight:650; }
.choice-card-group > label { position:relative; min-width:0; margin:0; }
.choice-card-group > label > input[type="radio"] { position:absolute; width:1px; height:1px; opacity:0; pointer-events:none; }
.choice-card-group > label > span { min-height:48px; display:flex; align-items:center; justify-content:center; gap:8px; padding:8px 10px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); color:var(--muted); cursor:pointer; }
.choice-card-group > label > input[type="radio"]:checked + span { border-color:color-mix(in srgb,var(--accent) 42%,var(--border)); background:var(--accent-soft); color:var(--accent); }
.choice-card-group > label > input[type="radio"]:focus-visible + span { outline:3px solid var(--focus-ring); outline-offset:2px; }
.choice-card-group > label > span > svg { width:17px; height:17px; flex:0 0 auto; stroke:currentColor; fill:none; stroke-width:2; }

/* Shared employee picker used by every create/edit dialog. */
.app-people-picker { box-sizing:border-box; width:100%; min-width:0; max-width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; align-items:start; }
.app-people-picker-field { box-sizing:border-box; width:100%; min-width:0; max-width:100%; margin:0; padding:0; border:0; }
.app-people-picker-field > legend { margin-bottom:7px; color:var(--muted); font-size:var(--text-xs); font-weight:650; }
.app-people-picker-field > legend small { margin-left:6px; color:var(--faint); font-size:var(--text-3xs); font-weight:400; }
.app-people-picker-list { box-sizing:border-box; width:100%; min-width:0; max-width:100%; display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px; padding:8px; overflow-x:hidden; overflow-y:auto; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); overscroll-behavior:contain; touch-action:pan-y; }
.app-people-picker-option { box-sizing:border-box; width:100%; min-width:0; max-width:100%; display:grid; grid-template-columns:16px 28px minmax(0,1fr); align-items:center; gap:8px; padding:8px; overflow:hidden; border:1px solid transparent; border-radius:6px; background:var(--surface); cursor:pointer; }
.app-people-picker-option:hover { border-color:var(--border); }
.app-people-picker-option > input[type="checkbox"] { position:static; width:15px !important; min-width:15px; max-width:15px; height:15px !important; min-height:15px; margin:0; padding:0; accent-color:var(--accent); }
.app-people-picker-option > span:last-child { min-width:0; display:grid; gap:2px; overflow:hidden; }
.app-people-picker-option strong,
.app-people-picker-option small { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.app-people-picker-option strong { color:var(--text); font-size:var(--text-xs); }
.app-people-picker-option small { color:var(--muted); font-size:var(--text-3xs); }

.module-header-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }


@media (max-width: 900px) {  .pagination { flex-wrap:wrap; }
  .pagination-summary { width:100%; margin:4px 0 0; text-align:center; }
}

#appointmentForm { width:min(var(--modal-width-lg),calc(100vw - var(--modal-viewport-inset))); height:auto; min-height:0; }
body.app-modal-embed #appointmentForm { width:100%; max-width:100%; }

#appointmentForm .workspace-modal-body { flex:0 1 auto; }
.workspace-modal.account-password-dialog { width:min(540px,calc(100vw - var(--modal-viewport-inset))); height:auto; min-height:0; max-height:calc(100dvh - var(--modal-viewport-block-inset)); }
.account-password-dialog .workspace-modal-body { display:grid; gap:18px; }
.account-password-dialog form { display:grid; gap:13px; }
.account-password-guidance { display:grid; gap:5px; padding:13px 14px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); }
.account-password-guidance strong { font-size:var(--text-sm); }
.account-password-guidance span { color:var(--muted); font-size:var(--text-xs); line-height:1.5; }
.account-password-success { padding:10px 12px; border:1px solid color-mix(in srgb,var(--success) 32%,var(--border)); border-radius:var(--radius); background:var(--success-bg); color:var(--success); font-size:var(--text-xs); font-weight:700; }
.board-compose-dialog .form-wrap { padding: 0; overflow: visible; }
.board-compose-dialog .editor { min-height:320px; max-height:46vh; }
.workspace-modal.dashboard-shortcut-panel { width:min(var(--modal-width-xl),calc(100vw - var(--modal-viewport-inset))); height:auto; min-height:0; overflow:hidden; }
.workspace-modal.dashboard-shortcut-panel .dashboard-shortcut-settings-layout { flex:1 1 auto; min-height:0; padding:0; overflow:auto; }

/* Responsive modal and form controls. */
@media (max-width: 860px) {
.workspace-modal { width: calc(100vw - var(--modal-viewport-inset)); height:auto; max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
.workspace-modal-large { width: calc(100vw - var(--modal-viewport-inset)); height: calc(100vh - var(--modal-viewport-block-inset)); }
  .workspace-modal-head { padding:16px; }
  .workspace-modal-body { padding:16px; }
  .app-form-dialog { width:calc(100vw - var(--modal-viewport-inset)); max-width:none; max-height:calc(100vh - var(--modal-viewport-block-inset)); }
  .app-form-dialog.workspace-modal-large,
  .app-form-dialog.company-document-compose-dialog,
  .app-form-dialog.board-compose-dialog {
    height:auto;
    min-height:0;
    max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset));
  }
  .app-form-dialog.app-form-dialog-tall,
  .app-form-dialog.employee-form-dialog,
  .app-form-dialog.vendor-editor-dialog {
    height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset));
  }
  .app-form-dialog .app-form-dialog-head { grid-template-columns:40px minmax(0,1fr) auto; gap:12px; padding:14px 16px; }
  .app-form-dialog .app-form-dialog-head h2,
  .app-form-dialog .app-form-dialog-head h3 { font-size:var(--text-lg); }
  .app-form-dialog .app-form-dialog-body { padding:16px; }
  .app-form-dialog .app-form-dialog-body-form { padding:0; }
  .app-form-dialog .app-form-dialog-body-form > form { padding:16px 16px 0; }
  .app-form-dialog .app-form-dialog-body-form > form > .app-form-dialog-footer { margin:16px -16px 0; }
  .app-form-dialog .app-form-dialog-body-form > .app-form-dialog-structured-form { padding:0; }
  .app-form-dialog .app-form-dialog-scroll-content { gap:12px; padding:16px; }
  .app-form-dialog .app-form-dialog-body-form > .app-form-dialog-structured-form > .app-form-dialog-footer { margin:0; }
  .app-form-dialog > .app-form-dialog-footer { padding-inline:16px; }
  .app-pdf-dialog { width:calc(100vw - var(--modal-viewport-inset)); height:calc(100vh - var(--modal-viewport-block-inset)); }
  .app-pdf-footer { padding:10px 16px; }

.app-form-dialog input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]),
  .app-form-dialog select { min-height:44px; }
  .app-form-dialog textarea { min-height:110px; }
  .app-form-dialog .editor-toolbar { min-height:44px; padding:7px; gap:4px; }
  .app-form-dialog .editor-toolbar button,
  .app-form-dialog .editor-toolbar label.tool { min-height:34px; padding:5px 8px; font-size:14px; line-height:1.2; }
}

@media (max-width: 720px) {  .workspace-modal[open],
  .app-form-dialog[open] { width:calc(100vw - var(--modal-viewport-inset)); height:auto; min-height:0; margin:0; max-width:calc(100vw - var(--modal-viewport-inset)); max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
  .module-header-actions { width:100%; justify-content:flex-start; }
  .app-form-dialog .app-form-dialog-footer { align-items:center; flex-direction:row; flex-wrap:wrap; }
  .app-form-dialog .app-form-dialog-footer > span { flex:1 0 100%; margin-right:0; }
  .app-form-dialog .app-form-dialog-footer .actions { width:100%; display:grid; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); gap:8px; margin-left:0; }
  .app-form-dialog .app-form-dialog-footer .actions > *,
  .app-form-dialog .app-form-dialog-footer > button,
  .app-form-dialog .app-form-dialog-footer > .btn { flex:1 1 0; min-width:0; }
  .workspace-modal-large[open]:not(.app-form-dialog) { height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
  .app-form-dialog.absence-dialog[open],
  .app-form-dialog.improvement-dialog[open] { height:auto; min-height:0; max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
  .app-people-picker,
  .app-people-picker-list { grid-template-columns:minmax(0,1fr); }
  .app-form-dialog.app-form-dialog-tall[open],
  .app-form-dialog.employee-form-dialog[open],
  .app-form-dialog.vendor-editor-dialog[open] { height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
  .app-form-dialog.absence-dialog > form { flex:0 1 auto; height:auto; min-height:0; max-height:calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - var(--modal-viewport-block-inset)); }
  .app-form-dialog.absence-dialog .app-form-dialog-body { flex:0 1 auto; }
}

/* Dynamic/generated form runtime and mobile form/table overrides migrated from app.css. */
.dynamic-form-runtime,
.generated-form-document { display: grid; gap: 12px; }
.dynamic-form-row,
.generated-form-row {
  display: grid;
  grid-template-columns: repeat(var(--form-columns), minmax(0, 1fr));
  gap: 12px;
}
.dynamic-form-row.has-divider-after,
.generated-form-row.has-divider-after { padding-bottom:12px; border-bottom:var(--form-row-line-width,1px) var(--form-row-line-style,solid) var(--form-row-line-color,#cbd5e1); }
.dynamic-form-cell,
.generated-form-cell { min-width: 0; }
.dynamic-form-cell,
.generated-form-cell {
  font-size:var(--form-field-font-size,var(--text-md));
  font-weight:var(--form-field-font-weight,400);
  font-style:var(--form-field-font-style,normal);
  text-align:var(--form-field-text-align,left);
}
.dynamic-form-cell.has-divider-after:after,
.generated-form-cell.has-divider-after:after { content:""; display:block; margin-top:12px; border-bottom:var(--form-field-line-width,1px) var(--form-field-line-style,solid) var(--form-field-line-color,#cbd5e1); }
.dynamic-form-cell .field > span,
.generated-form-cell .generated-form-value > strong { text-align:var(--form-field-text-align,left); }
.dynamic-form-cell input,
.dynamic-form-cell textarea,
.generated-form-cell .generated-form-value span,
.generated-form-cell .generated-form-value p,
.generated-form-cell .generated-form-memo { font-size:var(--form-field-font-size,var(--text-md))!important; font-weight:var(--form-field-font-weight,400); font-style:var(--form-field-font-style,normal); text-align:var(--form-field-text-align,left); }
.generated-form-divider { width:100%; margin:12px 0; border:0; border-top:var(--form-field-line-width,1px) var(--form-field-line-style,solid) var(--form-field-line-color,#cbd5e1); }
.dynamic-form-text-box textarea { min-height:var(--form-field-min-height,120px); }
.generated-form-text-box { min-height:var(--form-field-min-height,120px); padding:12px; border:1px solid var(--border); border-radius:var(--radius); white-space:normal; }
.generated-form-callout { box-sizing:border-box; width:100%; display:grid; grid-template-columns:24px minmax(0,1fr); align-items:start; gap:12px; padding:12px 14px; border:1px solid color-mix(in srgb,var(--info) 34%,var(--border)); border-radius:var(--radius); background:var(--info-soft); color:var(--text); break-inside:avoid; page-break-inside:avoid; text-align:var(--form-field-text-align,left); -webkit-print-color-adjust:exact; print-color-adjust:exact; }
.generated-form-callout-icon { width:24px; height:24px; display:grid; place-items:center; border-radius:50%; background:var(--info); color:#fff; font-size:14px; font-weight:800; line-height:1; }
.generated-form-callout > div { min-width:0; display:grid; gap:4px; }
.generated-form-callout strong { color:var(--text); font-size:max(var(--form-field-font-size,var(--text-md)),var(--text-sm)); line-height:1.4; }
.generated-form-callout p { margin:0; color:var(--muted); font-size:var(--form-field-font-size,var(--text-md)); line-height:1.55; }
.generated-form-callout b { color:var(--info); font-size:var(--form-field-font-size,var(--text-md)); line-height:1.5; }
.dynamic-form-cell > .field { height: 100%; margin: 0; }
.dynamic-form-cell textarea { min-height: 116px; resize: vertical; }
.dynamic-form-cell h2,
.dynamic-form-cell h3,
.generated-form-cell h2,
.generated-form-cell h3 { margin: 4px 0 0; letter-spacing: 0; }
.dynamic-form-cell h2,
.generated-form-cell h2 { font-size: var(--text-xl); }
.dynamic-form-cell h3,
.generated-form-cell h3 { font-size: var(--text-lg); }
.approval-compose-body-component .dynamic-form-cell.form-field-type-subheading h3 { margin-top:8px; padding-bottom:8px; border-bottom:1px solid var(--border); color:var(--text); font-size:var(--text-md); }
.approval-compose-body-component .dynamic-form-row:has(> .form-field-type-record_field) { gap:0; overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); }
.approval-compose-body-component .dynamic-form-row:has(> .form-field-type-record_field) > .dynamic-form-cell + .dynamic-form-cell { border-left:1px solid var(--border); }
.approval-compose-body-component .form-field-type-record_field .generated-form-value { min-height:46px; display:grid; grid-template-columns:minmax(108px,34%) minmax(0,1fr); align-items:stretch; gap:0; }
.approval-compose-body-component .form-field-type-record_field .generated-form-value > strong,
.approval-compose-body-component .form-field-type-record_field .generated-form-value > span { min-width:0; display:flex; align-items:center; margin:0; padding:10px 12px; overflow-wrap:anywhere; line-height:1.45; }
.approval-compose-body-component .form-field-type-record_field .generated-form-value > strong { background:var(--surface-subtle); color:var(--muted); font-size:var(--text-xs); font-weight:750; }
.approval-compose-body-component .form-field-type-record_field .generated-form-value > span { border-left:1px solid var(--border); color:var(--text); font-size:var(--text-sm); font-variant-numeric:tabular-nums; }
.dynamic-form-check { display: flex; align-items: center; gap: 8px; min-height: 42px; }
.dynamic-form-check input { width: 17px; height: 17px; }
.dynamic-form-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; }
.dynamic-form-money { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:stretch; }
.dynamic-form-money-symbol { min-width:42px; display:grid; place-items:center; border:1px solid var(--border-strong); border-right:0; border-radius:var(--radius) 0 0 var(--radius); background:var(--surface-subtle); color:var(--muted); font-size:var(--text-sm); font-weight:750; }
.dynamic-form-money input { min-width:0; border-radius:0 var(--radius) var(--radius) 0; font-variant-numeric:tabular-nums; }
.dynamic-form-money + small { display:block; margin-top:5px; color:var(--faint); font-size:var(--text-3xs); }
.dynamic-form-options { display: flex; min-height: 42px; align-items: center; gap: 7px; flex-wrap: wrap; }
.dynamic-form-options label { display: flex; align-items: center; gap: 5px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.db-picker-control { position:relative; width:100%; min-width:0; display:grid; justify-items:start; gap:8px; }
.db-picker-selection { width:100%; min-width:0; display:flex; flex-wrap:wrap; gap:8px; }
.db-picker-selection:empty { display:none; }
.db-picker-selected { box-sizing:border-box; width:100%; max-width:100%; min-height:42px; display:inline-grid; grid-template-columns:minmax(0,1fr) 34px; align-items:stretch; overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); color:var(--text); }
.db-picker-selected > span { min-width:0; display:grid; align-content:center; gap:2px; padding:7px 10px; }
.db-picker-selected strong,
.db-picker-selected small { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.db-picker-selected strong { color:var(--text); font-size:var(--text-xs); }
.db-picker-selected small { color:var(--muted); font-size:var(--text-3xs); }
.db-picker-selected > button { width:34px; min-width:34px; min-height:40px; display:grid; place-items:center; padding:0; border:0; border-left:1px solid var(--border); border-radius:0; background:var(--surface); color:var(--muted); }
.db-picker-selected > button:hover { background:var(--danger-soft); color:var(--danger); }
.db-picker-selected > button svg { width:14px; height:14px; stroke:currentColor; fill:none; stroke-width:2; }
.db-picker-open { min-height:38px; display:inline-flex; align-items:center; gap:7px; }
.db-picker-open svg { width:16px; height:16px; stroke:currentColor; fill:none; stroke-width:2; }
.db-picker-required { position:absolute !important; left:0; bottom:0; width:1px !important; min-width:1px !important; height:1px !important; min-height:1px !important; padding:0 !important; overflow:hidden; border:0 !important; opacity:0; pointer-events:none; }
.db-picker-dialog { width:min(var(--modal-width-md),calc(100vw - var(--modal-viewport-inset))); height:auto; min-height:0; max-height:calc(100dvh - var(--modal-viewport-block-inset)); }
.db-picker-tools { flex:0 0 auto; display:grid; grid-template-columns:minmax(0,1fr) 180px; gap:8px; padding:12px 16px; border-bottom:1px solid var(--border); background:var(--surface-subtle); }
.db-picker-tools label { min-width:0; margin:0; }
.db-picker-tools input,
.db-picker-tools select { box-sizing:border-box; width:100%; min-width:0; min-height:var(--control-height-lg); }
.db-picker-dialog .db-picker-results { min-height:112px; max-height:min(52dvh,460px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:start; gap:8px; padding:16px; overflow-x:hidden; overflow-y:auto; background:var(--surface); }
.db-picker-loading,
.db-picker-empty { grid-column:1 / -1; min-height:96px; display:grid; place-items:center; padding:18px; border:1px dashed var(--border-strong); border-radius:var(--radius); background:var(--surface-subtle); color:var(--muted); font-size:var(--text-sm); text-align:center; }
.db-picker-result { box-sizing:border-box; min-width:0; min-height:74px; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:5px 8px; padding:11px 12px; overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); color:var(--text); text-align:left; }
.db-picker-result:hover { border-color:var(--border-strong); background:var(--surface-hover); }
.db-picker-result:focus-visible { outline:3px solid var(--focus-ring); outline-offset:1px; }
.db-picker-result-main { min-width:0; display:grid; gap:3px; }
.db-picker-result-main strong,
.db-picker-result-main small,
.db-picker-result-detail { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.db-picker-result-main strong { color:var(--text); font-size:var(--text-sm); }
.db-picker-result-main small,
.db-picker-result-detail { color:var(--muted); font-size:var(--text-3xs); }
.db-picker-result > .status-chip { align-self:start; }
.db-picker-result-detail { grid-column:1 / -1; }
.db-picker-footer { width:100%; }
.db-picker-footer > span { font-variant-numeric:tabular-nums; }
.db-picker-footer nav { display:flex; align-items:center; gap:8px; }
.db-picker-footer nav > span { min-width:48px; color:var(--muted); font-size:var(--text-xs); text-align:center; font-variant-numeric:tabular-nums; }
.generated-form-document { margin: 20px 0; }
.generated-form-row { padding: 0; border-bottom: 0; }
.generated-form-row { break-inside:avoid; page-break-inside:avoid; }
.generated-form-value { display: grid; gap: 5px; }
.generated-form-value strong { color: var(--muted); font-size: var(--text-xs); }
.generated-form-value span,
.generated-form-value p { margin: 0; color: var(--text); font-size: var(--text-md); line-height: var(--line-relaxed); }
.generated-form-value.rich { min-height: 72px; }

/* Saved structured values render as one compact table in detail/preview/PDF.
   Authoring controls keep the looser dynamic-form spacing above. */
:is(.workspace-reading-body,.form-document-body) .generated-form-document { gap:0; margin:0; }
:is(.workspace-reading-body,.form-document-body) .generated-form-row:has(> .generated-form-cell > .generated-form-value) {
  gap:0; overflow:hidden; padding:0; border:1px solid var(--border); border-radius:0; background:var(--surface);
}
:is(.workspace-reading-body,.form-document-body) .generated-form-row:has(> .generated-form-cell > .generated-form-value):first-child,
:is(.workspace-reading-body,.form-document-body) .generated-form-row:not(:has(> .generated-form-cell > .generated-form-value)) + .generated-form-row:has(> .generated-form-cell > .generated-form-value) { border-radius:var(--radius) var(--radius) 0 0; }
:is(.workspace-reading-body,.form-document-body) .generated-form-row:has(> .generated-form-cell > .generated-form-value):last-child,
:is(.workspace-reading-body,.form-document-body) .generated-form-row:has(> .generated-form-cell > .generated-form-value):has(+ .generated-form-row:not(:has(> .generated-form-cell > .generated-form-value))) { border-radius:0 0 var(--radius) var(--radius); }
:is(.workspace-reading-body,.form-document-body) .generated-form-row:has(> .generated-form-cell > .generated-form-value) + .generated-form-row:has(> .generated-form-cell > .generated-form-value) { border-top:0; }
:is(.workspace-reading-body,.form-document-body) .generated-form-cell + .generated-form-cell { border-left:1px solid var(--border); }
:is(.workspace-reading-body,.form-document-body) .generated-form-row.has-divider-after:has(> .generated-form-cell > .generated-form-value) { padding-bottom:0; }
:is(.workspace-reading-body,.form-document-body) .generated-form-cell.has-divider-after:has(> .generated-form-value)::after { display:none; }
:is(.workspace-reading-body,.form-document-body) .generated-form-value { min-height:100%; display:grid; grid-template-columns:clamp(132px,24%,210px) minmax(0,1fr); align-items:stretch; gap:0; }
:is(.workspace-reading-body,.form-document-body) .generated-form-value > strong,
:is(.workspace-reading-body,.form-document-body) .generated-form-value > :is(span,p) { min-width:0; margin:0; padding:10px 12px; overflow-wrap:anywhere; line-height:1.55; }
:is(.workspace-reading-body,.form-document-body) .generated-form-value > strong { background:var(--surface-subtle); color:var(--muted); font-size:var(--text-sm); font-weight:700; }
:is(.workspace-reading-body,.form-document-body) .generated-form-value > :is(span,p) { border-left:1px solid var(--border); color:var(--text); font-size:var(--text-md)!important; }
:is(.workspace-reading-body,.form-document-body) .generated-form-row:not(:has(> .generated-form-cell > .generated-form-value)) { margin-block:12px; }

.approval-component-layout {
  display:grid;
  grid-template-columns:repeat(12,minmax(0,1fr));
  gap:16px;
  min-width:0;
}
.approval-component {
  order:var(--approval-component-order,0);
  grid-column:span var(--approval-component-span,12);
  min-width:0;
}
.approval-component[hidden] { display:none!important; }
.approval-component > :first-child { margin-top:0; }
.approval-component > :last-child { margin-bottom:0; }
.approval-component .form-document-head { padding-top:0; }
.form-document-workflow-card { min-height:54px; display:grid; gap:5px; padding:12px 14px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-subtle); }
.form-document-workflow-card > strong { color:var(--text); font-size:var(--text-sm); }
.form-document-workflow-card > span { color:var(--muted); font-size:var(--text-xs); line-height:1.5; }
.approval-component-empty { min-height:54px; display:grid; place-items:center; padding:12px; border:1px dashed var(--border-strong); border-radius:var(--radius); color:var(--muted); font-size:var(--text-xs); }
.approval-component .form-document-body,
.approval-component .form-document-detail-grid,
.approval-component .form-document-attachment-foot { margin-block:0; }
.form-document-approval .approval-component .form-document-body { min-height:0; padding:4mm 0; }
.form-pagination-component-hidden { display:none!important; }

.form-paginated-sheet { position:relative; box-sizing:border-box; overflow:hidden; break-after:page; page-break-after:always; }
.form-paginated-sheet:last-of-type { break-after:auto; page-break-after:auto; }
.form-paginated-sheet > .form-document-shell { height:100%; min-height:0; }
.form-paginated-sheet .form-document-shell.is-continuation .form-document-detail-grid,
.form-paginated-sheet .form-document-shell.is-continuation .form-document-lines { display:none; }
.form-paginated-sheet .form-document-shell.is-continuation .form-document-head,
.form-paginated-sheet .form-document-shell.is-continuation .form-document-company-head { padding-top:0; padding-bottom:4mm; }
.form-paginated-sheet .form-document-shell.is-continuation .form-document-head > span { margin-bottom:2mm; }
.form-paginated-sheet .form-document-shell.is-continuation .form-document-head h1,
.form-paginated-sheet .form-document-shell.is-continuation .form-document-title { font-size:var(--text-xl); text-align:left; }
.form-paginated-sheet .form-document-shell.is-continuation .form-document-title { padding:4mm 0 0; }
.form-paginated-sheet .form-document-page-footer-placeholder { visibility:hidden; }
.form-print-page-number { position:absolute; z-index:2; right:8mm; bottom:5mm; color:#64748b; font-size:var(--text-3xs); font-variant-numeric:tabular-nums; }
.form-pagination-overflow { outline:2px solid #ff3b30; outline-offset:-2px; }

@media (max-width: 860px) {
  :is(.workspace-reading-body,.form-document-body) .generated-form-value { grid-template-columns:minmax(112px,28%) minmax(0,1fr); }
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]),
  select,
  textarea { min-width:0; max-width:100%; font-size:16px !important; line-height:1.35; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]):not([type="hidden"]),
  select { min-height:44px; padding-block:8px; }
  textarea { min-height:96px; }
  .approval-component { grid-column:1 / -1!important; }
  input[type="date"], input[type="time"], input[type="datetime-local"] { display:block; width:100%; min-width:0; max-width:100%; }
  .field, .module-filter label, .workspace-filter-bar label { min-width:0; }
  .workspace-filter-bar { width:100%; grid-template-columns:minmax(0,1fr) minmax(0,1fr); align-items:end; gap:9px; padding:12px 14px; }
  .workspace-filter-bar button { width:100%; grid-column:1 / -1; }
  .mobile-icon-action { width:38px; min-width:38px; height:38px; min-height:38px; padding:0; }
  .mobile-icon-action > span { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
  .table td.table-empty, .table-empty, .module-empty { height:auto; min-height:92px; padding:22px 16px !important; font-size:var(--text-sm); line-height:1.55; }
  .memo-editor-toolbar { flex-wrap:wrap; overflow:visible; }
  .memo-toolbar-select select { min-height:36px; font-size:16px !important; }
  .memo-editor-surface { min-height:240px; max-height:46vh; padding:16px; font-size:var(--rich-text-base); }
  .memo-editor.is-source-mode .html-area { min-height:240px; max-height:46vh; font-size:16px !important; }
}

@container (max-width: 720px) {
  .memo-editor-toolbar { align-items:stretch; }
  .memo-toolbar-row { width:100%; max-width:100%; flex:0 0 100%; overflow-x:auto; overflow-y:hidden; overscroll-behavior-inline:contain; -webkit-overflow-scrolling:touch; scrollbar-width:thin; padding-bottom:2px; }
  .memo-toolbar-row > * { flex:0 0 auto; }
}
@media (max-width: 720px) {
  :is(.workspace-reading-body,.form-document-body) .generated-form-value { grid-template-columns:minmax(96px,34%) minmax(0,1fr); }
  .dynamic-form-row,
  .generated-form-row { grid-template-columns:1fr; }
  .approval-compose-body-component .dynamic-form-row:has(> .form-field-type-record_field) > .dynamic-form-cell + .dynamic-form-cell { border-top:1px solid var(--border); border-left:0; }
  .approval-compose-body-component .form-field-type-record_field .generated-form-value { grid-template-columns:minmax(96px,34%) minmax(0,1fr); }
  .db-picker-tools,
  .db-picker-dialog .db-picker-results { grid-template-columns:minmax(0,1fr); }
  .db-picker-dialog .db-picker-results { max-height:none; }
  .db-picker-footer nav { flex:1 1 100%; justify-content:center; }
  .db-picker-footer nav > button { flex:1 1 0; min-width:0; }
  .workspace-filter-bar { grid-template-columns:minmax(0,1fr); }
  .mobile-card-table { box-sizing:border-box; display:block; width:100%; min-width:0 !important; }
  .mobile-card-table colgroup { display:none; }
  .mobile-card-table thead { display:none; }
  .mobile-card-table tbody { display:grid; gap:10px; padding:12px; }
  .mobile-card-table tbody tr { display:grid; overflow:hidden; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface); }
  .mobile-card-table tbody td { min-width:0; display:grid; grid-template-columns:96px minmax(0,1fr); align-items:start; gap:10px; padding:9px 11px; border:0; border-bottom:1px solid var(--border); text-align:left; overflow-wrap:anywhere; }
  .mobile-card-table tbody td:last-child { border-bottom:0; }
  .mobile-card-table tbody td::before { content:attr(data-label); grid-column:1; grid-row:1 / -1; color:var(--muted); font-size:var(--text-xs); font-weight:650; }
  .mobile-card-table tbody td > * { grid-column:2; }
  .mobile-card-table .table-empty { display:grid; grid-template-columns:1fr; place-items:center; min-height:92px; }
  .mobile-card-table .table-empty::before { content:none; }
  .list > .empty { height:auto; min-height:112px; padding:24px 16px; font-size:var(--text-sm); line-height:1.5; }
}

@media print {  @page { size: A4; margin: 0; }
}

/* Overseas purchase execution: one remittance batch with invoice-level adjustments. */
.approval-trade-section { container-type:inline-size; display:grid; gap:16px; padding:18px; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); }
.approval-trade-section > header,.approval-trade-rate-card > header,.approval-trade-section > footer { display:flex; align-items:center; justify-content:space-between; gap:16px; }
.approval-trade-section > header > div,.approval-trade-rate-card > header > div { display:grid; gap:4px; min-width:0; }
.approval-trade-section > header strong,.approval-trade-rate-card > header strong { color:var(--text); font-size:var(--text-md); }
.approval-trade-section > header span,.approval-trade-rate-card > header span { color:var(--muted); font-size:var(--text-sm); line-height:1.55; }
.approval-trade-invoice-list { display:grid; gap:12px; }
.approval-trade-invoice-row { overflow:hidden; border:1px solid var(--border); border-radius:var(--radius-lg); background:var(--surface); box-shadow:var(--shadow-xs); }
.approval-trade-invoice-main { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)) 44px; grid-template-areas:"invoice number total installment remove" "planned current adjustment evidence ."; align-items:end; gap:10px; padding:14px; }
.approval-trade-invoice-main .field { min-width:0; margin-bottom:0; }
.approval-trade-invoice-main > .field:nth-child(1) { grid-area:invoice; }
.approval-trade-invoice-main > .field:nth-child(2) { grid-area:number; }
.approval-trade-invoice-main > .field:nth-child(3) { grid-area:total; }
.approval-trade-invoice-main > .field:nth-child(4) { grid-area:installment; }
.approval-trade-invoice-main > .field:nth-child(5) { grid-area:planned; }
.approval-trade-invoice-main > .field:nth-child(6) { grid-area:current; }
.approval-trade-adjustment-summary,.approval-trade-invoice-file { display:grid; gap:7px; min-width:0; }
.approval-trade-adjustment-summary { grid-area:adjustment; }
.approval-trade-adjustment-summary > span,.approval-trade-invoice-file > span { color:var(--muted); font-size:var(--text-xs); font-weight:700; }
.approval-trade-adjustment-summary .btn { justify-content:space-between; width:100%; min-height:44px; padding-inline:11px; color:var(--text); background:var(--surface); }
.approval-trade-adjustment-summary .btn strong { color:inherit; }
.approval-trade-adjustment-summary .btn .app-icon { color:var(--muted); transition:transform 160ms ease; }
.approval-trade-adjustment-summary .btn[aria-expanded="true"] .app-icon { transform:rotate(180deg); }
.approval-trade-adjustment-summary .btn.warning { border-color:color-mix(in srgb,var(--warning) 40%,var(--border)); background:color-mix(in srgb,var(--warning) 10%,var(--surface)); color:var(--warning-ink,var(--text)); }
.approval-trade-invoice-file > a { display:flex; align-items:center; gap:6px; min-width:0; min-height:22px; color:var(--accent); font-size:var(--text-xs); font-weight:700; }
.approval-trade-invoice-file > a span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.approval-trade-invoice-file > .approval-trade-invoice-pdf-input { width:100%; min-height:40px; }
.approval-trade-invoice-file > .app-upload-dropzone { width:100%; }
.approval-trade-invoice-file > label.btn { display:block; width:100%; min-height:0; padding:0; border:0; background:transparent; }
.approval-trade-invoice-file > label.btn > span:first-child { display:none; }
.approval-trade-invoice-file > label.btn > .app-upload-dropzone { width:100%; }
.approval-trade-invoice-file .app-upload-dropzone { grid-template-columns:34px minmax(0,1fr); min-height:44px; padding:4px 10px; }
.approval-trade-invoice-file .app-upload-dropzone input[type="file"] { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; }
.approval-trade-invoice-file { grid-area:evidence; }
.approval-trade-invoice-remove { grid-area:remove; align-self:end; width:44px; height:44px; min-height:44px; margin-bottom:0; }
.approval-trade-adjustment-detail { display:grid; grid-template-columns:minmax(190px,1fr) minmax(170px,.65fr) minmax(260px,1.4fr); align-items:end; gap:12px; padding:13px 14px; border-top:1px solid color-mix(in srgb,var(--warning) 32%,var(--border)); background:color-mix(in srgb,var(--warning) 6%,var(--surface)); }
.approval-trade-adjustment-detail .field { margin-bottom:0; }
.approval-trade-adjustment-detail > div { display:grid; gap:3px; align-self:center; }
.approval-trade-adjustment-detail > div strong { font-size:var(--text-sm); }
.approval-trade-adjustment-detail > div span { color:var(--muted); font-size:var(--text-xs); line-height:1.45; }
.approval-trade-rate-card { display:grid; gap:14px; padding:15px; border:1px solid color-mix(in srgb,var(--accent) 18%,var(--border)); border-radius:var(--radius-lg); background:color-mix(in srgb,var(--accent) 3%,var(--surface)); }
.approval-trade-rate-card .status-chip.brand { border-color:color-mix(in srgb,var(--accent) 18%,var(--border)) !important; background:var(--accent-soft); color:var(--accent); }
.approval-trade-rate-card > header > .status-chip { flex:0 0 auto; white-space:nowrap; }
.approval-trade-rate-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.approval-trade-rate-grid .field,.approval-trade-rate-override .field,.approval-trade-common-memo.field { margin-bottom:0; }
.approval-trade-rate-override { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-items:end; gap:10px; padding-top:12px; border-top:1px solid var(--border); }
.approval-trade-rate-override > label:first-child { display:flex; align-items:center; align-self:center; justify-self:start; gap:8px; color:var(--text); font-size:var(--text-sm); font-weight:700; white-space:nowrap; cursor:pointer; }
.approval-trade-rate-override > label:first-child > input[type="checkbox"] { flex:0 0 17px; width:17px; min-width:17px; max-width:17px; height:17px; min-height:17px; margin:0; padding:0; accent-color:var(--accent); }
.approval-trade-rate-override > .field { grid-column:2 / -1; min-width:0; }
.approval-trade-rate-override > span { grid-column:1/-1; color:var(--muted); font-size:var(--text-xs); line-height:1.5; }
.approval-trade-common-memo { padding-top:2px; }
.approval-trade-common-memo small { color:var(--muted); font-weight:400; }
.approval-trade-section > footer { justify-content:flex-end; padding:13px 15px; border-radius:var(--radius); background:var(--surface-muted); }
.approval-trade-section > footer span { color:var(--muted); font-size:var(--text-sm); }
.approval-trade-section > footer strong { margin-right:14px; font-size:var(--text-lg); font-variant-numeric:tabular-nums; }
.approval-trade-section > footer strong:last-child { margin-right:0; color:var(--accent); }
.approval-trade-detail { display:grid; gap:12px; }
.approval-trade-detail-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:10px; }
.approval-trade-detail-summary > div { display:grid; gap:5px; padding:12px; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface-muted); }
.approval-trade-detail-summary span { color:var(--muted); font-size:var(--text-xs); }
.approval-trade-detail-summary strong { font-size:var(--text-sm); font-variant-numeric:tabular-nums; }
.approval-trade-detail-table th:nth-child(n+2),.approval-trade-detail-table td:nth-child(n+2) { text-align:right; font-variant-numeric:tabular-nums; }
.approval-trade-detail-table th:first-child,.approval-trade-detail-table td:first-child { text-align:left; }
.approval-trade-detail-table .is-adjusted { color:var(--warning-ink,var(--text)); font-weight:700; }
.approval-trade-adjustment-note { display:block; margin-top:4px; color:var(--muted); font-size:var(--text-xs); font-weight:400; line-height:1.45; }

@container (max-width:720px) {
  .approval-trade-section > header { align-items:flex-start; }
  .approval-trade-section > header > .btn { flex:0 0 auto; }
  .approval-trade-invoice-main,.approval-trade-adjustment-detail,.approval-trade-rate-grid,.approval-trade-rate-override,.approval-trade-detail-summary { grid-template-columns:1fr; }
  .approval-trade-invoice-main { grid-template-areas:none; }
  .approval-trade-invoice-main > .field:nth-child(n) { grid-area:auto; grid-column:1; grid-row:auto; }
  .approval-trade-adjustment-summary,.approval-trade-invoice-file,.approval-trade-invoice-remove,.approval-trade-rate-override > .field,.approval-trade-rate-override > span { grid-area:auto; grid-column:auto; grid-row:auto; }
  .approval-trade-invoice-remove { justify-self:end; }
  .approval-trade-adjustment-detail { align-items:stretch; }
  .approval-trade-section > footer { display:grid; grid-template-columns:1fr auto; justify-content:stretch; }
  .approval-trade-section > footer strong { margin-right:0; text-align:right; }
}
.universal-preview-status {
  min-width: 0;
  min-height: 160px;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  color: var(--text-muted, #667085);
}
.viewer-standalone #globalAttachmentDialog {
  inset: 0 !important; margin: 0 !important; transform: none !important;
  width: 100vw !important; max-width: 100vw !important;
  height: 100dvh !important; max-height: 100dvh !important; border-radius: 0;
}
