.table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

.data-table th,
.data-table td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.data-table th {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.document-table {
    min-width: 1280px;
}

.table-filter-form {
    margin: 0;
}

.table-filter-row th {
    padding: 8px;
    background: #f8fafc;
    vertical-align: top;
}

.table-filter-row input,
.table-filter-row select {
    width: 100%;
    min-height: 36px;
    margin: 0 0 6px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    font-size: 12px;
    text-transform: none;
}

.table-filter-row input:last-child,
.table-filter-row select:last-child {
    margin-bottom: 0;
}

.table-filter-actions {
    min-width: 118px;
}

.table-filter-actions .primary-button,
.table-filter-actions .secondary-button {
    width: 100%;
    min-height: 36px;
    margin-bottom: 6px;
    padding: 8px 10px;
    font-size: 12px;
}

.reading-list-page .reading-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.records-matrix-page .records-matrix-metrics {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.reading-table-form {
    margin: 0;
}

.records-matrix-form {
    margin: 0;
}

.reading-list-table {
    min-width: 1220px;
}

.records-matrix-table {
    min-width: 1760px;
}

.records-matrix-table td small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.sgi-development-page {
    display: grid;
    gap: 18px;
}

.sgi-development-state {
    margin: 0;
}

.sgi-development-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.sgi-module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.sgi-module-card {
    display: grid;
    gap: 8px;
    min-height: 96px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
}

.sgi-module-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12);
}

.sgi-module-card strong {
    font-size: 15px;
}

.sgi-module-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.pagination-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pagination-page-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pagination-page-size select {
    min-height: 36px;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-weight: 800;
}

.pagination-summary .secondary-button {
    min-height: 36px;
    padding: 8px 12px;
}

.pagination-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination-links a,
.pagination-links span,
.pagination-links strong {
    display: inline-flex;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    text-decoration: none;
}

.pagination-links strong {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.pagination-links span {
    background: #f1f5f9;
    color: #94a3b8;
}

.trace-table-panel .table-wrap {
    margin-top: 0;
}

.trace-pagination {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}

.document-table td small,
.document-table td span {
    display: block;
}

.title-view-button {
    display: inline;
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary);
    font: inherit;
    font-weight: 800;
    text-align: left;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.document-viewer-panel[hidden],
.document-preview-modal[hidden],
.copy-download-modal[hidden],
.drawer-overlay[hidden],
.document-action-drawer[aria-hidden="true"] {
    display: none;
}

body.modal-open {
    overflow: hidden;
}

.document-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
}

.copy-download-modal {
    position: fixed;
    inset: 0;
    z-index: 130;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.52);
}

.copy-download-dialog {
    display: grid;
    gap: 14px;
    width: min(460px, calc(100vw - 36px));
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.copy-download-dialog header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.copy-download-dialog h2 {
    margin: 0;
    font-size: 20px;
}

.copy-download-dialog header button {
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 800;
}

.copy-download-dialog label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.copy-download-dialog input,
.copy-download-dialog select,
.copy-download-dialog textarea {
    width: 100%;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.document-preview-dialog {
    display: grid;
    grid-template-rows: auto auto auto 1fr;
    width: min(1180px, calc(100vw - 48px));
    max-height: calc(100vh - 48px);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.document-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
}

.document-preview-header h2 {
    margin: 0;
    font-size: 20px;
}

.document-preview-header p {
    margin: 4px 0 0;
    color: var(--muted);
}

.document-preview-modal.is-reviewing .document-preview-header {
    background: #fffbeb;
    border-bottom-color: #f5c56b;
}

.document-review-banner {
    padding: 10px 18px;
    border-bottom: 1px solid #f5c56b;
    background: #fef3c7;
    color: #7c2d12;
    font-weight: 800;
}

.document-preview-pages {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    min-height: 0;
    padding: 16px;
    background: #e5e7eb;
    overflow: auto;
}

.document-frame {
    width: 100%;
    height: min(72vh, 780px);
    min-height: 520px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
    pointer-events: none;
}

.document-viewer-message {
    display: grid;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff7ed;
    color: #7c2d12;
}

.document-viewer-message strong,
.document-viewer-message span {
    display: block;
}

.document-viewer-message .primary-button {
    width: fit-content;
}

.document-action-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    display: grid;
    grid-template-rows: auto auto 1fr auto;
    gap: 16px;
    width: min(430px, 92vw);
    padding: 22px;
    border-left: 1px solid var(--line);
    background: #ffffff;
    box-shadow: var(--shadow);
    overflow-y: auto;
}

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(15, 23, 42, 0.42);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    gap: 14px;
}

