/* Layout stays in the applications; semantic component states are shared. */
.esg-app { background: var(--esg-canvas); color: var(--esg-text); color-scheme: light; font-family: InterVariable, Inter, system-ui, sans-serif; }
.esg-app.dark { color-scheme: dark; }
.esg-nav { background: var(--esg-nav-bg); color: var(--esg-nav-text); border-right: 1px solid var(--esg-nav-border); box-shadow: 3px 0 12px #0001; }
.dark .esg-nav { border-right-width: 2px; }
.esg-nav-item { color: var(--esg-nav-text); }
.esg-nav-item:hover, .esg-nav-open { background: var(--esg-nav-hover); color: var(--esg-nav-title); }
.esg-nav-active { background: var(--esg-nav-active); color: var(--esg-on-nav-active); box-shadow: inset 3px 0 var(--esg-nav-marker); }
.esg-nav-active svg { color: inherit; }
.esg-table { color: var(--esg-text); }
.esg-table thead { background: var(--esg-table-head); color: var(--esg-text); }
.esg-row { background: var(--esg-table-row); }
.esg-row-alt { background: var(--esg-table-alt); }
.esg-row:hover, .esg-row-alt:hover { background: var(--esg-table-hover); }
.esg-row-selected, .esg-row-selected:hover { background: var(--esg-table-selected); }
.esg-app :where(input:not([type=checkbox]):not([type=radio]), textarea, select):not(.auth-input input) {
    background-color: var(--esg-input); color: var(--esg-input-text); border-color: var(--esg-input-border);
    min-height: 48px; padding-inline: 16px;
}
.esg-app :where(input, textarea)::placeholder { color: var(--esg-placeholder); opacity: 1; }
.esg-app :where(input, textarea, select):hover:not(:disabled) { border-color: var(--esg-input-hover); }
.esg-app :where(input, textarea, select, button, a, [tabindex]):focus-visible { outline: 2px solid var(--esg-focus); outline-offset: 2px; }
.esg-app :where(input[type=checkbox], input[type=radio]) { accent-color: var(--esg-primary); }
.esg-app :where(label) { color: var(--esg-label); }
.esg-app :where(button.bg-esg-surface, button.bg-esg-surface-raised) { background: var(--esg-quiet-bg); color: var(--esg-quiet-text); border: 1px solid var(--esg-quiet-border); min-height: 48px; }
.esg-app :where(button.bg-esg-surface, button.bg-esg-surface-raised):hover:not(:disabled) { background: var(--esg-quiet-hover); }
.esg-app :where(button.border-esg-border:not(.bg-esg-primary):not(.text-esg-danger)) { background: var(--esg-quiet-bg); color: var(--esg-quiet-text); border-color: var(--esg-quiet-border); min-height: 48px; }
.esg-app :where(button.border-esg-border:not(.bg-esg-primary):not(.text-esg-danger)):hover:not(:disabled) { background: var(--esg-quiet-hover); }
.esg-app :where(button.bg-esg-primary, a.bg-esg-primary) { min-height: 48px; background: var(--esg-primary); color: var(--esg-on-primary); }
.esg-app :where(button.bg-esg-primary, a.bg-esg-primary):hover:not(:disabled) { background: var(--esg-primary-hover); }
.esg-app :where(button.bg-esg-primary, a.bg-esg-primary):active:not(:disabled) { background: var(--esg-primary-active); }
.esg-app :where(button.bg-esg-danger-bg) { color: var(--esg-danger); border: 1px solid var(--esg-danger); }
.esg-app :where(button.bg-esg-success-bg) { color: var(--esg-success); }
.esg-app :where(button.bg-esg-warning-bg) { color: var(--esg-warning); }
.esg-app :where(button, input, select, textarea):disabled, .esg-app fieldset:disabled :where(button, input, select, textarea) {
    background: var(--esg-disabled-surface); color: var(--esg-disabled-text); border-color: var(--esg-border); opacity: 1; cursor: not-allowed;
}
.esg-app .validation-message { color: var(--esg-danger); }
.esg-app .invalid { border-color: var(--esg-danger); outline-color: var(--esg-danger); }
.esg-app .invalid:focus-visible { outline-color: var(--esg-focus); }
.esg-app .valid.modified:not([type=checkbox]):not(:focus-visible) { outline: none; }
.esg-app .loading-progress circle:last-child { stroke: var(--esg-primary); }
@media (pointer: coarse) {
    .esg-app :where(button, a[onclick]) { min-height: 44px; }
    .esg-table :where(td, th):has(input[type=checkbox]) { min-width: 44px; height: 44px; }
}

/* Native dialogs share the browser top layer, including dialogs opened from drawers. */
.esg-dialog { position: fixed; inset: 0; margin: auto; padding: 0; border: 1px solid var(--esg-popup-border); border-radius: 8px; color: var(--esg-text); background: var(--esg-popup-body); width: min(var(--esg-dialog-width, 32rem), calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); max-width: calc(100vw - 2rem); box-shadow: 0 24px 64px var(--esg-overlay); overflow: hidden; }
.esg-dialog-small { --esg-dialog-width: 24rem; }
.esg-dialog-medium { --esg-dialog-width: 32rem; }
.esg-dialog-large { --esg-dialog-width: 42rem; }
.esg-dialog-extra { --esg-dialog-width: 56rem; }
.esg-dialog-full { --esg-dialog-width: 100vw; }
.esg-dialog::backdrop { background: transparent; }
.esg-dialog[data-active=true]::backdrop { background: var(--esg-overlay); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.esg-dialog-layout { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 2rem); }
.esg-dialog-header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; background: var(--esg-popup-header); color: var(--esg-popup-title); }
.esg-dialog-header h2 { font-size: 1.125rem; font-weight: 600; }
.esg-dialog-header button { width: 44px; height: 44px; flex: none; color: inherit; }
.esg-dialog[data-active=false] .esg-dialog-header { background: var(--esg-surface-raised); color: var(--esg-text-muted); }
.esg-dialog-content { flex: 1; min-height: 0; overflow: auto; padding: 1.5rem; overscroll-behavior: contain; }
.esg-dialog-footer { flex: none; padding: 1rem 1.5rem; border-top: 1px solid var(--esg-divider); background: var(--esg-popup-body); }
.esg-dialog-fixed .esg-dialog-layout { height: min(70dvh, 900px); }
.esg-dialog-drawer { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; max-width: 100vw; border-radius: 0; }
.esg-dialog-drawer .esg-dialog-layout { height: 100dvh; max-height: 100dvh; }
@media (max-width: 640px) {
    .esg-dialog { max-width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
    .esg-dialog-layout { max-height: calc(100dvh - 1rem); }
    .esg-dialog-content { padding: 1rem; }
    .esg-dialog-drawer { width: 100vw; max-width: 100vw; max-height: 100dvh; }
}

/* Approved photographic auth/error scenes retain their independent dark composition. */
.auth-panel { font-family: InterVariable, Inter, system-ui, sans-serif; color: var(--esg-text); }
.auth-panel .auth-heading p, .auth-panel .auth-password-help { color: var(--esg-text-muted); }
.auth-panel .auth-leading, .auth-panel .auth-toggle { color: var(--esg-icon); }
.auth-panel .auth-toggle:hover { color: var(--esg-text); }
.auth-panel .auth-input input::placeholder { color: var(--esg-placeholder); }
.auth-panel .auth-message { color: var(--esg-info); background: var(--esg-info-bg); border-color: var(--esg-info); }
.auth-panel .auth-submit { background: var(--esg-primary); color: var(--esg-on-primary); min-height: 48px; }
.auth-panel .auth-submit:hover:not(:disabled) { background: var(--esg-primary-hover); }
.auth-panel .auth-submit:active:not(:disabled) { background: var(--esg-primary-active); }
.auth-panel .auth-submit:disabled { background: var(--esg-disabled-surface); color: var(--esg-disabled-text); }
.auth-panel .auth-input { background: var(--esg-input); border-color: var(--esg-input-border); }
.auth-panel .auth-input input { color: var(--esg-input-text); }
.auth-panel .auth-input:focus-within { outline: 2px solid var(--esg-focus); outline-offset: 2px; box-shadow: none; }
.auth-panel .auth-link { color: var(--esg-link); }
.auth-panel .auth-link:hover { color: var(--esg-link-hover); }
.auth-panel .auth-error { color: var(--esg-danger); background: var(--esg-danger-bg); border-color: var(--esg-danger); }

.esg-app :where(button.border-esg-danger, button.bg-esg-danger-bg) { min-height: 48px; }

/* Shared dense business lists. Colours always follow the common theme. */
.esg-list-page { min-width:0; color:var(--esg-text); }
.esg-page-heading { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.25rem; flex-wrap:wrap; }
.esg-page-heading h1 { font-size:1.65rem; font-weight:700; margin:0; }
.esg-page-heading p { color:var(--esg-text-muted); margin-top:.25rem; }
.esg-list-surface { background:var(--esg-surface); border:1px solid var(--esg-border); border-radius:.65rem; overflow:hidden; min-width:0; }
.esg-list-page button, .esg-filter-box button { cursor:pointer; }
.esg-list-page button:disabled, .esg-filter-box button:disabled { cursor:default; opacity:.5; }
.esg-list-page button:focus-visible, .esg-filter-box button:focus-visible, .esg-table-scroll:focus-visible { outline:2px solid var(--esg-focus); outline-offset:2px; }
.esg-primary-button { background:var(--esg-primary); color:var(--esg-on-primary); border:1px solid var(--esg-primary); border-radius:.35rem; padding:.55rem 1rem; display:inline-flex; gap:.5rem; align-items:center; }
.esg-primary-button:hover { background:var(--esg-primary-hover); }
.esg-list-views { display:flex; gap:1.25rem; padding:0 1rem; border-bottom:1px solid var(--esg-divider); overflow-x:auto; }
.esg-list-views button { white-space:nowrap; padding:.8rem 0; border-bottom:3px solid transparent; color:var(--esg-text-muted); }
.esg-list-views button[aria-pressed=true] { color:var(--esg-link); border-bottom-color:var(--esg-primary); }
.esg-list-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:.65rem; padding:.8rem 1rem; }
.esg-list-toolbar button, .esg-list-toolbar select { padding:.4rem .7rem; border:1px solid var(--esg-border); border-radius:.35rem; background:var(--esg-surface); }
.esg-list-toolbar .esg-search { flex:1; min-width:10rem; width:100%; padding:.55rem .75rem; border:1px solid var(--esg-input-border); border-radius:.35rem; background:var(--esg-input); color:var(--esg-text); }
.esg-list-surface .esg-filter-box { border:0; border-radius:0; box-shadow:none; }
.esg-filter-panel { border-top:1px solid var(--esg-divider); padding:1rem; }
.esg-filter-panel[hidden] { display:none; }
.esg-filter-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:1rem; }
.esg-filter-grid label { display:flex; flex-direction:column; gap:.35rem; font-size:.85rem; color:var(--esg-text-muted); }
.esg-filter-grid input, .esg-filter-grid select, .esg-filter-grid textarea { width:100%; min-width:0; padding:.5rem; background:var(--esg-input); color:var(--esg-text); border:1px solid var(--esg-input-border); border-radius:.35rem; }
.esg-filter-actions { display:flex; justify-content:flex-end; margin-top:1rem; }
.esg-filter-chips { display:flex; flex-wrap:wrap; gap:.5rem; padding:0 1rem .8rem; }
.esg-filter-chips button { padding:.25rem .5rem; border-radius:.25rem; background:var(--esg-info-bg); color:var(--esg-link); font-size:.8rem; }
.esg-result-bar { border-top:1px solid var(--esg-divider); color:var(--esg-text-muted); font-size:.85rem; }
.esg-result-bar > :first-child { margin-right:auto; }
.esg-selection-bar { background:var(--esg-table-selected); color:var(--esg-text); }
.esg-table-scroll { overflow:auto; max-width:100%; }
.esg-list-page .esg-table { width:100%; font-size:.85rem; }
.esg-list-page .esg-table th { text-align:left; font-weight:500; white-space:nowrap; background:var(--esg-table-head); color:var(--esg-text-muted); }
.esg-list-page .esg-table td, .esg-list-page .esg-table th { padding:.65rem .8rem; border-bottom:1px solid var(--esg-divider); }
.esg-list-page .esg-table td { width:1%; }
.esg-list-page .esg-table .esg-fill-cell { width:auto; padding:0; }
.esg-list-page .esg-table .esg-check-cell { width:2rem; }
.esg-table input[type=checkbox] { accent-color:var(--esg-primary); width:1rem; height:1rem; cursor:pointer; }
.esg-cell-nowrap { white-space:nowrap; }
.esg-cell-title { min-width:15rem; max-width:27rem; }
.esg-cell-areas { min-width:20rem; max-width:52rem; }
.esg-cell-sub { display:block; color:var(--esg-text-muted); font-size:.78rem; margin-top:.2rem; }
.esg-text-link { color:var(--esg-link); text-align:left; }
.esg-text-link:hover { text-decoration:underline; }
.esg-status { display:inline-block; padding:.15rem .4rem; border-radius:.25rem; background:var(--esg-info-bg); color:var(--esg-link); font-size:.78rem; white-space:nowrap; }
.esg-status-success { background:var(--esg-success-bg); color:var(--esg-success); }
.esg-status-warning { background:var(--esg-warning-bg); color:var(--esg-warning); }
.esg-status-danger { background:var(--esg-danger-bg); color:var(--esg-danger); }
.esg-tree-name { display:flex; gap:.4rem; align-items:center; min-width:12rem; }
.esg-tree-toggle { display:inline-flex; width:1.5rem; height:1.5rem; align-items:center; justify-content:center; flex-shrink:0; }
.esg-list-message { padding:2rem 1rem; text-align:center; color:var(--esg-text-muted); }
.esg-list-message[role=alert] { color:var(--esg-danger); }
.esg-list-cards { display:none; }
.esg-task-summary { display:flex; gap:.4rem; flex-wrap:wrap; margin-top:.2rem; }
@media(max-width:640px) {
 .esg-has-cards { display:none; }
 .esg-list-cards { display:grid; gap:.75rem; padding:1rem; }
 .esg-list-cards article { border:1px solid var(--esg-border); border-radius:.5rem; padding:1rem; }
 .esg-list-toolbar .esg-search { flex-basis:100%; }
 .esg-filter-grid { grid-template-columns:1fr; }
 .esg-list-page .esg-table td, .esg-list-page .esg-table th { padding:.5rem; }
}
@media(pointer:coarse) {
 .esg-list-page button, .esg-filter-box button { min-height:44px; }
 .esg-filter-box input, .esg-filter-box select { min-height:44px; font-size:16px; }
}

