/* Hide platform/source-set badges (e.g., JVM) in Dokka HTML output. */
.platform-tags--wrapper,
.platform-tag {
    display: none !important;
}

/* Narrative tables size columns from their contents. Dokka's 20vw first-column
   rule wastes most of a history or reaction table on a short identifier. */
.table--container td:first-child {
    width: auto;
}

.table--container :is(th, td) {
    overflow-wrap: anywhere;
    white-space: normal;
}

.stig-svg-preview-link {
    display: inline-block;
    max-width: 100%;
}

.stig-svg-preview {
    max-width: 100%;
    height: auto;
    cursor: zoom-in;
}

/* Dokka renders inline Markdown code as shaded chips. In STIG reports those
   spans often contain long task names or symbols, so keep only the monospace
   distinction and let the surrounding text background remain clean. */
#content :not(pre) > code:not(.block),
.main-content :not(pre) > code:not(.block) {
    display: inline;
    padding: 0;
    border-radius: 0;
    background: transparent !important;
}

#content code.stig-breakable-path,
.main-content code.stig-breakable-path {
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

/* Dokka sets `.main-content { z-index: 0; }` which traps fixed descendants in a lower
   stacking context than header/sidebar. Remove that barrier so the modal can be topmost. */
.main-content {
    z-index: auto !important;
}

.stig-tests-status {
    white-space: nowrap;
    display: inline-block;
}

@media (min-width: 900px) {
    .main-content {
        max-width: none !important;
    }
}

.stig-svg-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    isolation: isolate;
}

.stig-svg-modal:target {
    display: block;
}

.stig-svg-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.stig-svg-modal__panel {
    position: absolute;
    left: 0;
    top: 0;
    transform: none;
    width: 100vw;
    height: 100vh;
    background: #fff;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stig-svg-modal__toolbar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 12px;
    padding: 8px 12px 8px 12px;
    padding-right: 48px;
    border-bottom: 1px solid #ddd;
    font-size: 0.9rem;
}

.stig-svg-modal__toolbar a {
    white-space: nowrap;
}

.stig-svg-modal__hint {
    color: #555;
    font-size: 0.85rem;
}

.stig-svg-modal[data-svg-viewer-engine="toolbelt"] .stig-svg-modal__toolbar {
    display: none;
}

.stig-svg-modal__close-button {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 28px;
    height: 28px;
    line-height: 28px;
    text-align: center;
    border: 1px solid #bbb;
    border-radius: 4px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-weight: 700;
    z-index: 2;
}

.stig-svg-modal__close-button:hover {
    background: #f0f0f0;
}

.stig-svg-modal[data-svg-viewer-engine="toolbelt"] .stig-svg-modal__close-button {
    display: none;
}

.stig-svg-modal__viewport {
    flex: 1 1 auto;
    overflow: auto;
    background: #fff;
    cursor: default;
}

.stig-svg-modal[data-svg-viewer-engine="toolbelt"] .stig-svg-modal__viewport {
    overflow: hidden;
}

.stig-svg-modal__viewport--panning {
    cursor: grabbing;
}

.stig-svg-modal__viewport--panning,
.stig-svg-modal__viewport--panning * {
    user-select: none;
}

.stig-svg-modal__image {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    transform-origin: top left;
    flex: 0 0 auto;
    border: 0;
    -webkit-user-drag: none;
    -webkit-user-select: text;
    user-select: text;
}

.stig-svg-modal__toolbelt-host {
    position: relative;
    width: 100%;
    height: 100%;
    background: #fff;
    overflow: hidden;
}

.stig-svg-modal__toolbelt-host > svg {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: 0 0;
}

.stig-svg-modal__toolbelt-status {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 4;
    padding: 6px 8px;
    border-radius: 6px;
    background: rgba(247, 251, 255, 0.9);
    color: #425466;
    font-size: 0.85rem;
    border: 1px solid #d6dee8;
}

.stig-diagram-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
}

.stig-quick-links {
    margin: 0 0 1.25rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--wa-color-surface-border, #d7e0ea);
    border-bottom: 1px solid var(--wa-color-surface-border, #d7e0ea);
}

.stig-quick-links__heading {
    margin-bottom: 0.35rem;
}

.stig-quick-links__list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    grid-auto-rows: 1fr;
    gap: 0.7rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.stig-quick-links__list > li {
    display: flex;
    min-width: 0;
}

.stig-quick-link {
    display: flex;
    flex: 1;
    min-width: 0;
    border-radius: var(--wa-panel-border-radius, 0.75rem);
    color: inherit;
    text-decoration: none;
}

.stig-quick-link:hover {
    text-decoration: none;
}

.stig-quick-link__card {
    --spacing: 0.8rem;

    display: flex;
    flex: 1;
    width: 100%;
    height: 100%;
    min-width: 0;
    box-sizing: border-box;
    transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.stig-quick-link__card::part(body) {
    display: flex;
    flex: 1;
    box-sizing: border-box;
}

.stig-quick-link__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.85rem;
    min-width: 0;
    min-height: 4rem;
}

.stig-quick-link__title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
}

