/* Copied from NeoDocs (products/neodocs/src/NeoDocs.WebServer/wwwroot/css/site.css) by decision of
   2026-10-08: the same tokens (diretrizes-ux-ui-multiplataforma §1.3), light and dark themes, with
   the NeoField360 accent. The duplication is item 13 of products/neofield360/specs/TODO.md. */
:root {
    color-scheme: light;
    --brand: #24543a;
    --brand-contrast: #ffffff;
    --brand-text: #24543a;
    --brand-accent: #b08d4f;
    --surface: #f5f6f8;
    --card: #ffffff;
    --text: #22272e;
    --muted: #5d6672;
    --border: #cbd2dc;
    --danger: #b3261e;
    --warning-bg: #fdf3d7;
    --warning-border: #e0c36b;
    --overdue-bg: #fbe1df;
    --overdue-border: #c94b3f;
    --topbar-link: #d8e0ec;
    --diff-added: #2e7d32;
    --diff-removed: #c62828;
    --diff-added-bg: rgb(46 125 50 / 12%);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --radius: 8px;
    --shadow: 0 1px 3px rgb(0 0 0 / 12%);
    --sidebar-active-bg: rgb(36 84 58 / 8%);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --brand: #173726;
    --brand-text: #9fd8b5;
    --surface: #14171c;
    --card: #1e232b;
    --text: #e6e9ee;
    --muted: #9aa4b1;
    --border: #3a424e;
    --danger: #ff8a80;
    --warning-bg: #3a3320;
    --warning-border: #8a7433;
    --overdue-bg: #3d1f1c;
    --overdue-border: #e08277;
    --topbar-link: #c3cede;
    --diff-added: #6dbb70;
    --diff-removed: #ff8a80;
    --diff-added-bg: rgb(109 187 112 / 18%);
    --shadow: 0 1px 3px rgb(0 0 0 / 40%);
    --sidebar-active-bg: rgb(159 216 181 / 14%);
}

* {
    box-sizing: border-box;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: var(--space-4) 0;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, sans-serif;
    background: var(--surface);
    color: var(--text);
}

.topbar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    justify-content: space-between;
    background: var(--brand);
    color: var(--brand-contrast);
    padding: var(--space-2) var(--space-5);
}

.brand {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.topbar-user {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: var(--space-3);
    font-size: 0.9rem;
}

.inline-form {
    display: inline;
}

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    background: none;
    border: 1px solid rgb(255 255 255 / 35%);
    color: var(--topbar-link);
    border-radius: 999px;
    padding: 6px var(--space-3);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    min-height: 32px;
}

.brand {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    min-height: 32px;
}

label:has(> input[type="checkbox"]) {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 32px;
}

.theme-toggle:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.link-button {
    background: none;
    border: none;
    color: var(--brand-text);
    cursor: pointer;
    text-decoration: underline;
    font: inherit;
    padding: var(--space-2) var(--space-3);
    min-height: 32px;
}

.topbar .link-button {
    color: var(--topbar-link);
}

.content {
    margin: var(--space-6) 0;
    padding: 0 var(--space-4);
}

.content p,
.content form:not(.inline-form):not(.inline-form-group):not(:has(table)) {
    max-width: 40rem;
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5) var(--space-6);
}

.login-card {
    max-width: 24rem;
    margin: var(--space-6) auto;
}

.card h1 {
    margin-top: 0;
    color: var(--brand);
}

:root[data-theme="dark"] .card h1 {
    color: var(--text);
}

.standalone-viewport {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 4rem);
}

.standalone-card {
    width: 100%;
    max-width: 26rem;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: var(--space-5) var(--space-6);
}

.standalone-card h1 {
    margin-top: 0;
    color: var(--brand);
}

:root[data-theme="dark"] .standalone-card h1 {
    color: var(--text);
}

.muted {
    color: var(--muted);
}

.facts {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-1) var(--space-4);
}

.facts dt {
    color: var(--muted);
}

.facts dd {
    margin: 0;
}