.esg-task-result { font-size:.78rem; white-space:nowrap; }

/* Document workspace: the table owns both scroll axes; controls remain visible. */
.esg-document-list { height:100%; min-height:0; display:flex; flex-direction:column; }
.esg-document-list > .esg-page-heading { flex:none; }
.esg-document-list > .esg-list-surface { flex:1; min-height:0; display:flex; flex-direction:column; }
.esg-document-list > .esg-list-surface > * { flex-shrink:0; min-width:0; }
.esg-document-list > .esg-list-surface > .esg-table-scroll,
.esg-document-list > .esg-list-surface > .esg-list-cards { flex:1 1 0; min-height:0; overflow:auto; overscroll-behavior:contain; }
.esg-document-list .esg-table { min-width:80rem; }
.esg-document-list .esg-table thead { z-index:1; }
.esg-document-list .esg-filter-box { max-height:45%; overflow:auto; }
.esg-document-list .esg-text-link { color:inherit; }
.esg-filing-icon { display:inline-block; width:1.15rem; height:1.15rem; flex:none; vertical-align:middle; }
.esg-document-list .esg-status,
.esg-document-list .esg-task-result,
.esg-document-list .esg-text-link:has(.esg-filing-icon) { display:inline-flex; align-items:center; gap:.3rem; }
.esg-document-list .esg-text-link > .esg-filing-icon { color:var(--esg-icon); }