.stig-quick-link__icon {
    flex: 0 0 auto;
    width: 1.65rem;
    height: 1.65rem;
    color: var(--wa-color-brand-on-quiet, #2563eb);
}

.stig-quick-link__title {
    color: var(--wa-color-text-normal, #1f2d3a);
    font-size: 0.9rem;
    font-weight: 650;
    line-height: 1.3;
}

.stig-quick-link__tooltip {
    --max-width: 38ch;
}

.stig-quick-link__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.stig-quick-link__arrow {
    flex: 0 0 auto;
    width: 1rem;
    height: 1rem;
    color: var(--wa-color-brand-on-quiet, #2563eb);
    transition: transform 150ms ease;
}

.stig-quick-link:hover .stig-quick-link__card {
    --wa-color-neutral-fill-quiet: var(--wa-color-brand-fill-quiet);
    --wa-color-surface-border: var(--wa-color-brand-border-normal);

    box-shadow: var(--wa-shadow-m, 0 0.3rem 0.8rem rgb(15 23 42 / 15%));
    transform: translateY(-2px);
}

.stig-quick-link:hover .stig-quick-link__arrow {
    transform: translateX(2px);
}

.stig-quick-link:focus-visible {
    outline: none;
}

.stig-quick-link:focus-visible .stig-quick-link__card {
    outline: var(--wa-focus-ring, 3px solid #2563eb);
    outline-offset: var(--wa-focus-ring-offset, 2px);
}

.stig-quick-link:active .stig-quick-link__card {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .stig-quick-link__card,
    .stig-quick-link__arrow {
        transition: none;
    }
}

.stig-diagram-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 6px;
}

.stig-diagram-chip {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid #d7e0ea;
    border-radius: 5px;
    background: #f8fafc;
    color: #344154;
    font: 700 0.72rem/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0;
    white-space: nowrap;
}

.stig-diagram-chip--analysis {
    background: #eef6ff;
    border-color: #bfd8f7;
    color: #1f5f9f;
}

.stig-diagram-chip--flow {
    background: #edfdf7;
    border-color: #bdebd7;
    color: #13684f;
}

.stig-diagram-chip--summary {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #475569;
}

.stig-diagram-chip--format {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.stig-diagram-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 30px;
    padding: 4px 10px 4px 5px;
    border: 1px solid #d7e0ea;
    border-radius: 7px;
    background: #fff;
    color: #1f2d3a;
    font-size: 0.86rem;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(16, 32, 47, 0.06);
}

.stig-diagram-button:hover {
    background: #f4f7fb;
    text-decoration: none;
}

.stig-diagram-button__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 31px;
    height: 22px;
    padding: 0 6px;
    border-radius: 5px;
    color: #fff;
    font: 700 0.7rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0;
}

.stig-diagram-button--cytoscape .stig-diagram-button__badge {
    background: #4f46e5;
}

.stig-diagram-button--sigma .stig-diagram-button__badge {
    background: #d97706;
}

:root {
    --stig-complexity-too-low: #2563eb;
    --stig-complexity-too-low-bg: #eff6ff;
    --stig-complexity-too-low-border: #bfdbfe;
    --stig-complexity-outlier-low: #2563eb;
    --stig-complexity-outlier-low-bg: #eff6ff;
    --stig-complexity-outlier-low-border: #bfdbfe;
    --stig-complexity-very-low: #0284c7;
    --stig-complexity-very-low-bg: #f0f9ff;
    --stig-complexity-very-low-border: #bae6fd;
    --stig-complexity-low: #16833b;
    --stig-complexity-low-bg: #ecfdf3;
    --stig-complexity-low-border: #bbf7d0;
    --stig-complexity-medium: #64748b;
    --stig-complexity-medium-bg: #f8fafc;
    --stig-complexity-medium-border: #cbd5e1;
    --stig-complexity-high: #d97706;
    --stig-complexity-high-bg: #fffbeb;
    --stig-complexity-high-border: #fde68a;
    --stig-complexity-very-high: #ea580c;
    --stig-complexity-very-high-bg: #fff7ed;
    --stig-complexity-very-high-border: #fed7aa;
    --stig-complexity-too-high: #dc2626;
    --stig-complexity-too-high-bg: #fef2f2;
    --stig-complexity-too-high-border: #fecaca;
    --stig-complexity-outlier-high: #dc2626;
    --stig-complexity-outlier-high-bg: #fef2f2;
    --stig-complexity-outlier-high-border: #fecaca;
    --stig-complexity-unknown: #64748b;
    --stig-complexity-unknown-bg: #f3f4f6;
    --stig-complexity-unknown-border: #d1d5db;
}

.stig-complexity-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid var(--stig-complexity-unknown-border);
    border-radius: 5px;
    background: var(--stig-complexity-unknown-bg);
    color: var(--stig-complexity-unknown);
    font: 700 0.72rem/1.1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0;
    white-space: nowrap;
    vertical-align: middle;
}

.stig-complexity-badge .stig-icon {
    flex: 0 0 auto;
    width: 1em;
    height: 1em;
}

.stig-complexity-badge--too-low {
    border-color: var(--stig-complexity-too-low-border);
    background: var(--stig-complexity-too-low-bg);
    color: var(--stig-complexity-too-low);
}

.stig-complexity-badge--outlier-low {
    border-color: var(--stig-complexity-outlier-low-border);
    background: var(--stig-complexity-outlier-low-bg);
    color: var(--stig-complexity-outlier-low);
}

.stig-complexity-badge--very-low {
    border-color: var(--stig-complexity-very-low-border);
    background: var(--stig-complexity-very-low-bg);
    color: var(--stig-complexity-very-low);
}

.stig-complexity-badge--low {
    border-color: var(--stig-complexity-low-border);
    background: var(--stig-complexity-low-bg);
    color: var(--stig-complexity-low);
}

.stig-complexity-badge--medium {
    border-color: var(--stig-complexity-medium-border);
    background: var(--stig-complexity-medium-bg);
    color: var(--stig-complexity-medium);
}

.stig-complexity-badge--high {
    border-color: var(--stig-complexity-high-border);
    background: var(--stig-complexity-high-bg);
    color: var(--stig-complexity-high);
}

.stig-complexity-badge--very-high {
    border-color: var(--stig-complexity-very-high-border);
    background: var(--stig-complexity-very-high-bg);
    color: var(--stig-complexity-very-high);
}

.stig-complexity-badge--too-high {
    border-color: var(--stig-complexity-too-high-border);
    background: var(--stig-complexity-too-high-bg);
    color: var(--stig-complexity-too-high);
}

.stig-complexity-badge--outlier-high {
    border-color: var(--stig-complexity-outlier-high-border);
    background: var(--stig-complexity-outlier-high-bg);
    color: var(--stig-complexity-outlier-high);
}

.stig-complexity-badge--unknown {
    border-color: var(--stig-complexity-unknown-border);
    background: var(--stig-complexity-unknown-bg);
    color: var(--stig-complexity-unknown);
}

.theme-dark .stig-complexity-badge,
html[data-theme="dark"] .stig-complexity-badge {
    background: color-mix(in srgb, currentColor 18%, transparent);
}

.stig-diagview-diagram {
    max-width: 100%;
    margin: 8px 0 6px 0;
    border: 1px solid #d8dde4;
    border-radius: 8px;
    background: #ffffff;
    overflow: hidden;
}

.stig-diagview-diagram > svg {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
}

.stig-diagview-diagram__placeholder {
    padding: 12px;
    color: #53606d;
    font-size: 0.85rem;
}

.stig-diagview-diagram__placeholder--error {
    color: #8f2a2a;
}

.stig-svg-engine-diagview .stig-svg-modal {
    display: none !important;
}

.stig-svg-engine-diagview .stig-diagram-links[data-stig-link-type="svg"] {
    display: none;
}

/* DiagView defaults force SVGs to fill viewport (width/height 100%), which over-scales tiny graphs.
   Keep intrinsic SVG size while still constraining to container bounds. */
.stig-svg-engine-diagview .diagview-viewport > * {
    width: auto !important;
    max-width: 100% !important;
}

.stig-svg-engine-diagview .diagview-viewport svg,
.stig-svg-engine-diagview .diagview-modal-viewport svg {
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
}

.stig-sigma-viewer-link--newtab {
    font-size: 0.86rem;
    white-space: nowrap;
}

.stig-sigma-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    isolation: isolate;
}