.facts-box {
    background: var(--surface);
    padding: var(--space-4);
    border-radius: var(--radius);
}

form label {
    display: block;
    margin: var(--space-4) 0 var(--space-1);
    font-size: 0.9rem;
}

form input,
form select,
form textarea {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: 6px;
    font: inherit;
    background: var(--card);
    color: var(--text);
}

form textarea {
    resize: vertical;
    min-height: 6rem;
}

form input[type="checkbox"],
form input[type="radio"] {
    width: auto;
    padding: 0;
    border: none;
    accent-color: var(--brand);
}

form input[type="color"] {
    width: 6rem;
    min-height: 40px;
    padding: var(--space-1);
    cursor: pointer;
}

button.primary {
    margin-top: var(--space-5);
    width: 100%;
    padding: var(--space-3);
    background: var(--brand);
    color: var(--brand-contrast);
    border: none;
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    min-height: 40px;
}

button.secondary {
    padding: var(--space-2) var(--space-3);
    background: transparent;
    color: var(--brand-text);
    border: 1px solid var(--brand-text);
    border-radius: 6px;
    font: inherit;
    cursor: pointer;
    min-height: 32px;
}

button.primary:hover {
    filter: brightness(1.1);
}

button.primary:disabled {
    opacity: 0.7;
    cursor: progress;
}

.validation-summary {
    color: var(--danger);
    font-size: 0.9rem;
}

.validation-summary ul {
    margin: var(--space-2) 0;
    padding-left: 1.2rem;
}

.validation-summary-valid {
    display: none;
}

.field-error {
    display: block;
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: var(--space-1);
    min-height: 1em;
}

.banner {
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.banner.warning {
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
}

.banner.error {
    background: var(--overdue-bg);
    border: 1px solid var(--overdue-border);
}

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.page-header h1 {
    margin: 0;
    color: var(--brand);
}

:root[data-theme="dark"] .page-header h1 {
    color: var(--text);
}

.primary-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--brand);
    color: var(--brand-contrast);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    min-height: 32px;
    line-height: 1.5rem;
}

.primary-link:hover {
    filter: brightness(1.1);
}

.secondary-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    min-height: 32px;
    line-height: 1.5rem;
}

.secondary-link:hover {
    background: var(--surface);
}

.danger-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    color: var(--danger, #b3261e);
    border: 1px solid var(--danger, #b3261e);
    border-radius: 6px;
    font-weight: 600;
    min-height: 32px;
    line-height: 1.5rem;
    cursor: pointer;
}

.danger-link:hover {
    background: var(--danger, #b3261e);
    color: var(--brand-contrast);
}

.subtle-link {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: transparent;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    min-height: 32px;
    line-height: 1.5rem;
}

.subtle-link:hover,
.subtle-link:focus-visible {
    color: var(--brand-text);
    border-color: var(--brand-text);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
}

.data-table th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.data-table tbody tr:nth-child(even) {
    background: var(--surface);
}

.badge {
    display: inline-block;
    padding: 2px var(--space-2);
    border-radius: 999px;
    font-size: 0.8rem;
    background: var(--warning-bg);
    color: var(--text);
    border: 1px solid var(--warning-border);
}

.badge.muted {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
}

.badge.current {
    background: transparent;
    border-color: var(--diff-added);
    color: var(--diff-added);
}

.badge.danger {
    background: transparent;
    border-color: var(--danger);
    color: var(--danger);
}

.badge.extracted-content {
    background: transparent;
    border-color: var(--brand-text);
    color: var(--brand-text);
}

.permission-matrix {
    width: 100%;
    border-collapse: collapse;
}

.permission-matrix th,
.permission-matrix td {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    text-align: center;
}

.permission-matrix th:first-child,
.permission-matrix td:first-child {
    text-align: left;
}

.permission-matrix th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.permission-matrix tbody tr:nth-child(even) {
    background: var(--surface);
}

.section-title {
    margin-top: var(--space-6);
    margin-bottom: var(--space-3);
    color: var(--brand);
}

:root[data-theme="dark"] .section-title {
    color: var(--text);
}

.inline-form-group {
    display: flex;
    gap: var(--space-3);
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: var(--space-5);
}

.inline-form-group label {
    margin: 0 0 var(--space-1);
}

.inline-form-group button.primary {
    margin-top: 0;
    width: auto;
    padding: var(--space-2) var(--space-4);
}

.filter-form,
.mass-edit {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    margin-bottom: var(--space-4);
}

.filter-form-group {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    align-items: center;
    padding-right: var(--space-4);
    border-right: 1px solid var(--border);
}

.filter-form-group:last-of-type {
    padding-right: 0;
    border-right: none;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    max-width: 100%;
}

.filter-field > label {
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.filter-field > input,
.filter-field > select {
    width: auto;
    min-width: 10rem;
    max-width: 100%;
}

.mass-edit {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-3);
    margin-top: var(--space-4);
}

.badge.overdue {
    background: var(--overdue-bg);
    border: 1px solid var(--overdue-border);
    color: var(--text);
}

.stacked-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    max-width: 560px;
}

.plain-fieldset {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.stacked-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

@media (max-width: 640px) {
    .stacked-form-grid {
        grid-template-columns: 1fr;
    }
}

.field-group {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-4);
}

.field-group > legend {
    padding: 0 var(--space-2);
    font-weight: 600;
    color: var(--text);
}

.comment-list {
    list-style: none;
    padding-left: 0;
}

.comment-list > li {
    border-top: 1px solid var(--border);
    padding: var(--space-2) 0;
}

.pdf-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    align-items: center;
    overflow-x: auto;
}