/* Compact list controls, without changing unrelated application forms. */
.esg-table-pager > div { padding:.4rem .85rem; }
.esg-table-pager .esg-page-size { display:inline-flex; align-items:center; gap:.45rem; white-space:nowrap; font-size:.78rem; color:var(--esg-text-muted); }
.esg-app .esg-table-pager select { min-height:30px; height:30px; min-width:3.8rem; padding:0 .4rem; font-size:.78rem; }
.esg-table-pager button, .esg-table-pager nav > span { min-height:30px; height:30px; padding:.25rem .6rem; font-size:.78rem; }
.esg-table-pager p { font-size:.78rem; }
.esg-table-pager svg { width:1rem; height:1rem; }
.esg-table-pager .sm\:flex-1 { flex-wrap:wrap; gap:.4rem; }
.esg-filter-box .esg-list-toolbar { padding:.5rem .85rem; gap:.5rem; }
.esg-app .esg-filter-box .esg-search, .esg-filter-box .esg-filter-grid input,
.esg-filter-box .esg-filter-grid select { min-height:32px; height:32px; padding:.25rem .5rem; font-size:.8rem; }
.esg-filter-box .esg-filter-grid { gap:.6rem .8rem; }
.esg-filter-box .esg-filter-grid label { gap:.2rem; font-size:.78rem; }
.esg-filter-box .esg-filter-panel { padding:.65rem .85rem; }
.esg-filter-box .esg-list-toolbar button, .esg-filter-box .esg-filter-actions button { min-height:32px; padding:.25rem .65rem; font-size:.8rem; }
.esg-filter-box .esg-filter-actions { margin-top:.6rem; }
.esg-filter-chips .esg-filter-clear { background:var(--esg-danger-bg); color:var(--esg-danger); }
.esg-document-list .esg-cell-company { min-width:22.5rem; max-width:40.5rem; }