.stig-sigma-modal--open {
    display: block;
}

.stig-sigma-modal:target {
    display: block;
}

.stig-sigma-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
}

.stig-sigma-modal__panel {
    position: absolute;
    inset: 16px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stig-sigma-modal__viewport {
    flex: 1 1 auto;
    overflow: hidden;
    background: #fff;
}

.stig-sigma-modal__viewer-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.stig-sigma-preview {
    margin: 8px 0 14px 0;
    border: 1px solid #d8dde4;
    border-radius: 8px;
    background: #f8fafc;
}

.stig-sigma-preview > summary {
    cursor: pointer;
    padding: 8px 10px;
    font-weight: 600;
}

.stig-sigma-preview[open] > summary {
    border-bottom: 1px solid #e4e9ef;
    background: #f2f6fa;
}

.stig-sigma-preview__toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    flex-wrap: wrap;
}

.stig-sigma-preview__search {
    min-width: 220px;
    max-width: 560px;
    flex: 1 1 280px;
}

.stig-sigma-preview__canvas {
    width: 100%;
    height: 420px;
    background: #fff;
    border-top: 1px solid #e4e9ef;
    border-bottom: 1px solid #e4e9ef;
}

.stig-sigma-preview__status {
    padding: 6px 10px;
    color: #53606d;
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .stig-sigma-modal__panel {
        inset: 0;
        border-radius: 0;
    }

    .stig-sigma-preview__canvas {
        height: 300px;
    }
}