.pdf-container.pin-mode .pdf-page {
    cursor: crosshair;
}

.pdf-page {
    position: relative;
    box-shadow: var(--shadow);
}

.issue-pin {
    position: absolute;
    transform: translate(-50%, -100%);
    font-size: 20px;
    text-decoration: none;
}

.dwg-container {
    position: relative;
    overflow-x: auto;
}

.dwg-container.pin-mode {
    cursor: crosshair;
}

.dwg-zoomable {
    background: #ffffff;
    height: 70vh;
    overflow: hidden;
    touch-action: none;
    cursor: grab;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.dwg-zoomable.dragging {
    cursor: grabbing;
}

.dwg-stage {
    position: relative;
    transform-origin: 0 0;
}

.dwg-stage svg {
    display: block;
}

.dwg-mono .dwg-stage svg {
    filter: brightness(0);
}

.dwg-zoomable:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.titleblock-area-selection {
    position: absolute;
    display: none;
    border: 2px dashed var(--brand-text);
    background: rgb(31 58 95 / 15%);
    pointer-events: none;
}

.dwg-container svg {
    max-width: 100%;
    height: auto;
}

.dwg-compare-container {
    position: relative;
    overflow-x: auto;
}

.dwg-compare-layer {
    display: block;
    max-width: 100%;
    height: auto;
    mix-blend-mode: multiply;
}

.dwg-compare-layer-a {
    filter: invert(13%) sepia(89%) saturate(4429%) hue-rotate(357deg) brightness(88%) contrast(96%);
}

.dwg-compare-layer-b {
    position: absolute;
    top: 0;
    left: 0;
    filter: invert(39%) sepia(66%) saturate(722%) hue-rotate(88deg) brightness(93%) contrast(88%);
}

.undo-toast {
    position: fixed;
    bottom: var(--space-5);
    right: var(--space-5);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--text);
    color: var(--card);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    box-shadow: var(--shadow);
    z-index: 1000;
}

.undo-toast .link-button {
    color: var(--topbar-link);
}

@keyframes viewer-skeleton-pulse {
    0%, 100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

.viewer-skeleton {
    position: absolute;
    inset: 0;
    min-height: 400px;
    background: var(--border);
    border-radius: var(--radius);
    animation: viewer-skeleton-pulse 1.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
    .viewer-skeleton {
        animation: none;
    }
}

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.pager a,
.pager-current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
    padding: var(--space-1) var(--space-2);
    border-radius: 6px;
    text-decoration: none;
}

