:root {
    color-scheme: light;
    --ink: #18202f;
    --muted: #697386;
    --line: #e5e8ef;
    --surface: #ffffff;
    --canvas: #f5f6fa;
    --navy: #171c36;
    --violet: #6657e8;
    --violet-dark: #5142d5;
    --violet-soft: #efedff;
    --green: #1ca878;
    --amber: #d78a16;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-synthesis: none;
}

* { box-sizing: border-box; }
html, body, #app { min-height: 100%; margin: 0; }
body { background: var(--canvas); color: var(--ink); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, strong { font-family: Inter, "Segoe UI", Arial, sans-serif; }

.eyebrow { color: var(--violet); font-size: .69rem; font-weight: 800; letter-spacing: .14em; margin: 0 0 .55rem; }
.eyebrow.light { color: #aaa3ff; }
.muted { color: var(--muted); }
.wide { width: 100%; }
.visually-hidden { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.brand-mark {
    align-items: center; background: linear-gradient(135deg, #8174ff, #5747db); border-radius: 13px; box-shadow: 0 9px 24px #392f8e47;
    color: white; display: inline-flex; font-size: .85rem; font-weight: 800; height: 42px; justify-content: center; letter-spacing: -.04em; width: 42px;
}
.brand-lockup { align-items: center; display: flex; gap: .85rem; }
.brand-lockup strong { display: block; font-size: 1rem; line-height: 1.1; }
.brand-lockup small { color: #999fb7; display: block; font-size: .68rem; margin-top: .2rem; text-transform: uppercase; letter-spacing: .08em; }
.brand-lockup.dark { color: white; padding: 1.65rem 1.45rem; }
.brand-lockup.dark strong { font-size: .92rem; }

.boot-screen { align-items: center; display: flex; gap: 1rem; justify-content: center; min-height: 100vh; }
.boot-copy { display: flex; flex-direction: column; gap: .15rem; }
.boot-copy span { color: var(--muted); font-size: .82rem; }

.auth-shell { display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(430px, .92fr); min-height: 100vh; }
.auth-visual { background: radial-gradient(circle at 20% 10%, #393574 0, transparent 32%), radial-gradient(circle at 85% 80%, #292958 0, transparent 30%), var(--navy); color: white; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; padding: 3rem clamp(2.5rem, 6vw, 6.5rem); position: relative; }
.auth-visual::before, .auth-visual::after { border: 1px solid #7770db2b; border-radius: 50%; content: ''; height: 460px; position: absolute; right: -210px; top: -110px; width: 460px; }
.auth-visual::after { height: 620px; right: -270px; top: -190px; width: 620px; }
.auth-message { max-width: 610px; position: relative; z-index: 1; }
.auth-message h1 { font-size: clamp(2.4rem, 4.8vw, 4.6rem); letter-spacing: -.055em; line-height: 1.06; margin-bottom: 1.4rem; }
.auth-message > p:last-child { color: #b9bdd0; font-size: clamp(1rem, 1.25vw, 1.18rem); line-height: 1.7; max-width: 560px; }
.signal-row { color: #c6c9d9; display: flex; flex-wrap: wrap; font-size: .77rem; gap: 1.25rem; }
.signal-row span { align-items: center; display: flex; gap: .42rem; }
.signal-row i { background: #6bd6ae; border-radius: 50%; box-shadow: 0 0 0 4px #6bd6ae18; height: 6px; width: 6px; }
.auth-panel { align-items: center; background: white; display: flex; justify-content: center; padding: 3rem; }
.auth-card { max-width: 410px; width: 100%; }
.auth-card h2 { font-size: 2rem; letter-spacing: -.04em; margin-bottom: .55rem; }
.auth-card > .muted { font-size: .9rem; margin-bottom: 2rem; }
.auth-card form { display: flex; flex-direction: column; }
label { color: #353e50; font-size: .77rem; font-weight: 700; margin: 0 0 .45rem; }
.field { background: #fbfbfd; border: 1px solid #dfe2ea; border-radius: 10px; color: var(--ink); min-height: 46px; outline: none; padding: .76rem .9rem; transition: border .15s, box-shadow .15s; width: 100%; }
.field:focus { border-color: #8275ec; box-shadow: 0 0 0 3px #6b5be71c; }
.auth-card .field { margin-bottom: 1.1rem; }
.password-wrap { position: relative; }
.password-wrap .field { padding-right: 5rem; }
.password-toggle { background: transparent; border: 0; color: var(--violet); cursor: pointer; font-size: .74rem; font-weight: 700; position: absolute; right: .65rem; top: .85rem; }
.validation-message { color: #b93552; font-size: .73rem; margin: -.7rem 0 1rem; }
.security-note { border-top: 1px solid var(--line); color: #8a91a0; font-size: .7rem; line-height: 1.55; margin-top: 1.8rem; padding-top: 1.2rem; }
.mobile-brand { display: none; }

.btn { align-items: center; border: 1px solid transparent; border-radius: 10px; cursor: pointer; display: inline-flex; font-weight: 700; gap: .4rem; justify-content: center; min-height: 42px; padding: .68rem 1rem; text-decoration: none; transition: .16s ease; }
.btn:hover:not(:disabled) { transform: translateY(-1px); }
.btn:disabled { cursor: not-allowed; opacity: .52; }
.btn.primary { background: var(--violet); box-shadow: 0 8px 18px #6657e833; color: white; }
.btn.primary:hover:not(:disabled) { background: var(--violet-dark); }
.auth-card .btn.primary { margin-top: .45rem; }
.btn.secondary { background: var(--violet-soft); color: var(--violet-dark); }
.btn.ghost { background: white; border-color: var(--line); color: #4d5668; }
.btn.danger { background: #b4233f; color: white; }
.btn.danger:hover:not(:disabled) { background: #921c34; }
.btn.compact { font-size: .75rem; min-height: 34px; padding: .45rem .7rem; }

.app-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--navy); display: flex; flex-direction: column; min-height: 100vh; }
.sidebar nav { display: flex; flex: 1; flex-direction: column; gap: .32rem; padding: 1.35rem .85rem; }
.nav-item { align-items: center; background: transparent; border: 0; border-radius: 9px; color: #9da3bc; cursor: pointer; display: grid; font-size: .8rem; grid-template-columns: 25px 1fr auto; min-height: 43px; padding: .65rem .8rem; text-align: left; width: 100%; }
.nav-item.active { background: #6f62ee21; color: #d9d6ff; }
.nav-item:disabled { cursor: default; opacity: .62; }
.nav-item small { background: #ffffff0c; border-radius: 4px; font-size: .55rem; padding: .18rem .35rem; text-transform: uppercase; }
.nav-icon { font-size: 1.05rem; }
.sidebar-footer { align-items: center; border-top: 1px solid #ffffff12; color: #c3c7d8; display: flex; gap: .7rem; padding: 1.15rem 1.35rem; }
.sidebar-footer strong, .sidebar-footer small { display: block; font-size: .66rem; }
.sidebar-footer small { color: #737a98; margin-top: .15rem; }
.status-dot { background: #41d19e; border-radius: 50%; box-shadow: 0 0 0 4px #41d19e1c; height: 8px; width: 8px; }
.workspace { min-width: 0; }
.topbar { align-items: center; background: white; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; min-height: 84px; padding: 1rem clamp(1.4rem, 4vw, 3.5rem); }
.topbar h1 { font-size: 1.25rem; letter-spacing: -.025em; margin: 0; }
.topbar .eyebrow { font-size: .57rem; margin-bottom: .3rem; }
.user-area { align-items: center; display: flex; gap: .7rem; }
.user-area strong, .user-area small { display: block; font-size: .72rem; }
.user-area small { color: var(--muted); margin-top: .12rem; }
.avatar { align-items: center; background: var(--violet-soft); border-radius: 10px; color: var(--violet-dark); display: flex; font-size: .72rem; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.icon-button, .modal-close { background: transparent; border: 0; color: #7a8292; cursor: pointer; font-size: 1.25rem; }
.content { margin: 0 auto; max-width: 1340px; padding: 2.3rem clamp(1.4rem, 4vw, 3.5rem) 4rem; }
.hero-row { align-items: flex-end; display: flex; justify-content: space-between; margin-bottom: 1.8rem; }
.hero-row h2 { font-size: 1.55rem; letter-spacing: -.035em; margin-bottom: .4rem; }
.hero-row p { font-size: .84rem; margin: 0; }
.hero-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .7rem; }
.refresh-symbol { display: inline-block; font-size: 1.05rem; line-height: 1; }
.refresh-symbol.active { animation: spin .8s linear infinite; }
.folder-upload-control { display: inline-flex; position: relative; }
.folder-input { height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px; }
.folder-upload-control.busy { pointer-events: none; }
.folder-upload-control.busy .btn { cursor: not-allowed; opacity: .52; }
.stats-grid { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 1.5rem; }
.stat { align-items: center; background: white; border: 1px solid var(--line); border-radius: 12px; display: flex; gap: .9rem; padding: 1rem; }
.stat-icon { align-items: center; border-radius: 10px; display: flex; font-size: 1.05rem; height: 42px; justify-content: center; width: 42px; }
.stat-icon.violet { background: var(--violet-soft); color: var(--violet); }
.stat-icon.green { background: #e8f8f1; color: var(--green); }
.stat-icon.amber { background: #fff5e4; color: var(--amber); }
.stat strong, .stat small { display: block; }
.stat strong { font-size: 1.16rem; }
.stat small { color: var(--muted); font-size: .69rem; margin-top: .12rem; }
.template-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }
.template-card { align-items: center; background: white; border: 1px solid var(--line); border-radius: 13px; color: inherit; cursor: pointer; display: grid; gap: 1rem; grid-template-columns: 67px 1fr 18px; min-height: 145px; padding: 1rem; text-align: left; transition: border .16s, box-shadow .16s, transform .16s; }
.template-card:hover { border-color: #c9c3fb; box-shadow: 0 10px 26px #3136570d; transform: translateY(-2px); }
.document-preview { background: #f4f2ed; border: 1px solid #e6e1d8; border-radius: 4px; display: flex; flex-direction: column; gap: 6px; height: 91px; padding: 15px 10px 8px; position: relative; width: 67px; }
.document-preview::before { background: #d8d5ca; content: ''; height: 5px; width: 60%; }
.document-preview i { background: #dfdcd3; display: block; height: 3px; width: 100%; }
.document-preview b { align-self: flex-end; background: repeating-linear-gradient(90deg,#383838 0 1px,transparent 1px 3px); color: transparent; height: 13px; margin-top: auto; width: 34px; }
.card-copy { min-width: 0; }
.card-copy > strong, .card-copy > small, .card-copy > time { display: block; }
.card-copy > strong { font-size: .9rem; margin: .55rem 0 .3rem; }
.card-copy > small { color: var(--muted); font-size: .69rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-copy > time { color: #a0a6b1; font-size: .61rem; margin-top: .65rem; }
.card-arrow { color: #a6acb8; }
.badge { border-radius: 999px; display: inline-block; font-size: .57rem; font-weight: 800; letter-spacing: .05em; padding: .25rem .5rem; text-transform: uppercase; }
.badge.published { background: #e7f7f0; color: #17825e; }
.badge.draft { background: #fff4df; color: #a66a0f; }
.badge.neutral { background: #eef0f4; color: #697386; }
.empty-state { align-items: center; background: white; border: 1px dashed #d9dce5; border-radius: 14px; color: var(--muted); display: flex; flex-direction: column; min-height: 280px; justify-content: center; padding: 2rem; text-align: center; }
.empty-state h3 { color: var(--ink); margin: .8rem 0 .4rem; }
.empty-state p { font-size: .8rem; }
.empty-icon { align-items: center; background: var(--violet-soft); border-radius: 50%; color: var(--violet); display: flex; font-size: 1.25rem; height: 54px; justify-content: center; width: 54px; }

.alert { border-radius: 9px; font-size: .77rem; line-height: 1.5; margin: 1rem 0; padding: .8rem 1rem; }
.alert.error { background: #fff0f2; border: 1px solid #f4ccd4; color: #9f2f46; }
.alert.success { background: #eaf8f2; border: 1px solid #c7ebdc; color: #176f52; }
.spinner { animation: spin .8s linear infinite; border: 3px solid #ddd9fc; border-right-color: var(--violet); border-radius: 50%; height: 30px; width: 30px; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-backdrop { align-items: center; background: #13172ca8; display: flex; inset: 0; justify-content: center; padding: 1.5rem; position: fixed; z-index: 100; }
.modal-card { background: white; border-radius: 16px; box-shadow: 0 24px 80px #0b0e1c59; max-width: 510px; padding: 2.2rem; position: relative; width: 100%; }
.modal-card h2, .detail-header h2 { font-size: 1.45rem; letter-spacing: -.035em; margin-bottom: .4rem; }
.modal-card > .muted { font-size: .8rem; margin-bottom: 1.6rem; }
.modal-card form { display: flex; flex-direction: column; }
.modal-card .field { margin-bottom: 1rem; }
.textarea { min-height: 82px; resize: vertical; }
.optional { color: #9ba1ae; font-size: .66rem; font-weight: 500; }
.modal-close { font-size: 1.6rem; position: absolute; right: 1.2rem; top: 1rem; }
.file-drop { align-items: center; background: #faf9ff; border: 1px dashed #bbb4ed; border-radius: 10px; color: var(--violet); cursor: pointer; display: flex; flex-direction: column; gap: .18rem; margin: 0; padding: 1rem; text-align: center; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s; }
.file-drop.drag-active { background: #efedff; border-color: var(--violet); box-shadow: 0 0 0 4px #6657e81a; transform: scale(1.01); }
.file-drop > span { font-size: 1.3rem; }
.file-drop strong { color: #5047a3; font-size: .76rem; }
.file-drop small { color: #8e92a2; font-size: .65rem; }
.modal-actions { display: flex; gap: .7rem; justify-content: flex-end; margin-top: 1.5rem; }
.detail-backdrop { align-items: stretch; justify-content: flex-end; padding: 0; }
.detail-panel { background: white; box-shadow: -20px 0 55px #080b1747; height: 100%; max-width: 660px; overflow: auto; width: 100%; }
.detail-header { border-bottom: 1px solid var(--line); padding: 2rem; position: relative; }
.detail-header .muted { font-size: .78rem; margin: 0; }
.detail-body { padding: 2rem; }
.detail-body h3 { font-size: .92rem; margin-bottom: 1rem; }
.reserved-code-card { align-items: center; background: #f7f5ff; border: 1px solid #ded8ff; border-radius: 12px; display: flex; gap: 1rem; justify-content: space-between; margin-bottom: 1.5rem; padding: 1rem; }
.reserved-code-card .eyebrow { font-size: .53rem; margin-bottom: .25rem; }
.reserved-code-card h3 { color: var(--violet-dark); font-family: Consolas, monospace; font-size: 1.15rem; letter-spacing: .08em; margin: 0; }
.reserved-code-card p { color: var(--muted); font-size: .66rem; line-height: 1.45; margin: .35rem 0 0; max-width: 330px; }
.reserved-code-actions { align-items: flex-end; display: grid; gap: .35rem .5rem; grid-template-columns: 72px auto; min-width: 250px; }
.reserved-code-actions label { margin: 0; }
.reserved-code-actions .field { min-height: 38px; padding: .45rem .6rem; }
.reserved-code-actions .btn { grid-column: 1 / -1; }
.reserved-code-actions small { color: var(--muted); font-family: Consolas, monospace; font-size: .6rem; grid-column: 1 / -1; text-align: right; }
.version-row { align-items: center; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: .8rem; grid-template-columns: 42px 1fr auto; margin-bottom: .7rem; padding: .85rem; }
.version-number { align-items: center; background: var(--violet-soft); border-radius: 8px; color: var(--violet); display: flex; font-size: .72rem; font-weight: 800; height: 38px; justify-content: center; }
.version-row strong, .version-row small { display: block; font-size: .71rem; }
.version-row small { color: var(--muted); font-family: monospace; margin-top: .2rem; }
.editor-open { grid-column: 2 / -1; justify-self: start; }
.printable-actions { display: flex; flex-wrap: wrap; gap: .55rem; grid-column: 2 / -1; }
.upload-another { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1.5rem; }
.inline-upload { align-items: center; display: flex; gap: .7rem; }
.inline-upload input { font-size: .7rem; max-width: 350px; }
.selected-file { background: #f7f6ff; border-radius: 8px; color: #51489c; font-size: .7rem; margin-top: .8rem; padding: .65rem .75rem; }
.optional-label { color: var(--muted); font-size: .65rem; font-weight: 500; }
.form-hint { font-size: .7rem; line-height: 1.45; margin: -.45rem 0 1rem; }
.error-text { color: #aa2944; }
.batch-progress { background: #f7f6ff; border: 1px solid #e1ddff; border-radius: 10px; margin-top: 1rem; padding: .75rem; }
.batch-progress div { align-items: center; display: flex; font-size: .7rem; justify-content: space-between; margin-bottom: .5rem; }
.batch-progress progress { accent-color: var(--violet); height: .55rem; width: 100%; }
.document-list { background: white; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.document-row { align-items: center; border-bottom: 1px solid var(--line); display: grid; gap: 1rem; grid-template-columns: 52px minmax(0, 1fr) auto; padding: 1rem 1.2rem; }
.document-row:last-child { border-bottom: 0; }
.document-row strong, .document-row small { display: block; }
.document-row strong { font-size: .78rem; }
.document-template-name { color: var(--violet); font-weight: 700; }
.document-row small { color: var(--muted); font-size: .66rem; margin-top: .25rem; }
.document-type { align-items: center; background: var(--violet-soft); border-radius: 8px; color: var(--violet); display: flex; font-size: .65rem; font-weight: 800; height: 40px; justify-content: center; }
.document-row-actions { align-items: center; display: flex; gap: .65rem; }
.document-inspector { background: var(--canvas); display: flex; flex-direction: column; height: 100%; overflow: hidden; width: 100%; }
.batch-inspector { background: var(--canvas); display: flex; flex-direction: column; height: 100%; overflow: hidden; width: 100%; }
.batch-inspector-body { flex: 1; overflow-y: auto; padding: 1.4rem; }
.batch-stats { margin-bottom: 1.2rem; }
.batch-groups { display: grid; gap: 1rem; }
.batch-document-card, .batch-review-card { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 1rem; }
.batch-document-card > header, .batch-review-card > header { align-items: center; display: flex; gap: 1rem; justify-content: space-between; }
.batch-document-card h3, .batch-review-card h3 { font-size: .88rem; margin: .45rem 0 .2rem; }
.batch-document-card p { color: var(--muted); font-size: .66rem; margin: 0; }
.batch-card-actions { align-items: center; display: flex; flex-wrap: wrap; gap: .55rem; justify-content: flex-end; }
.batch-page-flow { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.batch-page-chip { background: #f7f6ff; border: 1px solid #e1ddff; border-radius: 9px; min-width: 155px; padding: .65rem .75rem; }
.batch-page-chip strong, .batch-page-chip span, .batch-page-chip small { display: block; }
.batch-page-chip strong { color: #3e367d; font-size: .7rem; }
.batch-page-chip span { color: var(--ink); font-size: .63rem; margin-top: .2rem; }
.batch-page-chip small { color: var(--muted); font-size: .57rem; margin-top: .22rem; }
.batch-review-card { border-color: #efd9ad; margin-top: 1rem; }
.batch-review-table-wrap { margin-top: .8rem; overflow-x: auto; }
.batch-review-table { border-collapse: collapse; font-size: .66rem; min-width: 760px; width: 100%; }
.batch-review-table th, .batch-review-table td { border-bottom: 1px solid var(--line); padding: .55rem; text-align: left; }
.batch-review-table th { color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.batch-review-table code { color: #42388e; font-size: .62rem; }
.compact-empty { min-height: 180px; }
.inspector-heading-meta { align-items: center; display: flex; gap: .75rem; }
.inspector-heading-meta span, .inspector-heading-meta small { display: block; }
.inspector-heading-meta span { font-size: .72rem; font-weight: 700; }
.inspector-heading-meta small { color: var(--muted); font-size: .62rem; }
.inspector-template-label { color: var(--muted); font-size: .66rem; margin: .22rem 0 0; }
.inspector-template-label strong { color: var(--purple); }
.anchor-settings { background: #f7f5ff; border: 1px solid #e6e0ff; border-radius: 10px; margin-top: .45rem; padding: .7rem; }
.anchor-settings label:first-child { margin-top: 0; }
.table-column-ruler { background: #eeecfb; border: 1px solid #ddd8f8; border-radius: 7px; height: 54px; margin: .55rem 0 .75rem; overflow: hidden; position: relative; }
.table-column-segment { align-items: center; background: #6c5ce733; border-left: 2px solid #6554dc; border-right: 1px solid #6554dc66; bottom: 0; display: flex; flex-direction: column; justify-content: center; min-width: 2px; overflow: hidden; position: absolute; top: 0; }
.table-column-segment b, .table-column-segment small { max-width: 100%; overflow: hidden; padding: 0 .2rem; text-overflow: ellipsis; white-space: nowrap; }
.table-column-segment b { font-size: .58rem; }
.table-column-segment small, .percent-readout { color: #6258a8; font-size: .55rem; }
.percent-readout { display: block; margin: .2rem .1rem 0; text-align: right; }
.document-inspector-layout { display: grid; flex: 1; grid-template-columns: 82px minmax(0, 1fr) 360px; height: 0; min-height: 0; }
.document-page-viewer { display: flex; min-height: 0; min-width: 0; }
.document-image-scroll { overflow: auto; padding: 1.5rem; text-align: center; width: 100%; }
.document-image-scroll img { background: white; box-shadow: 0 8px 30px #151a2d26; height: auto; max-width: 100%; }
.inspection-fields { background: white; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inspection-fields > header { border-bottom: 1px solid var(--line); padding: 1rem; }
.inspection-fields > header strong, .inspection-fields > header small { display: block; }
.inspection-fields > header strong { font-size: .78rem; }
.inspection-fields > header small { color: var(--muted); font-size: .62rem; margin-top: .2rem; }
.inspection-fields-scroll { overflow-y: auto; padding: .85rem; }
.inspection-field-card { border: 1px solid var(--line); border-radius: 9px; margin-bottom: .7rem; padding: .8rem; }
.inspection-field-title { align-items: flex-start; display: flex; gap: .6rem; justify-content: space-between; }
.inspection-field-title strong { font-size: .73rem; }
.result-status { border-radius: 999px; flex: none; font-size: .52rem; font-weight: 800; padding: .2rem .4rem; text-transform: uppercase; }
.result-status.valid { background: #e7f7f0; color: #17825e; }
.result-status.warning { background: #fff4df; color: #a66a0f; }
.result-status.invalid { background: #fff0f2; color: #9f2f46; }
.field-key { color: var(--muted); display: block; font-family: Consolas, monospace; font-size: .58rem; margin-top: .3rem; }
.recognized-value { background: #f7f6ff; border-radius: 7px; color: #312b69; font-size: .78rem; line-height: 1.45; margin-top: .65rem; overflow-wrap: anywhere; padding: .65rem; white-space: pre-wrap; }
.inspection-table-wrap { margin-top: .65rem; max-width: 100%; overflow-x: auto; }
.inspection-table { border-collapse: collapse; font-size: .72rem; min-width: 100%; }
.inspection-table th, .inspection-table td { border: 1px solid #e5e1f5; padding: .45rem .5rem; text-align: left; vertical-align: top; }
.inspection-table th { background: #f2efff; color: #312b69; white-space: nowrap; }
.table-settings { border-top: 1px solid #ece9f7; margin-top: .8rem; padding-top: .8rem; }
.table-settings-head, .table-column-title { align-items: center; display: flex; justify-content: space-between; gap: .5rem; }
.table-settings-head small { display: block; color: #77738b; font-size: .66rem; margin-top: .15rem; }
.table-column-card { background: #f8f7fc; border: 1px solid #e6e2f2; border-radius: 8px; margin-top: .65rem; padding: .65rem; }
.table-column-title button { background: transparent; border: 0; color: #b4233d; cursor: pointer; font-size: .68rem; }
.btn.compact { font-size: .68rem; padding: .45rem .6rem; }
.copy-code-row { align-items: center; display: flex; gap: .5rem; }
.copy-code-row .field { min-width: 10.5rem; }
.inspection-field-card details { color: var(--muted); font-size: .61rem; margin-top: .55rem; }
.inspection-field-card details p { margin: .35rem 0 0; white-space: pre-wrap; }
.inspection-field-card footer { color: #8b92a0; display: flex; font-size: .55rem; gap: .5rem; justify-content: space-between; margin-top: .65rem; }
.template-danger-zone { align-items: center; border-top: 1px solid #f0cbd3; display: flex; gap: 1rem; justify-content: space-between; margin-top: 1.5rem; padding-top: 1.5rem; }
.template-danger-zone strong, .template-danger-zone small { display: block; }
.template-danger-zone strong { color: #9f2f46; font-size: .76rem; }
.template-danger-zone small { color: var(--muted); font-size: .65rem; margin-top: .25rem; }
.delete-confirm-backdrop { z-index: 300; }
.confirm-card { max-width: 540px; }
.operational-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat-icon.red { background: #fff0f2; color: #b4233f; }
.badge.error { background: #fff0f2; color: #9f2f46; }
.badge.processing { background: var(--violet-soft); color: var(--violet-dark); }
.operations-table-wrap { background: white; border: 1px solid var(--line); border-radius: 12px; overflow: auto; }
.operations-table { border-collapse: collapse; min-width: 820px; width: 100%; }
.operations-table th { background: #fafafd; color: var(--muted); font-size: .62rem; letter-spacing: .06em; padding: .75rem 1rem; text-align: left; text-transform: uppercase; }
.operations-table td { border-top: 1px solid var(--line); font-size: .72rem; padding: .85rem 1rem; vertical-align: middle; }
.operations-table td strong, .operations-table td small { display: block; }
.operations-table td small { color: var(--muted); font-size: .61rem; margin-top: .22rem; }
.job-error { color: #9f2f46 !important; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-level-filter { min-height: 42px; width: 205px; }
.log-list { display: flex; flex-direction: column; gap: .55rem; }
.log-entry { background: white; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.log-entry summary { align-items: center; cursor: pointer; display: grid; gap: .8rem; grid-template-columns: 90px 135px minmax(0, 1fr); list-style: none; padding: .85rem 1rem; }
.log-entry summary::-webkit-details-marker { display: none; }
.log-entry summary time { color: var(--muted); font-size: .62rem; }
.log-entry summary strong { font-size: .7rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-level { border-radius: 999px; font-size: .54rem; font-weight: 800; padding: .22rem .45rem; text-align: center; text-transform: uppercase; }
.level-1, .level-2 { background: #fff0f2; color: #9f2f46; }
.level-3 { background: #fff4df; color: #a66a0f; }
.level-4 { background: #e8f8f1; color: #17795a; }
.level-5, .level-6, .level-7, .level-8 { background: var(--violet-soft); color: var(--violet-dark); }
.log-details { border-top: 1px solid var(--line); padding: 1rem; }
.log-details dl { display: grid; font-size: .66rem; gap: .35rem .8rem; grid-template-columns: 85px 1fr; margin: 0; }
.log-details dt { color: var(--muted); }
.log-details dd { margin: 0; overflow-wrap: anywhere; }
.log-details pre { background: #171c36; border-radius: 8px; color: #e7e9f3; font-size: .62rem; margin: .85rem 0 0; max-height: 280px; overflow: auto; padding: .8rem; white-space: pre-wrap; }

.editor-backdrop { background: #0c1020e8; inset: 0; position: fixed; z-index: 200; }
.pdf-editor { background: var(--canvas); display: flex; flex-direction: column; height: 100%; overflow: hidden; width: 100%; }
.editor-topbar { align-items: center; background: white; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; min-height: 76px; padding: .85rem 1.3rem; }
.editor-topbar h2 { font-size: 1.05rem; margin: 0; }
.editor-topbar .eyebrow { font-size: .55rem; margin-bottom: .25rem; }
.editor-actions { align-items: center; display: flex; gap: .65rem; }
.modal-close.static { position: static; }
.unsaved-dot { align-items: center; color: #aa6a0a; display: flex; font-size: .68rem; gap: .38rem; }
.unsaved-dot::before { background: #e8a439; border-radius: 50%; content: ''; height: 7px; width: 7px; }
.editor-alert { background: #fff0f2; border-bottom: 1px solid #f4ccd4; color: #9f2f46; font-size: .74rem; padding: .6rem 1.2rem; }
.editor-layout { display: grid; flex: 1; grid-template-columns: 82px minmax(0, 1fr) 310px; height: 0; min-height: 0; }
.page-rail { align-items: center; background: #f0f1f6; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: .7rem; overflow-y: auto; padding: 1rem .6rem; }
.page-rail > strong { color: #707789; font-size: .62rem; text-transform: uppercase; }
.page-chip { align-items: center; aspect-ratio: .75; background: white; border: 1px solid #d9dce5; border-radius: 7px; color: #545d70; cursor: pointer; display: flex; flex-direction: column; font-weight: 700; justify-content: center; width: 55px; }
.page-chip.active { border: 2px solid var(--violet); box-shadow: 0 4px 12px #6657e824; color: var(--violet); }
.page-chip small { color: #9aa0ae; font-family: monospace; font-size: .54rem; margin-top: .25rem; }
.pdf-workbench { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; overflow: hidden; }
.canvas-toolbar { align-items: center; background: white; border-bottom: 1px solid var(--line); color: #596174; display: flex; font-size: .68rem; justify-content: space-between; min-height: 40px; padding: .55rem 1rem; }
.draw-hint { background: var(--violet-soft); border-radius: 999px; color: var(--violet-dark); padding: .3rem .7rem; }
.canvas-scroll { align-items: flex-start; background-color: #d8dbe3; background-image: radial-gradient(#b7bbc6 1px, transparent 1px); background-size: 16px 16px; display: flex; flex: 1 1 0; height: 0; justify-content: center; min-height: 0; overflow: scroll; overscroll-behavior: contain; padding: 2rem; scrollbar-color: #7d8494 #c8cbd3; scrollbar-gutter: stable both-edges; scrollbar-width: auto; }
.canvas-scroll::-webkit-scrollbar { height: 14px; width: 14px; }
.canvas-scroll::-webkit-scrollbar-track { background: #c8cbd3; }
.canvas-scroll::-webkit-scrollbar-thumb { background: #7d8494; border: 3px solid #c8cbd3; border-radius: 999px; }
.pdf-page-stage { background: white; box-shadow: 0 8px 30px #1f253c38; flex: none; position: relative; touch-action: none; }
.pdf-page-stage canvas { display: block; height: auto !important; max-width: 100%; width: 100% !important; }
.pdf-zone-overlay { cursor: crosshair; inset: 0; position: absolute; user-select: none; }
.ocr-region { background: #6657e824; border: 2px solid #6557e8; border-radius: 3px; color: #4135aa; cursor: move; min-height: 0; min-width: 0; overflow: visible; padding: 0; position: absolute; touch-action: none; }
.ocr-region:hover, .ocr-region.selected { background: #6657e83d; border-color: #3f32bd; box-shadow: 0 0 0 2px #ffffffcc, 0 0 0 4px #6657e8; z-index: 2; }
.ocr-region > span { background: #5142d5; border-radius: 3px 3px 0 0; bottom: 100%; color: white; font-size: 9px; left: -2px; max-width: 180px; overflow: hidden; padding: 2px 5px; position: absolute; text-overflow: ellipsis; white-space: nowrap; }
.ocr-region.draft-region { background: #28a87e2e; border-color: #15976d; pointer-events: none; }
.resize-handle { background: white; border: 2px solid #5142d5; border-radius: 50%; display: none; height: 11px; position: absolute; width: 11px; z-index: 3; }
.ocr-region.selected .resize-handle { display: block; }
.handle-nw { cursor: nwse-resize; left: -6px; top: -6px; }
.handle-n { cursor: ns-resize; left: calc(50% - 5px); top: -6px; }
.handle-ne { cursor: nesw-resize; right: -6px; top: -6px; }
.handle-e { cursor: ew-resize; right: -6px; top: calc(50% - 5px); }
.handle-se { bottom: -6px; cursor: nwse-resize; right: -6px; }
.handle-s { bottom: -6px; cursor: ns-resize; left: calc(50% - 5px); }
.handle-sw { bottom: -6px; cursor: nesw-resize; left: -6px; }
.handle-w { cursor: ew-resize; left: -6px; top: calc(50% - 5px); }
.field-panel { background: white; border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.field-panel-head { border-bottom: 1px solid var(--line); min-height: 60px; padding: .85rem 1rem; }
.field-panel-head strong, .field-panel-head small { display: block; }
.field-panel-head strong { font-size: .8rem; }
.field-panel-head small { color: var(--muted); font-size: .63rem; margin-top: .2rem; }
.field-list { border-bottom: 1px solid var(--line); max-height: 34%; overflow-y: auto; padding: .6rem; }
.field-list-row { align-items: stretch; display: grid; gap: .35rem; grid-template-columns: minmax(0, 1fr) auto; margin-bottom: .3rem; }
.field-list-item { align-items: center; background: transparent; border: 1px solid transparent; border-radius: 7px; color: var(--ink); cursor: pointer; display: grid; gap: .65rem; grid-template-columns: 25px 1fr; padding: .55rem; text-align: left; width: 100%; }
.field-list-item:hover, .field-list-item.active { background: #f7f6ff; border-color: #dfdbff; }
.field-list-item strong, .field-list-item small { display: block; }
.field-list-item strong { font-size: .69rem; }
.field-list-item small { color: var(--muted); font-size: .58rem; margin-top: .12rem; }
.field-delete { background: #fff5f6; border: 1px solid #f1ccd3; border-radius: 7px; color: #a72d46; cursor: pointer; font-size: .58rem; font-weight: 700; padding: 0 .55rem; }
.field-delete:hover { background: #fee7eb; border-color: #dfa5b1; }
.field-order { align-items: center; background: var(--violet-soft); border-radius: 6px; color: var(--violet); display: flex; font-size: .62rem; font-weight: 800; height: 25px; justify-content: center; }
.field-empty { color: var(--muted); font-size: .68rem; padding: 1.3rem .7rem; text-align: center; }
.field-empty span { color: var(--violet); font-size: 1.3rem; }
.field-form { overflow-y: auto; padding: 1rem; }
.field-form-title { align-items: center; display: flex; justify-content: space-between; margin-bottom: 1rem; }
.field-form-title strong { font-size: .76rem; }
.field-form-title button { background: transparent; border: 0; color: #b43d55; cursor: pointer; font-size: .64rem; }
.field-form .field { font-size: .7rem; margin-bottom: .75rem; min-height: 38px; padding: .55rem .7rem; }
.field-form label { font-size: .65rem; }
.field-help { background: #f7f6ff; border-radius: 7px; color: #615a88; font-size: .62rem; line-height: 1.45; margin: -.35rem 0 .75rem; padding: .55rem .65rem; }
.code-input { font-family: Consolas, monospace; }
.form-grid { display: grid; gap: .6rem; grid-template-columns: 1fr 1fr; }
.check-row { align-items: center; display: flex; gap: .45rem; margin: .15rem 0 .8rem; }
.coordinates { display: grid; gap: .35rem; grid-template-columns: 1fr 1fr; }
.coordinates span { background: #f4f5f8; border-radius: 5px; color: #697184; font-family: Consolas, monospace; font-size: .59rem; padding: .35rem .45rem; }
.editor-loading { align-items: center; color: var(--muted); display: flex; flex: 1; flex-direction: column; gap: .8rem; justify-content: center; }
.editor-loading strong { font-size: .75rem; }
.editor-confirm-backdrop { align-items: center; background: #11162c9c; display: flex; inset: 0; justify-content: center; padding: 1.5rem; position: absolute; z-index: 20; }
.editor-confirm-card { background: white; border-radius: 14px; box-shadow: 0 24px 70px #080b175c; max-width: 540px; padding: 2rem; width: 100%; }
.editor-confirm-card h3 { font-size: 1.15rem; margin: 0 0 .55rem; }
.editor-confirm-card > p:not(.eyebrow) { color: var(--muted); font-size: .78rem; }

#blazor-error-ui { background: #fff4c9; bottom: 0; box-shadow: 0 -1px 8px #0002; display: none; left: 0; padding: .7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; }
.loading-progress { height: 5rem; left: calc(50% - 2.5rem); position: absolute; top: calc(50% - 2.5rem); width: 5rem; }
.loading-progress circle { fill: none; stroke: #dedbed; stroke-width: .5rem; transform-origin: 50% 50%; transform: rotate(-90deg); }
.loading-progress circle:last-child { stroke: var(--violet); stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * .8), 500%; transition: stroke-dasharray .05s ease-in-out; }
.loading-progress-text { left: 0; position: absolute; text-align: center; top: calc(50% + 3rem); width: 100%; }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-visual { display: none; }
    .auth-panel { min-height: 100vh; padding: 2rem; }
    .mobile-brand { align-items: center; display: flex; gap: .7rem; left: 2rem; position: absolute; top: 2rem; }
    .app-shell { grid-template-columns: 74px minmax(0, 1fr); }
    .sidebar .brand-lockup div, .nav-item > span:not(.nav-icon), .nav-item small, .sidebar-footer div { display: none; }
    .sidebar .brand-lockup { justify-content: center; padding-inline: .5rem; }
    .sidebar nav { padding-inline: .7rem; }
    .nav-item { display: flex; justify-content: center; padding: .6rem; }
    .sidebar-footer { justify-content: center; padding-inline: .5rem; }
    .editor-layout { grid-template-columns: 68px minmax(0, 1fr); }
    .field-panel { bottom: 0; box-shadow: 0 -8px 24px #1b203638; height: 42%; left: 68px; position: absolute; right: 0; z-index: 4; }
    .field-list { max-height: 42%; }
    .canvas-scroll { padding-bottom: calc(42vh + 2rem); }
    .document-inspector-layout { grid-template-columns: 68px minmax(0, 1fr) 300px; }
}

@media (max-width: 650px) {
    .app-shell { display: block; }
    .sidebar { bottom: 0; flex-direction: row; left: 0; min-height: 64px; position: fixed; right: 0; top: auto; z-index: 50; }
    .sidebar .brand-lockup, .sidebar-footer { display: none; }
    .sidebar nav { flex-direction: row; justify-content: space-around; padding: .45rem; width: 100%; }
    .nav-item { min-height: 48px; width: 48px; }
    .topbar { padding: 1rem; }
    .topbar h1 { font-size: 1rem; }
    .user-area > div:not(.avatar) { display: none; }
    .content { padding: 1.5rem 1rem 6rem; }
    .hero-row { align-items: flex-start; flex-direction: column; gap: 1rem; }
    .hero-actions { width: 100%; }
    .hero-actions .btn { flex: 1; }
    .document-row { grid-template-columns: 44px minmax(0, 1fr); }
    .document-row-actions { grid-column: 2; justify-content: space-between; }
    .document-inspector-layout { grid-template-columns: 50px minmax(0, 1fr); position: relative; }
    .inspection-fields { bottom: 0; box-shadow: 0 -8px 24px #1b203638; height: 42%; left: 50px; position: absolute; right: 0; z-index: 4; }
    .document-image-scroll { padding: 1rem 1rem calc(42vh + 1rem); }
    .inspector-heading-meta > span, .inspector-heading-meta > small { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .stat { padding: .75rem; }
    .template-grid { grid-template-columns: 1fr; }
    .modal-card { max-height: calc(100vh - 2rem); overflow: auto; padding: 1.5rem; }
    .version-row { grid-template-columns: 42px 1fr; }
    .version-row .badge { justify-self: start; margin-left: 50px; }
    .editor-topbar { align-items: flex-start; padding: .65rem .8rem; }
    .editor-topbar h2 { font-size: .82rem; }
    .unsaved-dot { display: none; }
    .editor-actions .btn { font-size: .65rem; min-height: 34px; padding: .4rem .6rem; }
    .editor-layout { grid-template-columns: 50px minmax(0, 1fr); position: relative; }
    .page-rail { padding-inline: .3rem; }
    .page-chip { width: 40px; }
    .field-panel { left: 50px; }
    .canvas-toolbar { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .draw-hint { border-radius: 4px; }
    .canvas-scroll { padding: 1rem 1rem calc(42vh + 1rem); }
    .resize-handle { height: 15px; width: 15px; }
    .handle-nw { left: -8px; top: -8px; }
    .handle-n { left: calc(50% - 7px); top: -8px; }
    .handle-ne { right: -8px; top: -8px; }
    .handle-e { right: -8px; top: calc(50% - 7px); }
    .handle-se { bottom: -8px; right: -8px; }
    .handle-s { bottom: -8px; left: calc(50% - 7px); }
    .handle-sw { bottom: -8px; left: -8px; }
    .handle-w { left: -8px; top: calc(50% - 7px); }
}
.page-range-fields { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.page-range-fields > div { min-width:0; }