.esg-filing-dialog { --esg-dialog-width:82rem; }
.esg-filing-dialog .esg-dialog-header { padding:.7rem 1.3rem; background:var(--esg-surface); color:var(--esg-text-muted); border-bottom:1px solid var(--esg-divider); }
.esg-filing-dialog .esg-dialog-header h2 { font-size:.85rem; font-weight:400; }
.esg-filing-dialog .esg-dialog-content { padding:0; }
.esg-filing-dialog-heading { padding:1.7rem 2rem; }
.esg-filing-dialog-heading h2 { font-size:1.4rem; font-weight:600; }
.esg-filing-dialog-heading p { margin-top:.4rem; color:var(--esg-text-muted); font-size:.85rem; }
.esg-filing-dialog .esg-table td { width:auto; padding:1rem .85rem; }
.esg-filing-dialog .esg-table th { padding:1rem .85rem; }
.esg-filing-dialog .esg-dialog-footer { text-align:right; }
.esg-filing-dialog .esg-dialog-footer button { border:1px solid var(--esg-border); border-radius:.4rem; padding:.55rem .9rem; }
.esg-task-outcome { display:inline-flex; align-items:center; gap:.3rem; white-space:nowrap; }
.esg-file-preview-button { width:2rem; height:2rem; }
.esg-file-preview-button svg { width:1.25rem; height:1.25rem; }
.esg-file-preview-image { display:block; max-width:100%; max-height:70dvh; margin:auto; object-fit:contain; }
.esg-file-preview-pdf { width:100%; height:70dvh; }