.pager a {
    color: var(--brand);
    border: 1px solid var(--border);
}

.pager a:hover {
    background: var(--surface);
}

.pager-current {
    background: var(--brand);
    color: var(--brand-contrast);
    font-weight: 600;
}

:root[data-theme="dark"] .pager a {
    color: var(--text);
}

.sortable-header {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
    cursor: pointer;
}

.sortable-header:hover,
.sortable-header:focus-visible {
    color: var(--brand-text);
}

.sortable-header:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.sort-arrow {
    font-size: 0.7rem;
}

.data-table .column-filter-row th,
.data-table .column-filter-row td.column-filter {
    padding-top: 0;
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--border);
}

.column-filter input[type="text"],
.column-filter input[type="number"],
.column-filter select {
    width: 100%;
    font-size: 0.85rem;
    padding: var(--space-1) var(--space-2);
}

.column-filter select {
    min-width: 7.5rem;
}

.table-scroll {
    overflow-x: auto;
}

.move-buttons {
    display: inline-flex;
    gap: var(--space-1);
    margin: 0;
}

.move-buttons button {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0 var(--space-1);
    cursor: pointer;
    color: inherit;
    font: inherit;
}

.move-buttons button:disabled {
    opacity: 0.35;
    cursor: default;
}

.move-buttons button:not(:disabled):hover,
.move-buttons button:not(:disabled):focus-visible {
    color: var(--brand-text);
    border-color: var(--brand-text);
}

.catalog-sublist {
    list-style: none;
    margin: 0 0 var(--space-2);
    padding: 0;
}

.catalog-sublist li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.document-index-layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: var(--space-4);
    align-items: start;
}

@media (max-width: 900px) {
    .document-index-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}

.document-tree-panel {
    position: sticky;
    top: var(--space-4);
    max-height: calc(100vh - var(--space-6));
    overflow-y: auto;
}

.document-tree-nav ul[role="tree"],
.document-tree-nav ul[role="group"] {
    list-style: none;
    margin: 0;
    padding-left: var(--space-4);
}

.document-tree-nav ul[role="tree"] {
    padding-left: 0;
}

.tree-node-row {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) 0;
}

.tree-node[role="treeitem"]:focus {
    outline: none;
}

.tree-node[role="treeitem"]:focus > .tree-node-row {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
    border-radius: 4px;
}

.tree-toggle {
    background: none;
    border: none;
    padding: 0;
    width: 1.2em;
    cursor: pointer;
    color: var(--muted);
    font-size: 0.7rem;
}

.tree-toggle-spacer {
    display: inline-block;
    width: 1.2em;
}

.tree-node-label {
    text-decoration: none;
    color: var(--text);
}

.tree-node-label:hover,
.tree-node-label:focus-visible {
    color: var(--brand-text);
    text-decoration: underline;
}

.tree-node-root > .tree-node-row .tree-node-label {
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    cursor: default;
}

.tree-node-count {
    margin-left: auto;
    color: var(--muted);
    font-size: 0.8rem;
}

.scope-selector-form {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}

.scope-selector-form select {
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
    color: var(--text);
}

.portfolio-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.portfolio-kpi {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.portfolio-kpi-value {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--brand);
}

:root[data-theme="dark"] .portfolio-kpi-value {
    color: var(--text);
}

.portfolio-kpi-value.muted {
    font-size: 1rem;
    font-weight: 400;
    color: var(--muted);
}

.portfolio-kpi-label {
    color: var(--muted);
    font-size: 0.875rem;
}

.portfolio-storage-kpi.portfolio-storage-warning {
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.portfolio-storage-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--surface);
    overflow: hidden;
    margin-top: var(--space-1);
}

.portfolio-storage-bar-fill {
    height: 100%;
    background: var(--brand);
}

.portfolio-storage-warning .portfolio-storage-bar-fill {
    background: var(--warning-border);
}

.project-storage-cell {
    min-width: 120px;
}