.drawer-header span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.drawer-header h2 {
    margin: 4px 0 0;
    font-size: 20px;
}

.drawer-header button {
    align-self: start;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.drawer-summary {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-muted);
}

.drawer-summary div {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}

.drawer-summary dt {
    color: var(--muted);
    font-weight: 800;
}

.drawer-summary dd {
    margin: 0;
    color: var(--text);
}

.drawer-actions,
.drawer-cancel-form {
    display: grid;
    gap: 10px;
}

.drawer-actions .primary-button,
.drawer-actions .secondary-button,
.drawer-cancel-form .danger-button {
    width: 100%;
    justify-content: center;
    text-align: center;
}

.viewer-shell {
    margin: -24px;
    background: #d9d9d9;
    min-height: calc(100vh - 92px);
}

.viewer-toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 18px;
    min-height: 64px;
    padding: 10px 18px;
    background: #d1d1d1;
    border-bottom: 1px solid #c4c4c4;
}

.viewer-title {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.viewer-title strong,
.viewer-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.viewer-tools,
.viewer-primary-actions {
    display: flex;
    gap: 10px;
}

.viewer-tool,
.viewer-primary-actions a,
.viewer-primary-actions button {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border: 1px solid #333;
    border-radius: 4px;
    background: #ffffff;
    color: #222;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
}

.viewer-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 420px;
    gap: 0;
}

.viewer-document {
    position: relative;
    padding: 18px;
    overflow: auto;
}

.viewer-document iframe {
    display: block;
    width: min(100%, 980px);
    height: calc(100vh - 130px);
    min-height: 620px;
    margin: 0 auto;
    border: 0;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}

.viewer-obsolete-watermark {
    position: absolute;
    top: calc(18px + min((100vh - 130px), 620px) * 0.42);
    left: 50%;
    z-index: 2;
    width: min(720px, 72%);
    transform: translate(-50%, -50%) rotate(-24deg);
    padding: 18px 28px;
    border: 7px solid rgba(185, 28, 28, 0.44);
    color: rgba(185, 28, 28, 0.44);
    font-size: clamp(42px, 8vw, 86px);
    font-weight: 900;
    letter-spacing: 0.14em;
    line-height: 1;
    text-align: center;
    pointer-events: none;
}

.viewer-details {
    height: calc(100vh - 64px);
    overflow-y: auto;
    padding: 22px 24px;
    background: #ffffff;
    border-left: 1px solid var(--line);
}

body.viewer-details-closed .viewer-body {
    grid-template-columns: 1fr;
}

body.viewer-details-closed .viewer-details {
    display: none;
}

.viewer-details-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.viewer-details-header h2 {
    margin: 0 0 8px;
    font-size: 22px;
}

.viewer-details-header p {
    margin: 0;
    color: var(--muted);
    font-weight: 800;
}

.viewer-details-header button {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    font-size: 24px;
    cursor: pointer;
}

.viewer-primary-actions {
    display: grid;
    margin-bottom: 28px;
}

.viewer-primary-actions form,
.viewer-primary-actions button,
.viewer-primary-actions a {
    width: 100%;
}

.viewer-section {
    border-top: 1px solid var(--line);
}

.viewer-section summary {
    min-height: 48px;
    padding: 14px 0;
    color: #333;
    cursor: pointer;
    font-weight: 800;
}

.viewer-section dl {
    display: grid;
    gap: 10px;
    margin: 0 0 14px;
}

.viewer-section dl div {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 10px;
}

.viewer-section dt {
    color: var(--muted);
    font-weight: 800;
}

.viewer-section dd {
    margin: 0;
}

