/* FHN cabinet tokens. Independent from the internal application theme. */
:root {
  --neutral-0: #ffffff; --neutral-50: #f6f8ef; --neutral-100: #ecf1e3;
  --neutral-200: #dce4d4; --neutral-300: #becdb4; --neutral-500: #6b7962;
  --neutral-700: #4b5c40; --neutral-900: #283b24;
  --green-50: #eef6e7; --green-600: #3c7a35; --green-700: #2b5f27;
  --surface: var(--neutral-0); --page-bg: var(--neutral-50); --border: var(--neutral-200);
  --text: var(--neutral-900); --secondary: var(--neutral-700); --muted: var(--neutral-500);
  --accent: var(--green-600); --accent-hover: var(--green-700); --selected: var(--green-50);
  --selected-border: #c9ddb9;
  --success: #23704c; --success-bg: #eef7f1; --warning: #825a14; --warning-bg: #fcf6e9;
  --danger: #a43338; --danger-bg: #fcf0f0;
  --sidebar-bg: #214b2c; --sidebar-text: #eef6e9; --sidebar-muted: #bfd4b7;
  --sidebar-selected: #39683c; --sidebar-line: #ffffff21;
  --control-height: 40px; --control-radius: 6px; --panel-radius: 8px;
  --header-height: 80px; --sidebar-width: 250px; --font: "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html { color-scheme: light; scroll-padding-top: calc(var(--header-height) + 16px); }
body { margin: 0; background: var(--page-bg); color: var(--text); font: 14px/1.5 var(--font); min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
h1,h2,h3,p,dl,dd { margin: 0; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.35; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
a { color: inherit; text-decoration: none; }
button,input,select { font: inherit; }
button,a,input,select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .5; }
button,a { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main:focus { outline: none; }
button i,a i { pointer-events: none; }
i.fa-solid { display: inline-flex; justify-content: center; align-items: center; width: 16px; font-size: 14px; flex-shrink: 0; }
strong { font-weight: 600; }
small { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 2000; left: 16px; top: -60px; background: var(--surface); padding: 12px 20px; border: 1px solid var(--accent); }
.skip-link:focus { top: 8px; }
.page-width { width: 100%; max-width: 1680px; margin-inline: auto; padding-inline: 32px; }
.site-header { position: sticky; top: 0; z-index: 30; background: var(--surface); border-top: 4px solid var(--accent); flex-shrink: 0; }
.masthead { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand img { width: 48px; height: 52px; object-fit: contain; }
.brand-name { display: flex; flex-direction: column; gap: 0; line-height: 1.35; }
.brand-name>span { font-size: 13px; color: var(--secondary); }
.brand-name>strong { font-size: 18px; font-weight: 600; }
.product-name { display: inline-flex; align-items: center; gap: 8px; padding-left: 28px; border-left: 1px solid var(--border); font-size: 15px; color: var(--secondary); }
.product-name>i { color: var(--accent); }
.header-breadcrumb { flex: 1; min-width: 0; font-size: 13px; }
.header-breadcrumb ol { display: flex; align-items: center; gap: 10px; list-style: none; margin: 0; padding: 0; }
.header-breadcrumb li { display: flex; align-items: center; gap: 10px; min-width: 0; }
.header-breadcrumb li:first-child { flex-shrink: 0; }
.header-breadcrumb li>a,.header-breadcrumb li>span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-breadcrumb a { color: var(--secondary); }
.header-breadcrumb a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.header-breadcrumb .breadcrumb-home { display: inline-flex; align-items: center; gap: 8px; }
.header-breadcrumb li>i { width: 8px; font-size: 9px; color: var(--muted); }
.header-breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.account-link { display: flex; align-items: center; gap: 12px; padding: 4px; border-radius: var(--control-radius); }
.account-link:hover { background: var(--page-bg); }
.account-link>span:not(.avatar) { display: flex; flex-direction: column; }
.account-link small { color: var(--muted); }
.account-link>i { color: var(--muted); font-size: 10px; margin-left: 4px; }
.avatar { width: 36px; height: 36px; background: var(--neutral-100); color: var(--secondary); display: inline-flex; justify-content: center; align-items: center; border-radius: 50%; font-size: 12px; font-weight: 600; flex: 0 0 auto; }
.avatar--large { width: 48px; height: 48px; font-size: 16px; }
.notification-shortcut { position: relative; }
.notification-shortcut>span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); position: absolute; top: 8px; right: 8px; border: 1px solid white; }
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width); border-top: 4px solid var(--accent); background: var(--sidebar-bg); color: var(--sidebar-text); z-index: 40; display: flex; flex-direction: column; }
.sidebar-brand { display: block; flex-shrink: 0; min-width: 0; padding: 18px 14px 14px; color: var(--sidebar-text); }
.brand-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-identity img { width: 44px; height: 48px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand .brand-name { min-width: 0; gap: 4px; }
.sidebar-brand .brand-name>span { font-size: 12.5px; line-height: 1.4; font-weight: 500; color: var(--sidebar-text); }
.sidebar-brand .brand-name>strong { font-size: 14px; line-height: 1.4; font-weight: 600; color: var(--sidebar-text); }
.brand-product { display: flex; align-items: center; justify-content: center; gap: 8px; border-top: 1px solid var(--sidebar-line); padding-top: 12px; margin-top: 14px; font-size: 12px; line-height: 1.4; color: #d3e3ce; }
.brand-product>i { color: #b5d88b; font-size: 12px; width: 12px; }
.sidebar-content { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 12px 12px 20px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff40 transparent; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-link { display: flex; align-items: center; gap: 12px; color: var(--sidebar-text); padding: 12px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 500; min-height: 44px; position: relative; }
.nav-link i { color: var(--sidebar-muted); }
.nav-link:hover { background: #ffffff0c; color: white; }
.nav-link.is-active { color: white; background: var(--sidebar-selected); border-color: #ffffff18; box-shadow: inset 3px 0 #b5d88b; }
.nav-link.is-active i { color: inherit; }
.nav-dot { width: 5px; height: 5px; border-radius: 50%; background: #b5d88b; margin-left: auto; }
.sidebar-organization { margin-top: auto; padding: 20px 12px 0; border-top: 1px solid var(--sidebar-line); }
.sidebar-organization-label { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--sidebar-muted); margin-bottom: 8px; }
.sidebar-organization>strong { display: block; font-size: 12px; line-height: 1.6; color: var(--sidebar-text); font-weight: 500; }
.sidebar-footer { display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; padding: 8px 12px; border-top: 1px solid var(--sidebar-line); background: #18391f; }
.sidebar-action { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 6px; background: transparent; color: var(--sidebar-text); }
.sidebar-action:hover { background: #ffffff12; color: white; }
.sidebar-action.sign-out { color: #ffa8a5; }
.sidebar-action.sign-out:hover { background: #ff9b9718; color: #ffc2bf; }
.sidebar :focus-visible { outline-color: #d1e9b6; outline-offset: 1px; }
body.sidebar-collapsed { --sidebar-width: 64px; }
.sidebar-collapsed .sidebar-brand { padding: 14px 10px; }
.sidebar-collapsed .brand-identity { justify-content: center; }
.sidebar-collapsed .sidebar-brand .brand-name,.sidebar-collapsed .brand-product { display: none; }
.sidebar-collapsed .sidebar-content { padding: 12px 8px; }
.sidebar-collapsed .sidebar-organization,.sidebar-collapsed .nav-label { display: none; }
.sidebar-collapsed .nav-link { justify-content: center; padding: 12px; }
.sidebar-collapsed .nav-dot { position: absolute; top: 8px; right: 8px; }
.sidebar-collapsed .sidebar-footer { flex-direction: column; gap: 4px; padding: 8px; }
body:not(.login-page) .site-header { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); }
body:not(.login-page) .masthead { max-width: none; padding-inline: 24px; border-bottom: 1px solid var(--border); }
body:not(.login-page) .main-content { width: calc(100% - var(--sidebar-width)); max-width: none; margin-left: var(--sidebar-width); margin-right: 0; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 35; background: #282c3265; border: 0; }
.main-content { padding-top: 24px; padding-bottom: 24px; flex: 1; min-width: 0; }
body[data-screen="pending"],body[data-screen="signed"] { height: 100dvh; overflow: hidden; }
body[data-screen="pending"] .main-content,body[data-screen="signed"] .main-content { height: calc(100dvh - var(--header-height)); flex: none; display: flex; flex-direction: column; min-height: 0; padding-bottom: 16px; }
#documents-view { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#documents-view>.page-heading { flex-shrink: 0; }
.document-list { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; position: relative; }
.document-list>.cabinet-grid { flex: 1; min-height: 0; height: 100%; }
.document-list>.loading-state,.document-list>.empty-state { position: absolute; inset: 0; background: var(--surface); z-index: 2; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; margin-bottom: 20px; }
.heading-line { display: flex; align-items: baseline; gap: 12px; }
.count-label { font-size: 13px; color: var(--muted); white-space: nowrap; }
.btn,.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 16px; border: 1px solid var(--border); border-radius: var(--control-radius); white-space: nowrap; background: var(--surface); color: var(--secondary); font-weight: 500; line-height: 1; }
.btn:hover,.icon-button:hover { background: var(--neutral-100); border-color: var(--neutral-300); }
.btn-primary { color: white; background: var(--accent); border-color: var(--accent); }
.btn-primary:hover { color: white; background: var(--accent-hover); border-color: var(--accent-hover); }
.icon-button { width: var(--control-height); padding: 0; flex-shrink: 0; }
.header-actions>.icon-button { border-color: transparent; }
.btn[aria-pressed="true"] { color: var(--accent); background: var(--selected); border-color: var(--selected-border); }
input:not([type="checkbox"]):not(.dx-texteditor-input),select { height: var(--control-height); color: var(--text); background: var(--surface); border: 1px solid var(--neutral-300); border-radius: var(--control-radius); padding: 0 12px; min-width: 0; }
input::placeholder { color: var(--muted); opacity: 1; }
input:not([type="checkbox"]):not(.dx-texteditor-input):focus,select:focus { border-color: var(--accent); outline: none; box-shadow: inset 0 0 0 1px var(--accent); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-radius); }
.cabinet-grid { width: 100%; min-width: 0; }
.cabinet-grid .dx-datagrid { font: 14px/1.45 var(--font); color: var(--text); background: transparent; border-radius: 0 0 var(--panel-radius) var(--panel-radius); }
.cabinet-grid .dx-datagrid-header-panel { padding: 8px 12px 12px; min-height: 61px; border-bottom: 1px solid var(--border); }
.cabinet-grid .dx-datagrid-header-panel .dx-toolbar { height: 40px; min-height: 40px; margin: 0; background: transparent; }
.cabinet-grid .dx-texteditor-input { font: 14px var(--font); min-height: 38px; }
.cabinet-grid .dx-texteditor.dx-editor-outlined { border: 1px solid var(--neutral-300); border-radius: 6px; }
.cabinet-grid .dx-texteditor.dx-state-focused { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cabinet-grid .dx-button { border-radius: 6px; border-color: var(--neutral-300); }
.cabinet-grid .dx-button .dx-button-content { min-height: 38px; padding: 8px 12px; }
.cabinet-grid .dx-toolbar .dx-button i { color: var(--secondary); }
.cabinet-grid .dx-datagrid-headers { color: var(--secondary); background: var(--surface); border-bottom-color: var(--border); }
.cabinet-grid .dx-datagrid-headers .dx-header-row>td { background: #eef3e6; font-weight: 600; padding: 12px; font-size: 13px; }
.cabinet-grid .dx-datagrid-headers .dx-datagrid-filter-row>td { background: var(--surface); }
.cabinet-grid .dx-datagrid .dx-row>td { border-color: var(--border); }
.cabinet-grid .dx-datagrid-rowsview .dx-row>td { padding: 12px; vertical-align: middle; font-size: 14px; }
.cabinet-grid .dx-row-alt>td { background: #fcfdf8; }
.cabinet-grid .dx-datagrid-rowsview .dx-row.dx-state-hover>td { background: #f3f8ec; }
.cabinet-grid .dx-datagrid-rowsview .dx-row.dx-row-focused>td { color: var(--text); background: var(--selected); border-color: var(--selected-border); }
.cabinet-grid .dx-datagrid-rowsview .dx-row.dx-row-focused a { color: var(--accent); }
.cabinet-grid .dx-datagrid-focus-overlay { border: 1px solid var(--accent); }
.cabinet-grid .dx-datagrid-content .dx-datagrid-table .dx-row>td:first-child { padding-left: 16px; }
.cabinet-grid .dx-datagrid-rowsview .dx-datagrid-content:not(.dx-scrollable) { border-bottom: 0; }
.cabinet-grid .dx-datagrid-pager { margin: 0; padding: 12px 16px; border-top: 1px solid var(--border); font: 13px var(--font); }
.cabinet-grid .dx-pager .dx-pages .dx-page,.cabinet-grid .dx-pager .dx-page-sizes .dx-page-size { border-radius: 4px; padding: 8px 12px; }
.cabinet-grid .dx-pager .dx-pages .dx-selection,.cabinet-grid .dx-pager .dx-page-sizes .dx-selection { background: var(--accent); color: white; }
.cabinet-grid .dx-pager .dx-info { color: var(--muted); opacity: 1; }
.cabinet-grid .dx-editor-cell .dx-texteditor { border: 0; background: transparent; border-radius: 0; }
.cabinet-grid .dx-editor-cell .dx-texteditor.dx-state-focused { box-shadow: inset 0 -2px var(--accent); }
.cabinet-grid .dx-filter-menu { color: var(--muted); }
.cabinet-grid .dx-datagrid-header-filter,.cabinet-grid .dx-datagrid .dx-sort { color: var(--muted); }
.cabinet-grid .dx-datagrid-nodata { color: var(--secondary); font-size: 14px; }
.dx-overlay-content { font-family: var(--font); }
.dx-popup-wrapper>.dx-overlay-content { border-radius: 8px; border-color: var(--border); box-shadow: 0 8px 32px #292c301a; }
.dx-checkbox-checked .dx-checkbox-icon { color: var(--accent); }
.dx-state-focused.dx-texteditor { border-color: var(--accent); }
.grid-number { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--accent); white-space: nowrap; }
.grid-title { display: block; font-weight: 500; }
.grid-title:hover,.grid-number:hover { text-decoration: underline; }
.grid-subject { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: 12px; margin-top: 4px; }
.grid-department { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13px; line-height: 1.5; }
.grid-date { white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.grid-time { color: var(--muted); display: block; font-size: 12px; margin-top: 4px; }
.grid-open { color: var(--accent); display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; min-height: 32px; padding: 4px 8px; border: 1px solid var(--selected-border); border-radius: 4px; background: white; }
.grid-open:hover { background: var(--selected); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.status-badge i { font-size: 12px; width: 12px; }
.status-badge--pending { color: var(--warning); background: var(--warning-bg); }
.status-badge--success { color: var(--success); background: var(--success-bg); }
.status-badge--waiting { color: #515d55; background: #eef1ee; white-space: normal; max-width: 280px; align-items: flex-start; }
.status-badge--waiting i { margin-top: 4px; }
.loading-state,.empty-state { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 48px 24px; color: var(--muted); }
.empty-state { flex-direction: column; text-align: center; min-height: 260px; }
.empty-state>i { font-size: 32px; width: 40px; margin-bottom: 8px; color: var(--muted); }
.empty-state h2 { color: var(--text); }
/* The document is the focus. Only the PDF and the context body scroll on desktop. */
body[data-screen="detail"] .main-content { display: flex; flex-direction: column; min-height: 0; }
#detail-view { min-height: 0; display: flex; flex-direction: column; }
.detail-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.detail-heading__text { flex: 1; min-width: 0; }
.detail-heading__meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.detail-heading h1 { font-size: 20px; }
.detail-heading p { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.detail-heading>.status-badge { margin-left: auto; flex-shrink: 0; }
.detail-workspace { display: grid; grid-template-columns: minmax(0,1fr) 352px; gap: 16px; min-height: 380px; height: calc(100dvh - var(--header-height) - 148px); }
.pdf-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.pdf-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px 8px 16px; border-bottom: 1px solid var(--border); min-height: 48px; }
.pdf-toolbar>strong { display: flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; }
.pdf-toolbar i { color: var(--secondary); }
.pdf-tools { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; font-size: 12px; font-variant-numeric: tabular-nums; }
.pdf-tool-group { display: flex; align-items: center; gap: 4px; }
.pdf-tools .icon-button { width: 32px; height: 32px; border-color: transparent; }
.pdf-tools .icon-button[aria-pressed="true"] { background: var(--selected); color: var(--accent); }
.pdf-page-selector { display: inline-flex; align-items: center; gap: 6px; }
.pdf-tools #pdf-page-number { width: 48px; height: 32px; padding: 0 4px; text-align: center; border-radius: 4px; appearance: textfield; }
#pdf-page-number::-webkit-inner-spin-button,#pdf-page-number::-webkit-outer-spin-button { appearance: none; margin: 0; }
#pdf-page-count { min-width: 12px; text-align: center; }
.tool-divider { height: 20px; width: 1px; background: var(--border); margin: 0 4px; }
.zoom-value { display: inline-flex; align-items: center; justify-content: center; font: inherit; color: var(--secondary); height: 32px; min-width: 44px; padding: 0 4px; }
.pdf-view-message { color: var(--danger); background: var(--danger-bg); padding: 8px 16px; font-size: 13px; }
.pdf-panel:fullscreen { display: flex; width: 100vw; height: 100dvh; min-height: 0; border: 0; border-radius: 0; background: var(--surface); }
.pdf-stage { background: #e8edde; padding: 20px; overflow: auto; min-height: 0; flex: 1; position: relative; scrollbar-gutter: stable; }
.pdf-stage canvas { display: block; margin: 0 auto; box-shadow: 0 1px 4px #292c3021; }
.pdf-message { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; min-height: 280px; height: 100%; color: var(--secondary); text-align: center; }
.pdf-message>i { font-size: 28px; width: 32px; }
.pdf-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }
.document-context { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.context-scroll { min-height: 0; flex: 1; overflow: auto; scrollbar-gutter: stable; }
.context-section { padding: 16px; }
.context-section h2 { font-size: 14px; margin-bottom: 12px; }
.metadata { display: grid; gap: 12px; }
.metadata dt { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.metadata dd { color: var(--text); font-size: 13px; overflow-wrap: anywhere; }
.metadata-inline { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.context-tabs { display: flex; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0 16px; gap: 20px; background: var(--surface); }
.context-tabs button { padding: 12px 0 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 500; }
.context-tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
#sequence-panel,#history-panel { padding: 16px; }
.signature-group-label { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-size: 12px; margin-bottom: 8px; font-weight: 500; }
.signature-group-label--participant { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 12px; }
.signature-step { display: flex; gap: 12px; padding: 12px 8px; position: relative; }
.signature-step+.signature-step { border-top: 1px solid var(--border); }
.step-icon { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); display: flex; justify-content: center; align-items: center; color: var(--muted); flex-shrink: 0; background: var(--surface); }
.step-icon i { font-size: 12px; width: 12px; }
.signature-step strong { font-size: 13px; display: block; }
.signature-step small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.signature-step .step-state { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.signature-step.is-complete .step-icon { color: var(--success); background: var(--success-bg); border-color: #c8e2d1; }
.signature-step.is-complete .step-state { color: var(--success); }
.signature-step.is-current { background: var(--selected); border-radius: 6px; }
.signature-step.is-current .step-icon { color: var(--accent); border-color: var(--selected-border); }
.context-actions { border-top: 1px solid var(--border); padding: 16px; background: white; flex-shrink: 0; }
.context-buttons { display: flex; gap: 8px; }
.context-buttons .btn { flex: 1; }
.context-buttons .btn-sign { flex: 2; }
.context-actions>small { display: block; color: var(--muted); font-size: 12px; margin-top: 8px; line-height: 1.5; }
.signed-confirmation { display: flex; align-items: center; gap: 12px; color: var(--success); margin-bottom: 12px; }
.signed-confirmation small { display: block; color: var(--muted); margin-top: 4px; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-list li { border-left: 1px solid var(--border); padding: 0 0 20px 16px; position: relative; }
.history-list li:before { content: ""; position: absolute; left: -4px; top: 6px; width: 7px; height: 7px; background: var(--accent); border-radius: 50%; }
.history-list strong,.history-list span,.history-list time { display: block; font-size: 13px; }
.history-list span,.history-list time { margin-top: 4px; color: var(--muted); font-size: 12px; }
/* Notifications and account share the same compact page rhythm. */
.notification-list { overflow: hidden; }
.notification-date { background: #eef3e6; padding: 8px 20px; font-size: 12px; font-weight: 500; color: var(--secondary); border-bottom: 1px solid var(--border); }
.notification-item { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); position: relative; }
.notification-item:last-child { border-bottom: 0; }
.notification-item.is-unread { background: #f7faef; }
.notification-item:hover { background: var(--neutral-100); }
.notification-icon { width: 32px; height: 32px; color: var(--secondary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.notification-icon.is-complete { color: var(--success); }
.notification-content { flex: 1; min-width: 0; }
.notification-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.notification-content strong { font-size: 14px; font-weight: 500; }
.notification-description { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.notification-item time { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.notification-unread { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.notification-chevron { color: var(--muted); font-size: 12px !important; }
.profile-layout { display: grid; grid-template-columns: 340px minmax(0,1fr); gap: 24px; align-items: start; max-width: 1200px; }
.profile-identity { padding: 24px; }
.identity-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.identity-header p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.account-permissions { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.account-permissions h2 { font-size: 14px; margin-bottom: 12px; }
.account-permissions>div { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; color: var(--secondary); }
.account-permissions i { font-size: 12px; color: var(--success); }
.panel-heading { padding: 20px 24px 0; }
.panel-heading--divided { border-top: 1px solid var(--border); }
.panel-body { padding: 20px 24px 24px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { display: grid; gap: 8px; }
.form-field label { color: var(--secondary); font-size: 13px; }
.form-field input { width: 100%; }
.form-field { align-content: start; }
.field-error { color: var(--danger); font-size: 12px; line-height: 1.5; }
.form-field input[aria-invalid="true"] { border-color: var(--danger); }
.form-field input[aria-invalid="true"]:focus { box-shadow: inset 0 0 0 1px var(--danger); }
.checkbox-row { display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--secondary); min-height: 32px; }
.checkbox-row+.checkbox-row { margin-top: 12px; }
.panel-footer { display: flex; justify-content: flex-end; border-top: 1px solid var(--border); padding: 16px 24px; }
/* Dialogs contain just the decision and its relevant context. */
.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 0; max-width: 520px; width: calc(100% - 32px); color: var(--text); background: var(--surface); box-shadow: 0 12px 48px #292c3026; }
.dialog::backdrop { background: #282c3270; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; gap: 16px; border-bottom: 1px solid var(--border); }
.dialog-header .icon-button { width: 32px; height: 32px; border: 0; }
.dialog-body { padding: 24px; }
.dialog-footer { display: flex; justify-content: flex-end; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); }
.sign-intro { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.sign-emblem { width: 44px; height: 44px; background: var(--selected); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--accent); flex-shrink: 0; }
.sign-intro p { color: var(--secondary); font-size: 13px; margin-top: 4px; }
.sign-details { display: grid; gap: 16px; }
.sign-details dt { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sign-details dd { font-size: 14px; }
.signing-consent { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); align-items: flex-start; }
.signing-consent input { margin-top: 4px; }
.sign-progress { padding: 24px 0; display: flex; align-items: center; gap: 12px; color: var(--accent); }
.sign-success { text-align: center; padding-top: 24px; }
.sign-success>i { width: 40px; font-size: 32px; color: var(--success); margin-bottom: 12px; }
.sign-success p { color: var(--secondary); margin-top: 8px; font-size: 13px; }
.toast-region { position: fixed; right: 24px; bottom: 24px; z-index: 2000; pointer-events: none; }
.toast { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--success); padding: 16px 20px; display: flex; align-items: center; gap: 12px; border-radius: 6px; box-shadow: 0 4px 24px #292c301a; max-width: 440px; }
.toast i { color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--error i { color: var(--danger); }
.noscript { position: fixed; bottom: 0; left: 0; right: 0; background: var(--danger-bg); color: var(--danger); padding: 16px; text-align: center; z-index: 3000; }
/* Entrance page follows the document-signing guide, without an institution-specific identity. */
.login-page { --login-form-bg: #f7f8f4; --login-left-bg: #164b2d; --login-heading: #10281c; --login-accent: #236b17; --login-inset: clamp(32px,4.6vw,80px); background: var(--login-form-bg); }
.login-main { display: grid; grid-template-columns: minmax(0,53.5fr) minmax(0,46.5fr); width: 100%; min-height: 100dvh; }
.login-overview { display: flex; flex-direction: column; min-width: 0; min-height: max(680px,100dvh); padding: 40px var(--login-inset); overflow: hidden; background: var(--login-left-bg); color: #f5f8ee; }
.login-brand { flex-shrink: 0; }
.login-brand .brand { display: flex; width: fit-content; max-width: 100%; white-space: normal; gap: 16px; }
.login-brand .brand img { width: clamp(64px,5.1vw,88px); height: auto; aspect-ratio: 16 / 17; flex: none; }
.login-brand .brand-name { min-width: 0; gap: 2px; padding-left: 16px; border-left: 1px solid #88a88d; }
.login-brand .brand-name>span { color: #eef4e9; font-size: clamp(15px,1.35vw,24px); font-weight: 400; }
.login-brand .brand-name>strong { color: #f5f8ee; font-size: clamp(20px,1.7vw,30px); line-height: 1.3; }
.login-nature { display: flex; flex-direction: column; flex: 1; min-height: 300px; margin: 20px calc(16px - var(--login-inset)) 0; }
.login-tree-scene { position: relative; flex: 1; min-height: 260px; }
.login-tree { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; }
.login-tree__wood { opacity: 0; }
.login-tree[data-tree-pending] .login-tree__wood,.login-tree[data-leafing] .login-tree__wood { opacity: 1; }
.login-tree[data-tree-pending] #tree-foliage { opacity: 0; }
.login-nature-caption { margin-top: 12px; color: #f0f5e9; text-align: center; font-size: clamp(17px,1.5vw,26px); line-height: 1.4; }
.login-form-content { display: grid; grid-template-rows: 1fr auto; align-items: center; justify-items: center; gap: 24px; min-width: 0; padding: 40px var(--login-inset) 24px; background: var(--login-form-bg); }
.login-form-inner { width: 100%; max-width: 640px; min-width: 0; }
.login-card { padding: clamp(28px,2.4vw,44px); background: #fff; border: 1px solid #d0d7d1; border-radius: 12px; }
.login-card h1 { color: var(--login-heading); font-size: clamp(28px,2.5vw,44px); font-weight: 700; line-height: 1.2; letter-spacing: -.7px; text-wrap: balance; }
.login-lead { color: #303a33; font-size: clamp(16px,1.3vw,22px); line-height: 1.5; margin-top: 16px; }
.login-submit { display: flex; gap: 20px; margin-top: 20px; width: 100%; min-height: clamp(56px,4.3vw,72px); padding: 12px 24px; font-size: clamp(18px,1.5vw,26px); font-weight: 600; background: var(--login-accent); border-color: var(--login-accent); color: #fff; border-radius: 8px; }
.login-submit:hover { background: #1a5612; border-color: #1a5612; }
.login-submit>i { font-size: 1.25em; line-height: 1; flex: none; }
.login-submit>i:last-child { margin-left: auto; }
.login-workflow { margin-top: 24px; padding-bottom: 20px; border-bottom: 1px solid #dce3da; }
.login-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; list-style: none; margin: 0; padding: 0; }
.login-steps li { position: relative; display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.login-step-icon { display: flex; justify-content: center; align-items: center; height: 38px; font-size: clamp(28px,2.15vw,36px); line-height: 1; color: #175b1b; }
.login-step-arrow { position: absolute; right: -17px; top: 10px; width: 18px; font-size: 18px; line-height: 1; color: #98bc8a; }
.login-steps h3 { margin-top: 8px; color: var(--login-heading); font-size: clamp(15px,1.05vw,17px); font-weight: 600; line-height: 1.3; }
.login-steps p { margin-top: 4px; color: #303a33; font-size: 13px; line-height: 1.45; }
.login-help-links { display: flex; align-items: center; justify-content: center; align-self: end; gap: 24px; margin: 0; }
.login-help-link { min-height: 40px; padding: 4px 0; background: transparent; border: 0; color: #215b1e; font-size: clamp(15px,1.2vw,21px); text-decoration: underline; text-underline-offset: 4px; }
.login-help-link:hover { color: #123e11; }
.login-help-divider { width: 1px; height: 20px; background: #6c9161; flex: none; }
.login-info-dialog .dialog-body { font-size: 14px; line-height: 1.65; }
.login-info-dialog ol { margin: 20px 0 0; padding-left: 24px; }
.login-info-dialog li+li { margin-top: 12px; }
.login-info-dialog h3 { font-size: 14px; margin-bottom: 8px; }
.login-info-dialog p+h3 { margin-top: 24px; }
.login-support-note { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--secondary); }
.login-account { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.login-account strong,.login-account small { display: block; }
.login-account small { color: var(--muted); margin-top: 4px; }
.login-account-organization { font-size: 13px; color: var(--secondary); }
@media (min-width: 1001px) {
  body[data-screen="detail"] { height: 100dvh; overflow: hidden; }
  body[data-screen="detail"] #detail-view { flex: 1; }
  body[data-screen="detail"] .detail-workspace { flex: 1; height: auto; min-height: 0; }
}
@media (max-width: 1280px) {
  .page-width { padding-inline: 24px; }
  .masthead { gap: 20px; }
  .product-name { font-size: 13px; padding-left: 20px; }
  .header-actions { gap: 8px; }
}
@media (max-width: 1100px) {
  .brand-name>strong { font-size: 16px; }
  .detail-workspace { grid-template-columns: minmax(0,1fr) 320px; }
  .profile-layout { grid-template-columns: 300px minmax(0,1fr); }
}
@media (max-width: 1000px) {
  .detail-workspace { grid-template-columns: minmax(0,1fr); height: auto; }
  .pdf-panel { height: 65dvh; min-height: 380px; }
  .document-context { overflow: visible; }
  .context-scroll { overflow: visible; }
  .context-actions { position: sticky; bottom: 0; z-index: 5; border-radius: 0 0 8px 8px; box-shadow: 0 -4px 12px #292c3008; }
  #sequence-panel { display: block; }
  .profile-layout { grid-template-columns: 280px minmax(0,1fr); gap: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .product-name { display: none; }
  .login-page { --login-inset: 24px; }
  .login-overview { padding: 32px; }
  .login-form-content { padding: 32px 24px 24px; }
  .login-card { padding: 24px; }
  .login-card h1 { font-size: 28px; }
  .login-steps { gap: 16px; }
  .login-step-icon { height: 34px; font-size: 30px; }
  .login-step-arrow { top: 8px; }
  .login-brand .brand-name>strong { font-size: 18px; }
}
@media (max-width: 760px) {
  body:not(.login-page) { --sidebar-width: 250px; }
  body.sidebar-collapsed { --sidebar-width: 56px; }
  body:not(.login-page) .site-header { width: calc(100% - 56px); margin-left: 56px; }
  body:not(.login-page) .masthead { padding-inline: 12px; }
  .sidebar-collapsed .brand-identity img { width: 36px; height: 40px; }
  body:not(.login-page) .main-content { width: calc(100% - 56px); margin-left: 56px; }
  .sidebar { box-shadow: 8px 0 24px #292c3010; }
  .sidebar-collapsed .sidebar-content { padding-inline: 6px; }
  .sidebar-collapsed .nav-link { padding: 12px 8px; }
  body.menu-open { overflow: hidden; }

  :root { --header-height: 80px; }
  .page-width { padding-inline: 16px; }
  .masthead { min-height: 76px; gap: 8px; }
  .header-breadcrumb ol,.header-breadcrumb li { gap: 7px; }
  .header-breadcrumb .breadcrumb-home>span { display: none; }
  .header-breadcrumb li:not(:first-child):not(:last-child) { display: none; }
  .brand img { width: 36px; height: 40px; }
  .brand { gap: 8px; }
  .brand-name>span { font-size: 11px; }
  .brand-name>strong { font-size: 13px; }
  .account-link { padding: 4px; }
  .account-link>span:not(.avatar),.account-link>i { display: none; }
  .header-actions { gap: 0; }
  .header-actions .notification-shortcut { display: none; }
  .header-actions .icon-button { width: 32px; }
  .avatar { width: 32px; height: 32px; font-size: 11px; }
  .avatar--large { width: 44px; height: 44px; font-size: 14px; }
  .main-content { padding-top: 20px; }
  h1 { font-size: 20px; }
  .heading-line { align-items: flex-start; flex-direction: column; gap: 4px; }
  .count-label { font-size: 12px; }
  .page-heading { margin-bottom: 16px; }
  .page-heading .btn { font-size: 12px; padding: 0 12px; }
  .cabinet-grid .dx-datagrid-rowsview .dx-row>td { padding: 12px 8px; font-size: 13px; }
  .cabinet-grid .dx-datagrid-headers .dx-header-row>td { padding: 12px 8px; font-size: 12px; }
  .cabinet-grid .dx-datagrid-pager { padding: 8px; }
  .cabinet-grid .dx-pager .dx-info { margin-inline: 4px; }
  .grid-number { font-size: 12px; }
  .grid-subject { display: none; }
  .grid-open { min-height: 32px; }
  .grid-open span { display: none; }
  .grid-title { font-size: 13px; }
  .detail-heading { flex-wrap: wrap; }
  .detail-heading h1 { font-size: 18px; }
  .detail-heading p { font-size: 12px; }
  .detail-heading>.status-badge { margin-left: 52px; margin-top: -4px; }
  .detail-workspace { gap: 12px; }
  .pdf-panel { min-height: 340px; height: 58dvh; }
  .pdf-toolbar { flex-wrap: wrap; gap: 4px; padding: 8px; }
  .pdf-toolbar>strong { padding-left: 4px; font-size: 12px; }
  .pdf-tools { margin-left: auto; }
  .pdf-stage { padding: 12px; }
  .profile-layout { grid-template-columns: 1fr; }
  .profile-identity { padding: 20px; }
  .panel-heading { padding: 20px 20px 0; }
  .panel-body { padding: 16px 20px 20px; }
  .panel-footer { padding: 16px 20px; }
  .notification-item { padding: 12px; gap: 8px; flex-wrap: wrap; }
  .notification-date { padding: 8px 16px; }
  .notification-icon { width: 24px; }
  .notification-content { flex-basis: calc(100% - 64px); }
  .notification-item time { padding-left: 32px; font-size: 11px; }
  .notification-content strong { font-size: 13px; }
  .notification-description { font-size: 12px; }
  .notification-chevron { margin-left: auto; }
  .notification-unread { position: absolute; right: 12px; top: 20px; }
  .toast-region { left: 16px; right: 16px; bottom: 16px; }
  .toast { max-width: none; padding: 12px 16px; }
  .dialog-header,.dialog-body,.dialog-footer { padding: 16px 20px; }
  .login-main { grid-template-columns: 1fr; }
  .login-page { --login-inset: 24px; }
  .login-overview { padding: 24px; min-height: 0; }
  .login-brand .brand { gap: 12px; }
  .login-brand .brand img { width: 48px; height: 52px; }
  .login-brand .brand-name { padding-left: 12px; }
  .login-brand .brand-name>span { font-size: 13px; }
  .login-brand .brand-name>strong { font-size: 16px; }
  .login-nature { flex: none; min-height: 0; margin: 16px -12px 0; }
  .login-tree-scene { flex: none; height: 200px; min-height: 0; }
  .login-nature-caption { font-size: 16px; }
  .login-form-content { padding: 24px 20px; }
  .login-card h1 { font-size: 26px; }
  .login-lead { margin-top: 12px; font-size: 14px; }
  .login-submit { gap: 12px; padding-inline: 16px; font-size: 18px; }
  .login-workflow { margin-top: 20px; padding-bottom: 18px; }
  .login-steps { gap: 12px; }
  .login-step-icon { font-size: 28px; height: 32px; }
  .login-step-arrow { top: 8px; right: -14px; width: 16px; font-size: 16px; }
  .login-steps h3 { font-size: 15px; }
  .login-steps p { font-size: 12px; }
  .login-help-links { gap: 20px; }
  .login-help-link { font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .login-tree[data-tree-pending] .login-tree__wood { opacity: 0; }
  .login-tree[data-tree-pending] #tree-foliage { opacity: 1; }
  *,*:before,*:after { transition: none !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