.project-storage-cell .portfolio-storage-bar {
    margin-top: 0;
    margin-bottom: 3px;
}

.project-storage-cell-label {
    font-size: 0.75rem;
    color: var(--muted);
}

.portfolio-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-5);
}

.donut-chart-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.donut-chart {
    width: 140px;
    height: 140px;
    border-radius: 50%;
}

.donut-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    font-size: 0.875rem;
}

.donut-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.donut-legend a {
    color: var(--text);
    text-decoration: none;
}

.donut-legend a:hover,
.donut-legend a:focus-visible {
    color: var(--brand-text);
    text-decoration: underline;
}

.donut-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dashboard-section {
    margin-bottom: var(--space-6);
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    width: 100%;
    padding: var(--space-2) 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
    cursor: pointer;
    font: inherit;
    text-align: left;
    color: var(--text);
    min-height: 32px;
}

.dashboard-section-header:hover {
    color: var(--brand-text);
}

.dashboard-section-header:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.dashboard-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: inherit;
}

.dashboard-section-chevron {
    display: inline-block;
    transition: transform 0.15s ease;
}

.dashboard-section-header[aria-expanded="false"] .dashboard-section-chevron {
    transform: rotate(-90deg);
}

.dashboard-section-header[aria-expanded="false"] + .dashboard-section-body {
    display: none;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.kpi-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-left: 4px solid var(--kpi-accent, var(--border));
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    min-height: 32px;
}

.kpi-card:hover,
.kpi-card:focus-visible {
    background: var(--surface);
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.kpi-card-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.kpi-card-label {
    color: var(--muted);
    font-size: 0.85rem;
}

.funnel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-2);
    align-items: stretch;
    margin-bottom: var(--space-4);
}

.funnel-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    padding: var(--space-4) var(--space-2);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    text-align: center;
    min-height: 32px;
    position: relative;
}

.funnel-step:hover,
.funnel-step:focus-visible {
    border-color: var(--brand-text);
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.funnel-step:not(:last-child)::after {
    content: "\2192";
    position: absolute;
    right: calc(-1 * var(--space-2) - 4px);
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.funnel-step-value {
    font-size: 1.4rem;
    font-weight: 600;
}

.funnel-step-label {
    color: var(--muted);
    font-size: 0.8rem;
}

.discipline-issue-chart {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.discipline-issue-chart-legend {
    display: flex;
    gap: var(--space-4);
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: var(--space-1);
}

.discipline-issue-chart-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.discipline-issue-chart-legend-swatch {
    display: inline-block;
    width: 11px;
    height: 11px;
    border-radius: 3px;
}

.discipline-issue-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 90px;
    align-items: center;
    gap: var(--space-3);
}

.discipline-issue-bar-name {
    font-size: 0.88rem;
}

.discipline-issue-bar-track {
    display: flex;
    height: 24px;
    border-radius: 4px;
    overflow: hidden;
    background: var(--surface);
}

.discipline-issue-bar-segment-open {
    background: var(--warning-border);
}

.discipline-issue-bar-segment-inprogress {
    background: var(--brand-text);
}

.discipline-issue-bar-segment-done {
    background: var(--diff-added);
}

.discipline-issue-bar-track a {
    display: block;
}

.discipline-issue-bar-track a:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: -2px;
}

.discipline-issue-bar-counts {
    font-size: 0.78rem;
    color: var(--muted);
    text-align: right;
    white-space: nowrap;
}

.activity-feed {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-feed li {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
}

.activity-feed li:last-child {
    border-bottom: none;
}

.activity-feed-text {
    flex: 1;
}

.activity-feed-time {
    color: var(--muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.breadcrumb {
    margin-bottom: var(--space-3);
    font-size: 0.85rem;
    color: var(--muted);
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1);
    list-style: none;
    margin: 0;
    padding: 0;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.breadcrumb-item:not(:last-child)::after {
    content: "/";
    color: var(--border);
    margin-left: var(--space-1);
}

.breadcrumb-item a {
    color: var(--brand-text);
    text-decoration: underline;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus-visible {
    color: var(--muted);
}

.breadcrumb-item span[aria-current="page"] {
    color: var(--text);
    font-weight: 600;
}

.breadcrumb-item-ellipsis {
    display: none;
}

.breadcrumb-expand {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    padding: 0 var(--space-1);
    min-height: 32px;
    min-width: 32px;
}

.breadcrumb-expand:hover,
.breadcrumb-expand:focus-visible {
    color: var(--brand-text);
}

@media (max-width: 640px) {
    .breadcrumb-item-middle {
        display: none;
    }

    .breadcrumb-item-middle.breadcrumb-item-expanded {
        display: flex;
    }

    .breadcrumb-item-ellipsis {
        display: flex;
    }
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2) var(--space-4);
    background: var(--card);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 999px;
    font: inherit;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    min-height: 32px;
}

.back-button:hover,
.back-button:focus-visible {
    color: var(--brand-text);
    border-color: var(--brand-text);
}

.page-header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.settings-list {
    list-style: none;
    margin: var(--space-5) 0 0;
    padding: 0;
    display: grid;
    gap: var(--space-4);
}

.settings-list > li {
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.settings-list > li > p {
    margin: var(--space-1) 0 0;
    font-size: 0.9rem;
}

.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
}

.app-shell-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.sidebar {
    width: 232px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    padding: var(--space-5) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2) var(--space-5);
}

.sidebar-brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--brand);
    color: var(--brand-contrast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-weight: 600;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 9px var(--space-2);
    border-radius: 6px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 500;
    font-size: 0.9rem;
    min-height: 36px;
}

.sidebar-nav-item:hover {
    background: var(--surface);
}

.sidebar-nav-item:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: -2px;
}

.sidebar-nav-item .badge {
    margin-left: auto;
}

.sidebar-nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--brand-text);
    font-weight: 600;
}