.viewer-link-list {
    display: grid;
    gap: 10px;
    padding-bottom: 16px;
}

.viewer-link-list a {
    color: var(--primary);
    font-weight: 800;
}

.viewer-revisions-table {
    width: 100%;
    margin: 0 0 16px;
    border-collapse: collapse;
    font-size: 14px;
}

.viewer-revisions-table th,
.viewer-revisions-table td {
    padding: 12px 10px;
    text-align: left;
    vertical-align: top;
}

.viewer-revisions-table th {
    background: #f3f4f6;
    color: var(--muted);
    font-weight: 800;
}

.viewer-revisions-table tbody tr:not(.viewer-revision-reason) {
    border-top: 1px solid var(--line);
}

.viewer-revisions-table tbody tr.is-selected {
    background: #f8fafc;
}

.viewer-revisions-table tbody tr.is-pending-revision,
.viewer-revisions-table tbody tr.is-pending-revision + .viewer-revision-reason {
    background: #fffbeb;
}

.viewer-revisions-table tbody tr.is-pending-revision {
    box-shadow: inset 4px 0 0 #f5c56b;
}

.viewer-revisions-table a {
    color: var(--primary);
    font-weight: 800;
    text-decoration: none;
}

.viewer-revisions-table strong {
    font-weight: 800;
}

.viewer-revision-reason td {
    padding-top: 4px;
    padding-bottom: 18px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.data-table td small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.status {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.status.on {
    background: #dcfce7;
    color: #166534;
}

.status.off {
    background: #fee2e2;
    color: #991b1b;
}

.status.neutral {
    background: #e0f2fe;
    color: #075985;
}

.danger-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 8px;
    background: #dc2626;
    color: #ffffff;
    font-weight: 700;
    cursor: pointer;
}

.workflow-board {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.task-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.task-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.task-card h3 {
    margin: 4px 0 0;
    font-size: 18px;
    line-height: 1.3;
}

.task-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.task-meta div {
    padding: 10px;
    border-radius: 8px;
    background: var(--surface-muted);
}

.task-meta dt,
.task-meta dd {
    margin: 0;
}

.task-meta dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.task-meta dd {
    margin-top: 3px;
}

.task-comment {
    margin: 0;
    padding: 10px;
    border-left: 3px solid var(--primary);
    background: #f8fafc;
    color: var(--muted);
}

.task-actions-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}

.task-actions {
    display: grid;
    gap: 10px;
}

.training-header {
    position: sticky;
    top: 0;
    z-index: 5;
}

.training-progress {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.training-progress.is-completed {
    justify-content: flex-start;
}

.training-progress strong {
    color: var(--primary);
}

.training-progress button:disabled,
.primary-button:disabled,
.secondary-button:disabled {
    border-color: #cbd5e1;
    background: #e5e7eb;
    color: #64748b;
    cursor: not-allowed;
    opacity: .85;
}

.training-pages {
    display: grid;
    gap: 18px;
}

.training-page {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.training-page header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
}

.training-page header span {
    color: var(--muted);
    font-weight: 800;
}

.training-page.is-viewed header span {
    color: #047857;
}

.training-preview-pages {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
}

.training-canvas-frame {
    display: flex;
    justify-content: center;
    min-height: 420px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #525659;
    overflow: auto;
}

.training-canvas-frame canvas {
    display: block;
    align-self: flex-start;
    max-width: 100%;
    background: #ffffff;
}

.training-nav {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

.training-page-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.training-page-buttons button {
    min-width: 34px;
    min-height: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--text);
    font-weight: 800;
    cursor: pointer;
}

.training-page-buttons button.is-viewed {
    border-color: #047857;
    color: #047857;
}

.training-page-buttons button.is-current {
    border-color: var(--primary);
    background: var(--primary);
    color: #ffffff;
}

.task-actions textarea {
    width: 100%;
    min-height: 76px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
}

.task-actions div {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.empty-state.compact {
    min-height: 260px;
    margin-top: 16px;
}

.actions {
    white-space: nowrap;
}

.actions a,
.actions button {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    color: var(--primary-strong);
    text-decoration: none;
}

.actions form {
    display: inline;
}