.sidebar-current-project {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.sidebar-current-project-label {
    font-size: 0.72rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 var(--space-2) 4px;
}

.sidebar-current-project-name {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0 var(--space-2) var(--space-2);
    line-height: 1.3;
}

.sidebar-switch-project {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 6px;
    padding: 7px var(--space-2);
    font: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    width: 100%;
    min-height: 32px;
    text-decoration: none;
    display: block;
    text-align: center;
}

.sidebar-switch-project:hover {
    background: var(--surface);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid rgb(255 255 255 / 35%);
    color: var(--topbar-link);
    border-radius: 6px;
    padding: var(--space-1) var(--space-2);
    font: inherit;
    cursor: pointer;
    min-height: 32px;
    min-width: 32px;
}

.sidebar-overlay {
    display: none;
}

@media (max-width: 900px) {
    .sidebar-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.15s ease;
        box-shadow: var(--shadow);
    }

    .app-shell.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .app-shell.sidebar-open .sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        background: rgb(0 0 0 / 40%);
        z-index: 1000;
    }
}

.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
    padding: 0;
    background: var(--border);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--card);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease;
}

.toggle-switch[aria-checked="true"],
.toggle-switch[aria-pressed="true"] {
    background: var(--brand);
}

.toggle-switch[aria-checked="true"]::after,
.toggle-switch[aria-pressed="true"]::after {
    transform: translateX(18px);
}

.toggle-switch:focus-visible {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.toggle-switch:disabled,
.toggle-switch.toggle-switch-saving {
    opacity: 0.6;
    cursor: progress;
}

@media (prefers-reduced-motion: reduce) {
    .toggle-switch,
    .toggle-switch::after {
        transition: none;
    }
}

.detail-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-5);
    align-items: start;
}

.detail-layout-main,
.detail-layout-aside {
    min-width: 0;
}

@media (max-width: 900px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }
}

.dropzone {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-6) var(--space-4);
    text-align: center;
    color: var(--muted);
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dropzone-active {
    border-color: var(--brand-text);
    color: var(--brand-text);
}

.dropzone:focus-within {
    outline: 2px solid var(--brand-text);
    outline-offset: 2px;
}

.dropzone input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.dropzone-text {
    font-size: 0.9rem;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: var(--muted);
}

.dropzone-filename {
    font-weight: 600;
    color: var(--text);
}

.pill-tabs {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin-bottom: var(--space-4);
    background: var(--surface);
    border-radius: 999px;
}

.pill-tab {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-4);
    border-radius: 999px;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    min-height: 32px;
}

.pill-tab:hover {
    color: var(--text);
}

.pill-tab.active,
.pill-tab[aria-current="page"] {
    background: var(--card);
    color: var(--brand-text);
    box-shadow: var(--shadow);
}

.revision-stepper {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
}

.revision-stepper-step {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
    text-align: center;
}

.revision-stepper-step:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 13px;
    left: 50%;
    z-index: 0;
    width: 100%;
    height: 2px;
    background: var(--border);
}

.revision-stepper-circle {
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    border: 2px solid var(--border);
    border-radius: 50%;
}

.revision-stepper-label {
    color: var(--muted);
    font-size: 0.78rem;
}

.revision-stepper-step.completed .revision-stepper-circle {
    background: var(--diff-added);
    color: var(--brand-contrast);
    border-color: var(--diff-added);
}

.revision-stepper-step.current .revision-stepper-circle {
    background: var(--brand);
    color: var(--brand-contrast);
    border-color: var(--brand);
}

.revision-stepper-step.current .revision-stepper-label {
    color: var(--text);
    font-weight: 600;
}

.import-stepper {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.import-stepper-step {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-4);
    background: var(--surface);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.85rem;
    border-radius: 999px;
}

.import-stepper-step.current {
    background: var(--brand);
    color: var(--brand-contrast);
}

.discipline-pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    color: var(--text);
    font-size: 0.85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}

.discipline-pill:has(input:checked),
.discipline-pill.selected {
    background: var(--sidebar-active-bg);
    color: var(--brand-text);
    font-weight: 600;
    border-color: var(--brand-text);
}

.viewer-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3);
    margin-bottom: var(--space-3);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.viewer-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: var(--space-4);
    align-items: start;
}

@media (max-width: 900px) {
    .viewer-layout {
        grid-template-columns: 1fr;
    }
}

.viewer-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.federate-discipline-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    padding: var(--space-1) 0;
}

.ifc-viewer-container {
    position: relative;
    width: 100%;
    height: 600px;
}

.diff-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
    padding: 0;
    color: var(--muted);
    font-size: 0.875rem;
    list-style: none;
}

.diff-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.diff-legend-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    border-radius: 3px;
}

.diff-legend-swatch-added {
    background: var(--diff-added);
}

.diff-legend-swatch-changed {
    background: var(--warning-border);
}

.diff-legend-swatch-removed {
    background: var(--diff-removed);
}

.confirmation-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 50%;
}

.confirmation-icon-success {
    background: var(--diff-added-bg);
    color: var(--diff-added);
}

.confirmation-icon-warning {
    background: var(--warning-bg);
    color: var(--warning-border);
}

.app-footer {
    padding: var(--space-3) var(--space-5);
    text-align: center;
}

.app-footer-link {
    color: var(--muted);
    font-size: 0.8rem;
    text-decoration: none;
}

.app-footer-link:hover,
.app-footer-link:focus-visible {
    color: var(--brand-text);
    text-decoration: underline;
}

mark {
    background: var(--warning-bg);
    color: var(--text);
    padding: 0 var(--space-1);
    border-radius: var(--radius);
}

.gantt {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    overflow: hidden;
}

.gantt-row,
.gantt-ruler {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    border-bottom: 1px solid var(--border);
}

.gantt-label {
    flex: 0 0 22%;
    min-width: 12ch;
    color: var(--text);
    font-size: 0.9rem;
}

.gantt-track {
    position: relative;
    flex: 1 1 auto;
    height: 20px;
}

.gantt-ruler .gantt-track {
    height: 1.4rem;
}

.gantt-tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font-size: 0.72rem;
    color: var(--muted);
    white-space: nowrap;
}

.gantt-today {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--overdue-border);
    z-index: 0;
}

.gantt-bar {
    position: absolute;
    border-radius: var(--radius);
    z-index: 1;
    min-width: 2px;
}

.gantt-bar-planned {
    top: 0;
    height: 8px;
    background: repeating-linear-gradient(
        45deg,
        var(--border) 0 4px,
        transparent 4px 8px
    );
    border: 1px solid var(--border);
}

.gantt-bar-actual {
    bottom: 0;
    height: 8px;
    background: var(--brand);
}

.gantt-bar-open::after {
    content: "›";
    position: absolute;
    right: -0.6rem;
    top: -0.45rem;
    color: var(--brand);
    font-weight: 700;
}

.gantt-bar-envelope {
    top: 4px;
    height: 10px;
    background: var(--sidebar-active-bg);
    border: 1px solid var(--brand);
}

.gantt-swatch {
    position: static;
    display: inline-block;
    width: 28px;
    height: 8px;
    vertical-align: middle;
}

.gantt-row-child .gantt-label {
    padding-left: var(--space-4);
    color: var(--muted);
}

.gantt-row-flagged {
    background: var(--warning-bg);
    border-left: 3px solid var(--warning-border);
}

.gantt-flag,
.gantt-incomplete {
    margin-left: var(--space-2);
    font-size: 0.75rem;
    color: var(--muted);
    white-space: nowrap;
}

.gantt-unplanned {
    margin-left: var(--space-2);
    font-size: 0.75rem;
    font-style: italic;
    color: var(--muted);
}

.gantt-milestone {
    position: absolute;
    top: -2px;
    transform: translateX(-50%);
    z-index: 2;
    font-size: 1rem;
    line-height: 1;
}

.gantt-milestone-reached {
    color: var(--diff-added);
}

.gantt-milestone-atrisk {
    color: var(--overdue-border);
}

.gantt-milestone-pending {
    color: var(--muted);
}

.gantt-phase > summary {
    cursor: pointer;
    font-weight: 600;
}

.gantt-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    list-style: none;
    padding: var(--space-3) 0;
    margin: 0;
    font-size: 0.8rem;
    color: var(--muted);
}

.gantt-legend li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.gantt-orphan-milestones {
    margin-top: var(--space-5);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media print {
    .gantt-toolbar {
        display: none;
    }
}

@media (max-width: 900px) {
    .gantt-row,
    .gantt-ruler {
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-1);
    }

    .gantt-label {
        flex: 1 1 auto;
        min-width: 0;
    }

    .gantt-row-child .gantt-label {
        padding-left: var(--space-2);
    }

    .gantt-track {
        height: 24px;
    }

    .gantt-legend {
        gap: var(--space-2);
    }
}

.thumbnail {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #ffffff;
}

.thumbnail-small {
    height: 48px;
    max-width: 72px;
    object-fit: contain;
}

.thumbnail-large {
    width: 100%;
    max-width: 320px;
    height: auto;
}

.thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.1;
    text-align: center;
}

.thumbnail-small.thumbnail-placeholder {
    width: 64px;
}

.thumbnail-large.thumbnail-placeholder {
    aspect-ratio: 4 / 3;
}

.thumbnail-neutral {
    background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 6px, transparent 6px, transparent 12px);
}

.thumbnail[hidden] {
    display: none;
}

@media (max-width: 640px) {
    .thumbnail-column {
        display: none;
    }
}

.media-card {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: flex-start;
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border);
}

.media-thumb {
    width: 160px;
    max-width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* A SHA-256 has no break points: without this it widens the table of documents past the viewport at 390 px. */
.mono-wrap {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8em;
  overflow-wrap: anywhere;
}

/* The words of the verification page carry the result also in their weight, so a conference does not depend on colour alone. */
.outcome-matches {
  color: var(--diff-added);
  font-weight: 700;
}

.outcome-differs {
  color: var(--danger);
  font-weight: 700;
  text-decoration: underline;
}
