:root {
    --bg: var(--nwc-basic-background);
    --line: var(--nwc-ui-border);
    --text: var(--nwc-text-primary);
    --muted: var(--nwc-text-secondary);
    --primary: #0b63f6;
    --primary-hover: #084ec3;
    --danger: #bf2f2f;
    --sidebar-background: #1C222C;
    --sidebar-background-popover: #0d1b2af2;
    --sidebar-background-hover: #26303B;
    --sidebar-inner-border-color: #303f49;
    --sub-sidebar-width: 260px;
    --top-panel-height: 50px;
    --buttons-gray-color: #56657b;
    --text-gray-color: var(--nwc-text-secondary);
    --tabs-panel-color: #212529;
    --light-gray-border: var(--nwc-ui-border);
    --selection-gray-background-color: var(--nwc-ui-surface-soft);
    --card-shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    --border-default: var(--nwc-ui-border);
    --cai-border: var(--nwc-ui-border);
    --border-input: var(--nwc-ui-border);
    --nph-border-color: var(--nwc-ui-border);
    --wc-color-border: var(--nwc-ui-border);
    --border-color: var(--nwc-ui-border);
    --gray-250: var(--nwc-ui-border);
    --gray-300: var(--nwc-ui-border);
    --sdtm-gray-250: var(--nwc-ui-border);
    --text-primary: var(--nwc-text-primary);
    --ink: var(--nwc-text-primary);
    --text-secondary: var(--nwc-text-secondary);
    --text-muted: var(--nwc-text-muted);
    --gray-400: var(--nwc-text-muted);
    --surface-card: var(--nwc-ui-surface);
    --surface-sunken: var(--nwc-ui-surface-soft);
    --surface-subtle: var(--nwc-ui-surface-soft);
    --navy-700: var(--nwc-text-primary);
    --gray-100: var(--nwc-ui-surface-soft);
    --cai-text-warning: color-mix(in oklch, var(--nwc-warning) 50%, var(--nwc-text-primary));
    --cai-text-success: color-mix(in oklch, var(--nwc-success) 50%, var(--nwc-text-primary));
    --cai-text-info: color-mix(in oklch, var(--nwc-info) 50%, var(--nwc-text-primary));
    --cai-text-error: color-mix(in oklch, var(--nwc-error) 50%, var(--nwc-text-primary));
}

:root[data-theme="dark"] {
    --sidebar-background: var(--nwc-ui-surface);
    --sidebar-inner-border-color: var(--nwc-ui-border);
    --sidebar-background-popover: var(--nwc-ui-surface);
}

* {
    box-sizing: border-box;
}

* [hidden] {
    display: none !important;
}

/* Suppress the layout-shifting left-border dirty indicator from the WC component library.
   border-inline-start + padding-inline-start shifts content 17px right on first keystroke. */
.wc-ui-form-dialog-dirty .wc-ui-form-dialog-content {
    border-inline-start: none;
    padding-inline-start: 0;
}

html,
body,
#app-theme,
#wc-app,
.wc-app-root,
.wc-app-content {
    margin: 0;
    width: 100%;
    height: 100%;
}

#app-theme {
    display: flex;
    flex-direction: column;
}

button,
input {
    font: inherit;
}

/* ── Session warning dialog ─────────────────────────────────────────────── */

.session-warning-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    text-align: center;
}

.session-warning-icon {
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 50%;
    border: 0.1875rem solid #e8924a;
    color: #e8924a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: bold;
    line-height: 1;
    margin-bottom: 0.25rem;
}

.session-warning-icon iconify-icon {
    display: flex;
    width: 2.25rem;
    height: 2.25rem;
}

.session-warning-message {
    margin: 0;
    color: var(--text);
    font-size: 0.9375rem;
}

.session-warning-progress-track {
    width: 100%;
    height: 0.75rem;
    background: var(--nwc-ui-surface-soft);
    border-radius: 0.375rem;
    overflow: hidden;
    margin: 0.25rem 0;
}

.session-warning-progress-bar {
    height: 100%;
    border-radius: 0.375rem;
    background: linear-gradient(to right, #3a7a62, #52a085);
    transition: width 1s linear;
}

.session-warning-time {
    margin: 0;
    font-style: italic;
    color: var(--muted);
    font-size: 0.875rem;
}

.wc-app-root {
    overflow: hidden;
}

.wc-app-content {
    overflow: auto;
}

.app-shell {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    position: relative;
    background: var(--bg);
    overflow: hidden;
}

.app-top-bar {
    display: flex;
    flex-direction: row;
    flex: 0 0 auto;
    height: var(--top-panel-height);
    background: var(--nwc-ui-surface);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    z-index: 50;
    align-items: center;
}

/* Slot kept for backward compat — now inside sub-sidebar header */
.app-top-bar-sidebar-slot {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
    flex: 1;
    position: relative;
}

/* Collapsed nav pills shown in topbar when sidebar is hidden */
.app-topbar-collapsed-nav {
    display: none;
    align-items: center;
    gap: 2px;
    padding: 0 0.5rem;
    flex-shrink: 0;
    height: 100%;
    width: var(--sub-sidebar-width);
}

.app-topbar-collapsed-nav-visible {
    display: flex;
    justify-content: space-around;
}

.app-topbar-collapsed-logo {
    flex: unset;
    height: 2.25rem;
    width: auto;
}

.app-topbar-logo-square {
    width: 1.5rem;
    height: 1.5rem;
    background: #111;
    border-radius: 0.3125rem;
    display: inline-block;
    flex-shrink: 0;
}

.app-shell-body {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.app-main-sidebar {
    display: none;
}

.logo-container {
    display: flex;
    align-items: center;
    position: relative;
}

.logo-icon {
    display: block;
    height: 3rem;
    object-fit: contain;
}

.logo-full-sidebar {
    display: block;
    width: 100%;
    max-width: 156px;
    height: auto;
}

.app-sidebar-nav {
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.app-sub-sidebar {
    flex: 0 0 var(--sub-sidebar-width);
    width: var(--sub-sidebar-width);
    background: var(--sidebar-background);
    color: #d9e1ee;
    border-right: 1px solid var(--sidebar-inner-border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    position: relative;
    scrollbar-width: none;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    flex-basis 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.22s ease,
    border-width 0.28s ease;
}

.app-sub-sidebar-instant .app-sub-sidebar {
    transition: none !important;
}

.app-shell-sub-hidden .app-sub-sidebar {
    width: 0;
    flex-basis: 0;
    opacity: 0;
    border-right-width: 0;
    overflow: hidden;
    pointer-events: none;
}

.app-sub-sidebar-header {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: var(--top-panel-height);
    border-bottom: 1px solid var(--sidebar-inner-border-color);
    background: var(--sidebar-background);
}

.app-sub-sidebar-back {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    border-left: 3px solid var(--nwc-accent);
    border-bottom: 1px solid var(--sidebar-inner-border-color);
    background: rgba(16, 163, 127, 0.08);
    padding: 0.625rem 0.875rem 0.625rem 0.75rem;
    color: #bbb;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    white-space: nowrap;
    transition: background var(--nwc-duration-fast), color var(--nwc-duration-fast);
}

.app-sub-sidebar-back-arrow {
    flex: 0 0 auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--nwc-accent);
}

.app-sub-sidebar-back-arrow:hover {
    color: #ffffff;
}

.app-sub-sidebar-back-title {
    flex: 1 1 auto;
    font-size: 13px;
    font-weight: 600;
    color: #d9e1ee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sub-sidebar-back-badge {
    border-radius: 0.25rem;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: rgba(16, 163, 127, 0.20);
    color: var(--nwc-accent);
    border: 1px solid rgba(16, 163, 127, 0.30);
    padding: 0.0625rem 0.3125rem;
    margin-left: auto;
}

.app-sub-sidebar-title {
    min-width: 0;
    flex: 1 1 auto;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sub-sidebar-toggle iconify-icon,
.app-section-switcher-btn iconify-icon {
    display: flex;
    height: 2rem;
    width: 2rem;
    margin-block-start: 0;
    margin-inline-start: 0;
}

.app-sub-sidebar-toggle,
.app-section-switcher-btn {
    border: 0 !important;
    border-radius: 0.5rem;
    display: flex;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    color: var(--nwc-text-secondary);
    background: transparent !important;
    box-shadow: none !important;
    transition: background-color var(--nwc-duration-normal) ease,
    transform var(--nwc-duration-normal) ease;
}

.app-sub-sidebar-toggle:hover,
.app-section-switcher-btn:hover {
    background: var(--nwc-raw-dark-2) !important;
    color: #bbb;
}

.app-sub-sidebar-toggle-collapsed {
    transform: rotate(180deg);
}

.app-sub-sidebar-switcher-collapsed:hover,
.app-sub-sidebar-toggle-collapsed:hover {
    background: var(--nwc-ui-surface-soft) !important;
    color: var(--nwc-text-secondary);
}

.app-sub-sidebar-logo {
    height: 2.25rem;
    width: auto;
    object-fit: contain;
    flex: 1;
}

.app-section-popover {
    position: absolute;
    top: 3.25rem;
    inset-inline-start: 0.75rem;
    width: 12.5rem;
    z-index: 200;
    background: var(--sidebar-background-popover);
    border: 1px solid #333;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.app-section-popover-hidden {
    display: none;
}

.app-section-popover-btn {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    display: flex;
    align-items: center;
    gap: 0.675rem;
    padding: 0.5rem 0.675rem;
    border-radius: 0.325rem;
    cursor: pointer;
    justify-content: flex-start;
    transition: background var(--nwc-duration-fast);
}

.app-section-popover-btn:hover {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ddd !important;
}

.app-section-popover-btn-content {
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.app-section-popover-btn-content iconify-icon {
    font-size: 0.9rem;
}

.app-section-popover-btn-selected {
    background: var(--nwc-accent-subtle) !important;
    font-weight: 600;
    padding-inline-start: 0.75rem;
    border-inline-start: 2px solid var(--nwc-accent) !important;
}

.app-section-popover-btn-selected * {
    color: var(--nwc-accent) !important;
}

.app-section-popover-btn-icon {
    width: 1.4rem;
    height: 1.4rem;
    object-fit: contain;
}

.app-section-popover-btn-label {
    font-size: 0.9rem;
    color: #e6ebf4;
    font-weight: 300;
    text-align: center;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sub-sidebar-content {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.app-sub-group {
    margin-bottom: 1rem;
}

.app-sub-group-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.11em;
    margin: 0 .375rem;
    font-weight: 700;
    color: var(--nwc-text-form-labels);
    padding: 0.875rem 1rem 0;
    white-space: nowrap;
}

.app-sub-section-label {
    font-size: .875rem;
    font-weight: 600;
    color: #e6ebf4;
    padding: 1rem .75rem .5rem;
}

.app-sub-item-content {
    width: 100%;
    text-align: left;
    color: var(--nwc-secondary-300);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.41rem 0.625rem;
    margin: 0.06rem 0.5rem;
    font-weight: 300;
    font-size: 0.85rem;
    line-height: 1;
    border-radius: 0.5rem;
    transition: all var(--nwc-duration-normal) linear;
}

.app-sub-item-content:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #ddd;
}

.app-sub-item-btn-selected {
    background: var(--nwc-accent-subtle) !important;
    font-weight: 600;
    border-left: 2px solid var(--nwc-accent) !important;
    margin-left: 0.25rem;
    padding-left: 0.75rem;
}

.app-sub-item-btn-selected .app-sub-item-icon,
.app-sub-item-btn-selected .app-sub-item-label {
    color: var(--nwc-accent);
}

.app-sub-item-icon {
    width: 1.15rem;
    height: 1.15rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.app-sub-item-label {
    flex: 1 1 auto;
    min-width: 0;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.5;
    transition: all var(--nwc-duration-normal) linear;
}

.app-sub-item-btn-selected .app-sub-item-label {
    font-weight: 600;
}

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

.app-top-panel {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    height: 100%;
}

.app-top-panel-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    height: inherit;
    min-width: 0;
    flex-wrap: nowrap;
}

.app-top-panel-title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1rem;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 240px;
    height: inherit;
}

.app-page-title-icon {
    width: 1.1rem;
    height: 1.1rem;
    object-fit: contain;
}

.app-page-title {
    font-size: 16px;
    font-weight: 700;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
    overflow: hidden;
    height: inherit;
}

.app-breadcrumb > span {
    font-size: 0.9rem;
    font-weight: 300;
}

.app-breadcrumb-ancestor {
    color: var(--nwc-text-secondary);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

.app-breadcrumb-sep {
    color: var(--nwc-text-muted);
    font-size: 15px;
    line-height: 1;
    flex-shrink: 0;
    user-select: none;
}

.app-breadcrumb-current {
    color: var(--nwc-text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-top-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    justify-content: flex-end;
    margin-left: auto;
    min-width: 0;
    height: inherit;
}

.app-top-actions > * {
    flex: 0 0 auto;
    min-width: 0;
}

.app-aria-launcher {
    --nwc-button-border-color: var(--nwc-ui-border) !important;
    --nwc-button-color: var(--nwc-text-secondary);
}

.context-switcher-icon {
    width: 1.25rem;
    height: 1.25rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.context-switcher-content {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 0;
}

.context-switcher-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-user-badge,
.app-user-trigger {
    white-space: nowrap;
}

.selection-dialog-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(13, 20, 33, 0.42);
    z-index: 1200;
}

.selection-dialog-overlay.selection-dialog-open {
    display: flex;
}

.selection-dialog-card {
    width: min(560px, 100%);
    max-height: min(78vh, 720px);
    overflow: auto;
    border-radius: 18px;
    background: var(--nwc-ui-surface);
    border: 1px solid rgba(24, 34, 52, 0.08);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.selection-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.selection-dialog-heading {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.selection-dialog-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.selection-dialog-subtitle {
    font-size: 14px;
    line-height: 1.45;
    color: var(--muted);
}

.selection-dialog-close {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 10px;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
}

.selection-dialog-options {
    display: grid;
    gap: 12px;
    padding: 20px 24px 24px;
}

.selection-dialog-option {
    width: 100%;
    text-align: left;
    display: grid;
    gap: 6px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 14px;
    background: var(--nwc-ui-surface);
    padding: 16px 18px;
    cursor: pointer;
    transition: border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.selection-dialog-option:hover {
    border-color: #9fb8ea;
    box-shadow: 0 10px 24px rgba(11, 99, 246, 0.08);
    transform: translateY(-1px);
}

.selection-dialog-option-active {
    border-color: var(--primary);
    background: linear-gradient(180deg, rgba(11, 99, 246, 0.04), rgba(11, 99, 246, 0.08));
}

.selection-dialog-option-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.selection-dialog-option-description,
.selection-dialog-empty {
    font-size: 13px;
    line-height: 1.45;
    color: var(--muted);
}

.selection-dialog-empty {
    padding: 18px;
    border: 1px dashed var(--nwc-ui-border);
    border-radius: 14px;
    background: var(--nwc-ui-surface-soft);
}

.modal-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(18, 31, 56, 0.42);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 2200;
}

.modal-dialog-overlay.modal-dialog-open {
    display: flex;
}

.modal-dialog-card {
    width: min(640px, 100%);
    max-height: min(88vh, 860px);
    overflow: auto;
    background: var(--nwc-ui-surface);
    border-radius: 22px;
    border: 1px solid rgba(206, 214, 228, 0.9);
    box-shadow: 0 24px 64px rgba(16, 33, 61, 0.24);
    display: flex;
    flex-direction: column;
}

.modal-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.5rem 1rem;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.modal-dialog-heading {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
}

.modal-dialog-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.modal-dialog-subtitle {
    font-size: 0.92rem;
    color: var(--text-gray-color);
}

.modal-dialog-close,
.modal-dialog-btn {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 10px;
    background: var(--nwc-ui-surface);
    color: var(--nwc-text-primary);
    padding: 0.72rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.modal-dialog-close:hover,
.modal-dialog-btn:hover:enabled {
    background: var(--nwc-ui-surface-soft);
}

.modal-dialog-btn:disabled,
.modal-dialog-close:disabled {
    opacity: 0.7;
    cursor: default;
}

.modal-dialog-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.modal-dialog-btn-primary:hover:enabled {
    background: var(--primary-hover);
}

.modal-dialog-btn-danger {
    color: var(--cai-text-error);
    border-color: rgba(155, 28, 28, 0.2);
    background: var(--nwc-error-subtle);
}

.modal-dialog-btn-danger:hover:enabled {
    background: var(--nwc-error-subtle);
}

.modal-dialog-body {
    padding: 1.35rem 1.5rem 1rem;
}

.modal-dialog-footer {
    padding: 0 1.5rem 1.4rem;
}

.confirm-dialog-message {
    font-size: 0.96rem;
    line-height: 1.5;
    color: var(--nwc-text-primary);
}

.confirm-dialog-actions,
.token-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.token-dialog {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.token-dialog-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
}

.token-dialog-section {
    padding: 1rem 1.1rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 16px;
    background: var(--nwc-ui-surface);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.token-dialog-section-title {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.token-dialog-field {
    display: flex;
    flex-direction: column;
    gap: 0.32rem;
}

.token-dialog-meta {
    padding: 0.95rem 1rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 14px;
    background: var(--nwc-ui-surface);
}

.token-dialog-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.token-dialog-value {
    font-size: 0.96rem;
    color: var(--nwc-text-primary);
    line-height: 1.4;
}

.token-dialog-input {
    max-width: 220px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 10px;
    padding: 0.72rem 0.85rem;
    background: var(--nwc-ui-surface);
}

.token-dialog-input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 99, 246, 0.12);
}

.token-dialog-note,
.token-dialog-status {
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text-gray-color);
}

.token-dialog-status {
    min-height: 1.5rem;
}

.token-dialog-status-error {
    color: var(--danger);
}

.project-study-datasets-editor {
    gap: 1.25rem;
}

.project-study-datasets-editor-runs,
.project-study-datasets-dialog-runs {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.project-study-datasets-editor-grid-shell,
.project-study-datasets-dialog-grid-shell {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--nwc-ui-surface);
}

.project-study-datasets-editor-grid-shell {
    min-height: 30rem;
    height: min(36rem, calc(100vh - 22rem));
}

.project-study-datasets-dialog-grid-shell {
    min-height: 22rem;
    height: 22rem;
}

.project-study-datasets-dialog-empty-state {
    padding: 2.25rem 1.25rem;
    border: 1px dashed var(--nwc-ui-border);
    border-radius: 16px;
    background: var(--nwc-ui-surface);
}

.project-study-datasets-dialog-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.project-study-datasets-run-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.9rem;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.wc-ui-read-only-value {
    color: var(--nwc-accent);
}

.lookup-code-toolbar {
    display: flex;
    justify-content: flex-end;
}

.lookup-code-status {
    min-height: 1.4rem;
    font-size: 0.9rem;
    color: var(--text-gray-color);
}

.lookup-code-status-error {
    color: var(--danger);
}

.lookup-code-empty {
    border: 1px dashed var(--nwc-ui-border);
    border-radius: 14px;
    background: var(--nwc-ui-surface);
    padding: 1rem 1.1rem;
    color: var(--text-gray-color);
    line-height: 1.5;
}

.role-assignment-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.role-assignment-row {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) auto auto auto;
    gap: 0.75rem;
    align-items: end;
    padding: 0.9rem 1rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 14px;
    background: var(--nwc-ui-surface);
}

.role-assignment-field {
    display: flex;
    flex-direction: column;
    gap: 0.38rem;
}

.admin-users-environment-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.admin-users-project-roles-table {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--nwc-ui-surface);
}

.admin-users-project-roles-empty {
    padding: 1rem 1.1rem;
    color: var(--text-gray-color);
    line-height: 1.5;
}

.admin-users-project-roles-actions {
    display: flex;
    justify-content: flex-end;
}

.admin-users-project-role-checks {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.admin-users-project-role-dialog .wc-ui-field sp-picker {
    width: 100%;
}

.admin-users-project-role-dialog .wc-ui-field {
    display: grid;
    grid-template-columns: 10.5rem minmax(0, 1fr);
    align-items: start;
}

.admin-users-project-role-dialog .wc-ui-field > .wc-ui-label {
    width: auto;
    padding-top: 0.375rem;
}

.admin-users-project-role-dialog .admin-users-project-role-summary-field {
    align-items: center;
}

.admin-users-project-role-dialog .admin-users-project-role-summary-field > .wc-ui-label {
    padding-top: 0;
}

.admin-users-project-role-dialog .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 28.75rem;
}

.admin-users-project-role-value {
    color: var(--nwc-ui-text);
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.app-user-avatar {
    width: 1.875rem;
    height: 1.875rem;
    border-radius: 50%;
    background: var(--nwc-ui-surface);
    object-fit: cover;
    flex-shrink: 0;
}

.app-user-menu {
    position: relative;
    height: inherit;
    padding: 0.4rem;
}

.app-user-trigger {
    justify-content: space-between;
    height: inherit;
    padding: 0 0.4rem;
    align-self: center;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.88rem;
    border-radius: 100rem;
    transition: background-color var(--nwc-duration-fast);
}

.app-user-trigger:hover {
    background-color: #0000000A;
}

.app-user-trigger[aria-expanded=true] {
    background-color: var(--nwc-accent-subtle);
    color: var(--nwc-text-primary);
}

.app-user-trigger[aria-expanded=true] .app-user-icon {
    transform: rotate(180deg);
}

.app-user-trigger[aria-expanded=true] .app-user-name {
    color: var(--nwc-text-primary);
}

.app-user-icon {
    transition: transform var(--nwc-duration-slow) cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.app-user-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    color: var(--nwc-text-primary);
    font-weight: 500;
}

.app-user-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--nwc-text-secondary);
    font-size: 0.9rem;
}

.app-user-dropdown {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    display: none;
    color: var(--nwc-text-primary);
    width: 17rem;
    padding: 0.9rem 0.5rem 0.5rem;
    flex-direction: column;
    border: 1px solid var(--nwc-border-subtle);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.18);
    z-index: 40;
}

.app-user-menu-open .app-user-dropdown {
    display: flex;
}

.app-user-menu-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.25rem 0.6rem 0.85rem;
}

.app-user-menu-avatar {
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
}

.app-user-menu-identity {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.app-user-menu-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-user-menu-role {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--nwc-text-secondary);
}

.app-user-menu-section {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 0;
}

.app-user-menu-section-footer {
    border-top: 1px solid var(--nwc-border-subtle);
    padding-bottom: 0;
}

.app-user-menu-action {
    text-align: left;
    width: 100%;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.3rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background var(--nwc-duration-fast) ease, color var(--nwc-duration-fast) ease;
}

.app-user-menu-action:hover {
    background: var(--nwc-accent-subtle);
    color: var(--nwc-accent);
}

.app-user-menu-action-danger {
    color: #dc3545 !important;
}

.app-user-menu-theme {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.3rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background var(--nwc-duration-fast) ease, color var(--nwc-duration-fast) ease;
}

.app-user-menu-theme:hover {
    background: var(--nwc-accent-subtle);
    color: var(--nwc-accent);
}

.app-notif-menu {
    position: relative;
    height: inherit;
    padding: 0 0.25rem;
    display: flex;
    align-items: center;
}

.app-notif-trigger {
    --app-notif-trigger-size: 2.5rem;
    width: var(--app-notif-trigger-size);
    height: var(--app-notif-trigger-size);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    position: relative;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color var(--nwc-duration-fast);
}

.app-notif-trigger:hover {
    background-color: var(--nwc-row-hover);
}

.app-notif-trigger:focus-visible {
    outline: 2px solid var(--nwc-accent);
    outline-offset: 2px;
}

.app-notif-trigger[aria-expanded=true] {
    background-color: var(--nwc-accent-subtle);
}

.app-notif-icon {
    font-size: 1.5rem;
    color: var(--nwc-text-secondary);
}

.app-notif-badge {
    position: absolute;
    top: 0.15rem;
    inset-inline-end: 0.15rem;
    min-width: 1.25rem;
    height: 1.25rem;
    padding-inline: 0.3rem;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: var(--nwc-radius-full);
    background: var(--nwc-danger);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 0 0 2px #fff;
}

/* Arrival signal of a live unread push (NotificationBellWidget.announceArrival): swing + badge pop, once. */
@media (prefers-reduced-motion: no-preference) {
    .app-notif-trigger--arrived .app-notif-icon {
        transform-origin: 50% 0;
        animation: app-notif-icon-swing 0.8s ease-in-out 1;
    }

    .app-notif-trigger--arrived .app-notif-badge {
        animation: app-notif-badge-pop 0.8s ease-out 1;
    }
}

@keyframes app-notif-icon-swing {
    0%, 100% {
        transform: rotate(0deg);
    }
    15% {
        transform: rotate(14deg);
    }
    30% {
        transform: rotate(-12deg);
    }
    45% {
        transform: rotate(8deg);
    }
    60% {
        transform: rotate(-5deg);
    }
    75% {
        transform: rotate(2deg);
    }
}

@keyframes app-notif-badge-pop {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 2px #fff, 0 0 0 2px color-mix(in srgb, var(--nwc-danger) 55%, transparent);
    }
    25% {
        transform: scale(1.35);
    }
    50% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 2px #fff, 0 0 0 10px color-mix(in srgb, var(--nwc-danger) 0%, transparent);
    }
}

.app-notif-dropdown {
    position: absolute;
    top: calc(100% + 0.4rem);
    inset-inline-end: 0;
    display: none;
    flex-direction: column;
    color: var(--nwc-text-primary);
    width: 24rem;
    max-width: calc(100vw - 1rem);
    max-height: 32rem;
    padding: 0.5rem;
    border: 1px solid rgba(24, 34, 52, 0.1);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    box-shadow: 0 1rem 2rem rgba(15, 23, 42, 0.18);
    z-index: 40;
    overflow: hidden;
}

.app-notif-menu-open .app-notif-dropdown {
    display: flex;
}

.app-notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
    padding: 0.4rem 0.5rem 0.6rem;
    border-bottom: 1px solid var(--nwc-border-subtle);
}

.app-notif-mark-all-btn {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nwc-accent);
    cursor: pointer;
    padding: 0.1rem 0.3rem;
    border-radius: var(--nwc-radius-sm);
    transition: background-color var(--nwc-duration-fast);
    white-space: nowrap;
}

.app-notif-mark-all-btn:hover,
.app-notif-mark-all-btn:focus-visible {
    background-color: var(--nwc-accent-subtle);
}

.app-notif-mark-all-btn-disabled {
    color: var(--nwc-text-muted);
    cursor: default;
    pointer-events: none;
}

.app-notif-list {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    max-height: 28rem;
}

/* Row chrome: [severity circle] [main: head (title · time), context, body, footer] */
.app-notif-row {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding-block: 0.7rem;
    padding-inline: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--nwc-border-subtle);
    border-inline-start: 3px solid transparent;
    cursor: default;
    transition: background-color var(--nwc-duration-fast);
}

.app-notif-row:last-child {
    border-bottom: none;
}

.app-notif-row-clickable {
    cursor: pointer;
}

.app-notif-row-clickable:hover {
    background-color: var(--nwc-row-hover);
}

.app-notif-row:focus-visible {
    outline: 2px solid var(--nwc-accent);
    outline-offset: -2px;
}

.app-notif-row-unread {
    border-inline-start-color: var(--nwc-accent);
    background-color: var(--nwc-accent-subtle);
}

.app-notif-row-unread.app-notif-row-clickable:hover {
    background-color: color-mix(in srgb, var(--nwc-accent) 14%, transparent);
}

/* A row that just arrived live starts stronger and settles into its own background (no `to` frame). */
@media (prefers-reduced-motion: no-preference) {
    .app-notif-row--arrived {
        animation: app-notif-row-arrive 2s ease-out 1;
    }
}

@keyframes app-notif-row-arrive {
    from {
        background-color: color-mix(in srgb, var(--nwc-accent) 28%, transparent);
    }
}

.app-notif-sev-icon {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--nwc-radius-full);
}

.app-notif-sev-success {
    background: color-mix(in srgb, var(--nwc-success) 12%, transparent);
    color: var(--cai-text-success);
}

.app-notif-sev-warning {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

.app-notif-sev-error {
    background: var(--nwc-danger-subtle);
    color: var(--nwc-danger);
}

.app-notif-sev-info {
    background: color-mix(in srgb, var(--nwc-info) 14%, transparent);
    color: var(--cai-text-info);
}

.app-notif-sev-neutral {
    background: var(--nwc-border-subtle);
    color: var(--nwc-text-secondary);
}

.app-notif-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.app-notif-head {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
}

.app-notif-head .app-notif-title {
    flex: 1;
    min-width: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

/* Time and read/delete actions share one grid cell: the swap on hover never reflows the title. */
.app-notif-meta {
    flex: 0 0 auto;
    display: grid;
    align-items: center;
    justify-items: end;
    height: 1.12rem;
}

.app-notif-meta > * {
    grid-area: 1 / 1;
}

.app-notif-row:hover .app-notif-timestamp,
.app-notif-row:focus-within .app-notif-timestamp {
    visibility: hidden;
}

.app-notif-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    line-height: 1.4;
}

.app-notif-context {
    font-size: 0.72rem;
    color: var(--nwc-text-muted);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-notif-timestamp {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: var(--nwc-text-secondary);
    line-height: 1;
    white-space: nowrap;
}

.app-notif-content {
    min-width: 0;
}

.app-notif-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.15rem;
}

/* Body parts (NotificationParts) */
.app-notif-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.app-notif-transition,
.app-notif-fact {
    font-size: 0.75rem;
    color: var(--nwc-text-secondary);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.app-notif-quote {
    margin: 0;
    padding-inline-start: 0.5rem;
    border-inline-start: 2px solid var(--nwc-border-subtle);
    font-size: 0.75rem;
    font-style: italic;
    color: var(--nwc-text-secondary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.app-notif-actor {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    font-size: 0.75rem;
    color: var(--nwc-text-secondary);
}

.app-notif-actor-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-notif-link {
    align-self: flex-start;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.75rem;
    color: var(--nwc-accent);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.app-notif-attachment {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 100%;
    padding-block: 0.15rem;
    padding-inline: 0.4rem;
    border: 1px solid var(--nwc-border-subtle);
    border-radius: var(--nwc-radius-sm);
    background: var(--nwc-ui-surface);
    font: inherit;
    font-size: 0.75rem;
    color: var(--nwc-text-primary);
    cursor: pointer;
    transition: border-color var(--nwc-duration-fast), color var(--nwc-duration-fast);
}

.app-notif-attachment:hover {
    border-color: var(--nwc-accent);
    color: var(--nwc-accent);
}

.app-notif-attachment-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Footer: only rows with a primary action have one */
.app-notif-row-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.2rem;
}

.app-notif-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    max-width: 60%;
    padding-block: 0.2rem;
    padding-inline: 0.5rem;
    border: 1px solid var(--nwc-accent);
    border-radius: var(--nwc-radius-sm);
    background: var(--nwc-ui-surface);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nwc-accent);
    cursor: pointer;
    transition: background-color var(--nwc-duration-fast);
}

.app-notif-primary-action:hover {
    background: var(--nwc-accent-subtle);
}

.app-notif-primary-action-label {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-notif-row-actions {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    visibility: hidden;
}

.app-notif-row:hover .app-notif-row-actions,
.app-notif-row:focus-within .app-notif-row-actions {
    visibility: visible;
}

.app-notif-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    padding: 0;
    border: none;
    border-radius: var(--nwc-radius-sm);
    background: transparent;
    color: var(--nwc-text-secondary);
    cursor: pointer;
    transition: background-color var(--nwc-duration-fast), color var(--nwc-duration-fast);
}

.app-notif-action-btn:hover,
.app-notif-action-btn:focus-visible {
    background-color: var(--nwc-border-subtle);
    color: var(--nwc-text-primary);
}

.app-notif-delete-btn:hover,
.app-notif-delete-btn:focus-visible {
    background-color: var(--nwc-danger-subtle);
    color: var(--nwc-danger);
}

/* CSS-driven read/unread toggle icons */
.app-notif-row-unread .app-notif-act-icon-unread,
.app-notif-row:not(.app-notif-row-unread) .app-notif-act-icon-read {
    display: none;
}

/* Empty / load-error states */
.app-notif-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding-block: 1.5rem;
    padding-inline: 1rem;
    text-align: center;
}

.app-notif-state-title {
    font-size: 0.8rem;
    color: var(--nwc-text-secondary);
}

.app-main-content {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background: var(--nwc-basic-background);
}

.app-shell-body > .wc-ui-loading-overlay-page {
    position: absolute;
}

/* Reserve the scrollbar track so the SAS-to-R wizard does not shift sideways when content loads and a scrollbar appears. */
.app-main-content:has(.project-sas2r-wizard) {
    scrollbar-gutter: stable;
}

/* Page templates own their content viewport so the shared header stays fixed. */
.app-main-content:has(.app-content-body > .wc-structured-panel),
.app-content-body:has(> .wc-structured-panel) {
    overflow: hidden;
}

.app-content-body > .wc-structured-panel > .wc-structured-panel-header {
    flex-shrink: 0;
}

.app-content-body > .wc-structured-panel > .wc-structured-panel-content:not(.app-grid-page-grid-shell) {
    overflow: auto;
    scrollbar-width: none;
}

/* AG Grid provides its own viewport and must not gain a second scrollbar. */
.app-content-body > .wc-structured-panel > .app-grid-page-grid-shell {
    overflow: hidden;
}

.app-main-content .wc-structured-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
    "title actions"
    "desc actions";
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.2rem;
}

.app-main-content .wc-structured-panel-heading {
    grid-area: title;
    min-width: 0;
}

.app-main-content .wc-structured-panel-desc {
    grid-area: desc;
    min-width: 0;
}

.app-main-content .wc-structured-panel-actions {
    grid-area: actions;
    width: auto;
    align-self: center;
}

@media (max-width: 720px) {
    .app-main-content .wc-structured-panel-header {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
        "title"
        "desc"
        "actions";
        align-items: flex-start;
    }

    .app-main-content .wc-structured-panel-actions {
        width: 100%;
    }
}

.legacy-module-card {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100% - 4px);
    height: 100%;
}

.app-content-title {
    font-size: 24px;
    font-weight: 700;
}

.app-content-description {
    font-size: 14px;
    color: var(--muted);
}

.app-content-description:empty {
    display: none;
}

.app-content-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.app-grid-page-surface {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-grid-page-surface > nph-tab-panel.project-tokens-environment-tabs {
    flex: 0 0 auto;
    --content-padding: 0.75rem;
}

.project-study-execution {
    display: flex;
    flex-direction: column;
    gap: 12px;
    height: 100%;
    min-height: 0;
    color: var(--nwc-text-primary);
}

.project-study-execution-context {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.project-study-execution-context-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 10px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 6px;
    background: var(--nwc-ui-surface);
}

.project-study-execution-context-key {
    font-size: 11px;
    font-weight: 700;
    color: var(--nwc-text-secondary);
    text-transform: uppercase;
}

.project-study-execution-context-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.project-study-execution-stage-strip {
    display: flex;
    align-items: center;
    gap: 0;
    min-height: 48px;
    padding: 0 12px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--nwc-ui-surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
    position: sticky;
    top: 0;
    z-index: 20;
}

.project-study-execution-stage-strip::-webkit-scrollbar {
    display: none;
}

.project-study-execution-stage-step {
    position: relative;
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
    gap: 7px;
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 6px;
    color: var(--nwc-text-secondary);
    white-space: nowrap;
    transition: background 0.12s ease, color 0.12s ease;
    outline: none;
}

.project-study-execution-stage-step:not(:last-child)::after {
    content: "›";
    margin-left: 4px;
    color: #cbd5e1;
    font-size: 13px;
    font-weight: 700;
}

.project-study-execution-stage-step--clickable {
    cursor: pointer;
}

.project-study-execution-stage-step--clickable:hover,
.project-study-execution-stage-step--clickable:focus-visible {
    background: var(--nwc-ui-surface-soft);
}

.project-study-execution-stage-step--active {
    background: var(--nwc-accent-subtle);
    color: var(--nwc-accent);
}

.project-study-execution-stage-step--active.project-study-execution-stage-step--clickable:hover,
.project-study-execution-stage-step--active.project-study-execution-stage-step--clickable:focus-visible {
    background: var(--nwc-accent-subtle);
}

.project-study-execution-stage-step--done {
    color: #166534;
}

.project-study-execution-stage-index {
    width: 20px;
    height: 20px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
    font-size: 10px;
    font-weight: 800;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.project-study-execution-stage-step--active .project-study-execution-stage-index {
    background: #2563eb;
    color: #ffffff;
}

.project-study-execution-stage-step--done .project-study-execution-stage-index {
    background: #22c55e;
    color: #ffffff;
}

.project-study-execution-stage-step--active .project-study-execution-stage-meta {
    color: #1d4ed8;
}

.project-study-execution-stage-step--done .project-study-execution-stage-meta {
    color: #166534;
}

.project-study-execution-stage-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.project-study-execution-stage-title {
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 700;
    color: currentColor;
}

.project-study-execution-stage-meta {
    margin-top: 1px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.project-study-execution-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
    gap: 12px;
    min-height: 0;
    flex: 1;
}

.project-study-execution-main,
.project-study-execution-rail {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    min-height: 0;
}

.project-study-execution .wc-ui-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 6px;
    background: var(--nwc-ui-surface);
}

.project-study-execution .wc-ui-section-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--nwc-text-primary);
}

.project-study-execution-status {
    min-width: 0;
}

.project-study-execution-status:empty {
    display: none;
}

.project-study-execution-activity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--nwc-ui-border);
    border-left-width: 4px;
    border-radius: 6px;
    background: var(--nwc-ui-surface);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.project-study-execution-activity--neutral {
    border-left-color: #94a3b8;
}

.project-study-execution-activity--info {
    border-left-color: #2563eb;
}

.project-study-execution-activity--success {
    border-left-color: #16a34a;
}

.project-study-execution-activity--warning {
    border-left-color: #d97706;
}

.project-study-execution-activity--error {
    border-left-color: #dc2626;
}

.project-study-execution-activity-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 104px;
}

.project-study-execution-activity-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 999px;
    background: #94a3b8;
}

.project-study-execution-activity--info .project-study-execution-activity-dot {
    background: #2563eb;
}

.project-study-execution-activity--success .project-study-execution-activity-dot {
    background: #16a34a;
}

.project-study-execution-activity--warning .project-study-execution-activity-dot {
    background: #d97706;
}

.project-study-execution-activity--error .project-study-execution-activity-dot {
    background: #dc2626;
}

.project-study-execution-activity--active .project-study-execution-activity-dot {
    animation: project-study-execution-pulse 1.1s ease-in-out infinite;
}

.project-study-execution-activity-state {
    font-size: 12px;
    font-weight: 800;
    color: var(--nwc-text-primary);
    white-space: nowrap;
}

.project-study-execution-activity-body {
    min-width: 0;
}

.project-study-execution-activity-summary {
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 13px;
    font-weight: 700;
    color: var(--nwc-text-primary);
}

.project-study-execution-activity-meta {
    margin-top: 2px;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 11px;
    color: var(--nwc-text-secondary);
}

@keyframes project-study-execution-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.24);
    }
    70% {
        box-shadow: 0 0 0 7px rgba(37, 99, 235, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.project-study-execution-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    align-items: start;
    padding: 6px 0;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.project-study-execution-row:last-child {
    border-bottom: none;
}

.project-study-execution-row-key {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    font-size: 12px;
    font-weight: 700;
    color: var(--nwc-text-secondary);
}

.project-study-execution-row-value {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    line-height: 1.35;
    font-size: 12px;
    color: var(--nwc-text-primary);
}

.project-study-execution-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.project-study-execution-panel-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--nwc-text-primary);
}

.project-study-execution-panel-subtitle {
    margin-top: -3px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--nwc-text-secondary);
}

.project-study-execution-runs {
    min-width: 0;
    overflow-x: auto;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 6px;
    background: var(--nwc-ui-surface);
}

.project-study-execution-runs-row {
    display: grid;
    grid-template-columns:
        minmax(90px, 0.7fr)
        minmax(136px, 1fr)
        minmax(160px, 1.35fr)
        minmax(130px, 1fr)
        minmax(120px, 0.85fr)
        minmax(110px, 0.8fr)
        minmax(176px, auto);
    min-width: 940px;
    align-items: center;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.project-study-execution-runs-row:last-child {
    border-bottom: none;
}

.project-study-execution-runs-row--header {
    background: var(--nwc-ui-surface-soft);
}

.project-study-execution-runs-row--header .project-study-execution-runs-cell {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.project-study-execution-runs-cell {
    min-width: 0;
    padding: 8px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    line-height: 1.35;
    font-size: 12px;
    color: var(--nwc-text-primary);
}

.project-study-execution-runs-final {
    display: inline-flex;
    align-items: center;
    margin-left: 6px;
    min-height: 18px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
    font-size: 10px;
    font-weight: 800;
    vertical-align: middle;
}

.project-study-execution-runs-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
    padding: 5px 8px;
}

.project-study-execution-run-action {
    min-width: 48px;
    min-height: 28px;
    font-size: 11px;
}

.project-study-execution-status-badge {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.project-study-execution-status-badge--neutral {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.project-study-execution-status-badge--info {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
}

.project-study-execution-status-badge--success {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.project-study-execution-status-badge--warning {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.project-study-execution-status-badge--error {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

@media (max-width: 980px) {
    .project-study-execution-stage-strip {
        padding: 7px 8px;
    }

    .project-study-execution-stage-step {
        padding: 6px 8px;
    }

    .project-study-execution-workbench {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-study-execution-activity {
        grid-template-columns: minmax(0, 1fr);
    }

    .project-study-execution-activity-indicator {
        min-width: 0;
    }
}

.aria-assistant-page,
.aria-assistant-page > .wc-structured-panel-content,
.aria-assistant-root {
    min-height: 0;
    height: 100%;
}

.aria-assistant-page {
    overflow: hidden;
}

.aria-assistant-page > .wc-structured-panel-content {
    padding: 0;
}

.aria-assistant-root {
    display: flex;
    flex-direction: column;
}

.aria-assistant-float-button {
    white-space: nowrap;
}

.support-api-reference-page,
.support-api-reference-page > .wc-structured-panel-content {
    min-height: 0;
    height: 100%;
}

.support-api-reference-page > .wc-structured-panel-content {
    padding: 0;
}

.support-api-reference-mount {
    width: 100%;
    height: 100%;
    overflow: auto;
}

/* The heading text sits two levels deep (<h3 class="opblock-tag"><a class="nostyle"><span>).
   nphase-wc-bundle.min.css has a "* { font-weight: 400 }" universal-selector rule that applies
   directly to that inner <span> itself — a value applied directly to an element always beats an
   inherited one from a bolded ancestor, regardless of that direct rule's own (here: zero)
   specificity. Targeting every descendant (not just direct children) closes that gap; <small>
   (and anything inside it) is excluded to keep the description at normal weight, matching
   nphase's own look. */
.support-api-reference-mount .opblock-tag,
.support-api-reference-mount .opblock-tag :not(small):not(small *) {
    font-weight: 700 !important;
}

/* Same universal-selector situation as .opblock-tag above. */
.support-api-reference-mount .opblock-summary-path,
.support-api-reference-mount .opblock-summary-path__deprecated,
.support-api-reference-mount .opblock-summary-path *,
.support-api-reference-mount .opblock-summary-path__deprecated * {
    font-weight: 700 !important;
}

.support-api-directory-page,
.support-api-directory-page > .wc-structured-panel-content {
    min-height: 0;
    height: 100%;
}

.support-api-directory-mount {
    width: 100%;
    height: 100%;
    overflow: auto;
    scroll-behavior: smooth;
    padding: 1.5rem;
    box-sizing: border-box;
}

.support-api-directory-layout {
    display: flex;
    align-items: flex-start;
    gap: 2.5rem;
    max-width: 90rem;
}

.support-api-directory-toc {
    position: sticky;
    top: 0;
    flex: 0 0 12rem;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    border-left: 2px solid var(--line);
    padding-left: 0.9rem;
    font-size: 0.8rem;
}

.support-api-directory-toc a {
    color: var(--muted);
    text-decoration: none;
    padding: 0.15rem 0;
    width: fit-content;
}

.support-api-directory-toc a:hover {
    color: var(--nwc-accent-active, var(--primary));
}

.support-api-directory-content {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.support-api-directory-section {
    scroll-margin-top: 1rem;
}

.support-api-directory-section h2 {
    margin: 0 0 0.3rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.support-api-directory-section-description {
    color: var(--muted);
    margin: 0 0 1rem;
    font-size: 0.875rem;
    max-width: 68ch;
}

/* Same look as .library-sdtm-table, but with tokens that resolve outside .library-sdtm-surface */
.support-api-directory-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--nwc-ui-surface);
    border: 1px solid var(--line);
}

.support-api-directory-table th {
    padding: 0.45rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    color: var(--text-gray-color);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 1px solid var(--nwc-ui-border);
    white-space: nowrap;
}

.support-api-directory-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--nwc-ui-border);
    font-size: 0.82rem;
    color: var(--tabs-panel-color);
    vertical-align: top;
}

.support-api-directory-table tr:last-child td {
    border-bottom: none;
}

.support-api-directory-table .support-api-directory-mono {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.78rem;
    white-space: nowrap;
}

.support-api-directory-table .support-api-directory-muted {
    color: var(--text-gray-color);
}

.support-api-directory-overview {
    margin-bottom: 1rem;
}

.support-api-directory-card {
    background: var(--nwc-ui-surface);
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.support-api-directory-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
}

.support-api-directory-card-header:hover {
    background: var(--nwc-ui-surface-soft);
}

.support-api-directory-path {
    flex: 1 1 auto;
    min-width: 0;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text);
    overflow-x: auto;
    white-space: nowrap;
}

.support-api-directory-chevron {
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    margin-right: 0.25rem;
    border-right: 2px solid var(--text-gray-color);
    border-bottom: 2px solid var(--text-gray-color);
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}

.support-api-directory-card-header[aria-expanded="true"] .support-api-directory-chevron {
    transform: rotate(45deg);
}

.support-api-directory-card-body {
    padding: 1rem;
    border-top: 1px solid var(--nwc-ui-border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.support-api-directory-card-summary {
    margin: 0;
    color: var(--tabs-panel-color);
    font-size: 0.875rem;
    max-width: 68ch;
}

.support-api-directory-label {
    margin: 0 0 0.4rem;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-gray-color);
}

.support-api-directory-fields {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
}

.support-api-directory-field {
    display: grid;
    grid-template-columns: 14rem minmax(0, 1fr);
    gap: 1rem;
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.support-api-directory-field:last-child {
    border-bottom: none;
}

.support-api-directory-field-name {
    min-width: 0;
    overflow-wrap: anywhere;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.8rem;
    color: var(--text);
}

.support-api-directory-field-meta {
    display: block;
    margin-top: 0.1rem;
    font-size: 0.72rem;
    color: var(--text-gray-color);
}

.support-api-directory-field-required {
    color: #92400e;
    font-weight: 600;
}

.support-api-directory-field-description {
    font-size: 0.82rem;
    color: var(--tabs-panel-color);
}

.support-api-directory-field-description.support-api-directory-field-description--empty {
    color: #B0BEC5;
}

/* Dark example block — same recipe as .prod-code-block */
.support-api-directory-sample {
    margin: 0;
    padding: 0.75rem 0.9rem;
    border-radius: 0.375rem;
    background: #1C2333;
    color: #CBD5E1;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre;
}

.support-api-directory-sample .support-api-directory-json-key {
    color: #8FB8DB;
}

.support-api-directory-sample .support-api-directory-json-string {
    color: #A8CFA0;
}

.support-api-directory-sample .support-api-directory-json-literal {
    color: #E0B080;
}

.support-api-directory-codes {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid var(--nwc-ui-border);
}

.support-api-directory-method-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 3.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
}

.support-api-directory-table .support-api-directory-method-badge {
    min-width: 3rem;
    font-size: 0.65rem;
}

.support-api-directory-method-badge[data-method="GET"] {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-primary);
}

.support-api-directory-method-badge[data-method="POST"] {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.support-api-directory-method-badge[data-method="PUT"],
.support-api-directory-method-badge[data-method="PATCH"] {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.support-api-directory-method-badge[data-method="DELETE"] {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

[data-testid="aria-shell"] .wc-ui-assistant-session-meta {
    box-sizing: border-box;
    width: 100%;
    overflow: hidden;
}

[data-testid="aria-shell"] .wc-ui-assistant-session-details {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

[data-testid="aria-shell"] .wc-ui-assistant-session-subtitle {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
}

[data-testid="aria-shell"] .wc-ui-assistant-session-subtitle-text {
    display: block;
    flex: 1 1 0;
    width: 0;
    max-width: 100%;
    min-width: 0;
}

.aria-ai-disclosure {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.5rem;
    margin: 0.75rem 1rem 0;
}

.aria-ai-disclosure-notice,
.aria-ai-disclosure-error {
    width: 100%;
    max-width: none;
    min-width: 0;
    inline-size: 100%;
    max-inline-size: none;
    min-inline-size: 0;
}

.aria-ai-disclosure-collapsed {
    display: none;
}

.aria-ai-disclosure-error {
    grid-column: 1 / -1;
}

/* Core Config grid shells stretch into the space their section cards receive. The
   cards and section surfaces below establish the flex/height chain; keep a usable
   minimum without pinning the grid to a fixed viewport. */
.core-config-rtp-grid-shell,
.core-config-ps-grid-shell,
.core-config-as-grid-shell,
.core-config-ta-grid-shell,
.core-config-arm-grid-shell,
.core-config-sf-grid-shell {
    flex: 1 1 auto;
    min-height: 16rem;
}

.wc-ui-section:has(> .core-config-rtp-grid-shell),
.wc-ui-section:has(> .core-config-ps-grid-shell),
.wc-ui-section:has(> .core-config-as-grid-shell),
.wc-ui-section:has(> .core-config-ta-grid-shell),
.wc-ui-section:has(> .core-config-arm-grid-shell),
.wc-ui-section:has(> .core-config-sf-grid-shell) {
    flex: 1 1 auto;
    min-height: 0;
}

.core-config-rtp-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* Compound & Classification tab panels — vertical spacing between the A/B/C
   sub-section cards within each tab. */
.compound-tab-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 0;
    padding-top: 0.75rem;
    overflow-y: auto;
}

/* Estimand intercurrent events — fixed event rows, one strategy dropdown each
   (wireframe: Intercurrent Event / Strategy table). */
.core-config-estimand-events {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.core-config-estimand-event-empty {
    font-size: 0.82rem;
    color: var(--nwc-text-secondary);
}

.core-config-estimand-event-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0.625rem;
    border-radius: 0.375rem;
    background: var(--nwc-ui-surface-soft);
    font-size: 0.82rem;
    color: var(--nwc-text-primary);
}

.core-config-estimand-event-label {
    font-weight: 600;
}

/* Submission Targets — selected regulatory authorities shown as removable chips
   above the "+ Add authority" dropdown (Core Config wireframe Card 1). */
.core-config-authority-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.625rem;
}

.core-config-authority-chips-empty {
    font-size: 0.82rem;
    color: var(--nwc-text-secondary);
}

.cai-user-picker {
    position: relative;
    --nwc-suggestion-position: static;
    --nwc-suggestion-popup-inset-inline-start: 11.5rem;
    --nwc-suggestion-popup-inline-size: min(28.75rem, calc(100% - 11.5rem));
    --nwc-suggestion-popup-max-block-size: 15rem;
    --nwc-suggestion-list-overflow-x: auto;
    --nwc-suggestion-row-font-family: var(--nwc-font-primary);
    --nwc-suggestion-row-font-size: 1rem;
    --nwc-suggestion-row-font-weight: 400;
    --nwc-suggestion-row-line-height: 1.7;
    --nwc-suggestion-row-color: currentColor;
    --nwc-suggestion-secondary-line-height: 1.7;
}

.cai-user-picker--compact {
    --nwc-suggestion-popup-inset-inline-start: 0;
    --nwc-suggestion-popup-inline-size: 100%;
}

/* Selected options use public Tag tokens. The label follows the measured global
   font reset; the close glyph retains its separate legacy typography. */
.cai-role-chip,
.cai-selected-chip {
    --nwc-tag-font-family: var(--nwc-font-primary);
    --nwc-tag-font-size: 1rem;
    --nwc-tag-font-weight: 400;
    --nwc-tag-line-height: 1.7;
    --nwc-tag-background: var(--nwc-ui-surface-soft);
    --nwc-tag-color: #334155;
    --nwc-tag-border-width: 0;
    --nwc-tag-radius: .75rem;
    --nwc-tag-gap: .375rem;
    --nwc-tag-min-block-size: auto;
    --nwc-tag-padding-block: .125rem;
    --nwc-tag-padding-inline: .625rem;
    --nwc-tag-max-inline-size: none;
    --nwc-tag-label-white-space: normal;
    --nwc-tag-label-overflow: visible;
    --nwc-tag-label-text-overflow: clip;
    --nwc-tag-close-font-size: .72rem;
    --nwc-tag-close-font-weight: 400;
    --nwc-tag-close-line-height: 1;
    --nwc-tag-close-inline-size: auto;
    --nwc-tag-close-margin-inline-end: 0;
    --nwc-tag-close-opacity: .6;
    --nwc-tag-close-hover-opacity: 1;
}

.core-config-authority-picker-host {
    max-width: 21.25rem;
}

.library-tlf-surface {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.library-tlf-zone-section {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.library-tlf-zone-section > nph-tab-panel {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
}

.library-tlf-surface .app-grid-page-surface {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.library-tlf-surface .app-grid-page-grid-shell {
    flex: 1 1 0;
    height: auto;
    min-height: 12.5rem;
}

/* The CSR Prompt Packages and Review Routes tabs stack sized grids under headers and details, so they are taller than
   the fill-height surface, whose clipped tab showed one grid row. While one is open the surface takes its content
   height and the page scrolls (CAI-588). */
.library-tlf-surface[data-page-scroll],
.library-tlf-surface[data-page-scroll] .library-tlf-zone-section {
    flex: none;
    height: auto;
    overflow: visible;
}

.library-tlf-surface[data-page-scroll] .library-tlf-zone-section > nph-tab-panel {
    flex: none;
    height: auto;
}

/* The OVL rules page replaces the content body, outside .library-tlf-surface; without its own height the AG Grid
   body collapses to zero and only the pager shows. */
.library-tlf-ovl-rules-surface > .app-grid-page-grid-shell {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 12.5rem;
}

.app-grid-page-grid-shell:not(.ag-theme-quartz) {
    min-width: 0;
    overflow: auto;
}

.app-grid-page-grid-shell:not(.ag-theme-quartz) > .wc-structured-panel {
    flex: 1 1 auto;
    min-height: 0;
}

.app-grid-page-grid-shell:not(.ag-theme-quartz) > .wc-structured-panel > .wc-structured-panel-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.app-grid-page-grid-shell.project-allowed-images-grid,
.app-grid-page-grid-shell.project-allowed-resources-grid,
.app-grid-page-grid-shell.project-ars-reporting-events-grid,
.app-grid-page-grid-shell.project-allowed-images-grid > .wc-structured-panel,
.app-grid-page-grid-shell.project-allowed-resources-grid > .wc-structured-panel,
.app-grid-page-grid-shell.project-allowed-images-grid > .wc-structured-panel > .wc-structured-panel-content,
.app-grid-page-grid-shell.project-allowed-resources-grid > .wc-structured-panel > .wc-structured-panel-content {
    height: 100%;
}

.project-details-section-panel[data-section-panel="study-documents"],
.project-details-section-panel[data-section-panel="study-documents"] .core-config-study-documents,
.project-details-section-panel[data-section-panel="study-documents"] > .core-config-study-documents > .core-config-section-body,
.project-details-section-panel[data-section-panel="study-documents"] .wc-ui-section,
.project-details-section-panel[data-section-panel="study-documents"] .wc-ui-section nph-tab-panel,
.core-config-study-documents-tab-content,
.core-config-study-documents-grid-shell,
.project-details-section-panel[data-section-panel="treatment-arm"],
.project-details-section-panel[data-section-panel="treatment-arm"] .core-config-treatment-arm,
.project-details-section-panel[data-section-panel="treatment-arm"] > .core-config-treatment-arm > .core-config-section-body,
.project-details-section-panel[data-section-panel="treatment-arm"] .wc-ui-section,
.project-details-section-panel[data-section-panel="treatment-arm"] .wc-ui-section nph-tab-panel,
.project-details-section-panel[data-section-panel="population-set"],
.project-details-section-panel[data-section-panel="population-set"] .core-config-population-set,
.project-details-section-panel[data-section-panel="population-set"] > .core-config-population-set > .core-config-section-body,
.project-details-section-panel[data-section-panel="population-set"] .wc-ui-section,
.project-details-section-panel[data-section-panel="population-set"] .wc-ui-section nph-tab-panel,
.project-details-section-panel {
    height: 100%;
}

.embedded-grid-panel {
    min-height: 0;
    width: 100%;
    height: 100%;
}

.embedded-grid-panel > .wc-structured-panel-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.tabbed-content-shell.tabbed-grid-shell {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tabbed-grid-body {
    flex: 1 1 auto;
    min-height: 0;
}

.app-content-list {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: var(--nwc-text-primary);
}

.app-content-list li {
    margin: 3px 0;
}

.app-status {
    min-height: 22px;
    font-size: 13px;
}

.app-status:empty {
    display: none;
}

.app-status-info {
    color: var(--muted);
}

.app-status-error {
    color: var(--danger);
}

.projects-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

.projects-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-bottom: 1rem;
}

.projects-panel-heading {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.projects-panel-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.projects-panel-subtitle {
    color: var(--text-gray-color);
    font-size: 0.95rem;
}

.projects-panel-tools {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.projects-search-input,
.records-search-input {
    min-width: 260px;
    max-width: 320px;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    background: var(--nwc-ui-surface);
}

.projects-search-input:focus,
.records-search-input:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 99, 246, 0.12);
}

.wc-ui-records-actions-cell {
    justify-content: flex-end;
}

.wc-ui-records-action-menu {
    position: relative;
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.wc-ui-records-menu-trigger {
    min-width: 2.1rem;
    padding: 0.42rem 0.62rem;
    font-size: 1.1rem;
    line-height: 1;
}

.wc-ui-records-action-dropdown {
    position: absolute;
    top: calc(100% + 0.35rem);
    right: 0;
    z-index: 30;
    display: none;
    flex-direction: column;
    gap: 0.22rem;
    min-width: 11.5rem;
    padding: 0.35rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 10px;
    background: var(--nwc-ui-surface);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.12);
}

.wc-ui-records-action-dropdown-open {
    display: flex;
}

.wc-ui-records-action-item {
    width: 100%;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--nwc-text-primary);
    padding: 0.52rem 0.68rem;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    text-align: left;
    cursor: pointer;
}

.wc-ui-records-action-item:hover {
    background: var(--nwc-ui-surface-soft);
}

.wc-ui-records-action-item-danger {
    color: #9b1c1c;
}

.wc-ui-records-action-item-danger:hover {
    background: var(--nwc-error-subtle);
}

.projects-panel-summary {
    color: var(--text-gray-color);
    font-size: 0.92rem;
}

.projects-table,
.records-table {
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    background: var(--nwc-ui-surface);
}

.project-overview-shell {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-screen {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.detail-screen-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.detail-screen-heading {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.detail-screen-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.detail-screen-subtitle {
    color: var(--text-gray-color);
    font-size: 0.95rem;
}

.detail-screen-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.detail-screen-actions:empty,
.detail-screen-summary:empty,
.detail-screen-tabs:empty {
    display: none;
}

.detail-screen-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.9rem;
    margin-bottom: 1rem;
}

.detail-screen-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.95rem 1rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.detail-screen-summary-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-gray-color);
}

.detail-screen-summary-value {
    font-size: 1rem;
    line-height: 1.45;
    color: var(--text);
    word-break: break-word;
}

.detail-screen-summary-value-empty {
    color: var(--muted);
}

.detail-screen-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.detail-screen-body {
    display: flex;
    flex-direction: column;
    margin-top: 0.5em;
    gap: 18px;
    min-height: 0;
}

.projects-table-row,
.records-table-row {
    display: grid;
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(140px, 1fr) 110px;
    gap: 1rem;
    align-items: center;
    padding: 0.95rem 1.1rem;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.projects-table-row:last-child,
.records-table-row:last-child {
    border-bottom: 0;
}

.projects-table-row-header,
.records-table-row-header {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.projects-table-cell,
.records-table-cell {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.projects-empty-state,
.records-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 3rem 1.5rem;
    text-align: center;
}

.projects-empty-image,
.records-empty-image {
    width: 160px;
    max-width: 100%;
    height: auto;
    opacity: 0.94;
}

.projects-empty-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.projects-empty-subtitle,
.records-empty-subtitle {
    max-width: 32rem;
    color: var(--text-gray-color);
    font-size: 0.92rem;
}

.entity-details-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 100%;
}

.entity-details-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.entity-details-heading {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.entity-details-title {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.entity-details-subtitle {
    color: var(--text-gray-color);
    font-size: 0.95rem;
}

.entity-details-body {
    display: flex;
    flex: 1;
    min-height: 0;
}

.entity-details-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.entity-details-item {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 1rem 1rem 1.05rem;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
    min-height: 112px;
}

.entity-details-item-wide {
    grid-column: 1 / -1;
    min-height: 140px;
}

.entity-details-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-gray-color);
}

.entity-details-value {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

.entity-details-value-empty {
    color: var(--muted);
}

.entity-details-state {
    width: 100%;
    min-height: 360px;
    border: 1px dashed var(--nwc-ui-border);
    border-radius: 18px;
    background: var(--nwc-ui-surface-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 2rem;
    text-align: center;
}

.entity-details-state-loading {
    background: radial-gradient(circle at top, rgba(11, 99, 246, 0.08), rgba(248, 250, 252, 0.98) 56%);
}

.entity-details-state-error {
    border-color: rgba(191, 47, 47, 0.22);
    background: radial-gradient(circle at top, rgba(191, 47, 47, 0.08), rgba(255, 250, 250, 0.98) 56%);
}

.entity-details-state-image {
    width: min(180px, 100%);
    height: auto;
    opacity: 0.96;
}

.entity-details-spinner {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 4px solid rgba(11, 99, 246, 0.18);
    border-top-color: var(--primary);
    animation: entity-details-spin 0.9s linear infinite;
}

.entity-details-state-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--tabs-panel-color);
}

.entity-details-state-subtitle {
    max-width: 34rem;
    font-size: 0.95rem;
    color: var(--text-gray-color);
    line-height: 1.55;
}

@keyframes entity-details-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.admin-project-surface {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-project-users-grid-shell {
    flex: none;
    height: calc(100vh - 26rem);
    min-height: 20rem;
    overflow-y: auto;
}

.admin-project-surface-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.admin-project-surface-heading {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.admin-project-surface-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
}

.admin-project-surface-subtitle {
    color: var(--nwc-text-secondary);
    font-size: 0.98rem;
    max-width: 60rem;
}

.admin-project-surface-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
}

.surface-tabs {
    --mod-tabs-divider-size: 0;
    --mod-tabs-selection-indicator-color: transparent;
    --mod-tabs-item-horizontal-spacing: 0;
    --mod-tabs-color: #5b6776;
    --mod-tabs-color-hover: #334155;
    --mod-tabs-color-selected: #0f8b69;
    --mod-tabs-color-key-focus: #10a37f;
    display: block;
    width: 100%;
}

.surface-tabs::part(tablist) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem;
    align-items: flex-end;
    border-bottom: 1px solid var(--nwc-ui-border);
    padding-bottom: 0.1rem;
    background: none;
}

.surface-tabs sp-tab.surface-tab {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
    background: linear-gradient(180deg, var(--nwc-ui-surface) 0%, var(--nwc-ui-surface-soft) 100%);
    padding: 0 1rem 0;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.surface-tabs sp-tab.surface-tab:hover {
    border-color: rgba(16, 163, 127, 0.34);
    background: linear-gradient(180deg, var(--nwc-ui-surface) 0%, color-mix(in srgb, var(--nwc-accent) 8%, var(--nwc-ui-surface)) 100%);
    color: var(--nwc-text-primary);
}

.surface-tabs sp-tab.surface-tab:focus-visible {
    outline: 2px solid rgba(16, 163, 127, 0.34);
    outline-offset: 2px;
}

.surface-tabs sp-tab.surface-tab[selected],
.surface-tabs sp-tab.surface-tab-active {
    background: linear-gradient(180deg, #fbfffd 0%, #e2f5ec 100%);
    color: #0f8b69;
    border-color: rgba(16, 163, 127, 0.44);
    border-left: 3px solid #10a37f;
    box-shadow: inset 0 2px 0 0 color-mix(in srgb, #6ee7b7 72%, white 28%),
    inset 3px 0 0 0 #10a37f,
    0 10px 22px rgba(16, 163, 127, 0.08);
    font-weight: 700;
    padding-left: calc(1rem - 2px);
    transform: translateY(1px);
}

.surface-tabs sp-tab.surface-tab[selected]:hover,
.surface-tabs sp-tab.surface-tab-active:hover {
    color: #0f8b69;
    border-color: rgba(16, 163, 127, 0.52);
}

.surface-tabs sp-tab.surface-tab[disabled] {
    color: var(--nwc-text-muted);
    border-color: var(--nwc-ui-border);
    background: var(--nwc-ui-surface-soft);
    cursor: not-allowed;
    opacity: 1;
}

.perm-action-menu {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.perm-action-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 200;
    min-width: 140px;
    background: var(--nwc-ui-surface);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 4px 0;
}

.perm-action-dropdown.perm-action-dropdown-open {
    display: block;
}

.perm-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--nwc-text-primary);
    white-space: nowrap;
}

.perm-action-item:hover {
    background: var(--nwc-ui-surface-soft);
}

.perm-action-item.perm-action-item-danger {
    color: #dc2626;
}

.perm-action-item.perm-action-item-danger:hover {
    background: var(--nwc-error-subtle);
}

.cai-activity-metrics {
    --wc-ui-metric-columns: repeat(4, minmax(180px, 1fr));
    --wc-ui-metric-gap: 0.9rem;
    --wc-ui-metric-min-width: 0;
    --wc-ui-metric-background: linear-gradient(180deg, var(--nwc-ui-surface) 0%, var(--nwc-ui-surface-soft) 100%);
    --wc-ui-metric-border: 1px solid rgba(148, 163, 184, 0.24);
    --wc-ui-metric-radius: 18px;
    --wc-ui-metric-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    --wc-ui-metric-padding: 1rem 1.05rem;
    --wc-ui-metric-item-display: flex;
    --wc-ui-metric-item-position: static;
    --wc-ui-metric-item-overflow: visible;
    --wc-ui-metric-item-gap: 0.45rem;
    --wc-ui-metric-accent-size: 0;
    --wc-ui-metric-label-size: 0.77rem;
    --wc-ui-metric-label-weight: 700;
    --wc-ui-metric-label-spacing: 0.08em;
    --wc-ui-metric-label-transform: uppercase;
    --wc-ui-metric-label-color: #64748b;
    --wc-ui-metric-value-size: 1.55rem;
    --wc-ui-metric-value-weight: 800;
    --wc-ui-metric-value-color: #0f172a;
    --wc-ui-metric-value-line-height: 1.7;
    --wc-ui-metric-detail-size: 0.86rem;
    --wc-ui-metric-detail-color: #475569;
    --wc-ui-metric-detail-line-height: 1.7;
    margin: 0.25rem 0;
}

.activity-filters,
.message-template-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    align-items: flex-end;
    margin: 0.1rem 0 0.15rem;
}

.activity-filter-control,
.message-template-filter-control {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 180px;
}

.activity-filter-label,
.message-template-filter-label {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.admin-message-body-editor {
    display: grid;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
}

.admin-message-body-editor-panel {
    min-width: 0;
    width: 100%;
}

.admin-message-body-editor .wc-ui-rich-text-editor-host,
.admin-message-body-editor .wc-ui-code-editor-host {
    min-height: 22rem;
    height: 22rem;
}

@media (max-width: 900px) {
    .admin-message-body-editor .wc-ui-rich-text-editor-host,
    .admin-message-body-editor .wc-ui-code-editor-host {
        min-height: 20rem;
        height: 20rem;
    }
}

.library-automapper-steps {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
}

.library-automapper-step {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.9rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: var(--nwc-ui-surface);
    color: var(--nwc-text-secondary);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.library-automapper-step-active {
    border-color: rgba(37, 99, 235, 0.25);
    color: var(--nwc-text-primary);
}

.library-automapper-step:not(.library-automapper-step-active) .library-automapper-step-badge {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.library-automapper-step-badge {
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    flex: 0 0 auto;
}

.library-automapper-step-label {
    font-weight: 700;
    line-height: 1.35;
}

.library-automapper-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1.35rem;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: var(--nwc-ui-surface);
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.library-automapper-section-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
}

.library-automapper-subsection-title {
    margin-top: 0.5rem;
}

.library-automapper-export-note,
.library-automapper-loading,
.library-automapper-raw-type {
    color: var(--nwc-text-secondary);
    line-height: 1.5;
}

.library-automapper-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.library-automapper-empty-state {
    margin: 0;
}

.library-automapper-grid-shell {
    min-height: 26rem;
}

.library-automapper-grid-cell {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    line-height: 1.45;
    white-space: normal;
}

.library-automapper-multiline {
    white-space: pre-line;
    word-break: break-word;
}

.library-automapper-raw-name {
    font-weight: 700;
    color: var(--nwc-text-primary);
}

.library-automapper-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: lowercase;
    color: #fff;
}

.library-automapper-badge-confidence {
    background: #16a34a;
    text-transform: none;
}

.library-automapper-badge-ml {
    background: #7c3aed;
}

.library-automapper-badge-rule {
    background: #2563eb;
}

.library-automapper-badge-neutral {
    background: #64748b;
}

.library-automapper-mapping-confirmed {
    background: rgba(220, 252, 231, 0.7);
}

.library-automapper-mapping-unconfirmed {
    background: rgba(255, 247, 237, 0.82);
}

.library-reference-program-status {
    padding: 0 0.2rem;
}

.library-reference-program-host {
    min-height: 52rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    overflow: hidden;
    background: var(--nwc-ui-surface);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.library-reference-program-root .btn-save,
.library-reference-program-root .btn-back {
    display: none;
}

/* ── ARS editor full-height card override ─────────────────────── */
/* Strip card chrome; keep height: 100% so the flex inside resolves */
.legacy-module-card:has(.project-sapars-root),
.legacy-module-card:has(.project-ards-root) {
    height: 100%;
    min-height: unset;
    padding: 0;
    gap: 0;
    border: none;
    border-radius: 12px;
    box-shadow: none;
    background: transparent;
}

/* Hide title, description, and bottom status bar for ARS pages */
.legacy-module-card:has(.project-sapars-root) > .app-content-title,
.legacy-module-card:has(.project-sapars-root) > .app-content-description,
.legacy-module-card:has(.project-sapars-root) > .app-status,
.legacy-module-card:has(.project-ards-root) > .app-content-title,
.legacy-module-card:has(.project-ards-root) > .app-content-description,
.legacy-module-card:has(.project-ards-root) > .app-status {
    display: none;
}

/* Establish containing block so absolute root resolves correctly */
.app-content-body:has(.project-sapars-root),
.app-content-body:has(.project-ards-root) {
    position: relative;
}

/* Hide inline status text (non-error); keep errors visible */
.project-sapars-status:not(.wc-ui-status-error),
.project-ards-status:not(.wc-ui-status-error) {
    display: none;
}

.project-sapars-status.wc-ui-status-error,
.project-ards-status.wc-ui-status-error {
    padding: 0.5rem 0.75rem;
    font-size: 13px;
    flex-shrink: 0;
}

.project-sapars-host,
.project-ards-host {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--nwc-ui-surface);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06);
}

/* ── ARS Reporting Events editor full-bleed layout ────────────── */
/* Activated by .ars-editor-active on the wc-structured-panel root */

.app-main-content:has(.ars-editor-active) {
    padding: 0;
    overflow: hidden;
}

/* Restore padding so the panel header (title + buttons) isn't flush */
.app-main-content:has(.ars-editor-active) .wc-structured-panel-header {
    padding: 1rem;
}

.legacy-module-card:has(.ars-editor-active) {
    padding: 0;
    gap: 0;
    height: 100%;
    min-height: unset;
    border: none;
    box-shadow: none;
    background: transparent;
}

.wc-structured-panel.ars-editor-active {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.wc-structured-panel.ars-editor-active > .wc-structured-panel-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: unset;
    padding: 0 1rem 1rem;
}

.wc-structured-panel.ars-editor-active .ars-editor-view {
    flex: 1;
    min-height: 37.5rem;
    display: flex;
    flex-direction: column;
}

.wc-structured-panel.ars-editor-active .project-sapars-host {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.library-standards-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.85rem;
}

.library-standards-readonly {
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 92%, transparent);
    color: var(--nwc-text-secondary);
}

.library-standards-details-table-wrap {
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
}

.library-standards-details-table {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.library-standards-details-table .records-table-row,
.library-standards-details-table .records-table-row-header {
    align-items: start;
}

.library-standards-details-cell {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.45;
    word-break: break-word;
}

.tlg-preview-status {
    margin-top: 0.25rem;
}

.tlg-preview-designer-host {
    min-height: 44rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 24px;
    overflow: hidden;
    background: var(--nwc-ui-surface);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.08);
}

.library-flow-empty-state,
.library-flow-editor-loading {
    min-height: 18rem;
}

.library-flow-template-editor > .wc-structured-panel-content {
    display: flex;
    flex-direction: column;
}

.library-flow-editor-surface {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.library-flow-versions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.library-flow-versions-title {
    color: var(--nwc-text-secondary);
    line-height: 1.5;
}

.library-flow-editor-surface > .library-flow-versions-section,
.library-flow-versions {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.library-flow-versions-grid-shell {
    min-height: 22rem;
    flex: 1;
}

.library-flow-version-notes {
    white-space: normal;
    line-height: 1.45;
}

/* TLF governance asset editor — mirror workflow template versions grid layout */
.gov-asset-editor-surface {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.gov-asset-versions-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.gov-asset-versions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gov-asset-versions-grid-shell {
    min-height: 31rem;
    height: 31rem;
}

.gov-asset-version-desc {
    white-space: normal;
    line-height: 1.45;
}

/* TLF asset standard editor — mirror governance asset editor layout */
.asset-std-editor-surface {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.asset-std-versions-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.asset-std-versions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.asset-std-versions-grid-shell {
    min-height: 27rem;
    height: 27rem;
}

.ai-capability-versions-grid-shell {
    min-height: 36rem;
    height: 36rem;
}

.asset-std-version-desc {
    white-space: normal;
    line-height: 1.45;
}

/* ── Create/Edit Workflow Template Version — full-page editor (sidebar fields + code panel) ── */
.app-content-body > .wc-structured-panel.library-flow-version-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.app-content-body > .wc-structured-panel.library-flow-version-page > .wc-structured-panel-header .wc-structured-panel-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.app-content-body > .wc-structured-panel.library-flow-version-page > .wc-structured-panel-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding: 0.5rem 0 0;
    overflow: hidden;
}

.library-flow-version-page-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.library-flow-version-page-content > .wc-ui-status {
    min-height: 0;
    flex-shrink: 0;
}

.library-flow-version-page-content > .wc-ui-status:empty {
    display: none;
}

.library-flow-version-page-content > .wc-ui-status:not(:empty) {
    padding: 0.5rem 0.25rem 0.75rem;
}

.library-flow-version-page-body {
    --lfv-editor-footer-height: 2.125rem;
    display: grid;
    grid-template-columns: 23rem minmax(0, 1fr);
    gap: 1rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.lfv-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: 1.25rem 1.375rem 0;
    overflow: hidden;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-basic-border, #dde3ec);
    border-radius: 0.5rem;
}

.lfv-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex-shrink: 0;
}

.lfv-notes-section {
    flex: 1;
    min-height: 0;
    flex-shrink: 1;
    overflow: hidden;
    padding-bottom: var(--lfv-editor-footer-height);
}

.lfv-notes-section > .lfv-release-notes,
.lfv-notes-section > nph-textarea {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    max-width: 100%;
    --label-width: 0px;
    --label-input-gap: 0px;
    --input-max-width: 100%;
    display: flex;
    flex-direction: column;
}

.lfv-section-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: 0.625rem;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: normal;
    text-transform: none;
    color: var(--nwc-text-secondary);
}

.lfv-section-title-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: inherit;
}

.lfv-section-hint {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: inherit;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.lfv-field-hint {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--nwc-text-muted);
}

.lfv-field-hint:empty {
    display: none;
}

.lfv-field-error {
    font-size: 0.72rem;
    line-height: 1.4;
    color: var(--nwc-danger, #dc2626);
}

.lfv-field-error:empty {
    display: none;
}

.lfv-datasets {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lfv-dataset-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    border: 0.0625rem solid var(--nwc-basic-border, #dde3ec);
    background: var(--nwc-ui-surface);
    transition: background 140ms ease, border-color 140ms ease;
}

.lfv-dataset-row.lfv-dataset-row--on {
    background: color-mix(in srgb, var(--nwc-accent) 8%, transparent);
    border-color: var(--nwc-accent);
}

.lfv-dataset-row nph-checkbox {
    flex-shrink: 0;
}

.lfv-dataset-desc {
    margin-left: auto;
    font-size: 0.6875rem;
    color: var(--nwc-text-muted);
}

.lfv-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-basic-border, #dde3ec);
    border-radius: 0.5rem;
}

.lfv-main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    border-bottom: 0.0625rem solid var(--nwc-basic-border, #dde3ec);
    flex-shrink: 0;
}

.lfv-main-header-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lfv-main-header-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    white-space: nowrap;
}

.lfv-python-badge {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--nwc-accent) 12%, transparent);
    color: var(--nwc-accent);
    white-space: nowrap;
}

.lfv-toolbar-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.lfv-toolbar-controls nph-switch {
    --label-width: auto;
    --label-input-gap: 0.5rem;
}

.lfv-toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lfv-toolbar-group-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

.lfv-toolbar-theme-select {
    width: 9rem;
    min-width: 9rem;
    flex-shrink: 0;
}

.lfv-toolbar-font-select {
    width: 6rem;
    min-width: 6rem;
    flex-shrink: 0;
}

.lfv-toolbar-divider {
    width: 0.0625rem;
    height: 1.25rem;
    background: var(--nwc-basic-border, #dde3ec);
    flex-shrink: 0;
}

.library-flow-code-stack {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 0;
}

.library-flow-code.wc-ui-code-editor {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    border: 0;
    border-radius: 0;
}

.library-flow-code .wc-ui-code-editor-host {
    flex: 1;
    min-height: 0;
    height: 100%;
    width: 100%;
}

/* Ace's own stylesheet leaves these inner layers without font-size/line-height rules, so the
   library's global `* { font-size: clamp(...); line-height: 1.7 }` reset wins over inheriting from
   .ace_editor — re-establish it. The line-height mismatch (Ace measures its row height assuming the
   browser default, but the forced 1.7 multiplier renders taller) is what clipped descenders and threw
   off cursor positioning at larger sizes. */
.library-flow-code .ace_editor,
.library-flow-code .ace_editor * {
    font-size: inherit;
    line-height: inherit;
}

/* Same reset also overrides font-family on every descendant with the app's proportional UI font,
   so the code text was rendering in that instead of the monospace font .ace_editor itself correctly
   gets from Ace's own stylesheet. Ace's cursor math assumes fixed-width characters, so with a
   proportional font the drift compounds with every character typed — restrict to descendants only
   so .ace_editor's own correct value isn't itself overridden into inheriting the wrapper's font. */
.library-flow-code .ace_editor * {
    font-family: inherit;
}

/* Ace's per-line gutter highlight for the active line — not wanted alongside the disabled
   highlightActiveLine text-row highlight. */
.library-flow-code .ace_gutter-active-line {
    background: transparent;
}

/* Ace's stock "terminal" theme is an unrelated maroon/steelblue palette (not an nPhase design), so
   the gutter/content split read as barely-there low-contrast noise. Recolor it in place to match
   the mockup's custom navy Terminal theme. */
.library-flow-code .ace-terminal-theme {
    background-color: #0D1B2A;
    color: rgba(255, 255, 255, 0.9);
}

.library-flow-code .ace-terminal-theme .ace_gutter {
    background: #14263A;
    color: rgba(255, 255, 255, 0.35);
    border-right: 0.0625rem solid rgba(255, 255, 255, 0.1);
}

.library-flow-code .ace-terminal-theme .ace_cursor {
    color: rgba(255, 255, 255, 0.9);
}

.library-flow-code .ace-terminal-theme .ace_keyword,
.library-flow-code .ace-terminal-theme .ace_meta,
.library-flow-code .ace-terminal-theme .ace_storage,
.library-flow-code .ace-terminal-theme .ace_storage.ace_type,
.library-flow-code .ace-terminal-theme .ace_support.ace_type,
.library-flow-code .ace-terminal-theme .ace_keyword.ace_operator {
    color: #3FC9AC;
}

.library-flow-code .ace-terminal-theme .ace_string,
.library-flow-code .ace-terminal-theme .ace_heading {
    color: #F5C77E;
}

.library-flow-code .ace-terminal-theme .ace_comment {
    color: rgba(255, 255, 255, 0.38);
}

.library-flow-code .ace-terminal-theme .ace_entity.ace_name.ace_function,
.library-flow-code .ace-terminal-theme .ace_support.ace_function,
.library-flow-code .ace-terminal-theme .ace_variable {
    color: #7FB8F5;
}

.library-flow-code .ace-terminal-theme .ace_support.ace_class {
    color: #C4A6F5;
}

/* nph-combobox has no public toggle for its search input / "Unselect All" row; hide it only while
   this editor is open. Scoped via :has() so other comboboxes elsewhere in the app are unaffected. */
body:has(.library-flow-version-page) #combobox-overlay-root .nph-combobox-search {
    display: none;
}

.library-flow-code-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    box-sizing: border-box;
    height: var(--lfv-editor-footer-height);
    min-height: var(--lfv-editor-footer-height);
    padding: 0 1.25rem;
    border-top: 0.0625rem solid var(--nwc-basic-border, #dde3ec);
    background: var(--nwc-ui-surface-muted, var(--nwc-ui-surface-soft));
    font-size: 0.72rem;
    line-height: 1.2;
    color: var(--nwc-text-muted);
    flex-shrink: 0;
}

.library-flow-code-note > :last-child {
    margin-left: auto;
}

.lfv-start-from-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.lfv-start-from-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    white-space: nowrap;
}

.lfv-start-from-select {
    width: 9rem;
    min-width: 9rem;
    flex-shrink: 0;
}

.lfv-start-from-hint {
    white-space: nowrap;
}

@media (max-width: 56.25rem) {
    .library-flow-version-page-body {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .lfv-sidebar {
        overflow-y: auto;
    }

    .lfv-notes-section {
        flex: 0 0 auto;
        min-height: 12rem;
    }

    .lfv-main {
        min-height: 28rem;
    }
}

.cai-activity-detail-row {
    --wc-ui-details-row-columns: minmax(120px, 0.45fr) minmax(0, 1fr);
    --wc-ui-details-row-gap: 0.75rem;
    --wc-ui-details-row-padding: 0.45rem 0;
    --wc-ui-details-row-border-width: 1px;
    --wc-ui-details-row-border-color: rgba(148, 163, 184, 0.18);
    --wc-ui-details-row-label-font-weight: 700;
    --wc-ui-details-row-label-color: #334155;
    --wc-ui-details-row-value-color: #475569;
    --wc-ui-details-row-value-white-space: pre-wrap;
    --wc-ui-details-row-value-word-break: break-word;
}

/* ── AuditTrailDialog ─────────────────────────────────────────────────── */

.audit-trail-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--nwc-text-muted);
    margin-bottom: 0.4rem;
}

.audit-trail-eyebrow > span {
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.audit-trail-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.audit-trail-title > span {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
    letter-spacing: -0.005em;
}

.audit-trail-header {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.audit-trail-body {
    display: flex;
    flex-direction: column;
}

.audit-trail-record-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.125rem 0.5625rem 0.125rem 0.1875rem;
    background: var(--nwc-raw-gray-50);
    border: 1px solid var(--nwc-basic-border);
    border-radius: 100rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nwc-text-muted);
}

.audit-trail-pill-av.wc-ui-avatar {
    --wc-ui-avatar-size: 1.5rem;
    --wc-ui-avatar-font-size: 0.65rem;
    --wc-ui-avatar-font-weight: 700;
    --wc-ui-avatar-background: linear-gradient(135deg, var(--nwc-accent), #1c3152);
    --wc-ui-avatar-color: white;
    --wc-ui-avatar-border-width: 0;
    --wc-ui-avatar-border-color: currentColor;
    display: flex;
    user-select: none;
}

.audit-trail-record-pill > span {
    font-size: 0.85rem;
}

.audit-trail-timeline {
    max-height: 22rem;
    overflow: auto;
    scrollbar-width: thin;
}

.audit-trail-event {
    display: grid;
    grid-template-columns: 1.75rem 1fr;
    gap: 0.875rem;
}

.audit-trail-event + .audit-trail-event {
    margin-top: 0.25rem;
}

.audit-trail-rail {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.audit-trail-marker {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--nwc-accent);
}

.audit-trail-event--created .audit-trail-marker {
    background: color-mix(in srgb, var(--nwc-accent) 13%, transparent);
    color: var(--nwc-accent);
}

.audit-trail-event--updated .audit-trail-marker {
    background: rgba(79, 111, 155, 0.14);
    color: var(--nwc-text-secondary);
}

.audit-trail-event--unblinded .audit-trail-marker {
    background: rgba(180, 83, 9, 0.13);
    color: #b45309;
}

.audit-trail-event--started .audit-trail-marker {
    background: rgba(79, 111, 155, 0.14);
    color: var(--nwc-text-secondary);
}

.audit-trail-event--match .audit-trail-marker {
    background: rgba(22, 163, 74, 0.13);
    color: #15803d;
}

.audit-trail-event--mismatch .audit-trail-marker,
.audit-trail-event--failed .audit-trail-marker {
    background: rgba(220, 38, 38, 0.12);
    color: #b91c1c;
}

.audit-trail-line {
    flex: 1;
    width: 0.125rem;
    background: var(--nwc-raw-gray-50);
    margin: 0.25rem 0;
}

.audit-trail-event:last-child .audit-trail-line {
    display: none;
}

.audit-trail-content {
    padding-bottom: 1.25rem;
}

.audit-trail-event:last-child .audit-trail-content {
    padding-bottom: 0.25rem;
}

.audit-trail-ev-title {
    font-weight: 500;
    color: var(--nwc-text-primary);
    line-height: 1.2;
    padding-top: 0.25rem;
}

.audit-trail-ev-time {
    font-family: monospace;
    color: var(--nwc-text-muted);
}

.audit-trail-ev-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
}

.audit-trail-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.35rem;
    background: var(--bg);
    border: 1px solid var(--nwc-border-subtle);
    border-radius: 0.3125rem;
}

.audit-trail-chip > span {
    font-size: 0.75rem;
    color: var(--nwc-text-muted);
}

.audit-trail-chip-lbl {
    color: var(--nwc-text-muted);
}

.audit-trail-chip-val {
    color: var(--nwc-text-primary) !important;
    font-weight: 500;
}

.audit-trail-chip-val--na {
    color: var(--nwc-text-muted);
    font-weight: 400;
    font-style: italic;
}

.audit-trail-chip-val--mono {
    font-family: monospace;
    font-size: 0.72rem !important;
}

.audit-trail-chip-val--italic {
    font-style: italic;
    font-weight: 400;
    color: var(--nwc-text-muted);
}

.audit-trail-who-av.wc-ui-avatar {
    --wc-ui-avatar-size: 1.25rem;
    --wc-ui-avatar-font-size: 0.45rem;
    --wc-ui-avatar-font-weight: 700;
    --wc-ui-avatar-background: linear-gradient(135deg, var(--nwc-accent), #1c3152);
    --wc-ui-avatar-color: white;
    --wc-ui-avatar-border-width: 0;
    --wc-ui-avatar-border-color: currentColor;
    display: flex;
    user-select: auto;
}

.audit-trail-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.audit-trail-footer-note {
    font-size: 0.72rem;
    color: var(--nwc-text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.audit-trail-footer-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.project-snapshots-readonly {
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 92%, transparent);
    color: var(--nwc-text-secondary);
}

.tag-manager-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.secrets-editor-field-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    align-items: center;
}

.wc-ui-field > .wc-ui-field-action {
    width: auto;
    flex-shrink: 0;
    align-self: flex-start;
}

.wc-ui-field-wrapper > :first-child {
    width: 100%;
}

.wc-ui-field > .wc-ui-field-action.admin-secrets-reveal {
    width: fit-content;
}

.wc-ui-field:has(.wc-ui-note) {
    align-items: flex-start;
}

.wc-ui-field:has(.wc-ui-note) > .wc-ui-label {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 34px;
}

.tag-manager-list,
.project-snapshots-tags {
    display: grid;
    gap: 0.7rem;
}

.tag-manager-row,
.project-snapshots-tag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 92%, transparent);
}

.tag-manager-copy,
.project-snapshots-tag-copy {
    display: grid;
    gap: 0.25rem;
}

.project-snapshots-tag-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-manager-name,
.project-snapshots-tag-name {
    color: var(--nwc-text-primary);
    font-weight: 600;
}

.tag-manager-meta,
.tag-manager-empty,
.project-snapshots-tag-meta,
.project-snapshots-tag-empty {
    color: var(--nwc-text-secondary);
    line-height: 1.45;
}

.tag-manager-empty,
.project-snapshots-tag-empty {
    padding: 0.95rem 1rem;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 85%, transparent);
}

.project-snapshots-confirm-copy {
    display: grid;
    gap: 0.8rem;
    color: var(--nwc-text-secondary);
    line-height: 1.5;
}

.project-snapshots-confirm-warning {
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(248, 113, 113, 0.28);
    background: rgba(254, 242, 242, 0.96);
    color: #991b1b;
}

.project-uploads-root {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.project-uploads-browser {
    display: flex;
    height: calc(100vh - 12rem);
    min-height: 32rem;
}

.project-uploads-browser > nph-file-browser {
    --nwc-file-browser-max-height: none;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.wc-folder-picker-path-field {
    position: relative;
    width: 100%;
}

.wc-folder-picker-path-field > nph-input {
    --nwc-input-padding: 0.4375rem 9.75rem 0.4375rem 0.6875rem;
    display: block;
    width: 100%;
    max-width: 100%;
}

.wc-folder-picker-path-icons > nph-input {
    --label-width: 0;
    --label-input-gap: 0;
}

.wc-folder-picker-browse {
    --button-padding: 0.15rem 0.7rem;
    --nwc-button-min-height: 1.85rem;
    --nwc-button-min-width: 0;
    position: absolute;
    z-index: 1;
    top: 50%;
    inset-inline-end: 0.3rem;
    transform: translateY(-50%);
}

.wc-folder-picker-browser {
    display: flex;
    height: min(42rem, calc(85vh - 11rem));
    min-height: 24rem;
}

.wc-folder-picker-browser > nph-file-browser {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.study-datasets-import-list,
.study-datasets-snapshots {
    display: grid;
    gap: 0.75rem;
}

.study-datasets-import-row,
.study-datasets-snapshot-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 92%, transparent);
}

.study-datasets-import-copy,
.study-datasets-snapshot-copy {
    color: var(--nwc-text-secondary);
    line-height: 1.45;
    white-space: pre-wrap;
}

.study-datasets-snapshots-empty,
.execution-record-empty,
.study-datasets-runs-empty {
    padding: 0.95rem 1rem;
    border: 1px dashed rgba(148, 163, 184, 0.35);
    border-radius: 14px;
    color: var(--nwc-text-secondary);
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 85%, transparent);
}

@media (max-width: 900px) {
    .library-domains-actions {
        width: 100%;
        margin-left: 0;
    }

    .library-domains-actions {
        width: 100%;
    }

    .library-domains-grid-shell {
        min-height: 24rem;
        height: auto;
    }

    .library-esign-actions {
        width: 100%;
        margin-left: 0;
    }

    .library-esign-actions {
        width: 100%;
    }

    .library-vendors-actions {
        width: 100%;
        margin-left: 0;
    }

    .library-vendors-actions {
        width: 100%;
    }

    .library-sources-actions {
        width: 100%;
        margin-left: 0;
    }

    .library-sources-actions {
        width: 100%;
    }

    .library-destinations-actions {
        width: 100%;
        margin-left: 0;
    }

    .library-destinations-actions {
        width: 100%;
    }

    .project-study-datasets-actions {
        width: 100%;
        margin-left: 0;
    }

    .project-study-datasets-actions {
        width: 100%;
    }

    .project-study-datasets-grid-shell {
        min-height: 24rem;
        height: auto;
    }
}

.execution-record-table,
.study-datasets-runs-table {
    display: grid;
    gap: 0.6rem;
}

.execution-record-row,
.study-datasets-runs-row {
    display: grid;
    grid-template-columns: 72px minmax(150px, 1fr) minmax(160px, 1.1fr) minmax(160px, 1.1fr) minmax(160px, 1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(240px, 1.35fr);
    gap: 0.6rem;
    align-items: center;
}

.execution-record-row-header,
.study-datasets-runs-row-header {
    padding: 0 0.2rem;
}

.execution-record-row:not(.execution-record-row-header),
.study-datasets-runs-row:not(.study-datasets-runs-row-header) {
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 16px;
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 90%, transparent);
}

.execution-record-cell,
.study-datasets-runs-cell {
    font-size: 0.9rem;
    color: var(--nwc-text-secondary);
    word-break: break-word;
}

.execution-record-row-header .execution-record-cell,
.execution-record-row-header .study-datasets-runs-cell,
.study-datasets-runs-row-header .study-datasets-runs-cell {
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.study-datasets-runs-cell-auth {
    font-weight: 700;
    color: #0f766e;
}

.execution-record-actions,
.study-datasets-runs-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.execution-log-editor {
    width: 100%;
}

.execution-log-editor .wc-ui-code-editor-host {
    min-height: 32rem;
    height: min(42rem, calc(100vh - 16rem));
}

/* SDTM execution logs use the resizable ModalWindow body as their height source. */
.cai-sdtm-output-modal,
.cai-sdtm-logs-modal {
    --modal-initial-width: min(90vw, 96rem);
    --modal-min-width: min(62rem, 90vw);
    --body-padding-x: 0;
    --body-padding-y: 0;
    --body-min-height: 30rem;
}

.cai-sdtm-output-body .wc-ui-artifact-viewer-shell .wc-ui-xpt-viewer-toolbar,
.cai-sdtm-output-body .wc-ui-artifact-viewer-shell {
    border: 0;
    border-radius: 0;
}

.sdtm-pre21-readiness-body > cds-inline-notification {
    max-inline-size: 100%;
}

.cai-sdtm-logs-body.wc-ui-code-editor {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 30rem;
    height: 100%;
    width: 100%;
    border: 0;
    border-radius: 0;
}

.cai-sdtm-logs-body.wc-ui-code-editor .wc-ui-code-editor-toolbar {
    padding-right: 1rem;
}

.cai-sdtm-logs-body .wc-ui-code-editor-host {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

@media (max-width: 52rem) {
    .cai-sdtm-logs-modal {
        --modal-min-width: 94vw;
    }

    .cai-sdtm-logs-body.wc-ui-code-editor {
        height: 76vh;
        min-height: 24rem;
    }
}

.cai-sdtm-program-compare-modal {
    --modal-initial-width: min(94vw, 110rem);
    --modal-min-width: min(62rem, 94vw);
}

.cai-sdtm-program-compare-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 70vh;
}

.cai-sdtm-program-compare-selectors {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

/* The diff editor sizes itself from its container, so the pane needs a definite height. */
.cai-sdtm-program-compare-viewer {
    height: min(65vh, 40rem);
    min-height: 20rem;
}

.cai-sdtm-program-compare-viewer[hidden] {
    display: none;
}

.tabbed-content-shell {
    display: grid;
    gap: 1rem;
}

.project-workflows-task {
    display: grid;
    gap: 1rem;
}

.project-workflows-task-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.project-workflows-task-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
}

.project-workflows-params {
    display: grid;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.project-workflows-param-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
    gap: 0.65rem;
    align-items: center;
}

.tabbed-content-shell {
    display: grid;
    gap: 1rem;
}

.tabbed-content-tabs,
.project-connectors-tabs {
    --mod-tabs-divider-size: 0;
    --mod-tabs-selection-indicator-color: transparent;
    --mod-tabs-item-horizontal-spacing: 0;
    --mod-tabs-color: #334155;
    --mod-tabs-color-hover: #334155;
    --mod-tabs-color-selected: #fff;
    --mod-tabs-color-key-focus: #1d4ed8;
    display: block;
    width: 100%;
}

.tabbed-content-tabs::part(tablist),
.project-connectors-tabs::part(tablist) {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    align-items: center;
    background: none;
}

.tabbed-content-tabs sp-tab.tabbed-content-tab,
.project-connectors-tabs sp-tab.project-connectors-tab {
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 999px;
    background: var(--nwc-ui-surface);
    color: inherit;
    font-weight: 600;
    padding: 0.55rem 0.95rem;
    cursor: pointer;
    transition: background 120ms ease, color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.tabbed-content-tabs sp-tab.tabbed-content-tab:hover,
.project-connectors-tabs sp-tab.project-connectors-tab:hover {
    border-color: rgba(29, 78, 216, 0.34);
    background: rgba(29, 78, 216, 0.05);
}

.tabbed-content-tabs sp-tab.tabbed-content-tab:focus-visible,
.project-connectors-tabs sp-tab.project-connectors-tab:focus-visible {
    outline: 2px solid rgba(29, 78, 216, 0.34);
    outline-offset: 2px;
}

.tabbed-content-tabs sp-tab.tabbed-content-tab[selected],
.project-connectors-tabs sp-tab.project-connectors-tab[selected] {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}

.project-connectors-shell {
    display: grid;
    gap: 0.9rem;
}

.project-connectors-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

.project-connectors-filter-control {
    display: grid;
    gap: 0.35rem;
    min-width: 220px;
}

.project-connectors-filter-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.project-connectors-filter-select {
    min-width: 220px;
}

.project-connectors-readonly {
    background: color-mix(in srgb, var(--nwc-ui-surface-soft) 92%, transparent);
    color: var(--nwc-text-secondary);
}

.project-connectors-log {
    min-height: 14rem;
    font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
}

/* SAS to R list: nine columns must fit the grid beside the expanded sidebar at a 1280px window, so the
   column widths in ProjectSas2RTemplate.listColumns assume 8px instead of 16px horizontal cell padding. */
.project-sas2r-list-grid {
    --ag-cell-horizontal-padding: 8px;
}

.project-sas2r-list-grid .ag-cell,
.project-sas2r-list-grid .ag-header-cell {
    padding-left: 8px;
    padding-right: 8px;
}

/* sas2r wizard: shell/list/source/publish */
.project-sas2r-wizard {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    height: 100%;
}

.project-sas2r-wizard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.project-sas2r-wizard-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.project-sas2r-wizard-subtitle,
.project-sas2r-wizard-step-subtitle {
    margin-top: 0.1875rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-wizard-actions {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 0.5rem;
}

.project-sas2r-wizard-badge {
    padding: 0.125rem 0.625rem;
    border-radius: 999px;
    border: 1px solid rgba(91, 33, 182, 0.25);
    background: rgba(91, 33, 182, 0.08);
    color: #5b21b6;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.project-sas2r-wizard-banner {
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.08);
    color: #92400e;
    font-size: 0.875rem;
    white-space: pre-wrap;
}

.project-sas2r-wizard-stepper {
    padding: 0.75rem 1rem 0.875rem;
    border: 1px solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-sas2r-wizard-step {
    height: 100%;
}

.project-sas2r-wizard-step-title {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.project-sas2r-wizard-canvas {
    min-width: 0;
    height: 100%;
}

.project-sas2r-publish-destination {
    --sas2r-destination-label-width: 5rem;
    --sas2r-destination-label-gap: 0.75rem;
}

/* Location (a .wc-ui-field label; its combobox's own label slot is collapsed) and Path (the nph-input's
   internal label) share one label column. */
.project-sas2r-publish-destination .wc-folder-picker-zone {
    display: flex;
    align-items: center;
    gap: var(--sas2r-destination-label-gap);
}

.project-sas2r-publish-destination .wc-folder-picker-zone > .wc-ui-label {
    flex: 0 0 var(--sas2r-destination-label-width);
    width: var(--sas2r-destination-label-width);
    box-sizing: border-box;
    text-align: right;
    padding: 0;
}

.project-sas2r-publish-destination .wc-folder-picker-zone > nph-combobox {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

/* The Publish card is narrow at 1280px: the Select folder button sits beside the path instead of over it. */
.project-sas2r-publish-destination .wc-folder-picker-path-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-sas2r-publish-destination .wc-folder-picker-path-field > nph-input {
    --nwc-input-padding: 0.4375rem 0.6875rem;
    --label-width: var(--sas2r-destination-label-width);
    --label-input-gap: var(--sas2r-destination-label-gap);
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
}

.project-sas2r-publish-destination .wc-folder-picker-browse {
    position: static;
    flex: 0 0 auto;
    transform: none;
}

.project-sas2r-source-columns {
    height: 100%;
}

.project-sas2r-source-columns,
.project-sas2r-publish-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 1rem;
    align-items: start;
}

.project-sas2r-publish-columns {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    height: 100%;
}

.project-sas2r-source-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    height: 100%;
}

.project-sas2r-wizard-step {
    height: 100%;
}

.project-sas2r-source nph-textarea {
    font-family: var(--nwc-font-primary);
}

.project-sas2r-card {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem;
    border: 1px solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    min-width: 0;
    height: 100%;
}

.project-sas2r-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.project-sas2r-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.project-sas2r-card-hint {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-flist {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-default, #dde3ec);
    border-radius: 0.375rem;
}

.project-sas2r-frow {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.625rem;
    border-bottom: 1px solid var(--border-default, #dde3ec);
}

.project-sas2r-frow:last-child {
    border-bottom: none;
}

.project-sas2r-frow-text {
    flex: 1;
    min-width: 0;
}

.project-sas2r-frow-name {
    font-weight: 600;
    font-size: 0.875rem;
    overflow-wrap: anywhere;
}

.project-sas2r-frow-meta {
    font-size: 0.75rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-frow-actions {
    display: flex;
    flex-shrink: 0;
    gap: 0.25rem;
}

.project-sas2r-flist-empty {
    padding: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-chip {
    flex-shrink: 0;
    padding: 0.0625rem 0.5rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.6875rem;
    font-weight: 600;
    white-space: nowrap;
}

.project-sas2r-chip--neutral {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    border-color: var(--nwc-ui-border);
}

.project-sas2r-chip--final,
.project-sas2r-chip--ok {
    background: rgba(16, 163, 127, 0.10);
    color: var(--nwc-accent-active, #0f766e);
    border-color: rgba(16, 163, 127, 0.22);
}

.project-sas2r-chip--warn {
    background: rgba(217, 119, 6, 0.10);
    color: #92400e;
    border-color: rgba(217, 119, 6, 0.25);
}

.project-sas2r-chip--blocker {
    background: rgba(191, 47, 47, 0.08);
    color: var(--danger, #bf2f2f);
    border-color: rgba(191, 47, 47, 0.25);
}

.project-sas2r-source-inlined {
    font-size: 0.75rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-source-inlined--over {
    color: var(--danger, #bf2f2f);
    font-weight: 600;
}

.project-sas2r-note {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
}

.project-sas2r-note--warn {
    background: rgba(217, 119, 6, 0.08);
    border: 1px solid rgba(217, 119, 6, 0.25);
    color: #92400e;
}

.project-sas2r-note--info {
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.2);
    color: #1e3a8a;
}

.sign-sso-verified {
    color: #2e7d32;
    font-weight: 600;
}

.sign-sso-failed {
    color: var(--danger);
}

.project-sas2r-inputs-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-sas2r-inputs-folder {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    overflow-wrap: anywhere;
}

.project-sas2r-inputs-list {
    max-height: 22rem;
    overflow-y: auto;
}

.project-sas2r-checks {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.project-sas2r-check {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.875rem;
}

.project-sas2r-check-label {
    min-width: 0;
}

.project-sas2r-kv {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.project-sas2r-kv-key {
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-sas2r-kv-value {
    overflow-wrap: anywhere;
}

.project-sas2r-sigbox {
    border-color: rgba(91, 33, 182, 0.3);
    background: rgba(91, 33, 182, 0.03);
}

.project-sas2r-attest {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.project-sas2r-attest-text {
    flex: 1 1 auto;
    min-width: 0;
}

.project-sas2r-publish-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

@media (max-width: 1260px) {
    :root {
        --sub-sidebar-width: 250px;
    }

    .logo-container {
        justify-content: center;
        padding: 1rem;
        min-height: var(--top-panel-height);
    }

    .logo-icon {
        display: block;
    }

    .logo-full-sidebar {
        display: none;
    }

    .projects-table-row,
    .records-table-row {
        grid-template-columns: minmax(180px, 2fr) minmax(120px, 1fr) minmax(120px, 1fr) 90px;
    }

    .entity-details-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .execution-record-row,
    .study-datasets-runs-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 1240px) {
    .app-top-panel {
        padding: 12px 16px;
    }

    .app-top-panel-container {
        flex-direction: row;
        align-items: center;
        gap: 1rem;
    }

    .app-top-panel-title {
        flex: 1 1 0;
        min-width: 0;
    }

    .app-top-actions {
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .app-user-dropdown {
        left: auto;
        right: 0;
    }

    .project-connectors-filter-control,
    .project-connectors-filter-select {
        min-width: 100%;
    }

    .project-workflows-param-row {
        grid-template-columns: 1fr;
    }

    .project-snapshots-filter-control,
    .project-snapshots-filter-select {
        min-width: 100%;
    }

    .tag-manager-input-row {
        grid-template-columns: 1fr;
    }

    .cai-activity-detail-row {
        --wc-ui-details-row-columns: 1fr;
    }

    .project-sas2r-source-columns,
    .project-sas2r-publish-columns {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 980px) {
    .app-main-sidebar,
    .app-sub-sidebar,
    .app-topbar-collapsed-nav {
        display: none;
    }

    .app-top-panel {
        padding: 12px;
    }

    .app-top-panel-container {
        flex-direction: column;
        align-items: stretch;
    }

    .app-top-actions {
        justify-content: flex-start;
        margin-left: 0;
        flex-wrap: wrap;
    }

    .app-user-dropdown {
        left: 0;
        right: auto;
    }

    .selection-dialog-overlay {
        padding: 12px;
    }

    .selection-dialog-card {
        width: 100%;
        max-height: 92vh;
    }

    .selection-dialog-header {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-dialog-overlay {
        padding: 12px;
    }

    .modal-dialog-card {
        width: 100%;
        max-height: 92vh;
    }

    .modal-dialog-header {
        flex-direction: column;
        align-items: stretch;
    }

    .projects-table-row,
    .projects-table-row-header,
    .records-table-row,
    .records-table-row-header {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .token-dialog-summary {
        grid-template-columns: 1fr;
    }

    .entity-details-grid {
        grid-template-columns: 1fr;
    }

    .detail-screen-header {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-screen-actions {
        justify-content: flex-start;
    }

    .admin-project-surface-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-project-surface-actions {
        justify-content: flex-start;
    }

    .project-folders-workspace {
        grid-template-columns: 1fr;
    }

    .cai-activity-metrics {
        --wc-ui-metric-columns: minmax(0, 1fr);
    }

    .activity-filter-control {
        min-width: 100%;
    }

    .cai-activity-detail-row {
        --wc-ui-details-row-columns: 1fr;
        --wc-ui-details-row-gap: 0.35rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   LIBRARY — SDTM MAPPINGS  (library.sdtm)
   Design follows library_module_v11.html wireframe — teal/cyan palette
═══════════════════════════════════════════════════════════════════════════ */

/* Local colour tokens — SDTM teal palette (neutral tokens map to app standard vars) */
.library-sdtm-surface {
    --lsd-primary: var(--nwc-accent-active);
    --lsd-primary-dk: var(--nwc-accent-active);
    --lsd-primary-lt: #E0F2F1;
    --lsd-text: var(--tabs-panel-color);
    --lsd-light: var(--text-gray-color);
    --lsd-muted: #B0BEC5;
    --lsd-bg: var(--bg);
    --lsd-card: var(--nwc-ui-surface);
    --lsd-border: var(--line);
    --lsd-border-lt: #F0F2F5;
    --lsd-success: #43A047;
    --lsd-success-bg: #E8F5E9;
    --lsd-danger: #C62828;
    --lsd-danger-bg: #FFEBEE;
    --lsd-warn: #F57C00;
    --lsd-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --lsd-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --lsd-radius: 8px;
    --lsd-radius-lg: 12px;
    --lsd-divider: #E8EAED;

    display: flex;
    flex-direction: column;
    background: var(--lsd-bg);
    color: var(--lsd-text);
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

/* ── Metrics grid ── */
.library-sdtm-metrics.wc-ui-metric-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 22px;
    --wc-ui-metric-value-color: var(--lsd-primary, var(--nwc-accent-active));
}

.cai-library-summary-metrics {
    --wc-ui-metric-min-width: 0;
    --wc-ui-metric-background: var(--lsd-card, var(--nwc-ui-surface));
    --wc-ui-metric-radius: var(--lsd-radius-lg, 12px);
    --wc-ui-metric-padding: 18px;
    --wc-ui-metric-shadow: var(--lsd-shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.06));
    --wc-ui-metric-hover-shadow: var(--lsd-shadow-md, 0 4px 12px rgba(0, 0, 0, 0.08));
    --wc-ui-metric-border: 1px solid var(--lsd-border-lt, var(--nwc-ui-border));
    --wc-ui-metric-border-block-start: 3px solid var(--lsd-primary, var(--nwc-accent-active));
    --wc-ui-metric-item-display: block;
    --wc-ui-metric-transition: box-shadow 0.2s;
    --wc-ui-metric-label-color: var(--lsd-text, var(--nwc-ui-text));
    --wc-ui-metric-label-size: 14px;
    --wc-ui-metric-label-weight: 400;
    --wc-ui-metric-label-spacing: normal;
    --wc-ui-metric-label-transform: none;
    --wc-ui-metric-value-size: 1.55rem;
    --wc-ui-metric-value-weight: 700;
    --wc-ui-metric-value-line-height: normal;
    --wc-ui-metric-value-margin-block-end: 5px;
    --wc-ui-metric-detail-display: block;
    --wc-ui-metric-detail-color: var(--lsd-text, var(--nwc-ui-text));
    --wc-ui-metric-detail-size: 14px;
    --wc-ui-metric-detail-line-height: normal;
}

.cai-summary-metrics {
    --wc-ui-metric-accent-size: 0;
    --wc-ui-metric-value-color: var(--nwc-ui-text);
    --wc-ui-metric-accent-value-color: var(--lsd-primary, var(--nwc-accent-active));
    --wc-ui-metric-warning-border-block-start: 3px solid var(--nwc-warning-active, #b45309);
    --wc-ui-metric-warning-value-color: var(--nwc-warning-active, #b45309);
}

.sdtm-provenance-metrics.wc-ui-metric-strip {
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
}

.sdtm-guide-sources {
    container-type: inline-size;
}

.sdtm-guide-sources .sdtm-provenance-metrics[data-metric-count]:not([data-metric-count="0"], [data-metric-count="1"], [data-metric-count="2"], [data-metric-count="3"]) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@container (min-width: 60rem) {
    .sdtm-guide-sources .sdtm-provenance-metrics[data-metric-count]:not([data-metric-count="0"], [data-metric-count="1"], [data-metric-count="2"], [data-metric-count="3"]) {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@container (max-width: 30rem) {
    .sdtm-guide-sources .sdtm-provenance-metrics[data-metric-count]:not([data-metric-count="0"], [data-metric-count="1"], [data-metric-count="2"], [data-metric-count="3"]) {
        grid-template-columns: minmax(0, 1fr);
    }
}

.sdtm-provenance-metrics {
    --wc-ui-metric-value-size: 1.125rem;
    --wc-ui-metric-value-line-height: 1.4;
    --wc-ui-metric-value-overflow-wrap: anywhere;
    --wc-ui-metric-detail-color: var(--nwc-ui-text-muted);
    --wc-ui-metric-detail-size: .8125rem;
    --wc-ui-metric-detail-line-height: 1.4;
    --wc-ui-metric-detail-overflow-wrap: anywhere;
}

.sdtm-provenance-metrics[data-specification-signature="SIGNED"] [data-metric-key="specification"] {
    --wc-ui-metric-badge-color: var(--nwc-accent, #009879);
    --wc-ui-metric-badge-border-color: currentColor;
}

.sdtm-provenance-metrics[data-specification-signature="UNSIGNED"] [data-metric-key="specification"] {
    --wc-ui-metric-badge-color: var(--nwc-danger, #dc2626);
    --wc-ui-metric-badge-border-color: currentColor;
}

.library-sdtm-zone-section {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.library-sdtm-zone-section > nph-tab-panel {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
}

/* Both SDTM and ADaM library surfaces share this root class. Let each active tab
   take the remaining height instead of making every nested shell as tall as its
   parent; this keeps the grid body adaptive even when the page grows or shrinks. */
.library-sdtm-surface .app-grid-page-surface {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.library-sdtm-surface .app-grid-page-grid-shell {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

/* Full-page drill-ins sit outside the main library surface. Give their panel
   content and nested tabs the same parent-driven flex sizing as the zone tabs. */
.app-content-body > .wc-structured-panel.library-parent-height-grid-page,
.app-content-body > .wc-structured-panel:has(> .wc-structured-panel-content.library-parent-height-grid-page) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

.app-content-body > .wc-structured-panel.library-parent-height-grid-page > .wc-structured-panel-content,
.app-content-body > .wc-structured-panel:has(> .wc-structured-panel-content.library-parent-height-grid-page)
> .wc-structured-panel-content.library-parent-height-grid-page {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.library-parent-height-grid-page > .app-grid-page-surface {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.library-parent-height-grid-page.app-grid-page-grid-shell,
.library-parent-height-grid-page > .app-grid-page-grid-shell,
.library-parent-height-grid-page .app-grid-page-grid-shell {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    height: auto;
    min-height: 0;
    overflow: hidden;
}

.library-parent-height-grid-page > nph-tab-panel {
    flex: 1 1 0;
    min-height: 0;
}

/* ── Tab filter bar (search + dropdowns above each grid) ── */
.library-sdtm-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--lsd-card, var(--nwc-ui-surface-soft));
    border-bottom: 1px solid var(--lsd-border, var(--nwc-ui-border));
    flex-wrap: wrap;
}

.library-sdtm-status {
    padding: 8px 14px;
    font-size: 0.82rem;
    border-radius: var(--lsd-radius, 4px);
    margin: 6px 14px;
}

.library-sdtm-status--error {
    background: var(--lsd-danger-bg);
    color: var(--lsd-danger);
    border-left: 3px solid var(--lsd-danger);
}

.library-sdtm-cell-muted {
    color: var(--lsd-muted);
}

.library-sdtm-mono {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.8rem;
    color: var(--lsd-primary-dk);
    font-weight: 600;
}

/* ── Badges ── */
.library-sdtm-badge--primary {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--lsd-primary-lt);
    color: var(--lsd-primary);
}

/* ── Buttons ── */
.library-sdtm-btn {
    padding: 8px 16px;
    border-radius: var(--lsd-radius);
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.library-sdtm-btn--primary {
    background: var(--lsd-primary);
    color: #fff;
}

.library-sdtm-btn--primary:hover {
    background: var(--lsd-primary-dk);
    box-shadow: var(--lsd-shadow-sm);
}

.library-sdtm-btn--secondary {
    background: var(--lsd-card);
    color: var(--lsd-text);
    border: 1px solid var(--lsd-border);
}

.library-sdtm-btn--secondary:hover {
    background: var(--lsd-bg);
}

.library-sdtm-btn-group {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Program Detail Modal ── */
.lsd-modal-body {
    padding: 1.35rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.lsd-modal-footer {
    /* --lsd-border-lt is only defined on .library-sdtm-surface, and these detail modals mount
       in .wc-app-modal-host outside it, so the divider needs the literal as a fallback. */
    padding: 0 1.5rem 1.4rem;
    border-top: 0.0625rem solid var(--lsd-border-lt, #F0F2F5);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    background: var(--nwc-ui-surface-soft);
    border-radius: 0 0 22px 22px;
}

.lsd-modal-section {
    background: var(--lsd-card);
    border: 1px solid var(--lsd-border-lt);
    border-radius: var(--lsd-radius);
    overflow: hidden;
}

.lsd-modal-section-hdr {
    padding: 9px 14px;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 1px solid var(--lsd-border-lt);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--lsd-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.lsd-modal-section-body {
    padding: 12px 14px;
}

.lsd-modal-section-body--noPad {
    padding: 0;
}

.lsd-kv {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--lsd-border-lt);
}

.lsd-kv:last-child {
    border-bottom: none;
}

.lsd-kv-inline {
    display: grid;
    grid-template-columns: 10rem minmax(0, 1fr);
    justify-content: unset;
    align-items: start;
    gap: 0.35rem 1rem;
}

.lsd-kv-inline .lsd-kv-v {
    text-align: left;
}

.lsd-kv-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--lsd-border-lt);
}

.lsd-kv-stack:last-child {
    border-bottom: none;
}

.lsd-kv-stack .lsd-kv-v {
    font-weight: 400;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-cap-detail-modal-body .deriv-spec-chip-list {
    margin-top: 0;
}

.lsd-kv-k {
    font-size: 0.77rem;
    color: var(--lsd-light);
    font-weight: 500;
}

.lsd-kv-v {
    font-size: 0.82rem;
    color: var(--lsd-text);
    font-weight: 600;
}

.adam-finding-detail-dialog .lsd-kv-k {
    font-weight: 600;
}

.adam-finding-detail-dialog .lsd-kv-v {
    font-weight: 400;
}

.lsd-modal-code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.76rem;
    color: var(--lsd-text);
    background: var(--lsd-bg);
    padding: 12px 14px;
    white-space: pre;
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
    display: block;
    border: none;
    width: 100%;
    box-sizing: border-box;
}

/* ── Status / loading / empty ── */
.library-sdtm-loading {
    padding: 24px 0;
    text-align: center;
    color: var(--lsd-muted);
    font-size: 0.85rem;
}

.library-sdtm-empty {
    padding: 28px 0;
    text-align: center;
    color: var(--lsd-muted);
    font-size: 0.85rem;
}

/* ── Modal layout helpers (replaces inline styles) ── */
.lsd-modal-two-col {
    display: flex;
    gap: 14px;
}

.lsd-modal-section-flex {
    flex: 1;
}

.lsd-copy-btn--success {
    background: var(--lsd-success-bg) !important;
    color: var(--lsd-success) !important;
    border-color: var(--lsd-success) !important;
}

/* CAI-227: removed `.wc-ui-modal-close` rules added by an earlier patch.
   In nphase-wc 0.5.5 ModalDialog builds its close button via
   `Button.create().variant(GHOST).withIcon(Icon.create("lucide:x", 16))`
   and never applies the `wc-ui-modal-close` class, so those rules were
   dead code. They were also a global widget override (every modal in the
   app), which is the antipattern CAI-227 forbids — widget styling must
   be component-side, not screen-local. */

/* — Preview Dialogs (Standards, Spec, Source Metadata, Domain Template) — */
.library-sdtm-preview-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
    width: min(680px, 100%);
    max-width: 100%;
    min-width: 0;
}

/* Preview Card internals are owned by nphase-wc. */
.library-sdtm-preview-card {
    --wc-ui-card-background: var(--lsd-card);
    --wc-ui-card-border-color: var(--lsd-border);
    --wc-ui-card-radius: var(--lsd-radius-lg);
    --wc-ui-card-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    --wc-ui-card-overflow: hidden;
    --wc-ui-card-header-background: var(--nwc-ui-surface-soft);
    --wc-ui-card-header-divider: 1px solid var(--lsd-border);
    --wc-ui-card-header-padding: 14px 18px;
    --wc-ui-card-body-gap: 0;
    --wc-ui-card-title-size: 0.92rem;
    --wc-ui-card-title-color: var(--lsd-text);
    --wc-ui-card-title-weight: 600;
    --wc-ui-card-title-line-height: normal;
}

.library-sdtm-preview-card--padded {
    --wc-ui-card-body-padding: 16px 18px;
}

.library-sdtm-preview-card--table {
    --wc-ui-card-body-padding: 0;
}

/* KV rows — wireframe .kv style: key left, value right, space-between */
.library-sdtm-preview-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 0;
    border-bottom: 1px solid var(--lsd-divider);
}

.library-sdtm-preview-meta-row:last-child {
    border-bottom: none;
}

.library-sdtm-preview-meta-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--lsd-light);
}

.library-sdtm-preview-meta-value {
    min-width: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--lsd-text);
    text-align: right;
    overflow-wrap: anywhere;
}

.library-sdtm-preview-table-shell {
    width: 100%;
    overflow-x: auto;
}

/* Preview variables / fields table — wireframe .sm-table style */
.library-sdtm-table {
    width: 100%;
    border-collapse: collapse;
}

.library-sdtm-table th {
    padding: 7px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 0.68rem;
    color: var(--lsd-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 1px solid var(--lsd-divider);
    white-space: nowrap;
}

.library-sdtm-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--lsd-divider);
    color: var(--lsd-text);
    font-size: 0.82rem;
    vertical-align: middle;
}

.library-sdtm-table tr:last-child td {
    border-bottom: none;
}

.library-sdtm-table tbody tr:hover td {
    background: var(--nwc-ui-surface-soft);
}

/* Core badges for Required / Expected / Permitted */
.library-sdtm-badge--red {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
}

.library-sdtm-badge--orange {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

.library-sdtm-badge--grey {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

/* Fade-up animation matching wireframe modal open */
@keyframes library-sdtm-fadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.library-sdtm-preview-body {
    animation: library-sdtm-fadeUp 0.2s ease;
}

/* ── SDTM Editor Dialog Forms ──────────────────────────────────────────── */
.library-sdtm-dialog-body .wc-ui-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 2px 0;
}

.library-sdtm-dialog-body .wc-ui-section {
    background: var(--nwc-ui-surface-soft);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    position: relative;
    padding: 1rem;
    background: var(--nwc-raw-gray-50);
}

.library-sdtm-dialog-body .wc-ui-note {
    font-size: 0.72rem;
    color: var(--lsd-muted, var(--nwc-text-muted));
    margin-bottom: 8px;
    font-style: italic;
}

.library-sdtm-dialog-body .wc-ui-field {
    display: grid;
    grid-template-columns: max-content 1fr;
    align-items: center;
    gap: 10px 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.library-sdtm-dialog-body .wc-ui-field:last-child {
    border-bottom: none;
}

.library-sdtm-dialog-body .wc-ui-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    line-height: 1.3;
    white-space: nowrap;
}

.library-sdtm-dialog-body .wc-ui-field > sp-textfield,
.library-sdtm-dialog-body .wc-ui-field > sp-picker,
.library-sdtm-dialog-body .wc-ui-field > sp-textarea {
    width: 100%;
    min-width: 18rem;
}

.library-sdtm-dialog-body .wc-ui-field > sp-picker {
    --spectrum-popover-max-height: 12rem;
}

/* Model picker + optional free-text field composite */
.lsd-model-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    width: 100%;
}

.lsd-model-group > sp-picker {
    width: 100%;
}

.lsd-model-custom-wrap {
    width: 100%;
}

.lsd-model-custom-wrap sp-textfield {
    width: 100%;
}

/* Textarea fields — label on top, input full width */
.library-sdtm-dialog-body .wc-ui-field.lsd-field-full {
    grid-template-columns: 1fr;
}

.library-sdtm-dialog-body .wc-ui-field.lsd-field-full .wc-ui-label {
    margin-bottom: 0.125rem;
}

/* ── System Prompt editor — two-column layout (config | prompt content) ── */
.lsd-prompt-editor-body {
    display: grid;
    grid-template-columns: 26rem minmax(0, 1fr);
}

.lsd-prompt-editor {
    --body-padding-y: 0;
    --body-padding-x: 0;
    --modal-initial-width: 50%;
}

.lsd-prompt-editor-config {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-right: 0.0625rem solid var(--lsd-border, #dde3ec);
    overflow-y: auto;
}

.lsd-prompt-editor-body .wc-ui-card {
    --wc-ui-card-background: var(--nwc-raw-gray-50);
    --wc-ui-card-header-background: var(--nwc-raw-gray-50);
}

.lsd-prompt-editor-config .wc-ui-form {
    gap: 20px;
    padding: 0;
}

.lsd-prompt-editor-config .wc-ui-section {
    padding: 14px 16px 10px;
}

.lsd-prompt-editor-config .wc-ui-field {
    padding: 12px 0;
}

/* Outer panel — same top/bottom padding as .lsd-prompt-editor-config so the card below
   lines up with the top of "Configuration" and the bottom of "Lifecycle". */
.lsd-prompt-editor-content {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1.25rem 1rem;
}

.lsd-prompt-editor-content-card {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem;
}

.lsd-prompt-editor-content-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.lsd-prompt-editor-content-title {
    color: var(--nwc-ui-text);
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0;
}

.lsd-prompt-editor-char-count {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.72rem;
    color: var(--lsd-muted, var(--nwc-text-muted));
    white-space: nowrap;
}

.lsd-prompt-editor-content-desc {
    margin: -4px 0 0;
    font-size: 0.78rem;
    color: var(--lsd-muted, var(--nwc-text-muted));
}

.lsd-prompt-editor-textarea-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
}

.lsd-prompt-editor-textarea-wrap > * {
    flex: 1;
    min-height: 0;
    width: 100%;
}

.lsd-prompt-editor-textarea {
    /* nph-textarea reserves a label column + caps width via these vars by default (see
       AbstractTextControlElement's NPH_INPUT_SHARED shadow CSS) — override so the host fills
       the panel edge-to-edge even with no visible label. */
    --label-width: 0px;
    --label-input-gap: 0px;
    --input-max-width: 100%;
    --input-max-height: 25rem;
    --input-min-height: 100%;
    min-width: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.82rem;
    line-height: 1.6;
}

.lsd-prompt-editor-save-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.76rem;
    color: var(--lsd-muted, var(--nwc-text-muted));
}

.lsd-prompt-editor-save-kbd {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    color: var(--lsd-text, var(--nwc-text-primary));
}

/* Title badge — sits inline with the modal title (e.g. "DRAFT") */
.lsd-prompt-editor-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.lsd-prompt-editor-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    letter-spacing: 0.03em;
}

.lsd-prompt-editor-status-badge--draft {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.lsd-prompt-editor-status-badge--active {
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
}

.lsd-prompt-editor-status-badge--archived {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

/* Footer — required-fields hint (left) + Cancel/Save actions (right) */
.wc-ui-modal-card:has(.library-sdtm-dialog-body) .wc-ui-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.lsd-prompt-editor-required-hint {
    font-size: 0.78rem;
    color: var(--lsd-muted, var(--nwc-text-muted));
}

.lsd-prompt-editor-required-star {
    color: #C62828;
}

/* ── Parse-result view — count tiles + warnings (post-parse success) ── */
.library-sdtm-dialog-body .library-sdtm-upload-counts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 10px;
    padding: 2px 0;
}

.library-sdtm-dialog-body .library-sdtm-upload-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 14px 10px;
    background: var(--nwc-ui-surface-soft);
    border: 1px solid var(--nwc-ui-border);
    border-top: 3px solid #00897B;
    border-radius: 8px;
    text-align: center;
}

.library-sdtm-dialog-body .library-sdtm-upload-count-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #00897B;
}

.library-sdtm-dialog-body .library-sdtm-upload-count-label {
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--nwc-text-muted);
}

.library-sdtm-dialog-body .library-sdtm-upload-warnings,
.acrf-initial-setup .library-sdtm-upload-warnings {
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--nwc-warning-subtle);
    border: 1px solid #FDE68A;
    border-radius: 8px;
    font-size: 0.76rem;
    line-height: 1.5;
    color: var(--cai-text-warning);
    max-height: 9rem;
    overflow-y: auto;
}

.library-sdtm-dialog-body .library-sdtm-upload-warnings > div,
.acrf-initial-setup .library-sdtm-upload-warnings > div {
    padding: 1px 0;
}

.acrf-initial-setup .library-sdtm-upload-warnings > div {
    display: list-item;
    list-style: disc inside;
}

/* In a section, a flex column, the shared shell's flex: 1 would replace its height and collapse the grid
   to its pager, as .wc-ui-card-body > .sdtm-rds-grid-shell guards against in a card. */
.acrf-initial-setup .wc-ui-section > .sdtm-rds-grid-shell {
    flex: none;
}

.acrf-initial-setup .acrf-crf-history-grid-shell .ag-cell-wrap-text {
    line-height: 1.4;
    padding-block: .375rem;
}

/* ── Labelled Form Layout ─────────────────────────────────────────────────── */
/* Reusable 10rem-label + 1fr-control form layout.
   Apply .cai-labelled-form to any form container that needs this shape. */

.cai-labelled-form {
    --nwc-text-inputs: #111827;
    --nwc-row-hover: color-mix(in srgb, var(--nwc-accent) 2.5%, transparent);
}

/* Section = form card: white, 0.5rem radius.
   No overflow:hidden — Flatpickr calendar popups must render outside the card. */
.cai-labelled-form .wc-ui-section {
    background: var(--nwc-ui-surface);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    padding: 0.375rem 0 0.625rem;
    gap: 0;
}

/* Form row: 10rem label + 1fr control */
.cai-labelled-form .wc-ui-field {
    display: grid;
    grid-template-columns: 10rem 1fr;
    align-items: start;
    gap: 0 1.125rem;
    padding: 0.5625rem 1.75rem;
    transition: background 0.12s;
}

/* Controls: fill control column, capped at nph-input's natural max so form stays left-clustered */
.cai-labelled-form .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 28.75rem;
    min-width: 0;
}

/* Label: right-aligned, muted, top-padded to sit flush with the input border */
.cai-labelled-form .wc-ui-field > .wc-ui-label {
    text-align: right;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    padding-top: 0.5rem;
    line-height: 1.4;
    align-self: start;
    display: block;
    user-select: none;
}

/* Control wrapper (hint text below a picker or input): flex column */
.cai-labelled-form .wc-ui-field-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
}

/* nph-input: collapse internal label slot; fill the capped control column */
/* nph-input: collapse internal label slot; uncap shadow-DOM max-width */
.cai-labelled-form nph-input {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    width: 100%;
    max-width: 100%;
}

/* sp-picker: fill the capped control column */
/* sp-picker: nphase-wc hardcodes a fixed width on the host element.
   Override to fill the 1fr column. Remove once nphase-wc exposes a width CSS variable. */
.cai-labelled-form sp-picker {
    width: 100%;
    max-width: 100%;
}

/* Keep grid cells from overflowing their 1fr column */
.cai-labelled-form .cai-form-grid-2 > * {
    min-width: 0;
}

/* Hint text (Approved By note, footer note) */
.cai-labelled-form .wc-ui-note {
    font-size: 0.71875rem;
    color: var(--nwc-text-muted);
    line-height: 1.4;
}

/* Section divider: solid rule spanning the content width */
.cai-labelled-form .cai-form-section-divider {
    border-top: 1px solid var(--nwc-ui-border);
    margin: 0.375rem 1.75rem 0;
    padding-top: 0;
}

/* Section label: indented to align with the 1fr control column */
.cai-labelled-form .cai-form-section-label {
    padding: 0.625rem 0 0.125rem calc(10rem + 1.125rem);
    font-size: 0.65625rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--nwc-text-muted);
}

/* Footer note (inside the white card): indented to align with the 1fr control column */
.cai-labelled-form .wc-ui-section > .wc-ui-note {
    padding: 0.5rem 1.75rem 0.875rem calc(10rem + 2.875rem);
    font-size: 0.71875rem;
    color: var(--nwc-text-muted);
    font-style: italic;
}

/* Zone A / Zone B toggle */
.library-sdtm-zone-toggle {
    display: inline-flex;
    align-items: stretch;
    align-self: flex-start;
    border: 1.5px solid var(--lsd-primary, #00897B);
    border-radius: 8px;
    margin: 12px 0;
    background: var(--nwc-ui-surface);
}

.library-sdtm-zone-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 28px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    outline: none;
    transition: background 0.15s, color 0.15s;
}

.library-sdtm-zone-toggle-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.library-sdtm-zone-toggle-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.library-sdtm-zone-toggle-btn + .library-sdtm-zone-toggle-btn {
    border-left: 1.5px solid var(--lsd-primary, #00897B);
}

.library-sdtm-zone-toggle-btn--active {
    background: var(--lsd-primary, #00897B);
    color: #ffffff;
}

.library-sdtm-zone-toggle-btn--active:first-child {
    border-radius: 6px 0 0 6px;
}

.library-sdtm-zone-toggle-btn--active:last-child {
    border-radius: 0 6px 6px 0;
}

.library-sdtm-zone-toggle-btn:hover:not(.library-sdtm-zone-toggle-btn--active) {
    background: var(--lsd-primary-lt, #E0F2F1);
}

.library-sdtm-zone-toggle-refresh {
    border-left: 0.1rem solid var(--lsd-primary);
    display: inline-flex;
    align-items: stretch;
    --nwc-button-color: var(--nwc-accent-active);
}

/* TLF Library — zone toggle (mirrors library-sdtm-zone-toggle pattern) */
.library-tlf-zone-toggle {
    display: inline-flex;
    align-items: stretch;
    align-self: flex-start;
    border: 0.09375rem solid var(--lsd-primary, #00897B);
    border-radius: 0.5rem;
    margin: 0.75rem 0;
    background: var(--nwc-ui-surface);
}

.library-tlf-zone-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
    background: transparent;
    border: none;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    outline: none;
    transition: background 0.15s, color 0.15s;
}

.library-tlf-zone-toggle-btn:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.library-tlf-zone-toggle-btn:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

.library-tlf-zone-toggle-btn + .library-tlf-zone-toggle-btn {
    border-left: 0.09375rem solid var(--lsd-primary, #00897B);
}

.library-tlf-zone-toggle-btn--active {
    background: var(--lsd-primary, #00897B);
    color: #ffffff;
}

.library-tlf-zone-toggle-btn--active:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.library-tlf-zone-toggle-btn--active:last-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

.library-tlf-zone-toggle-btn:hover:not(.library-tlf-zone-toggle-btn--active) {
    background: var(--lsd-primary-lt, #E0F2F1);
}

/* ── Derivation Spec Editor ──────────────────────────────────────────────── */

/* Cards span the full panel width, like other screens; the page's own side padding is the
   only gap, so an editor lines up with the list it was opened from. The form content sits in a
   fixed, left-aligned column; the extra card width becomes right-side whitespace. */
.deriv-spec-editor-surface .wc-structured-panel-header {
    width: 100%;
    box-sizing: border-box;
}

.deriv-spec-editor-surface .wc-structured-panel-content {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    box-sizing: border-box;
}

.deriv-spec-editor-form {
    /* Card edge padding, and the fixed content column width (-10% vs prior 72rem). */
    --deriv-card-pad: 2.25rem;
    --deriv-content-max: 64.8rem;
    --deriv-content-box: calc(var(--deriv-content-max) + (2 * var(--deriv-card-pad)));
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

/* Card shell — mock .form-section */
.deriv-spec-editor-form.cai-labelled-form .wc-ui-section {
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

/* Card header — mock .sec-hdr / .sec-lbl (bg spans full card, text inset to card padding) */
.deriv-spec-editor-form.cai-labelled-form .wc-ui-section > .wc-ui-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.625rem var(--deriv-card-pad);
    background: var(--nwc-ui-surface-soft);
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
    line-height: 1.3;
}

/* Card body — mock .form-body: left-aligned fixed content column, inset by card padding */
.deriv-spec-editor-form .deriv-spec-sec-body {
    padding: 0.375rem var(--deriv-card-pad) 0.875rem;
    max-width: var(--deriv-content-box);
    box-sizing: border-box;
}

/* Form rows: label column + full-width control column (no 460px cap) */
.deriv-spec-editor-form.cai-labelled-form .wc-ui-field {
    grid-template-columns: 10.5rem minmax(0, 1fr);
}

.deriv-spec-editor-form.cai-labelled-form .wc-ui-field > :not(.wc-ui-label) {
    max-width: none;
}

.deriv-spec-editor-form.cai-labelled-form nph-input,
.deriv-spec-editor-form.cai-labelled-form nph-combobox,
.deriv-spec-editor-form.cai-labelled-form sp-picker,
.deriv-spec-editor-form.cai-labelled-form .wc-ui-field > .wc-token-input {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* Metadata dropdowns use nph-combobox — collapse internal label slot so width matches text fields */
.deriv-spec-editor-form .deriv-spec-sec-body .wc-ui-field > nph-combobox {
    display: block;
}

/* Version is a short field in the mock */
.deriv-spec-editor-form .deriv-spec-version-field > :not(.wc-ui-label) {
    max-width: 7.5rem;
}

.deriv-spec-editor-form .deriv-spec-version-field nph-input {
    max-width: 7.5rem;
}

/* Composite widgets sit in the same left-aligned fixed content column */
.deriv-spec-editor-form .wc-ui-section > .wc-ntl,
.deriv-spec-editor-form .wc-ui-section > .wc-kvl {
    padding: 0.75rem var(--deriv-card-pad) 0.25rem;
    max-width: var(--deriv-content-box);
    box-sizing: border-box;
}

/* Governance card: header bar spans full card; body uses the same content column. */
.deriv-spec-editor-form .tlf-gov-section {
    --wc-ui-card-header-padding: 0.625rem var(--deriv-card-pad);
    --wc-ui-card-body-padding: 1rem var(--deriv-card-pad);
    max-width: var(--deriv-content-box);
    box-sizing: border-box;
}

.csr-linkage-editor-form {
    --csr-card-pad: 2.25rem;
    /* Was 100% — with every field on its own full-width row that gave the widest possible box
       to a 6-character E3 Ref. Sections/bindings fields now sit in .cai-form-grid-2/-3 rows, so
       a real cap keeps those rows (and Template Details/Governance, which share --csr-content-box)
       from stretching arbitrarily wide on a large monitor without leaving the old dead band. */
    --csr-content-max: 76rem;
    --csr-content-box: calc(var(--csr-content-max) + (2 * var(--csr-card-pad)));
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.csr-linkage-editor-form.cai-labelled-form .wc-ui-section {
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

.csr-linkage-editor-form.cai-labelled-form .wc-ui-section > .wc-ui-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0.625rem var(--csr-card-pad);
    background: var(--nwc-ui-surface-soft);
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
    line-height: 1.3;
}

/* Kind/Lifecycle are nph-combobox and Design Summary is nph-textarea; the shared
   .cai-labelled-form rule only uncaps nph-input, so these kept a 28.7rem shadow-DOM cap
   inside a 49.7rem column. Mirrors the .deriv-spec-editor-form rule above. */
.csr-linkage-editor-form.cai-labelled-form nph-combobox,
.csr-linkage-editor-form.cai-labelled-form nph-textarea {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.csr-linkage-editor-form .csr-linkage-sec-body {
    padding: 0.375rem var(--csr-card-pad) 0.875rem;
    max-width: var(--csr-content-box);
    box-sizing: border-box;
}

.csr-linkage-editor-form.cai-labelled-form .wc-ui-field {
    grid-template-columns: 10.5rem minmax(0, 1fr);
}

.csr-linkage-editor-form.cai-labelled-form .wc-ui-field > :not(.wc-ui-label) {
    max-width: none;
}

.csr-linkage-editor-form .tlf-gov-section {
    --wc-ui-card-header-padding: 0.625rem var(--csr-card-pad);
    --wc-ui-card-body-padding: 1rem var(--csr-card-pad);
    max-width: var(--csr-content-box);
    box-sizing: border-box;
}

.csr-linkage-editor-form .linked-tpl-grid,
.csr-linkage-editor-form .linked-tpl-footer {
    padding-left: var(--csr-card-pad);
    padding-right: var(--csr-card-pad);
    max-width: var(--csr-content-box);
    box-sizing: border-box;
}

.csr-linkage-editor-form .linked-tpl-grid {
    padding-top: 0.375rem;
}

/* Below the card's comfortable width for a 3-up row, stack to one field per line instead of
   letting columns get cramped. 2-up (Template Details) drops to one column a bit later, since a
   pair of fields keeps enough room for longer values down to a narrower viewport. */
@media (max-width: 56rem) {
    .csr-linkage-editor-form .cai-form-grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 40rem) {
    .csr-linkage-editor-form .cai-form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ── TLF Governance card (shared across all TLF library editors) ─────────────
   Self-styled via tlf-gov-* so it renders identically in every host form. */
.tlf-gov-section {
    --wc-ui-card-background: var(--nwc-ui-surface);
    --wc-ui-card-border-color: #DDE3EC;
    --wc-ui-card-radius: 0.5rem;
    --wc-ui-card-shadow: none;
    --wc-ui-card-overflow: hidden;
    --wc-ui-card-header-background: var(--nwc-ui-surface-soft);
    --wc-ui-card-header-divider: 0.0625rem solid #DDE3EC;
    --wc-ui-card-header-padding: 0.625rem 1.25rem;
    --wc-ui-card-body-padding: 1rem 1.25rem;
    --wc-ui-card-body-gap: 1rem;
    --wc-ui-card-title-size: 0.6875rem;
    --wc-ui-card-title-color: #5C6878;
    --wc-ui-card-title-weight: 700;
    --wc-ui-card-title-line-height: 1;
    --wc-ui-card-title-letter-spacing: 0.08em;
    --wc-ui-card-title-text-transform: uppercase;
}

.tlf-gov-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tlf-gov-standard-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6875rem 0.875rem;
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
}

.tlf-gov-standard-icon {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 0.25rem;
    background: var(--nwc-success-subtle);
    border: 0.0625rem solid #A6E0CF;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--cai-text-success);
}

.tlf-gov-standard-info {
    flex: 1;
    min-width: 0;
}

.tlf-gov-standard-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
}

.tlf-gov-standard-sub {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.125rem;
}

.tlf-gov-ver-badge {
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--cai-text-success);
    background: var(--nwc-success-subtle);
    border: 0.0625rem solid #A6E0CF;
    border-radius: 0.1875rem;
    padding: 0.0625rem 0.375rem;
}

.tlf-gov-ver-badge--hidden {
    display: none;
}

.tlf-gov-standard-meta {
    font-size: 0.6875rem;
    color: var(--nwc-text-muted);
}

.tlf-gov-change-btn {
    flex-shrink: 0;
    font-size: 0.71875rem;
    font-weight: 500;
    color: #14967D;
    background: transparent;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
    padding: 0.25rem 0.6875rem;
    cursor: pointer;
    font-family: inherit;
    transition: border-color .12s, background .12s;
}

.tlf-gov-change-btn:hover:not(:disabled) {
    border-color: var(--nwc-accent);
    background: var(--nwc-success-subtle);
}

.tlf-gov-change-btn:disabled {
    opacity: .5;
    cursor: default;
}

.tlf-gov-compliance {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0 0.125rem;
    border-top: 0.0625rem solid var(--nwc-ui-border);
}

.tlf-gov-compliance-lbl {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    flex-shrink: 0;
    width: 10.5rem;
    text-align: right;
}

.tlf-gov-pills {
    display: flex;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.tlf-gov-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.3125rem 0.8125rem;
    border-radius: 99rem;
    border: 0.09375rem solid var(--nwc-ui-border);
    background: transparent;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
    user-select: none;
}

.tlf-gov-pill:hover:not(:disabled):not(.tlf-gov-pill--active) {
    border-color: var(--nwc-ui-border);
}

.tlf-gov-pill:disabled {
    opacity: .5;
    cursor: default;
}

.tlf-gov-pill-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: currentColor;
    opacity: 0;
    transition: opacity .1s;
}

.tlf-gov-pill--active .tlf-gov-pill-dot {
    opacity: 1;
}

.tlf-gov-pill[data-status="COMPLIANT"].tlf-gov-pill--active {
    color: var(--cai-text-success);
    background: var(--nwc-success-subtle);
    border-color: #15803D;
}

.tlf-gov-pill[data-status="NON_COMPLIANT"].tlf-gov-pill--active {
    color: var(--cai-text-error);
    background: var(--nwc-error-subtle);
    border-color: #E53E3E;
}

/* ── Linked Zone A Templates (card list) ─────────────────────────────────── */
.linked-tpl-grid {
    display: flex;
    flex-direction: column;
    gap: 0.4375rem;
    margin-bottom: 0.625rem;
}

.linked-tpl-card {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5625rem 0.75rem;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
    transition: border-color .12s, box-shadow .12s;
}

.linked-tpl-card:hover {
    border-color: var(--nwc-ui-border);
    box-shadow: 0 0.0625rem 0.125rem rgba(13, 27, 42, 0.06);
}

.linked-tpl-icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.25rem;
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--nwc-ui-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--nwc-text-muted);
}

.linked-tpl-info {
    flex: 1;
    min-width: 0;
}

.linked-tpl-name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.linked-tpl-meta {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-top: 0.1875rem;
}

.linked-tpl-ver {
    font-size: 0.6875rem;
    color: var(--nwc-text-muted);
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
}

.linked-tpl-sep {
    font-size: 0.625rem;
    color: var(--nwc-text-muted);
}

.linked-tpl-status {
    font-size: 0.6875rem;
    color: #15803D;
    font-weight: 500;
}

.linked-tpl-type-badge {
    font-size: 0.59375rem;
    font-weight: 700;
    letter-spacing: .06em;
    padding: 0.0625rem 0.375rem;
    border-radius: 0.1875rem;
    background: var(--nwc-info-subtle);
    color: #2563EB;
}

.linked-tpl-type-badge[data-type="FIGURE"] {
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
}

.linked-tpl-type-badge[data-type="LISTING"] {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

.linked-tpl-del {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    border: 0.0625rem solid transparent;
    background: transparent;
    color: var(--nwc-text-muted);
    cursor: pointer;
    border-radius: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    line-height: 1;
    transition: background .12s, color .12s, border-color .12s;
}

.linked-tpl-del:hover {
    background: var(--nwc-error-subtle);
    color: #E53E3E;
    border-color: #FECACA;
}

.linked-tpl-empty {
    padding: 1.375rem 1rem;
    text-align: center;
    font-size: 0.78125rem;
    color: var(--nwc-text-muted);
    border: 0.09375rem dashed var(--nwc-ui-border);
    border-radius: 0.375rem;
    margin-bottom: 0.625rem;
}

.linked-tpl-footer {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.deriv-spec-sec-body .linked-tpl-footer.wc-ntl-footer {
    padding: 0.5rem 0 0;
}

.linked-tpl-footer-count {
    font-size: 0.71875rem;
    color: var(--nwc-text-muted);
}

.deriv-spec-linked-summary-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.deriv-spec-linked-summary {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    color: var(--nwc-text-secondary);
}

.deriv-spec-linked-item-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0;
}

.deriv-spec-linked-item-row label {
    cursor: pointer;
    margin: 0;
}

.deriv-spec-picker-scroll {
    max-height: 24rem;
    overflow-y: auto;
}

.deriv-spec-picker-list {
    padding: 0.25rem 0;
}

.deriv-spec-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.75rem;
}

/* TLF library governance helpers */
.tlf-governance-picker-scroll {
    max-height: 24rem;
    overflow-y: auto;
}

.tlf-governance-picker-list {
    padding: 0.25rem 0;
}

.tlf-governance-picker-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.75rem;
}

.tlf-governance-picker-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0;
    cursor: pointer;
}

.tlf-governance-picker-row label,
.tlf-governance-picker-label {
    cursor: pointer;
    margin: 0;
}

/* ── Derivation Spec Detail Modal chips ─────────────────────────────────── */
.deriv-spec-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    padding: 0.25rem 0;
}

.deriv-spec-chip {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    background: var(--lsd-card);
    border: 1px solid var(--lsd-border);
    border-radius: 62.4375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--lsd-text);
    white-space: nowrap;
}

/* SAS code block in detail modal */
.sas-code-block {
    width: 100%;
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    padding: 0.75rem 1rem;
    background: var(--spectrum-gray-75, var(--nwc-ui-surface-soft));
    border: 1px solid var(--spectrum-gray-300, var(--nwc-ui-border));
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    margin: 0;
    box-sizing: border-box;
}

/* Inline chip list for Output & Checks rows */
.sas-chip-list-inline {
    display: inline-flex;
    flex-wrap: wrap;
}

/* ── SAS Reference Program split editor ───────────────────────────────────── */

.admin-project-surface:has(.sas-ref-editor-body) {
    flex: 1;
    min-height: 0;
    gap: 0;
}

.sas-ref-editor-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40rem;
    flex: 1;
    min-height: calc(100vh - 11rem);
    overflow: hidden;
    gap: 0;
    border: 0.0625rem solid var(--lsd-border, #dde3ec);
    border-radius: 0.5rem;
    background: var(--lsd-card, var(--nwc-ui-surface));
}

.sas-ref-code-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 0.0625rem solid var(--lsd-border, #dde3ec);
}

.sas-ref-code-panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 0.0625rem solid var(--lsd-border, #dde3ec);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--nwc-text-muted);
    flex-shrink: 0;
}

.sas-ref-code-panel-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.sas-ref-code-editor-mount {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.sas-ref-code-editor {
    flex: 1;
    width: 100%;
    min-height: 0;
}

.sas-ref-code-editor .wc-ui-code-editor-host {
    flex: 1;
    min-height: 100%;
    height: 100%;
}

.sas-ref-props-panel {
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--lsd-card, var(--nwc-ui-surface));
}

.sas-ref-props-header {
    padding: 0.875rem 1.25rem;
    border-bottom: 0.0625rem solid var(--lsd-border, #dde3ec);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.sas-ref-props-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.sas-ref-props-body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Reference program / governance version properties panel — card form in narrow right column */
.sas-ref-props-body .deriv-spec-editor-form {
    --deriv-card-pad: 1rem;
    padding: 0.75rem 0.75rem 1.25rem;
}

.sas-ref-props-panel .deriv-spec-editor-form.cai-labelled-form .wc-ui-field {
    grid-template-columns: 11.5rem minmax(0, 1fr);
    gap: 0 0.875rem;
    padding-left: 0;
    padding-right: 0;
}

.sas-ref-props-panel .deriv-spec-editor-form.cai-labelled-form .wc-ui-field > .wc-ui-label {
    white-space: nowrap;
}

.sas-ref-props-panel .deriv-spec-editor-form .deriv-spec-sec-body,
.sas-ref-props-panel .deriv-spec-editor-form .wc-ui-section > .wc-ntl,
.sas-ref-props-panel .deriv-spec-editor-form .wc-ui-section > .wc-kvl,
.sas-ref-props-panel .deriv-spec-editor-form .tlf-gov-section {
    max-width: none;
}

/* Force AG Grid column menu/filter buttons always visible (ag-theme-quartz hides them until hover) */
.ag-theme-quartz .ag-header-cell-menu-button,
.ag-theme-quartz .ag-header-cell-filter-button,
.ag-theme-quartz .ag-header-icon {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Audit logs grid: header title left-aligned with its filter icon immediately
   adjacent, so the header sits over the start of the value it labels.

   flex-end, not flex-start: AG Grid sets .ag-cell-label-container to
   flex-direction: row-reverse (its children are ordered menu, filter, label in the
   DOM and reversed for display). On a reversed main axis flex-start is the RIGHT
   edge, so flex-end is what pins the group to the left.

   .ag-header-cell-label keeps flex: 0 0 auto -- overriding AG Grid's 1 1 auto -- so
   the label shrinks to its text and the filter icon stays beside it rather than
   being pushed to the far edge of the column by the default space-between. */
.admin-audit-logs-grid .ag-cell-label-container,
.project-audit-logs-grid .ag-cell-label-container {
    justify-content: flex-end;
}

.admin-audit-logs-grid .ag-header-cell-label,
.project-audit-logs-grid .ag-header-cell-label {
    flex: 0 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROJECTS — STUDY SETUP BLUEPRINT  (projects.sdtm.setup)
═══════════════════════════════════════════════════════════════════════════ */

.sdtm-blueprint-surface {
    --bp-primary: #00897B;
    --bp-primary-dk: #00695C;
    --bp-primary-lt: #E0F2F1;
    --bp-primary-10: rgba(0, 137, 123, 0.10);
    --bp-accent: #0097A7;
    --bp-text: #37474F;
    --bp-light: #78909C;
    --bp-muted: #B0BEC5;
    --bp-bg: var(--nwc-ui-surface-muted);
    --bp-card: var(--nwc-ui-surface);
    --bp-border: #E0E4EA;
    --bp-border-lt: #F0F2F5;
    --bp-success: #43A047;
    --bp-success-bg: #E8F5E9;
    --bp-warn: #F57C00;
    --bp-warn-bg: #FFF3E0;
    --bp-error: #E53935;
    --bp-error-bg: #FFEBEE;
    --bp-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --bp-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --bp-radius: 8px;
    --bp-radius-lg: 12px;

    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 24px 28px;
    background: var(--bp-bg);
    min-height: 100%;
    color: var(--bp-text);
    font-size: 14px;
}

.sdtm-blueprint-panel {
    background: var(--bp-card);
    border-radius: var(--bp-radius-lg);
    border: 1px solid var(--bp-border-lt);
    box-shadow: var(--bp-shadow-sm);
    overflow: hidden;
}

.sdtm-blueprint-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--bp-border-lt);
    background: var(--nwc-ui-surface-soft);
    flex-wrap: wrap;
    gap: 12px;
}

.sdtm-blueprint-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.sdtm-blueprint-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sdtm-blueprint-meta-item > span:first-child {
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--bp-muted);
    font-weight: 600;
}

.sdtm-blueprint-meta-item > span:last-child {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--bp-text);
}

.sdtm-blueprint-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.sdtm-blueprint-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.sdtm-blueprint-badge.badge-draft {
    background: var(--nwc-warning-subtle);
    color: var(--bp-warn);
}

.sdtm-blueprint-badge.badge-locked {
    background: var(--bp-success-bg);
    color: var(--bp-success);
}

.sdtm-blueprint-badge.badge-review {
    background: var(--nwc-info-subtle);
    color: var(--bp-accent);
}

.sdtm-blueprint-domain-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--bp-text);
    margin-right: 6px;
}

.sdtm-blueprint-domain-select {
    padding: 6px 10px;
    border: 1px solid var(--bp-border);
    border-radius: var(--bp-radius);
    font-size: 0.83rem;
    color: var(--bp-text);
    background: var(--bp-card);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
    cursor: pointer;
}

.sdtm-blueprint-domain-select:focus {
    border-color: var(--bp-primary);
}

.sdtm-blueprint-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--bp-border-lt);
    background: var(--bp-bg);
}

.sdtm-blueprint-init-btn {
    padding: 9px 20px;
    background: var(--bp-primary);
    color: #fff;
    border: none;
    border-radius: var(--bp-radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.sdtm-blueprint-init-btn:hover {
    background: var(--bp-primary-dk);
}

.sdtm-blueprint-reopen-btn {
    padding: 7px 16px;
    background: var(--bp-card);
    color: var(--bp-warn);
    border: 1px solid var(--bp-warn);
    border-radius: var(--bp-radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.sdtm-blueprint-reopen-btn:hover {
    background: var(--bp-warn-bg);
}

.sdtm-blueprint-table-shell {
    overflow-x: auto;
}

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

.sdtm-blueprint-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--bp-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--bp-border-lt);
    background: var(--nwc-ui-surface-soft);
    white-space: nowrap;
}

.sdtm-blueprint-table td {
    padding: 11px 14px;
    font-size: 0.85rem;
    border-bottom: 1px solid var(--bp-border-lt);
    vertical-align: middle;
}

.sdtm-blueprint-table tr:last-child td {
    border-bottom: none;
}

.sdtm-blueprint-table select,
.sdtm-blueprint-table input[type="text"] {
    padding: 5px 8px;
    border: 1px solid var(--bp-border);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--bp-text);
    background: var(--bp-bg);
    outline: none;
    font-family: inherit;
    transition: border-color 0.15s;
    width: 100%;
    min-width: 90px;
}

.sdtm-blueprint-table select:focus,
.sdtm-blueprint-table input[type="text"]:focus {
    border-color: var(--bp-primary);
    background: var(--nwc-ui-surface);
}

.sdtm-blueprint-var-row {
    cursor: pointer;
    transition: background 0.12s;
}

.sdtm-blueprint-var-row:hover td {
    background: var(--nwc-ui-surface-soft);
}

.sdtm-blueprint-no-vars {
    padding: 28px;
    text-align: center;
    color: var(--bp-muted);
    font-size: 0.85rem;
}

.sdtm-blueprint-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 28px;
    text-align: center;
}

.sdtm-blueprint-empty-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--bp-text);
    margin-bottom: 8px;
}

.sdtm-blueprint-empty-subtitle {
    font-size: 0.85rem;
    color: var(--bp-light);
    margin-bottom: 20px;
    max-width: 420px;
    line-height: 1.55;
}

.wc-ui-records-subtitle,
.wc-ui-records-summary {
    display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SDTM PIPELINE SCREENS — Design tokens + component CSS
   Covers Screens 01–08: AutoMapper · Domain Mapping · Production · QC ·
   Compare · Pre-P21 Validation · Pinnacle 21 · Package Ready
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Design tokens (scoped to SDTM pipeline surfaces) ─────────────────────── */
.am-surface, .dm-root, .prod-root, .qc-root, .compare-surface,
.validation-surface, .p21-surface, .package-surface, .adam-ai-program,
.adam-ai-program-run-details {
    --sdtm-font: 'IBM Plex Sans', system-ui, sans-serif;
    --sdtm-mono: 'IBM Plex Mono', monospace;
    --sdtm-blue-900: #1B4F72;
    --sdtm-blue-800: #1A5276;
    --sdtm-blue-600: #2471A3;
    --sdtm-blue-100: #D6EAF8;
    --sdtm-blue-50: #EBF5FB;
    --sdtm-prod-900: #1A6B3C;
    --sdtm-prod-700: #229954;
    --sdtm-prod-200: #A9DFBF;
    --sdtm-prod-50: #EAFAF1;
    --sdtm-qc-900: #5B2C6F;
    --sdtm-qc-700: #7D3C98;
    --sdtm-qc-200: #D7BDE2;
    --sdtm-qc-50: #F5EEF8;
    --sdtm-lead-700: #B7770D;
    --sdtm-lead-200: #FAD7A0;
    --sdtm-lead-50: #FEF9E7;
    --sdtm-success: #166534;
    --sdtm-success-bg: #F0FDF4;
    --sdtm-success-border: #BBF7D0;
    --sdtm-warn: #92400E;
    --sdtm-warn-bg: #FFFBEB;
    --sdtm-warn-border: #FDE68A;
    --sdtm-error: #9B1C1C;
    --sdtm-error-bg: #FEF2F2;
    --sdtm-error-border: #FECACA;
    --sdtm-info: #1E3A5F;
    --sdtm-info-bg: #EFF6FF;
    --sdtm-info-border: #BFDBFE;
    --sdtm-gray-900: var(--nwc-text-primary);
    --sdtm-gray-700: var(--nwc-text-primary);
    --sdtm-gray-500: var(--nwc-text-secondary);
    --sdtm-gray-400: var(--nwc-text-muted);
    --sdtm-gray-300: var(--nwc-ui-border);
    --sdtm-gray-200: var(--nwc-ui-border);
    --sdtm-gray-100: var(--nwc-ui-surface-soft);
    --sdtm-gray-50: #F9FAFB;
    --sdtm-white: var(--nwc-ui-surface);
    --sdtm-radius: 6px;
    --sdtm-radius-lg: 10px;
    --sdtm-shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
    --sdtm-shadow: 0 2px 8px rgba(0, 0, 0, .08);
    --sdtm-shadow-lg: 0 8px 24px rgba(0, 0, 0, .12);
    font-family: var(--sdtm-font);
    font-size: 14px;
    color: var(--sdtm-gray-900);
}

/* ── Spec version banner (Screens 2–8) ─────────────────────────────────────── */
.spec-ver-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border-radius: var(--sdtm-radius);
    margin-bottom: 10px;
    font-size: .75rem;
    border: 1px solid;
}

.spec-ver-banner.draft {
    background: var(--sdtm-warn-bg);
    border-color: var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

.spec-ver-banner.approved {
    background: var(--sdtm-success-bg);
    border-color: var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.spec-ver-banner.locked {
    background: var(--sdtm-gray-100);
    border-color: var(--sdtm-gray-300);
    color: var(--sdtm-gray-500);
}

.map-ver-status {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.map-ver-approved {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.map-ver-draft {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border: 1px solid #FDE68A;
}

.map-ver-locked {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border: 1px solid var(--sdtm-gray-300);
}

.spec-ver-note {
    font-size: .68rem;
    font-style: italic;
    margin-left: auto;
    opacity: .75;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 01 — AM: AUTOMAPPER RUN (Review & Refine)
   ═══════════════════════════════════════════════════════════════════ */

.am-surface {
    display: block;
}

.am-main {
    padding: 20px 24px;
    min-height: calc(100vh - 100px);
}

/* Wizard bar */
.am-wizbar {
    height: 48px;
    background: var(--sdtm-white);
    border-bottom: 1px solid var(--sdtm-gray-200);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 0;
    position: sticky;
    top: 64px;
    z-index: 200;
    box-shadow: var(--sdtm-shadow-sm);
    margin: -20px -24px 20px;
}

.am-wiz-study {
    min-width: 160px;
    flex-shrink: 0;
    padding-right: 14px;
    border-right: 1px solid var(--sdtm-gray-200);
}

.am-wiz-study-name {
    font-weight: 700;
    font-size: .82rem;
    color: var(--sdtm-gray-900);
    display: block;
}

.am-wiz-study-meta {
    font-size: .68rem;
    color: var(--sdtm-gray-500);
    margin-top: 1px;
    display: block;
}

.am-wiz-steps {
    display: flex;
    align-items: center;
    flex: 1;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 10px;
    gap: 0;
}

.am-wiz-steps::-webkit-scrollbar {
    display: none;
}

.am-wiz-node {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 10px;
    border-radius: var(--sdtm-radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background .12s;
    flex-shrink: 0;
}

.am-wiz-node:hover {
    background: var(--sdtm-gray-100);
}

.am-wiz-node.am-wiz-node--active {
    background: var(--sdtm-blue-50);
}

.am-wiz-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    font-weight: 700;
    flex-shrink: 0;
}

.am-wiz-num--active {
    background: var(--sdtm-blue-600);
    color: #fff;
}

.am-wiz-num--idle {
    background: var(--sdtm-gray-200);
    color: var(--sdtm-gray-500);
}

.am-wiz-num--done {
    background: var(--sdtm-success);
    color: #fff;
}

.am-wiz-lbl {
    font-size: .72rem;
    font-weight: 500;
    color: var(--sdtm-gray-500);
}

.am-wiz-node.am-wiz-node--active .am-wiz-lbl {
    color: var(--sdtm-blue-600);
    font-weight: 600;
}

.am-wiz-sep {
    color: var(--sdtm-gray-300);
    font-size: .65rem;
    margin: 0 2px;
    flex-shrink: 0;
}

.am-wiz-actions {
    display: flex;
    gap: 6px;
    padding-left: 12px;
    border-left: 1px solid var(--sdtm-gray-200);
    flex-shrink: 0;
}

/* Buttons */
.am-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: var(--sdtm-radius);
    font-size: .8rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: var(--sdtm-font);
}

.am-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.am-btn--primary {
    background: var(--sdtm-blue-900);
    color: #fff;
}

.am-btn--primary:hover {
    background: var(--sdtm-blue-800);
}

.am-btn--secondary {
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    border: 1px solid var(--sdtm-gray-300);
}

.am-btn--secondary:hover {
    border-color: var(--sdtm-blue-600);
    color: var(--sdtm-blue-600);
}

.am-btn--sm {
    padding: 4px 10px;
    font-size: .72rem;
}

.am-btn--xs {
    padding: 2px 8px;
    font-size: .65rem;
}

.am-btn--full {
    width: 100%;
    justify-content: center;
}

/* Badges */
.am-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: .65rem;
    font-weight: 600;
    white-space: nowrap;
}

.am-badge--success {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.am-badge--warn {
    background: var(--sdtm-warn-bg);
    color: var(--sdtm-warn);
    border: 1px solid var(--sdtm-warn-border);
}

.am-badge--error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border: 1px solid var(--sdtm-error-border);
}

.am-badge--info {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
}

.am-badge--runtime {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border: 1px solid var(--sdtm-gray-300);
}

/* Context banner */
.am-context-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: var(--sdtm-info-bg);
    border: 1px solid var(--sdtm-info-border);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    color: var(--sdtm-info);
    margin-bottom: 14px;
}

.am-banner-icon {
    flex-shrink: 0;
    font-size: 1rem;
}

.am-banner-msg {
    flex: 1;
    line-height: 1.5;
}

.am-sync-badge {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
    white-space: nowrap;
}

/* Study Setup Snapshot panel */
.am-snapshot-panel {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    padding: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.am-snapshot-label {
    min-width: 140px;
    flex-shrink: 0;
}

.am-snapshot-label-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--sdtm-gray-900);
    display: block;
}

.am-snapshot-label-meta {
    font-size: .65rem;
    color: var(--sdtm-gray-500);
    margin-top: 2px;
    display: block;
}

.am-snapshot-cols {
    display: flex;
    flex: 1;
    gap: 0;
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius);
    overflow: hidden;
}

.am-snapshot-col {
    flex: 1;
    padding: 8px 12px;
    border-right: 1px solid var(--sdtm-gray-200);
}

.am-snapshot-col:last-child {
    border-right: none;
}

.am-snapshot-col-label {
    font-size: .6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-400);
    display: block;
    margin-bottom: 3px;
}

.am-snapshot-col-value {
    font-size: .82rem;
    font-weight: 600;
    color: var(--sdtm-gray-900);
}

.am-snapshot-btn-wrap {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Execution review section */
.am-exec-review-section {
    margin-top: 4px;
}

.am-exec-review-hdr {
    margin-bottom: 12px;
}

.am-section-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--sdtm-gray-900);
    display: block;
}

.am-section-desc {
    font-size: .72rem;
    color: var(--sdtm-gray-500);
    margin-top: 2px;
    display: block;
}

/* Card grid */
.am-card-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Cards */
.am-card {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.am-card-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--sdtm-gray-200);
    background: var(--sdtm-gray-50);
}

.am-card-hdr-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.am-card-title {
    font-size: .88rem;
    font-weight: 700;
    color: var(--sdtm-gray-900);
}

.am-card-body {
    padding: 14px;
}

.am-card-desc {
    font-size: .75rem;
    color: var(--sdtm-gray-500);
    line-height: 1.5;
    margin-bottom: 10px;
    display: block;
}

/* Stat grid */
.am-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius);
    overflow: hidden;
    margin-bottom: 10px;
}

.am-stat-cell {
    padding: 9px 10px;
    text-align: center;
    border-right: 1px solid var(--sdtm-gray-200);
}

.am-stat-cell:last-child {
    border-right: none;
}

.am-stat-val {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.2;
    display: block;
}

.am-stat-val--success {
    color: var(--sdtm-success);
}

.am-stat-val--info {
    color: var(--sdtm-blue-600);
}

.am-stat-val--co {
    color: #5B21B6;
}

.am-stat-val--warn {
    color: var(--sdtm-warn);
}

.am-stat-val--error {
    color: var(--sdtm-error);
}

.am-stat-lbl {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-400);
    font-weight: 600;
    margin-top: 2px;
    display: block;
}

/* Alerts */
.am-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 9px 11px;
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    line-height: 1.5;
    margin-bottom: 10px;
}

.am-alert-icon {
    flex-shrink: 0;
}

.am-alert--warn {
    background: var(--sdtm-warn-bg);
    border: 1px solid var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

.am-alert--success {
    background: var(--sdtm-success-bg);
    border: 1px solid var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.am-alert--info {
    background: var(--sdtm-info-bg);
    border: 1px solid var(--sdtm-info-border);
    color: var(--sdtm-info);
}

.am-alert--error {
    background: var(--sdtm-error-bg);
    border: 1px solid var(--sdtm-error-border);
    color: var(--sdtm-error);
}

/* Drawers */
.am-drawer {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    margin-top: 14px;
}

.am-drawer--hidden {
    display: none;
}

.am-ct-note {
    font-size: .68rem;
    color: var(--sdtm-gray-500);
}

/* Table */
.am-tbl {
    width: 100%;
    border-collapse: collapse;
    font-size: .79rem;
}

.am-tbl th {
    background: var(--sdtm-gray-50);
    padding: 7px 11px;
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-500);
    border-bottom: 1px solid var(--sdtm-gray-200);
    text-align: left;
    white-space: nowrap;
}

.am-tbl td {
    padding: 7px 11px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    vertical-align: middle;
}

.am-tbl tr:last-child td {
    border-bottom: none;
}

.am-tbl tr:hover td {
    background: var(--sdtm-gray-50);
}

.am-td-mono {
    font-family: var(--sdtm-mono);
    font-size: .75rem;
}

.am-td-bold {
    font-weight: 600;
}

.am-td-spec {
    font-size: .75rem;
    color: var(--sdtm-gray-700);
}

.am-td-interp {
    font-size: .75rem;
    color: var(--sdtm-gray-700);
}

.am-row--confirmed {
    background: var(--nwc-success-subtle);
}

.am-row--warn {
    background: var(--nwc-warning-subtle);
}

.am-row--error {
    background: var(--nwc-error-subtle);
}

.am-select {
    padding: 4px 8px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .75rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-900);
    cursor: pointer;
}

/* Status bar */
.am-status-bar {
    padding: 8px 12px;
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    margin-top: 12px;
}

.am-status-bar--hidden {
    display: none;
}

.am-status-bar--ok {
    background: var(--sdtm-success-bg);
    border: 1px solid var(--sdtm-success-border);
    color: var(--sdtm-success);
    display: block;
}

.am-status-bar--error {
    background: var(--sdtm-error-bg);
    border: 1px solid var(--sdtm-error-border);
    color: var(--sdtm-error);
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 02 — DM: DOMAIN MAPPING
   ═══════════════════════════════════════════════════════════════════ */

.dm-root {
    display: block;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 03 — PRODUCTION PROGRAMMING
   ═══════════════════════════════════════════════════════════════════ */

/* Utility: .hidden hides any element (used by all SDTM surfaces) */
.hidden {
    display: none !important;
}

/* Outer column container */
.prod-root {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Split pane — two-column grid */
.prod-split-pane {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    align-items: start;
}

/* Left pane — domain list */
.prod-left-pane {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    position: sticky;
    top: 104px;
}

.prod-domain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 11px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.prod-panel-title {
    font-size: .75rem;
    font-weight: 700;
    color: var(--sdtm-gray-900);
}

.prod-domain-count {
    font-size: .7rem;
    font-family: var(--sdtm-mono);
    color: var(--sdtm-success);
}

.prod-domain-list {
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

.prod-domain-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    cursor: pointer;
    transition: background .1s;
    border-left: 2px solid transparent;
}

.prod-domain-chip:hover {
    background: var(--sdtm-gray-50);
}

.prod-domain-chip.active,
.prod-domain-chip.selected {
    background: var(--sdtm-prod-50);
    border-left-color: var(--sdtm-prod-700);
}

.prod-chip-name {
    font-family: var(--sdtm-mono);
    font-weight: 600;
    font-size: .75rem;
    flex: 1;
}

.prod-chip-badge {
    font-size: .58rem;
    font-weight: 800;
    font-family: var(--sdtm-mono);
    padding: 2px 5px;
    border-radius: 4px;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    flex-shrink: 0;
}

/* Chip status labels */
.prod-chip-status {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.prod-chip-status.approved {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.prod-chip-status.generated {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
}

.prod-chip-status.not-started {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border: 1px solid var(--sdtm-gray-300);
}

/* Right pane — program detail */
.prod-right-pane {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.prod-det-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.prod-det-name {
    font-family: var(--sdtm-mono);
    font-weight: 700;
    font-size: .92rem;
    flex: 1;
}

.prod-det-badge {
    width: 36px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .75rem;
    font-weight: 800;
    font-family: var(--sdtm-mono);
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
    flex-shrink: 0;
}

.prod-det-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

.prod-det-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-bottom: 1px solid var(--sdtm-gray-200);
    background: var(--sdtm-gray-50);
}

/* Program status badge (in det-meta) */
.prod-status-badge {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
}

.prod-status-badge.status-not-started {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border-color: var(--sdtm-gray-300);
}

.prod-status-badge.status-generated {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border-color: var(--sdtm-info-border);
}

.prod-status-badge.status-approved {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

.prod-status-badge.status-error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

/* Language bar */
.prod-lang-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--sdtm-gray-50);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius);
}

.prod-lang-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-500);
}

.prod-lang-btn {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--sdtm-gray-300);
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-600);
    transition: all .12s;
}

.prod-lang-btn.active {
    background: var(--sdtm-prod-900);
    color: #fff;
    border-color: var(--sdtm-prod-900);
}

.prod-lang-btn:hover:not(.active) {
    border-color: var(--sdtm-prod-700);
    color: var(--sdtm-prod-900);
}

/* Tab bar */
.prod-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--sdtm-gray-200);
    background: var(--sdtm-white);
}

.prod-tab-btn {
    padding: 9px 14px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--sdtm-gray-500);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: all .12s;
    font-family: var(--sdtm-font);
    background: transparent;
}

.prod-tab-btn:hover {
    color: var(--sdtm-gray-700);
}

.prod-tab-btn.active {
    color: var(--sdtm-prod-900);
    border-bottom-color: var(--sdtm-prod-900);
    font-weight: 600;
}

/* Tab panels */
.prod-tab-panel {
    display: block;
}

.prod-tab-panel.hidden {
    display: none;
}

/* Code / log blocks */
.prod-code-block {
    background: #1C2333;
    padding: 12px 14px;
    font-family: var(--sdtm-mono);
    font-size: .68rem;
    line-height: 1.9;
    color: #CBD5E1;
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
    margin: 0;
    white-space: pre;
}

.prod-log-block {
    padding: 12px 14px;
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    line-height: 1.8;
    color: var(--sdtm-gray-700);
    background: var(--nwc-ui-surface-soft);
    max-height: 420px;
    overflow-y: auto;
}

.prod-log-line {
    display: block;
}

.prod-log-line.note {
    color: var(--sdtm-success);
}

.prod-log-line.warning {
    color: var(--sdtm-warn);
}

.prod-log-line.error {
    color: var(--sdtm-error);
}

.prod-output-block {
    padding: 14px;
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 420px;
    overflow-y: auto;
}

.prod-code-note {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    background: #252D3D;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.prod-note-text {
    font-size: .65rem;
    color: rgba(255, 255, 255, .4);
    font-family: var(--sdtm-font);
}

.prod-ai-conf {
    font-size: .65rem;
    color: var(--sdtm-gray-400);
    margin-left: 6px;
}

/* Spinner */
.prod-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--sdtm-gray-300);
    border-top-color: var(--sdtm-prod-700);
    border-radius: 50%;
    animation: sdtm-spin .7s linear infinite;
    vertical-align: middle;
}

.prod-spinner.hidden {
    display: none;
}

/* Action bar */
.prod-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    background: var(--sdtm-gray-50);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius);
}

.prod-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--sdtm-radius);
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid var(--sdtm-gray-300);
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    transition: all .15s;
}

.prod-action-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.prod-action-btn.primary {
    background: var(--sdtm-prod-900);
    color: #fff;
    border-color: var(--sdtm-prod-900);
}

.prod-action-btn.primary:hover {
    background: var(--sdtm-prod-700);
}

.prod-action-btn.success {
    background: var(--sdtm-success);
    color: #fff;
    border-color: var(--sdtm-success);
}

.prod-action-btn.success:hover {
    background: var(--sdtm-prod-700);
}

/* Progress */
.prod-progress-wrap {
    flex: 1;
}

.prod-progress-label {
    font-size: .72rem;
    color: var(--sdtm-gray-500);
    white-space: nowrap;
}

/* Status bar */
.prod-status-bar {
    padding: 8px 12px;
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    margin-top: 4px;
}

.prod-status-bar.hidden {
    display: none;
}

.prod-status-bar.success {
    background: var(--sdtm-success-bg);
    border: 1px solid var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.prod-status-bar.error {
    background: var(--sdtm-error-bg);
    border: 1px solid var(--sdtm-error-border);
    color: var(--sdtm-error);
}

/* Empty state */
.prod-empty-state {
    padding: 40px;
    text-align: center;
    color: var(--sdtm-gray-400);
    font-size: .82rem;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 04 — QC PROGRAMMING
   ═══════════════════════════════════════════════════════════════════ */

/* Root is a flex column: langBar → actionBar → independenceBanner → splitPane → statusBar */
.qc-root {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Split pane is the 2-column grid */
.qc-split-pane {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 14px;
    align-items: start;
}

/* Language bar */
.qc-lang-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius-lg);
}

.qc-lang-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-qc-700);
}

.qc-lang-btn {
    padding: 3px 10px;
    border-radius: 4px;
    border: 1px solid var(--sdtm-qc-200);
    font-size: .7rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-qc-700);
    transition: all .12s;
}

.qc-lang-btn.active {
    background: var(--sdtm-qc-900);
    color: #fff;
    border-color: var(--sdtm-qc-900);
}

.qc-lang-btn:hover:not(.active) {
    background: var(--sdtm-qc-50);
}

.qc-progress-wrap {
    flex: 1;
}

.qc-progress-label {
    font-size: .7rem;
    font-family: var(--sdtm-mono);
    color: var(--sdtm-qc-700);
}

/* Action bar */
.qc-action-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius-lg);
}

.qc-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: var(--sdtm-radius);
    font-size: .75rem;
    font-weight: 600;
    border: 1px solid var(--sdtm-qc-200);
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-qc-900);
    transition: all .15s;
}

.qc-action-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.qc-action-btn.primary {
    background: var(--sdtm-qc-900);
    color: #fff;
    border-color: var(--sdtm-qc-900);
}

.qc-action-btn.primary:hover {
    background: var(--sdtm-qc-700);
}

.qc-action-btn.success {
    background: var(--sdtm-success);
    color: #fff;
    border-color: var(--sdtm-success);
}

.qc-action-btn.success:hover {
    filter: brightness(.92);
}

/* Spinner */
.qc-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--sdtm-gray-300);
    border-top-color: var(--sdtm-qc-700);
    border-radius: 50%;
    animation: sdtm-spin .7s linear infinite;
}

.qc-spinner.hidden {
    display: none;
}

/* Independence banner */
.qc-independence-banner {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-qc-50);
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius-lg);
    font-size: .73rem;
    color: var(--sdtm-qc-900);
    line-height: 1.5;
}

/* Left pane */
.qc-left-pane {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    position: sticky;
    top: 104px;
}

.qc-domain-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 11px;
    background: var(--sdtm-qc-50);
    border-bottom: 1px solid var(--sdtm-qc-200);
}

.qc-panel-title {
    font-size: .75rem;
    font-weight: 700;
    color: var(--sdtm-qc-900);
}

.qc-domain-count {
    font-size: .7rem;
    font-family: var(--sdtm-mono);
    color: var(--sdtm-qc-700);
}

.qc-domain-list {
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

.qc-domain-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: background .1s;
}

.qc-domain-chip:hover {
    background: var(--sdtm-gray-50);
}

.qc-domain-chip.active,
.qc-domain-chip.selected {
    background: var(--sdtm-qc-50);
    border-left-color: var(--sdtm-qc-700);
}

.qc-chip-badge {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.qc-chip-name {
    font-family: var(--sdtm-mono);
    font-weight: 600;
    font-size: .75rem;
    flex: 1;
}

.qc-chip-define {
    font-size: .58rem;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 3px;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    border: 1px solid #DDD6FE;
    flex-shrink: 0;
}

.qc-chip-status {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.qc-chip-status.completed {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.qc-chip-status.reviewed {
    background: var(--sdtm-qc-50);
    color: var(--sdtm-qc-700);
    border: 1px solid var(--sdtm-qc-200);
}

.qc-chip-status.generated {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
}

.qc-chip-status.not-started {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border: 1px solid var(--sdtm-gray-300);
}

/* Right pane */
.qc-right-pane {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.qc-det-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--sdtm-qc-50);
    border-bottom: 1px solid var(--sdtm-qc-200);
}

/* Square domain-code badge (e.g. "AE", "LB") */
.qc-det-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--sdtm-qc-900);
    color: #fff;
    border-radius: 6px;
    font-size: .7rem;
    font-weight: 800;
    font-family: var(--sdtm-mono);
    flex-shrink: 0;
}

.qc-det-name {
    font-family: var(--sdtm-mono);
    font-weight: 700;
    font-size: .92rem;
    flex: 1;
}

.qc-det-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--sdtm-gray-100);
}

.qc-det-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 8px 14px;
    border-bottom: 1px solid var(--sdtm-gray-100);
}

/* Status badge */
.qc-status-badge {
    font-size: .65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid;
}

.qc-status-badge.status-not-started {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border-color: var(--sdtm-gray-300);
}

.qc-status-badge.status-generated {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border-color: var(--sdtm-info-border);
}

.qc-status-badge.status-reviewed {
    background: var(--sdtm-qc-50);
    color: var(--sdtm-qc-700);
    border-color: var(--sdtm-qc-200);
}

.qc-status-badge.status-completed {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

/* Define count badge */
.qc-define-count {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    border: 1px solid #DDD6FE;
}

.qc-define-count.hidden {
    display: none;
}

/* Tab bar */
.qc-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--sdtm-gray-200);
    background: var(--sdtm-white);
}

.qc-tab-btn {
    padding: 9px 14px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--sdtm-gray-500);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: var(--sdtm-font);
    transition: color .1s;
}

.qc-tab-btn.active {
    color: var(--sdtm-qc-900);
    border-bottom-color: var(--sdtm-qc-900);
    font-weight: 600;
}

.qc-tab-btn:hover:not(.active) {
    color: var(--sdtm-qc-700);
}

/* Tab panels */
.qc-tab-panel {
    display: block;
}

.qc-tab-panel.hidden {
    display: none;
}

/* Code blocks */
.qc-code-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    background: #1C2333;
    color: rgba(255, 255, 255, .4);
    font-size: .65rem;
    font-family: var(--sdtm-font);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.qc-code-block {
    background: #1C2333;
    padding: 12px 14px;
    font-family: var(--sdtm-mono);
    font-size: .68rem;
    line-height: 1.9;
    color: #CBD5E1;
    overflow-x: auto;
    max-height: 420px;
    overflow-y: auto;
    margin: 0;
}

.qc-log-block {
    padding: 12px 14px;
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    line-height: 1.8;
    color: var(--sdtm-gray-700);
    background: var(--nwc-ui-surface-soft);
    max-height: 420px;
    overflow-y: auto;
}

.qc-log-line {
    display: block;
}

.qc-log-line.note {
    color: var(--sdtm-success);
}

.qc-log-line.warning {
    color: var(--sdtm-warn);
}

.qc-log-line.error {
    color: var(--sdtm-error);
}

.qc-output-block {
    padding: 14px;
    font-family: var(--sdtm-mono);
    font-size: .72rem;
}

.qc-output-note {
    font-size: .72rem;
    color: var(--sdtm-gray-500);
    padding: 6px 14px;
    background: var(--sdtm-warn-bg, #FFFBEB);
    border-bottom: 1px solid var(--sdtm-warn-border, #FDE68A);
    font-style: italic;
}

/* QC note panel */
.qc-note-textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--sdtm-qc-200);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-qc-50);
    color: var(--sdtm-qc-900);
    resize: vertical;
    min-height: 60px;
    line-height: 1.5;
    box-sizing: border-box;
}

.qc-note-textarea:focus {
    outline: none;
    border-color: var(--sdtm-qc-700);
}

.qc-note-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.qc-note-hint {
    font-size: .68rem;
    color: var(--sdtm-gray-400);
    margin-top: 4px;
}

/* Status bar */
.qc-status-bar {
    padding: 7px 14px;
    font-size: .78rem;
    border-radius: var(--sdtm-radius-lg);
    border: 1px solid transparent;
}

.qc-status-bar.hidden {
    display: none;
}

.qc-status-bar.success {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

.qc-status-bar.error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 05 — COMPARE & DIAGNOSTICS
   ═══════════════════════════════════════════════════════════════════ */

/* compare-surface is the two-column root (left panel + right panel) */
.compare-surface {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 14px;
    align-items: start;
}

/* Stats row — inside right panel */
.compare-stats-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.compare-stats-row > * {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    padding: 11px;
    text-align: center;
}

/* Two-pane layout */
.compare-left-panel {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    position: sticky;
    top: 104px;
}

.compare-right-panel {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.compare-domain-list {
    overflow-y: auto;
    max-height: calc(100vh - 220px);
}

/* Domain rows */
.domain-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    cursor: pointer;
    transition: background .1s;
}

.domain-row:hover {
    background: var(--sdtm-gray-50);
}

.domain-row.selected {
    background: var(--sdtm-blue-50);
    border-left: 2px solid var(--sdtm-blue-600);
}

.domain-badge {
    width: 30px;
    height: 26px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .6rem;
    font-weight: 800;
    font-family: var(--sdtm-mono);
    flex-shrink: 0;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
}

.domain-name {
    font-size: .78rem;
    font-weight: 600;
    color: var(--sdtm-gray-900);
}

.domain-info {
    flex: 1;
    min-width: 0;
}

.domain-meta {
    font-size: .62rem;
    color: var(--sdtm-gray-400);
}

.domain-mismatch-detail {
    font-size: .6rem;
    color: var(--sdtm-error);
}

/* Filter row */
.compare-filter-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.filter-btn {
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid var(--sdtm-gray-300);
    font-size: .65rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-600);
    transition: all .12s;
}

.filter-btn.active {
    background: var(--sdtm-blue-900);
    color: #fff;
    border-color: var(--sdtm-blue-900);
}

/* Detail header */
.compare-detail-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.detail-domain-title {
    font-family: var(--sdtm-mono);
    font-weight: 700;
    font-size: .92rem;
    flex: 1;
}

/* detail-pane wraps the tab bar and panels — no extra padding so panels fill edge-to-edge */
.compare-detail-pane {
    overflow: hidden;
}

/* Run all row */
.compare-run-all-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-info-bg);
    border-bottom: 1px solid var(--sdtm-info-border);
    font-size: .75rem;
}

/* Tab bar */
.compare-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--sdtm-gray-200);
    overflow-x: auto;
    scrollbar-width: none;
}

.compare-tab-bar::-webkit-scrollbar {
    display: none;
}

/* Diff table */
.diff-stats-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
    font-size: .75rem;
    font-weight: 600;
}

.diff-table-body {
    width: 100%;
    border-collapse: collapse;
    font-size: .78rem;
}

.diff-row {
    display: grid;
    grid-template-columns: 140px 1fr 1fr 60px 80px;
    gap: 8px;
    padding: 7px 12px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    align-items: center;
}

.diff-row:hover {
    background: var(--sdtm-gray-50);
}

.diff-prod-val {
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    color: var(--sdtm-prod-900);
}

.diff-qc-val {
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    color: var(--sdtm-qc-900);
}

.diff-records {
    font-size: .68rem;
    color: var(--sdtm-gray-400);
}

.diff-action {
    display: flex;
    gap: 4px;
}

.mtype-intentional {
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    border: 1px solid #DDD6FE;
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
}

/* Log / LST */
.diag-log-content {
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    line-height: 1.8;
    color: var(--sdtm-gray-700);
    padding: 12px 14px;
    background: var(--nwc-ui-surface-soft);
    max-height: 360px;
    overflow-y: auto;
}

.diag-severity-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    font-size: .75rem;
}

.lst-content {
    font-family: var(--sdtm-mono);
    font-size: .7rem;
    line-height: 1.8;
    color: var(--sdtm-gray-700);
    padding: 12px 14px;
    background: var(--nwc-ui-surface-soft);
    max-height: 360px;
    overflow-y: auto;
    white-space: pre;
}

.lst-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.lst-toggle {
    padding: 3px 9px;
    border-radius: 4px;
    border: 1px solid var(--sdtm-gray-300);
    font-size: .65rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--sdtm-white);
    font-family: var(--sdtm-font);
}

.lst-toggle.active {
    background: var(--sdtm-blue-900);
    color: #fff;
    border-color: var(--sdtm-blue-900);
}

/* Status bar */
.compare-status-bar {
    padding: 8px 14px;
    font-size: .78rem;
    border-radius: var(--sdtm-radius);
    margin-top: 10px;
}

.compare-status-bar.ok,
.compare-status-bar.success {
    background: var(--sdtm-success-bg);
    border: 1px solid var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.compare-status-bar.error {
    background: var(--sdtm-error-bg);
    border: 1px solid var(--sdtm-error-border);
    color: var(--sdtm-error);
}

.compare-status-bar.hidden {
    display: none;
}

/* Spinner (standalone, no inline) for compare screen */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--sdtm-gray-300);
    border-top-color: var(--sdtm-blue-600);
    border-radius: 50%;
    animation: sdtm-spin .7s linear infinite;
    vertical-align: middle;
}

.spinner.hidden {
    display: none;
}

/* Tab buttons inside compare-tab-bar */
.compare-tab-bar .tab-btn {
    padding: 9px 14px;
    font-size: .78rem;
    font-weight: 500;
    color: var(--sdtm-gray-500);
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    font-family: var(--sdtm-font);
    white-space: nowrap;
    transition: color .1s;
}

.compare-tab-bar .tab-btn.active {
    color: var(--sdtm-blue-900);
    border-bottom-color: var(--sdtm-blue-900);
    font-weight: 600;
}

.compare-tab-bar .tab-btn:hover:not(.active) {
    color: var(--sdtm-gray-700);
}

/* Compare panel visibility */
.compare-panel {
    display: block;
}

.compare-panel.hidden {
    display: none;
}

/* Domain row status chips */
.status-chip {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 3px;
    white-space: nowrap;
    border: 1px solid;
    flex-shrink: 0;
}

.status-chip.status-match {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

.status-chip.status-mismatch {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

.status-chip.status-error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

.status-chip.status-not-run {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border-color: var(--sdtm-gray-300);
}

/* Diff table missing classes */
.diff-row-header span {
    font-size: .62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-500);
}

.diff-var {
    font-family: var(--sdtm-mono);
    font-size: .75rem;
    font-weight: 600;
    color: var(--sdtm-gray-900);
}

.diff-mismatch-type {
    font-size: .6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    white-space: nowrap;
}

.mtype-match {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.mtype-prog-error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border: 1px solid var(--sdtm-error-border);
}

/* Severity tags in diagnostics panel */
.sev-tag {
    font-size: .62rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    border: 1px solid;
}

.sev-tag.sev-error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

.sev-tag.sev-warning {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border-color: #FDE68A;
}

/* Query raised tag */
.query-raised-tag {
    font-size: .65rem;
    color: var(--sdtm-blue-600);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 06 — VALIDATION (Pre-P21 Readiness)
   ═══════════════════════════════════════════════════════════════════ */

.validation-surface {
    display: block;
}

.validation-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius);
    margin-bottom: 12px;
}

.filter-select {
    padding: 5px 9px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    cursor: pointer;
}

.filter-select:focus {
    outline: none;
    border-color: var(--sdtm-blue-600);
}

.validation-summary {
    display: flex;
    gap: 0;
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    margin-bottom: 14px;
    background: var(--sdtm-white);
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.1;
    display: block;
}

.stat-label {
    font-size: .6rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-400);
    font-weight: 600;
    margin-top: 2px;
    display: block;
}

.stat-error .stat-value {
    color: var(--sdtm-error);
}

.stat-warning .stat-value {
    color: var(--sdtm-warn);
}

.stat-notice .stat-value {
    color: var(--sdtm-blue-600);
}

.stat-info .stat-value {
    color: var(--sdtm-gray-500);
}

.findings-table-wrapper {
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.findings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .79rem;
}

.findings-table th {
    background: var(--sdtm-gray-50);
    padding: 7px 11px;
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-500);
    border-bottom: 1px solid var(--sdtm-gray-200);
    text-align: left;
    white-space: nowrap;
}

.findings-table td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    vertical-align: middle;
}

.findings-table tr:last-child td {
    border-bottom: none;
}

.findings-table tr:hover td {
    background: var(--sdtm-gray-50);
}

/* Status bar — shared by validation, p21, package */
.status-bar {
    padding: 8px 12px;
    border-radius: var(--sdtm-radius);
    margin-top: 10px;
    font-size: .78rem;
}

.status-bar.ok {
    background: var(--sdtm-success-bg);
    border: 1px solid var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.status-bar.error {
    background: var(--sdtm-error-bg);
    border: 1px solid var(--sdtm-error-border);
    color: var(--sdtm-error);
}

.status-bar.hidden {
    display: none;
}

.status-msg {
    font-size: .78rem;
}

/* Inline spinner */
.spinner-inline {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--sdtm-gray-300);
    border-top-color: var(--sdtm-blue-600);
    border-radius: 50%;
    animation: sdtm-spin .7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes sdtm-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Shared button styles (used across screens 05–08) ── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--sdtm-blue-800, #1E40AF);
    color: #fff;
    border: 1px solid var(--sdtm-blue-800, #1E40AF);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--sdtm-font);
    cursor: pointer;
    transition: all .12s;
}

.btn-primary:hover:not(:disabled) {
    background: var(--sdtm-blue-900, #1E3A8A);
}

.btn-primary:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--sdtm-font);
    cursor: pointer;
    transition: all .12s;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--sdtm-gray-50);
}

.btn-secondary:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.btn-warning {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border: 1px solid #FDE68A;
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-weight: 600;
    font-family: var(--sdtm-font);
    cursor: pointer;
    transition: all .12s;
}

.btn-sm {
    padding: 3px 8px;
    font-size: .7rem;
}

.btn-xs {
    padding: 2px 6px;
    font-size: .65rem;
    font-weight: 600;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--sdtm-font);
}

.btn-lg {
    padding: 8px 18px;
    font-size: .85rem;
}

.btn-fix {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border: 1px solid var(--sdtm-success-border);
}

.btn-accept {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
}

.btn-csdrg {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-600);
    border: 1px solid var(--sdtm-gray-300);
}

.btn-save {
    background: var(--sdtm-blue-800, #1E40AF);
    color: #fff;
    border: 1px solid var(--sdtm-blue-800, #1E40AF);
}

.btn-fix:hover, .btn-accept:hover, .btn-csdrg:hover, .btn-save:hover {
    filter: brightness(.92);
}

/* Stat cell (shared between compare and validation) */
.stat-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    min-width: 0;
}

/* Severity badge in findings tables (validation + p21) */
.sev-badge {
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.sev-badge.sev-error {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
    border: 1px solid #FECACA;
}

.sev-badge.sev-warning {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border: 1px solid #FDE68A;
}

.sev-badge.sev-notice {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
}

/* Status badge in findings table */
.status-badge {
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid;
}

.status-badge.st-open {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

.status-badge.st-resolved {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

.status-badge.st-closed {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    border-color: var(--sdtm-gray-300);
}

/* Validation-specific table cells */
.rule-id {
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    color: var(--sdtm-blue-600);
}

.msg-cell {
    max-width: 280px;
    word-break: break-word;
    font-size: .77rem;
}

.actions-cell {
    white-space: nowrap;
}

.autofix-yes {
    font-size: .65rem;
    font-weight: 700;
    color: var(--sdtm-success);
}

.p21-risk {
    font-size: .65rem;
    font-weight: 600;
    color: var(--sdtm-warn);
}

.empty-msg {
    text-align: center;
    padding: 20px;
    color: var(--sdtm-gray-400);
    font-size: .8rem;
}

.resolved {
    font-size: .65rem;
    color: var(--sdtm-gray-400);
    font-style: italic;
}

/* Row severity colouring for finding rows */
.finding-row.sev-error > td {
    border-left: 3px solid var(--sdtm-error);
}

.finding-row.sev-warning > td:first-child {
    border-left: 3px solid var(--sdtm-warn);
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 07 — P21 VALIDATION (Pinnacle 21)
   ═══════════════════════════════════════════════════════════════════ */

.p21-surface {
    display: block;
}

.p21-table-wrapper {
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
}

.p21-compare-panel {
    background: var(--sdtm-white);
    border: 1px solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    overflow: hidden;
    margin-top: 14px;
}

/* Profile selector */
.profile-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

.profile-label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--sdtm-gray-700);
    flex-shrink: 0;
}

.btn-profile {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--sdtm-gray-300);
    font-size: .72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-600);
    transition: all .12s;
}

.btn-profile.active {
    background: var(--sdtm-blue-900);
    color: #fff;
    border-color: var(--sdtm-blue-900);
}

.btn-profile:hover:not(.active) {
    border-color: var(--sdtm-blue-600);
    color: var(--sdtm-blue-600);
}

/* Resolution controls */
.resolution-select {
    padding: 4px 8px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .73rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-900);
    cursor: pointer;
}

.just-input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .73rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-900);
}

.just-input:focus {
    outline: none;
    border-color: var(--sdtm-blue-600);
}

/* Severity chips */
.p21-severity-e {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
    border: 1px solid #FECACA;
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.p21-severity-w {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border: 1px solid #FDE68A;
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

.p21-severity-n {
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
    border: 1px solid var(--sdtm-info-border);
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
}

/* P21 compare panel internals */
.p21-compare-panel {
    display: flex;
    padding: 14px;
    gap: 14px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.compare-section {
    flex: 1;
    min-width: 140px;
}

.compare-section h4 {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-400);
    margin: 0 0 8px;
}

.compare-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--sdtm-gray-100);
    font-size: .78rem;
}

.compare-label {
    color: var(--sdtm-gray-500);
    font-size: .75rem;
}

.compare-value {
    font-weight: 700;
    font-size: .92rem;
    color: var(--sdtm-gray-900);
    font-family: var(--sdtm-mono);
}

.compare-arrow {
    font-size: 1.5rem;
    color: var(--sdtm-gray-300);
    align-self: center;
    padding: 0 8px;
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 0;
    font-size: .78rem;
}

.p21-stat {
    font-size: .78rem;
    font-weight: 600;
}

.p21-stat b {
    font-size: 1rem;
}

.p21-stat.error {
    color: var(--sdtm-error);
}

.p21-stat.warning {
    color: var(--sdtm-warn);
}

.p21-stat.notice {
    color: var(--sdtm-blue-600);
}

.p21-stat.pass {
    color: var(--sdtm-success);
}

/* P21 findings table cells */
.desc-cell {
    max-width: 300px;
    word-break: break-word;
    font-size: .77rem;
}

.res-cell {
    min-width: 120px;
}

.just-cell {
    min-width: 160px;
}

.action-cell {
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════════════
   SCREEN 08 — PACKAGE READY
   ═══════════════════════════════════════════════════════════════════ */

.package-surface {
    display: block;
}

/* Tab bar */
.tab-bar {
    display: flex;
    border-bottom: 2px solid var(--sdtm-gray-200);
    margin-bottom: 16px;
    overflow-x: auto;
    scrollbar-width: none;
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab {
    padding: 10px 18px;
    font-size: .82rem;
    font-weight: 500;
    color: var(--sdtm-gray-500);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all .12s;
    font-family: var(--sdtm-font);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--sdtm-gray-700);
}

.tab.active {
    color: var(--sdtm-blue-800);
    border-bottom-color: var(--sdtm-blue-800);
    font-weight: 700;
}

/* Tab panels for package screen */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel.hidden {
    display: none;
}

/* Gates grid */
.gates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.gate-card {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--sdtm-radius-lg);
    font-size: .78rem;
    border: 1px solid;
}

.gate-card.gate-pass {
    background: var(--sdtm-success-bg);
    border-color: var(--sdtm-success-border);
}

.gate-card.gate-warn {
    background: var(--nwc-warning-subtle);
    border-color: #FDE68A;
}

.gate-card.gate-fail {
    background: var(--sdtm-error-bg);
    border-color: var(--sdtm-error-border);
}

.gate-icon {
    font-size: 1rem;
    font-weight: 900;
    flex-shrink: 0;
    line-height: 1;
}

.gate-icon.pass {
    color: var(--sdtm-success);
}

.gate-icon.warn {
    color: #92400E;
}

.gate-icon.fail {
    color: var(--sdtm-error);
}

.gate-body {
    flex: 1;
    min-width: 0;
}

.gate-id {
    font-family: var(--sdtm-mono);
    font-size: .65rem;
    color: var(--sdtm-gray-400);
}

.gate-label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--sdtm-gray-900);
    margin-top: 2px;
}

.gate-detail {
    font-size: .68rem;
    color: var(--sdtm-gray-500);
    margin-top: 3px;
    word-break: break-word;
}

/* Legacy grid children fallback */
.gates-grid > *.pass {
    background: var(--sdtm-success-bg);
    border-color: var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.gates-grid > *.fail {
    background: var(--sdtm-error-bg);
    border-color: var(--sdtm-error-border);
    color: var(--sdtm-error);
}

.gates-grid > *.warn {
    background: var(--sdtm-warn-bg);
    border-color: var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

/* Datasets table */
.datasets-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .79rem;
}

.datasets-table th {
    background: var(--sdtm-gray-50);
    padding: 7px 11px;
    font-size: .63rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--sdtm-gray-500);
    border-bottom: 1px solid var(--sdtm-gray-200);
    text-align: left;
}

.datasets-table td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--sdtm-gray-100);
    vertical-align: middle;
}

.datasets-table tr:last-child td {
    border-bottom: none;
}

.datasets-table tr:hover td {
    background: var(--sdtm-gray-50);
}

/* Generate row */
.generate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--sdtm-info-bg);
    border: 1px solid var(--sdtm-info-border);
    border-radius: var(--sdtm-radius);
    margin-bottom: 14px;
}

/* Settings form */
.settings-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Panel toolbar */
.panel-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--sdtm-gray-50);
    border-bottom: 1px solid var(--sdtm-gray-200);
}

/* Content viewer */
.content-viewer {
    font-family: var(--sdtm-mono);
    font-size: .72rem;
    line-height: 1.8;
    color: var(--sdtm-gray-700);
    padding: 14px;
    background: var(--nwc-ui-surface-soft);
    max-height: 480px;
    overflow-y: auto;
    white-space: pre-wrap;
}

/* Traceability chain */
.trace-chain {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    font-size: .72rem;
    margin-top: 8px;
}

.trace-node {
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    white-space: nowrap;
    margin: 2px;
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-600);
    border: 1px solid var(--sdtm-gray-200);
}

.trace-node.active-node {
    background: var(--sdtm-blue-800, #1E40AF);
    color: #fff;
    border-color: var(--sdtm-blue-800, #1E40AF);
}

.trace-arrow {
    font-size: .9rem;
    color: var(--sdtm-gray-300);
    margin: 2px;
}

/* Settings form */
.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-row label {
    font-size: .78rem;
    font-weight: 600;
    color: var(--sdtm-gray-700);
    min-width: 130px;
}

.form-select {
    padding: 6px 10px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    cursor: pointer;
    flex: 1;
}

.form-input {
    padding: 6px 10px;
    border: 1px solid var(--sdtm-gray-300);
    border-radius: var(--sdtm-radius);
    font-size: .78rem;
    font-family: var(--sdtm-font);
    background: var(--sdtm-white);
    color: var(--sdtm-gray-700);
    flex: 1;
}

.form-select:focus, .form-input:focus {
    outline: none;
    border-color: var(--sdtm-blue-600);
}

/* Dataset table badges */
.qc-badge, .p21-badge, .pkg-badge {
    font-size: .6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    border: 1px solid;
}

.qc-badge {
    background: var(--sdtm-qc-50);
    color: var(--sdtm-qc-700);
    border-color: var(--sdtm-qc-200);
}

.p21-badge {
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-600);
    border-color: var(--sdtm-gray-300);
}

.pkg-badge.st-ready {
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
    border-color: var(--sdtm-success-border);
}

.pkg-badge.st-error {
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
    border-color: var(--sdtm-error-border);
}

/* Package status badge st-* variants (applied as "pkg-status-badge st-{status}") */
.pkg-status-badge.st-ready {
    background: var(--sdtm-success-bg);
    border-color: var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.pkg-status-badge.st-error {
    background: var(--sdtm-error-bg);
    border-color: var(--sdtm-error-border);
    color: var(--sdtm-error);
}

.pkg-status-badge.st-warn {
    background: var(--sdtm-warn-bg);
    border-color: var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

.pkg-status-badge.st-pending {
    background: var(--sdtm-gray-100);
    border-color: var(--sdtm-gray-300);
    color: var(--sdtm-gray-600);
}

/* Package status badge */
.pkg-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 700;
    border: 1px solid;
}

.pkg-status-badge.ready {
    background: var(--sdtm-success-bg);
    border-color: var(--sdtm-success-border);
    color: var(--sdtm-success);
}

.pkg-status-badge.error {
    background: var(--sdtm-error-bg);
    border-color: var(--sdtm-error-border);
    color: var(--sdtm-error);
}

.pkg-status-badge.warn {
    background: var(--sdtm-warn-bg);
    border-color: var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

/* cSDRG pct */
.csdrg-pct {
    font-size: .82rem;
    font-weight: 700;
    color: var(--sdtm-blue-600);
}

/* Status variants used by package */
.st-ready {
    color: var(--sdtm-success);
}

.st-error {
    color: var(--sdtm-error);
}

/* ═══════════════════════════════════════════════════════════════════ */

.ag-theme-quartz * {
    font-size: 1rem;
}

.records-link-btn {
    vertical-align: baseline;
}

.adam-sap-studydoc-link {
    width: fit-content;
    padding: 0;
    border: none;
    background: none;
    color: #0b56d3;
    font-size: 0.8125rem;
    cursor: pointer;
    text-decoration: none;
}

.adam-sap-studydoc-link:hover {
    text-decoration: underline;
}

.project-status-badge-active {
    background: rgba(16, 163, 127, 0.10);
    color: var(--nwc-accent-active);
    border: 1px solid rgba(16, 163, 127, 0.22);
}

.project-status-badge-archived {
    background: rgba(0, 0, 0, 0.04);
    color: var(--nwc-raw-gray-500);
    border: 1px solid rgba(0, 0, 0, 0.09);
}

.project-status-badge-pending {
    background: rgba(245, 158, 11, 0.08);
    color: #92580A;
    border: 1px solid rgba(245, 158, 11, 0.20);
}

.project-status-badge-failed {
    background: rgba(220, 38, 38, 0.08);
    color: #991b1b;
    border: 1px solid rgba(220, 38, 38, 0.20);
}

.project-status-badge-info,
.adam-ai-corrections-status-running {
    background: rgba(24, 105, 180, 0.08);
    color: #1869b4;
    border: 1px solid rgba(24, 105, 180, 0.20);
}

/* ── Audit log "Changes" cell rendering (admin audit grid) ───── */
.admin-audit-logs-changes-cell {
    padding: 0.375em 0;
    white-space: normal;
    line-height: 1.4;
    max-height: 100%;
    overflow-y: auto;
    box-sizing: border-box;
}

.admin-audit-logs-changes-line {
    word-break: break-word;
    margin-bottom: 0.125em;
}

/* ── Audit log filter bar ────────────────────────────────────────────────── */

/* Green palette scoped to the audit filter bar */
.audit-filter-bar {
    --af-green: #00897B;
    --af-green-dk: #00695C;
    --af-green-lt: rgba(0, 137, 123, 0.10);
    display: flex;
    align-items: center;
    gap: 0.625em;
    padding: 0.625em 1em;
    background: var(--nwc-ui-surface);
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
    flex-shrink: 0;
    position: relative;
}

.audit-filter-bar-spacer {
    flex: 1;
}

/* ── Time range selector trigger button ──────────────────────────────────── */

.audit-filter-search-box {
    flex: 1;
    min-width: 12.5em;
    height: 1.875em;
    display: flex;
    align-items: center;
    gap: 0.4375em;
    background: var(--nwc-ui-surface);
    border: 1px solid var(--line);
    border-radius: 0.375em;
    padding: 0 0.625em;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.audit-filter-search-box:focus-within {
    border-color: var(--af-green);
    box-shadow: 0 0 0 2px rgba(0, 137, 123, 0.12);
}

.audit-filter-search-icon {
    color: var(--muted);
    display: flex;
    flex-shrink: 0;
}

.audit-filter-search-input {
    flex: 1;
    --nwc-input-border: none;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 0.8125em;
    color: var(--text);
    background: transparent;
}

.audit-filter-search-input::placeholder {
    color: var(--muted);
}

.audit-filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125em;
    padding: 0.3125em 0.75em;
    font-family: inherit;
    font-size: 0.8125em;
    border-radius: 0.375em;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}

.audit-filter-btn-icon {
    background: var(--nwc-ui-surface);
    border: 1px solid var(--line);
    color: var(--muted);
    padding: 0.3125em 0.5625em;
}

.audit-filter-btn-icon:hover {
    background: var(--bg);
    color: var(--text);
}

.audit-filter-btn-primary {
    background: var(--af-green);
    border: 1px solid var(--af-green);
    color: #fff;
    font-weight: 600;
}

.audit-filter-btn-primary:hover {
    background: var(--af-green-dk);
    border-color: var(--af-green-dk);
}

/* ── Time range selector popup (dark-themed) ─────────────────────────────── */

/* ── ACTION column filter icon (injected) ───────────────────────────────── */

.audit-header-filter-btn,
.audit-action-filter-btn {
    cursor: pointer;
    border: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    line-height: 1;
    border-radius: 0.1875em;
    transition: background-color 0.1s;
}

.audit-header-filter-btn:hover,
.audit-header-filter-btn:focus-visible,
.audit-action-filter-btn:hover {
    background-color: rgba(186, 191, 199, 0.4);
}

.audit-header-filter-btn:focus-visible {
    outline: 2px solid #229e8c;
    outline-offset: 1px;
}

/* ── ACTION column multiselect filter popup ──────────────────────────────── */

.audit-action-filter-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--nwc-ui-surface);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.25em;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    width: 15.625em;
    overflow: hidden;
}

.audit-action-filter-popup--open {
    display: block;
}

.audit-action-filter-header {
    padding: 0.75em 1em 0.5em;
    font-size: 0.6875em;
    font-weight: 600;
    color: var(--nwc-text-secondary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}


.audit-action-filter-list {
    max-height: 13.75em;
    overflow-y: auto;
}

.audit-action-filter-item {
    display: flex;
    align-items: center;
    gap: 0.625em;
    padding: 0.4375em 1em;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s;
}

.audit-action-filter-item:hover {
    background: var(--nwc-ui-surface-soft);
}

.audit-action-filter-checkbox {
    width: 1em;
    height: 1em;
    border: 1.5px solid var(--nwc-ui-border);
    border-radius: 0.1875em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--nwc-ui-surface);
    transition: background 0.1s, border-color 0.1s;
}

.audit-action-filter-item--checked .audit-action-filter-checkbox {
    background: #2BB6A3;
    border-color: #2BB6A3;
}

.audit-action-filter-checkbox-mark {
    display: none;
    width: 0.5625em;
    height: 0.3125em;
    border-bottom: 2px solid #fff;
    border-left: 2px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}

.audit-action-filter-item--checked .audit-action-filter-checkbox-mark {
    display: block;
}

.audit-action-filter-label {
    font-size: 0.8125em;
    color: var(--nwc-text-primary);
    flex: 1;
    white-space: nowrap;
}

.audit-action-filter-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.625em 1em;
    border-top: 1px solid var(--nwc-ui-border);
    gap: 0.5em;
}

.audit-action-filter-clear {
    font-size: 0.8125em;
    color: var(--nwc-text-secondary);
    cursor: pointer;
    padding: 0.25em 0;
    user-select: none;
    transition: color 0.1s;
}

.audit-action-filter-clear:hover {
    color: var(--nwc-text-primary);
}

.audit-action-filter-footer-btns {
    display: flex;
    gap: 0.5em;
}

.audit-action-filter-cancel {
    padding: 0.3125em 0.875em;
    font-size: 0.8125em;
    font-weight: 500;
    color: var(--nwc-text-primary);
    background: var(--nwc-ui-surface);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.25em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}

.audit-action-filter-cancel:hover {
    background: var(--nwc-ui-surface-soft);
}

.audit-action-filter-apply {
    padding: 0.3125em 0.875em;
    font-size: 0.8125em;
    font-weight: 500;
    color: #fff;
    background: #2BB6A3;
    border: none;
    border-radius: 0.25em;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.1s;
}

.audit-action-filter-apply:hover {
    background: #24a090;
}

/* ── Prefix filter (First Name / Last Name / Username) text input ─────────── */

.audit-prefix-filter-input-wrap {
    margin: 0 1em 0.5em;
}

/* --- Audit filter chips row --- */
.audit-chips-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375em;
    padding: 0.375em 1em;
    background: var(--af-bg, var(--nwc-ui-surface-soft));
    border-bottom: 1px solid var(--line, #e2e8f0);
}

.audit-chips-label {
    font-size: 0.75em;
    font-weight: 600;
    color: var(--muted, var(--nwc-text-secondary));
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.audit-chip {
    font-size: 0.75em;
    --nwc-tag-font-family: inherit;
    --nwc-tag-font-size: inherit;
    --nwc-tag-font-weight: inherit;
    --nwc-tag-line-height: 1.7;
    --nwc-tag-background: var(--af-teal, #0d9488);
    --nwc-tag-color: #fff;
    --nwc-tag-border-width: 0;
    --nwc-tag-radius: 999px;
    --nwc-tag-gap: 0.25em;
    --nwc-tag-min-block-size: auto;
    --nwc-tag-padding-block: 0.125em;
    --nwc-tag-padding-inline: 0.5em;
    --nwc-tag-max-inline-size: none;
    --nwc-tag-label-white-space: nowrap;
    --nwc-tag-label-overflow: visible;
    --nwc-tag-label-text-overflow: clip;
    --nwc-tag-prefix-font-size: 1rem;
    --nwc-tag-prefix-font-weight: 600;
    --nwc-tag-prefix-line-height: 1.7;
    --nwc-tag-close-font-size: 0.8125em;
    --nwc-tag-close-font-weight: inherit;
    --nwc-tag-close-line-height: 1;
    --nwc-tag-close-inline-size: 0.875em;
    --nwc-tag-close-block-size: 0.875em;
    --nwc-tag-close-margin-inline-end: 0;
    --nwc-tag-close-border-radius: 50%;
    --nwc-tag-close-background: rgba(255, 255, 255, 0.25);
    --nwc-tag-close-hover-background: rgba(255, 255, 255, 0.45);
    --nwc-tag-close-opacity: 1;
    --nwc-tag-close-hover-opacity: 1;
}

.audit-chips-spacer {
    flex: 1;
}

.audit-chips-clear-all {
    font-size: 0.75em;
    white-space: nowrap;
    --nwc-button-color: var(--af-teal, #0d9488);
    --nwc-button-text-font-family: inherit;
    --nwc-button-text-font-size: inherit;
    --nwc-button-text-font-weight: inherit;
    --nwc-button-text-line-height: 1.7;
    --nwc-button-text-decoration: underline;
    --nwc-button-text-hover-color: var(--af-teal-dk, #0f766e);
}

.spinner {
    width: 1.5em;
    height: 1.5em;
    border: 2px solid var(--nwc-text-primary);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

.spinner::after {
    content: '';
    box-sizing: border-box;
    position: absolute;
    left: 0;
    top: 0;
    background: #92580A;
    width: 0.5em;
    height: 0.5em;
    transform: translate(-50%, 50%);
    border-radius: 50%;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.picture-button {
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
    background-color: transparent;
    color: var(--nwc-text-primary);
}

.centered-cell-content {
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

:root {
    --bs-border-width: 1px;
    --bs-border-radius: 0.375rem;
}

.alert {
    --bs-alert-bg: transparent;
    --bs-alert-padding-x: 1rem;
    --bs-alert-padding-y: 1rem;
    --bs-alert-margin-bottom: 0rem;
    --bs-alert-color: inherit;
    --bs-alert-border-color: transparent;
    --bs-alert-border: var(--bs-border-width) solid var(--bs-alert-border-color);
    --bs-alert-border-radius: var(--bs-border-radius);
    --bs-alert-link-color: inherit;

    position: relative;
    padding: var(--bs-alert-padding-y) var(--bs-alert-padding-x);
    margin-bottom: var(--bs-alert-margin-bottom);
    color: var(--bs-alert-color);
    background-color: var(--bs-alert-bg);
    border: var(--bs-alert-border);
    border-radius: var(--bs-alert-border-radius);
}

.alert-warning {
    --bs-alert-color: #664d03;
    --bs-alert-bg: #fff3cd;
    --bs-alert-border-color: #ffe69c;
    --bs-alert-link-color: #664d03;
}

.admin-project-roles-root {
    --grid-chrome-height: 16rem;
}

.admin-project-roles-grid-shell {
    flex: 1 1 auto;
    height: 23.75rem;
    min-height: 23.75rem;
}

.admin-project-roles-tabs-slot {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.admin-project-roles-tabs-slot > nph-tab-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.admin-project-roles-env-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    min-width: 0;
}

.wc-ui-tab-content {
    gap: 1rem;
    display: flex;
    flex-direction: column;
}

/* ── Lock-screen overlay ─────────────────────────────────────────────────
 *
 * CAI-217 review fix (RSeglin): all dimensional values use REM (1rem = 16px)
 * so the layout adapts to the user's browser font-size setting. Visibility
 * is owned by the .is-hidden modifier class — Java code toggles the class,
 * never sets style.display directly. */

/* ── DevTools-proof session lock screen (CAI-217 follow-up) ─────────────────
 * Mounted as the sole <body> child while locked. The app's <sp-theme> root
 * is detached from the document, so this stylesheet is the only thing
 * styling the locked view.
 *
 * Colors are hardcoded (not var(--bs-*)) on purpose — Bootstrap CSS variables
 * may be defined inside the detached theme provider, in which case var()
 * would silently fall through to its default. Hardcoding guarantees the
 * lock screen renders correctly even with the entire app subtree gone. Do
 * not "consistency-fix" these to var(--bs-*).
 */

.session-lock-screen {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0a0e17 0%, #111827 40%, #0d1f1a 70%, #0a0e17 100%);
    /* Max 32-bit z-index — defends against browser extensions and third-party
     * scripts that inject siblings directly into <body> with their own
     * positive z-index. The detach already removes app DOM; this prevents
     * a sibling toast from painting visibly over the lock screen. */
    z-index: 2147483647;
    position: relative;
    overflow: hidden;
}

/* Background Web */
.session-lock-screen::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(26, 188, 156, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 188, 156, 0.03) 1px, transparent 1px);
    background-size: 5rem 5rem;
    pointer-events: none;
}

/* Geometric Shapes — Circles */
.session-lock-screen-bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(6rem);
    pointer-events: none;
    animation: float 20s ease-in-out infinite;
}

.session-lock-screen-bg-shape--1 {
    width: 30rem;
    height: 30rem;
    background: rgba(26, 188, 156, 0.1);
    top: -12rem;
    right: -9rem;
    animation-delay: 0s;
}

.session-lock-screen-bg-shape--2 {
    width: 25rem;
    height: 25rem;
    background: rgba(26, 188, 156, 0.13);
    bottom: -9rem;
    left: -6rem;
    animation-delay: -7s;
}

.session-lock-screen-bg-shape--3 {
    width: 18.75rem;
    height: 18.75rem;
    background: rgba(26, 188, 156, 0.09);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

/* Thin Lines */
.session-lock-screen-bg-line {
    position: absolute;
    pointer-events: none;
    border: 1px solid rgba(26, 188, 156, 0.06);
    border-radius: 50%;
}

.session-lock-screen-bg-line--1 {
    width: 50rem;
    height: 50rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.session-lock-screen-bg-line--2 {
    width: 68.75rem;
    height: 68.75rem;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-color: rgba(26, 188, 156, 0.03);
}

/* Flow Animation */
@keyframes float {
    0%, 100% {
        transform: translate(0, 0) scale(1);
    }
    25% {
        transform: translate(2rem, -1.25rem) scale(1.05);
    }
    50% {
        transform: translate(-0.95rem, 1.6rem) scale(0.95);
    }
    75% {
        transform: translate(-1.6rem, -0.95rem) scale(1.02);
    }
}

.session-lock-screen-card {
    background: var(--nwc-basic-background);
    border-radius: 0.5rem;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(26, 188, 156, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
    padding: 1.75rem 2rem;
    min-width: 22rem; /* 352px */
    max-width: 28rem; /* 448px */
    display: flex;
    flex-direction: column;
}

.session-lock-screen-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
    text-align: center;
}

.session-lock-screen-subtitle {
    font-size: 0.875rem;
    color: var(--nwc-text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
}

.session-lock-screen-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.session-lock-screen-greeting {
    font-size: 1rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.session-lock-screen-message {
    font-size: 0.9rem;
    color: var(--nwc-text-secondary);
}

.session-lock-screen-password-row {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.session-lock-screen-password-input {
    width: 100%;
}

.session-lock-screen-error {
    color: #dc3545;
    font-size: 0.85rem;
}

.session-lock-screen-attempts {
    color: var(--nwc-text-secondary);
    font-size: 0.8rem;
}

.session-lock-screen-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.session-lock-screen-body .is-hidden,
.session-lock-screen-footer .is-hidden,
.session-lock-screen-password-row.is-hidden {
    display: none !important;
}

/*
 * Primary-action buttons need white label text on the teal background.
 *
 * Workaround for an `nphase-wc` bundle bug: `UiSupport.actionButton(label,
 * "wc-ui-button wc-ui-button-primary", ...)` (which `FormDialog.ActionSpec
 * .primaryAction(...)` calls under the hood) hard-codes `variant=GHOST` on
 * the inner shadow-DOM button regardless of className. The host gets the
 * teal primary background, but the inner GHOST text picks up `--nwc-accent`
 * (also teal) → invisible label. Setting `--nwc-accent: #fff` on the host
 * inherits through the shadow boundary and recolours the GHOST text white.
 *
 * Per CAI-227, the override is scoped via screen-local marker classes
 * already on our own DOM — it cannot leak to any modal we don't author:
 *   - `library-sdtm-dialog-body`  — every SDTM Library editor dialog
 *   - `library-sdtm-preview-body` — every SDTM Library preview dialog
 *   - `session-lock-screen-footer` — the lock screen (not a modal but
 *     uses the same primary-button helper)
 *
 * Remove once `nphase-wc-components` honours variant from className in
 * `actionButton(...)`.
 */
.wc-ui-modal-card:has(.library-sdtm-dialog-body) .wc-ui-button-primary,
.wc-ui-modal-card:has(.library-sdtm-preview-body) .wc-ui-button-primary,
.session-lock-screen-footer .wc-ui-button-primary {
    --nwc-accent: #fff;
}

/* SDTM Mappings — wc-button hover artifact suppression.
   ───────────────────────────────────────────────────────────────────────
   <nph-button> shadow CSS paints the inner button's :hover background
   using `var(--nwc-accent-subtle)` with its own `border-radius: 0.625rem`.
   The host (`.wc-ui-button`) has `border-radius: 999px` (pill). On hover
   both paint — the inner shaded rectangle is smaller and more square than
   the outer pill, producing "a smaller shaded button inside the real
   button". CSS custom properties inherit through the shadow boundary, so
   overriding the variant hover variables on the host suppresses the
   inner paint. The host's own .wc-ui-button :hover (border + transform)
   still fires and provides the visible feedback.

   Per CAI-227: scoped to SDTM only via `:has()` anchored on SDTM-specific
   marker classes already present on every dialog body
   (`library-sdtm-preview-body`, `library-sdtm-dialog-body`) plus the
   detail-modal footer (`lsd-modal-footer`) and the refresh icon's own
   class (`library-sdtm-zone-toggle-refresh`). Other screens using
   FormDialog / FilePickerField / Button get the nphase-wc contract
   unmodified. */
.wc-ui-modal-card:has(.library-sdtm-preview-body) .wc-ui-actions .wc-ui-button,
.wc-ui-modal-card:has(.library-sdtm-dialog-body) .wc-ui-actions .wc-ui-button,
.wc-ui-modal-card:has(.library-sdtm-dialog-body) .wc-ui-file-picker .wc-ui-button,
.lsd-modal-footer .wc-ui-button {
    /* Ghost variant hover/active — used by Close / Cancel / Refresh */
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    /* Secondary variant hover — used by previous SECONDARY refresh */
    --nwc-raw-gray-50: transparent;
    --nwc-raw-gray-100: transparent;
    --nwc-secondary-shadow: none;
    /* Accent variant hover — used by primary Save / Apply actions */
    --nwc-accent-hover: var(--nwc-accent);
    /* Suppress the inner-button transform so it doesn't double-stack with
       the host's :hover transform */
    --nwc-inset-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   CAI-243 Library Sources v2 — design tokens + component styles
   ═══════════════════════════════════════════════════════════════════════ */

:root {
    /* Status tones */
    --cai-ok: #1D9E75;
    --cai-warn: #B45309;
    --cai-err: #C0322B;
    --cai-idle: var(--nwc-text-muted);

    /* Type-badge palette — one representative tone per connection type (Sources + Destinations).
       Soft tinted background + readable muted foreground; hues spread for at-a-glance distinction. */
    --cai-rest: #BE3A55; /* REST API — friendly rose-red */
    --cai-rest-soft: #FBE9EC;
    --cai-fs: #1E5FD0; /* Filesystem — blue */
    --cai-fs-soft: #E2ECFB;
    --cai-sql: #6B3FB3; /* SQL Database / Postgres — violet */
    --cai-sql-soft: #EFE8F8;
    --cai-sftp: #0F766E; /* SFTP — teal */
    --cai-sftp-soft: #E1F2F0;
    --cai-s3: #BD6A0E; /* S3 — AWS amber */
    --cai-s3-soft: #FBEDD6;
    --cai-duck: #2F855A; /* DuckDB — green */
    --cai-duck-soft: #E6F4EC;
    --cai-vault: #B23C0B; /* Veeva Vault — red-orange, apart from the S3 amber */
    --cai-vault-soft: #FDE4D7;
    --cai-sharepoint: #0A6C8C; /* SharePoint — deep cyan, between the SFTP teal and the filesystem blue */
    --cai-sharepoint-soft: #DDF0F7;
    /* Publish-only destinations (Veeva Vault, SharePoint): indigo, a hue no type pill uses; 6.96:1 on the soft tone */
    --cai-publish: #4338CA;
    --cai-publish-soft: #EEF0FB;

    /* Sources surface tokens */
    --cai-ink: var(--nwc-text-heading);
    --cai-body: var(--nwc-text-primary);
    --cai-muted: var(--nwc-text-secondary);
    --cai-faint: var(--nwc-text-muted);
    --cai-rule: var(--nwc-ui-border);
    --cai-rule-strong: var(--nwc-ui-border-strong);
    --cai-inset: var(--nwc-ui-surface-soft);
    --cai-hover: var(--nwc-row-hover);
    --cai-card: var(--nwc-ui-surface);
    --cai-shadow-sm: 0 0.0625rem 0 rgba(15, 17, 21, .04), 0 0.0625rem 0.125rem rgba(15, 17, 21, .05);
    --cai-scrim: rgba(15, 22, 30, 0.32);
    --cai-shadow-side-panel: -0.625rem 0 1.875rem rgba(20, 30, 40, 0.18);
}

/* ── StatusBadge ──────────────────────────────────────────────────────── */

.cai-status-badge {
    display: inline-flex;
    flex-direction: column;
    gap: 0.0625rem;
}

.cai-status-badge-row {
    --nwc-badge-display: flex;
    --nwc-badge-min-inline-size: 100%;
    --nwc-badge-background: transparent;
    --nwc-badge-border-width: 0;
    --nwc-badge-padding: 0;
    --nwc-badge-radius: 0;
    --nwc-badge-color: var(--cai-body);
    --nwc-font-size: 1rem;
    --nwc-badge-font-weight: 500;
    --nwc-badge-line-height: 1.7;
    --nwc-badge-label-overflow: visible;
    --nwc-badge-white-space: normal;
    --nwc-badge-dot-size: 0.5rem;
    --nwc-badge-dot-gap: 0.375rem;
    --nwc-badge-dot-color: transparent;
    --nwc-badge-dot-pulse-color: rgba(29, 158, 117, 0.4);
    --nwc-badge-dot-pulse-spread: 0.3125rem;
    --nwc-badge-dot-pulse-duration: 2s;
    display: inline-flex;
}

.cai-status-badge-row[data-health-status="ok"] {
    --nwc-badge-dot-color: var(--cai-ok);
}

.cai-status-badge-row[data-health-status="warn"] {
    --nwc-badge-dot-color: var(--cai-warn);
}

.cai-status-badge-row[data-health-status="err"] {
    --nwc-badge-dot-color: var(--cai-err);
}

.cai-status-badge-row[data-health-status="idle"] {
    --nwc-badge-dot-color: var(--cai-idle);
}

.cai-status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.cai-status-dot--ok {
    background: var(--cai-ok);
}

.cai-status-dot--warn {
    background: var(--cai-warn);
}

.cai-status-dot--err {
    background: var(--cai-err);
}

.cai-status-dot--idle {
    background: var(--cai-idle);
}

.sdtm-ai-mapping-confirmation-error,
.sdtm-ai-mapping-confirmation-status {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.sdtm-ai-mapping-confirmation-error > label {
    font-weight: bold;
}

.sdtm-ai-mapping-confirmation-status > label {
    font-size: 1.15rem;
    color: var(--nwc-text-secondary);
    font-weight: bold;
}

.sdtm-ai-mapping-confirmation-status > nph-badge {
    height: 100%;
}

.sdtm-ai-mapping-confirmation-warning {
    font-weight: bold;
    font-style: italic;
}

.sdtm-pre-p21-readiness-step {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    box-sizing: border-box;
}

.sdtm-pre-p21-readiness-notes {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.sdtm-pre-p21-readiness-step .embedded-grid-panel,
.sdtm-pre-p21-readiness-step .app-grid-page-grid-shell {
    min-height: 20rem;
    height: 100%;
}

.sdtm-pre-p21-detail-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .75rem;
    padding: .5rem;
    border-bottom: 1px solid var(--cai-rule);
    font-size: .75rem;
}

.sdtm-pre-21-findings-modal {
    --modal-initial-width: 50%;
}

.sdtm-pre-21-findings-modal-body > .wc-structured-panel {
    min-height: 20rem;
}

.sdtm-p21-validation-status .cai-status-badge-row {
    --nwc-badge-dot-size: 0.75rem;
}

.cai-status-latency {
    font-size: 0.6875rem;
    color: var(--cai-muted);
    padding-left: 0.875rem; /* align under label, past dot+gap */
}

/* ── RequiredReasonDialog ─────────────────────────────────────────────── */

.cai-required-reason-dialog {
    --wc-ui-prompt-note-color: var(--cai-muted);
    --wc-ui-prompt-warning-color: var(--cai-err);
}

/* ── TypeBadge ────────────────────────────────────────────────────────── */

.cai-type-badge {
    --nwc-badge-display: inline-flex;
    --nwc-badge-padding: 0.1875rem 0.5625rem 0.1875rem 0.4375rem;
    --nwc-badge-radius: 62.4375rem;
    --nwc-badge-border-width: 0;
    --nwc-font-size: clamp(13px, calc(12.7px + 0.1vw), 21px);
    --nwc-badge-font-weight: 400;
    --nwc-badge-line-height: 1.7;
    --nwc-badge-label-overflow: visible;
    --nwc-badge-icon-size: clamp(13px, calc(12.7px + 0.1vw), 21px);
    --nwc-badge-icon-wrapper-display: block;
    --nwc-badge-icon-wrapper-font-size: 0.8125rem;
    --nwc-badge-icon-wrapper-line-height: 1;
    --nwc-badge-icon-display: inline-block;
    --nwc-badge-icon-line-height: 1.7;
    --nwc-badge-icon-gap: 0.3125rem;
    --nwc-badge-color: inherit;
    --nwc-badge-background: transparent;
    display: inline-flex;
}

.cai-type-badge-legacy {
    --nwc-font-size: 0.75rem;
    --nwc-badge-font-weight: 500;
    --nwc-badge-icon-size: 0.8125rem;
    align-items: center;
    gap: var(--nwc-badge-icon-gap);
    padding: var(--nwc-badge-padding);
    border-radius: var(--nwc-badge-radius);
    font-size: var(--nwc-font-size);
    font-weight: var(--nwc-badge-font-weight);
    color: var(--nwc-badge-color);
    background: var(--nwc-badge-background);
    white-space: nowrap;
}

.cai-type-badge--rest_api {
    --nwc-badge-color: var(--cai-rest);
    --nwc-badge-background: var(--cai-rest-soft);
}

.cai-type-badge--filesystem {
    --nwc-badge-color: var(--cai-fs);
    --nwc-badge-background: var(--cai-fs-soft);
}

.cai-type-badge--sql_database,
.cai-type-badge--postgres {
    --nwc-badge-color: var(--cai-sql);
    --nwc-badge-background: var(--cai-sql-soft);
}

.cai-type-badge--sftp {
    --nwc-badge-color: var(--cai-sftp);
    --nwc-badge-background: var(--cai-sftp-soft);
}

.cai-type-badge--s3 {
    --nwc-badge-color: var(--cai-s3);
    --nwc-badge-background: var(--cai-s3-soft);
}

.cai-type-badge--duckdb {
    --nwc-badge-color: var(--cai-duck);
    --nwc-badge-background: var(--cai-duck-soft);
}

.cai-type-badge--veeva_vault {
    --nwc-badge-color: var(--cai-vault);
    --nwc-badge-background: var(--cai-vault-soft);
}

.cai-type-badge--sharepoint {
    --nwc-badge-color: var(--cai-sharepoint);
    --nwc-badge-background: var(--cai-sharepoint-soft);
}

.cai-type-badge-legacy .cai-type-badge-icon {
    font-size: var(--nwc-badge-icon-size);
    line-height: 1;
}

/* ── CardSelect (single-select grid of icon + label cards) ────────────── */
.cai-card-select {
    --wc-ui-card-choice-border-color: var(--cai-rule-strong);
    --wc-ui-card-choice-background: var(--cai-card);
    --wc-ui-card-choice-color: var(--cai-muted);
    --wc-ui-card-choice-hover-border-color: var(--cai-faint);
    --wc-ui-card-choice-selected-border-color: var(--nwc-accent-on-light);
    --wc-ui-card-choice-selected-background: var(--nwc-accent-subtle);
    --wc-ui-card-choice-selected-color: var(--nwc-accent-on-light);
}

/* ── VendorAvatar ─────────────────────────────────────────────────────── */

.cai-vendor-avatar {
    --wc-ui-avatar-font-family: "Inter", system-ui, sans-serif;
}

/* ── HealthSummaryChips ───────────────────────────────────────────────── */

.cai-health-chips {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.cai-health-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.3125rem 0.75rem 0.3125rem 0.625rem;
    border-radius: 62.4375rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    font-size: 0.78125rem;
    white-space: nowrap;
}

.cai-health-chip-count {
    font-weight: 600;
    color: var(--cai-body);
}

.cai-health-chip-label {
    color: var(--cai-muted);
}

/* ── GroupedTable ─────────────────────────────────────────────────────── */

.cai-grouped-table {
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.5rem;
    box-shadow: var(--cai-shadow-sm);
    overflow: hidden;
}

.cai-grouped-table-group:not(:last-child) .cai-grouped-table-group-rows {
    border-bottom: 0.125rem solid var(--cai-rule);
}

.cai-grouped-table-group-header {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.cai-grouped-table-group-extras {
    display: contents;
}

.cai-grouped-table-group-desc {
    margin-left: auto;
    font-size: 0.71875rem;
    color: var(--cai-faint);
}

.cai-grouped-table-row {
    display: grid;
    padding: 0.75rem 1.25rem;
    gap: 0.75rem;
    min-height: 3.5rem;
    align-items: center;
    border-bottom: 0.0625rem solid var(--cai-rule);
    cursor: pointer;
    transition: background 0.1s;
}

.cai-grouped-table-row:last-child {
    border-bottom: none;
}

.cai-grouped-table-row:hover {
    background: var(--cai-hover);
}

.cai-grouped-table-row:hover .cai-row-kebab {
    opacity: 1;
}

/* Group count + collapsible accordion (shared by Sources / Destinations via AbstractLibraryListTemplate) */
.cai-grouped-table-group-count {
    font-size: 0.9rem;
    color: var(--cai-muted);
}

.cai-grouped-table-group-header--collapsible {
    cursor: pointer;
    user-select: none;
}

.cai-grouped-table-chevron {
    transition: transform 0.2s;
    color: var(--cai-faint);
    flex-shrink: 0;
}

.cai-grouped-table-group--collapsed .cai-grouped-table-chevron {
    transform: rotate(-90deg);
}

.cai-grouped-table-group--collapsed .cai-grouped-table-group-rows {
    display: none;
}

/* Sources list specific grid */
/* minmax(0, …): a bare fr track won't shrink below its content, so a long nowrap endpoint would push later columns out from under their headers. */
.cai-sources-grid {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.5fr) 7.5rem minmax(0, 1fr) 2.25rem;
}

/* ── PageActionRow ────────────────────────────────────────────────────── */

.cai-page-action-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.625rem 0;
}

/* ── EmptyStateBuilder CTA extension ─────────────────────────────────── */

.records-empty-cta {
    margin-top: 0.75rem;
    display: flex;
    justify-content: center;
}

/* ── Row kebab ────────────────────────────────────────────────────────── */

.cai-row-kebab {
    opacity: 0.4;
    transition: opacity 0.1s;
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    border: none;
    background: transparent;
    font-size: 1.125rem;
    color: var(--cai-muted);
}

.cai-row-kebab:hover {
    opacity: 1;
    background: var(--cai-rule);
}

/* Kebab dropdown menu */
.cai-row-kebab-wrap {
    position: relative;
}

.cai-row-kebab-menu {
    display: none;
    position: fixed;
    /* Position is measured from the trigger at open time and supplied as custom properties by
       AbstractLibraryListTemplate (only --vars are set inline; the rules live here). */
    top: var(--cai-kebab-top, auto);
    right: var(--cai-kebab-right, auto);
    z-index: 200;
    min-width: 10rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule-strong);
    border-radius: 0.375rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.12);
    padding: 0.25rem 0;
}

.cai-row-kebab-menu--open {
    display: flex;
    flex-direction: column;
}

.cai-row-kebab-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    color: var(--cai-body);
    background: transparent;
    border: none;
    cursor: pointer;
    text-align: left;
    width: 100%;
    white-space: nowrap;
}

.cai-row-kebab-item:hover {
    background: var(--cai-hover);
}

.cai-row-kebab-item iconify-icon {
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--cai-muted);
}

.cai-row-kebab-item--danger {
    color: var(--cai-err);
}

.cai-row-kebab-item--danger iconify-icon {
    color: var(--cai-err);
}

.cai-row-kebab-item--danger:hover {
    background: var(--nwc-error-subtle);
}

.cai-row-kebab-divider {
    height: 0.0625rem;
    background: var(--cai-rule);
    margin: 0.25rem 0;
}

/* ── KeyValueList ─────────────────────────────────────────────────────── */

.cai-kv-list {
    --nwc-key-value-gap: 0.375rem;
    --nwc-key-value-columns: 1fr 1fr 1.9rem;
    --nwc-key-value-row-gap: 0.375rem;
    --nwc-key-value-row-align: center;
    --nwc-key-value-padding: 0;
    --nwc-key-value-add-margin-block-start: 0.25rem;
}

/* ── Destination field mapping (target | value from | SCE field or constant | required | remove) ── */

.cai-field-mapping-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cai-field-mapping-row {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1.6fr auto 1.9rem;
    gap: 0.5rem;
    align-items: center;
}

.cai-field-mapping-add {
    margin-top: 0.5rem;
}

/* ── SecretReferencePicker ────────────────────────────────────────────── */

.cai-secret-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0 0.75rem;
    height: 2.125rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule-strong);
    border-radius: 0.375rem;
    cursor: pointer;
    text-align: left;
    font-size: 0.8125rem;
    color: var(--cai-muted);
    transition: border-color 0.15s;
}

.cai-secret-trigger:hover {
    border-color: var(--cai-ok);
}

.cai-secret-trigger-chevron {
    margin-left: auto;
    opacity: 0.5;
    font-size: 0.6875rem;
}

.cai-secret-chip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3125rem 0.625rem;
    background: var(--cai-inset);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.375rem;
    font-size: 0.78125rem;
}

.cai-secret-chip-key {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    color: var(--cai-body);
}

.cai-secret-chip-mask {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.6875rem;
    color: var(--cai-muted);
    margin-left: auto;
}

.cai-secret-chip-clear {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--cai-muted);
    padding: 0.125rem 0.25rem;
    border-radius: 0.1875rem;
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.cai-secret-chip-clear:hover {
    background: var(--cai-rule);
    color: var(--cai-body);
}

.cai-secret-popover-wrap {
    position: relative;
}

.cai-secret-popover {
    position: fixed; /* portaled to <body>; left/top/width/max-height set inline at open */
    width: 23.75rem;
    max-height: 20rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.5rem;
    box-shadow: var(--cai-shadow-sm), 0 0.5rem 1.5rem rgba(15, 17, 21, 0.10);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cai-secret-popover-search {
    padding: 0.5rem 0.75rem;
    border-bottom: 0.0625rem solid var(--cai-rule);
}

.cai-secret-popover-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.cai-secret-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5625rem 0.875rem;
    cursor: pointer;
    border-bottom: 0.0625rem solid var(--cai-rule);
    transition: background 0.1s;
}

.cai-secret-option:last-child {
    border-bottom: none;
}

.cai-secret-option:hover,
.cai-secret-option--active {
    background: var(--nwc-success-subtle);
}

.cai-secret-option-key {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.78125rem;
    color: var(--cai-body);
    font-weight: 500;
}

.cai-secret-option-desc {
    font-size: 0.71875rem;
    color: var(--cai-muted);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cai-secret-option-mask {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.6875rem;
    color: var(--cai-faint);
    flex-shrink: 0;
}

.cai-secret-popover-empty {
    padding: 2rem 0.875rem;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--cai-muted);
}

.cai-secret-popover-footer {
    padding: 0.5rem 0.875rem;
    border-top: 0.0625rem solid var(--cai-rule);
}

.cai-secret-popover-footer a {
    font-size: 0.78125rem;
    color: var(--cai-ok);
    text-decoration: none;
}

.cai-secret-popover-footer a:hover {
    text-decoration: underline;
}

/* ── ConnectionTestStrip ──────────────────────────────────────────────── */

.cai-test-strip {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 0.875rem 1.125rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--cai-rule);
    background: var(--cai-inset);
    min-height: 100%;
}

.cai-test-strip-header {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.cai-test-strip--testing {
    background: var(--nwc-info-subtle);
    border-color: #BFCFF8;
}

.cai-test-strip--success {
    background: var(--cai-card);
    border-color: var(--cai-rule);
}

.cai-test-strip--failure {
    background: var(--nwc-error-subtle);
    border-color: #F5BDB9;
}

.cai-test-strip-icon {
    font-size: 1.125rem;
    flex-shrink: 0;
    line-height: 1.3;
}

/* Per-state icon color matches the headline; the testing icon spins to signal progress. */
.cai-test-strip--testing .cai-test-strip-icon {
    color: #2F6FE8;
    animation: rotation 1s linear infinite;
}

.cai-test-strip--success .cai-test-strip-icon {
    color: var(--cai-ok);
}

.cai-test-strip--failure .cai-test-strip-icon {
    color: var(--cai-err);
}

.cai-test-strip-body {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cai-test-strip-headline {
    font-weight: 600;
    color: var(--cai-body);
}

.cai-test-strip--testing .cai-test-strip-headline {
    color: #2F6FE8;
}

.cai-test-strip--success .cai-test-strip-headline {
    color: var(--cai-ok);
}

.cai-test-strip--failure .cai-test-strip-headline {
    color: var(--cai-err);
}

.cai-test-strip-sub {
    font-size: 0.78125rem;
    color: var(--cai-muted);
}

.cai-test-strip-facts {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem 1.25rem;
}

.cai-test-strip-fact-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--cai-muted);
}

.cai-test-strip-fact-value {
    font-size: 0.8125rem;
    color: var(--cai-body);
}

.cai-test-strip-fact-value--mono {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.75rem;
}

.cai-test-strip-detail {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--cai-inset);
    border-radius: 0.25rem;
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.71875rem;
    color: var(--cai-body);
    white-space: pre-wrap;
    word-break: break-all;
}

.cai-test-strip-footer {
    margin-top: 0.625rem;
}

.cai-test-strip-action {
    flex-shrink: 0;
    margin-left: auto;
}

.cai-secret-reference-picker a {
    color: var(--nwc-accent);
    padding-left: 11.5rem;
}

.cai-secret-reference-picker--label-up a {
    padding-left: 0;
}

/* ── Sources List (Wave 5c) ───────────────────────────────────────────── */

.cai-sources-page {
    gap: 0.875rem;
}

.cai-sources-page > .wc-structured-panel-header {
    padding-bottom: 0;
}

/* Page header */
.cai-sources-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.cai-sources-page-title-wrap {
    flex: 1;
}

.cai-sources-page-title {
    font-size: 1.375rem;
    font-weight: 600;
    color: var(--cai-ink);
    letter-spacing: -0.015em;
    margin: 0 0 0.25rem;
}

.cai-sources-page-subtitle {
    font-size: 0.8125rem;
    color: var(--cai-muted);
    line-height: 1.55;
    max-width: 40rem;
}

.cai-sources-page-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.cai-sources-refresh-btn {
    width: 2.125rem;
    height: 2.125rem;
    border: 0.0625rem solid var(--cai-rule-strong);
    border-radius: 0.375rem;
    background: var(--cai-card);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cai-muted);
    font-size: 0.9375rem;
    transition: background 0.1s;
}

.cai-sources-refresh-btn:hover {
    background: var(--cai-hover);
}

.cai-sources-refresh-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Toolbar */
.cai-sources-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.cai-sources-search-wrap {
    margin-left: auto;
    min-width: 13.75rem;
}

.cai-sources-table-slot {
    flex: 1 1 auto;
    min-height: var(--cai-sources-table-min-h, 0);
    overflow-y: auto;
    scrollbar-width: none;
}

.cai-sources-table-slot::-webkit-scrollbar {
    display: none;
}

.cai-sources-accordion {
    --nwc-accordion-overflow: visible;
    --nwc-accordion-content-overflow: visible;
}

.cai-sources-accordion-item .cai-grouped-table-group-header {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0;
    background: transparent;
    border-bottom: none;
}

/* Group header cells */
.cai-group-header-inner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
}

.cai-group-source-count {
    font-size: 0.78125rem;
    color: var(--cai-muted);
}

/* Column header */
.cai-destinations-col-header,
.cai-grouped-table-col-header,
.cai-sources-col-header {
    display: grid;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
    border-top: 0.0625rem solid var(--nwc-border-subtle);
    border-bottom: 0.0625rem solid var(--nwc-border-subtle);
    background: var(--nwc-raw-gray-100);
}

.cai-col-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Row cells */
.cai-sources-cell-source {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
}

.cai-sources-cell-source-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cai-sources-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cai-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cai-sources-vendor {
    font-size: 0.71875rem;
    color: var(--cai-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cai-sources-endpoint {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.75rem;
    color: var(--cai-body);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cai-sources-last-conn {
    font-size: 1rem;
    color: var(--cai-body);
}

/* State overlays */
.cai-sources-state {
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    --wc-ui-card-body-padding: 3rem 1.25rem;
}

/* ── Sources Editor (Wave 5d) ─────────────────────────────────────────── */

.cai-sources-editor {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.cai-source-identity-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Identity card */
.cai-source-identity-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.125rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.5rem;
    padding: 1.25rem 1.25rem 2rem;
}

/* Editor cards (connection/schedule sub-cards). Card internals are owned by nphase-wc. */
.cai-editor-card {
    --wc-ui-card-background: var(--cai-card);
    --wc-ui-card-border-color: var(--cai-rule);
    --wc-ui-card-radius: 0.5rem;
    --wc-ui-card-shadow: none;
    --wc-ui-card-overflow: visible;
    --wc-ui-card-header-background: var(--cai-card);
    --wc-ui-card-header-divider: none;
    --wc-ui-card-header-padding: 1.25rem 1.25rem 0;
    --wc-ui-card-body-padding: 1rem 1.25rem 1.25rem;
    --wc-ui-card-body-gap: 1rem;
    --wc-ui-card-title-size: 0.875rem;
    --wc-ui-card-title-color: var(--cai-ink);
    --wc-ui-card-title-weight: 600;
    --wc-ui-card-title-line-height: normal;
    --wc-ui-card-subtitle-size: 0.78125rem;
    --wc-ui-card-subtitle-color: var(--cai-muted);
    --wc-ui-card-subtitle-line-height: normal;
}

.cai-editor-card--body-only {
    --wc-ui-card-body-padding: 1.25rem;
}

/* Top-level content/form cards preserve the former UiSupport.section rhythm while using Card's
   public customization contract. */
.cai-content-card {
    --wc-ui-card-background: var(--nwc-basic-fill);
    --wc-ui-card-border-color: var(--nwc-basic-border);
    --wc-ui-card-radius: 0.5rem;
    --wc-ui-card-shadow: none;
    --wc-ui-card-overflow: visible;
    --wc-ui-card-header-background: var(--nwc-basic-fill);
    --wc-ui-card-header-divider: none;
    --wc-ui-card-header-padding: 1rem 1rem 0;
    --wc-ui-card-body-padding: 0.75rem 1rem 1rem;
    --wc-ui-card-body-gap: 0.75rem;
    --wc-ui-card-title-size: 1rem;
    --wc-ui-card-title-color: var(--nwc-text-disabled);
    --wc-ui-card-title-weight: 700;
    --wc-ui-card-title-line-height: normal;
}

/* Form layout helpers */
.cai-form-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cai-form-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 0.25rem;
}

.cai-form-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cai-muted);
    padding: 0.75rem 0;
}

.cai-form-section-hint {
    font-size: 0.75rem;
    color: var(--cai-muted);
    margin-top: -0.5rem;
}

.cai-form-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

/* Initial Setup cards can render each two-column field below the legacy field's intrinsic width.
   Keep lookup hosts shrinkable and stack SDTM's long file-picker action inside its grid cell. */
:is(.sdtm-initial-setup, .adam-initial-setup, .tlf-initial-setup, .csr-setup)
.cai-form-grid-2 > .wc-ui-field > .core-config-picker-host {
    display: block;
}

:is(.sdtm-initial-setup, .adam-initial-setup, .tlf-initial-setup, .csr-setup)
.cai-form-grid-2 > .wc-ui-field > .core-config-picker-host > nph-combobox {
    width: 100%;
    max-width: 100%;
}

.sdtm-initial-setup .cai-form-grid-2 > .wc-ui-field:has(> .wc-ui-file-picker) {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
}

.sdtm-initial-setup .cai-form-grid-2 > .wc-ui-field:has(> .wc-ui-file-picker) > .wc-ui-label {
    width: auto;
    text-align: start;
}

.sdtm-initial-setup .cai-form-grid-2 > .wc-ui-field > .wc-ui-file-picker {
    width: 100%;
    max-width: 100%;
}

/* Build-once/populate-later pickers (e.g. Standards & Terminology Card 4/5) wrap each picker in a
   stable host div so populate() can rebuild just that one field's options later. display:contents
   removes the wrapper from box generation so its child (the picker) sizes as the direct grid item,
   same as before the wrapper existed. */
.core-config-picker-host {
    display: contents;
}

/* Same fix as .core-config-picker-host, for host divs that wrap MULTIPLE sibling elements that
   used to be direct children of a .wc-ui-section (display:grid; gap:.75rem between direct
   children only). Without display:contents here, everything inside the host loses that gap and
   visually collapses together — e.g. ADaM SAP Linkage's toggle sat flush against the picker row
   above it once wrapped in .adam-sap-linkage-host. */
.adam-sap-linkage-host,
.tlf-governance-host {
    display: contents;
}

.cai-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.cai-form-grid-auth {
    display: grid;
    grid-template-columns: 13.75rem 1fr;
    gap: 1rem;
    align-items: start;
}

.cai-auth-sub-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.cai-auth-method {
    max-width: 32.5rem;
}

/* Spectrum TextField/Picker wrap their native <sp-*> element inside a <div class="sp-input">,
   and the native control does not stretch on its own. Force every auth control to fill the 32.5rem
   column so the Method picker, text fields, and secret pickers all share one standard width. */
.cai-auth-method .sp-input,
.cai-auth-sub-form .sp-input {
    width: 100%;
}

/* Method picker is a Spectrum <sp-picker> inside a .sp-input wrapper. */
.cai-auth-method .sp-input sp-picker,
.cai-auth-sub-form .sp-input sp-picker {
    width: 100%;
    box-sizing: border-box;
}

/* 12-column responsive grid (SQL connection form + container queries) */
.nph-grid12 {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.nph-grid12 > .col-2 {
    grid-column: span 2;
}

.nph-grid12 > .col-3 {
    grid-column: span 3;
}

.nph-grid12 > .col-4 {
    grid-column: span 4;
}

.nph-grid12 > .col-6 {
    grid-column: span 6;
}

.nph-grid12 > .col-8 {
    grid-column: span 8;
}

.nph-grid12 > .col-12 {
    grid-column: span 12;
}

/* Container query context — set on the card that contains the grid */
.nph-page-cq {
    container-type: inline-size;
    container-name: page;
}

@container page (max-width: 53.75rem) {
    .nph-grid12 > .col-2,
    .nph-grid12 > .col-3,
    .nph-grid12 > .col-4 {
        grid-column: span 6;
    }

    .nph-grid12 > .col-8 {
        grid-column: span 12;
    }
}

@container page (max-width: 35rem) {
    .nph-grid12 > * {
        grid-column: span 12 !important;
    }
}

@supports not (container-type: inline-size) {
    @media (max-width: 53.75rem) {
        .nph-grid12 > .col-2,
        .nph-grid12 > .col-3,
        .nph-grid12 > .col-4 {
            grid-column: span 6;
        }

        .nph-grid12 > .col-8 {
            grid-column: span 12;
        }
    }
    @media (max-width: 35rem) {
        .nph-grid12 > * {
            grid-column: span 12 !important;
        }
    }
}

/* 2-column layout for SQL connection form */
.cai-sql-form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem 2.5rem;
    align-items: start;
}

.cai-sql-form-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Library Sources blinded (CAI-243) + Saved Queries grid styles moved to library-sources.css (linked in index.html). */

/* Section divider inside a card (Server / Credentials / Advanced) */
.cai-form-section-divider {
    padding-top: 0.25rem;
    border-top: 0.0625rem dashed var(--cai-rule, var(--nwc-ui-border));
}

/* Field label + control wrapper */
.cai-field {
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}

.cai-field-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--cai-body);
}

.cai-field-label--required::after {
    content: " *";
    color: var(--cai-err);
}

/* Core Configuration page roots: space stacked section cards like
   .admin-project-surface (Create Project) does. */
.core-config-study-identity,
.core-config-standards-terminology,
.core-config-compound-classification,
.core-config-treatment-arm,
.core-config-population-set,
.core-config-statistical-analysis,
.sdtm-initial-setup,
.adam-initial-setup,
.tlf-initial-setup,
.csr-setup,
.csr-setup-linkage {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* TLF deliveries: neither the CSR set-up sub-tab nor the Register dialog gives its grids a definite height, so
   without one the AG Grid body collapses to zero and only the pager shows. flex: none keeps the shell's own height
   in a flex parent, where the shared shell's flex: 1 1 0% would replace it. */
.app-grid-page-grid-shell:is(.csr-setup-tlf-deliveries-grid-shell, .csr-setup-tlf-deliveries-files-shell,
        .csr-tlf-delivery-review-grid-shell) {
    display: flex;
    flex: none;
    flex-direction: column;
}

.csr-setup-tlf-deliveries-grid-shell,
.csr-setup-tlf-deliveries-files-shell {
    min-height: 16rem;
    height: min(26rem, calc(100vh - 22rem));
}

.csr-tlf-delivery-review-grid-shell {
    min-height: 18rem;
    height: min(28rem, calc(100vh - 24rem));
}

/* The modal is centred once, at the size it opens with, and the review and row editor appear later. The body keeps
   one height from the start and scrolls itself, so the dialog never grows past the viewport. */
.csr-tlf-delivery-register {
    height: min(46rem, calc(100vh - 12rem));
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Pass the selected Project Details viewport through each Core Config surface so its
   flexing grid card (and the grid inside it) can resolve height:100% against a real size. */
.core-config-study-identity,
.core-config-standards-terminology,
.core-config-compound-classification,
.core-config-treatment-arm,
.core-config-population-set,
.core-config-statistical-analysis {
    height: 100%;
    min-height: 0;
}

.core-config-compound-classification > nph-tab-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}

/* Outputs tab hosts the shared TLF Registry. Execution CSS sizes the grid via a
   viewport flex chain (.project-tlf-execution-canvas); that chain is absent here,
   so .project-tlf-setup-step { height:100%; flex:1 } + grid-shell { height:auto }
   collapses the AG Grid body to zero while pagination still shows. */
.tlf-initial-setup-tabs {
    display: flex;
    flex-direction: column;
    min-height: 0;
    width: 100%;
}

.tlf-initial-setup-outputs {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
    width: 100%;
}

.tlf-initial-setup-outputs .project-tlf-setup-header-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    flex-shrink: 0;
}

.tlf-initial-setup-outputs .project-tlf-setup-step {
    display: flex;
    flex-direction: column;
    flex: none;
    height: auto;
    min-height: 0;
}

.tlf-initial-setup-outputs .project-tlf-setup-step > .app-grid-page-surface {
    flex: none;
    height: auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tlf-initial-setup-outputs .project-tlf-setup-step .app-grid-page-grid-shell {
    flex: none;
    min-height: 16rem;
    /* Leave room for Project Details title, tabs, and Add TLF — no max-height
       so the grid uses most of the remaining viewport. */
    height: calc(100vh - 18rem);
}

/* CSR set-up -> CSR scope, template card. Two rules from library-csr-templates.css shape this card
   and neither one reaches it on its own:
   - .csr-template-editor-form .cai-editor-card caps the Sections card's width, but this card is a
     plain .wc-ui-section, so without the cap below it stretched the full viewport while its
     contents stopped short and the two cards ended at different x positions.
   - .csr-template-editor-form.cai-labelled-form .wc-ui-section zeroes card padding so the header
     band can span full width. An EditorCard repays that via --wc-ui-card-body-padding; a plain
     .wc-ui-section has no such hook, so the field row carries the padding itself.
   --csr-card-pad and --csr-content-box are inherited from the .csr-template-editor-form host. */
.tlf-csr-scope-host > .tlf-csr-template-card {
    max-width: var(--csr-content-box);
    box-sizing: border-box;
}

.tlf-csr-scope-host > .tlf-csr-template-card > .cai-form-grid-2 {
    padding: 1rem var(--csr-card-pad);
}

/* Save sits in the Sections card footer, opposite "+ Add Section". Scoped to this host rather
   than to .csr-template-editor-form so the Library CSR Template editor's own footer, which has
   only the one button, keeps the layout it has. */
.tlf-csr-scope-host .linked-tpl-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

/* CSR set-up -> TLF linkage. Same host classes as the CSR scope card, so the card chrome and
   --csr-card-pad token resolves identically — but unlike the scope card's form fields, this is a
   data grid, so it must NOT inherit --csr-content-box: the cap exists to keep narrow form fields
   from stretching absurdly wide, and only leaves a dead band down the right side of a grid. */
.tlf-csr-linkage-host > .tlf-csr-linkage-card {
    box-sizing: border-box;
}

.tlf-csr-linkage-host > .tlf-csr-linkage-card > .gatehint,
.tlf-csr-linkage-host > .tlf-csr-linkage-card > .tlf-linkage-status:not(:empty) {
    margin: 0.75rem var(--csr-card-pad) 0;
}

/* The grid needs an explicit shell height: an embedded AgGrid in a flex column collapses its
   body to zero while still painting pagination. */
.tlf-csr-linkage-host .tlf-linkage-grid-shell {
    height: 26rem;
    min-height: 16rem;
    margin: 0.75rem var(--csr-card-pad);
    box-sizing: border-box;
}

/* Three-class selector so this beats library-csr-templates.css's same-specificity
   .csr-template-editor-form .linked-tpl-footer rule (that file loads after this one), which would
   otherwise re-impose --csr-content-box here and leave the footer narrower than the now full-width
   card above it. */
.tlf-csr-linkage-host > .tlf-csr-linkage-card > .linked-tpl-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    max-width: none;
}

.csr-setup-linkage-stepper {
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    box-sizing: border-box;
    padding: 0.875rem 1.5rem 0.5rem;
}

.csr-setup-linkage-stepper > .csr-tlf-index-stepper {
    --stb-label-max-width: 9rem;
    width: 100%;
}

.csr-tlf-index-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    margin: 0.75rem var(--csr-card-pad) 0;
}

.csr-tlf-index-file {
    display: flex;
    flex: 1 1 22rem;
    flex-direction: column;
    gap: 0.375rem;
    max-width: 36rem;
    min-width: 0;
}

.csr-tlf-index-file-label {
    color: var(--nwc-text-secondary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
}

.csr-tlf-index-picker {
    min-width: 0;
    width: 100%;
}

.csr-tlf-index-actions {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 0.5rem;
}

.csr-tlf-index-status,
.csr-tlf-index-error,
.csr-tlf-index-notice {
    margin: 0.75rem var(--csr-card-pad) 0;
}

.csr-tlf-index-progress {
    background: var(--nwc-ui-surface-soft);
    border-radius: 999px;
    height: 0.375rem;
    margin: 0.5rem var(--csr-card-pad) 0;
    max-width: calc(100% - (2 * var(--csr-card-pad)));
    overflow: hidden;
    position: relative;
    width: 12.5rem;
}

.csr-tlf-index-progress::after {
    animation: csr-tlf-index-progress 1.2s ease-in-out infinite;
    background: var(--nwc-accent);
    border-radius: inherit;
    content: "";
    inset: 0 auto 0 0;
    position: absolute;
    width: 40%;
}

.csr-tlf-index-grid-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0.75rem var(--csr-card-pad) 0.5rem;
}

.csr-tlf-index-grid-shell {
    box-sizing: border-box;
    height: 26rem;
    margin: 0 var(--csr-card-pad) 0.75rem;
    min-height: 16rem;
}

@keyframes csr-tlf-index-progress {
    from {
        transform: translateX(-120%);
    }
    to {
        transform: translateX(280%);
    }
}

.csr-tlf-linkage-toolbar,
.csr-tlf-linkage-empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.75rem var(--csr-card-pad) 0.5rem;
}

.csr-tlf-linkage-toolbar {
    justify-content: flex-end;
}

.csr-tlf-linkage-save {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.csr-tlf-linkage-dirty-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #b45309;
}

.csr-tlf-linkage-grid-shell {
    box-sizing: border-box;
    flex: none;
    height: 36.4rem;
    margin: 0 var(--csr-card-pad) 0.75rem;
    min-height: 22.4rem;
}

.csr-tlf-linkage-grid-shell .ag-row {
    min-height: 44px;
}

.csr-tlf-linkage-grid-shell .ag-cell:has(.csr-tlf-linkage-cell),
.csr-tlf-linkage-grid-shell .ag-cell:has(.csr-tlf-linkage-cell) .ag-cell-wrapper,
.csr-tlf-linkage-grid-shell .ag-cell:has(.csr-tlf-linkage-cell) .ag-cell-value {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.csr-tlf-linkage-cell {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.csr-tlf-linkage-cell::-webkit-scrollbar {
    height: 0;
}

.csr-tlf-linkage-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 999px;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-primary);
    font-size: 0.75rem;
    line-height: 1.4;
    white-space: nowrap;
}

.csr-tlf-linkage-suggestion {
    display: flex;
    align-items: center;
    min-width: 0;
    min-height: 1.75rem;
}

.csr-tlf-linkage-none,
.csr-tlf-linkage-suggestion-count {
    color: var(--nwc-text-muted);
    font-size: 0.8125rem;
}

.csr-tlf-suggest-lead {
    margin: 0 0 0.75rem;
    color: var(--nwc-text-secondary);
    font-size: 0.875rem;
    line-height: 1.45;
}

.csr-tlf-suggest-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 28rem;
    overflow: auto;
}

.csr-tlf-suggest-row {
    display: grid;
    grid-template-columns: auto minmax(6.5rem, max-content) auto minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    cursor: pointer;
}

.csr-tlf-suggest-row:hover {
    border-color: #b7c3d4;
    background: var(--nwc-ui-surface-soft);
}

.csr-tlf-suggest-number {
    font-weight: 600;
    color: var(--nwc-text-primary);
    white-space: nowrap;
}

.csr-tlf-suggest-kind {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.4;
    text-transform: uppercase;
    white-space: nowrap;
}

.csr-tlf-suggest-title {
    min-width: 0;
    overflow: hidden;
    color: var(--nwc-text-primary);
    font-size: 0.875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.csr-tlf-suggest-empty {
    color: var(--nwc-text-secondary);
    padding: 0.5rem 0.25rem;
}

.csr-tlf-linkage-status {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.csr-tlf-linkage-status-linked {
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
}

.csr-tlf-linkage-status-suggested {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

.csr-tlf-linkage-status-unassigned {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.csr-tlf-linkage-picker-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 24rem;
    overflow: auto;
    margin-top: 0.75rem;
}

.csr-tlf-linkage-picker-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.csr-tlf-linkage-empty-text {
    color: var(--nwc-text-secondary);
}

/* KPI strip above the CSR sub-tabs (scope / TLF linkage / reviewers), matching the wireframe's
   tc-kpis row. Shared by all three sub-tabs, so it spans the full CSR set-up width rather than the
   narrower --csr-content-box used by the form cards below it. */
.tlf-csr-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
    margin: 0 0 0.75rem;
    box-sizing: border-box;
}

.tlf-csr-kpi {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
}

.tlf-csr-kpi-label {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.tlf-csr-kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--nwc-text-primary);
}

@media (max-width: 56rem) {
    .tlf-csr-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Review-dialog check list. The state modifier is a compound selector so it cannot be lost to
   the base rule at equal specificity. */
.tlf-linkage-checks {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.tlf-linkage-check {
    padding: 0.375rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.8125rem;
}

.tlf-linkage-check.tlf-linkage-check--ok {
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
}

.tlf-linkage-check.tlf-linkage-check--fail {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
}

/* CSR set-up -> Reviewers. Plain .wc-ui-section chrome (the host deliberately omits
   .csr-template-editor-form), full page width, and stacked labels so each picker gets the whole
   column — the wireframe's shape. Without the stack, .wc-ui-label's fixed 10.5rem column plus a
   narrow grid cell squeezes the combobox to a few rem, exactly as it did in the edit-links dialog. */
.tlf-csr-reviewers-host > .tlf-csr-reviewers-card {
    box-sizing: border-box;
    padding: 1rem 1.25rem 1.125rem;
}

/* The wireframe's card heading is a quiet label, not a page-level title: small, semibold, muted
   slate, Title Case. .wc-ui-section-title's own 1rem/700 reads as a second page heading directly
   under the sub-tabs. */
.tlf-csr-reviewers-host .wc-ui-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--nwc-text-secondary);
    margin-bottom: 0.25rem;
}

/* Wider gutter than the default 1rem — the wireframe's two columns sit clearly apart. */
.tlf-csr-reviewers-host .cai-form-grid-2 {
    gap: 0.75rem 1.5rem;
}

.tlf-csr-reviewers-host .wc-ui-label {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--nwc-text-secondary);
}

.tlf-csr-reviewers-host .wc-ui-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
}

.tlf-csr-reviewers-host .wc-ui-field > .wc-ui-label {
    width: auto;
    text-align: start;
}

.tlf-csr-reviewers-host .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 100%;
}

.tlf-csr-reviewers-host .tlf-csr-reviewer-picker-host {
    display: block;
    width: 100%;
}

/* The control reserves --label-width for a label it is not rendering here (the light-DOM
   .wc-ui-label carries it) and caps itself at --input-max-width. */
.tlf-csr-reviewers-host nph-combobox {
    width: 100%;
    max-width: 100%;
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
}

/* Note left, buttons right — the footer shape the linkage card already uses. */
.tlf-csr-reviewers-host .linked-tpl-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.tlf-csr-reviewers-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Outputs tab -> CSR usage card, mounted under the shared TLF Registry. */
.tlf-csr-usage-host {
    margin-top: 1rem;
}

.tlf-csr-usage-host > .tlf-csr-usage-card > .gatehint {
    margin-bottom: 0.75rem;
}

.tlf-csr-usage-host .tlf-linkage-grid-shell {
    height: 22rem;
    min-height: 14rem;
    box-sizing: border-box;
}

/* Section-first linkage: the output check-list inside the section edit dialog. */
.tlf-section-linkage-outputs {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 18rem;
    overflow-y: auto;
}

.tlf-section-linkage-output {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.3rem 0.2rem;
}

.tlf-section-linkage-output-text {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--cai-ink, #111827);
}

/* An output excluded in the output view stays listed but unpickable — hiding it would leave the
   planner hunting for something deliberately excluded, with no hint why. */
.tlf-section-linkage-output--excluded .tlf-section-linkage-output-text {
    color: var(--cai-muted, var(--nwc-text-secondary));
    font-style: italic;
}

/* ── Edit-links dialog ──────────────────────────────────────────────────────
   Labels stack above their controls here, as in the wireframe: .wc-ui-label's fixed 10.5rem
   column plus a half-width grid cell left the section combobox about 6rem wide, and its dropdown
   panel — which sizes off the host — wrapped every option over four lines and ran past the
   dialog's own footer. Same stacking idiom the SDTM file-picker field already uses. */
.tlf-linkage-edit-form .wc-ui-field {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.375rem;
}

.tlf-linkage-edit-form .wc-ui-label {
    width: auto;
    text-align: start;
}

.tlf-linkage-edit-form .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 100%;
}

/* The combobox's own shadow CSS caps itself at --input-max-width and reserves --label-width for a
   label it is not rendering here (the light-DOM .wc-ui-label carries it instead). The textarea
   renders its own label with label-side="up", so it only needs the width cap lifted. */
.tlf-linkage-edit-form nph-combobox {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
}

.tlf-linkage-edit-form nph-textarea {
    --input-max-width: 100%;
    width: 100%;
}

.tlf-linkage-edit-form .tlf-linkage-ai-panel {
    margin: 0.25rem 0;
}

.tlf-linkage-link-rows {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

/* Same card chrome as .tlf-linkage-suggestion-row above. */
.tlf-linkage-link-card {
    padding: 0.75rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
}

.tlf-linkage-link-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.tlf-linkage-link-card-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.tlf-linkage-link-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.tlf-linkage-edit-footnote {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
}

/* The dropdown renders in the body-level overlay root, outside the dialog, so it cannot be capped
   from inside it — scope by the open dialog instead, the same way the flow-version page does. */
body:has(.tlf-linkage-edit-form) #combobox-overlay-root .nph-combobox-list {
    max-height: 14rem;
}

/* Acknowledgement row: the checkbox keeps only its aria-label, the sentence is a sibling that can
   wrap. Same shape as .cai-conn-create-ack-row. */
.tlf-linkage-review-ack {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    padding: 0.4rem 0.2rem;
}

.tlf-linkage-review-ack-text {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: var(--cai-ink, #111827);
}

.tlf-linkage-suggestion-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-height: 20rem;
    overflow-y: auto;
}

.tlf-linkage-suggestion-row {
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
}

.tlf-linkage-suggestion-sections {
    font-weight: 600;
}

/* Current-specification banner shared by the SDTM/ADaM Initial Setup surfaces. */
.cai-spec-banner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.625rem 0.875rem;
}

.cai-spec-banner--empty {
    color: var(--nwc-text-secondary);
}

.cai-spec-banner-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cai-spec-banner-label {
    min-width: 4rem;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--nwc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.025rem;
}

.cai-spec-banner-label--primary {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text);
}

.cai-spec-banner-value {
    color: var(--text);
}

.cai-spec-banner-value--name {
    flex: 1;
    font-weight: 600;
}

.cai-spec-banner-value--link {
    color: var(--nwc-accent-active);
    cursor: pointer;
}

.cai-spec-banner-value--link:hover,
.cai-spec-banner-value--link:focus-visible {
    text-decoration: underline;
}

/* Specification/Approval Status is derived, meaningful content shown in a disabled-looking
   read-only input — override the component's default muted-grey disabled text so it reads
   with the same weight as an editable field. Covers both a wrapper and a nested <input>,
   since the exact markup depends on the underlying TextField component. */
.cai-spec-status-value,
.cai-spec-status-value input {
    color: var(--text) !important;
    -webkit-text-fill-color: var(--text);
}

.cai-spec-badge {
    border-radius: var(--nwc-radius-full);
    padding: 0.0625rem 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.025rem;
}

.cai-spec-badge--ok {
    background: var(--nwc-accent-subtle, color-mix(in srgb, var(--nwc-accent) 12%, transparent));
    color: var(--nwc-accent-active, #0b7a5e);
}

/* Core Configuration in-page rail (mirrors the Admin Permissions sidebar pattern). */
.cai-coreconfig-root {
    display: grid;
    grid-template-columns: 20rem 1fr;
    grid-template-rows: minmax(0, 1fr);
    gap: 1.25rem;
}

/* Project Details keeps its section rail outside the scrolling canvas. */
.app-content-body > .wc-structured-panel > .wc-structured-panel-content:has(> .cai-coreconfig-root) {
    overflow: hidden;
    min-height: 0;
}

.app-content-body .cai-coreconfig-root {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.cai-coreconfig-rail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    gap: 0.25rem;
    padding: 0.75rem;
    border: 0.0625rem solid var(--line, #d8deea);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    overflow-y: auto;
    scrollbar-width: none;
}

.cai-coreconfig-canvas {
    min-width: 0;
}

.app-content-body .cai-coreconfig-canvas {
    height: 100%;
    min-height: 0;
    overflow: auto;
    scrollbar-width: none;
}

@media (max-width: 56rem) {
    .app-content-body > .wc-structured-panel > .wc-structured-panel-content:has(> .cai-coreconfig-root) {
        overflow: auto;
    }

    .app-content-body .cai-coreconfig-root {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
        height: auto;
        overflow: visible;
    }

    .cai-coreconfig-rail {
        min-height: auto;
        overflow: visible;
    }

    .app-content-body .cai-coreconfig-canvas {
        height: auto;
        overflow: visible;
    }
}

.cai-coreconfig-rail-item {
    min-height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border-radius: var(--nwc-input-border-radius);
    cursor: pointer;
    transition: background var(--nwc-duration-normal), color var(--nwc-duration-normal);
}

.cai-coreconfig-rail-item:hover:not([active]) {
    background: var(--nwc-accent-hover);
    color: white;
}

.cai-coreconfig-rail-item:hover:not([active]) > .cai-coreconfig-rail-status {
    color: white;
}

.cai-coreconfig-rail-item[active] {
    background: var(--nwc-accent);
}

.cai-coreconfig-rail-item[active] .cai-coreconfig-rail-title {
    color: #fff;
}

.cai-coreconfig-rail-title {
    flex-grow: 1;
    font-weight: 400;
}

.cai-coreconfig-rail-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--cai-warning, #d97706);
    visibility: hidden;
    flex: none;
}

.cai-coreconfig-rail-item[data-dirty] .cai-coreconfig-rail-dot {
    visibility: visible;
}

.cai-coreconfig-rail-item[active][data-dirty] .cai-coreconfig-rail-dot {
    background: var(--nwc-ui-surface);
}

/* Per-section completion flag: a small status icon (check = completed, ring = not started),
   mirroring the rail markers in the approved design. */
.cai-coreconfig-rail-status {
    flex: none;
    display: inline-flex;
    align-items: center;
    color: var(--cai-muted, var(--nwc-text-secondary));
}

.cai-coreconfig-rail-status--completed {
    color: var(--cai-ok, #16a34a);
}

.cai-coreconfig-rail-item[active] .cai-coreconfig-rail-status {
    color: #fff;
}

/* Required marker for UiSupport.field labels (core-config picker/toggle rows). */
.wc-ui-label.wc-ui-label--required::after {
    content: " *";
    color: var(--cai-err);
}

/* Study Scope region/country checklists (was inline styles). */
.core-config-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    max-height: 16.25rem;
    overflow-y: auto;
}

.cai-field-hint {
    font-size: 0.71875rem;
    color: var(--cai-muted);
    margin-top: 0.1875rem;
}

.cai-field-hint--warn {
    color: var(--cai-warn);
}

.cai-field-convent {
    padding-left: 11.5rem;
}

.admin-secrets-tab-body {
    padding: 0.75rem 0.25rem;
}

/* EmbeddedGridPanel is height:100%, so the host needs a concrete height or AG Grid rows
   collapse to 0 (header/footer still render). */
.admin-secrets-usage-grid,
.admin-secrets-history-grid {
    min-height: 20rem;
    height: 20rem;
}

.cai-field-error {
    font-size: 0.71875rem;
    color: var(--cai-err);
    margin-top: 0.1875rem;
}

.cai-field-action-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cai-field-action-row > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

/* Segmented toggle (Password | SSH key) */
.cai-segmented {
    display: inline-flex;
    border: 0.0625rem solid var(--cai-rule-strong);
    border-radius: 0.375rem;
    overflow: hidden;
}

.cai-segmented-btn {
    padding: 0.375rem 0.875rem;
    font-size: 0.78125rem;
    border: none;
    background: var(--cai-card);
    color: var(--cai-muted);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.cai-segmented-btn + .cai-segmented-btn {
    border-left: 0.0625rem solid var(--cai-rule-strong);
}

.cai-segmented-btn--active {
    background: var(--cai-inset);
    color: var(--cai-ink);
    font-weight: 600;
}

/* Banners */
.cai-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    border-radius: 0.375rem;
    font-size: 0.78125rem;
    border: 0.0625rem solid;
}

.cai-banner--warn {
    background: var(--nwc-warning-subtle);
    border-color: #F9C846;
    color: var(--cai-text-warning);
}

.cai-banner--err {
    background: var(--nwc-error-subtle);
    border-color: #F5BDB9;
    color: var(--cai-err);
}

.cai-banner--info {
    background: var(--nwc-info-subtle);
    border-color: #BFCFF8;
    color: var(--cai-text-info);
}

.cai-banner-icon {
    flex-shrink: 0;
    font-size: 0.875rem;
    line-height: 1.4;
}

/* Datasets placeholder */
.cai-datasets-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 3rem 1.25rem;
    text-align: center;
    gap: 0.5rem;
}

.cai-datasets-placeholder-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.cai-datasets-placeholder-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--cai-ink);
}

.cai-datasets-placeholder-body {
    font-size: 0.8125rem;
    color: var(--cai-muted);
    max-width: 27.5rem;
    line-height: 1.5;
}

/* SFTP datasets section */
.cai-datasets-sftp {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cai-datasets-sftp-header {
    padding: 0 0 0.5rem;
}

.cai-datasets-sftp-heading-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.cai-datasets-sftp-heading {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--cai-label);
}

.cai-datasets-sftp-count {
    font-size: 0.75rem;
    color: var(--cai-muted);
}

.cai-datasets-sftp-subtitle {
    font-size: 0.75rem;
    color: var(--cai-muted);
}

.cai-datasets-sftp-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cai-datasets-sftp-row {
    display: grid;
    grid-template-columns: 1fr 1.75rem;
    gap: 0.25rem;
    align-items: center;
}

.cai-datasets-sftp-input {
    width: 100%;
    padding: 0.3125rem 0.5rem;
    border: 0.0625rem solid var(--border);
    border-radius: 0.25rem;
    font-family: var(--mono-font);
    font-size: 0.78125rem;
    background: var(--surface);
    color: var(--text);
}

.cai-datasets-sftp-input:focus {
    outline: none;
    border-color: var(--teal);
}

.cai-datasets-sftp-remove {
    width: 1.5rem;
    height: 1.5rem;
    border: none;
    background: none;
    color: var(--cai-muted);
    cursor: pointer;
    border-radius: 0.25rem;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cai-datasets-sftp-remove:hover {
    background: var(--surface-hover);
    color: var(--err);
}

.cai-datasets-sftp-add-btn {
    margin-top: 0.25rem;
    padding: 0.375rem 0.75rem;
    border: 0.09375rem dashed var(--border);
    border-radius: 0.375rem;
    background: none;
    color: var(--cai-muted);
    cursor: pointer;
    font-size: 0.78125rem;
    text-align: left;
    width: 100%;
}

.cai-datasets-sftp-add-btn:hover {
    border-color: var(--teal);
    color: var(--teal);
}

/* SQL IDE datasets section */
.cai-sql-datasets {
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    overflow: hidden;
}

.cai-sql-datasets-split {
    display: grid;
    grid-template-columns: 16.25rem 1fr;
    gap: 1rem;
    align-items: start;
    min-width: 0;
    overflow: hidden;
}

/* Query Editor header strip — one vertically-centred toolbar: editing-context group · query-name
   field · action buttons grouped at the right edge. Wraps as whole groups on a narrow viewport. */
.cai-query-header-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
    padding: 0.625rem 0 0.75rem;
}

.cai-query-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.cai-query-header-label {
    font-size: 0.78125rem;
    font-weight: 600;
    color: var(--cai-muted);
    white-space: nowrap;
}

.cai-query-header-right {
    display: flex;
    flex: 1 1 13.75rem;
    align-items: center;
    gap: 0.625rem;
    min-width: 13.75rem;
    max-width: 23.75rem;
}

.cai-query-name-label {
    font-size: 0.78125rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.cai-query-header-right nphase-text-field {
    flex: 1 1 auto;
    min-width: 0;
}

/* Actions sit as one right-aligned group so they read as a unit, not buttons scattered after the field. */
.cai-query-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.cai-query-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 6.1875rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.cai-query-status-badge--draft {
    background: var(--warn-soft, #fffbeb);
    color: var(--warn, #d97706);
}

.cai-query-status-badge--review {
    background: var(--info-soft, #eff6ff);
    color: var(--info, #2563eb);
}

.cai-query-status-badge--approved {
    background: var(--tealSoft, var(--nwc-ui-surface-soft));
    color: var(--teal, #0d9488);
}

.cai-query-status-badge--archived {
    background: var(--muted-soft, var(--nwc-ui-surface-soft));
    color: var(--cai-muted, var(--nwc-text-secondary));
}

/* Saved Queries tab */
.cai-saved-queries {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cai-sq-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0 0.625rem;
    gap: 0.75rem;
}

.cai-sq-filters {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cai-sq-filter-pill {
    padding: 0.25rem 0.75rem;
    border-radius: 6.1875rem;
    font-size: 0.75rem;
    cursor: pointer;
    border: 0.09375rem solid var(--border);
    background: var(--surface);
    color: var(--cai-muted);
}

.cai-sq-filter-pill:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.cai-sq-filter-pill--active {
    background: var(--tealSoft, var(--nwc-ui-surface-soft));
    color: var(--teal, #0d9488);
    border-color: var(--teal, #0d9488);
}

.cai-sq-filter-pill--active:hover {
    background: var(--tealSoft, var(--nwc-ui-surface-soft));
    color: var(--teal, #0d9488);
}

/* Saved-Queries grid cell containers (AG-Grid custom renderers; layout is the grid's own) */
.cai-sq-name {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.cai-sq-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 6.1875rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.cai-sq-status-badge--draft {
    background: var(--warn-soft, #fffbeb);
    color: var(--warn, #d97706);
}

.cai-sq-status-badge--review {
    background: var(--info-soft, #eff6ff);
    color: var(--info, #2563eb);
}

.cai-sq-status-badge--approved {
    background: var(--tealSoft, var(--nwc-ui-surface-soft));
    color: var(--teal, #0d9488);
}

.cai-sq-status-badge--archived {
    background: var(--muted-soft, var(--nwc-ui-surface-soft));
    color: var(--cai-muted, var(--nwc-text-secondary));
}

/* Schema browser: flex column so the body scrolls independently */
.cai-schema-browser {
    background: var(--surface-inset, var(--nwc-ui-surface-soft));
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--border);
    display: flex;
    flex-direction: column;
    max-height: 36.25rem;
    overflow: hidden;
    position: sticky;
    top: 1rem;
}

.cai-schema-browser-header {
    flex-shrink: 0;
    padding: 0.625rem 0.75rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--cai-muted);
    border-bottom: 0.0625rem solid var(--border);
}

.cai-schema-browser-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.25rem 0;
}

.cai-schema-browser-loading, .cai-schema-browser-empty, .cai-schema-browser-error {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--cai-muted);
}

.cai-schema-browser-error {
    color: var(--err);
}

.cai-schema-table-row {
    padding: 0 0 0.25rem;
}

.cai-schema-table-label {
    padding: 0.3125rem 0.75rem;
    font-size: 0.78125rem;
    font-family: var(--mono-font);
    cursor: pointer;
    user-select: none;
    color: var(--text);
}

.cai-schema-table-label:hover {
    background: var(--surface-hover);
}

.cai-schema-col-container {
    padding-left: 1rem;
}

.cai-schema-col-container--hidden {
    display: none;
}

.cai-schema-col-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.1875rem 0.75rem;
    font-size: 0.71875rem;
    color: var(--cai-muted);
    cursor: pointer;
}

.cai-schema-col-row:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.cai-schema-col-pk {
    flex: 0 0 auto;
    color: var(--cai-muted);
    font-size: 0.75rem;
}

.cai-schema-col-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--mono-font);
    font-size: 0.71875rem;
    line-height: 1.4;
}

.cai-schema-col-type {
    flex: 0 0 auto;
    font-size: 0.625rem;
    color: var(--cai-muted);
    background: var(--surface-inset, var(--nwc-ui-surface-soft));
    padding: 0 0.3125rem;
    border-radius: 0.25rem;
}

.cai-sql-editor-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    width: 100%;
    overflow: hidden;
    padding-right: 1.25rem;
}

.cai-sql-editor-mount {
    border: 0.0625rem solid var(--border);
    border-radius: 0.375rem;
    overflow: hidden;
    width: 100%;
}

.cai-preview-grid-wrap {
    overflow: auto;
    max-height: 12.5rem;
    border: 0.0625rem solid var(--border);
    border-radius: 0.375rem;
}

.cai-preview-grid {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--mono-font);
    font-size: 0.75rem;
}

.cai-preview-grid th {
    padding: 0.3125rem 0.625rem;
    background: var(--surface-inset, var(--nwc-ui-surface-soft));
    border-bottom: 0.125rem solid var(--border);
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.cai-preview-grid td {
    padding: 0.25rem 0.625rem;
    border-bottom: 0.0625rem solid var(--border-muted, var(--nwc-ui-border));
    white-space: nowrap;
    max-width: 15rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cai-preview-loading {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--cai-muted);
}

.cai-preview-error {
    padding: 0.75rem;
    font-size: 0.75rem;
    color: var(--err);
}

/* Test strip wrapper inside Connection tab */
.cai-connection-test-wrap {
    margin-top: 0.25rem;
}

.cai-connection-test-hint {
    margin-top: 0.375rem;
}

.cai-connection-test-hint--hidden {
    display: none;
}

.project-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5em;
}

.project-description-card {
    grid-column: 1/4;
}

.project-overview-milestone-stepper {
    margin-top: 1rem;
}

.project-overview-milestone-stepper:empty {
    display: none;
}

/* ── Workflow Editor page ─────────────────────────────────────────────────── */
.workflow-editor-page {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.workflow-editor-page > .wc-structured-panel-content {
    flex: 1;
    min-height: 0;
    padding: 0;
}

.cai-sftp-fingerprint-row {
    min-width: 0;
}

.cai-sftp-fingerprint-row > nph-input {
    --input-max-width: 21.5rem;
    flex: 1 1 auto;
    min-width: 0 !important;
}

.cai-sftp-fingerprint-row > nph-button {
    flex: 0 0 auto;
}

.cai-sftp-scan-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cai-sftp-scan-modal-host {
    font-size: 0.78125rem;
    color: var(--cai-muted);
}

.cai-sftp-scan-modal-fingerprint {
    font-family: var(--mono-font);
    font-size: 0.78125rem;
    padding: 0.75rem;
    background: var(--surface-hover);
    border: 0.0625rem solid var(--border);
    border-radius: 0.375rem;
    word-break: break-all;
}

.cai-sftp-scan-modal-help {
    font-size: 0.75rem;
    color: var(--cai-muted);
    line-height: 1.5;
}

.cai-sftp-scan-modal-help-code {
    font-family: var(--mono-font);
    font-size: inherit;
    font-style: italic;
}

/* ── Modal card — suppress browser focus ring on programmatic focus (tabIndex=-1, card.focus() on open) ── */
.wc-ui-modal-card:focus {
    outline: none;
}

/* ── Profile dialog — card: strip library padding/gap, enable edge-to-edge sections (spec §9.2) ── */
.wc-ui-modal-card:has(.profile-dialog-body) {
    width: min(32.5rem, 100%);
    border-radius: 0.625rem;
    padding: 0;
    gap: 0;
    overflow: hidden;
}

/* ── Profile dialog — header: own padding, bottom border, spec typography ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-header {
    padding: 1.375rem 1.5rem 1.25rem;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-heading {
    gap: 0.1875rem;
}

.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    letter-spacing: -0.005em;
    line-height: normal;
}

.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-subtitle {
    font-size: 0.84375rem;
    color: var(--nwc-text-secondary);
    line-height: 1.5;
}

/* ── Profile dialog — body: collapse library gaps so sections go edge-to-edge ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-body,
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-body-wrap,
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-body-content {
    gap: 0;
}

/* Status element: no reserved height when empty ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-status {
    min-height: 0;
}

.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-status:empty {
    display: none;
}

/* ── Profile dialog — footer: spec padding, background, top border ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-footer {
    padding: 1rem 1.5rem;
    background: var(--nwc-ui-surface);
    border-top: 1px solid var(--nwc-ui-border);
    gap: 0;
}

/* ── Profile dialog — suppress library dirty border/shift (button state is the indicator) ── */
.wc-ui-modal-body-wrap--dirty .wc-ui-modal-body-content:has(.profile-dialog-body) {
    border-inline-start: none;
    padding-inline-start: 0;
}

/* ── Profile dialog identity strip ─────────────────────────────────────── */
.profile-dialog-body .wc-ui-form {
    gap: 0.5rem;
    padding: 0.625rem 1.5rem 0.5rem;
}

.profile-dialog-identity {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1.375rem 1.5rem;
    border-bottom: 1px solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
}

.profile-dialog-avatar.wc-ui-avatar {
    --wc-ui-avatar-size: 3.25rem;
    --wc-ui-avatar-font-size: 1.125rem;
    --wc-ui-avatar-font-weight: 700;
    --wc-ui-avatar-background: linear-gradient(135deg, #1a7a65, #1c3152);
    --wc-ui-avatar-color: #fff;
    --wc-ui-avatar-border-width: 0;
    --wc-ui-avatar-radius: 50%;
    display: flex;
    letter-spacing: 0.04em;
    user-select: none;
}

.profile-dialog-id-text {
    min-width: 0;
    flex: 1;
}

.profile-dialog-id-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    letter-spacing: -0.005em;
    line-height: 1.2;
}

.profile-dialog-id-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.profile-dialog-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.125rem 0.5rem;
    background: var(--nwc-ui-surface-soft);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.25rem;
    font-size: 0.78125rem;
    color: var(--nwc-text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.profile-dialog-pill-username {
    color: var(--nwc-text-primary);
    font-weight: 500;
}

/* ── Change password aux row ────────────────────────────────────────────── */
.profile-dialog-change-password {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.875rem 1.5rem 1.125rem;
    margin-top: 0.25rem;
    font-size: 0.84375rem;
    color: var(--nwc-text-secondary);
    border-top: 1px solid var(--nwc-ui-border);
}

.profile-dialog-change-password-text {
    flex-shrink: 0;
}

.profile-dialog-change-password-link {
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    font-size: 0.84375rem;
    color: #14967d;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}

.profile-dialog-change-password-link:hover {
    text-decoration: underline;
}

/* ── Form: TextField custom properties (label 8.125rem, input max 21.25rem, row padding 0.75rem) ── */
.profile-dialog-body nph-text-field {
    --label-width: 8.125rem;
    --input-max-width: 21.25rem;
    padding: 0.75rem 0;
}

/* ── Default Application row — light-DOM .wc-ui-field override ──
   Match the nph-input rows above: same 10.5rem label column (the input
   component's default --label-width) and 1rem label-to-control gap. */
.profile-dialog-body .wc-ui-field {
    padding: 0;
    gap: 1rem;
}

.profile-dialog-body .wc-ui-label {
    width: 10.5rem;
    min-width: 10.5rem;
}

/* ── Lock icon in aux row ── */
.profile-dialog-lock-icon {
    color: var(--nwc-text-secondary);
    flex-shrink: 0;
    display: block;
}

/* ── Close button: muted grey icon (spec §9.6), not teal ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-controls nph-button {
    --nwc-accent: #9ca3af;
    --nwc-accent-subtle: rgba(0, 0, 0, 0.06);
    --nwc-accent-subtle-strong: rgba(0, 0, 0, 0.1);
    --nwc-accent-shadow: none;
    width: 1.75rem;
    height: 1.75rem;
}

/* ── Footer Cancel button (variant=ghost set by JS): color #5c6878, no teal ── */
.wc-ui-modal-card:has(.profile-dialog-body) .wc-ui-modal-footer nph-button:first-child {
    --nwc-accent: #5c6878;
    --nwc-accent-subtle: rgba(0, 0, 0, 0.04);
    --nwc-accent-shadow: none;
}

/* ── Audit grid row click + cell style overrides ─────────────────────────── */

/* Clickable rows */
.admin-audit-logs-grid .ag-row,
.project-audit-logs-grid .ag-row {
    cursor: pointer;
}

.admin-audit-logs-grid .ag-row:hover .ag-cell,
.project-audit-logs-grid .ag-row:hover .ag-cell {
    background: rgba(0, 137, 123, 0.04);
}

.admin-audit-logs-grid .ag-row.audit-row--active,
.project-audit-logs-grid .ag-row.audit-row--active {
    box-shadow: inset 0.1875em 0 0 rgb(0, 137, 123);
}

.admin-audit-logs-grid .ag-row.audit-row--active .ag-cell,
.project-audit-logs-grid .ag-row.audit-row--active .ag-cell {
    background: rgba(0, 137, 123, 0.09) !important;
}

/* Cells left-align to match their headers. These were flex-centred, which put the
   value under the middle of the column while the header text sat at its start, and
   — because a flex container centres content wider than the box — clipped long
   values at BOTH ends: BLINDING_GATE_CHALLENGE_SENT rendered as
   "NDING_GATE_CHALLENGE_SE", losing the prefix that identifies it.
   Dropping display:flex restores AG Grid's own cell layout, which left-aligns and
   ellipsises overflow, so a too-long value keeps its readable start. */
.admin-audit-logs-grid .ag-cell,
.project-audit-logs-grid .ag-cell {
    text-align: start;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Audit detail drawer ─────────────────────────────────────────────────── */

.cai-audit-side-sheet {
    --wc-ui-side-sheet-nonmodal-scrim-opacity: 1;
    --wc-ui-side-sheet-width: 32.5rem;
    --wc-ui-side-sheet-background: var(--nwc-ui-surface);
    --wc-ui-side-sheet-border: 1px solid var(--line, #d8deea);
    --wc-ui-side-sheet-shadow: -12px 0 30px rgba(13, 27, 42, 0.10);
    --wc-ui-side-sheet-scrim: rgba(13, 27, 42, 0.10);
    --wc-ui-side-sheet-overflow: hidden;
    --wc-ui-side-sheet-body-display: block;
    --wc-ui-side-sheet-body-padding: 1.5rem 1.25rem 2rem;
}

/* Identifiers are set in monospace so ambiguous glyphs (0/O, 1/l) stay readable.
   Naming a concrete family before the generic keyword also avoids the browser's
   monospace-default quirk, where a relative font-size resolves against the
   monospace default rather than the inherited size. */
.audit-detail-drawer-ev-id,
.audit-dr-v-mono,
.audit-dr-v-action-code,
.audit-dr-meta-json {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums slashed-zero;
    letter-spacing: -0.01em;
}

/* ── Drawer head ─────────────────────────────────────────────────────────── */

.audit-detail-drawer-head {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--line, #d8deea);
    display: flex;
    align-items: flex-start;
    gap: 0.75em;
    flex-shrink: 0;
}

.audit-detail-drawer-titles {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.125em;
}

.audit-detail-drawer-ev-id {
    font-size: 0.75rem;
    color: var(--muted, var(--nwc-text-secondary));
    margin-bottom: 0.125rem;
    /* One click selects the whole id — it exists to be copied into an export or a query. */
    user-select: all;
}

.audit-detail-drawer-ev-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text, #182234);
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.audit-detail-drawer-ev-cat {
    font-size: 0.75rem;
    color: var(--muted, var(--nwc-text-secondary));
    margin-top: 0.25rem;
}

.audit-detail-drawer-nav {
    display: flex;
    align-items: center;
    gap: 0.25em;
    flex-shrink: 0;
}

.audit-detail-drawer-icon-btn {
    --nwc-button-color: var(--muted, #5d6d85);
    --nwc-button-text-hover-color: var(--text, #182234);
    --nwc-button-text-decoration: none;
    --nwc-button-text-font-size: inherit;
    --nwc-button-text-font-weight: inherit;
    --nwc-button-text-line-height: 1;
    width: 1.75em;
    height: 1.75em;
    border: 1px solid var(--line, #d8deea);
    background: var(--nwc-ui-surface);
    border-radius: 0.3125em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    padding: 0;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}

.audit-detail-drawer-icon-btn:hover:not([disabled]) {
    background: var(--bg, var(--nwc-ui-surface-soft));
    color: var(--text, #182234);
}

.audit-detail-drawer-icon-btn:focus-visible {
    outline: 2px solid var(--primary, #0b63f6);
    outline-offset: 2px;
}

.audit-detail-drawer-icon-btn[disabled] {
    opacity: 0.35;
    cursor: not-allowed;
}

.audit-detail-drawer-close-btn {
    border: none;
    font-size: 0.9375rem;
    margin-inline-start: 0.125rem;
}

/* ── Drawer body ─────────────────────────────────────────────────────────── */

.audit-detail-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.25rem 2rem;
}

.audit-detail-drawer-body::-webkit-scrollbar {
    width: 0.375em;
}

.audit-detail-drawer-body::-webkit-scrollbar-thumb {
    background: var(--line, #d8deea);
    border-radius: 0.1875em;
}

/* ── Drawer sections ─────────────────────────────────────────────────────── */

.audit-dr-section {
    margin-bottom: 2rem;
}

/* The section boundary is the more important one, so it carries the solid rule and
   the row rules recede. Previously every row had a full-weight rule while sections
   were separated by whitespace alone, which inverted the hierarchy. */
.audit-dr-section-title {
    display: block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted, var(--nwc-text-secondary));
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--line, #d8deea);
}

.audit-dr-row {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 0 1rem;
    padding: 0.5rem 0;
    min-height: 2.25rem;
    font-size: 0.875rem;
    line-height: 1.45;
    border-bottom: 1px solid rgba(216, 222, 234, 0.55);
    /* baseline, not center: values wrap (see overflow-wrap on .audit-dr-v), and
       centring drops the label between the value's lines instead of against the
       first line it labels. baseline also survives the label being a step smaller
       than the value, which start does not. */
    align-items: baseline;
}

.audit-dr-row:last-child {
    border-bottom: none;
}

.audit-dr-k {
    /* end, not right: the grid columns flip under dir=rtl (ar is a shipped locale),
       and right would then align the label to the far edge, away from the value it
       labels — losing the short eye travel this layout exists for. */
    text-align: end;
    color: var(--muted, var(--nwc-text-secondary));
    font-weight: 500;
    font-size: 0.8125rem;
}

.audit-dr-v {
    color: var(--text, #182234);
    overflow-wrap: break-word;
    word-break: break-word;
}

/* Raw-value token. Everywhere the panel shows a value exactly as it is stored —
   resource id, username, the action's enum code — it gets this outlined treatment,
   so a reader can tell at a glance what is human-facing copy and what is literally
   in the database and safe to grep for in an export. */
.audit-dr-v-mono,
.audit-dr-v-action-code {
    display: inline-block;
    background: transparent;
    border: 1px solid var(--line, #d8deea);
    border-radius: 0.1875rem;
    padding: 0.125rem 0.375rem;
    color: var(--muted, var(--nwc-text-secondary));
    /* Keeps the bordered box inside the row's normal line box, so a row holding a
       token is the same height as a row holding plain text. */
    line-height: 1;
}

.audit-dr-v-mono {
    font-size: 0.8125rem;
    /* These sit directly in the row grid, so without this the cell stretches the
       token to the full column width and it reads as a text input. */
    justify-self: start;
}

/* Action cell */
.audit-dr-v-action {
    display: flex;
    align-items: center;
    gap: 0.4375em;
    flex-wrap: wrap;
}

.audit-dr-v-action-label {
    color: var(--text, #182234);
    font-weight: 500;
}

.audit-dr-v-action-code {
    font-size: 0.6875rem;
}

/* Status cell */
.audit-dr-v-status {
    display: flex;
    align-items: center;
    gap: 0.375em;
    color: var(--text, #182234);
}

.audit-dr-status-dot {
    width: 0.4375em;
    height: 0.4375em;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
}

.audit-dr-status-dot--ok {
    background: #10B981;
}

.audit-dr-status-dot--fail {
    background: #BF2F2F;
}

/* Actor cell */
.audit-dr-actor {
    display: flex;
    align-items: center;
    gap: 0.5em;
}

.audit-dr-actor-av.wc-ui-avatar {
    --wc-ui-avatar-size: 1.5rem;
    --wc-ui-avatar-font-size: 0.625rem;
    --wc-ui-avatar-font-weight: 700;
    --wc-ui-avatar-background: var(--bg, #f3f5f9);
    --wc-ui-avatar-color: var(--muted, #5d6d85);
    --wc-ui-avatar-border-width: 1px;
    --wc-ui-avatar-radius: 50%;
    display: inline-flex;
    letter-spacing: 0.02em;
    --wc-ui-avatar-border-color: var(--line, #d8deea);
    user-select: auto;
    unicode-bidi: normal;
}

.audit-dr-actor-stack {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.audit-dr-actor-nm {
    font-weight: 500;
    color: var(--text, #182234);
}

.audit-dr-actor-em {
    font-size: 0.75rem;
    color: var(--muted, var(--nwc-text-secondary));
    margin-top: 0.125rem;
}

/* Metadata JSON pre block */
.audit-dr-meta-json {
    background: var(--bg, var(--nwc-ui-surface-soft));
    border: 1px solid var(--line, #d8deea);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    padding: 0.625rem 0.75rem;
    color: var(--muted, var(--nwc-text-secondary));
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.audit-trail-modal {
    --header-padding-y-bottom: 0;
    --header-border-bottom: none;
}

/* SDTM Initial Setup — grid shells require a concrete height so AG Grid rows render
   (height:100% collapses to 0 when ancestor uses min-height instead of height). */
.sdtm-rds-grid-shell {
    height: 23.75rem;
    min-height: 23.75rem;
}

/* In the card body, a flex column, the shared shell's flex: 1 would replace that height with
   an indefinite one and collapse the grid to its pager. */
.wc-ui-card-body > .sdtm-rds-grid-shell {
    flex: none;
}

.sdtm-sfv-grid-shell {
    height: 23.75rem;
    min-height: 23.75rem;
}

.lsdtm-spec-upload-dialog {
    --modal-initial-width: 50%;
    --modal-min-width: 30%;
}

/* ModalWindow has no Size enum — width is a CSS custom property on the host. This is the
   replacement for the CSR dialogs that used ModalDialog.Size.WIDE. */
.tlf-csr-dialog-wide {
    --modal-initial-width: 60%;
    --modal-min-width: 40%;
}

.adam-sfv-grid-shell,
.adam-sph-grid-shell,
.adam-pd-grid-shell,
.adam-db-grid-shell,
.adam-ps-grid-shell,
.adam-param-grid-shell {
    height: 23.75rem;
    min-height: 23.75rem;
}

.adam-initial-setup-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.adam-initial-setup-settings-header-title {
    flex: 1;
    min-width: 0;
}

.adam-initial-setup-settings-header .adam-study-setup-lock-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.adam-initial-setup-settings-host .wc-ui-field:has(> .cai-field-hint) {
    display: grid;
    grid-template-columns: min(30%, 10.5rem) minmax(0, 28.75rem);
    row-gap: 0;
}

.adam-initial-setup-settings-host .wc-ui-field:has(> .cai-field-hint) > * {
    width: 100%;
}

.adam-initial-setup-settings-host .wc-ui-field > .cai-field-hint {
    grid-column: 2;
}

/* Study Document detail tabs. nph-tab-panel is `display: flex; min-height: 0` with no height and
   no flex-grow, so as a `flex: 0 1 auto` item it sizes to content; its shadow
   `.tab-slot.active { height: 100% }` then resolves to auto and no grid inside gets a definite
   height. AG Grid's own .ag-root-wrapper-body declares `height: 0`, so the row viewport stays at
   zero while the fixed-height header and pager still paint — the "correct count, no rows"
   signature of CAI-439. Giving the panel a real flex context lets height flow down, which is how
   .admin-project-roles-tabs-slot and .library-tlf-zone-section already do it. They never shrink:
   the files and the audit trail above already fill the fixed-height column, so a shrinkable slot
   collapses to 0 and the shadow `.tabs-content { overflow: hidden }` clips a tab without a sized
   grid, such as CSR sections, to nothing (CAI-542). */
.study-document-detail-tabs-slot {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    min-height: 0;
}

.study-document-detail-tabs-slot > nph-tab-panel {
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    min-height: 0;
}

.study-doc-ops-card {
    flex: 0 0 auto;
    margin-bottom: 28px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 8px;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.study-doc-ops-card--hidden {
    display: none;
}

.study-doc-ops-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 28px;
    padding: 10px 16px;
}

.study-doc-ops-spacer {
    flex: 1 1 auto;
}

.study-doc-ops-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.study-doc-ops-caption,
.study-doc-ops-th {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-ops-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #0f172a);
}

.study-doc-ops-grid {
    display: grid;
    grid-template-columns: minmax(200px, 1.2fr) minmax(220px, 1.6fr) auto;
    border-top: 1px solid var(--border-default, #e2e8f0);
}

.study-doc-ops-th {
    padding: 8px 16px;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
    border-bottom: 1px solid var(--border-default, #e2e8f0);
}

.study-doc-ops-cell {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-default, #e2e8f0);
}

.study-doc-ops-cell--action {
    align-items: flex-end;
}

.study-doc-ops-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text, #0f172a);
}

.study-doc-ops-code {
    font-family: var(--sdtm-mono, ui-monospace, monospace);
    font-size: 11px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-ops-reason {
    font-size: 12px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-ops-type {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.study-doc-ops-route {
    font-size: 13px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-ops-empty {
    padding: 12px 16px;
    border-top: 1px solid var(--border-default, #e2e8f0);
    font-size: 13px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-ops-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}

.study-doc-ops-badge--neutral {
    background: rgba(100, 116, 139, 0.10);
    color: var(--text-muted, var(--nwc-text-secondary));
    border-color: rgba(100, 116, 139, 0.22);
}

.study-doc-ops-badge--accent,
.study-doc-ops-badge--success {
    background: rgba(16, 163, 127, 0.10);
    color: var(--nwc-accent-active, #0b7a60);
    border-color: rgba(16, 163, 127, 0.22);
}

.study-doc-ops-badge--info {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    border-color: rgba(37, 99, 235, 0.22);
}

.study-doc-ops-badge--danger {
    background: rgba(220, 38, 38, 0.10);
    color: var(--sdtm-error, #b91c1c);
    border-color: rgba(220, 38, 38, 0.22);
}

.study-doc-file-status {
    justify-self: start;
    width: fit-content;
    gap: 6px;
}

.study-doc-file-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
    flex: none;
}

.study-doc-files-card,
.study-doc-audit-card {
    flex: 0 0 auto;
    margin-bottom: 28px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 8px;
    background: var(--surface-card, var(--nwc-ui-surface));
    box-shadow: 0 1px 2px rgba(13, 27, 42, 0.04);
}

.study-doc-files-header,
.study-doc-audit-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    padding: 14px 20px;
}

.study-doc-audit-header {
    border-bottom: 1px solid var(--border-default, #e2e8f0);
}

.study-doc-files-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text, #0f172a);
}

.study-doc-audit-count {
    font-size: 12.5px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-files-filters {
    margin-left: auto;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 6px;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
    --wc-ui-filter-chip-group-gap: 2px;
    --wc-ui-filter-chip-block-size: 26px;
    --wc-ui-filter-chip-padding: 0 10px;
    --wc-ui-filter-chip-border-width: 0;
    --wc-ui-filter-chip-radius: 4px;
    --wc-ui-filter-chip-background: transparent;
    --wc-ui-filter-chip-color: var(--text-muted, #64748b);
    --wc-ui-filter-chip-font-size: 12.5px;
    --wc-ui-filter-chip-font-weight: 500;
    --wc-ui-filter-chip-label-font-size: inherit;
    --wc-ui-filter-chip-label-font-weight: inherit;
    --wc-ui-filter-chip-label-line-height: inherit;
    --wc-ui-filter-chip-hover-background: transparent;
    --wc-ui-filter-chip-selected-background: var(--nwc-ui-surface);
    --wc-ui-filter-chip-selected-color: var(--text, #0f172a);
    --wc-ui-filter-chip-selected-shadow: 0 1px 2px rgba(13, 27, 42, 0.12);
}

.study-doc-files-columns,
.study-doc-files-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.8fr) minmax(120px, 220px) 128px 72px;
    gap: 16px;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid var(--border-default, #e2e8f0);
}

.study-doc-files-columns {
    padding-top: 9px;
    padding-bottom: 9px;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
}

.study-doc-files-heading {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-files-columns-actions {
    text-align: right;
}

.study-doc-files-row:hover {
    background: color-mix(in srgb, var(--nwc-accent) 2.5%, transparent);
}

.study-doc-file-identity {
    display: flex;
    gap: 12px;
    min-width: 0;
}

.study-doc-file-type {
    flex: none;
    width: 40px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 4px;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
    font: 600 10px var(--font-mono, ui-monospace, monospace);
    letter-spacing: 0.04em;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-file-name-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.study-doc-file-name {
    padding: 0;
    border: none;
    background: none;
    text-align: left;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--nwc-accent-active, #0b7a60);
    cursor: pointer;
    overflow-wrap: anywhere;
}

.study-doc-file-name:hover {
    text-decoration: underline;
}

.study-doc-file-reason {
    margin-top: 6px;
    padding: 8px 10px;
    border-radius: 6px;
    background: rgba(220, 38, 38, 0.08);
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--sdtm-error, #b91c1c);
}

.study-doc-file-reason-label {
    font-weight: 600;
}

.study-doc-file-description {
    font-size: 13px;
    color: var(--text, #0f172a);
}

.study-doc-file-actions {
    display: flex;
    justify-content: flex-end;
}

.study-doc-file-menu-button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted, var(--nwc-text-secondary));
    cursor: pointer;
}

.study-doc-file-menu-button:hover {
    background: rgba(13, 27, 42, 0.05);
}

.study-doc-file-menu {
    position: fixed;
    z-index: 901;
    width: 200px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    background: var(--nwc-ui-surface);
    border: 1px solid var(--border-default, #e2e8f0);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(13, 27, 42, 0.12);
}

.study-doc-file-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 32px;
    padding: 0 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-size: 13px;
    text-align: left;
    color: var(--text, #0f172a);
    cursor: pointer;
}

.study-doc-file-menu-item:hover {
    background: rgba(13, 27, 42, 0.05);
}

.study-doc-file-menu-item--danger,
.study-doc-file-menu-icon--danger {
    color: #dc2626;
}

.study-doc-file-menu-icon {
    display: flex;
    align-items: center;
    color: inherit;
}

.study-doc-files-empty,
.study-doc-audit-empty {
    padding: 28px 20px;
    font-size: 13px;
    text-align: center;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-audit-body {
    padding: 6px 20px 16px;
}

.study-doc-audit-date {
    padding: 14px 0 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-audit-event {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    gap: 14px;
}

.study-doc-audit-rail {
    position: relative;
    display: flex;
    justify-content: center;
}

.study-doc-audit-rail::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--border-default, #e2e8f0);
}

.study-doc-audit-dot {
    position: relative;
    margin-top: 5px;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    box-shadow: 0 0 0 3px #fff;
}

.study-doc-audit-dot--accent {
    background: #0d9488;
}

.study-doc-audit-dot--success {
    background: #16a34a;
}

.study-doc-audit-dot--danger {
    background: #dc2626;
}

.study-doc-audit-dot--neutral {
    background: #94a3b8;
}

.study-doc-audit-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding-bottom: 16px;
}

.study-doc-audit-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--text, #0f172a);
}

.study-doc-audit-actor {
    font-weight: 500;
}

.study-doc-audit-verb,
.study-doc-audit-time,
.study-doc-audit-code {
    color: var(--text-muted, var(--nwc-text-secondary));
}

.study-doc-audit-file,
.study-doc-audit-code,
.study-doc-audit-time {
    font-family: var(--font-mono, ui-monospace, monospace);
}

.study-doc-audit-file {
    font-size: 13px;
    font-weight: 500;
}

.study-doc-audit-code,
.study-doc-audit-time {
    font-size: 12px;
}

.study-doc-audit-time {
    padding-top: 2px;
    white-space: nowrap;
}

.study-doc-audit-comment {
    padding: 8px 12px;
    border-radius: 6px;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
    font-size: 13px;
    line-height: 1.5;
    color: var(--text, #0f172a);
}

.study-doc-audit-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 0 20px 14px;
}

.study-doc-audit-pager:empty {
    display: none;
}

.study-doc-audit-range {
    font-size: 12px;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.core-config-study-documents-grid-shell {
    min-height: 23.75rem;
}

/* One step under the 14px grid header so the longer titles still fit on one line and every
   column stays in view. The audit grid uses the same size. */
.core-config-study-documents-grid-shell .ag-header-cell-text,
.study-document-audit-grid-shell .ag-header-cell-text {
    font-size: 0.8125rem;
}

/* Centered loading placeholder shown while a Core Config / Initial Setup section fetches its data */
.core-config-section-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 15rem;
    width: 100%;
}

/* Back-to-list bar shown above a Core Config / Initial Setup detail view. Without this, the
   wrapping div has no layout rule, so nph-button's shadow CSS (button { width: 100% }) fills the
   full-width block host and stretches the pill into a bar instead of a compact button. padding-top
   gives the button's hover ring room to render — this sits flush against the top
   of .cai-coreconfig-canvas's overflow:auto viewport, which otherwise clips the ring's top edge. */
.core-config-section-back {
    display: flex;
    justify-content: flex-start;
    padding-top: 0.25rem;
    margin-bottom: 1rem;
}

.directory-configuration-hint {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: var(--nwc-text-secondary);
}

.directory-configuration-warning {
    margin: 0 0 0.75rem;
    font-size: 0.875rem;
    color: #b45309;
}

.directory-configuration-section .wc-ui-section {
    grid-template-columns: max-content minmax(12rem, 1fr);
    align-items: center;
}

.directory-configuration-section .wc-ui-section-title,
.directory-configuration-section .directory-configuration-hint,
.directory-configuration-section .directory-configuration-warning {
    grid-column: 1 / -1;
}

.directory-configuration-section .wc-ui-field {
    display: contents;
}

.directory-configuration-section .wc-ui-label {
    width: auto;
    white-space: nowrap;
}

.directory-configuration-section .wc-ui-field > nph-combobox {
    width: 100%;
    min-width: 12rem;
}

/* SDTM Initial Setup — Metadata Package upload (vendor picker, file chooser, hint) and the
   package files table: one row per file with its vendor picker, datasets and actions. */
.sdtm-package-upload {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sdtm-package-files-table-shell {
    overflow-x: auto;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    margin-top: 0.5rem;
}

.sdtm-package-files-table {
    width: 100%;
    border-collapse: collapse;
}

.sdtm-package-files-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--nwc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    white-space: nowrap;
}

.sdtm-package-files-table td {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    vertical-align: middle;
}

.sdtm-package-files-table tr:last-child td {
    border-bottom: none;
}

.sdtm-package-files-name {
    min-width: 11rem;
    overflow-wrap: anywhere;
}

.sdtm-package-files-vendor {
    min-width: 12rem;
}

.sdtm-package-files-datasets {
    color: var(--nwc-text-secondary);
}

.sdtm-package-files-actions {
    white-space: nowrap;
    text-align: right;
}

/* Sub-heading dividers within SDTM/ADaM Initial Setup cards */
.sdtm-is-subheading,
.adam-is-subheading {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--nwc-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.875rem 0 0.375rem 0;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    margin-bottom: 0.125rem;
}

/* ── SDTM Domain Blueprint — Approval sub-section (Card 5) ─────────────────
   Plain sub-heading + content, no boxed background — matches every other
   Card 5/other-card sub-section (e.g. .sdtm-is-subheading siblings). Reads
   top-to-bottom as one form: status badge + "View Change History" (this
   row), then the comment box, then the three action buttons directly under
   it — so it's visually unambiguous the comment travels with the button
   clicked next. */
/* Same pill formula as .project-study-execution-status-badge — reused here as its own
   scoped class since this badge's tones (draft/submitted/approved) are domain-specific. */
/* ── SDTM Domain Blueprint — Change History dialog table ──────────────────
   Same bordered/header-shaded/hover shape as .library-sdtm-table, using the
   app's standard tokens instead of that component's scoped --lsd-* variables. */
/* ── ADaM Dataset Blueprint — Approval sub-section (Card 3) ─────────────────
   Badge + History → comment box → buttons → meta line. Previously mirrored the
   SDTM Domain Blueprint approval sub-section, which was removed in CAI-437;
   this family was always independently scoped, so it is unaffected. */
.adam-bp-approval-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 0.625rem;
}

.adam-bp-approval-status-host {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.adam-bp-approval-buttons-host {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.adam-bp-approval-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.375rem;
    padding: 0.125rem 0.625rem;
    border-radius: 6.1875rem;
    font-size: 0.6875rem;
    font-weight: 800;
    white-space: nowrap;
}

.adam-bp-approval-status-badge--draft {
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

.adam-bp-approval-status-badge--submitted {
    background: rgba(217, 119, 6, 0.12);
    color: #92400e;
}

.adam-bp-approval-status-badge--approved {
    background: rgba(22, 163, 74, 0.12);
    color: #166534;
}

.adam-bp-approval-meta-text {
    font-size: 0.82rem;
    color: var(--nwc-text-secondary);
    margin-top: 0.5rem;
}

.adam-bp-approval-meta-comment {
    font-size: 0.82rem;
    color: var(--nwc-text-secondary);
    margin-top: 0.25rem;
    font-style: italic;
}

/* ── ADaM Dataset Blueprint — Change History dialog table ──────────────────
   Bordered, header-shaded, hover-highlighted table. */
.adam-bp-history-table {
    width: 100%;
    border-collapse: collapse;
}

.adam-bp-history-table th {
    padding: 0.5625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--nwc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    white-space: nowrap;
}

.adam-bp-history-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    color: var(--nwc-ui-text, var(--nwc-text-primary));
    font-size: 0.95rem;
    vertical-align: middle;
}

.adam-bp-history-table tr:last-child td {
    border-bottom: none;
}

.adam-bp-history-table tbody tr:hover td {
    background: var(--nwc-ui-surface-soft);
}

.adam-bp-history-empty {
    font-size: 0.9rem;
    color: var(--nwc-text-muted);
    font-style: italic;
    padding: 0.5rem 0;
}

/* ── ADaM Initial Setup — shared editor dialog body ──────────────────────
   All five ADaM editor dialogs (spec version, planned dataset, blueprint,
   population, parameter) use this single wrapper class so the field/section
   layout matches the SDTM editor dialogs exactly, with an ADaM teal accent. */
.adam-dialog-body .wc-ui-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.125rem 0;
}

.adam-dialog-body .wc-ui-section {
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    padding: 0.75rem 0.875rem 0.375rem;
    position: relative;
}

.adam-dialog-body .wc-ui-section-title {
    font-size: 0.69rem;
    font-weight: 700;
    color: #00897B;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
}

.adam-dialog-body .wc-ui-note {
    font-size: 0.72rem;
    color: var(--nwc-text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.adam-dialog-body .wc-ui-field {
    display: grid;
    grid-template-columns: 10rem 1fr;
    align-items: center;
    gap: 0.625rem 1rem;
    padding: 0.5rem 0;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
}

.adam-dialog-body .wc-ui-field:last-child {
    border-bottom: none;
}

.adam-dialog-body .wc-ui-label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    line-height: 1.3;
}

.adam-dialog-body .wc-ui-field > sp-textfield,
.adam-dialog-body .wc-ui-field > sp-picker,
.adam-dialog-body .wc-ui-field > sp-textarea {
    width: 100%;
}

/* Button token override — same pattern as SDTM dialogs */
.wc-ui-modal-card:has(.adam-dialog-body) .wc-ui-actions .wc-ui-button {
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    --nwc-raw-gray-50: transparent;
    --nwc-raw-gray-100: transparent;
    --nwc-secondary-shadow: none;
    --nwc-accent-hover: var(--nwc-accent);
    --nwc-inset-shadow: none;
}

/* ── TLF Initial Setup — grid shell heights ───────────────────────────────────
   Match the ADaM / SDTM Initial Setup grid sizing (23.75rem). */
.tlf-gov-pin-grid-shell,
.tlf-lsd-grid-shell,
.tlf-sc-grid-shell,
.tlf-sad-grid-shell,
.tlf-pm-grid-shell,
.tlf-osp-grid-shell,
.tlf-cg-grid-shell {
    height: 23.75rem;
    min-height: 23.75rem;
}

/* ── TLF Initial Setup — dialog body ─────────────────────────────────────── */
.tlf-dialog-body .wc-ui-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.125rem 0;
}

.tlf-dialog-body .wc-ui-section {
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    padding: 0.75rem 0.875rem 0.375rem;
    position: relative;
}

.tlf-dialog-body .wc-ui-section-title {
    font-size: 0.69rem;
    font-weight: 700;
    color: #1565C0;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding-bottom: 0.5rem;
    margin-bottom: 0.25rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
}

.tlf-dialog-body .wc-ui-note {
    font-size: 0.72rem;
    color: var(--nwc-text-muted);
    margin-bottom: 0.5rem;
    font-style: italic;
}

/* TLF setup item editor: flat cai-labelled-form (all labels via UiSupport.field).
   Overrides the shared 10rem / 1.75rem-pad card layout so every row — including
   TokenInput Sources — shares one 10.5rem right-aligned label column. */
.tlf-dialog-body .tlf-setup-item-form.cai-labelled-form .wc-ui-field,
.project-tlf-setup-add-form .tlf-setup-item-form.cai-labelled-form .wc-ui-field {
    display: grid;
    grid-template-columns: 10.5rem minmax(0, 28.75rem);
    align-items: start;
    gap: 0 1rem;
    padding: 0.375rem 0;
    border-bottom: none;
}

.tlf-dialog-body .tlf-setup-item-form.cai-labelled-form .wc-ui-field > .wc-ui-label,
.project-tlf-setup-add-form .tlf-setup-item-form.cai-labelled-form .wc-ui-field > .wc-ui-label {
    width: auto;
    min-width: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--nwc-text-form-labels, var(--nwc-text-primary));
    line-height: 1.4;
    text-align: end;
    padding-top: 0.5rem;
}

.tlf-dialog-body .tlf-setup-item-form.cai-labelled-form .wc-ui-field > :not(.wc-ui-label),
.project-tlf-setup-add-form .tlf-setup-item-form.cai-labelled-form .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 28.75rem;
    min-width: 0;
}

.tlf-dialog-body .tlf-setup-item-form.cai-labelled-form nph-input,
.tlf-dialog-body .tlf-setup-item-form.cai-labelled-form nph-combobox,
.project-tlf-setup-add-form .tlf-setup-item-form.cai-labelled-form nph-input,
.project-tlf-setup-add-form .tlf-setup-item-form.cai-labelled-form nph-combobox {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    width: 100%;
    max-width: 100%;
}

.wc-ui-modal-card:has(.tlf-dialog-body) .wc-ui-actions .wc-ui-button {
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    --nwc-raw-gray-50: transparent;
    --nwc-raw-gray-100: transparent;
    --nwc-secondary-shadow: none;
    --nwc-accent-hover: var(--nwc-accent);
    --nwc-inset-shadow: none;
}

/* ── TLF Coverage Summary — KPI strip ────────────────────────────────────────
   Read-only completeness metrics, computed from spec + source/population state. */
.tlf-kpi-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    padding: 0.375rem 0 0.75rem;
}

.tlf-kpi {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.875rem 0.5rem;
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid #EEF2F7;
    text-align: center;
}

.tlf-kpi-num {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--nwc-text-primary);
    line-height: 1.1;
}

.tlf-kpi-label {
    font-size: 0.72rem;
    color: var(--nwc-text-secondary);
    line-height: 1.25;
}

@media (max-width: 56rem) {
    .tlf-kpi-strip {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── TLF Governance Commitments — read-only version-pin chips ─────────────────
   Inherited from Library / AI Configuration; surfaced here for context. */
.tlf-gov-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.375rem 0 0.5rem;
}

.tlf-gov-chip {
    display: inline-flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.3rem 0.625rem;
    border-radius: var(--nwc-radius-full);
    background: var(--nwc-info-subtle);
    border: 0.0625rem solid #DBEAFE;
}

.tlf-gov-chip-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: #1E40AF;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.tlf-gov-chip-value {
    font-size: 0.78rem;
    color: var(--nwc-text-primary);
    font-weight: 600;
}

.tlf-gov-chip-empty {
    background: var(--nwc-ui-surface-soft);
    border-color: #EEF2F7;
}

.tlf-gov-chip-empty .tlf-gov-chip-label {
    color: var(--nwc-text-muted);
}

.tlf-gov-chip-empty .tlf-gov-chip-value {
    color: var(--nwc-text-muted);
    font-weight: 500;
    font-style: italic;
}

/* ── TLF Shell Specification — grouped file-upload control ────────────────────
   Read-only filename grows; compact secondary Upload button sits inline. */
.tlf-file-input-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tlf-file-input-row > :first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.tlf-upload-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* ── Library Launchable Images editor form ─────────────────────────────────── */
/* wc-ui-field adds 1.75rem horizontal padding that misaligns picker rows vs nph-input rows — remove it (profile-dialog-body pattern). */
.library-launchable-images-editor .wc-ui-field {
    padding: 0;
    gap: 1rem;
    align-items: start;
}

.library-launchable-images-editor .wc-ui-label {
    min-width: 10.5rem;
}

/* --nwc-font-primary crosses the shadow boundary; nph-textarea 0.6.19 shadow CSS has font-family:inherit on <textarea>, so this resolves cross-browser. */
.library-launchable-images-editor nph-textarea {
    font-family: var(--nwc-font-primary);
}

/* Match picker/date control column width to nph-input's --input-max-width (28.75rem) */
.library-launchable-images-editor .wc-ui-field > :not(.wc-ui-label) {
    width: 100%;
    max-width: 28.75rem;
    min-width: 0;
}

/* sp-picker has a hardcoded host width — override so it fills the column above */
.library-launchable-images-editor sp-picker {
    width: 100%;
    max-width: 100%;
}

/* cds-date-picker host width is controlled by Carbon's own CSS; target it directly so shadow DOM layout scales to match. */
.library-launchable-images-editor .cai-form-grid-2 {
    grid-template-columns: 1fr 1fr;
}

.library-launchable-images-editor cds-date-picker {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.library-launchable-images-editor cds-date-picker-input {
    width: 100%;
    max-width: 100%;
}

/* Indent the Approval sub-section header to the control column */
.library-launchable-images-editor .cai-form-section-label {
    padding-left: calc(10.5rem + 1rem);
}

/* ── AI Configuration — root container ──────────────────────────────────── */
.core-config-ai-configuration {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── AI Configuration — Card 1: Capability rows ────────────────────────────── */
.core-config-ai-cap-row {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1rem;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-border, #dde3ec);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.12s;
}

.core-config-ai-cap-row:last-child {
    margin-bottom: 0;
}

.core-config-ai-cap-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.core-config-ai-cap-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
}

.core-config-ai-cap-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text, #182234);
}

/* Risk and governance chips — follow cai-spec-badge sizing/shape */
.core-config-ai-cap-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.0625rem 0.5rem;
    border-radius: var(--nwc-radius-full, 62.4375rem);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01rem;
    white-space: nowrap;
    border: 0.0625rem solid transparent;
    text-transform: uppercase;
}

.core-config-ai-cap-chip--limited {
    background: var(--nwc-accent-subtle, color-mix(in srgb, var(--nwc-accent) 12%, transparent));
    color: var(--nwc-accent-active, #0b7a5e);
    border-color: color-mix(in srgb, var(--nwc-accent) 30%, transparent);
}

.core-config-ai-cap-chip--medium {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
    border-color: #fcd34d;
}

.core-config-ai-cap-chip--art50 {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
    border-color: #fca5a5;
}

.core-config-ai-cap-chip--disclosure {
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
    border-color: #93c5fd;
}

.core-config-ai-cap-chip--readonly {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    border-color: var(--nwc-ui-border);
}

/* NL-to-SQL sub-toggle row inside the Aria capability card */
.core-config-ai-cap-subtoggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    background: var(--bg, var(--nwc-ui-surface-soft));
    border: 0.0625rem solid var(--nwc-border, #dde3ec);
    border-radius: 0.25rem;
}

.core-config-ai-cap-subtoggle-label {
    font-size: 0.8rem;
    color: var(--text, #182234);
}

/* ── Card 2: AI Model banner ─────────────────────────────────────────────── */
.core-config-ai-pin-model-banner {
    background: var(--nwc-info-subtle);
    border: 0.0625rem solid #bfdbfe;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.core-config-ai-pin-model-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.375rem;
}

.core-config-ai-pin-model-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e40af;
    white-space: nowrap;
}

.core-config-ai-pin-model-banner nwc-text-field,
.core-config-ai-pin-model-banner input[type="text"] {
    flex: 1;
    min-width: 0;
}

/* ── AI Configuration grid shells — fixed height matching Initial Setup grids */
.ai-version-pins-grid-shell,
.ai-hitl-grid-shell,
.ai-overrides-grid-shell {
    height: 23.75rem;
    min-height: 23.75rem;
}

.core-config-ai-readiness-preview-box {
    border: 0.0625rem solid #99f6e4;
    background: var(--nwc-ui-surface);
    border-radius: 0.375rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.core-config-ai-readiness-preview-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--spectrum-gray-600, var(--nwc-text-secondary));
    margin-bottom: 0.75rem;
}

.core-config-ai-readiness-preview-row {
    display: grid;
    grid-template-columns: 12.5rem 1fr;
    gap: 0.5rem;
    padding: 0.3rem 0;
    border-bottom: 0.0625rem solid #f0fdf4;
    font-size: 0.8125rem;
}

.core-config-ai-readiness-preview-row:last-child {
    border-bottom: none;
}

.core-config-ai-readiness-preview-key {
    color: var(--spectrum-gray-600, var(--nwc-text-secondary));
    font-weight: 500;
}

.core-config-ai-readiness-preview-value {
    color: var(--spectrum-gray-900, #111827);
    word-break: break-word;
}

.core-config-ai-readiness-preview-value--warn {
    color: #d97706;
    font-style: italic;
}

.core-config-ai-readiness-btn-row {
    display: flex;
    justify-content: flex-start;
    margin-top: 0.75rem;
}

.core-config-ai-readiness-mark-btn {
    flex-shrink: 0;
}

/* ── TLF Execution workflow ─────────────────────────────────────────────── */
/* Shell card title is hidden so the panel header is the only page title, with actions on that row. */
.legacy-module-card:has(.project-tlf-execution-shell) > .app-content-title,
.legacy-module-card:has(.project-tlf-execution-shell) > .app-content-description {
    display: none;
}

.project-tlf-execution-shell > .wc-structured-panel-header .wc-structured-panel-heading {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary, #111827);
}

.project-tlf-execution-shell > .wc-structured-panel-header .wc-structured-panel-desc {
    font-size: 14px;
    color: var(--muted);
}

.project-tlf-execution-shell > .wc-structured-panel-header .wc-structured-panel-desc:empty {
    display: none;
}

.project-tlf-execution-shell > .wc-structured-panel-header .wc-structured-panel-actions {
    align-self: start;
}

/* Full-bleed shell: stepper flush to top, title/subtitle on page background. */
.app-main-content:has(.project-tlf-execution-page) {
    padding: 0;
}

.legacy-module-card:has(.project-tlf-execution-page) {
    height: 100%;
    min-height: unset;
    padding: 0;
    gap: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.legacy-module-card:has(.project-tlf-execution-page) > .app-content-title,
.legacy-module-card:has(.project-tlf-execution-page) > .app-content-description,
.legacy-module-card:has(.project-tlf-execution-page) > .app-status {
    display: none;
}

.app-content-body:has(.project-tlf-execution-page) {
    position: relative;
    min-height: 0;
    flex: 1;
}

.project-tlf-execution-page,
.project-tlf-execution-page > .wc-structured-panel-content,
.project-tlf-execution-page > .wc-structured-panel-content > .project-tlf-execution {
    height: 100%;
    min-height: 0;
}

.project-tlf-execution-page > .wc-structured-panel-content {
    padding: 0;
    background: transparent;
}

.project-tlf-execution {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    background: transparent;
}

.project-tlf-execution-stepper-wrap {
    flex-shrink: 0;
    width: 100%;
    background: var(--surface-card, var(--nwc-ui-surface));
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    padding: 0.75rem 1.5rem 0.875rem;
}

.project-tlf-execution-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
    background: transparent;
}

.project-tlf-execution--list .project-tlf-execution-body {
    padding-top: 0.75rem;
}

.project-tlf-execution--list .project-tlf-execution-canvas {
    padding-top: 0.5rem;
}

.project-tlf-execution-step-header {
    flex-shrink: 0;
    background: transparent;
}

.project-tlf-execution-step-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.project-tlf-execution-step-header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-tlf-execution-step-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    letter-spacing: -0.01em;
}

.project-tlf-execution-step-subtitle {
    margin-top: 0.1875rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-tlf-execution-canvas {
    flex: 1;
    min-height: 0;
    padding: 1rem 0 1.5rem;
    background: transparent;
}

.project-tlf-execution-step-placeholder {
    min-height: 12rem;
}

.project-tlf-execution--designer .project-tlf-execution-stepper-wrap,
.project-tlf-execution--designer .project-tlf-execution-step-header {
    display: none;
}

.project-tlf-execution--designer .project-tlf-execution-body {
    flex: 1;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.project-tlf-execution--designer .project-tlf-execution-canvas {
    flex: 1;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-tlf-execution-delivery-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.25rem 0 0.75rem;
}

.project-tlf-execution-delivery-name {
    font-weight: 600;
}

.project-tlf-delivery-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-tlf-delivery-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-delivery-step > .project-tlf-setup-step {
    flex: 1;
    min-height: 0;
}

.project-tlf-setup-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-execution-canvas:has(.project-tlf-setup-step) {
    display: flex;
    flex-direction: column;
    padding-bottom: 0.75rem;
}

/* ── aCRF Deliverable (shares the TLF Execution shell and stepper) ───────── */
.acrf-deliverable .project-tlf-execution-canvas {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.acrf-deliverable-issues {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.acrf-deliverable-grid {
    flex: 1 1 auto;
    min-height: 24rem;
    display: flex;
    flex-direction: column;
}

.acrf-deliverable-grid > .wc-structured-panel,
.acrf-deliverable-grid > .wc-structured-panel > .wc-structured-panel-content {
    height: 100%;
}

.acrf-deliverable-split {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr);
    gap: 0.5rem;
    flex: 1 1 auto;
    min-height: 26rem;
}

.acrf-deliverable-split.acrf-deliverable-split--mapping {
    grid-template-columns: 24rem minmax(0, 1fr);
}

.acrf-deliverable-card {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.5rem;
}

.acrf-deliverable-panel-title {
    padding: 0.7rem 1rem;
    border-bottom: 0.0625rem solid var(--cai-rule);
    font-size: 0.95rem;
    font-weight: 600;
}

.acrf-deliverable-not-placed {
    padding: 0 0.5rem 0.75rem;
}

.acrf-deliverable-not-placed > .acrf-deliverable-panel-title {
    padding: 0.7rem 0.5rem 0;
    border-bottom: 0;
}

/* Every page of the delivery in one scroll beside the tree, which follows it. */
.acrf-deliverable-sheet-host {
    max-height: calc(100vh - 16rem);
    background: var(--cai-hover);
    padding: 1rem;
}

.acrf-deliverable-pages {
    display: grid;
    gap: 1.25rem;
}

/* Room after the last page, so any page chosen, the last included, can be brought to the top of the preview. */
.acrf-deliverable-pages:has(> .acrf-deliverable-page-slot)::after {
    content: "";
    block-size: max(0rem, calc(100vh - 20rem));
}

.acrf-deliverable-page-slot[data-current] > .acrf-deliverable-sheet {
    border-color: var(--nwc-accent);
}

/* A page's contents are drawn again on every change; the browser anchors the scroll on the page, which stays. */
.acrf-deliverable-page-slot > .acrf-deliverable-sheet {
    overflow-anchor: none;
}

/* A page not read yet keeps the room it will take, so the scroll does not jump as pages are read. */
.acrf-deliverable-sheet.acrf-deliverable-sheet--placeholder {
    display: grid;
    gap: 0.6rem;
    min-height: 12rem;
    padding: 0.75rem;
}

.acrf-deliverable-page.acrf-deliverable-page--placeholder {
    background: var(--cai-inset);
}

.acrf-deliverable-sheet {
    max-width: 54rem;
    margin: 0 auto;
    padding: 1.4rem 1.6rem 1rem;
    background: var(--cai-card);
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.25rem;
    box-shadow: var(--cai-shadow-sm);
}

.acrf-deliverable-sheet-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.acrf-deliverable-sheet-title {
    font-size: 0.92rem;
    font-weight: 700;
}

.acrf-deliverable-sheet-heads {
    display: grid;
    justify-items: end;
    gap: 0.25rem;
}

.acrf-deliverable-sheet-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(9rem, 16rem);
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 0.0625rem dashed var(--cai-rule);
    font-size: 0.84rem;
}

.acrf-deliverable-sheet-row--issue {
    background: var(--cai-s3-soft);
}

.acrf-deliverable-sheet-answer {
    margin-top: 0.15rem;
    color: var(--cai-body);
}

.acrf-deliverable-sheet-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.acrf-deliverable-sheet-foot,
.acrf-deliverable-sheet-empty {
    margin-top: 0.9rem;
    text-align: center;
    font-size: 0.72rem;
    color: var(--cai-muted);
}

.acrf-deliverable-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.05rem 0.4rem;
    border: 0.0625rem solid var(--cai-fs);
    border-radius: 0.2rem;
    background: var(--cai-fs-soft);
    color: var(--cai-fs);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    max-width: 100%;
    overflow-wrap: anywhere;
    text-align: left;
    cursor: pointer;
}

.acrf-deliverable-tag.acrf-deliverable-tag--supp {
    border-color: var(--cai-s3);
    background: var(--cai-s3-soft);
    color: var(--cai-warn);
}

.acrf-deliverable-tag.acrf-deliverable-tag--not-submitted {
    border-color: var(--cai-muted);
    background: var(--cai-hover);
    color: var(--cai-body);
}

.acrf-deliverable-tag.acrf-deliverable-tag--head {
    font-weight: 600;
    cursor: default;
}

/* The Blank CRF page with its labels laid over it, positioned in PDF points as shares of the page. */
.acrf-deliverable-sheet.acrf-deliverable-sheet--page {
    padding: 0.75rem;
}

.acrf-deliverable-sheet-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.acrf-deliverable-sheet-hint {
    flex: 1 1 auto;
    font-size: 0.78rem;
    color: var(--cai-muted);
}

.acrf-deliverable-sheet-refusals {
    display: grid;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
    padding: 0.5rem 0.6rem;
    border: 0.0625rem solid var(--cai-s3);
    border-radius: 0.25rem;
    background: var(--cai-s3-soft);
    font-size: 0.78rem;
}

.acrf-deliverable-sheet-refusal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.acrf-deliverable-page {
    display: block;
    width: 100%;
    height: auto;
    border: 0.0625rem solid var(--cai-rule);
    background: var(--cai-card);
    user-select: none;
}

/* Only a label that can be dragged takes touch gestures; a swipe anywhere else on a page scrolls the pages. */
.acrf-deliverable-page-label[data-draggable] {
    touch-action: none;
}

.acrf-deliverable-page[data-placing] {
    cursor: crosshair;
    outline: 0.125rem dashed var(--nwc-accent);
    outline-offset: 0.125rem;
}

.acrf-deliverable-page-image {
    pointer-events: none;
}

.acrf-deliverable-page-label {
    cursor: grab;
    outline: none;
}

.acrf-deliverable-page-label--head {
    cursor: default;
}

/* A label's fill, border, dashes and text colour are presentation attributes the server styles each line with, as the
   aCRF draws it. A rule would beat them, so only the focus and blocked states below override them. */
.acrf-deliverable-page-label-box {
    stroke-width: 0.5;
}

/* The component library's global font rule beats SVG presentation attributes, so the label text rolls font-size back
   to the size the server sends in its font-size attribute, in PDF points, and sets the font and spacing the aCRF draws
   it with. Geometric precision keeps glyph widths from being rounded to screen pixels at any zoom. */
.acrf-deliverable-page-label-text {
    font-family: "Liberation Sans", Arial, Helvetica, sans-serif;
    font-size: revert-layer;
    font-style: normal;
    font-weight: 400;
    line-height: normal;
    letter-spacing: 0;
    word-spacing: 0;
    font-kerning: none;
    font-variant-ligatures: none;
    text-transform: none;
    text-rendering: geometricPrecision;
    pointer-events: none;
}

.acrf-deliverable-page-label-text[data-bold] {
    font-weight: 700;
}

.acrf-deliverable-page-label[data-pending] {
    opacity: 0.6;
}

.acrf-deliverable-page-label[data-held] {
    cursor: grabbing;
}

.acrf-deliverable-page-label:focus-visible .acrf-deliverable-page-label-box {
    stroke: var(--nwc-accent);
    stroke-width: 1.5;
}

.acrf-deliverable-page-label[data-blocked] {
    cursor: not-allowed;
}

.acrf-deliverable-page-label[data-blocked] .acrf-deliverable-page-label-box {
    fill: color-mix(in srgb, var(--cai-err) 12%, var(--cai-card));
    stroke: var(--cai-err);
    stroke-width: 1.5;
}

/* What a held label would cover where it is: printed text, a line the page draws, or another moved label. */
.acrf-deliverable-page-blocked {
    fill: none;
    stroke: var(--cai-err);
    stroke-width: 1;
    stroke-dasharray: 3 2;
    pointer-events: none;
}

/* A refused move's message floats over the foot of the page in view, so nothing moves when it comes or goes. */
.acrf-deliverable-sheet-notices {
    position: sticky;
    bottom: 0;
    block-size: 0;
}

.acrf-deliverable-review {
    display: grid;
    gap: 0.75rem;
    align-content: start;
}

.acrf-deliverable-review-metrics {
    --wc-ui-metric-accent-value-color: var(--nwc-accent-active);
    --wc-ui-metric-warning-value-color: var(--cai-warn);
    --wc-ui-metric-negative-value-color: var(--cai-err);
}

.acrf-deliverable-review-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
    align-items: stretch;
}

.acrf-deliverable-summary {
    display: grid;
    gap: 0.7rem;
}

.acrf-deliverable-summary-row {
    display: grid;
    grid-template-columns: 9.5rem minmax(0, 1fr);
    align-items: center;
    gap: 0.75rem;
    font-size: 0.86rem;
}

.acrf-deliverable-summary-label {
    text-align: right;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--cai-muted);
}

.acrf-deliverable-dialog-body {
    display: grid;
    gap: 0.8rem;
    padding-top: 0.9rem;
}

.acrf-deliverable-labels {
    display: grid;
    gap: 0.4rem;
}

/* Lines up under the Label fields: nph-input's left label is --label-width 10.5rem plus --label-input-gap 1rem. */
.acrf-deliverable-labels > .acrf-deliverable-add-label {
    justify-self: start;
    margin-left: 11.5rem;
}

.acrf-deliverable-label-row {
    display: flex;
    align-items: flex-end;
    gap: 0.6rem;
}

.acrf-deliverable-label-row > :first-child {
    flex: 1 1 auto;
}

.acrf-deliverable-standards-picker {
    display: grid;
    gap: 0.25rem;
}

.acrf-deliverable-standards-picker > :last-child {
    justify-self: start;
}

.acrf-deliverable-ai-progress {
    align-self: center;
    color: var(--nwc-text-muted);
    font-size: 0.8125rem;
}

.acrf-deliverable-ai-reasons {
    display: grid;
    gap: 0.15rem;
    margin-top: 0.25rem;
    color: var(--nwc-text-muted);
    font-size: 0.75rem;
}

@media (max-width: 60rem) {
    .acrf-deliverable-split,
    .acrf-deliverable-split.acrf-deliverable-split--mapping,
    .acrf-deliverable-review-cards,
    .acrf-deliverable-sheet-row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.project-tlf-setup-step > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-tlf-setup-step .app-grid-page-grid-shell {
    flex: 1;
    min-height: 12rem;
    height: auto;
}

.project-tlf-setup-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.project-tlf-programming-header-actions,
.project-tlf-compare-header-actions,
.project-tlf-packaging-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.project-tlf-programming-directory-defaults {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-tlf-programming-directory-defaults-readonly {
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.875rem;
}

.project-tlf-setup-add-dialog {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.project-tlf-setup-add-dialog .wc-ui-tab-content {
    min-height: 18rem;
}

.project-tlf-setup-add-placeholder {
    min-height: 18rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.project-tlf-setup-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 52vh;
    overflow-y: auto;
    padding: 1.25rem 1.375rem 0.5rem;
}

.project-tlf-setup-add-dialog .tlf-dialog-body .wc-ui-section,
.project-tlf-setup-add-form .wc-ui-section {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}

.project-tlf-setup-add-dialog .tlf-dialog-body .wc-ui-section-title {
    display: none;
}

.project-tlf-setup-add-dialog .tlf-dialog-body .wc-ui-form {
    padding: 0;
}

.project-tlf-setup-add-form-intro {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-tlf-setup-add-create-tab {
    min-height: 0;
}

.project-tlf-setup-library-import-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 18rem;
}

.project-tlf-setup-library-import-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.25rem;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-default, var(--nwc-ui-surface));
}

.project-tlf-setup-library-import-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-tlf-setup-library-import-selection-count {
    margin-left: auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, var(--nwc-text-primary));
}

.project-tlf-setup-library-import-grid-shell {
    flex: 1;
    min-height: 0;
}

.project-tlf-setup-library-import-checkbox-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.project-tlf-setup-import-row--imported {
    opacity: 0.6;
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
}

.project-tlf-setup-library-import-checkmark,
.project-tlf-setup-study-import-checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--semantic-positive, #059669);
}

.project-tlf-setup-study-import-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 18rem;
}

.project-tlf-setup-study-import-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.25rem;
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-default, var(--nwc-ui-surface));
}

.project-tlf-setup-study-import-study-select {
    flex: 0 0 240px;
    max-width: 100%;
}

.project-tlf-setup-study-import-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-tlf-setup-study-import-selection-count {
    margin-left: auto;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, var(--nwc-text-primary));
}

.project-tlf-setup-study-import-grid-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.project-tlf-setup-study-import-grid-shell {
    flex: 1;
    min-height: 0;
}

.project-tlf-setup-study-import-empty {
    flex: 1;
    min-height: 12rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-tlf-setup-study-import-checkbox-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.project-tlf-setup-import-row--selected {
    background: rgba(13, 148, 136, 0.12);
}

/* ── SDTM mapping-candidates grid: multi-select (selection persists across pages) ── */
.sdtm-candidate-select-all {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    margin-left: auto;
    flex: 0 0 auto;
    white-space: nowrap;
}

.sdtm-candidate-bulk-host {
    display: inline-flex;
    align-items: center;
}

.sdtm-candidate-checkbox-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.sdtm-candidate-checkbox-cell--disabled {
    opacity: 0.4;
}

.sdtm-candidate-row--selected {
    background: rgba(13, 148, 136, 0.12);
}

.lib-sdtm-datepicker {
    margin-left: 11.5rem;
}

.sdtm-root-shell {
    height: 100%;
}

.sdtm-workflow {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0.75rem;
}

.sdtm-workflow-stepper {
    flex: 0 0 auto;
}

.sdtm-workflow-stage {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.sdtm-workflow-stage > * {
    height: 100%;
    min-height: 0;
}

.sdtm-mappings-detail .ag-theme-quartz {
    --ag-wrapper-border: 0;
    border-block-start: 1px solid var(--nwc-input-border-color);
}

.sdtm-mapping-domain-panel .ag-theme-quartz {
    --ag-wrapper-border: 0;
}

.sdtm-programming-exec .ag-theme-quartz {
    --ag-wrapper-border: 0;
}

.sdtm-workflow-action-bar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    min-height: 3.5rem;
    gap: 0.75rem;
    padding-inline: 0.75rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.sdtm-workflow-action-title {
    min-width: 0;
    overflow-wrap: anywhere;
    font-weight: 600;
    font-size: 1.25rem;
}

.sdtm-workflow-action-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

@media (max-width: 40rem) {
    .sdtm-workflow-action-bar {
        align-items: flex-start;
        flex-direction: column;
        padding-block: 0.5rem;
    }

    .sdtm-workflow-action-buttons {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        margin-left: unset;
    }
}

.sdtm-mappings-root-content {
    display: flex;
    min-height: 0;
}

.sdtm-programming-root-content {
    display: flex;
    min-height: 0;
}

.sdtm-programming-workspace,
.sdtm-mappings-workspace {
    display: grid;
    grid-template-columns: minmax(16rem, 0.75fr) minmax(0, 5fr);
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.sdtm-mappings-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.2em;
}

.adam-mapping-dataset-panel.sdtm-domain-panel {
    grid-row: 1;
    border: 1px solid var(--nwc-input-border-color);
    border-radius: var(--bs-border-radius);
}

.sdtm-mappings-workspace.adam-mapping-workspace-collapsed,
.sdtm-programming-workspace.adam-mapping-workspace-collapsed {
    grid-template-columns: 5rem minmax(0, 5fr);
}

.sdtm-programming-detail,
.sdtm-mappings-detail {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    border: 1px solid var(--nwc-input-border-color);
    border-radius: var(--bs-border-radius);
    background: var(--nwc-ui-surface);
}

.sdtm-mappings-detail > .cai-sdtm-mapping-actions,
.sdtm-programming-detail > .cai-sdtm-programming-actions {
    flex: 0 0 auto;
}

.sdtm-programming-detail > .sdtm-programming-tabs,
.sdtm-mappings-detail > *:last-child {
    flex: 1 1 auto;
    min-height: 0;
}

.sdtm-compare-step .ag-theme-quartz,
.sdtm-programming-exec .ag-theme-quartz {
    border-block-start: 0 !important;
}

.sdtm-ai-mapping-pending-status {
    color: var(--nwc-text-muted);
}

.sdtm-ai-mapping-has-status {
    color: var(--nwc-ui-primary-strong);
}

.sdtm-ai-mapping-ready-status {
    color: var(--nwc-accent);
}

.cai-sdtm-programming-actions,
.cai-sdtm-mapping-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: space-between;
}

.cai-sdtm-mapping-actions {
    padding: 0.5rem;
}

.cai-sdtm-programming-actions {
    padding: 0.5rem;
}

.cai-sdtm-mapping-actions-left,
.cai-sdtm-mapping-actions-right {
    display: flex;
    gap: 0.75rem;
}

.cai-sdtm-mapping-actions-left {
    width: 100%;
}

/* Programming actions share the available pane width and wrap before controls collide. */
.cai-sdtm-programming-actions {
    flex-wrap: wrap;
}

.cai-sdtm-programming-actions > .cai-sdtm-mapping-actions-left,
.cai-sdtm-programming-actions > .cai-sdtm-mapping-actions-right {
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
}

.cai-sdtm-programming-actions > .cai-sdtm-mapping-actions-left {
    flex: 1 1 15em;
}

.cai-sdtm-programming-actions > .cai-sdtm-mapping-actions-right {
    flex: 0 1 auto;
    justify-content: flex-end;
    margin-inline-start: auto;
}

.cai-sdtm-programming-actions > div > * {
    flex: 0 0 auto;
}

.cai-sdtm-programming-actions .cai-sdtm-program-version-selector {
    min-width: 15em;
    max-width: 100%;
}

.sdtm-readiness-empty-state {
    height: 100%;
}

.sdtm-readiness-empty-state > .no-data-panel {
    height: 100%;
    justify-content: center;
}

.sdtm-mappings-edit-form {
    --modal-initial-width: 35%;
}

.sdtm-mappings-edit-form .wc-ui-section {
    border: 0;
}

.sdtm-code-editor {
    border-radius: 0 !important;
    height: 100%;
}

.sdtm-programming-tabs {
    --content-padding: 0;
    width: 100%;
    height: 100%;
}

/* Application palette and caller geometry for the public numbered stepper. */
.cai-stepper {
    --cai-stepper-circle-size: 1.6875rem;
    --nwc-stepper-node-size: var(--cai-stepper-circle-size);
    --nwc-stepper-item-min-inline-size: auto;
    --nwc-stepper-node-box-sizing: border-box;
    --nwc-stepper-node-border-width: 1.5px;
    --nwc-stepper-node-font-size: 0.75rem;
    --nwc-stepper-node-font-weight: 600;
    --nwc-stepper-node-line-height: 1.7;
    --nwc-stepper-node-background: var(--nwc-ui-surface);
    --nwc-stepper-node-border-color: var(--cai-border, #c6cfd8);
    --nwc-stepper-node-color: var(--cai-muted, #9ca3af);
    --nwc-stepper-complete-background: var(--nwc-accent);
    --nwc-stepper-complete-border-color: var(--nwc-accent);
    --nwc-stepper-complete-color: #fff;
    --nwc-stepper-active-background: var(--nwc-accent);
    --nwc-stepper-active-border-color: var(--nwc-accent);
    --nwc-stepper-active-color: #fff;
    --nwc-stepper-active-shadow: 0 0 0 3px color-mix(in srgb, var(--nwc-accent) 18%, transparent);
    --nwc-stepper-label-font-size: 0.6875rem;
    --nwc-stepper-label-font-weight: 400;
    --nwc-stepper-label-line-height: 1.7;
    --nwc-stepper-label-color: var(--cai-muted, #9ca3af);
    --nwc-stepper-complete-label-color: var(--cai-ink, #5c6878);
    --nwc-stepper-active-label-color: #14967d;
    --nwc-stepper-active-label-weight: 600;
    --nwc-stepper-gap: 0.45rem;
    --nwc-stepper-track-color: var(--cai-border, #dde3ec);
    --nwc-stepper-track-size: 1px;
    --nwc-stepper-track-inset: 1.5rem;
    margin: 0.25rem 0 1.25rem;
}

.cai-stepper--blinded {
    --nwc-stepper-complete-background: #f59e0b;
    --nwc-stepper-complete-border-color: #f59e0b;
    --nwc-stepper-active-background: #f59e0b;
    --nwc-stepper-active-border-color: #f59e0b;
    --nwc-stepper-active-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
    --nwc-stepper-active-label-color: var(--cai-text-warning);
}

/* ── Audit export status card (fixed bottom-right popup) ─────────────────── */

.audit-export-card {
    position: fixed;
    bottom: 1.5rem;
    right: 2rem;
    width: 22.5rem;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--nwc-ui-border);
    border-left: 0.25rem solid #2BB6A3;
    border-radius: 0.625rem;
    box-shadow: 0 8px 28px rgba(13, 27, 42, 0.14), 0 2px 8px rgba(13, 27, 42, 0.06);
    z-index: 9999;
    overflow: hidden;
}

.audit-export-card-head {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 0.75rem 0.75rem 0.875rem;
}

.audit-export-card-badge {
    width: 2.125rem;
    height: 2.125rem;
    flex-shrink: 0;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(43, 182, 163, 0.14);
    color: #2BB6A3;
    font-size: 1.0625rem;
    font-weight: 700;
    transition: background 0.2s, color 0.2s;
}

.audit-export-card--ready .audit-export-card-badge {
    background: #2BB6A3;
    color: #fff;
}

.audit-export-card--error .audit-export-card-badge {
    background: rgba(191, 47, 47, 0.10);
    color: #bf2f2f;
}

/* File/CSV icon in the badge — shown during in-progress states */
.audit-export-card-file-icon {
    width: 1.1875rem;
    height: 1.4375rem;
    background: #2BB6A3;
    clip-path: polygon(0 0, 65% 0, 100% 35%, 100% 100%, 0 100%);
    flex-shrink: 0;
}

.audit-export-card--ready .audit-export-card-file-icon,
.audit-export-card--error .audit-export-card-file-icon {
    display: none;
}

.audit-export-card-check {
    display: none;
    line-height: 1;
}

.audit-export-card--ready .audit-export-card-check {
    display: block;
}

.audit-export-card-error-icon {
    display: none;
    line-height: 1;
}

.audit-export-card--error .audit-export-card-error-icon {
    display: block;
}

/* Progress section — shown during in-progress, hidden on ready/error */
.audit-export-card-progress {
    padding: 0 0.875rem 0.875rem;
}

.audit-export-card--ready .audit-export-card-progress,
.audit-export-card--error .audit-export-card-progress {
    display: none;
}

.audit-export-card-bar {
    height: 0.375rem;
    border-radius: 0.1875rem;
    background: var(--nwc-ui-surface-soft);
    overflow: hidden;
    position: relative;
}

.audit-export-card-bar-fill {
    position: absolute;
    top: 0;
    height: 100%;
    width: 42%;
    background: linear-gradient(90deg, #229e8c, #2BB6A3);
    border-radius: 0.1875rem;
    animation: audit-export-progress 1.5s ease-in-out infinite;
}

@keyframes audit-export-progress {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(340%);
    }
}

.audit-export-card-working-text {
    display: block;
    font-size: 0.71875rem;
    color: var(--nwc-text-secondary);
    margin-top: 0.4375rem;
    font-style: italic;
}

.audit-export-card-titles {
    flex: 1;
    min-width: 0;
}

.audit-export-card-title {
    display: block;
    font-size: 0.84375rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    line-height: 1.3;
}

.audit-export-card-sub {
    display: block;
    font-size: 0.71875rem;
    color: var(--nwc-text-secondary);
    margin-top: 0.125rem;
    line-height: 1.35;
}


.audit-export-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.875rem 0.875rem;
}

.audit-export-card-dl-btn {
    flex: 1;
    height: 2.125rem;
    background: #2BB6A3;
    color: #fff;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3125rem;
    transition: background 0.12s;
}

.audit-export-card-dl-btn:hover {
    background: #229e8c;
}

.audit-export-card-dismiss-btn {
    height: 2.125rem;
    padding: 0 0.875rem;
    background: var(--nwc-ui-surface);
    color: #2BB6A3;
    border: 0.09375rem solid #2BB6A3;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.12s;
}

.audit-export-card-dismiss-btn:hover {
    background: rgba(43, 182, 163, 0.08);
}

.project-tlf-programming-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-programming-step > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-tlf-programming-step .app-grid-page-grid-shell {
    flex: 1;
    min-height: 0;
}

.project-tlf-programming-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-tlf-programming-choice-body {
    padding: 0.25rem 0 0.125rem;
}

.project-tlf-programming-choice-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    padding: 0.5rem 0 0.25rem;
    flex-wrap: wrap;
}

.project-tlf-programming-choice-card {
    width: 13.125rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.625rem 1rem;
    border-radius: 0.5rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    color: inherit;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.project-tlf-programming-choice-card:hover {
    border-color: var(--nwc-accent);
    box-shadow: 0 0.25rem 0.875rem rgba(15, 122, 101, 0.14);
}

.project-tlf-programming-choice-card:focus-visible {
    outline: none;
    border-color: var(--nwc-accent);
    box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--nwc-accent) 13%, transparent);
}

.project-tlf-programming-choice-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nwc-success-subtle);
    color: var(--nwc-accent);
    flex-shrink: 0;
}

.project-tlf-programming-choice-title {
    font-size: 0.90625rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.project-tlf-programming-choice-desc {
    font-size: 0.78125rem;
    color: var(--nwc-text-secondary);
    line-height: 1.4;
}

.project-tlf-programming-generate-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    box-sizing: border-box;
}

.project-tlf-programming-generate-body > * {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.project-tlf-programming-generate-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.375rem;
    width: 100%;
    min-width: 0;
}

.project-tlf-programming-generate-field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    line-height: 1.3;
}

.project-tlf-programming-generate-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.project-tlf-programming-generate-instr-optional {
    color: var(--nwc-text-muted);
    font-weight: 400;
}

.project-tlf-programming-generate-tlf-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.project-tlf-programming-generate-tlf-field-label {
    flex: 0 0 auto;
    width: 3rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--nwc-text-secondary);
    line-height: 1.3;
}

.project-tlf-programming-generate-body nph-combobox.project-tlf-programming-generate-tlf-select,
.project-tlf-programming-generate-body .project-tlf-programming-generate-tlf-select {
    /* External "TLF" label; collapse internal label slot and never exceed parent width. */
    --label-width: 0px;
    --label-input-gap: 0px;
    --input-max-width: 100%;
    flex: 1 1 auto;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow: hidden;
}

.project-tlf-programming-generate-body .project-tlf-programming-generate-textarea,
.project-tlf-programming-generate-body nph-textarea.project-tlf-programming-generate-textarea {
    /* nph-textarea reserves a 10.5rem label column by default — collapse it when
       the visible label lives outside the control (stacked above). */
    --label-width: 0px;
    --label-input-gap: 0px;
    --input-max-width: 100%;
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.project-tlf-programming-generate-regen-field {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.375rem;
    width: 100%;
    min-width: 0;
}

.project-tlf-programming-generate-regen-field > .project-tlf-programming-generate-field-label {
    display: block;
    width: 100%;
    margin-bottom: 0;
}

.project-tlf-programming-generate-subtitle {
    font-size: 0.8125rem;
    color: var(--nwc-text-secondary);
    margin-top: 0.1875rem;
    line-height: 1.4;
}

.project-tlf-programming-generate-hdr-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.project-tlf-programming-ai-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    font-size: 0.5rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1;
    padding: 0.0625rem 0.3125rem;
    border-radius: 6.1875rem;
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
    border: 0.0625rem solid #a7e4d4;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: uppercase;
}

.project-tlf-programming-generate-body .project-tlf-programming-ai-chip {
    font-size: 0.5rem;
}

.project-tlf-programming-ai-chip > span {
    font-size: inherit;
    line-height: inherit;
}

.project-tlf-programming-ai-chip nph-icon,
.project-tlf-programming-ai-chip svg {
    width: 0.5rem;
    height: 0.5rem;
    flex-shrink: 0;
}

.project-tlf-programming-generate-context-host {
    width: 100%;
    min-width: 0;
}

.project-tlf-programming-ctx-panel {
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface-soft);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.project-tlf-programming-ctx-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    color: inherit;
    text-align: left;
    user-select: none;
    box-sizing: border-box;
}

.project-tlf-programming-ctx-hdr-title {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--nwc-text-secondary);
}

.project-tlf-programming-ctx-chev {
    transition: transform 0.15s ease;
    color: var(--nwc-text-muted);
    flex-shrink: 0;
}

.project-tlf-programming-ctx-chev.is-open {
    transform: rotate(180deg);
}

.project-tlf-programming-ctx-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 0.875rem 0.75rem;
    box-sizing: border-box;
}

.project-tlf-programming-ctx-row {
    display: grid;
    /* Mock: 130px label column, 10px gap, 12.5px type */
    grid-template-columns: 8.125rem minmax(0, 1fr);
    column-gap: 0.625rem;
    align-items: start;
    font-size: 0.78125rem;
    line-height: 1.4;
}

.project-tlf-programming-ctx-label {
    color: var(--nwc-text-muted);
    font-weight: 400;
}

.project-tlf-programming-ctx-value {
    color: var(--nwc-text-primary);
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.project-tlf-programming-generate-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.125rem 1.25rem;
    text-align: center;
}

.project-tlf-programming-generate-progress-spinner {
    display: inline-flex;
    flex-shrink: 0;
    color: var(--nwc-accent);
}

.project-tlf-programming-generate-progress-spinner svg,
.project-tlf-programming-generate-progress-spinner nph-icon {
    color: inherit;
}

.project-tlf-programming-generate-progress-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.project-tlf-programming-generate-progress-hint {
    font-size: 0.78125rem;
    color: var(--nwc-text-muted);
    text-align: center;
}

.project-tlf-programming-generate-code-host {
    min-height: 24rem;
    height: 26rem;
    max-height: 26rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface-soft);
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
}

.project-tlf-programming-generate-code-host .project-tlf-programming-code-editor,
.project-tlf-programming-generate-code-host nph-code-editor {
    height: 100%;
    min-height: 24rem;
}

.project-tlf-programming-generate-regen-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.project-tlf-programming-generate-regen-row > *:first-child {
    flex: 1 1 auto;
    min-width: 0;
}

.project-tlf-programming-generate-regen-row > *:last-child {
    flex: 0 0 auto;
    align-self: flex-start;
}

.project-tlf-programming-list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-programming-list-view > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-tlf-execution-canvas:has(.project-tlf-programming-step),
.project-tlf-execution-canvas:has(.project-tlf-compare-step),
.project-tlf-execution-canvas:has(.project-tlf-validation-step),
.project-tlf-execution-canvas:has(.project-tlf-packaging-step) {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    padding-bottom: 0.75rem;
}

.project-tlf-compare-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-compare-list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-compare-step > .app-grid-page-surface,
.project-tlf-compare-list-view > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-tlf-compare-step .app-grid-page-grid-shell {
    flex: 1;
    min-height: 0;
}

.project-tlf-validation-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-validation-list-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-validation-list-view > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-tlf-validation-step .app-grid-page-grid-shell {
    flex: 1;
    min-height: 0;
    height: auto;
}

.project-tlf-packaging-step {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-packaging-panes {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
}

.project-tlf-packaging-pane-left {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.project-tlf-packaging-toolbar {
    min-height: 2.75rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    padding: 0.4375rem 1.25rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    border-bottom: 1px solid var(--border-default, #dde3ec);
}

.project-tlf-packaging-registry-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    white-space: nowrap;
}

.project-tlf-packaging-registry-count {
    font-size: 0.71875rem;
    color: var(--text-muted, var(--nwc-text-muted));
    white-space: nowrap;
}

.project-tlf-packaging-seg {
    display: flex;
    background: var(--gray-100, var(--nwc-ui-surface-soft));
    border: 1px solid var(--border-default, #dde3ec);
    border-radius: 0.375rem;
    padding: 0.125rem;
    gap: 0.125rem;
}

.project-tlf-packaging-seg-btn {
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.71875rem;
    color: var(--text-secondary, var(--nwc-text-secondary));
    padding: 0.1875rem 0.625rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-weight: 500;
}

.project-tlf-packaging-seg-btn.is-on {
    background: var(--surface-card, var(--nwc-ui-surface));
    color: var(--text-primary, #111827);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(13, 27, 42, 0.08);
}

.project-tlf-packaging-pane-left > .app-grid-page-surface {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* A CSR draft in the CSR Authoring workspace; its layout is in csr-workspace.css. */
.tlf-csr-draft {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tlf-csr-block--output-missing {
    color: var(--cai-warn);
}

.tlf-csr-draft-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tlf-csr-draft-empty {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1.5rem;
    border: 0.0625rem dashed var(--nwc-ui-border);
    border-radius: 0.5rem;
    color: var(--nwc-text-secondary);
}

.tlf-csr-signatures {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.75rem 1rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
}

.tlf-csr-roles {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.tlf-csr-roles-label {
    font-weight: 600;
}

.tlf-csr-role {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 62.5rem;
    background: var(--nwc-info-subtle);
    color: var(--cai-text-info);
}

.tlf-csr-block {
    display: grid;
    grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
    column-gap: 1rem;
    align-items: start;
    padding: 0.375rem 0;
    border-top: 0.0625rem solid #F1F5F9;
}

.tlf-csr-block--output {
    display: block;
    font-size: 0.85rem;
    color: var(--nwc-text-primary);
    overflow-wrap: anywhere;
}

.tlf-csr-block[data-picked] {
    background: var(--nwc-accent-subtle);
    box-shadow: inset 0.1875rem 0 0 var(--nwc-accent);
}

@media (forced-colors: active) {
    .tlf-csr-block[data-picked] {
        outline: 0.1875rem solid Highlight;
        outline-offset: -0.1875rem;
    }
}

.tlf-csr-block-label {
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
    padding-top: 0.25rem;
    min-width: 0;
}

.tlf-csr-block-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    overflow-wrap: anywhere;
}

.tlf-csr-block-source {
    font-size: 0.7rem;
    color: var(--nwc-text-secondary);
}

.tlf-csr-block-body {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.tlf-csr-block-text {
    padding-top: 0.25rem;
    font-size: 0.875rem;
    white-space: pre-wrap;
    color: var(--nwc-text-primary);
}

.tlf-csr-block-hint {
    font-size: 0.75rem;
    color: var(--nwc-text-secondary);
}

@media (max-width: 48rem) {
    .tlf-csr-block {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.25rem;
    }
}

.tlf-csr-section-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
}

.tlf-csr-signature {
    font-size: 0.85rem;
    color: var(--nwc-text-primary);
}

.project-tlf-packaging-step .app-grid-page-grid-shell {
    flex: 1;
    min-height: 0;
}

.project-tlf-packaging-pane-right {
    display: flex;
    flex-direction: column;
    flex: 0 0 31.5rem;
    min-width: 24.5rem;
    min-height: 0;
    border-left: 1px solid var(--border-default, #dde3ec);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-tlf-packaging-pane-right > nph-tab-panel.project-tlf-packaging-side-tabs {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    width: 100%;
    background: var(--surface-card, var(--nwc-ui-surface));
    --content-padding: 0;
}

.project-tlf-packaging-side-tab-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.project-tlf-packaging-side-tab-body[data-tab-id="versions"] {
    overflow-y: auto;
}

.project-tlf-packaging-side-tab-body > nph-tree-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

.project-tlf-packaging-step .ag-cell {
    display: flex;
    align-items: center;
}

.project-tlf-packaging-step .ag-cell .ag-cell-wrapper,
.project-tlf-packaging-step .ag-cell .ag-cell-value {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.tlf-packaging-text {
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    font-size: 12.5px;
    line-height: 1.2;
    color: var(--text-secondary, var(--nwc-text-secondary));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tlf-packaging-id {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.tlf-packaging-lc-cell {
    overflow: visible;
}

.tlf-packaging-lc {
    display: flex;
    align-items: center;
    height: 16px;
    flex-shrink: 0;
}

.tlf-packaging-lc-rail {
    width: 10px;
    height: 2px;
    margin: 0 1px;
    border-radius: 1px;
    background: var(--nwc-ui-surface-soft);
    flex-shrink: 0;
}

.tlf-packaging-lc-rail--done {
    background: #A6E0CF;
}

.tlf-packaging-lc-chip {
    display: flex;
    align-items: center;
    gap: 5px;
    height: 16px;
    flex-shrink: 0;
}

.tlf-packaging-lc-dot {
    box-sizing: border-box;
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
    line-height: 0;
    overflow: hidden;
}

.tlf-packaging-lc-dot--done {
    background: var(--nwc-accent);
}

.tlf-packaging-lc-dot--done::after {
    content: "";
    box-sizing: border-box;
    width: 4px;
    height: 7px;
    border-right: 1.75px solid #fff;
    border-bottom: 1.75px solid #fff;
    transform: translateY(-0.5px) rotate(45deg);
}

.tlf-packaging-lc-dot--run {
    background: var(--nwc-ui-surface);
    border: 2px solid #3B82F6;
}

.tlf-packaging-lc-dot--run::after {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #3B82F6;
}

.tlf-packaging-lc-dot--fail {
    background: #E53E3E;
}

.tlf-packaging-lc-dot--wait {
    background: var(--nwc-ui-surface);
    border: 1.5px solid var(--nwc-ui-border);
}

.tlf-packaging-lc-bang {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    color: #fff;
}

.tlf-packaging-lc-lbl {
    font-size: 10.5px;
    font-weight: 500;
    line-height: 1;
    color: var(--text-secondary, var(--nwc-text-secondary));
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.tlf-packaging-lc-lbl--wait {
    color: var(--text-muted, var(--nwc-text-muted));
    font-weight: 400;
}

.project-tlf-packaging-versions-heading {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-muted));
    padding: 12px 14px 8px;
}

.project-tlf-packaging-versions-empty {
    padding: 8px 14px 16px;
}

.project-tlf-packaging-versions-empty-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.project-tlf-packaging-versions-empty-hint {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.project-tlf-packaging-version-card {
    margin: 0 12px 8px;
    padding: 10px 11px;
    border: 1px solid var(--border-default, #dde3ec);
    border-radius: 6px;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-tlf-packaging-version-card.is-latest {
    border-color: var(--teal-200, #A6E0CF);
    background: var(--teal-050, var(--nwc-ui-surface-soft));
}

.project-tlf-packaging-version-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.project-tlf-packaging-version-name {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #111827);
}

.project-tlf-packaging-version-latest {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 1px 5px;
    border-radius: 3px;
    background: var(--teal-100, #E0F5EE);
    color: var(--teal-700, #0F7A65);
}

.project-tlf-packaging-version-size {
    margin-left: auto;
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 11px;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.project-tlf-packaging-version-meta,
.project-tlf-packaging-version-hash {
    font-size: 11px;
    color: var(--text-muted, var(--nwc-text-muted));
    line-height: 1.5;
}

.project-tlf-packaging-version-hash {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-tlf-packaging-version-download {
    margin-top: 8px;
}

.project-tlf-packaging-build-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.project-tlf-packaging-build-kv {
    display: grid;
    grid-template-columns: 7rem 1fr;
    gap: 8px 12px;
    align-items: baseline;
}

.project-tlf-packaging-build-kv-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-muted));
}

.project-tlf-packaging-build-kv-value {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 12px;
    color: var(--text-primary, #111827);
}

.project-tlf-packaging-build-note {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.project-tlf-packaging-build-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
}

.project-tlf-packaging-build-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.project-tlf-packaging-build-ready-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 6px;
    background: var(--green-100, #DCFCE7);
    border: 1px solid #BBF7D0;
}

.project-tlf-packaging-build-filename {
    font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--green-600, #15803D);
}

.project-tlf-packaging-build-ready-meta {
    margin-top: 2px;
    font-size: 11.5px;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.project-tlf-compare-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-tlf-compare-dialog-tlf {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 0.25rem;
}

.project-tlf-compare-dialog-unavailable .wc-ui-field > sp-textfield {
    --spectrum-textfield-text-color: var(--text-secondary, #6b7280);
}

.project-tlf-validation-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-tlf-validation-dialog-tlf {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin-bottom: 0.25rem;
}

.project-tlf-validation-dialog-unavailable .wc-ui-field > sp-textfield {
    --spectrum-textfield-text-color: var(--text-secondary, #6b7280);
}

.project-tlf-programming-editor-host,
.project-tlf-programming-editor {
    display: flex;
    flex: 1;
    min-height: 0;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.project-tlf-execution--designer .project-tlf-programming-editor-host {
    padding-top: 0.75rem;
}

.project-tlf-programming-editor {
    flex-direction: row;
    background: var(--surface-card, var(--nwc-ui-surface));
    --project-tlf-programming-chrome-height: 3.5rem;
}

.project-tlf-programming-editor-col {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-tlf-programming-editor-toolbar {
    box-sizing: border-box;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.5rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-tlf-programming-editor-back {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 0.25rem 0;
    font-family: inherit;
    font-size: 0.78125rem;
    font-weight: 500;
    color: var(--text-secondary, var(--nwc-text-secondary));
    cursor: pointer;
    flex-shrink: 0;
    appearance: none;
}

.project-tlf-programming-editor-back:hover,
.project-tlf-programming-editor-back:focus-visible {
    color: var(--text-primary, #111827);
    background: transparent;
    border: none;
    box-shadow: none;
    outline: none;
}

.project-tlf-programming-editor-back svg {
    flex-shrink: 0;
}

.project-tlf-programming-editor-toolbar-divider {
    width: 0.0625rem;
    height: 1.125rem;
    background: var(--border-default, #dde3ec);
    flex-shrink: 0;
}

.project-tlf-programming-editor-tlf-id {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.78125rem;
    font-weight: 500;
    color: var(--text-secondary, var(--nwc-text-secondary));
    white-space: nowrap;
    flex-shrink: 0;
}

.project-tlf-programming-editor-sep {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-muted));
    flex-shrink: 0;
}

.project-tlf-programming-editor-name {
    flex: 1;
    min-width: 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted, var(--nwc-text-secondary));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-tlf-programming-editor-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    margin-left: auto;
}

.project-tlf-programming-editor-run-controls {
    display: inline-flex;
    align-items: stretch;
    gap: 0.5rem;
}

.project-tlf-programming-editor-run-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    border: 0.0625rem solid var(--border-input, #d1d5db);
    border-radius: 0.3125rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    color: var(--text-primary, #111827);
    cursor: pointer;
    appearance: none;
}

.project-tlf-programming-editor-run-settings:hover:not(:disabled) {
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
}

.project-tlf-programming-editor-run-settings:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.project-tlf-programming-run-settings {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-tlf-programming-run-settings-hint {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.project-tlf-programming-run-settings-warning {
    font-size: 0.8125rem;
    color: var(--text-warning, #b45309);
}

.project-tlf-programming-run-settings nph-combobox.project-tlf-programming-run-settings-workflow {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 100%;
    display: block;
    width: 100%;
}

.adam-programming-workspace-template .project-tlf-programming-editor-toolbar-actions {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

/* The menu trigger sits at the editor column's left edge, which clips anything opening leftwards. */
.adam-programming-workspace-template .project-tlf-programming-editor-toolbar-actions nph-action-menu {
    --nwc-action-menu-inset-inline-start: 0;
    --nwc-action-menu-inset-inline-end: auto;
}

.adam-programming-action-menu sp-menu-item iconify-icon[slot="icon"] {
    align-self: center;
}

.adam-programming-workspace-template .project-tlf-programming-editor-run-controls {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-end;
}

.adam-programming-workspace-template .project-tlf-programming-editor-run-controls > nph-button {
    flex: 0 0 auto;
}

.adam-programming-workspace-template .project-tlf-programming-editor-run-controls nph-combobox.adam-programming-version-filter {
    --label-width: 0;
    --label-input-gap: 0;
    --input-max-width: 8rem;
    flex: 0 0 8rem;
    min-width: 8rem;
    max-width: 8rem;
}

.adam-programming-workspace-template .project-tlf-programming-editor-run-controls nph-combobox.project-tlf-programming-editor-workflow-select {
    --input-max-width: 14rem;
    flex: 1 1 0;
    min-width: 0;
    max-width: 14rem;
}

.project-tlf-programming-editor-run-unavailable {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    white-space: nowrap;
}

.project-tlf-programming-editor-language,
.adam-prog-create-version {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0 0.625rem;
    border: 0.0625rem solid var(--border-input, #d1d5db);
    border-radius: 0.3125rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.adam-prog-create-version {
    --nwc-button-min-width: 2.5rem;
    --nwc-button-min-height: 2.5rem;
    --nwc-button-icon-only-padding: 0;
    --nwc-button-border-radius: 0.3125rem;
    width: 2.5rem;
    padding: 0;
    border: none;
}

.project-tlf-programming-editor-run {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-width: 4.75rem;
    height: 2.5rem;
    min-height: 2.5rem;
    padding: 0 0.875rem;
    border: none;
    border-radius: 0.3125rem;
    background: var(--nwc-accent);
    color: #fff;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    box-shadow: none;
}

.project-tlf-programming-editor-run-spinner {
    display: inline-flex;
    flex-shrink: 0;
    color: #fff;
    animation: rotation 0.8s linear infinite;
}

.project-tlf-programming-editor-run-label {
    line-height: 1;
}

.project-tlf-programming-editor-run:hover:not(:disabled) {
    background: #14967d;
}

.project-tlf-programming-editor-run:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.project-tlf-programming-editor-run.is-gated {
    opacity: 0.55;
    cursor: pointer;
}

.project-tlf-programming-editor-run.is-gated:hover {
    opacity: 0.7;
}

.project-tlf-programming-editor-run-lock {
    display: inline-flex;
    margin-right: 0.25rem;
    vertical-align: -0.1rem;
}

.project-tlf-programming-editor-title-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.project-tlf-programming-editor-banners {
    flex-shrink: 0;
    padding: 0.625rem 1.25rem;
    background: var(--nwc-ui-surface);
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.project-tlf-programming-editor-banners[hidden] {
    display: none;
}

.project-tlf-programming-st-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.1875rem 0.5rem;
    border-radius: 999px;
    border: 0.0625rem solid;
    white-space: nowrap;
    flex-shrink: 0;
}

.project-tlf-programming-st-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.project-tlf-programming-st-ai-draft {
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
    border-color: #a6e0cf;
}

.project-tlf-programming-st-draft {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    border-color: var(--nwc-ui-border);
}

.project-tlf-programming-st-ready {
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
    border-color: #a6e0cf;
}

.project-tlf-programming-st-final {
    background: #0d1b2a;
    color: #fff;
    border-color: #0d1b2a;
}

.project-tlf-programming-pop-anchor {
    position: relative;
    display: inline-flex;
}

.project-tlf-programming-pop {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 30rem;
    max-width: min(30rem, calc(100vw - 2rem));
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.625rem;
    box-shadow: 0 0.75rem 2rem rgba(13, 27, 42, 0.16);
    z-index: 60;
    overflow: hidden;
}

.project-tlf-programming-pop[hidden] {
    display: none;
}

.project-tlf-programming-pop-head {
    padding: 0.75rem 0.875rem 0.625rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.project-tlf-programming-pop-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--nwc-text-primary);
    margin-bottom: 0.1875rem;
}

.project-tlf-programming-pop-body-text {
    font-size: 0.75rem;
    color: var(--nwc-text-secondary);
    line-height: 1.5;
}

.project-tlf-programming-pop-body {
    padding: 0.75rem 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.5625rem;
    max-height: 23.75rem;
    overflow-y: auto;
}

.project-tlf-programming-pop-foot {
    padding: 0.625rem 0.875rem;
    border-top: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--nwc-ui-surface-soft);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.project-tlf-programming-path-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.375rem;
    padding: 0.4375rem 0.625rem;
}

.project-tlf-programming-path-lbl {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--nwc-text-muted);
    flex-shrink: 0;
}

.project-tlf-programming-path-val {
    font-family: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.71875rem;
    color: var(--nwc-text-primary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-tlf-programming-path-copy {
    border: 0.0625rem solid var(--border-input, #c6cfd8);
    background: var(--nwc-ui-surface);
    border-radius: 0.3125rem;
    height: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.6875rem;
    font-family: inherit;
    color: var(--nwc-text-secondary);
    cursor: pointer;
    flex-shrink: 0;
}

.project-tlf-programming-path-copy:hover {
    border-color: var(--nwc-accent);
    color: #14967d;
}

.project-tlf-programming-ws-heading {
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--nwc-text-muted);
    margin-top: 0.125rem;
}

.project-tlf-programming-ws-host {
    display: flex;
    flex-direction: column;
    gap: 0.5625rem;
}

.project-tlf-programming-ws-card {
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    padding: 0.625rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.project-tlf-programming-ws-card:hover {
    border-color: var(--nwc-ui-border);
}

.project-tlf-programming-ws-avatar.wc-ui-avatar {
    --wc-ui-avatar-size: 1.875rem;
    --wc-ui-avatar-font-size: 0.5625rem;
    --wc-ui-avatar-font-weight: 800;
    --wc-ui-avatar-background: var(--nwc-ui-surface-soft);
    --wc-ui-avatar-color: #0f7a65;
    --wc-ui-avatar-border-width: 0.0625rem;
    --wc-ui-avatar-radius: 0.375rem;
    display: flex;
    letter-spacing: 0.02em;
    --wc-ui-avatar-border-color: var(--border-default, #dde3ec);
    user-select: auto;
}

.project-tlf-programming-ws-body {
    flex: 1;
    min-width: 0;
}

.project-tlf-programming-ws-name {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.project-tlf-programming-ws-name-text {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--nwc-text-primary);
    line-height: 1.25;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-tlf-programming-ws-meta {
    font-size: 11px;
    color: var(--nwc-text-muted);
    margin-top: 0.125rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-tlf-programming-ws-state {
    display: inline-flex;
    align-items: center;
    gap: 0.125rem;
    flex-shrink: 0;
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: #0f7a65;
    line-height: 1;
}

.project-tlf-programming-ws-state.is-off {
    color: var(--nwc-text-muted);
}

.project-tlf-programming-ws-state .project-tlf-programming-st-dot {
    width: 4px;
    height: 4px;
    background: var(--nwc-accent);
}

.project-tlf-programming-ws-state.is-off .project-tlf-programming-st-dot {
    background: #c6cfd8;
}

.project-tlf-programming-ws-state-lbl {
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    line-height: inherit;
    text-transform: inherit;
    color: inherit;
}

.project-tlf-programming-ws-action {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.625rem;
    padding: 0 0.5625rem;
    border: 0.0625rem solid var(--border-input, #c6cfd8);
    border-radius: 0.3125rem;
    background: var(--nwc-ui-surface);
    font-family: inherit;
    font-size: 0.6875rem;
    font-weight: 500;
    line-height: 1;
    color: var(--nwc-text-primary);
    cursor: pointer;
    white-space: nowrap;
}

.project-tlf-programming-ws-action:hover {
    border-color: var(--nwc-accent);
    color: #14967d;
}

.project-tlf-programming-ws-action-icon {
    width: 0.625rem;
    height: 0.625rem;
    flex-shrink: 0;
    display: block;
}

.project-tlf-programming-ws-empty {
    padding: 1.125rem 0.875rem;
    text-align: center;
}

.project-tlf-programming-ws-empty-text {
    font-size: 0.78125rem;
    color: var(--nwc-text-secondary);
    line-height: 1.55;
    margin-bottom: 0.625rem;
}

.project-tlf-programming-ws-empty-link {
    font-size: 0.78125rem;
    font-weight: 600;
    color: #14967d;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0;
}

.project-tlf-programming-ws-empty-link:hover {
    color: #0f7a65;
}

.project-tlf-programming-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5625rem;
    padding: 0.5625rem 0.75rem;
    border-radius: 0.4375rem;
    font-size: 0.75rem;
    line-height: 1.5;
}

.project-tlf-programming-notice-warn {
    background: var(--nwc-ui-surface-soft);
    border: 0.0625rem solid var(--nwc-ui-border);
    color: var(--nwc-text-secondary);
}

.project-tlf-programming-check-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    cursor: pointer;
    background: var(--nwc-ui-surface);
    text-align: left;
    font-family: inherit;
    width: 100%;
}

.project-tlf-programming-check-row:hover {
    border-color: var(--nwc-ui-border);
}

.project-tlf-programming-check-row.is-on {
    border-color: #a6e0cf;
    background: var(--nwc-success-subtle);
}

.project-tlf-programming-check-box {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    border: 0.09375rem solid var(--border-input, #c6cfd8);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.0625rem;
    background: var(--nwc-ui-surface);
}

.project-tlf-programming-check-row.is-on .project-tlf-programming-check-box {
    background: var(--nwc-accent);
    border-color: var(--nwc-accent);
    color: #fff;
}

.project-tlf-programming-check-txt {
    font-size: 0.78125rem;
    color: var(--nwc-text-primary);
    line-height: 1.45;
}

.project-tlf-programming-ready-checks {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.project-tlf-programming-editor-code {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--nwc-ui-surface-soft);
}

.project-tlf-programming-editor-code-status {
    flex-shrink: 0;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
    color: var(--nwc-text-secondary);
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--nwc-ui-surface);
}

.project-tlf-programming-editor-code-status.is-error {
    color: #b91c1c;
}

.project-tlf-programming-editor-code-status[hidden] {
    display: none;
}

.project-tlf-programming-editor-code-mount {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--nwc-ui-surface-soft);
}

.project-tlf-programming-code-editor.wc-ui-code-editor {
    border: none;
    border-radius: 0;
    overflow: hidden;
}

.project-tlf-programming-code-editor {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--nwc-ui-surface-soft);
}

.project-tlf-programming-code-editor .wc-ui-code-editor-host {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.project-tlf-programming-code-editor .wc-ui-code-editor-host .ace_editor,
.project-tlf-programming-code-editor .wc-ui-code-editor-host .ace_scroller,
.project-tlf-programming-code-editor .wc-ui-code-editor-host .ace_content {
    background: var(--nwc-ui-surface-soft) !important;
}

.project-tlf-programming-code-editor .wc-ui-code-editor-host .ace_gutter {
    background: var(--nwc-ui-surface-soft) !important;
    color: #d1d5db;
    border-right: none;
}

.project-tlf-programming-run-panel {
    width: 36.96rem;
    flex-shrink: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-tlf-programming-run-panel > nph-tab-panel.project-tlf-programming-run-tabs {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--surface-card, var(--nwc-ui-surface));
    --content-padding: 0;
}

.project-tlf-programming-run-tab-body {
    flex: 1;
    min-height: 0;
    height: 100%;
    background: var(--nwc-ui-surface);
}

.project-tlf-programming-run-history,
.project-tlf-programming-run-logs,
.project-tlf-programming-run-results {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.project-tlf-programming-run-history-grid-shell {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-tlf-run-history-grid {
    width: 100%;
    min-width: 0;
}

.project-tlf-run-history-grid .ag-body-viewport,
.project-tlf-run-history-grid .ag-center-cols-viewport {
    overflow-x: hidden;
}

.project-tlf-run-history-grid .ag-body-horizontal-scroll,
.project-tlf-run-history-grid .ag-horizontal-left-spacer,
.project-tlf-run-history-grid .ag-horizontal-right-spacer {
    display: none;
}

.project-tlf-run-history-grid .ag-header-cell-text,
.project-tlf-run-history-grid .ag-header-cell-label {
    font-size: 0.75rem;
    font-weight: 600;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.project-tlf-run-history-grid .ag-cell {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-tlf-run-history-grid .ag-cell[col-id="id"] {
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-tlf-run-history-grid .ag-header-cell[col-id="duration"],
.project-tlf-run-history-grid .ag-cell[col-id="duration"] {
    padding-inline: 0.25rem;
}

.project-tlf-run-history-grid .ag-cell[col-id="status"],
.project-tlf-run-history-grid .ag-cell[col-id="isFinal"] {
    padding-inline: 0.25rem;
    text-align: center;
}

.project-tlf-run-history-grid .ag-cell[col-id="status"] .wc-ag-col-badge-phi,
.project-tlf-run-history-grid .ag-cell[col-id="isFinal"] .wc-ag-col-badge-phi {
    padding: 0.125rem 0.375rem;
    font-size: 0.6875rem;
    line-height: 1.2;
}

.project-tlf-run-history-grid .ag-row {
    cursor: pointer;
}

.project-tlf-run-history-grid .ag-row:hover .ag-cell {
    background: rgba(0, 137, 123, 0.04);
}

.project-tlf-run-history-grid .ag-row.project-tlf-run-history-row--active {
    box-shadow: inset 0.1875rem 0 0 rgb(0, 137, 123);
}

.project-tlf-run-history-grid .ag-row.project-tlf-run-history-row--active .ag-cell {
    background: rgba(0, 137, 123, 0.06);
}

.project-tlf-programming-run-logs > nph-log-viewer-panel {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-programming-run-results-banner {
    flex-shrink: 0;
    margin: 0.75rem 0.75rem 0;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: rgba(0, 137, 123, 0.08);
    color: rgb(0, 105, 92);
    font-size: 0.75rem;
    font-weight: 600;
}

.project-tlf-programming-run-results-cards {
    flex: 1;
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
}

.project-tlf-programming-run-results-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    text-align: center;
}

.project-tlf-programming-run-results-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 1.5rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    text-align: center;
}

.project-tlf-programming-run-results-spinner {
    display: inline-flex;
    flex-shrink: 0;
    color: rgb(0, 137, 123);
    animation: rotation 0.8s linear infinite;
}

.project-tlf-programming-output-preview-modal {
    --modal-initial-width: min(90vw, 96rem);
    --modal-min-width: min(62rem, 90vw);
}

.project-tlf-programming-output-preview-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: min(75vh, 50rem);
    min-height: 0;
}

.project-tlf-programming-output-preview-viewer {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.project-tlf-programming-output-preview-viewer .wc-ui-xpt-viewer,
.project-tlf-programming-output-preview-viewer .wc-ui-rtf-viewer,
.project-tlf-programming-output-preview-viewer .wc-ui-document-viewer {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-tlf-programming-output-preview-viewer .wc-ui-artifact-viewer {
    display: flex;
    flex-direction: column;
}

.project-tlf-programming-output-preview-viewer .wc-ui-artifact-viewer-shell {
    flex: 1 1 0;
    min-height: 0;
}

.project-tlf-programming-output-preview-viewer .wc-ui-rtf-viewer-grid,
.project-tlf-programming-output-preview-viewer .wc-ui-document-viewer-grid {
    height: auto;
    min-height: 0;
}

.project-tlf-programming-output-preview-state {
    margin: auto;
    max-width: 32rem;
    padding: 2rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    text-align: center;
}

.project-tlf-programming-output-preview-viewer[hidden],
.project-tlf-programming-output-preview-state[hidden] {
    display: none !important;
}

.project-sas2r-output-preview-modal {
    --modal-initial-width: min(90vw, 96rem);
    --modal-min-width: min(62rem, 90vw);
}

.project-sas2r-output-preview-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: min(70vh, 50rem);
    min-height: 30rem;
}

.project-sas2r-output-preview-viewer {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.project-sas2r-output-preview-viewer .wc-ui-xpt-viewer {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.project-sas2r-output-preview-viewer .wc-ui-artifact-viewer {
    display: flex;
    flex-direction: column;
}

.project-sas2r-output-preview-viewer .wc-ui-artifact-viewer-shell {
    flex: 1 1 0;
    min-height: 0;
}

.project-sas2r-output-preview-state {
    margin: auto;
    max-width: 32rem;
    padding: 2rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    text-align: center;
}

.project-sas2r-output-preview-viewer[hidden],
.project-sas2r-output-preview-state[hidden] {
    display: none !important;
}

.project-tlf-programming-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PROJECT DETAILS — PROJECT OVERSIGHT  (projects.overview.oversight)
   Read-only dashboard tiles rendered directly below "Overview" in the rail.
═══════════════════════════════════════════════════════════════════════════ */

.project-oversight-surface {
    --po-primary: #00897B;
    --po-card: var(--nwc-ui-surface);
    --po-border-lt: #F0F2F5;
    --po-success: #43A047;
    --po-warn: #F57C00;
    --po-muted: #90A4AE;
    --po-text: var(--tabs-panel-color, #1f2937);
    --po-text-light: var(--text-gray-color, #64748b);
    --po-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --po-radius-lg: 0.75rem;

    display: block;
    padding: 0.5rem 0 2rem;
    color: var(--po-text);
    font-size: 0.9375rem;
}

.project-oversight-unavailable {
    display: none; /* hidden by default; the --shown modifier reveals it when metrics are hidden */
    color: var(--po-text-light);
    font-style: italic;
    padding: 0.75rem 0;
}

.project-oversight-unavailable.project-oversight-unavailable--shown {
    display: block;
}

.project-oversight-metrics {
    display: grid;
    /* 22rem keeps three cards to a row at a normal content width. At 17.5rem a fourth squeezed in
       and every card became a narrow column, which is what forced the readings to wrap. */
    grid-template-columns: repeat(auto-fit, minmax(22rem, 1fr));
    gap: 1rem;
    align-items: stretch;
}

.project-oversight-metrics.project-oversight-metrics--hidden {
    display: none;
}

/* The cards carry their own chrome from the shared library; only the grid and the
   page's own muted treatment for an unavailable card belong here. */
.project-oversight-metrics .wc-ui-metric-card-unavailable .wc-ui-metric-card-value {
    color: var(--po-text-light);
}

/* The chart action is an icon-only button carrying --nwc-button-icon-only-padding: 0.5rem, so the
   button is flush with the header's end but the glyph inside it sits 0.5rem short of the content
   edge the row readings line up on. Pulling the button out by exactly its own padding puts the
   glyph on that edge without shrinking its hit area. */
.project-oversight-metrics .wc-ui-metric-card-action {
    margin-inline-end: -0.5rem;
}

/* Needs Attention marks each row with an icon, the other cards with a 0.5rem dot or nothing at
   all. The library's icon tile is a bordered 1.5rem box, so those labels started a full 1rem
   further in than their neighbours' and the rows stood taller. Flattening it to a bare glyph
   keeps what the icon says — a warning or a date — at the weight the dots carry. */
.project-oversight-metrics .wc-ui-metric-card-row-icon {
    inline-size: 1rem;
    block-size: 1rem;
    border: 0;
    background: transparent;
}

/* The library stacks the footer's three parts in a grid, so "VALIDATION", the state pill and
   "11 remaining" each took a line. They are one statement about where the deliverable stands,
   so they read as one line — the same flex treatment the hero already uses, wrapping only when
   the card is too narrow to hold them.

   margin-block-start: auto pins the footer to the bottom of the card body (a flex column), so
   the footers line up across the row even when a card carries an extra row — SDTM and ADaM both
   gain a "Failed" row when a run or a P21 check fails. */
.project-oversight-metrics .wc-ui-metric-card-footer {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-block-start: auto;
}

.project-oversight-metric-subtitle-line {
    font-size: 0.9rem;
    color: var(--po-text-light);
    line-height: 1.4;
}

/* ── Milestone Timeline / Recent Changes — full-width cards below the tile row ── */
.project-oversight-section-card {
    margin-top: 1.5rem;
    --wc-ui-card-background: var(--po-card);
    --wc-ui-card-border-color: var(--po-border-lt);
    --wc-ui-card-radius: var(--po-radius-lg);
    --wc-ui-card-shadow: var(--po-shadow-sm);
    --wc-ui-card-overflow: visible;
    --wc-ui-card-header-background: var(--po-card);
    --wc-ui-card-header-divider: none;
    --wc-ui-card-header-padding: 1.625rem 1.75rem 0;
    --wc-ui-card-body-gap: 0;
    --wc-ui-card-title-size: 0.82rem;
    --wc-ui-card-title-color: var(--po-text-light);
    --wc-ui-card-title-weight: 600;
    --wc-ui-card-title-line-height: normal;
    --wc-ui-card-title-letter-spacing: 0.02em;
    --wc-ui-card-title-text-transform: uppercase;
}

.project-oversight-milestone-card {
    --wc-ui-card-body-padding: 0.25rem 1.75rem 1.625rem;
}

.project-oversight-changes-card {
    --wc-ui-card-body-padding: 0.875rem 1.75rem 1.625rem;
}

/* Larger milestone typography is caller-owned through public stepper tokens. */
.project-oversight-section-card .cai-stepper {
    --cai-stepper-circle-size: 2.25rem;
    --nwc-stepper-node-font-size: 0.95rem;
    --nwc-stepper-gap: 0.6rem;
    --nwc-stepper-label-font-size: 0.85rem;
}

/* ── Recent Changes ── */
.project-oversight-changes-list {
    display: flex;
    flex-direction: column;
}

.project-oversight-change-row {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.92rem;
    padding: 0.625rem 0;
}

.project-oversight-change-row:not(:last-child) {
    border-bottom: 0.0625rem solid var(--po-border-lt);
}

.project-oversight-change-row:first-child {
    padding-top: 0;
}

.project-oversight-change-row:last-child {
    padding-bottom: 0;
}

.project-oversight-change-dot {
    width: 0.5625rem;
    height: 0.5625rem;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.45em;
    background: var(--po-primary);
}

.project-oversight-change-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.project-oversight-change-subject {
    font-weight: 700;
    color: var(--po-text);
}

.project-oversight-change-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}

.project-oversight-change-description {
    color: var(--po-text-light);
}

.project-oversight-change-time {
    font-size: 0.9rem;
    color: var(--po-text-light);
    flex-shrink: 0;
}

/* Preview affordance — dims + badges tiles/cards showing static placeholder content (no backend yet)
   so their fixed values are never mistaken for live oversight data. */
.project-oversight-preview {
    opacity: 0.6;
}

.project-oversight-preview-badge {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--po-text-light);
    background: var(--po-border-lt);
    padding: 0.125rem 0.375rem;
    border-radius: 0.75rem;
}


/* =====================================================================
   GOVERNANCE > BLINDING & UNBLINDING (net-new screen, CAI Governance rail)
   ============================================================================ */

.bl-surface {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Section wrapper + locked placeholder shown until the secure access gate is passed */
.bl-section-root {
    height: 100%;
    width: 100%;
}

.bl-folders-host {
    height: 100%;
}

.bl-locked-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.875rem;
    padding: 3rem 1.5rem;
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--line);
    border-radius: 0.5rem;
    text-align: center;
}

.bl-locked-message {
    font-size: 0.9rem;
    color: var(--muted);
    max-width: 24rem;
    line-height: 1.6;
}

/* Info banners (Open Label / Single Blind) — visibility toggled inline via style.display */
.bl-ol-banner,
.bl-sb-banner {
    border-radius: 0.5rem;
    padding: 0.875rem 1.125rem;
    border-left: 0.25rem solid;
    margin-bottom: 0.25rem;
}

.bl-ol-banner {
    background: var(--nwc-info-subtle);
    border-left-color: var(--primary);
}

.bl-sb-banner {
    background: var(--nwc-info-subtle);
    border-left-color: #7b1fa2;
}

.bl-banner-title {
    font-size: 0.875rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.bl-ol-banner .bl-banner-title {
    color: #1565c0;
}

.bl-sb-banner .bl-banner-title {
    color: #6a1b9a;
}

.bl-banner-message {
    font-size: 0.8125rem;
    line-height: 1.6;
}

.bl-ol-banner .bl-banner-message {
    color: #1976d2;
}

.bl-sb-banner .bl-banner-message {
    color: #7b1fa2;
}

/* Blinding Design card */
.bl-surface .wc-ui-section {
    background: var(--nwc-ui-surface);
    border: 0.0625rem solid var(--line);
    border-radius: 0.5rem;
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.bl-surface .wc-ui-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

.bl-surface .wc-ui-field {
    display: flex;
    flex-direction: column;
    align-items: stretch; /* override inherited align-items:center so the tile row fills the card width */
    gap: 0.5rem;
}

.bl-surface .wc-ui-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    align-self: flex-start;
}

/* Blinding type tile selector */
.bl-type-options {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.bl-type-tile {
    flex: 1 1 0;
    min-width: 0;
    cursor: pointer;
    border: 0.09375rem solid var(--line);
    border-radius: 0.5rem;
    padding: 0.875rem 1rem;
    text-align: center;
    transition: border-color 0.12s ease, background 0.12s ease;
}

.bl-type-tile:hover {
    border-color: var(--primary);
}

.bl-type-tile-selected {
    border-color: var(--primary);
    background: var(--nwc-accent-subtle);
}

.bl-type-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.bl-type-desc {
    font-size: 0.75rem;
    color: var(--muted);
}

/* Interim toggle + Blinded/Unblinded role columns */
.bl-blinded-fields {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    border-top: 0.0625rem solid var(--line);
    padding-top: 1.25rem;
    margin-top: 0.25rem;
}

.bl-roles-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    border-top: 0.0625rem solid var(--line);
    padding-top: 1.25rem;
}

/* Interim = No (or non-Double-Blind): Blinded Roles spans the full width */
.bl-roles-row-single {
    grid-template-columns: 1fr;
}

.bl-role-col-label {
    margin-bottom: 0.5rem;
}

.bl-role-col-title {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.bl-role-col-note {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.bl-blinded-col,
.bl-unblinded-col {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* ── Secure Access Gate overlay ─────────────────────────────────────────────
   Appended directly to <body> (see BlindingSectionAdapter#onSelected) rather
   than a nphase-wc ModalDialog, so it needs its own fixed-position/backdrop
   CSS — max 32-bit z-index mirrors .session-lock-screen's defensive value. */
.bl-gate-overlay {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background: rgba(8, 12, 18, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bl-gate-card {
    background: var(--nwc-ui-surface);
    border-radius: 0.75rem;
    width: 26rem;
    max-width: calc(100vw - 2rem);
    box-shadow: 0 1.75rem 4.5rem rgba(0, 0, 0, 0.38);
    overflow: hidden;
}

.bl-gate-header {
    background: #1a237e;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    padding: 1.125rem 1.375rem;
}

.bl-gate-phase-1,
.bl-gate-phase-2 {
    padding: 1.5rem;
}

.bl-gate-role-line {
    font-size: 0.8125rem;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.bl-gate-project-id-line {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text);
    margin: 0.75rem 0 0.5rem;
}

.bl-gate-project-id-input {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

.bl-gate-mfa-hint {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.875rem;
    text-align: center;
}

.bl-gate-otp-input {
    display: block;
    width: 100%;
    text-align: center;
    letter-spacing: 0.5rem;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.bl-gate-status {
    font-size: 0.8125rem;
    color: var(--danger);
    min-height: 1.25rem;
    margin-bottom: 0.75rem;
}

.bl-gate-warning {
    font-size: 0.8125rem;
    color: var(--cai-warn);
    margin-bottom: 0.75rem;
}

.bl-gate-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    gap: 0.75rem;
}

.adam-sap-status,
.adam-core-mapping-status {
    font-family: inherit;
    cursor: pointer;
}

.adam-sap-status:hover,
.adam-core-mapping-status:hover {
    filter: brightness(0.96);
}

/* ── ADaM dataset summary card (Mapping Detail) ────────────────────────────── */
.adam-dataset-summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
    padding: 0.65em 0.85em;
    margin-bottom: 0.75em;
    border: var(--bs-border-width) solid var(--light-gray-border);
    border-radius: var(--bs-border-radius);
    background: var(--nwc-ui-surface);
    flex-shrink: 0;
    max-height: 220px;
    overflow-y: auto;
}

/* Keeps the grid from being squeezed to 0 height by the card above it on short viewports. */
.wc-structured-panel:has(> .adam-dataset-summary-card) > .wc-structured-panel-content {
    min-height: 320px;
}

/* Compact variant of the shared DetailsPanel empty state — these three panels are placeholder-only today. */
.adam-dataset-summary-context-row .wc-ui-details {
    gap: 6px;
}

.adam-dataset-summary-context-row .wc-ui-details-title {
    font-size: 0.8rem;
}

.adam-dataset-summary-context-row .wc-ui-details-body {
    gap: 6px;
}

.adam-dataset-summary-context-row .wc-ui-state {
    gap: 4px;
    padding: 8px 10px;
    border-radius: 10px;
}

.adam-dataset-summary-context-row .wc-ui-state-badge {
    inline-size: 22px;
    block-size: 22px;
    font-size: 0.75rem;
}

.adam-dataset-summary-context-row .wc-ui-state-title {
    font-size: 0.78rem;
}

.adam-dataset-summary-context-row .wc-ui-state-subtitle {
    font-size: 0.7rem;
    line-height: 1.3;
}

.adam-dataset-summary-progress-row {
    display: flex;
    align-items: center;
    gap: 0.75em;
}

.adam-dataset-summary-progress-track {
    --progress-track-height: 8px;
    --progress-radius: var(--nwc-radius-full);
    --progress-track-color: rgba(0, 0, 0, 0.08);
    --progress-fill-color: var(--nwc-accent-active, #10a37f);
    --progress-fill-transition: width var(--nwc-duration-normal, 0.2s) ease;
    flex: 1;
}

.adam-dataset-summary-progress-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--nwc-raw-gray-400, var(--nwc-text-muted));
    min-width: 3em;
    text-align: right;
}

.adam-dataset-status {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
}

.adam-dataset-status--complete {
    background: rgba(16, 163, 127, 0.12);
    color: var(--nwc-accent-active, #10a37f);
}

.adam-dataset-status--in-progress {
    background: rgba(180, 131, 24, 0.12);
    color: #b48318;
}

.adam-dataset-status--not-started {
    background: rgba(0, 0, 0, 0.05);
    color: var(--nwc-raw-gray-400, var(--nwc-text-muted));
}


.adam-production-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
}

.adam-production-status-badge--ready {
    background: rgba(16, 163, 127, 0.12);
    color: var(--nwc-accent-active, #10a37f);
}

.adam-production-status-badge--blocked {
    background: rgba(180, 35, 24, 0.12);
    color: var(--sdtm-error, #b42318);
}

.adam-production-status-badge--generated {
    background: rgba(24, 105, 180, 0.12);
    color: #1869b4;
}

.adam-production-status-badge--review-approved {
    background: rgba(16, 163, 127, 0.18);
    color: var(--nwc-accent-active, #10a37f);
}

.adam-production-status-badge--executed {
    background: rgba(16, 163, 127, 0.18);
    color: var(--nwc-accent-active, #10a37f);
}

.adam-production-status-badge--rejected {
    background: rgba(180, 35, 24, 0.12);
    color: var(--sdtm-error, #b42318);
}

.adam-production-status-badge--validation-failed {
    background: rgba(180, 35, 24, 0.12);
    color: var(--sdtm-error, #b42318);
}

.adam-production-status-badge--unknown {
    background: rgba(0, 0, 0, 0.05);
    color: var(--nwc-raw-gray-400, var(--nwc-text-muted));
}

.adam-production-status-badge--draft {
    background: rgba(0, 0, 0, 0.05);
    color: var(--nwc-raw-gray-400, var(--nwc-text-muted));
}

.adam-production-status-badge--clickable {
    cursor: pointer;
}

.adam-prog-notices {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}

/* The one look of an ADaM stage notice. A banner inherits its font from wherever it is mounted, so the
   font is set here; failure text keeps its line breaks. */
.adam-stage-notice {
    --nwc-inline-font: 0.8125rem/1.25rem var(--nwc-font-primary, system-ui, sans-serif);
    --nwc-inline-padding: 0.5rem 0.75rem;
    --nwc-inline-radius: var(--bs-border-radius, 0.25rem);
    --nwc-inline-overflow-wrap: anywhere;
    white-space: pre-wrap;
}

/* The component's :host display would otherwise win over the hidden attribute. */
.adam-stage-notice[hidden] {
    display: none;
}

/* A closed notice leaves its container empty; the container must not keep its margin or gap. */
.adam-prog-notices:not(:has(> :not([hidden]))),
.adam-compare-dataset-banners:not(:has(> :not([hidden]))) {
    display: none;
}

/* Amber: the program exists and is approved, and the text names a prerequisite the user can
   satisfy — it is not a failure of the displayed version. */
.adam-prog-run-gate-reason {
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid rgba(183, 121, 31, 0.35);
    border-left-width: 0.1875rem;
    border-radius: var(--bs-border-radius, 0.25rem);
    background: rgba(183, 121, 31, 0.06);
    color: #975a16;
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.adam-prog-findings {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    max-height: 9rem;
    overflow-y: auto;
}

.adam-prog-finding {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--bs-border-radius, 0.25rem);
    background: rgba(0, 0, 0, 0.03);
    font-size: 0.8125rem;
    line-height: 1.125rem;
}

.adam-prog-finding-code {
    flex: 0 0 auto;
    font-weight: 600;
    font-size: 0.6875rem;
    letter-spacing: 0.02em;
    color: var(--nwc-raw-gray-600, var(--nwc-text-secondary));
}

.adam-prog-finding-message {
    flex: 1 1 auto;
    min-width: 0;
}

.adam-prog-finding-where {
    flex: 0 0 auto;
    color: var(--nwc-raw-gray-400, var(--nwc-text-muted));
}

.adam-prog-finding--ovl {
    box-shadow: inset 0.1875rem 0 0 #2b6cb0;
}

.adam-prog-artifact-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

.adam-prog-artifact-chips {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.adam-prog-chip {
    display: inline-flex;
    align-items: center;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.05);
    color: var(--nwc-ui-text, var(--nwc-text-primary));
}

.adam-prog-chip--hash {
    font-family: var(--nwc-mono-font, monospace);
    font-weight: 400;
}

.adam-prog-artifact-generated,
.adam-prog-artifact-reviewed {
    font-size: 0.85rem;
    color: var(--nwc-text-muted);
}

/* ── ADaM Dataset List — Blockers dialog table ──────────────────────────
   Same bordered/header-shaded/hover shape as .adam-bp-history-table. */
.adam-blockers-table {
    width: 100%;
    border-collapse: collapse;
}

.adam-blockers-table th {
    padding: 0.5625rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--nwc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--nwc-ui-surface-soft);
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    white-space: nowrap;
}

.adam-blockers-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
    color: var(--nwc-ui-text, var(--nwc-text-primary));
    font-size: 0.95rem;
    vertical-align: middle;
}

.adam-blockers-table tr:last-child td {
    border-bottom: none;
}

.adam-blockers-table tbody tr:hover td {
    background: var(--nwc-ui-surface-soft);
}

.adam-blockers-empty {
    font-size: 0.9rem;
    color: var(--nwc-text-muted);
    font-style: italic;
    padding: 0.5rem 0;
}

.adam-dataset-summary-context-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5em;
}

.adam-prog-host {
    display: grid;
    gap: 0.5em;
    grid-template-columns: 1.5fr 5fr;
    min-height: 100%;
}

.adam-mapping-workspace {
    display: grid;
    grid-template-columns: clamp(9rem, 12vw, 14rem) minmax(0, 5fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: 0.25em;
    row-gap: 0.5em;
    height: 100%;
    min-height: 0;
}

/* An empty summary row would still push the detail panel down by the row gap. */
.adam-mapping-workspace:not(:has(> .adam-mapping-detail-summary-panel > .adam-mapping-detail-summary > :not([hidden]))) {
    row-gap: 0;
}

.adam-mapping-workspace.adam-mapping-workspace-collapsed {
    grid-template-columns: 4.5rem minmax(0, 5fr);
}

.adam-mapping-page {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    gap: 0.75rem;
}

.adam-mapping-overview {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius);
    padding: 0.375rem 1.5rem;
}

.adam-mapping-action-bar > .wc-structured-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
            "title actions"
            "desc actions";
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.2rem;
    flex: 1 1 auto;
    min-width: 0;
    /* The library header reserves padding-bottom for a stacked layout; inside a single-row bar
       that offset lifts the title off the baseline of the controls beside it. */
    padding: 0;
}

/* Back sits left of the page title, as on the SDTM workflow. */
.adam-back-button {
    grid-area: back;
    flex: 0 0 auto;
}

.wc-structured-panel-header:has(> .adam-back-button) {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
            "back title actions"
            "back desc actions";
    column-gap: 0.75rem;
}

@media (max-width: 720px) {
    .wc-structured-panel-header:has(> .adam-back-button) {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
                "back title"
                "desc desc"
                "actions actions";
    }
}

/* Programming mounts Back beside its header rather than inside it; the bar's own gap is narrower. */
.adam-mapping-action-bar > .adam-back-button {
    margin-inline-end: 0.25rem;
}

.adam-initial-load-content > .adam-mapping-workspace {
    flex: 1 1 auto;
    min-height: 0;
}

.app-main-content:has(.adam-mapping-workspace) {
    overflow: hidden;
}

.wc-structured-panel.app-grid-page-surface:has(.adam-mapping-workspace) {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.wc-structured-panel.app-grid-page-surface:has(.adam-mapping-workspace) > .wc-structured-panel-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.wc-structured-panel.app-grid-page-surface:has(.adam-mapping-workspace) .adam-mapping-workspace {
    flex: 1 1 auto;
}

.adam-mapping-detail-summary-panel,
.adam-mapping-dataset-panel,
.adam-mapping-detail-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.adam-mapping-dataset-panel {
    position: relative;
    grid-column: 1;
    grid-row: 1 / 3;
    border: 1px solid var(--nwc-input-border-color);
    border-radius: var(--bs-border-radius);
}

/* The dataset list scrolls inside the available workspace height. */
.adam-mapping-dataset-panel > .adam-dataset-cards {
    overflow-y: auto;
}

.adam-mapping-detail-summary-panel {
    grid-column: 2;
    grid-row: 1;
}

.adam-mapping-detail-panel {
    grid-column: 2;
    grid-row: 2;
}

.adam-mapping-detail-summary .adam-dataset-summary-card {
    margin-bottom: 0;
}

.adam-mapping-dataset-panel,
.adam-mapping-detail-panel {
    height: 100%;
}

/* The collapse control's own row above the dataset cards. */
.adam-mapping-dataset-toggle-host {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    padding: 0.5rem 0.45rem 0;
}

.adam-mapping-dataset-toggle {
    cursor: pointer;
    flex: 0 0 auto;
    color: var(--nwc-navy);
}

.adam-mapping-dataset-toggle-collapsed {
    transform: rotate(180deg);
}

.adam-mapping-dataset-panel > .adam-mapping-dataset-grid {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: 100%;
    border-right: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-card, var(--nwc-ui-surface));
    --content-padding: 0;
    /* Strip the columns stop short of, so the toggle sits after status instead of over it. */
    padding-right: 2.25rem;
}

.adam-mapping-dataset-grid {
    width: 100%;
    min-width: 0;
}

.adam-mapping-dataset-grid .ag-theme-quartz {
    --ag-wrapper-border: 0;
}

.adam-mapping-dataset-grid .ag-body-viewport,
.adam-mapping-dataset-grid .ag-center-cols-viewport {
    overflow-x: hidden;
}

.adam-mapping-dataset-grid .ag-body-horizontal-scroll,
.adam-mapping-dataset-grid .ag-horizontal-left-spacer,
.adam-mapping-dataset-grid .ag-horizontal-right-spacer {
    display: none;
}

.adam-mapping-dataset-grid .ag-header-cell-text,
.adam-mapping-dataset-grid .ag-header-cell-label {
    font-size: 0.75rem;
    font-weight: 600;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

.adam-mapping-dataset-grid .ag-cell {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adam-mapping-dataset-grid .ag-cell[col-id="datasetName"],
.adam-mapping-dataset-grid .ag-cell[col-id="status"] {
    display: flex;
    align-items: center;
}

.adam-mapping-dataset-name-badge {
    display: inline-flex;
    align-items: center;
    min-height: 1.375rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-header,
.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-cell[col-id="status"],
.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-paging-panel {
    display: none;
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-cell[col-id="datasetName"] {
    justify-content: center;
    padding-inline: 0;
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-toggle-host {
    justify-content: center;
    padding-inline: 0;
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-panel > .adam-mapping-dataset-grid {
    height: auto;
    padding-right: 0;
}

.adam-mapping-dataset-grid .ag-cell[col-id="status"] {
    align-items: center;
    display: flex;
    justify-content: center;
    padding-inline: 0.25rem;
}

.adam-mapping-dataset-grid .ag-header-cell[col-id="status"] .ag-header-cell-label {
    justify-content: center;
}

.adam-mapping-dataset-grid .ag-row {
    cursor: pointer;
}

.adam-mapping-dataset-grid .ag-row:hover .ag-cell {
    background: rgba(0, 137, 123, 0.04);
}

.adam-mapping-dataset-grid .ag-row.project-tlf-run-history-row--active {
    box-shadow: inset 0.1875rem 0 0 rgb(0, 137, 123);
}

.adam-mapping-dataset-grid .ag-row.project-tlf-run-history-row--active .ag-cell {
    background: rgba(0, 137, 123, 0.06);
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-row.project-tlf-run-history-row--active {
    background: rgba(0, 137, 123, 0.06);
}

.adam-mapping-workspace-collapsed .adam-mapping-dataset-grid .ag-row.project-tlf-run-history-row--active .ag-cell {
    background: transparent;
}

/* Dataset cards: the list beside Mapping, Programming and the AI program. */
.adam-dataset-cards {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    padding: 0.25rem 0.5rem 0.5rem;
}

.adam-dataset-cards-filter {
    width: 100%;
    min-width: 0;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 0.0625rem solid var(--nwc-input-border-color);
    border-radius: var(--bs-border-radius);
}

.adam-dataset-cards-list {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    min-height: 0;
    overflow-y: auto;
}

.adam-dataset-cards-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    padding: 0.5rem 0.625rem;
    font: inherit;
    font-size: 0.75rem;
    text-align: left;
    color: inherit;
    background: var(--surface-card, var(--nwc-ui-surface));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius);
    cursor: pointer;
}

.adam-dataset-cards-item:hover {
    background: rgba(0, 137, 123, 0.04);
}

.adam-dataset-cards-item[aria-current="true"] {
    border-color: rgb(0, 137, 123);
    box-shadow: inset 0.1875rem 0 0 rgb(0, 137, 123);
    background: rgba(0, 137, 123, 0.06);
}

.adam-dataset-cards-item:focus-visible {
    outline: 0.125rem solid rgb(0, 137, 123);
    outline-offset: 0.0625rem;
}

/* Pre-lock cards stay clickable; the mark only says the mapping is not Locked yet. */
.adam-dataset-cards-item--pre-lock {
    opacity: 0.7;
}

/* The display rules above would otherwise override the hidden attribute. */
.adam-dataset-cards-filter[hidden],
.adam-dataset-cards-item[hidden],
.adam-dataset-cards-chip[hidden] {
    display: none;
}

.adam-dataset-cards-head {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.adam-dataset-cards-name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-dataset-cards-chip {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    padding: 0.0625rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.adam-dataset-cards-line {
    overflow: hidden;
    color: var(--text-secondary, var(--nwc-text-secondary));
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A card without a count keeps the height of its neighbours. */
.adam-dataset-cards-line:empty::before {
    content: "\00a0";
}

.adam-dataset-cards-line--success {
    color: var(--text-success, #027a48);
}

.adam-dataset-cards-line--warn {
    color: var(--text-warning, #b45309);
}

.adam-dataset-cards-line--danger {
    color: var(--text-danger, #b42318);
}

.adam-dataset-cards-warning {
    display: inline-flex;
    flex: 0 0 auto;
}

.adam-dataset-cards-warning:empty {
    display: none;
}

.adam-duty-separation-icon {
    color: var(--nwc-warning, #b45309);
}

/* Shown only in the collapsed strip, where the chip and the line are hidden. */
.adam-dataset-cards-dot {
    display: none;
    flex: 0 0 auto;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--text-secondary, #6b7280);
}

.adam-dataset-cards-dot--success {
    background: var(--text-success, #027a48);
}

.adam-dataset-cards-dot--warn {
    background: var(--text-warning, #b45309);
}

.adam-dataset-cards-dot--danger {
    background: var(--text-danger, #b42318);
}

.adam-mapping-workspace-collapsed .adam-dataset-cards {
    padding-inline: 0.25rem;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-list {
    overflow-x: hidden;
    scrollbar-width: thin;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-filter,
.adam-mapping-workspace-collapsed .adam-dataset-cards-chip,
.adam-mapping-workspace-collapsed .adam-dataset-cards-line {
    display: none;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-item {
    align-items: center;
    padding: 0.375rem 0.125rem;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-head {
    flex-direction: column;
    gap: 0.25rem;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-name {
    font-size: 0.6875rem;
    text-overflow: clip;
}

.adam-mapping-workspace-collapsed .adam-dataset-cards-dot {
    display: inline-block;
}

/* Measures one rem for the narrow-workspace threshold; out of flow, never painted. */
.adam-dataset-cards-rem-probe {
    position: absolute;
    width: 1rem;
    height: 0;
    visibility: hidden;
    pointer-events: none;
}

.adam-mapping-workspace-detail {
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.adam-mapping-detail-summary,
.adam-mapping-action-bar {
    flex: 0 0 auto;
}

.adam-mapping-action-bar {
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-inline: 0.75rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.adam-mapping-action-bar:empty {
    display: none;
}

/* The heading is the stage template's own title slot: the selected dataset or the stage name. */
.adam-mapping-action-bar .wc-structured-panel-desc {
    display: none;
}

/* Header actions leave their stage's subtree here, and with it that stage's [hidden] rule. */
.adam-mapping-action-bar [hidden] {
    display: none !important;
}

.adam-mapping-workspace-detail {
    flex: 1 1 auto;
}

.adam-mapping-workspace-detail > .wc-structured-panel.app-grid-page-surface {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.adam-mapping-workspace-detail > .wc-structured-panel.app-grid-page-surface > .app-grid-page-grid-shell {
    flex: 1 1 auto;
    min-height: 0;
}

.adam-prog-dataset-list {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    border: var(--bs-border-width) solid var(--light-gray-border);
    border-radius: var(--bs-border-radius);
    background: var(--nwc-ui-surface);
    min-height: 0;
    padding: 1em;
    overflow-y: auto;
    overflow-x: hidden;
}

.adam-prog-dataset-main-view {
    border: var(--bs-border-width) solid var(--light-gray-border);
    border-radius: var(--bs-border-radius);
    background: var(--nwc-ui-surface);
    min-height: 0;
    padding: 1em;

    overflow-x: hidden;
}

.adam-prog-editor-mount {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
}

.adam-prog-editor-mount .wc-ui-code-editor-host {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.adam-prog-editor-code {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.adam-ai-program-editor {
    display: flex;
    flex-direction: column;
    min-height: 32rem;
    height: 55vh;
}

.adam-ai-program-history {
    flex: 0 1 24rem;
    min-width: 12rem;
}

/* The finished generation's short facts in the toolbar; a click opens all of them. */
.adam-ai-program-summary {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.25rem 0.5rem;
    border: 0;
    border-radius: 0.25rem;
    background: none;
    color: var(--sdtm-gray-700);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.adam-ai-program-summary:hover {
    background: var(--sdtm-gray-100);
}

.adam-ai-program-summary:focus-visible {
    outline: 0.125rem solid var(--sdtm-blue-600);
    outline-offset: 0.125rem;
}

.adam-ai-program-summary-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-ai-program-summary > :last-child {
    flex: 0 0 auto;
    color: var(--sdtm-gray-500);
}

.adam-ai-program-generate {
    flex: 0 0 auto;
    margin-left: auto;
}

.adam-ai-program-root {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    gap: 0.5rem;
    min-width: 0;
    min-height: 0;
}

.adam-ai-program-failure {
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--sdtm-error-border);
    border-radius: 0.375rem;
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
}

.adam-ai-program-tab-row {
    display: flex;
    flex: 0 0 auto;
    align-items: flex-end;
    gap: 1rem;
    border-bottom: 0.0625rem solid var(--sdtm-gray-200);
}

/* Plain tabs: the views are not ordered steps and gate nothing; progress is the badge colour, selection the
   underline. */
.adam-ai-program-tabs {
    display: flex;
    flex: 1 1 auto;
    gap: 0.25rem;
    min-width: 0;
}

.adam-ai-program-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: -0.0625rem;
    padding: 0.5rem 0.75rem;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--sdtm-gray-700);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.adam-ai-program-tab:hover {
    color: var(--sdtm-gray-900);
    box-shadow: inset 0 -0.125rem 0 var(--sdtm-gray-300);
}

.adam-ai-program-tab.is-selected {
    color: var(--sdtm-blue-600);
    font-weight: 600;
    box-shadow: inset 0 -0.125rem 0 var(--sdtm-blue-600);
}

.adam-ai-program-tab:focus-visible {
    outline: 0.125rem solid var(--sdtm-blue-600);
    outline-offset: -0.125rem;
}

.adam-ai-program-tab-badge {
    padding: 0.0625rem 0.5rem;
    border: 0.0625rem solid var(--sdtm-gray-200);
    border-radius: 999px;
    background: var(--sdtm-gray-50);
    color: var(--sdtm-gray-500);
    font-size: 0.75rem;
    font-weight: 600;
}

.adam-ai-program-tab.is-current .adam-ai-program-tab-badge {
    border-color: var(--sdtm-info-border);
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
}

.adam-ai-program-tab.is-complete .adam-ai-program-tab-badge {
    border-color: var(--sdtm-success-border);
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
}

.adam-ai-program-tab.is-warn .adam-ai-program-tab-badge {
    border-color: var(--sdtm-warn-border);
    background: var(--sdtm-warn-bg);
    color: var(--sdtm-warn);
}

.adam-ai-program-tab.is-failed .adam-ai-program-tab-badge {
    border-color: var(--sdtm-error-border);
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
}

/* Review exposes its code toggle in the workspace tab row. */
.adam-ai-program-tab-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
}

.adam-ai-program-tab-action[hidden] {
    display: none;
}

.adam-ai-program-views {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}

.adam-ai-program-view {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

/* Two classes: the component bundle loads after this file and its .wc-ui-section grid would win a tie. */
.adam-ai-program-view.adam-ai-program-program-view {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.adam-ai-program-draft-view {
    align-content: start;
    padding: 0.75rem;
}

.adam-ai-program-program-view > .adam-ai-program-editor {
    flex: 1 1 auto;
    min-height: 16rem;
    height: auto;
}

.adam-ai-program-generating {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1.25rem 1.5rem 1.75rem;
}

.adam-ai-program-progress-card {
    width: 35rem;
    max-width: 100%;
    flex: 0 0 auto;
    --wc-ui-card-background: var(--surface-card, #fff);
    --wc-ui-card-border-color: var(--sdtm-gray-250, #dde3ec);
    --wc-ui-card-radius: 0.625rem;
    --wc-ui-card-shadow: 0 0.125rem 0.625rem rgba(13, 27, 42, 0.05);
    --wc-ui-card-body-gap: 0;
}

.adam-ai-program-phases {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    padding: 1.25rem 1.25rem 1.375rem;
    list-style: none;
}

.adam-ai-program-phase {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4375rem;
    min-width: 0;
    text-align: center;
    font-size: 0.71875rem;
    line-height: 1.35;
    color: var(--sdtm-gray-500);
}

.adam-ai-program-phase:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 0.8125rem;
    left: calc(50% + 1.25rem);
    right: calc(-50% + 1.25rem);
    height: 0.09375rem;
    background: var(--border-default, #dde3ec);
}

.adam-ai-program-phase.is-complete::after {
    background: #b0e4d8;
}

.adam-ai-program-phase-marker {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 1.625rem;
    height: 1.625rem;
    box-sizing: border-box;
    border: 0.09375rem solid var(--border-default, #dde3ec);
    border-radius: 50%;
    font-size: 0.65625rem;
    font-weight: 700;
}

.adam-ai-program-phase.is-complete .adam-ai-program-phase-marker {
    background: var(--nwc-accent);
    border-color: var(--nwc-accent);
    color: #fff;
}

.adam-ai-program-phase.is-complete .adam-ai-program-phase-name {
    color: var(--sdtm-gray-700);
}

.adam-ai-program-phase-name {
    padding: 0 0.25rem;
}

.adam-ai-program-phase.is-current .adam-ai-program-phase-name {
    font-weight: 600;
    color: #117a65;
}

.adam-ai-program-phase.is-current .adam-ai-program-phase-marker {
    border-color: var(--nwc-accent);
    color: #14967d;
    box-shadow: 0 0 0 0.25rem #d1f0e8;
}

.adam-ai-program-progress-meter {
    position: relative;
    height: 0.25rem;
    margin: 0 1.75rem 1.25rem;
    border-radius: 6rem;
    background: var(--sdtm-gray-100, var(--nwc-ui-surface-soft));
    overflow: hidden;
}

.adam-ai-program-progress-meter::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 34%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b0e4d8, var(--nwc-accent), #b0e4d8);
    animation: adam-ai-program-progress-meter 1.7s linear infinite;
}

.adam-ai-program-generating-elapsed {
    font-size: 0.8125rem;
    color: var(--sdtm-gray-700);
}

.adam-ai-program-generating-elapsed {
    display: block;
    padding: 0.75rem 1.75rem;
    text-align: center;
    background: var(--sdtm-gray-50, var(--nwc-ui-surface-soft));
    border-top: 0.0625rem solid var(--border-default, #dde3ec);
}

@keyframes adam-ai-program-progress-meter {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(300%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .adam-ai-program-progress-meter::after {
        animation: none;
        left: 33%;
    }
}

/* The dialog mounts outside .adam-ai-program, so the --sdtm-* tokens are not defined there. */
.adam-ai-program-facts-modal {
    --modal-initial-width: min(90vw, 46rem);
    --modal-min-width: min(36rem, 90vw);
}

.adam-ai-program-facts-dialog {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.adam-ai-program-facts-metrics.wc-ui-metric-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.adam-ai-program-facts-metrics .wc-ui-metric-item {
    min-inline-size: 0;
}

.adam-ai-program-facts-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.adam-ai-program-facts-section-title {
    margin: 0;
    color: var(--nwc-ui-text-muted, var(--nwc-text-secondary));
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.adam-ai-program-facts-domains {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.adam-ai-program-facts-domain {
    padding: 0.1875rem 0.625rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 999px;
    background: var(--nwc-ui-surface-muted, var(--nwc-ui-surface-soft));
    color: var(--nwc-ui-text, #111827);
    font-family: var(--font-mono, monospace);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Model run: label over value, one row, quieter than the metric tiles. */
.adam-ai-program-facts-run {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
    gap: 0.75rem;
    margin: 0;
    padding: 0.75rem 1rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.75rem;
}

.adam-ai-program-facts-run-item {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
    min-width: 0;
}

.adam-ai-program-facts-run dt {
    color: var(--nwc-ui-text-muted, var(--nwc-text-secondary));
    font-size: 0.75rem;
}

.adam-ai-program-facts-run dd {
    overflow: hidden;
    margin: 0;
    color: var(--nwc-ui-text, #111827);
    font-size: 0.875rem;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* No program yet: what generation does and where to start it. */
.adam-ai-program-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: 36rem;
    margin: 2rem auto;
    padding: 1.5rem 2rem;
    border: 0.0625rem solid var(--sdtm-gray-200);
    border-radius: var(--sdtm-radius-lg);
    background: var(--sdtm-white);
    box-shadow: var(--sdtm-shadow-sm);
    text-align: center;
}

.adam-ai-program-hero-icon {
    display: inline-flex;
    color: var(--sdtm-info);
}

.adam-ai-program-hero-title {
    color: var(--sdtm-gray-900);
    font-size: 1.0625rem;
    font-weight: 600;
}

.adam-ai-program-hero-steps {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    margin: 0;
    padding-left: 1.25rem;
    color: var(--sdtm-gray-700);
    text-align: left;
}

.adam-ai-program-hero-hint {
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
}

/* The hint invites to generate; before the lock, generation is not available yet. */
.adam-ai-program-lock-pending .adam-ai-program-hero-hint {
    display: none;
}

.adam-ai-program-editor-unsaved {
    color: var(--nwc-ui-text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    white-space: nowrap;
}

/* Review: the pane takes the workspace height and only its columns scroll. */
.adam-ai-program-review {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
    container-type: inline-size;
}

/* ≥ 88rem: rail | cards | code, code open unless closed by the toggle. */
.adam-ai-program-review-grid {
    display: grid;
    grid-template-columns: 15rem minmax(26rem, 1fr) minmax(26rem, 1.2fr);
    grid-template-rows: minmax(0, 1fr);
    /* The same gap as between the dataset list and the detail panel. */
    gap: 0.25em;
    flex: 1 1 auto;
    min-height: 0;
}

.adam-ai-program-review-grid > .wc-ui-section {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

/* The library section is a grid with an auto column: without this a long rail row widens the whole rail. */
.adam-ai-program-review-grid > .wc-ui-section > * {
    min-width: 0;
}

.adam-ai-program-review-grid.is-code-closed {
    grid-template-columns: 15rem minmax(0, 1fr) 3rem;
}

.adam-ai-program-review-grid.has-no-code {
    grid-template-columns: 15rem minmax(0, 1fr);
}

.adam-ai-program-review-grid.is-code-closed .adam-ai-program-code-header .project-tlf-programming-editor-toolbar-actions,
.adam-ai-program-review-grid.is-code-closed > .adam-ai-program-code > .adam-ai-program-editor,
.adam-ai-program-review-grid.has-no-code > .adam-ai-program-code,
.adam-ai-program-picker {
    display: none;
}

/* 56–88rem: rail | cards, code closed by default; open code swaps the rail for the picker. */
@container (width < 88rem) {
    .adam-ai-program-review-grid,
    .adam-ai-program-review-grid.is-code-closed {
        grid-template-columns: 13rem minmax(0, 1fr) 3rem;
    }

    .adam-ai-program-review-grid.has-no-code {
        grid-template-columns: 13rem minmax(0, 1fr);
    }

    .adam-ai-program-review-grid:not(.is-code-open) .adam-ai-program-code-header .project-tlf-programming-editor-toolbar-actions,
    .adam-ai-program-review-grid:not(.is-code-open) > .adam-ai-program-code > .adam-ai-program-editor {
        display: none;
    }

    .adam-ai-program-review-grid:not(.is-code-open) > .adam-ai-program-code {
        padding-inline: 0;
        align-items: center;
    }

    .adam-ai-program-review-grid:not(.is-code-open) .adam-ai-program-code-toggle {
        transform: none;
    }

    .adam-ai-program-review-grid.is-code-open:not(.has-no-code) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    }

    .adam-ai-program-review-grid.is-code-open:not(.has-no-code) > .adam-ai-program-rail-section {
        display: none;
    }

    .adam-ai-program-review-grid.is-code-open:not(.has-no-code) .adam-ai-program-picker {
        display: block;
    }
}

/* < 56rem: picker above full-width cards; open code replaces the cards. */
@container (width < 56rem) {
    .adam-ai-program-review-grid,
    .adam-ai-program-review-grid.is-code-closed {
        grid-template-columns: minmax(0, 1fr) 3rem;
    }

    .adam-ai-program-review-grid.has-no-code,
    .adam-ai-program-review-grid.is-code-open:not(.has-no-code) {
        grid-template-columns: minmax(0, 1fr);
    }

    .adam-ai-program-review-grid > .adam-ai-program-rail-section {
        display: none;
    }

    .adam-ai-program-review-grid .adam-ai-program-picker {
        display: block;
    }

    .adam-ai-program-review-grid.is-code-open:not(.has-no-code) > .adam-ai-program-choices-section {
        display: none;
    }
}

.adam-ai-program-review-grid > .adam-ai-program-code {
    overflow: hidden;
}

/* Min height: Save and Discard appear only while editing and must not shift the code below them. */
.adam-ai-program-code-header {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    min-height: 2.5rem;
}

.adam-ai-program-code-header .project-tlf-programming-editor-toolbar-actions[hidden] {
    display: none;
}

.adam-ai-program-code-toggle {
    transform: rotate(180deg);
}

.adam-ai-program-review-grid.is-code-closed > .adam-ai-program-code {
    padding-inline: 0;
    align-items: center;
}

.adam-ai-program-review-grid.is-code-closed .adam-ai-program-code-toggle {
    transform: none;
}

.adam-ai-program-code > .adam-ai-program-editor {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.adam-ai-program-picker {
    flex: none;
}

.adam-ai-program-cursor {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
}

.adam-ai-program-cursor-variable {
    font-family: var(--font-mono, monospace);
}

.adam-ai-program-rail {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.adam-ai-program-rail-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    width: 100%;
    min-height: 1.75rem;
    padding: 0.125rem 0.5rem;
    border: 0.0625rem solid transparent;
    border-left: 0.1875rem solid transparent;
    border-radius: 0.375rem;
    background: none;
    color: var(--sdtm-gray-700);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.adam-ai-program-rail-row:hover {
    background: var(--sdtm-gray-50);
}

.adam-ai-program-rail-row.is-selected {
    border-color: var(--sdtm-blue-100);
    border-left-color: var(--sdtm-blue-600);
    background: var(--sdtm-blue-50);
}

.adam-ai-program-rail-all {
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
    padding-block: 0.25rem;
    border-bottom-color: var(--sdtm-gray-200);
}

.adam-ai-program-rail-line {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
}

.adam-ai-program-rail-name {
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    font-family: var(--sdtm-mono);
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-ai-program-rail-all .adam-ai-program-rail-name,
.adam-ai-program-rail-dataset-wide .adam-ai-program-rail-name {
    font-family: inherit;
}

.adam-ai-program-rail-filter {
    flex: none;
}

.adam-ai-program-rail-filter[hidden] {
    display: none;
}

.adam-ai-program-rail-group > summary {
    padding: 0.25rem 0.5rem;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    cursor: pointer;
}

.adam-ai-program-rail-progress-value {
    margin-left: auto;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
}

.adam-ai-program-rail-progress {
    height: 0.25rem;
    border-radius: 999px;
    background: var(--sdtm-gray-200);
    overflow: hidden;
}

.adam-ai-program-rail-progress-fill {
    height: 100%;
    background: var(--sdtm-success);
}

.adam-ai-program-rail-state {
    flex: none;
    width: 1rem;
    text-align: center;
}

.adam-ai-program-rail-state--open::before {
    content: "●";
    color: var(--sdtm-warn);
}

.adam-ai-program-rail-state--reviewed::before {
    content: "✓";
    color: var(--sdtm-success);
}

.adam-ai-program-rail-state--none::before {
    content: "–";
    color: var(--sdtm-gray-400);
}

.adam-ai-program-badge {
    flex: none;
    padding: 0 0.375rem;
    border: 0.0625rem solid;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.adam-ai-program-badge--warn {
    border-color: var(--sdtm-warn-border);
    background: var(--sdtm-warn-bg);
    color: var(--sdtm-warn);
}

.adam-ai-program-badge--info {
    border-color: var(--sdtm-info-border);
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
}

.adam-ai-program-tag {
    padding: 0 0.375rem;
    border-radius: 0.25rem;
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    font-size: 0.75rem;
}

.adam-ai-program-pane {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.adam-ai-program-choice-filters {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.adam-ai-program-pane-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
    min-width: 0;
}

.adam-ai-program-status-filter {
    flex: 0 1 16rem;
    width: 16rem;
    max-width: 100%;
    min-width: 0;
}

.adam-ai-program-all-reviewed {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--sdtm-success-border);
    border-radius: 0.375rem;
    background: var(--sdtm-success-bg);
    color: var(--sdtm-success);
}

.adam-ai-program-pane-header {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.adam-ai-program-pane-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--sdtm-gray-900);
    font-size: 1rem;
    font-weight: 600;
}

.adam-ai-program-pane-spec {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    background: var(--sdtm-gray-50);
    color: var(--sdtm-gray-700);
}

.adam-ai-program-pane-spec-label {
    flex: none;
    color: var(--sdtm-gray-500);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.adam-ai-program-pane-data {
    font-variant-numeric: tabular-nums;
}

.adam-ai-program-choice-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.adam-ai-program-choice {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 0.0625rem solid var(--sdtm-gray-200);
    border-radius: 0.375rem;
    background: var(--sdtm-white);
}

.adam-ai-program-choice:hover,
.adam-ai-program-choice.is-active {
    border-color: var(--sdtm-blue-600);
    box-shadow: 0 0 0 0.0625rem var(--sdtm-blue-600);
}

.adam-ai-program-sub-choice {
    margin-left: 1.5rem;
    border-left: 0.1875rem solid var(--sdtm-gray-200);
}

.adam-ai-program-choice--reviewed {
    padding: 0.375rem 0.75rem;
}

.adam-ai-program-choice--complete {
    background: rgba(0, 137, 123, 0.06);
}

.adam-ai-program-choice--ready {
    background: rgba(124, 58, 237, 0.08);
}

.adam-ai-program-choice--attention {
    background: var(--sdtm-warn-bg);
}

.adam-ai-program-decision-status {
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    font-weight: 600;
}

.adam-ai-program-decision-status--complete {
    background: rgba(0, 137, 123, 0.12);
    color: var(--sdtm-success);
}

.adam-ai-program-decision-status--attention {
    background: var(--sdtm-warn-border);
    color: var(--sdtm-warn);
}

.adam-ai-program-choice-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.adam-ai-program-choice-kind {
    flex: none;
    padding: 0 0.5rem;
    border: 0.0625rem solid;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.adam-ai-program-choice-kind--warn {
    border-color: var(--sdtm-warn-border);
    background: var(--sdtm-warn-bg);
    color: var(--sdtm-warn);
}

.adam-ai-program-choice-kind--info {
    border-color: var(--sdtm-info-border);
    background: var(--sdtm-info-bg);
    color: var(--sdtm-info);
}

.adam-ai-program-choice-kind--other {
    border-color: var(--sdtm-gray-300);
    background: var(--sdtm-gray-100);
    color: var(--sdtm-gray-500);
}

.adam-ai-program-choice-stamp {
    flex: none;
    color: var(--sdtm-success);
    font-size: 0.8125rem;
}

.adam-ai-program-choice-summary {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    color: var(--sdtm-gray-500);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-ai-program-choice-assumption {
    color: var(--sdtm-gray-900);
}

.adam-ai-program-choice-label {
    margin-right: 0.5rem;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    font-weight: 600;
}

.adam-ai-program-alternatives {
    color: var(--sdtm-gray-700);
    font-size: 0.875rem;
}

.adam-ai-program-alternative + .adam-ai-program-alternative::before {
    content: " · ";
    color: var(--sdtm-gray-400);
}

.adam-ai-program-choice-header > .adam-ai-program-prepare-assumption {
    display: inline-flex;
    flex: 0 0 auto;
    margin-inline-start: auto;
}

.adam-ai-program-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.adam-ai-program-list-caption {
    color: var(--sdtm-gray-500);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.adam-ai-program-disclosure > summary {
    color: var(--sdtm-blue-600);
    cursor: pointer;
}

.adam-ai-program-disclosure > :not(summary) {
    display: block;
    margin-top: 0.375rem;
    padding-left: 1rem;
    color: var(--sdtm-gray-700);
}

.adam-ai-program-verdict-bar {
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 0.0625rem solid var(--sdtm-gray-200);
}

.adam-ai-program-summary[hidden],
.adam-ai-program-failure[hidden],
.adam-ai-program-tab-row[hidden],
.adam-ai-program-tab-badge[hidden],
.adam-ai-program-views[hidden],
.adam-ai-program-view[hidden],
.adam-ai-program-generating[hidden],
.adam-ai-program-review-grid[hidden],
.adam-ai-program-editor[hidden],
.adam-ai-program-code-toggle[hidden],
.adam-ai-program-cursor[hidden],
.adam-ai-program-findings[hidden],
.adam-ai-program-program-empty[hidden],
.adam-ai-program-draft-message[hidden],
.adam-ai-program-population[hidden] {
    display: none;
}

.adam-ai-program-editor .wc-ui-code-editor-host {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.adam-ai-program-findings {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--sdtm-error-border);
    border-radius: 0.375rem;
    background: var(--sdtm-error-bg);
    color: var(--sdtm-error);
}

.adam-ai-program-findings-title {
    font-weight: 600;
}

.adam-ai-program-finding {
    display: flex;
    gap: 0.5rem;
}

.adam-ai-program-finding-code {
    font-family: var(--font-mono, monospace);
    font-weight: 600;
}

.adam-ai-program-population {
    margin-top: 0.75rem;
    overflow-x: auto;
}

.adam-ai-program-population-table {
    width: 100%;
    border-collapse: collapse;
}

.adam-ai-program-population-table th,
.adam-ai-program-population-table td {
    padding: 0.25rem 0.5rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    text-align: left;
    white-space: nowrap;
}

/* The editor and the run panel are separate cards, like the AI Prototype review sections. */
.adam-prog-host.project-tlf-programming-editor {
    display: flex;
    /* The same gap as between the dataset list and the detail panel. */
    gap: 0.25em;
    height: 100%;
    min-height: 0;
    background: transparent;
}

.adam-prog-host > .project-tlf-programming-editor-col,
.adam-prog-host > .adam-prog-run-panel {
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    overflow: hidden;
}

/* Inside the card only the line under the toolbar remains. */
.adam-prog-host .project-tlf-programming-editor-col .wc-ui-code-editor {
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
}

/* The run grid fills its card edge to edge; its own rounded frame would sit inside the card's. */
.adam-prog-run-panel .ag-root-wrapper {
    border: 0 !important;
    border-radius: 0 !important;
}

.adam-prog-host.project-tlf-programming-editor > .adam-prog-dataset-main-view {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    border-radius: 0;
}

.adam-prog-host--workspace > .adam-prog-dataset-main-view > .wc-structured-panel-header {
    display: none;
}

.adam-prog-run-panel {
    position: relative;
    width: 30rem;
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-left: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.adam-prog-run-panel[hidden] {
    display: none;
}

.adam-prog-run-panel-tools {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    z-index: 2;
    display: flex;
    align-items: center;
}

/* The sidebar icon points left; turned around it reads as "collapse to the right". */
.adam-prog-run-panel-toggle {
    transform: rotate(180deg);
}

.adam-prog-run-panel-restore,
.adam-prog-run-panel--max .adam-prog-run-panel-maximize,
.adam-prog-run-panel--max .adam-prog-run-panel-toggle {
    display: none;
}

.adam-prog-run-panel--max .adam-prog-run-panel-restore {
    display: inline-flex;
}

.adam-prog-host--run-panel-max > .project-tlf-programming-editor-col {
    display: none;
}

.adam-prog-run-panel.adam-prog-run-panel--max {
    flex: 1 1 auto;
    width: auto;
}

.adam-prog-run-panel.adam-prog-run-panel--collapsed {
    width: 3rem;
}

.adam-prog-run-panel > .adam-ai-program-draft-message {
    flex: none;
    padding: 2.5rem 0.75rem 0.5rem;
}

.adam-prog-run-panel--collapsed > .adam-ai-program-draft-message,
.adam-prog-run-panel--collapsed > .adam-run-panel-views,
.adam-prog-run-panel--collapsed > .adam-prog-run-panel-tools {
    display: none;
}

.adam-run-strip {
    display: none;
}

.adam-prog-run-panel--collapsed > .adam-run-strip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.adam-run-strip:hover {
    background: var(--surface-hover, var(--nwc-ui-surface-soft));
}

.adam-run-strip-chevron {
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.adam-run-panel-views,
.adam-run-detail,
.adam-run-list {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.adam-run-detail[hidden],
.adam-run-list[hidden],
.adam-run-panel-views > .wc-ag-no-data[hidden] {
    display: none;
}

.adam-run-panel-views > .wc-ag-no-data {
    flex: 1;
    justify-content: center;
}

/* Leaves room for the collapse toggle pinned to the panel's top-right corner. */
.adam-run-panel-top,
.adam-run-list-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 5.5rem 0 0.75rem;
    flex: none;
}

/* Ghost button padding would indent the link past the run header below it. */
.adam-run-panel-top > nph-button {
    --button-padding: 0.25rem 0.375rem;
    margin-left: -0.375rem;
}

.adam-run-list-title {
    font-weight: 600;
}

.adam-run-stale {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0.5rem 0.75rem 0;
    padding: 0.375rem 0.625rem;
    border: 0.0625rem solid var(--border-warning, #efd9a8);
    border-radius: 0.375rem;
    background: var(--surface-warning, #fbf0dc);
    font-size: 0.8125rem;
    flex: none;
}

.adam-run-notice {
    margin: 0.5rem 0.75rem 0;
    padding: 0.375rem 0.625rem;
    border: 0.0625rem solid var(--border-warning, #efd9a8);
    border-radius: 0.375rem;
    background: var(--surface-warning, #fbf0dc);
    font-size: 0.8125rem;
    flex: none;
}

.adam-run-stale[hidden],
.adam-run-notice[hidden] {
    display: none;
}

.adam-run-head {
    padding: 0.5rem 0.75rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    flex: none;
}

.adam-run-head-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.adam-run-name {
    font-family: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.adam-run-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: auto;
}

.adam-run-actions[hidden] {
    display: none;
}

.adam-run-meta-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.adam-run-meta {
    min-width: 0;
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.75rem;
}

.adam-run-detail > nph-tab-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    --content-padding: 0;
}

.adam-prog-run-tab-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.adam-prog-dataset-ovl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex: none;
}

.adam-run-detail .adam-prog-dataset-ovl-header {
    padding: 0.625rem 0.75rem;
}

.adam-prog-dataset-ovl-header > .wc-ui-filter-chip-group {
    flex-wrap: wrap;
    min-width: 0;
}

.adam-run-ovl-pill {
    font-family: inherit;
    cursor: pointer;
}

.adam-run-ovl-pill:hover {
    filter: brightness(0.96);
}

.adam-run-ovl-pill:focus-visible {
    outline: 2px solid var(--nwc-accent-active);
    outline-offset: 1px;
}

.adam-prog-dataset-ovl-summary {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-prog-dataset-ovl-summary[data-tone="ok"] {
    color: var(--nwc-accent-active);
}

.adam-prog-dataset-ovl-summary[data-tone="warn"] {
    color: #92580A;
}

.adam-prog-dataset-ovl-summary[data-tone="error"] {
    color: #991b1b;
}

.adam-run-detail .adam-prog-run-tab-body > [hidden] {
    display: none;
}

.adam-run-list-grid {
    --ag-cell-horizontal-padding: 0.5rem;
    flex: 1;
    min-height: 0;
    width: 100%;
}

.adam-run-list-grid .ag-body-viewport,
.adam-run-list-grid .ag-center-cols-viewport {
    overflow-x: hidden;
}

.adam-run-list-grid .ag-body-horizontal-scroll,
.adam-run-list-grid .ag-horizontal-left-spacer,
.adam-run-list-grid .ag-horizontal-right-spacer {
    display: none;
}

.adam-run-list-grid .ag-header-cell-text,
.adam-run-list-grid .ag-header-cell-label {
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.adam-run-list-grid .ag-cell {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.adam-run-list-grid .ag-row {
    cursor: pointer;
}

.adam-run-list-grid .ag-row:hover .ag-cell {
    background: rgba(0, 137, 123, 0.04);
}

.adam-run-list-grid .adam-run-list-row--selected .ag-cell {
    background: rgba(0, 137, 123, 0.08);
}

.adam-run-list-run {
    display: flex;
    flex-direction: column;
    padding-block: 0.25rem;
}

/* `.ag-theme-quartz *` resets every descendant to 1rem and the bundle's `*` to line-height 1.7, so the two-line cell overflows the row. */
.adam-run-list-grid .adam-run-list-run > *,
.adam-run-list-grid .ag-cell-value > span:not(.wc-ag-col-status) {
    font-size: 0.75rem;
    line-height: 1.3;
}

.adam-run-list-grid .adam-run-list-run > .adam-run-name {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* The name gives way, never the final star after it. */
.adam-run-list-grid .adam-run-list-run > .adam-run-list-name {
    display: flex;
    min-width: 0;
}

.adam-run-list-grid .adam-run-list-name > * {
    font: inherit;
    line-height: inherit;
}

.adam-run-list-name-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-run-list-name > .adam-run-final-star {
    flex: none;
}

.adam-run-list-when {
    color: var(--text-muted, var(--nwc-text-secondary));
}

/* Over the program, start time and duration have their own columns. */
.adam-prog-run-panel--max .adam-run-list-when {
    display: none;
}

.adam-prog-run-panel--max .adam-run-list-run {
    justify-content: center;
    height: 100%;
}

.adam-run-list-result {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    height: 100%;
}

.adam-run-list-result > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.adam-run-list-result > .adam-programming-action-menu {
    flex-shrink: 0;
    margin-left: auto;
}

.adam-run-stages {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin-top: 0.375rem;
    font-size: 0.75rem;
}

.adam-run-stages[hidden],
.adam-run-progress[hidden],
.adam-run-progress > [hidden] {
    display: none;
}

.adam-run-stage {
    display: inline-flex;
    align-items: center;
    gap: 0.3125rem;
    padding: 0.1875rem 0.5rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 999px;
    color: var(--text-muted, var(--nwc-text-secondary));
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.adam-run-stage--done {
    border-color: transparent;
    background: rgba(16, 163, 127, 0.10);
    color: var(--nwc-accent-active);
}

.adam-run-stage--current {
    border-color: transparent;
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
    font-weight: 600;
}

.adam-run-stage-arrow {
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.6875rem;
}

.adam-run-stage-spin {
    width: 0.625rem;
    height: 0.625rem;
    border: 0.125rem solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    display: inline-block;
    animation: sdtm-spin 0.8s linear infinite;
}

.adam-run-log--progress > .project-tlf-programming-run-logs {
    display: none;
}

.adam-run-failure {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 0.625rem 0.75rem 0;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: var(--nwc-danger-subtle);
    font-size: 0.8125rem;
    flex: none;
}

.adam-run-failure-message {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.adam-run-failure-cause {
    color: var(--nwc-danger);
    font-size: 0.75rem;
    word-break: break-word;
}

.adam-run-failure[hidden],
.adam-run-failure-cause[hidden],
.adam-run-log--progress > .adam-run-failure {
    display: none;
}

.adam-run-progress {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted, var(--nwc-text-secondary));
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}

.adam-run-progress-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-default, var(--nwc-text-primary));
}

.adam-run-progress-bar {
    position: relative;
    width: 13.75rem;
    max-width: 100%;
    height: 0.25rem;
    border-radius: 0.125rem;
    background: rgba(37, 99, 235, 0.12);
    overflow: hidden;
}

.adam-run-progress-bar > span {
    position: absolute;
    inset: 0 auto 0 0;
    width: 35%;
    border-radius: 0.125rem;
    background: #2563eb;
    animation: adam-run-progress-slide 1.4s ease-in-out infinite;
}

@keyframes adam-run-progress-slide {
    from {
        left: -35%;
    }
    to {
        left: 100%;
    }
}

.adam-run-progress-slow {
    color: #b45309;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .adam-run-stage-spin,
    .adam-run-progress-bar > span {
        animation: none;
    }
}

.adam-run-final-star {
    margin-left: 0.25rem;
    color: var(--warning-text, #a86c12);
}

.wc-ag-no-data {
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem;
    text-align: center;
}

.wc-ag-no-data-icon {
    width: 3rem;
    height: 3rem;
    opacity: 0.6;
}

.wc-ag-no-data-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-default, var(--nwc-text-primary));
}

.wc-ag-no-data-desc {
    font-size: 0.75rem;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.adam-mapping-program-mode .adam-mapping-detail-summary-panel {
    display: none;
}

.adam-mapping-program-mode .adam-mapping-detail-panel {
    grid-column: 2;
    grid-row: 1 / 3;
}

.adam-mapping-program-mode .adam-mapping-workspace-detail {
    overflow: hidden;
}

.adam-mapping-program-mode .adam-mapping-workspace-detail > .adam-programming-workspace-template {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.adam-mapping-program-mode .adam-mapping-workspace-detail > .adam-programming-workspace-template > .wc-structured-panel-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.adam-mapping-program-mode .adam-mapping-action-bar {
    justify-content: flex-end;
}

/* AI Program: no summary row; the stage owns its own scroll regions, so the detail host does not scroll. */
.adam-mapping-ai-program-mode .adam-mapping-detail-summary-panel {
    display: none;
}

.adam-mapping-ai-program-mode .adam-mapping-detail-panel {
    grid-column: 2;
    grid-row: 1 / 3;
}

.adam-mapping-ai-program-mode .adam-mapping-workspace-detail {
    overflow: hidden;
}

.adam-mapping-ai-program-mode .adam-mapping-workspace-detail > .adam-ai-program {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.adam-mapping-ai-program-mode .adam-mapping-workspace-detail > .adam-ai-program > .wc-structured-panel-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

/* Compare: same grid as AI Program, but the dataset page is one long column scrolled by the detail host. */
.adam-mapping-compare-mode .adam-mapping-detail-summary-panel {
    display: none;
}

.adam-mapping-compare-mode .adam-mapping-detail-panel {
    grid-column: 2;
    grid-row: 1 / 3;
}

.adam-mapping-compare-mode .adam-mapping-workspace-detail {
    overflow: auto;
}

/* ── ADaM / post-programming stages ───────────────────────────────────── */
.adam-mapping-readiness-mode .adam-mapping-detail-summary-panel,
.adam-mapping-full-width-stage-mode .adam-mapping-detail-summary-panel {
    display: none;
}

.adam-mapping-readiness-mode .adam-mapping-dataset-panel,
.adam-mapping-full-width-stage-mode .adam-mapping-dataset-panel {
    display: none;
}

.adam-mapping-readiness-mode .adam-mapping-workspace,
.adam-mapping-full-width-stage-mode .adam-mapping-workspace {
    grid-template-columns: minmax(0, 1fr);
}

.adam-mapping-readiness-mode .adam-mapping-detail-panel,
.adam-mapping-full-width-stage-mode .adam-mapping-detail-panel {
    grid-column: 1;
    grid-row: 1 / 3;
}

/* Shared P21 report layout; controls and visual tokens belong to the application/WC library. */
.p21-validation-template,
.p21-validation-template > .wc-structured-panel-content {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.p21-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
    padding: .25rem;
}

.p21-empty-state {
    flex: 1 1 auto;
    min-height: 0;
}

.p21-provenance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-default);
    border-radius: var(--bs-border-radius);
    background: var(--surface-card);
}

.p21-detail {
    min-width: 0;
}

.p21-detail-label, .p21-hint {
    color: var(--text-secondary);
}

.p21-detail-label {
    font-size: .8125rem;
}

.p21-detail-value {
    overflow-wrap: anywhere;
}

.p21-hint {
    line-height: 1.5;
}

.p21-body > .cai-activity-metrics {
    --wc-ui-metric-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr));
}

.p21-body > nph-tab-panel {
    flex: 1 0 24rem;
    min-height: 24rem;
}

.p21-grid-pane, .p21-body .embedded-grid-panel {
    height: 100%;
    min-height: 20rem;
    min-width: 0;
}

.sdtm-p21-findings {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 24rem;
    gap: .5rem;
}

.sdtm-p21-findings > .app-grid-page-surface {
    flex: 1 0 20rem;
    min-height: 20rem;
}

.p21-busy {
    position: relative;
    min-height: 7rem;
}

.p21-body > nph-tab-panel:focus-visible {
    outline: 2px solid var(--nwc-accent-active);
    outline-offset: 2px;
}

.p21-justification-message {
    margin-bottom: 1rem;
    overflow-wrap: anywhere;
}

.p21-validation-template [hidden] {
    display: none !important;
}

.adam-p21-report {
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.adam-p21-report > .wc-structured-panel-content,
.app-content-body > .adam-p21-report > .wc-structured-panel-content:not(.app-grid-page-grid-shell) {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* Keep the cards open and the grid useful; scroll the report instead of squeezing the grid. */
.adam-p21-report-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 0.625rem;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0.25rem;
}

.adam-p21-report [hidden] {
    display: none !important;
}

.adam-p21-report .adam-p21-report-card,
.adam-p21-historical-report .adam-p21-report-card {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 100%;
    /* A row of tiles: the tiles carry the borders, the card only groups them. */
    --wc-ui-card-background: transparent;
    --wc-ui-card-border-color: transparent;
    --wc-ui-card-shadow: none;
    --wc-ui-card-body-padding: 0;
}

.adam-p21-report-findings {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    min-height: 32rem;
    --content-padding: 0;
}

.adam-p21-report-grid-pane,
.adam-p21-report-grid-pane > .embedded-grid-panel {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    min-height: 28rem;
    overflow: hidden;
}

/* The report is taller than the viewport by design: the grid keeps a usable height and this
   column scrolls, instead of the grid being squeezed into whatever the summary cards leave. */

.adam-p21-history-dialog {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 0;
}

.adam-p21-history-dialog [hidden],
.adam-p21-validation-template [hidden] {
    display: none !important;
}

.adam-p21-history-pane {
    display: flex;
    flex-direction: column;
    height: min(55vh, 32rem);
    min-height: 18rem;
}

.adam-p21-history-pane > .embedded-grid-panel {
    flex: 1 1 auto;
    height: 100%;
    min-height: 0;
}

.adam-p21-comparison-baseline {
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.wc-ui-modal-card:has(.adam-final-p21-comparison) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wc-ui-modal-card:has(.adam-final-p21-comparison) > .wc-ui-modal-header,
.wc-ui-modal-card:has(.adam-final-p21-comparison) > .wc-ui-modal-footer {
    flex: 0 0 auto;
}

.wc-ui-modal-card:has(.adam-final-p21-comparison) > .wc-ui-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.adam-final-p21-comparison,
.adam-final-p21-comparison-metadata,
.adam-final-p21-comparison-run {
    display: grid;
    gap: .5rem;
    min-width: 0;
}

.adam-final-p21-comparison-runs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.adam-final-p21-comparison-run-title {
    font-weight: 600;
}

.adam-final-p21-comparison-setting {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) minmax(0, 2fr);
    gap: .5rem;
}

.adam-final-p21-comparison-setting-label {
    font-weight: 500;
}

.adam-final-p21-comparison-line {
    overflow-wrap: anywhere;
}

.adam-final-p21-comparison-details > summary {
    cursor: pointer;
    padding-block: .5rem;
}

.adam-final-p21-comparison-compatibility {
    padding: .75rem;
    border-inline-start: 3px solid var(--spectrum-orange-600, #c76b00);
    background: var(--spectrum-orange-100, #fff3df);
    overflow-wrap: anywhere;
}

.adam-final-p21-comparison-grid {
    height: clamp(16rem, 40vh, 24rem);
    min-height: 16rem;
    min-width: 0;
}

@media (max-width: 40rem) {
    .adam-final-p21-comparison-runs {
        grid-template-columns: minmax(0, 1fr);
    }
}

.adam-p21-comparison-selection-notice {
    color: var(--text-danger, #991b1b);
    font-size: 0.8125rem;
}

.adam-p21-history-notice {
    flex: 0 0 auto;
    padding: 0.75rem 1rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius, 0.5rem);
    background: var(--surface-card, var(--nwc-ui-surface));
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    line-height: 1.45;
    text-align: center;
}

.adam-p21-status-detail {
    min-width: 0;
    margin-left: auto;
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.75rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.adam-p21-empty-state {
    display: flex;
    flex: 0 0 auto;
    min-height: 0;
    padding: 0.75rem 1rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius, 0.5rem);
    background: var(--surface-card, var(--nwc-ui-surface));
    text-align: center;
}

.adam-p21-empty-title {
    color: var(--text-primary, #0f172a);
    font-size: 0.9375rem;
    font-weight: 700;
}

.adam-p21-empty-hint {
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.adam-p21-report-content {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: column;
    gap: 0.625rem;
}

.adam-p21-notice {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid rgba(14, 116, 144, 0.22);
    border-radius: var(--bs-border-radius, 0.5rem);
    background: rgba(14, 116, 144, 0.06);
    color: #155e75;
    font-size: 0.75rem;
    line-height: 1.4;
}

.adam-p21-cutoff-disclosure {
    flex: 0 0 auto;
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.75rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.adam-p21-justification-message {
    padding: 0.625rem 0.75rem;
    border-radius: var(--bs-border-radius, 0.5rem);
    background: var(--surface-subtle, var(--nwc-ui-surface-soft));
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    line-height: 1.45;
}

.adam-prog-findings {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 0.75em;
}

.adam-prog-finding {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.8rem;
    line-height: 1.35;
}

.adam-prog-finding-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    inline-size: 18px;
    block-size: 18px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}

.adam-prog-finding-text {
    white-space: pre-wrap;
}

.adam-prog-finding--ovl {
    background: rgba(59, 130, 246, 0.08);
    color: #2563eb;
}

.adam-prog-finding--ovl .adam-prog-finding-badge {
    background: rgba(59, 130, 246, 0.18);
}

.adam-prog-findings-section {
    margin-top: 1em;
}

.adam-prog-findings-header {
    font-weight: 600;
    margin-bottom: 0.5em;
}

.adam-prog-blocked-note {
    margin-bottom: 0.5em;
}

.adam-prog-finding-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.adam-prog-finding-chip--code {
    font-family: var(--bs-font-monospace, monospace);
}

.adam-prog-viewing-older-version {
    margin: 0.5em 0;
    padding: 0.4em 0.75em;
    border-radius: 4px;
    background: rgba(255, 193, 7, 0.12);
    font-weight: 600;
    font-size: 0.85rem;
}

.adam-prog-history {
    margin-top: 1.5em;
}

.adam-prog-history-header {
    font-weight: 600;
    margin-bottom: 0.5em;
}

.adam-prog-history-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.adam-prog-history-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75em;
    padding: 0.4em 0.6em;
    border-radius: 4px;
    cursor: pointer;
}

.adam-prog-history-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

.adam-prog-history-row--active {
    background: rgba(0, 123, 255, 0.08);
    font-weight: 600;
}

.adam-prog-history-cell {
    font-size: 0.8rem;
}

.adam-prog-history-cell--version {
    flex: 0 0 auto;
}

.adam-prog-history-cell--hash {
    font-family: var(--bs-font-monospace, monospace);
    flex: 0 0 auto;
}

.adam-prog-history-cell--findings {
    flex: 0 0 auto;
}

.adam-prog-history-cell--generated,
.adam-prog-history-cell--reviewed {
    flex: 1 1 auto;
    color: var(--bs-secondary-color, var(--nwc-text-secondary));
}

/* ── OVL Rules Section ──────────────────────────────────────────────────────── */
.ovl-rules-section {
    margin-top: 1.5rem;
}

.ovl-rules-section .wc-structured-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--sdtm-gray-200);
    margin-bottom: 0.5rem;
}

.ovl-rules-section .wc-structured-panel-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--sdtm-gray-700);
}

.ovl-rules-section .wc-structured-panel-actions {
    display: flex;
    gap: 0.5rem;
}

/* OVL rule severity badges */
.ovl-rule-severity {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.ovl-severity-block {
    background: var(--sdtm-error-bg, #fee2e2);
    border: 1px solid var(--sdtm-error-border, #fca5a5);
    color: var(--sdtm-error, #dc2626);
}

.ovl-severity-warn {
    background: var(--sdtm-warn-bg, #fef3c7);
    border: 1px solid var(--sdtm-warn-border, #fcd34d);
    color: var(--sdtm-warn, #d97706);
}

/* OVL rule description cell */
.ovl-rule-description {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-header_title_no_shadow {
    font-size: 1.75rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1;
}

.edit-form-widget-root {
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.page-with-sidebar {
    height: 100%;
    min-height: 0;
    display: flex;
    grid-template-columns: 1fr 6fr;
    gap: 0.5em;
}

.sdtm-shell {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.5em;
}

.sdtm-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.1em;

    background: var(--nwc-basic-fill);
    border: 1px solid var(--nwc-basic-border);
    border-radius: .5rem;

    min-height: 0;
    min-width: 15em;
    max-width: 20em;
    padding-top: 0.2em;
}

.sdtm-sidebar-search {
    padding-left: 0.5em;
    padding-right: 0.5em;
}

.sdtm-sidebar-content {
    display: flex;
    flex-direction: column;
    gap: 0.1em;
    padding: 0.1em;
    overflow-y: scroll;
    overflow-x: hidden;
}

.sdtm-sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 1em;
}

.sdtm-sidebar-collapsed {
    min-width: 3em;
}

.sdtm-sidebar-empty {
    height: 100%;
    text-align: center;
    vertical-align: center;
}

.sdtm-cell-ai-button {
    width: 1em;
}

.full-height {
    height: 100%;
}

.full-width {
    width: 100%;
}

/* TLF Library Zone A — New Table/Listing/Figure choice modal (handoff) */
.library-tlf-create-choice-body {
    padding: 4px 0 2px;
}

.library-tlf-create-choice-row {
    display: flex;
    gap: 16px;
    justify-content: center;
    padding: 8px 0 4px;
    flex-wrap: wrap;
}

.library-tlf-create-choice-card {
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 28px 18px;
    border-radius: 8px;
    border: 1px solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    color: inherit;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.library-tlf-create-choice-card:hover {
    border-color: var(--nwc-accent);
    box-shadow: 0 4px 14px rgba(15, 122, 101, 0.14);
}

.library-tlf-create-choice-card:focus-visible {
    outline: none;
    border-color: var(--nwc-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--nwc-accent) 13%, transparent);
}

.library-tlf-create-choice-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nwc-success-subtle);
    color: var(--nwc-accent);
    flex-shrink: 0;
}

.library-tlf-create-choice-title {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--nwc-text-primary);
}

.library-tlf-create-choice-desc {
    font-size: 12.5px;
    color: var(--nwc-text-secondary);
    line-height: 1.4;
}

/* TLF Library Zone A — copy-from-existing picker */
.wc-ui-modal-card:has(.library-tlf-copy-source-picker-modal) .wc-ui-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.library-tlf-copy-source-picker-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.library-tlf-copy-source-picker-selection {
    font-size: 13px;
    color: var(--nwc-text-secondary);
}

.library-tlf-copy-source-picker-grid-shell {
    border: 1px solid var(--nwc-ui-border);
    border-radius: 6px;
    overflow: hidden;
}

.library-tlf-copy-source-picker-grid-shell .ag-cell {
    display: flex;
    align-items: center;
}

.library-tlf-copy-source-picker-checkbox-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 1.75rem;
}

.library-tlf-copy-source-picker-footer {
    display: flex;
    justify-content: flex-end;
    width: 100%;
}

.library-tlf-copy-source-picker-actions,
.library-tlf-copy-source-picker-footer .wc-ui-actions {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    width: auto;
    margin-left: auto;
}

.wc-ui-modal-card:has(.library-tlf-copy-source-picker-modal) .wc-ui-modal-footer .wc-ui-button,
.wc-ui-modal-card:has(.library-tlf-copy-source-picker-modal) .wc-ui-modal-footer nph-button,
.library-tlf-copy-source-picker-footer .wc-ui-button,
.library-tlf-copy-source-picker-footer nph-button,
.library-tlf-copy-source-picker-actions .wc-ui-button,
.library-tlf-copy-source-picker-actions nph-button {
    width: auto !important;
    max-width: none;
    flex: 0 0 auto;
    align-self: auto;
}

.adam-ovl-result-cell {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.adam-ovl-result-icon {
    color: var(--danger);
    cursor: pointer;
}

.adam-gap-result-icon {
    color: #b45309;
    cursor: pointer;
}

.cai-sdtm-variable-cell {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    min-width: 0;
    height: 100%;
}

.cai-sdtm-variable-cell-text {
    min-width: 0;
    text-overflow: ellipsis;
    overflow: hidden;
}

.cai-sdtm-suggestion-button {
    opacity: 0.6;
    transition: opacity 0.1s;
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    flex: none;
}

.cai-sdtm-suggestion-button:hover {
    opacity: 1;
}

.cai-sdtm-suggestion-modal {
    --modal-initial-width: 45%;
}

.cai-sdtm-output-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    min-height: 30rem;
    height: 100%;
}

.cai-sdtm-output-body .wc-ui-artifact-viewer {
    height: 100%;
    min-height: 30rem;
}

.cai-sdtm-output-provenance {
    min-height: 1.25rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.cai-sdtm-output-content {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border: 0.0625rem solid var(--border-default, #d8deea);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.cai-sdtm-output-artifacts {
    min-width: 15rem;
}

.cai-sdtm-output-viewer-panel,
.cai-sdtm-output-viewer {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
}

.cai-sdtm-output-viewer {
    flex: 1;
    overflow: hidden;
}

.cai-sdtm-output-viewer .wc-ui-xpt-viewer {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.cai-sdtm-output-state {
    margin: auto;
    max-width: 32rem;
    padding: 2rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    text-align: center;
}

.cai-sdtm-output-viewer[hidden],
.cai-sdtm-output-state[hidden] {
    display: none !important;
}

/* ADaM Program Results — XPT output preview. */
.adam-program-output-modal {
    --modal-initial-width: min(90vw, 96rem);
    --modal-min-width: min(62rem, 90vw);
}

.adam-program-output-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: min(70vh, 50rem);
    min-height: 30rem;
}

.adam-program-output-viewer {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.adam-program-output-viewer .wc-ui-xpt-viewer {
    flex: 1;
    min-height: 0;
    height: 100%;
}

.adam-program-output-state {
    margin: auto;
    max-width: 32rem;
    padding: 2rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    text-align: center;
}

.adam-program-output-viewer[hidden],
.adam-program-output-state[hidden] {
    display: none !important;
}

@media (max-width: 52rem) {
    .cai-sdtm-output-modal {
        --modal-min-width: 94vw;
    }

    .adam-program-output-modal {
        --modal-min-width: 94vw;
    }

    .project-tlf-programming-output-preview-modal {
        --modal-min-width: 94vw;
    }

    .adam-program-output-body {
        height: 76vh;
        min-height: 24rem;
    }

    .project-tlf-programming-output-preview-body {
        height: 76vh;
    }

    .cai-sdtm-output-body {
        min-height: 24rem;
    }

    .cai-sdtm-output-artifacts {
        min-width: 0;
        max-width: 45vw;
    }
}

.auto-width-input {
    --input-max-width: unset;
    --label-width: unset;
}

/* The page grows with its content; the detail host scrolls it. */
.adam-execution-stage-compare {
    min-height: 100%;
}

.adam-execution-stage-compare > .wc-structured-panel-content,
.adam-execution-stage-compare-root {
    display: flex;
    flex-direction: column;
    flex: 1 0 auto;
    height: auto;
    min-width: 0;
}

.adam-execution-stage-compare-root {
    gap: 0.75rem;
}

.adam-execution-stage-compare-toolbar-leading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.adam-execution-stage-compare-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-stage-compare-busy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 0.0625rem solid var(--green-200, #bfe3d4);
    background: var(--green-050, var(--nwc-ui-surface-soft));
    color: var(--green-700, #1d6b4a);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
}

.adam-execution-stage-compare-run-link {
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 0.125rem;
}

/* `button { font: inherit }` also inherits AG Grid's row-tall cell line-height. */
button.wc-ag-col-status {
    line-height: normal;
}

/* Dataset page: one column scrolled by the workspace detail host; sizes follow the page, not the viewport,
   because the dataset card list can collapse. */
.adam-compare-dataset-page {
    container-type: inline-size;
    min-width: 0;
}

.adam-compare-dataset-placeholder {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}

.adam-compare-dataset-body,
.adam-compare-dataset-banners,
.adam-compare-dataset-differences-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.adam-compare-dataset-state:empty,
.adam-compare-dataset-matched-on:empty,
.adam-compare-dataset-details-slot:empty {
    display: none;
}

/* Compact strip and quiet labels, as on the P21 report: the page is a result summary, not a dashboard. */
/* Summary tiles of every ADaM stage (Compare, P21, ADRG, Define-XML, Final Package). */
.adam-stage-metrics {
    --wc-ui-metric-columns: repeat(auto-fit, minmax(9rem, 1fr));
    --wc-ui-metric-accent-value-color: var(--nwc-accent);
    --wc-ui-metric-warning-value-color: #92580a;
    --wc-ui-metric-negative-value-color: #b42318;
    --wc-ui-metric-badged-label-padding-inline-end: 0;
    --wc-ui-metric-label-overflow-wrap: anywhere;
    --wc-ui-metric-value-overflow-wrap: anywhere;
    --wc-ui-metric-gap: 0.5rem;
    --wc-ui-metric-padding: 0.45rem 0.7rem;
    --wc-ui-metric-radius: 0.625rem;
    --wc-ui-metric-shadow: none;
    --wc-ui-metric-accent-size: 0;
    --wc-ui-metric-item-gap: 0.15rem;
    --wc-ui-metric-label-size: 0.65rem;
    --wc-ui-metric-label-weight: 600;
    --wc-ui-metric-value-size: 0.9375rem;
    --wc-ui-metric-value-weight: 600;
    --wc-ui-metric-detail-size: 0.75rem;
}

.adam-compare-dataset-page .wc-ui-card {
    --wc-ui-card-title-size: 0.875rem;
    --wc-ui-card-title-weight: 600;
    --wc-ui-card-shadow: none;
}

.adam-compare-dataset-page .wc-ui-details-row {
    --wc-ui-details-row-label-font-weight: 500;
    --wc-ui-details-row-label-color: var(--muted, #5d6d85);
    --wc-ui-details-row-value-color: var(--ink, #1a1f2b);
    font-size: 0.8125rem;
}

.adam-compare-dataset-sides {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

@container (width < 44rem) {
    .adam-compare-dataset-sides {
        grid-template-columns: minmax(0, 1fr);
    }
}

.adam-compare-dataset-side-facts {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Long run labels and file names wrap instead of widening the card. */
.adam-compare-dataset-side-facts .wc-ui-details-row-value {
    overflow-wrap: anywhere;
}

.adam-compare-dataset-matched-on .wc-ui-details-row-value {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

/* A side's block reason, in the look of the stage notices. */
.adam-compare-dataset-side-block {
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--nwc-warning-subtle-strong);
    border-radius: var(--bs-border-radius, 0.25rem);
    background: var(--nwc-warning-100);
    color: var(--nwc-text-primary);
    font-size: 0.8125rem;
    line-height: 1.25rem;
}

.adam-compare-dataset-side-block:not(:first-child) {
    margin-top: 0.5rem;
}

.adam-compare-dataset-details > summary {
    cursor: pointer;
    color: var(--muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.adam-compare-dataset-details-text {
    margin-top: 0.5rem;
    max-height: 24rem;
    overflow: auto;
    padding: 0.625rem 0.75rem;
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius);
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* On the page the difference table scrolls inside its card, so the sticky header stays in view. */
.adam-compare-dataset-evidence .adam-compare-differences {
    margin-bottom: 0;
}

.adam-compare-dataset-evidence .adam-compare-difference-tables {
    max-height: 36rem;
    overflow: auto;
}

.adam-compare-dataset-evidence .adam-compare-difference-production,
.adam-compare-dataset-evidence .adam-compare-difference-qc {
    min-width: 12rem;
}

.adam-compare-history-current {
    display: inline-block;
    margin-left: 0.375rem;
    padding: 0.05rem 0.4rem;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
    font-size: 0.6875rem;
    font-weight: 600;
}

.adam-execution-stage-compare-report-body {
    white-space: pre;
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
    overflow: auto;
    flex: 1 1 auto;
    min-block-size: 0;
}

.adam-execution-stage-compare-report-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* The report body is `white-space: pre` for the plain-text summary; the structured table opts back
   out so cells wrap and lay out normally. */
.adam-compare-differences {
    white-space: normal;
    font-family: var(--font-body, inherit);
    font-size: 0.8125rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.adam-compare-difference-summary {
    font-weight: 600;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-compare-difference-truncated {
    color: var(--muted, var(--nwc-text-secondary));
}

.adam-compare-difference-paging {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    color: var(--muted, var(--nwc-text-secondary));
}

.adam-compare-difference-paging[hidden] {
    display: none;
}

.adam-compare-differences input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    padding: 0.375rem 0.5rem;
    border: 0.0625rem solid var(--border-input, #c6cfd8);
    border-radius: 0.25rem;
    font: inherit;
}

.adam-compare-difference-tables {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adam-compare-difference-grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.adam-compare-difference-grid th,
.adam-compare-difference-grid td {
    text-align: left;
    padding: 0.25rem 0.5rem;
    border-bottom: 0.0625rem solid var(--border-muted, var(--nwc-ui-border));
    vertical-align: top;
    word-break: break-word;
}

.adam-compare-difference-grid th {
    position: sticky;
    top: 0;
    background: var(--surface-card, var(--nwc-ui-surface));
    font-weight: 600;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.adam-compare-difference-group td {
    background: var(--muted-soft, var(--nwc-ui-surface-soft));
    font-weight: 600;
}

.adam-compare-difference-structure td {
    color: var(--muted, var(--nwc-text-secondary));
    font-style: italic;
}

/* Values stay monospace so digit shifts line up when scanning Production against QC. */
.adam-compare-difference-key,
.adam-compare-difference-production,
.adam-compare-difference-qc {
    font-family: var(--font-mono, ui-monospace, monospace);
    font-size: 0.75rem;
}

.adam-compare-difference-production mark,
.adam-compare-difference-qc mark {
    padding: 0.08rem 0.15rem;
    border-radius: 0.2rem;
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

/* Preserve spaces in labels so whitespace differences remain visible. */
.adam-compare-difference-label {
    white-space: pre-wrap;
}

.adam-compare-difference-full {
    margin-top: 0.35rem;
    font-size: 0.6875rem;
}

.adam-compare-difference-full summary {
    cursor: pointer;
    color: var(--muted, var(--nwc-text-secondary));
}

.adam-execution-artifact-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    padding: 1rem;
}

.adam-execution-stage-define [hidden] {
    display: none !important;
}

.adam-execution-stage-define-root {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.adam-define-files-tab {
    padding: 1rem;
}

.adam-define-files-tab > .embedded-grid-panel {
    height: min(25rem, 55vh);
    min-height: 12rem;
}

.adam-define-files-grid {
    --ag-line-height: 1.4rem;
}

.adam-define-files-grid .ag-cell {
    display: flex;
    align-items: center;
}

.adam-execution-stage-define .adam-define-findings-tab .adam-p21-report-grid-pane {
    flex: 0 0 auto;
    height: min(55vh, 32rem);
    min-height: 18rem;
}

.adam-execution-stage-define .adam-define-findings-tab .adam-p21-report-grid-pane > .embedded-grid-panel {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
}

.adam-execution-stage-define .adam-execution-artifact-card {
    padding: 1.25rem;
}

.adam-execution-stage-define .adam-execution-artifact-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adam-define-action-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.5rem;
}


.adam-define-blocker-title {
    color: var(--warning-800, #7a2e0e);
    font-size: 0.875rem;
    font-weight: 700;
}

.adam-define-blocker-copy {
    color: var(--warning-800, #7a2e0e);
    font-size: 0.8125rem;
    line-height: 1.45;
}

.adam-execution-refresh {
    --nwc-button-border-color: transparent;
    --nwc-accent-shadow: none;
    --nwc-inset-shadow: none;
}

.adam-define-details-link,
.adam-adrg-file-link {
    /* Style the shadow button through its supported variables, including hover/active. */
    --nwc-button-border-color: transparent;
    --nwc-button-color: var(--nwc-accent);
    --nwc-button-min-width: 0;
    --nwc-button-min-height: 0;
    --nwc-button-border-radius: 0;
    --button-padding: 0;
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    --nwc-inset-shadow: none;
    color: var(--nwc-accent);
    white-space: nowrap;
    cursor: pointer;
}

.adam-adrg-p21-run-link {
    --nwc-button-color: var(--nwc-accent-on-light, #0b7a5e);
    --nwc-button-text-line-height: inherit;
}

.adam-define-details-link:hover,
.adam-adrg-file-link:hover {
    text-decoration: underline;
}

/* Grid links retain text-link presentation when the renderer uses a button. */
.adam-execution-stage-pkg-datasets-grid .wc-ag-col-clickable,
.adam-p21-history-pane [col-id="datasetSet"] .wc-ag-col-clickable,
.adam-execution-stage-compare .wc-ag-col-clickable,
.adam-execution-stage-pkg .wc-ag-col-clickable {
    --nwc-button-border-color: transparent;
    --nwc-button-color: var(--nwc-accent);
    --nwc-button-min-width: 0;
    --nwc-button-min-height: 0;
    --nwc-button-border-radius: 0;
    --button-padding: 0;
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    --nwc-inset-shadow: none;
    appearance: none;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0;
    min-width: 0;
    min-height: 0;
    color: var(--nwc-accent);
    font: inherit;
    font-weight: 500;
    cursor: pointer;
}

.adam-define-current-card {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    padding: 1rem;
}

.adam-define-current-kicker {
    color: var(--nwc-accent);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.adam-define-current-title,
.adam-define-artifacts-title {
    color: var(--ink, var(--nwc-text-primary));
    font-size: 0.9375rem;
    font-weight: 700;
}

.adam-define-current-copy {
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    line-height: 1.5;
}

.adam-define-current-card > .adam-stage-metrics {
    margin-top: 0.625rem;
}

.adam-define-artifacts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.adam-define-artifact-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.adam-define-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 68vh;
    overflow: auto;
}

.adam-define-details-heading {
    margin-top: 0.5rem;
    color: var(--ink, var(--nwc-text-primary));
    font-size: 0.875rem;
    font-weight: 700;
}

.adam-define-details-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.375rem;
    font-size: 0.75rem;
}

.adam-define-details-table th,
.adam-define-details-table td {
    padding: 0.625rem 0.75rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
    text-align: left;
    vertical-align: top;
}

.adam-define-details-table th {
    position: sticky;
    top: 0;
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
    color: var(--text-muted, var(--nwc-text-secondary));
    font-weight: 700;
}

.adam-define-details-table tr:last-child td {
    border-bottom: 0;
}

.adam-define-details-empty {
    border: 0.0625rem dashed var(--border-default, #dde3ec);
    border-radius: 0.375rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    padding: 0.75rem;
    font-size: 0.8125rem;
}

@media (max-width: 68rem) {
    .adam-define-artifact-grid {
        grid-template-columns: 1fr;
    }
}

.adam-execution-artifact-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-artifact-busy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
    padding: 1.5rem 1rem;
}

.adam-execution-artifact-busy-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-artifact-busy-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    max-width: 32rem;
}

.adam-execution-artifact-busy-label {
    font-size: 0.75rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-artifact-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    padding: 1.5rem 1rem;
}

.adam-execution-artifact-empty-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-artifact-empty-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    max-width: 32rem;
}

.adam-execution-artifact-gatehint {
    border: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-artifact-mini-caption {
    font-size: 0.75rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-artifact-footer {
    display: flex;
    justify-content: flex-end;
}

.adam-execution-artifact-preview-body {
    max-height: 22.5rem;
    overflow: auto;
}

.adam-execution-artifact-preview-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.adam-define-spec-dialog-body {
    max-height: 70vh;
    overflow-y: auto;
}

.adam-define-spec-dialog-tab-shell {
    min-height: 20rem;
}

.adam-define-spec-dialog-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

.adam-define-spec-dialog-toolbar nph-combobox,
.adam-define-spec-dialog-toolbar nph-text-field {
    width: 14rem;
    flex: 0 0 14rem;
}

.adam-define-spec-dialog-limit-note {
    color: var(--text-muted, var(--nwc-text-secondary));
    font-size: 0.75rem;
}

.adam-execution-artifact-preview-iframe {
    width: 100%;
    height: min(48rem, calc(100dvh - 14rem));
    border: 0;
}

.adam-execution-stage-pkg-card {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--surface-card, var(--nwc-ui-surface));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    padding: 1rem;
}

.adam-execution-stage-pkg-busy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    text-align: center;
    padding: 1.5rem 1rem;
}

.adam-execution-stage-pkg-busy-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-stage-pkg-busy-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
    max-width: 32rem;
}

/* Grid sections. The panel inherits height:100%, which collapses to zero inside a flex column,
   so each section owns an explicit height and the panel fills it. */
.adam-execution-stage-pkg-readiness,
.adam-execution-stage-pkg-payload,
.adam-execution-stage-pkg-evidence {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex-shrink: 0;
    min-width: 0;
}

.adam-execution-stage-pkg-readiness > .embedded-grid-panel {
    height: min(20rem, 45vh);
    min-height: 12rem;
    flex-shrink: 0;
    min-width: 0;
}

.adam-execution-stage-pkg-payload > .embedded-grid-panel,
.adam-execution-stage-pkg-evidence > .embedded-grid-panel {
    height: min(24rem, 50vh);
    min-height: 12rem;
    flex-shrink: 0;
    min-width: 0;
}

.adam-execution-stage-pkg-section-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

/* Host for the current-step card; it reuses the shared adam-define-* styles. */
.adam-execution-stage-pkg-step-host {
    display: contents;
}

.adam-execution-stage-pkg-readiness > .embedded-grid-panel {
    height: min(20rem, 45vh);
    min-height: 12rem;
    flex-shrink: 0;
    min-width: 0;
}

.adam-execution-stage-pkg-profile {
    font-size: 0.75rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-stage-pkg-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    border: 0.0625rem solid var(--border-default, #dde3ec);
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-stage-pkg-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.75rem;
    font-size: 0.8125rem;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-execution-stage-pkg-filename {
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-stage-pkg-locked-title,
.adam-execution-stage-pkg-preflight-passed {
    font-weight: 700;
    color: var(--ink, var(--nwc-text-primary));
}

.adam-execution-stage-pkg-rejected-title,
.adam-execution-stage-pkg-preflight-failed,
.adam-execution-stage-pkg-gate-title,
.adam-execution-stage-pkg-blocked-title {
    font-weight: 700;
    color: var(--danger, #b42318);
}

.adam-execution-stage-pkg-reason {
    font-style: italic;
}

.adam-execution-stage-pkg-findings {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* autoHeight grows each row to fit its wrapped text; this is only the floor for short rows. */
.adam-execution-stage-pkg-findings-grid,
.adam-execution-stage-pkg-datasets-grid {
    --ag-row-height: 56px;
}

/* Badges, sizes and hashes centre vertically instead of hugging the top border. Prose cells are
   excluded because a flex box would fight autoHeight's measurement of wrapped text. */
.adam-execution-stage-pkg-findings-grid .ag-cell:not(.adam-adrg-grid-text),
.adam-execution-stage-pkg-datasets-grid .ag-cell:not(.adam-adrg-grid-text) {
    display: flex;
    align-items: center;
}

/* Wrapping applies only to cells that opted in through withCellClass. No overflow-y here: the row
   grows to fit, so a scrollbar inside the cell would just re-clip the text. */
.adam-execution-stage-pkg-findings-grid .ag-cell.adam-adrg-grid-text,
.adam-execution-stage-pkg-datasets-grid .ag-cell.adam-adrg-grid-text {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
}

.wc-ag-col-status.adam-prep21-readiness-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    text-align: center;
    transition: background-color 120ms ease;
}

.adam-prep21-readiness .ag-header-cell[col-id="status"] .ag-header-cell-label {
    justify-content: center;
    white-space: nowrap;
}

.adam-prep21-readiness .ag-cell.adam-prep21-readiness-cell--center,
.adam-prep21-readiness .ag-cell.adam-prep21-readiness-cell--center .ag-cell-wrapper,
.adam-prep21-readiness .ag-cell.adam-prep21-readiness-cell--center .ag-cell-value {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.adam-prep21-readiness-status--clickable {
    cursor: pointer;
}

button.adam-prep21-readiness-status.project-status-badge-active:hover {
    background: rgba(16, 163, 127, 0.18);
}

button.adam-prep21-readiness-status.project-status-badge-pending:hover {
    background: rgba(245, 158, 11, 0.16);
}

button.adam-prep21-readiness-status.project-status-badge-failed:hover {
    background: rgba(220, 38, 38, 0.16);
}

button.adam-prep21-readiness-status:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.adam-prep21-readiness-dialog-body {
    display: grid;
    gap: 0.75rem;
    max-height: 30rem;
    overflow: auto;
}

.adam-prep21-readiness-dialog-row {
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.375rem;
    padding: 0.75rem;
    display: grid;
    gap: 0.35rem;
}

.adam-prep21-readiness-dialog-status {
    font-weight: 600;
}

.adam-prep21-readiness-dialog-reason {
    color: var(--text-danger, #b42318);
}

.adam-prep21-readiness-dialog-remediation {
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-prep21-readiness-dialog-summary {
    font-weight: 500;
}

.adam-prep21-readiness-dialog-note {
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-prep21-ovl-section {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.adam-prep21-ovl-section > h3 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted, var(--nwc-text-secondary));
}

.adam-prep21-ovl-datasets {
    height: min(22rem, 50vh);
    flex-shrink: 0;
    min-width: 0;
}

.adam-prep21-ovl-dataset-name {
    color: var(--nwc-accent);
    font-weight: 500;
}

.adam-prep21-ovl-cp2-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* ADRG uses the same workflow surfaces as Define-XML, with an explicit completion stage. */
.adam-execution-stage-adrg .adam-execution-artifact-card {
    padding: 1.25rem;
}

.adam-execution-stage-adrg .adam-execution-artifact-body,
.adam-adrg-details-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adam-adrg-pdf-card,
.adam-define-xml-card {
    position: relative;
}

.adam-adrg-pdf-card[inert] {
    opacity: 0.55;
}

.adam-adrg-file-actions {
    align-items: center;
}

.adam-adrg-files-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.adam-adrg-file-link {
    text-underline-offset: 0.125rem;
}

.adam-adrg-file-tabs {
    min-width: 0;
}

.adam-adrg-history-files {
    min-width: 0;
}

.adam-adrg-history-files > .embedded-grid-panel {
    height: min(25rem, 55vh);
    min-height: 12rem;
    flex-shrink: 0;
    min-width: 0;
}

.adam-adrg-history-file-links {
    display: flex;
    align-items: center;
    width: 100%;
}

.adam-adrg-history-grid {
    --ag-row-height: 96px;
    --ag-line-height: 1.4rem;
}

.adam-adrg-history-file-links > div {
    width: 100%;
    min-width: 0;
}

.adam-adrg-history-grid .ag-cell {
    display: flex;
    align-items: center;
}

.adam-adrg-history-grid .ag-cell[col-id="wordImportReason"] .ag-cell-wrapper {
    height: auto;
    min-width: 0;
    width: 100%;
}

.adam-adrg-history-grid .ag-cell[col-id="wordImportReason"] .ag-cell-value {
    height: auto;
    min-width: 0;
}

.adam-adrg-content-editor-body {
    max-height: 68vh;
    overflow: auto;
}

.adam-adrg-content-grid .ag-cell.adam-adrg-grid-text,
.adam-adrg-proposals-grid .ag-cell.adam-adrg-grid-text {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    overflow-y: auto;
}

.adam-adrg-content-grid,
.adam-adrg-proposals-grid {
    --ag-row-height: 112px;
}

.adam-adrg-missing-content-grid {
    --ag-row-height: 80px;
}

.adam-adrg-missing-grid-panel {
    height: min(18rem, 40vh);
    flex-shrink: 0;
    min-width: 0;
}

.adam-adrg-pdf-preview,
.adam-define-xml-preview {
    --nwc-button-width: 1.75rem;
    --nwc-button-min-height: 1.75rem;
    --nwc-button-icon-only-padding: 0;
    position: absolute;
    top: 50%;
    right: 3.125rem;
    transform: translateY(-50%);
    width: 1.75rem;
    height: 1.75rem;
}

.adam-adrg-advisory-banner {
    background: var(--surface-muted, var(--nwc-ui-surface-soft));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    padding: 1rem;
}

.adam-adrg-issue-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 0.0625rem solid var(--border-default, #dde3ec);
}

.adam-adrg-issues-dialog-body {
    max-height: min(34rem, 70vh);
    overflow: auto;
    min-width: 0;
}

.adam-adrg-issues-grid-panel {
    height: min(26rem, 55vh);
    flex-shrink: 0;
    min-width: 0;
}

.adam-adrg-standard-issues-grid,
.adam-define-validation-findings-grid,
.adam-define-final-p21-findings-grid {
    --ag-row-height: 96px;
}

.adam-adrg-standard-issues-grid .ag-cell.adam-adrg-grid-text,
.adam-define-validation-findings-grid .ag-cell.adam-adrg-grid-text,
.adam-define-final-p21-findings-grid .ag-cell.adam-adrg-grid-text {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    overflow-y: auto;
}

.adam-adrg-issue-code {
    display: inline-flex;
    align-items: baseline;
    gap: 0.375rem;
    font-weight: 600;
    white-space: nowrap;
}

.adam-adrg-issue-code::before {
    content: "";
    flex-shrink: 0;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
}

.adam-adrg-issue-code.is-blocking::before {
    background: var(--color-danger, #b42318);
}

.adam-adrg-issue-code.is-advisory::before {
    background: var(--color-warning, #b7791f);
}

/* SDTM delivery pages use application controls and tokens; ADaM styles are independent. */
.sdtm-delivery-template {
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.sdtm-delivery-template > .wc-structured-panel-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    overflow: hidden;
}

.sdtm-delivery-template .wc-ui-loading-layout,
.sdtm-delivery-template .wc-ui-loading-layout-content {
    min-height: 0;
    height: 100%;
}

.sdtm-delivery-page {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: auto;
}

.sdtm-delivery-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    min-height: 0;
    flex: 1 1 auto;
    height: 100%;
    overflow: auto;
}

.sdtm-delivery-define_xml .sdtm-delivery-page,
.sdtm-delivery-final_package .sdtm-delivery-page,
.sdtm-delivery-define_xml .sdtm-delivery-body,
.sdtm-delivery-final_package .sdtm-delivery-body {
    overflow: hidden;
}

.sdtm-delivery-empty {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    gap: .75rem;
    height: 100%;
}

.sdtm-delivery-empty > .sdtm-delivery-metadata,
.sdtm-delivery-empty > .wc-structured-panel-actions {
    width: min(100%, 48rem);
}

.sdtm-pre21-readiness-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    overflow: auto;
}

.sdtm-metrics {
    padding: 1rem 0;
}

.sdtm-delivery-metadata {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    min-width: 0;
}

.sdtm-delivery-checksum {
    padding: .75rem 1rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: .5rem;
    background: var(--nwc-ui-surface);
}

.sdtm-delivery-checksum-value {
    margin-top: .375rem;
    font-family: monospace;
    font-size: .8125rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    user-select: text;
}

.sdtm-delivery-context {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: .5rem 1rem;
    min-width: 0;
    overflow-wrap: anywhere;
}

.sdtm-delivery-detail {
    min-width: 0;
}

.sdtm-delivery-label {
    font-size: .8125rem;
    color: var(--text-secondary);
}

.sdtm-delivery-value {
    overflow-wrap: anywhere;
}

.sdtm-delivery-hint {
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-line;
}

.sdtm-delivery-results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    flex-shrink: 0;
    height: 100%;
}

.sdtm-delivery-results[hidden] {
    display: none;
}

.sdtm-delivery-define_xml .sdtm-delivery-results,
.sdtm-delivery-final_package .sdtm-delivery-results {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.sdtm-delivery-define_xml .sdtm-delivery-tabs,
.sdtm-delivery-final_package .sdtm-delivery-tabs {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    --content-padding: 0;
}

.sdtm-delivery-tabs > .sdtm-delivery-artifacts,
.sdtm-delivery-tabs > .sdtm-delivery-tables {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.sdtm-delivery-define_xml .sdtm-delivery-artifacts > .cai-content-card,
.sdtm-delivery-define_xml .sdtm-delivery-artifacts > .cai-content-card > .wc-ui-card-body {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.sdtm-delivery-define_xml .sdtm-delivery-artifacts > .cai-content-card > .wc-ui-card-body {
    display: flex;
    flex-direction: column;
}

.sdtm-delivery-define_xml .sdtm-delivery-tabs .embedded-grid-panel,
.sdtm-delivery-final_package .sdtm-delivery-tabs .embedded-grid-panel {
    flex: 1 1 0;
    height: 100%;
    min-height: 0;
}

.sdtm-delivery-define_xml .sdtm-delivery-tabs .sdtm-define-document-grid,
.sdtm-delivery-define_xml .sdtm-delivery-tabs .sdtm-define-document-grid .app-grid-page-grid-shell {
    height: 100%;
    min-height: 0;
}

.sdtm-delivery-results > .sdtm-delivery-empty {
    min-height: clamp(18rem, 40vh, 32rem);
}

.sdtm-delivery-artifacts, .sdtm-delivery-tables {
    min-width: 0;
}

.sdtm-delivery-final_package .sdtm-delivery-artifacts {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.sdtm-delivery-final_package .sdtm-delivery-metadata {
    overflow-wrap: anywhere;
}

.sdtm-package-signature-row {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.sdtm-package-limitations {
    --mod-accordion-item-header-color-default: var(--nwc-text-secondary, #64748b);
}

.sdtm-delivery-table-title {
    font-weight: 600;
}

.sdtm-delivery-table-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-bottom: .75rem;
}

.sdtm-delivery-artifacts > .embedded-grid-panel,
.sdtm-delivery-tables > .embedded-grid-panel,
.sdtm-delivery-preview-table > .embedded-grid-panel {
    min-width: 0;
    height: 22rem;
    flex-shrink: 0;
}

.sdtm-delivery-grid {
    min-width: 0;
    height: 100%;
}

.sdtm-delivery-csdrg .sdtm-delivery-artifacts > .embedded-grid-panel,
.sdtm-delivery-csdrg .sdtm-delivery-tables > .embedded-grid-panel {
    height: clamp(22rem, 38vh, 34rem);
}

.sdtm-delivery-csdrg .sdtm-delivery-artifacts > .sdtm-delivery-artifact-list,
.sdtm-delivery-final_package .sdtm-delivery-artifacts > .sdtm-delivery-artifact-list {
    height: clamp(10rem, calc(7rem + var(--sdtm-artifact-rows, 3) * 2.75rem), 34rem);
}

.sdtm-delivery-preview {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.sdtm-delivery-xml-preview-dialog > .wc-ui-modal-card,
.adam-define-xml-preview-dialog > .wc-ui-modal-card {
    width: 95vw;
    max-width: calc(100vw - 2rem);
}

.sdtm-delivery-preview-table {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    min-width: 0;
}

.sdtm-delivery-preview-code .wc-ui-code-editor-host,
.sdtm-delivery-preview-code-fallback,
.adam-define-xml-preview-code .wc-ui-code-editor-host,
.adam-define-xml-preview-fallback {
    height: min(65vh, 48rem);
    min-height: 20rem;
}

.sdtm-delivery-preview-code-fallback,
.adam-define-xml-preview-fallback {
    overflow: auto;
    margin: 0;
    padding: 1rem;
    white-space: pre;
    font-family: monospace;
}

.sdtm-delivery-preview-pdf,
.sdtm-delivery-preview-document,
.adam-define-xml-preview-document {
    width: 100%;
    height: 65vh;
    min-height: 20rem;
    border: 1px solid var(--border-default);
    border-radius: var(--bs-border-radius);
}

.sdtm-delivery-template [hidden] {
    display: none !important;
}

.sdtm-delivery-preview-details {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sdtm-delivery-template .wc-structured-panel-actions {
    flex-wrap: wrap;
    max-width: 100%;
}

.sdtm-delivery-final_package > .wc-structured-panel-header {
    overflow-x: auto;
}

.sdtm-delivery-final_package > .wc-structured-panel-header > .wc-structured-panel-actions {
    flex-wrap: nowrap;
}

@media (max-width: 48rem) {
    .sdtm-delivery-template .wc-structured-panel-actions {
        justify-content: flex-start;
    }
}

/* SDTM metadata uses the shared Card; this grid only arranges its definition list. */
.sdtm-p21-metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
    gap: 1rem;
    margin: 0;
}

.sdtm-p21-metadata-entry {
    min-width: 0;
}

.sdtm-p21-metadata dt {
    color: var(--text-secondary);
    font-size: .8125rem;
}

.sdtm-p21-metadata dd {
    margin: .25rem 0 0;
    overflow-wrap: anywhere;
}

.sdtm-p21-details, .sdtm-p21-metrics {
    min-width: 0;
    flex-shrink: 0;
}

/* Embedded SDTM steps follow the Mapping and Programming action-bar layout. */
.sdtm-step-panel > .wc-structured-panel-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    padding: .5rem;
    gap: .75rem;
}

.sdtm-step-panel > .wc-structured-panel-header > .wc-structured-panel-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .75rem;
    margin: 0;
}

.sdtm-step-panel [hidden] {
    display: none !important;
}

.sdtm-step-panel .sdtm-toolbar-status {
    margin-inline-end: auto;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: .4rem;
}

.sdtm-status-help {
    position: relative;
}

.sdtm-status-help > summary {
    display: grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border: 1px solid var(--border-default, #d7dee8);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 600;
    list-style: none;
}

.sdtm-status-help > summary::-webkit-details-marker {
    display: none;
}

.sdtm-status-help > summary:focus-visible {
    outline: 2px solid var(--focus-ring-color, currentColor);
    outline-offset: 2px;
}

.sdtm-status-help-content {
    position: absolute;
    inset-block-start: calc(100% + .5rem);
    inset-inline-start: 0;
    z-index: 20;
    width: min(28rem, 75vw);
    max-height: 16rem;
    overflow: auto;
    padding: .75rem 1rem;
    border: 1px solid var(--border-default, #d7dee8);
    border-radius: var(--bs-border-radius);
    background: var(--surface-card, var(--nwc-ui-surface));
    box-shadow: 0 .4rem 1.25rem rgb(0 0 0 / 15%);
    color: var(--text-primary, #111827);
    font-size: .875rem;
    font-weight: 400;
    line-height: 1.5;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.sdtm-step-panel [data-testid="sdtm-p21-preparation"] {
    margin: .5rem;
}

.sdtm-pre-p21-readiness-step .sdtm-delivery-grid {
    flex: 1;
    min-height: 16rem;
}

.sdtm-pre21-readiness-body .sdtm-readiness-check-group ~ .sdtm-readiness-check-group {
    border-bottom: 0;
}

.sdtm-readiness-check-group {
    flex-shrink: 0;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    --wc-ui-card-header-background: var(--nwc-ui-surface-muted);
}

.sdtm-readiness-check-group .wc-ui-card-header {
    padding: 1rem !important;
}

.sdtm-readiness-check-group .wc-ui-card-header h2 {
    font-size: 1.15rem !important;
    color: unset !important;
    font-weight: 500;
}

.sdtm-readiness-check-group .wc-ui-card-body {
    padding: 0 !important;
}

.sdtm-readiness-check-group .ag-root-wrapper {
    border-radius: 0 !important;
}

.sdtm-readiness-check-group .embedded-grid-panel,
.sdtm-readiness-check-group .app-grid-page-grid-shell {
    min-height: 0;
}

.sdtm-delivery-define_xml .sdtm-define-document-grid .app-grid-page-grid-shell {
    height: 100%;
    min-height: 0;
}

/* Each bounded readiness group displays all checks; pagination is redundant. */
.sdtm-readiness-check-grid .ag-paging-panel {
    display: none;
}

.sdtm-readiness-check-grid .ag-cell-wrap-text {
    line-height: 1.25;
    padding-top: .5rem;
    padding-bottom: .5rem;
    overflow-wrap: break-word;
}


/* Step VI separates editable content from immutable generated documents. */
.sdtm-guide-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: baseline;
    gap: .5rem 1.5rem;
    color: var(--text-secondary);
    font-size: .875rem;
}

.sdtm-guide-save-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
    min-width: 0;
}

.sdtm-guide-save-status[data-state="FAILED"],
.sdtm-guide-operation-error {
    color: var(--status-negative, #b42318);
}

.sdtm-guide-save-status[data-state="FAILED"] {
    max-width: 28rem;
}

.sdtm-guide-content, .sdtm-guide-preview, .sdtm-guide-sources, .sdtm-guide-history {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.sdtm-guide-sources,
.sdtm-guide-editor-pane,
.sdtm-guide-history,
.sdtm-delivery-final_package .sdtm-delivery-tables:has(> .sdtm-delivery-metadata) {
    padding: 1rem;
    background: var(--nwc-ui-surface);
    border-radius: .5rem;
}

.sdtm-guide-editor-pane {
    gap: 1rem;
}

.sdtm-delivery-final_package .sdtm-delivery-tables:has(> .sdtm-delivery-metadata) > .sdtm-delivery-metadata {
    margin-bottom: .875rem;
}

.sdtm-guide-content-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
}

.sdtm-guide-section-picker {
    width: min(100%, 30rem);
    --input-max-width: 100%;
}

.sdtm-guide-issues {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.sdtm-guide-section-editor {
    min-width: 0;
}

.sdtm-guide-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.sdtm-guide-section-title {
    font-size: 1.125rem;
    font-weight: 600;
}

.sdtm-guide-section nph-textarea, .sdtm-guide-section nph-input {
    width: 100%;
    --input-max-width: 100%;
}

.sdtm-guide-section-attention, .sdtm-guide-difference {
    padding: .75rem 1rem;
    border-inline-start: 3px solid var(--status-notice, #b58b2b);
    background: var(--surface-subtle, var(--nwc-ui-surface-soft));
    color: var(--text-primary);
    font-size: .875rem;
    white-space: pre-line;
}

.sdtm-guide-difference {
    width: 100%;
    box-sizing: border-box;
}

.sdtm-guide-section-help, .sdtm-guide-preview-message, .sdtm-guide-issues {
    color: var(--text-secondary);
    font-size: .875rem;
}

.sdtm-guide-pdf {
    display: block;
    width: 100%;
    height: 65vh;
    min-height: 26rem;
    border: 1px solid var(--border-default);
    border-radius: var(--bs-border-radius);
}

.sdtm-guide-history-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.sdtm-guide-saved-comparison {
    max-height: 28rem;
    overflow: auto;
    padding: 1rem;
    border: 1px solid var(--border-default);
}

/* SDTM validation keeps run context and row-review counts compact above one report grid. */
.sdtm-validation-metrics.wc-ui-metric-strip {
    --wc-ui-metric-item-display: flex;
    --wc-ui-metric-item-flex: 1 1 7rem;
    --wc-ui-metric-radius: 1.125rem;
    --wc-ui-metric-value-overflow-wrap: anywhere;
    --wc-ui-metric-detail-overflow-wrap: anywhere;
    --wc-ui-metric-badge-inset-block-start: .375rem;
    --wc-ui-metric-badge-inset-inline-end: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem 1.5rem;
}

.sdtm-p21-details,
.sdtm-p21-report-totals {
    display: flex;
    flex-direction: column;
    gap: .875rem;
    min-inline-size: 0;
}

.sdtm-p21-details .sdtm-provenance-metrics.wc-ui-metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
    gap: .875rem;
}

.sdtm-step-panel [data-testid="sdtm-p21-coverage"] > summary {
    display: list-item;
}

.sdtm-step-panel [data-testid="sdtm-p21-coverage"] > summary > * {
    display: inline-flex;
    vertical-align: middle;
}

.sdtm-p21-selected-run {
    font-size: .875rem;
    font-weight: 600;
}

.sdtm-p21-details > .sdtm-validation-evidence {
    margin-block: 0;
}

.sdtm-validation-metrics.sdtm-p21-review-metrics {
    --wc-ui-metric-item-direction: row;
    --wc-ui-metric-item-align: baseline;
    --wc-ui-metric-item-flex: 0 1 auto;
    --wc-ui-metric-item-gap: .375rem;
    --wc-ui-metric-padding: 0;
}

.sdtm-step-panel .sdtm-p21-findings .ag-header-cell-text {
    text-transform: none;
}

.sdtm-step-panel .sdtm-p21-findings .ag-cell-wrap-text {
    white-space: pre-line;
    line-height: 1.4;
    padding-block: .375rem;
}

/* Source-paged WC grids use uniform row heights. Longer diagnostics remain in the tooltip/detail. */
.sdtm-p21-history-actor {
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.4;
}

.sdtm-p21-diagnostic {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    white-space: pre-line;
}

.sdtm-validation-metrics.sdtm-p21-row-context {
    --wc-ui-metric-item-flex: 1 1 45%;
}

.sdtm-p21-findings > [hidden],
.sdtm-step-panel [data-testid="sdtm-p21-coverage"][hidden] {
    display: none !important;
}

.sdtm-validation-evidence {
    margin-block: .375rem;
    min-width: 0;
}

.sdtm-validation-evidence > summary {
    cursor: pointer;
    font-size: .8125rem;
    padding-block: .25rem;
}

.sdtm-p21-captured-inputs .sdtm-validation-evidence,
.sdtm-p21-coverage-body .sdtm-validation-evidence {
    margin-block: 0;
}

.sdtm-p21-captured-inputs .sdtm-validation-evidence > summary,
.sdtm-p21-coverage-body .sdtm-validation-evidence > summary {
    line-height: 1.4;
    padding-block: .125rem;
}

.sdtm-validation-evidence-line {
    font-size: .8125rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.sdtm-validation-evidence-body {
    display: flex;
    flex-direction: column;
    gap: .375rem;
    padding: .5rem 0 .25rem 1rem;
    max-inline-size: 80ch;
}

.sdtm-p21-coverage-body {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .5rem 0 .25rem 1rem;
}

.sdtm-p21-review-summary {
    font-size: .8125rem;
    line-height: 1.5;
}

.sdtm-step-panel .p21-body {
    gap: .5rem;
}

.sdtm-step-panel .p21-body > nph-tab-panel {
    flex: 1 0 24rem;
    min-height: 24rem;
}

.sdtm-p21-group-context {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem 1rem;
    min-width: 0;
}

.sdtm-p21-group-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sdtm-p21-group-context .wc-ui-metric-strip {
    flex: 1 1 auto;
    margin: 0;
    padding: 0;
}

.sdtm-p21-finding-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.sdtm-p21-finding-history {
    height: 22rem;
    min-height: 22rem;
}

.sdtm-p21-workbench > .wc-structured-panel-header,
.sdtm-p21-workbench > .wc-structured-panel-header > .wc-structured-panel-actions {
    gap: .5rem;
}

.wc-ui-modal-card:has(.sdtm-p21-finding-dialog, .sdtm-p21-comparison-dialog) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wc-ui-modal-card:has(.sdtm-p21-finding-dialog, .sdtm-p21-comparison-dialog) > .wc-ui-modal-header,
.wc-ui-modal-card:has(.sdtm-p21-finding-dialog, .sdtm-p21-comparison-dialog) > .wc-ui-modal-footer {
    flex: 0 0 auto;
}

.wc-ui-modal-card:has(.sdtm-p21-finding-dialog, .sdtm-p21-comparison-dialog) > .wc-ui-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.sdtm-p21-finding-dialog {
    gap: .75rem;
}

.p21-review-save-error {
    color: var(--danger, #bf2f2f);
}

.sdtm-p21-finding-dialog :is(nph-input, nph-textarea, nph-combobox) {
    width: 100%;
    max-width: 100%;
    --input-max-width: 100%;
}

.sdtm-p21-workbench .p21-body > .sdtm-validation-evidence {
    margin-block: 0;
}

.sdtm-p21-workbench .p21-body > .sdtm-validation-evidence > summary {
    padding-block: 0;
}

.sdtm-p21-workbench .p21-body > .sdtm-validation-evidence > summary > sp-status-light {
    min-height: 0;
    padding-block: 0;
}

.sdtm-validation-metrics.sdtm-p21-finding-evidence {
    --wc-ui-metric-item-flex: 1 1 9rem;
}

.sdtm-p21-assessment-choices {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
}

.sdtm-p21-comparison-dialog,
.sdtm-p21-comparison-metadata {
    display: grid;
    gap: .5rem;
    min-width: 0;
}

.sdtm-p21-comparison-grid {
    height: clamp(16rem, 40vh, 24rem);
    min-width: 0;
}

.sdtm-p21-comparison-grid .ag-cell-wrap-text {
    white-space: pre-line;
    line-height: 1.4;
    padding-block: .375rem;
}

@media (max-width: 40rem) {
    .sdtm-p21-assessment-choices {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Keep the report's height chain definite; the tab clips content outside its slot. */
.sdtm-p21-workbench > .wc-structured-panel-content {
    flex: 1 1 auto;
    height: auto;
    overflow: hidden;
}

.sdtm-p21-workbench .wc-ui-loading-layout,
.sdtm-p21-workbench .wc-ui-loading-layout-content,
.sdtm-p21-workbench .wc-ui-loading-layout-content > .wc-ui-vertical-panel {
    height: 100%;
    min-height: 0;
}

.sdtm-p21-workbench .p21-grid-pane,
.sdtm-p21-workbench .sdtm-p21-findings {
    min-height: 0;
}

.sdtm-p21-workbench .sdtm-p21-findings > .app-grid-page-surface {
    flex: 1 1 0;
    height: auto;
    min-height: 0;
}

.sdtm-p21-workbench .p21-body {
    gap: .25rem;
    padding-block: 0;
}

.sdtm-guide-source-pickers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
    gap: .5rem;
}

.sdtm-guide-source-pickers > nph-combobox,
.sdtm-guide-source-pickers > nph-input {
    min-width: 0;
    width: 100%;
    --input-max-width: 100%;
}

.sdtm-guide-source-pickers > .sdtm-guide-section-help {
    grid-column: 1 / -1;
}

/* Report facts and review workflow use distinct compact groups. */
.sdtm-p21-details .sdtm-p21-report-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
    gap: .875rem;
    align-items: stretch;
}

.sdtm-p21-metric-group {
    min-inline-size: 0;
    padding: 1rem;
    border: 1px solid var(--nwc-ui-border);
    border-top: 3px solid var(--nwc-accent-active);
    border-radius: 12px;
    background: var(--nwc-ui-surface);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.sdtm-p21-metric-group[hidden] {
    display: none;
}

.sdtm-p21-metric-group-title {
    margin-bottom: .75rem;
    font-size: 14px;
    font-weight: 600;
}

.sdtm-p21-details .sdtm-p21-metric-group .wc-ui-metric-strip {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: .75rem;
}

.sdtm-p21-metric-group .sdtm-validation-metrics {
    --wc-ui-metric-item-display: grid;
    --wc-ui-metric-item-columns: minmax(0, 1fr) auto;
    --wc-ui-metric-item-align: baseline;
    --wc-ui-metric-item-gap: .75rem;
    --wc-ui-metric-padding: 0;
    --wc-ui-metric-label-color: var(--nwc-ui-text);
    --wc-ui-metric-label-size: 14px;
    --wc-ui-metric-label-weight: 400;
    --wc-ui-metric-label-overflow-wrap: anywhere;
    --wc-ui-metric-value-size: 16px;
    --wc-ui-metric-value-text-align: end;
}

.sdtm-guide-document-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.sdtm-guide-file-metadata {
    min-inline-size: 0;
}

.sdtm-guide-file-name {
    font-size: 16px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.sdtm-guide-file-date {
    margin-top: .375rem;
    font-size: 14px;
    color: var(--nwc-ui-text-muted);
}

.sdtm-guide-file-title {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* ═══════════════════════════════════════════════════════════════════════
   CAI-499 Study Documents — a protocol's CSR sections tab
   ═══════════════════════════════════════════════════════════════════════ */

.protocol-sections {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.protocol-sections-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
}

.protocol-sections-intro {
    flex-basis: 100%;
    margin: 0;
    color: var(--cai-body);
}

.protocol-sections-source {
    color: var(--cai-muted);
    font-size: 0.875rem;
}

.protocol-sections-problem {
    flex-basis: 100%;
    color: var(--cai-err);
}

.protocol-sections-table {
    display: grid;
    grid-template-columns: minmax(min-content, 1fr) minmax(8rem, 2.5fr) auto auto auto;
    column-gap: 0.75rem;
    overflow-x: auto;
}

/* Rows share the table's columns (subgrid), so the header lines up with rows whose actions differ. */
.protocol-sections-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
    padding: 0.5rem 0.25rem;
    border-bottom: 0.0625rem solid var(--cai-rule);
}

.protocol-sections-row--header {
    color: var(--cai-muted);
    font-size: 0.8125rem;
    font-weight: 600;
}

.protocol-sections-cell--muted {
    color: var(--cai-muted);
}

.protocol-sections-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
}

.protocol-section-status {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: var(--nwc-radius-full);
    font-size: 0.8125rem;
    border: 0.0625rem solid currentColor;
}

.protocol-section-status--proposed {
    color: var(--cai-warn);
}

.protocol-section-status--confirmed {
    color: var(--cai-ok);
}

.protocol-section-status--not-found {
    color: var(--cai-err);
}

.protocol-section-modal {
    --modal-initial-width: min(90vw, 48rem);
}

.protocol-section-dialog {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

/* sas2r wizard: sas-run/convert/compare */

.project-sas2r-ide {
    display: flex;
    flex-direction: row;
    gap: 0;
    height: 99%;
    background: var(--surface-card, var(--nwc-ui-surface));
    border: 0.0625rem solid var(--border-default, #dde3ec);
    border-radius: 0.5rem;
    overflow: hidden;
}

.project-sas2r-ide-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.project-sas2r-ide-side {
    width: 40rem;
    flex-shrink: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-left: 0.0625rem solid var(--border-default, #dde3ec);
}

.project-sas2r-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    flex-shrink: 0;
    min-height: 3.5rem;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
}

.project-sas2r-toolbar > nph-combobox {
    min-width: 24rem;
}

.project-sas2r-toolbar-hint {
    flex-shrink: 0;
    padding: 0.25rem 0.75rem 0;
}

.project-sas2r-spacer {
    flex: 1;
}

.project-sas2r-muted {
    color: var(--cai-muted, var(--nwc-text-secondary));
    font-size: 0.75rem;
}

.project-sas2r-mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.project-sas2r-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.0625rem 0.5rem;
    border-radius: var(--nwc-radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    background: var(--cai-hover, var(--nwc-ui-surface-soft));
}

.project-sas2r-chip.is-ok {
    color: var(--cai-ok, #1d9e75);
    background: var(--nwc-success-subtle);
}

.project-sas2r-chip.is-warn {
    color: var(--cai-warn, #b45309);
    background: var(--nwc-warning-subtle);
}

.project-sas2r-chip.is-error {
    color: var(--cai-err, #c0322b);
    background: var(--nwc-error-subtle);
}

.project-sas2r-chip.is-running {
    color: var(--cai-text-info);
    background: var(--nwc-info-subtle);
}

.project-sas2r-chip.is-final {
    color: var(--cai-text-info);
    background: var(--nwc-info-subtle);
}

.project-sas2r-banner {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.75rem;
    margin: 0.5rem 0.75rem 0;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--cai-body, var(--nwc-text-primary));
    background: var(--cai-inset, var(--nwc-ui-surface-soft));
    border: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
}

.project-sas2r-banner.is-warn {
    background: var(--nwc-warning-subtle);
    border-color: #f5d9b0;
}

.project-sas2r-banner.is-error {
    background: var(--nwc-error-subtle);
    border-color: #f1c4c1;
}

.project-sas2r-banner.is-ok {
    background: var(--nwc-success-subtle);
    border-color: #bfe6d6;
}

.project-sas2r-banner.is-info,
.project-sas2r-banner.is-running {
    background: var(--nwc-info-subtle);
    border-color: #bcd0f3;
}

.project-sas2r-code-status {
    flex-shrink: 0;
    margin: 0.75rem;
    color: var(--cai-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.project-sas2r-code-mount {
    flex: 1;
    min-height: 24rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--nwc-ui-surface-soft);
}

.project-sas2r-code-mount > .wc-ui-code-editor {
    border: 0 !important;
    border-radius: 0 !important;
}

.project-sas2r-code-editor {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.project-sas2r-code-editor .wc-ui-code-editor-host {
    flex: 1;
    min-height: 0;
    width: 100%;
    height: 100%;
}

.project-sas2r-meta-strip {
    display: flex;
    flex-wrap: nowrap;
    justify-content: safe center;
    align-items: stretch;
    overflow-x: auto;
    padding: 0.625rem 0.75rem;
    border-bottom: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
    background: var(--cai-inset, var(--nwc-ui-surface-soft));
}

.project-sas2r-meta-item {
    display: inline-flex;
    flex: 0 0 auto;
    flex-direction: column;
    align-items: center;
    gap: 0.125rem;
    padding: 0 1.25rem;
    text-align: center;
}

.project-sas2r-meta-item + .project-sas2r-meta-item {
    border-left: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
}

.project-sas2r-meta-item .project-sas2r-muted {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.project-sas2r-meta-value {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--cai-ink, #111827);
    white-space: nowrap;
}

.project-sas2r-flagbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--nwc-warning-subtle);
    border-bottom: 0.0625rem solid #f5d9b0;
    font-size: 0.8125rem;
}

.project-sas2r-flagbar.is-clear {
    background: var(--nwc-success-subtle);
    border-bottom-color: #bfe6d6;
}

.project-sas2r-flagbar-text {
    font-weight: 600;
}

.project-sas2r-flag-detail {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--cai-muted, var(--nwc-text-secondary));
    border-bottom: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
}

.project-sas2r-flag-detail.is-open {
    color: var(--cai-warn, #b45309);
}

.project-sas2r-flag-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.project-sas2r-flag-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
    border-radius: 0.375rem;
    cursor: pointer;
}

.project-sas2r-flag-item.is-selected {
    border-color: rgb(0, 137, 123);
    box-shadow: inset 0.1875rem 0 0 rgb(0, 137, 123);
}

.project-sas2r-flag-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.project-sas2r-flag-line {
    font-size: 0.75rem;
    font-weight: 600;
}

.project-sas2r-flag-message,
.project-sas2r-flag-note {
    font-size: 0.8125rem;
}

.project-sas2r-flag-note {
    font-style: italic;
}

.project-sas2r-run-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.project-sas2r-run-panel > nph-tab-panel.project-sas2r-run-tabs {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    --content-padding: 0;
    padding-top: 0.3rem;
}

.project-sas2r-run-tab-body {
    flex: 1;
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-sas2r-run-tab-body > nph-log-viewer-panel {
    flex: 1;
    min-height: 0;
}

.project-sas2r-run-history {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.project-sas2r-run-history-grid {
    --ag-wrapper-border: 0;
    --ag-wrapper-border-radius: 0;
}

.project-sas2r-run-history-grid .ag-header-cell-text,
.project-sas2r-run-history-grid .ag-header-cell-label {
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-sas2r-run-history-grid .ag-header-cell:is([col-id="revision"], [col-id="duration"], [col-id="final"]),
.project-sas2r-run-history-grid .ag-cell:is([col-id="revision"], [col-id="duration"], [col-id="final"]) {
    padding-inline: 0.375rem;
}

.project-sas2r-run-history-grid .ag-row.project-sas2r-run-row--active {
    box-shadow: inset 0.1875rem 0 0 rgb(0, 137, 123);
}

.project-sas2r-run-history-grid .ag-row.project-sas2r-run-row--active .ag-cell {
    background: rgba(0, 137, 123, 0.06);
}

.project-sas2r-run-icon {
    color: var(--cai-muted, var(--nwc-text-secondary));
}

.project-sas2r-run-icon.is-ok {
    color: #1b7f4b;
}

.project-sas2r-run-icon.is-warn {
    color: #b45309;
}

.project-sas2r-run-icon.is-failed {
    color: #b42318;
}

.project-sas2r-run-icon.is-running {
    color: #1e5fd0;
}

.project-sas2r-run-icon.is-final {
    color: #5b21b6;
}

.project-sas2r-run-cell-id {
    font-weight: 600;
}

.project-sas2r-run-external-id {
    font-size: 0.6875rem;
    color: var(--cai-muted, var(--nwc-text-secondary));
    overflow-wrap: anywhere;
}

.project-sas2r-run-text-note {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    color: var(--cai-warn, #b45309);
}

.project-sas2r-run-results {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
}

.project-sas2r-run-summary {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-sas2r-section-title {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 0.25rem;
}

.project-sas2r-run-messages {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.8125rem;
}

.project-sas2r-run-messages.is-error {
    background: var(--nwc-error-subtle);
}

.project-sas2r-run-messages.is-warn {
    background: var(--nwc-warning-subtle);
}

.project-sas2r-run-message {
    white-space: pre-wrap;
    word-break: break-word;
}

.project-sas2r-program-notes {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
    font-size: 0.8125rem;
}

.project-sas2r-program-summary {
    font-weight: 600;
}

.project-sas2r-program-note {
    white-space: pre-wrap;
    word-break: break-word;
}

.project-sas2r-check--blocker {
    color: var(--nwc-danger);
}

.project-sas2r-output-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
    border-radius: 0.5rem;
}

.project-sas2r-output-kind {
    min-width: 2.5rem;
    padding: 0.25rem 0.375rem;
    border-radius: 0.25rem;
    text-align: center;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--cai-text-info);
    background: var(--nwc-info-subtle);
}

.project-sas2r-output-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.project-sas2r-output-name {
    font-weight: 600;
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-sas2r-empty {
    padding: 1rem 0.75rem;
    font-size: 0.8125rem;
    color: var(--cai-muted, var(--nwc-text-secondary));
}

.project-sas2r-note-context {
    font-size: 0.8125rem;
    color: var(--cai-muted, var(--nwc-text-secondary));
}

.project-sas2r-compare-step {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

.project-sas2r-compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-sas2r-compare-reference {
    font-size: 0.8125rem;
    color: var(--cai-body, var(--nwc-text-primary));
}

.project-sas2r-compare-actions,
.project-sas2r-compare-detail-actions {
    display: flex;
    gap: 0.5rem;
}

.project-sas2r-compare-missing {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border: 0.0625rem dashed var(--cai-rule-strong, #d1d5db);
    border-radius: 0.5rem;
    background: var(--cai-inset, var(--nwc-ui-surface-soft));
}

.project-sas2r-compare-missing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.875rem;
}

.project-sas2r-compare-content {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}

.project-sas2r-compare-grid {
    min-height: 16rem;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.project-sas2r-compare-detail {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border: 0.0625rem solid var(--cai-rule, var(--nwc-ui-border));
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.project-sas2r-compare-detail .project-sas2r-banner {
    margin: 0;
}

.project-sas2r-publish > .project-sas2r-banner {
    margin: 0 0 1rem;
}

.project-sas2r-compare-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.project-sas2r-compare-rendered {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Project Knowledge Graph host (renderer: /wc/knowledge-graph.js) */
.project-knowledge-graph-host {
    position: relative;
    height: calc(100vh - 220px);
    min-height: 480px;
    overflow: hidden;
    border-radius: 12px;
    background: var(--nwc-ui-surface);
}

.adam-p21-history-tab,
.adam-p21-historical-report,
.adam-p21-findings-tab {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.75rem;
}

.adam-program-compare-label {
    font-weight: 700;
}

.adam-program-compare-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    padding-block: 0.25rem;
}

.adam-program-version-download,
.adam-program-version-expand {
    --nwc-button-border-color: transparent;
}

.adam-program-compare-navigation {
    --nwc-button-min-width: 2rem;
    --nwc-button-min-height: 2rem;
    --nwc-button-icon-only-padding: 0;
    --nwc-button-color: var(--text-secondary, #64748b);
    --nwc-button-border-color: transparent;
}

.adam-program-history-toolbar,
.adam-p21-history-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.adam-p21-history-readonly {
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.adam-p21-finding-toolbar,
.adam-program-history-toolbar,
.adam-p21-history-toolbar {
    margin-block: 0.75rem;
}

.adam-p21-finding-toolbar {
    justify-content: flex-start;
}

.adam-p21-finding-toolbar > * {
    min-width: 10rem;
}

.adam-p21-history-tab,
.adam-p21-findings-tab {
    gap: 0;
}

.adam-program-history-selection-cell,
.adam-p21-history-selection-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.adam-program-history-selection-cell > *,
.adam-p21-history-selection-cell > * {
    display: flex;
    align-items: center;
}

.adam-p21-files-tab {
    min-width: 0;
    padding-block: 0.75rem;
}

.adam-p21-report-file,
.adam-p21-report-file > nph-download-card {
    display: block;
    width: 100%;
}

.adam-p21-report-file[inert] {
    opacity: 0.55;
}

.adam-p21-files-empty {
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
}

.adam-p21-history-run-link {
    --button-padding: 0;
    --button-min-width: 0;
    --button-min-height: auto;
    color: var(--nwc-accent, #0f8b69);
    text-decoration: underline;
    text-underline-offset: 0.125rem;
    vertical-align: middle;
}


.adam-initial-load-surface {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

/* Keep grids connected and measurable while LoadingLayout protects their content. */
.adam-initial-load-surface > .wc-ui-loading-layout-content,
.adam-initial-load-surface > .wc-ui-loading-layout-content[hidden] {
    display: flex !important;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
}

.adam-initial-load-surface > .wc-ui-loading-layout-content[hidden] {
    visibility: hidden;
    /* AgGrid header icons explicitly override inherited visibility. */
    opacity: 0;
    pointer-events: none;
}

.adam-initial-load-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    gap: 0.75rem;
}

.adam-variable-detail-page .adam-initial-load-content > .wc-structured-panel-content {
    flex: 1 1 auto;
    height: auto;
    overflow-y: auto;
}

.adam-initial-load-surface > .wc-ui-loading-layout-view,
.adam-initial-load-error {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
}

.adam-initial-load-error {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adam-initial-load-surface[data-retained-content="true"] > .wc-ui-loading-layout-view {
    z-index: 10;
    background: color-mix(in srgb, var(--surface-card, var(--nwc-ui-surface)) 65%, transparent);
}

/* CSR Authoring: a study has a handful of reports, so the reports grid keeps a short height (a few rows, capped)
   and the versions grid takes the rest of the page. The versions card is a flex column so its grid shell gets a
   definite height (the generic shell rule only applies to direct flex children of the surface). */
.csr-authoring-surface.app-grid-page-surface > .app-grid-page-grid-shell {
    flex: 0 0 auto;
    height: clamp(12rem, 30vh, 22rem);
    min-height: 12rem;
}

.csr-authoring-surface.app-grid-page-surface > .csr-authoring-versions {
    flex: 1 1 0;
    min-height: 16rem;
    display: flex;
    flex-direction: column;
}

.csr-authoring-surface.app-grid-page-surface > .csr-authoring-versions > .app-grid-page-grid-shell {
    flex: 1 1 0;
    height: auto;
    min-height: 10rem;
}

.csr-authoring-surface.app-grid-page-surface > .csr-authoring-versions[hidden],
.csr-authoring-surface.app-grid-page-surface > .app-grid-page-grid-shell[hidden] {
    display: none;
}

/* CSR Authoring — a report's sources (SRC-06), the next version against the last (VER-02), and the New CSR wizard's
   AI pins line. The sources table has a handful of rows, so it is a plain grid rather than a data grid. */
.csr-authoring-wizard-attest {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background: var(--cai-inset);
    color: var(--cai-body);
    font-size: 0.875rem;
}

.csr-sources {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.csr-sources[hidden] {
    display: none;
}

.csr-sources-muted {
    margin: 0;
    color: var(--cai-muted);
    font-size: 0.875rem;
}

.csr-sources-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.csr-sources-title {
    margin: 0;
    flex: 1 1 auto;
}

.csr-sources-actions {
    display: flex;
    gap: 0.5rem;
}

.csr-sources-content {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

.csr-sources-table {
    display: grid;
    grid-template-columns: minmax(10rem, 1.2fr) minmax(7rem, 1fr) max-content minmax(12rem, 2fr)
        minmax(10rem, 1.5fr) minmax(8rem, 1fr);
    overflow-x: auto;
}

.csr-sources-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: start;
    border-bottom: 0.0625rem solid var(--cai-rule);
}

.csr-sources-table > .csr-sources-row:last-child {
    border-bottom: 0;
}

.csr-sources-table .csr-sources-cell {
    min-width: 0;
    padding: 0.625rem 0.75rem;
    font-size: inherit;
}

.csr-sources-row--header {
    background: var(--cai-hover, var(--nwc-ui-surface-soft));
    color: var(--cai-muted);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.csr-sources-table .csr-sources-cell > strong {
    font-weight: 600;
}

.csr-sources-table .csr-sources-row--header > .csr-sources-cell,
.csr-sources-table .csr-pill {
    font-size: 0.875em;
}

.csr-sources-cell.csr-sources-cell--mono {
    font-family: var(--csr-mono, var(--nwc-font-mono, monospace));
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

.csr-sources-origin,
.csr-sources-subline {
    margin: 0.125rem 0 0;
    color: var(--cai-muted);
    font-size: 0.8125rem;
}

.csr-pill.csr-pill--source-ok {
    background: var(--csr-ok-soft, var(--cai-duck-soft));
    color: var(--csr-ok, var(--cai-ok));
}

.csr-pill.csr-pill--source-bad {
    background: var(--csr-bad-soft, var(--cai-rest-soft));
    color: var(--csr-bad, var(--cai-err));
}

.csr-pill.csr-pill--source-warning {
    background: var(--csr-ai-soft, var(--nwc-warning-subtle));
    color: var(--csr-ai, var(--cai-warn));
}

.csr-pill.csr-pill--source-neutral {
    background: var(--csr-none-soft, var(--cai-hover));
    color: var(--csr-none, var(--cai-muted));
}

.csr-pill.csr-pill--source-info {
    background: var(--csr-review-soft, var(--cai-fs-soft));
    color: var(--csr-review, var(--cai-fs));
}

.csr-sources-table .csr-sources-row:not(.csr-sources-row--header) > .csr-sources-cell:nth-child(5) {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem 0.75rem;
}

.csr-sources-needs--action {
    color: var(--nwc-accent);
}

.csr-sources-needs-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--nwc-accent-on-light, var(--nwc-accent));
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-align: start;
}

.csr-sources-needs-link:hover {
    text-decoration: underline;
}

.csr-sources-needs-link.csr-sources-problem {
    color: var(--cai-err);
}

.csr-sources-needs-link.csr-sources-warning {
    color: var(--cai-warn);
}

.csr-sources-status-button {
    border: 0;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.csr-recon-table {
    display: grid;
    grid-template-columns: minmax(6rem, 0.8fr) minmax(8rem, 1.4fr) minmax(6rem, 0.8fr) minmax(8rem, 1fr)
        minmax(8rem, 1.2fr);
    column-gap: 0.75rem;
    overflow-x: auto;
}

.csr-sources-change-detail {
    margin-inline-start: 0.35rem;
}

.csr-sources-row--focus {
    animation: csr-sources-row-focus 2s ease-out;
}

@keyframes csr-sources-row-focus {
    from {
        background: var(--nwc-warning-subtle);
    }
    to {
        background: transparent;
    }
}

.csr-sources-problem {
    color: var(--cai-err);
}

.csr-sources-warning {
    color: var(--cai-warn);
}

.csr-sources-info {
    color: var(--cai-info, var(--cai-muted));
}

.csr-sources-banners {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.csr-sources-banner {
    --nwc-inline-padding: 0.75rem 1rem;
    --nwc-inline-border: 0.0625rem solid var(--cai-rule);
    --nwc-inline-radius: 0.625rem;
    --nwc-inline-color: var(--nwc-text-primary, inherit);
    margin: 0;
}

.csr-sources-banner--list {
    --nwc-inline-padding: 0.75rem 1rem 0.75rem 2rem;
}

.csr-sources-banner--list > .csr-sources-list {
    padding-inline-start: 0;
}

.csr-sources-banner.csr-sources-warning {
    --nwc-inline-background: var(--nwc-warning-subtle);
    --nwc-inline-border: 0.0625rem solid color-mix(in srgb, var(--cai-warn) 35%, transparent);
}

.csr-sources-banner.csr-sources-problem {
    --nwc-inline-background: var(--csr-bad-soft, var(--cai-rest-soft));
    --nwc-inline-border: 0.0625rem solid color-mix(in srgb, var(--cai-err) 30%, transparent);
}

.csr-sources-banner.csr-sources-info {
    --nwc-inline-background: var(--csr-review-soft, var(--cai-fs-soft));
    --nwc-inline-border: 0.0625rem solid color-mix(in srgb, var(--cai-fs) 25%, transparent);
}

.csr-sources-banner > strong {
    display: block;
    margin-bottom: 0.125rem;
}

.csr-sources-banner .csr-sources-problem,
.csr-sources-banner .csr-sources-info {
    margin: 0;
    color: inherit;
}

.csr-sources-banner:not(.csr-sources-banner--list) > .csr-sources-list {
    margin-top: 0.375rem;
}

.csr-sources-details {
    margin-top: 0.25rem;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
}

.csr-sources-srcpick {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.csr-sources-list {
    margin: 0;
    padding-left: 1.25rem;
}

.csr-sources-pickers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: 0.75rem;
}

.csr-sources-evidence {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.125rem;
    align-items: start;
}

@media (min-width: 960px) {
    .csr-sources-evidence:has(> :nth-child(2)) {
        grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
    }
}

.csr-sources-evidence[hidden] {
    display: none;
}

.csr-sources-evidence > .wc-ui-card {
    --wc-ui-card-title-size: 1.0625rem;
    --wc-ui-card-header-padding: 1rem 1.125rem;
    --wc-ui-card-header-background: transparent;
    --wc-ui-card-body-padding: 1rem 1.125rem;
}

.csr-sources-evidence > .wc-ui-card:has(.csr-sources-changes) {
    --wc-ui-card-body-padding: 0;
}

.csr-sources-coverage {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.csr-sources-coverage > .csr-sources-muted {
    margin-bottom: 0.5rem;
    color: inherit;
    font-size: inherit;
}

.csr-sources-coverage-row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 0.875rem;
}

.csr-sources-coverage-row > :first-child {
    color: var(--cai-muted);
}

.csr-sources-changes {
    display: grid;
    grid-template-columns: max-content minmax(10rem, 1.6fr) minmax(6rem, 1fr);
}

.csr-sources-changes .csr-sources-cell {
    min-width: 0;
    padding: 0.625rem 0.75rem;
}

.csr-sources-changes .csr-sources-row--header > .csr-sources-cell {
    font-size: 0.875em;
}

.csr-sources-changes > .csr-sources-row:last-child {
    border-bottom: 0;
}

.csr-sources-changes .csr-sources-cell > p {
    margin: 0;
}

.csr-sources-evidence-bad {
    color: var(--csr-bad);
}

.csr-generate-dialog-list {
    margin: 0.25rem 0 0.75rem;
    padding-left: 1.25rem;
}

.csr-generate-dialog-warnings {
    color: var(--cai-warn);
}

.core-config-ai-csr-prompt-package-warning,
.core-config-ai-csr-prompt-package-problem,
.core-config-ai-participant-data-problem {
    color: var(--cai-warn);
}

.core-config-ai-participant-data-set-by {
    color: var(--cai-muted);
}

/* CSR Authoring — the panel beside the selected section: comments, revision history and who is editing it
   (CSR-EDT-05, 07, 08). The draft's section list and page make room for it as a third column. */
.csr-draft-layout:has(> .csr-editor-panel) {
    grid-template-columns: 18rem minmax(0, 1fr) 22.5rem;
}

@media (max-width: 80rem) {
    .csr-draft-layout:has(> .csr-editor-panel) {
        grid-template-columns: 16rem minmax(0, 1fr);
    }

    .csr-draft-layout > .csr-editor-panel {
        grid-column: 1 / -1;
        position: static;
        max-height: none;
        border-left: 0;
        border-top: 0.0625rem solid var(--cai-rule);
    }
}

@media (max-width: 56rem) {
    .csr-draft-layout:has(> .csr-editor-panel) {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* CSR Authoring — the live document preview (CAI-573). Edit + preview shares the room between the editor and the panel;
   at 80rem and narrower, where the panel would drop below the page, the section list gives way instead. */
.csr-draft-layout[data-view="edit-preview"]:has(> .csr-editor-panel) {
    grid-template-columns: 18rem minmax(0, 1fr) minmax(0, 1fr);
}

.csr-draft-layout[data-view="edit-preview"] > .csr-editor-panel {
    height: 100cqh;
}

/* The editor has half the room here, so a field's label goes above its text box, not beside it. */
.csr-draft-layout[data-view="edit-preview"] .tlf-csr-block {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.25rem;
}

@media (max-width: 80rem) {
    .csr-draft-layout[data-view="edit-preview"]:has(> .csr-editor-panel) {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .csr-draft-layout[data-view="edit-preview"]:has(> .csr-editor-panel) > .csr-toc {
        display: none;
    }

    .csr-draft-layout[data-view="edit-preview"] > .csr-editor-panel {
        grid-column: auto;
        position: sticky;
        max-height: 100cqh;
        border-top: 0;
        border-left: 0.0625rem solid var(--cai-rule);
    }
}

.csr-author-view-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.csr-author-view-bar[data-view="preview"] {
    justify-content: flex-start;
}

.csr-editor-panel[data-preview] .csr-editor-body {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;
}

.csr-editor-preview-pane:not([hidden]) {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
}

.csr-doc-preview {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
}

.csr-doc-preview-note {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.875rem;
    border-bottom: 0.0625rem solid var(--cai-rule);
    color: var(--cai-muted);
    font-size: 0.8125rem;
}

.csr-doc-preview-no-contents {
    padding: 0.5rem 0.875rem;
    border-bottom: 0.0625rem solid var(--cai-rule);
    background: var(--nwc-warning-subtle);
    font-size: 0.8125rem;
}

.csr-doc-preview-scroller {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 1rem;
    background: var(--cai-inset);
}

.csr-draft-canvas > .csr-doc-preview > .csr-doc-preview-scroller {
    flex: none;
    max-height: calc(100vh - 18rem);
}

/* The document's own type, whatever the application's: as CsrDocxAssembler writes it. */
.csr-doc-preview-page {
    display: flow-root;
    padding: 2rem 2.25rem;
    border: 0.0625rem solid var(--cai-rule);
    background: var(--cai-card);
    color: var(--cai-ink);
    font-family: Calibri, Carlito, "Segoe UI", Arial, sans-serif;
    font-size: 0.9167rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.csr-doc-preview-section {
    margin-left: -0.75rem;
    margin-bottom: 1rem;
    padding: 0 0 0 0.5rem;
    border: 0;
    border-left: 0.25rem solid transparent;
    border-radius: 0;
    background: none;
}

.csr-doc-preview-section[data-current] {
    border-left-color: var(--nwc-accent);
}

.csr-doc-preview-heading {
    margin: 0.75rem 0 0.375rem;
    color: var(--cai-ink);
    font-weight: 700;
}

.csr-doc-preview-heading[data-level="1"] {
    font-size: 1.3333rem;
}

.csr-doc-preview-heading[data-level="2"] {
    font-size: 1.0833rem;
}

.csr-doc-preview-heading[data-level="3"] {
    font-size: 1rem;
}

.csr-doc-preview-heading[data-level="4"],
.csr-doc-preview-heading[data-level="5"] {
    font-size: 0.9167rem;
}

.csr-doc-preview-heading[data-level="6"],
.csr-doc-preview-heading[data-level="7"],
.csr-doc-preview-heading[data-level="8"],
.csr-doc-preview-heading[data-level="9"] {
    font-size: 0.8333rem;
}

.csr-doc-preview-block ul,
.csr-doc-preview-block ol {
    margin: 0 0 0.5rem;
    padding-left: 1.5rem;
}

.csr-doc-preview-block ul {
    list-style-type: disc;
}

.csr-doc-preview-block ul ul {
    list-style-type: circle;
}

.csr-doc-preview-block ul ul ul {
    list-style-type: square;
}

.csr-doc-preview-block ol {
    list-style-type: decimal;
}

.csr-doc-preview-paragraph,
.csr-doc-preview-placeholder {
    margin-bottom: 0.5rem;
    white-space: pre-wrap;
}

/* An empty paragraph is a blank line in the Word document. */
.csr-doc-preview-paragraph:empty {
    min-height: 1.4em;
}

.csr-doc-preview-block li > .csr-doc-preview-paragraph {
    margin-bottom: 0.25rem;
}

.csr-doc-preview-label,
.csr-doc-preview-output-title {
    margin-bottom: 0.125rem;
    font-weight: 700;
}

.csr-doc-preview-placeholder {
    width: fit-content;
    background: var(--nwc-warning-subtle);
    font-style: italic;
}

.csr-doc-preview-contents-entry[data-depth="1"] {
    padding-left: 1rem;
}

.csr-doc-preview-contents-entry[data-depth="2"] {
    padding-left: 2rem;
}

.csr-doc-preview-contents-entry[data-depth="3"] {
    padding-left: 3rem;
}

.csr-doc-preview-contents-entry[data-depth="4"] {
    padding-left: 4rem;
}

.csr-doc-preview-contents-entry[data-depth="5"] {
    padding-left: 5rem;
}

.csr-doc-preview-contents-entry[data-depth="6"] {
    padding-left: 6rem;
}

.csr-doc-preview-table {
    margin-bottom: 0.5rem;
    border-collapse: collapse;
}

.csr-doc-preview-table th,
.csr-doc-preview-table td {
    padding: 0.25rem 0.5rem;
    border: 0.0625rem solid var(--cai-rule-strong);
    text-align: left;
    vertical-align: top;
}

.csr-doc-preview-table th {
    font-weight: 700;
}

.csr-doc-preview-table .csr-doc-preview-paragraph {
    margin-bottom: 0;
}

.csr-doc-preview-bold {
    font-weight: 700;
}

.csr-doc-preview-italic {
    font-style: italic;
}

.csr-doc-preview-underline {
    text-decoration: underline;
}

.csr-doc-preview-superscript {
    vertical-align: super;
    font-size: 0.75em;
}

.csr-doc-preview-subscript {
    vertical-align: sub;
    font-size: 0.75em;
}

/* Keeps its place while its table loads, so what is below does not jump as tables come in. */
.csr-doc-preview-block .csr-output-preview-content:empty {
    min-height: 6rem;
}

.csr-editor-panel {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    min-width: 0;
    max-height: 100cqh;
    border-left: 0.0625rem solid var(--cai-rule);
    background: var(--cai-card);
}

.csr-ws-tabs,
.csr-editor-tabs {
    --nwc-tabs-line-height: 1.7;
    --nwc-tabs-title-font-size: 1rem;
    --nwc-tabs-title-font-weight: 400;
    --nwc-tabs-title-line-height: 1.7;
    --nwc-tabs-active-color: var(--nwc-accent-active, var(--nwc-accent));
    --nwc-tabs-active-border-color: var(--nwc-accent);
    --nwc-tabs-badge-min-inline-size: 0;
    --nwc-tabs-badge-block-size: auto;
    --nwc-tabs-badge-font-size: .6875rem;
    --nwc-tabs-badge-font-weight: 400;
    --nwc-tabs-badge-line-height: 1.7;
}

/* Six tabs share the narrow rail: each keeps its natural width, and the bar scrolls rather than overlap them. */
.csr-editor-tabs {
    flex: none;
    --nwc-tabs-title-font-size: .8125rem;
    --nwc-tabs-nav-gap: .375rem;
    --nwc-tabs-nav-overflow-x: auto;
    --nwc-tabs-nav-position: static;
    --nwc-tabs-button-position: static;
    --nwc-tabs-nav-border: .0625rem solid var(--cai-rule);
    --nwc-tabs-button-margin-block-end: 0;
    --nwc-tabs-padding: .6875rem .25rem;
    --nwc-tabs-font-size: .78125rem;
    --nwc-tabs-font-weight: 600;
    --nwc-tabs-active-font-weight: 600;
    --nwc-tabs-color: var(--cai-muted);
    --nwc-tabs-hover-color: var(--cai-muted);
    --nwc-tabs-hover-border-color: transparent;
    --nwc-tabs-hover-text-shadow: none;
    --nwc-tabs-badge-radius: 0;
    --nwc-tabs-badge-padding: 0;
    --nwc-tabs-badge-background: transparent;
    --nwc-tabs-badge-color: var(--cai-muted);
}

.csr-editor-body {
    flex: 1;
    overflow: auto;
    padding: 0.875rem;
}

.csr-editor-filters,
.csr-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 0.625rem;
    align-items: center;
}

.csr-editor-actions.csr-source-line {
    flex-wrap: nowrap;
}

.csr-source-line > .csr-source-fields {
    flex: 1 1 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

.csr-source-line > :not(.csr-source-fields) {
    flex: none;
}

.csr-editor-pane,
.csr-editor-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.csr-editor-message,
.csr-editor-note,
.csr-comment-meta {
    font-size: 0.78125rem;
    color: var(--cai-muted);
}

.csr-comment-thread,
.csr-revision {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding: 0.625rem 0.75rem;
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.5rem;
    font-size: 0.8125rem;
}

.csr-comment-thread[data-status="RESOLVED"] {
    opacity: 0.7;
}

.csr-revision[data-focused],
.csr-comment-thread[data-focused] {
    border-color: var(--cai-rule-strong);
    background: var(--cai-inset);
}

.csr-mention-list {
    display: flex;
    flex-direction: column;
    border: 0.0625rem solid var(--cai-rule);
    border-radius: 0.375rem;
    background: var(--cai-card);
}

.csr-mention-option {
    padding: 0.25rem 0.5rem;
    border: 0;
    background: none;
    color: var(--cai-ink);
    font-size: 0.8125rem;
    text-align: left;
    cursor: pointer;
}

.csr-mention-option:hover,
.csr-mention-option[aria-selected="true"] {
    background: var(--cai-hover);
}

.csr-comment {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.csr-comment-reply {
    margin: 0.25rem 0 0 0.875rem;
    padding-left: 0.625rem;
    border-left: 0.125rem solid var(--cai-rule);
}

.csr-comment-who {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.csr-av.wc-ui-avatar {
    --wc-ui-avatar-size: 1.5rem;
    --wc-ui-avatar-font-size: 0.625rem;
    --wc-ui-avatar-font-weight: 700;
    --wc-ui-avatar-background: var(--cai-body);
    --wc-ui-avatar-color: var(--cai-card);
    --wc-ui-avatar-border-width: 0;
    --wc-ui-avatar-border-color: currentColor;
    display: grid;
    flex: none;
    place-items: center;
    justify-content: normal;
    user-select: auto;
    unicode-bidi: normal;
    border-style: none;
}

.csr-comment-name {
    font-weight: 700;
}

.csr-comment-time {
    font-size: 0.71875rem;
    color: var(--cai-muted);
}

.csr-comment-body {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.csr-comment-quote {
    padding: 0.125rem 0.5rem;
    border-left: 0.1875rem solid color-mix(in srgb, var(--cai-warn) 50%, transparent);
    color: var(--cai-muted);
    font-family: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
    overflow-wrap: anywhere;
}

.csr-comment-quote--link {
    display: block;
    width: 100%;
    border-top: 0;
    border-right: 0;
    border-bottom: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.csr-comment-quote--link:hover,
.csr-comment-quote--link:focus-visible {
    color: var(--cai-body);
}

.csr-comment-orphaned {
    font-size: 0.78125rem;
    color: var(--cai-warn);
}

.csr-comment-box {
    align-self: flex-start;
}

.csr-comment-box.csr-comment-box--link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    cursor: pointer;
}

.csr-comment-composer {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    padding-top: 0.625rem;
    border-top: 0.0625rem solid var(--cai-rule);
}

.csr-revision-title {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    font-weight: 600;
}

/* Someone else is editing the section: one line with their initials, since when, and Take over editing. */
.csr-editor-banner {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: var(--cai-fs-soft);
    color: color-mix(in srgb, var(--cai-fs) 65%, var(--cai-ink));
    font-size: 0.8125rem;
}

.csr-editor-banner-text {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* A section someone else is editing: its list entry shows a blue dot (unsaved edits keep the accent one) and names
   them on hover. */
.csr-toc-item[data-editing] .csr-toc-title {
    font-style: italic;
}

.csr-toc-item[data-editing]:not([data-dirty]) .csr-toc-dirty {
    background: var(--cai-fs);
}

.csr-redline {
    --wc-ui-text-diff-insert-background: var(--cai-duck-soft);
    --wc-ui-text-diff-insert-color: color-mix(in srgb, var(--cai-ok) 65%, var(--cai-ink));
    --wc-ui-text-diff-delete-background: var(--cai-rest-soft);
    --wc-ui-text-diff-delete-color: color-mix(in srgb, var(--cai-err) 65%, var(--cai-ink));
}

/* CSR draft: what a writer had typed in a field someone else saved meanwhile, kept to copy back. */
.tlf-csr-set-aside {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.375rem;
    padding: 0.375rem 0.625rem;
    border: 0.0625rem dashed var(--cai-warn);
    border-radius: 0.375rem;
}

.tlf-csr-set-aside-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}

/* An author field's rich-text editor: its formatting toolbar above the text. */
.tlf-csr-rich {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.tlf-csr-rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
}

.tlf-csr-rich-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.125rem;
}

.tlf-csr-rich-group:not(:last-child) {
    padding-right: 0.5rem;
    border-right: 0.0625rem solid var(--cai-rule);
}

.tlf-csr-rich-group[hidden] {
    display: none;
}

/* Icons in ink, as in Word; a style that cannot apply is a muted icon, not a grey tile. */
.tlf-csr-rich-button {
    --nwc-button-color: var(--cai-ink);
    --nwc-button-icon-only-padding: 0.375rem;
}

.tlf-csr-rich-button[disabled] {
    --nwc-button-color: var(--cai-muted);
    --nwc-raw-gray-50: transparent;
}

.tlf-csr-rich-style {
    width: 9.5rem;
}

.tlf-csr-rich-failed {
    color: var(--cai-err);
}

/* ADaM source viewers reserve their modal size before loading their content. */
.adam-program-compare-dialog .wc-ui-modal-card,
.adam-program-version-dialog .wc-ui-modal-card,
.adam-compare-report-dialog .wc-ui-modal-card {
    inline-size: 94vw;
    max-inline-size: 94vw;
    block-size: 90vh;
    block-size: 90dvh;
    max-block-size: 90vh;
    max-block-size: 90dvh;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.adam-program-version-dialog .wc-ui-modal-card {
    inline-size: 47vw;
    max-inline-size: 47vw;
}

.adam-program-compare-dialog.adam-program-compare-expanded .wc-ui-modal-card,
.adam-program-version-dialog.adam-program-version-expanded .wc-ui-modal-card,
.adam-compare-report-dialog.adam-compare-report-expanded .wc-ui-modal-card {
    inline-size: calc(100vw - 1rem);
    max-inline-size: calc(100vw - 1rem);
    block-size: calc(100vh - 1rem);
    block-size: calc(100dvh - 1rem);
    max-block-size: calc(100vh - 1rem);
    max-block-size: calc(100dvh - 1rem);
}

.adam-program-compare-dialog .wc-ui-modal-header,
.adam-program-version-dialog .wc-ui-modal-header,
.adam-compare-report-dialog .wc-ui-modal-header {
    flex: 0 0 auto;
    padding: 0.5rem 0.75rem;
    align-items: center;
}

.adam-program-compare-dialog .wc-ui-modal-controls,
.adam-program-compare-dialog .wc-ui-modal-actions,
.adam-program-version-dialog .wc-ui-modal-controls,
.adam-program-version-dialog .wc-ui-modal-actions,
.adam-compare-report-dialog .wc-ui-modal-controls,
.adam-compare-report-dialog .wc-ui-modal-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.adam-program-compare-dialog .wc-ui-modal-body,
.adam-program-compare-dialog .wc-ui-modal-body-wrap,
.adam-program-compare-dialog .wc-ui-modal-body-content,
.adam-program-version-dialog .wc-ui-modal-body,
.adam-program-version-dialog .wc-ui-modal-body-wrap,
.adam-program-version-dialog .wc-ui-modal-body-content,
.adam-compare-report-dialog .wc-ui-modal-body,
.adam-compare-report-dialog .wc-ui-modal-body-wrap,
.adam-compare-report-dialog .wc-ui-modal-body-content {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-block-size: 0;
    min-inline-size: 0;
    gap: 0;
}

.adam-program-compare-dialog .wc-ui-modal-body,
.adam-program-version-dialog .wc-ui-modal-body,
.adam-compare-report-dialog .wc-ui-modal-body {
    overflow: auto;
    padding: 0.5rem 0.75rem;
}

.adam-program-version-dialog .wc-ui-modal-footer,
.adam-compare-report-dialog .wc-ui-modal-footer {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    align-items: center;
    padding: 1rem 1.25rem;
}

.adam-program-version-dialog .wc-ui-modal-footer > .wc-ui-actions,
.adam-compare-report-dialog .adam-execution-stage-compare-report-footer {
    width: 100%;
    justify-content: flex-end;
}

.adam-program-compare-body,
.adam-program-version-body {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-block-size: 0;
    min-inline-size: 0;
}

.adam-program-compare-labels,
.adam-program-compare-details {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.adam-program-compare-pane {
    min-inline-size: 0;
}

.adam-program-compare-pane-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem;
}

.adam-program-compare-label,
.adam-program-compare-selector {
    font-weight: 600;
    min-inline-size: 0;
}

.adam-program-compare-label {
    overflow-wrap: anywhere;
}

.adam-program-compare-selector {
    display: flex;
    flex: 1 1 auto;
    --nwc-button-border-color: transparent;
    --nwc-button-min-height: 2rem;
    --nwc-button-padding: 0.25rem 0.5rem;
}

.adam-program-compare-icon {
    flex: 0 0 auto;
    --nwc-button-border-color: transparent;
    --nwc-button-min-width: 2rem;
    --nwc-button-min-height: 2rem;
    --nwc-button-icon-only-padding: 0;
    --nwc-button-color: var(--nwc-ui-text-muted, #64748b);
}

.adam-program-compare-metadata {
    color: var(--nwc-ui-text-muted, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-inline: 0.5rem;
}

.adam-program-compare-toolbar {
    padding-inline-start: 1.5rem;
    flex: 0 0 auto;
}

.adam-program-compare-loading-surface {
    min-block-size: 10rem;
}

.adam-program-version-loading-surface {
    flex: 1 1 auto;
    min-block-size: 0;
}

.adam-program-version-feedback {
    min-block-size: 1.5rem;
}

.adam-program-version-editor {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-block-size: 0;
    min-inline-size: 0;
}

.adam-program-version-editor > .wc-ui-code-editor {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 auto;
    min-block-size: 0;
    block-size: 100%;
}

.adam-program-version-editor .wc-ui-code-editor-host {
    flex: 1 1 auto;
    min-height: 0;
}

.adam-program-compare-editor {
    flex: 1 1 auto;
    min-block-size: 10rem;
    min-inline-size: 0;
    direction: ltr;
    border-block-start: 1px solid var(--nwc-ui-border);
}

.adam-program-compare-state {
    font-size: 0.875rem;
    color: var(--nwc-ui-text-muted, var(--nwc-text-secondary));
}

.adam-program-compare-details-side {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 800px) {
    .adam-program-version-dialog .wc-ui-modal-card {
        inline-size: 94vw;
        max-inline-size: 94vw;
    }

    .adam-program-compare-metadata {
        white-space: normal;
    }

    .adam-program-compare-dialog .wc-ui-modal-header,
    .adam-program-version-dialog .wc-ui-modal-header,
    .adam-compare-report-dialog .wc-ui-modal-header {
        flex-wrap: wrap;
    }
}

.admin-projects-wrapped-cell {
    display: flex;
    align-items: center;
    line-height: 1.5rem;
}

.admin-projects-wrapped-cell .wc-ag-col-clickable,
.admin-projects-wrapped-cell .wc-ag-col-id-string {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    max-block-size: 4.5rem;
    line-height: 1.5rem;
    white-space: normal;
    overflow: hidden;
    overflow-wrap: anywhere;
}

.kg-artifact-modal {
    --modal-initial-width: min(90vw, 96rem);
    --modal-min-width: min(62rem, 90vw);
}

.kg-artifact-body {
    height: 75vh;
    overflow: auto;
}

.kg-artifact-body > iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.kg-artifact-body > pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.cai-sdtm-run-section {
    min-width: 0;
    padding: .75rem;
}

.cai-sdtm-run-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .5rem;
}

.cai-sdtm-execute-modal {
    --modal-initial-width: min(30rem, 90vw);
    --modal-min-width: min(30rem, 90vw);
}

.cai-sdtm-execute-modal-intermediate-check {
    --label-width: 100%;
}

.cai-sdtm-execute-modal .cai-sdtm-snapshot-selector {
    --input-max-width: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.cai-sdtm-selected-snapshot {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: .875rem;
    margin-top: .5rem;
}

.cai-sdtm-run-inputs {
    padding: 0 .75rem .75rem;
    color: var(--nwc-text-muted);
    font-size: .875rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.cai-sdtm-execution-details-modal {
    --body-min-height: 0;
}

.cai-sdtm-run-body {
    box-sizing: border-box;
    height: min(42rem, calc(100dvh - 10rem));
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.cai-sdtm-run-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
}

.cai-sdtm-run-context {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    padding: .75rem;
}

.cai-sdtm-run-results,
.cai-sdtm-run-log-body {
    padding: .75rem;
}

.cai-sdtm-run-log-body {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: auto;
}

.cai-sdtm-run-log-body > .cai-sdtm-run-inputs,
.cai-sdtm-run-log-body > .cai-sdtm-run-downloads {
    flex-shrink: 0;
}

.cai-sdtm-run-log-body > nph-log-viewer-panel {
    flex: 1;
    min-height: 16rem;
    height: 0;
}

.cai-sdtm-run-results {
    display: grid;
    gap: .5rem;
}

.cai-sdtm-run-panel > nph-tab-panel {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    --content-padding: 0;
}

.cai-sdtm-run-history {
    height: 100%;
    min-height: 0;
}

.adam-working-publication-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.adam-working-publication-details > h3 {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    color: var(--nwc-text-primary);
}

.adam-working-snapshot-metadata-error {
    color: var(--nwc-danger, #b91c1c);
}

/* AI draft execution history belongs to the selected generated program; the panel itself is .adam-prog-run-panel. */
.adam-ai-program-workspace {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.adam-ai-program-workspace > .adam-ai-program-program-view {
    min-width: 0;
    border: 0;
    border-radius: 0;
}

.adam-ai-program-workspace--run-panel-max > .adam-ai-program-program-view {
    display: none;
}

@media (max-width: 68rem) {
    .adam-ai-program-workspace {
        flex-direction: column;
        overflow: auto;
    }

    .adam-ai-program-workspace > .adam-prog-run-panel {
        flex: 0 0 22rem;
        width: 100%;
        border-left: 0;
        border-top: 0.0625rem solid var(--border-default, #dde3ec);
    }

    .adam-ai-program-workspace > .adam-prog-run-panel > .adam-prog-run-panel-tools {
        display: none;
    }
}

.adam-ai-program-run-details {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: baseline;
    gap: 1rem 1.5rem;
    margin: 0;
}

.adam-ai-program-run-details > dt {
    color: var(--sdtm-gray-500);
    font-weight: 600;
}

.adam-ai-program-run-details > dt::after {
    content: ":";
}

.adam-ai-program-run-details > dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
}


.adam-ai-program-editor-toolbar[hidden] {
    display: none;
}

.adam-ai-patch {
    border-top: 1px solid var(--wc-color-border, #d7dde5);
    margin-top: 1rem;
    padding-top: 1rem;
}

.adam-ai-patch-actions,
.adam-ai-patch-paging {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin: .5rem 0;
}

.adam-ai-patch-acknowledge {
    flex: 0 0 auto;
    align-self: flex-start;
    width: max-content;
    margin-block-start: .5rem;
    white-space: nowrap;
}

.adam-ai-patch-acknowledge .check-label {
    white-space: nowrap;
}

.adam-ai-patch-preview-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
    width: 100%;
}

.adam-ai-patch-decision,
.adam-ai-patch-editor {
    padding: .75rem;
    margin: .5rem 0;
    border: 1px solid var(--wc-color-border, #d7dde5);
    border-radius: .5rem;
}

.adam-ai-patch-preview-body {
    display: grid;
    grid-template-columns: minmax(12rem, 22%) minmax(0, 1fr);
    gap: 1rem;
    min-height: 65vh;
}

.adam-ai-patch-preview-rail,
.adam-ai-patch-preview-detail {
    min-width: 0;
    overflow: auto;
}

.adam-ai-patch-preview-rail {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.adam-ai-patch-diff {
    min-height: 26rem;
    height: 48vh;
}

.adam-ai-patch-preview--review .wc-ui-modal-card-full {
    width: calc(100vw - 2rem);
    height: calc(100vh - 2rem);
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.adam-ai-patch-preview--review .wc-ui-modal-body,
.adam-ai-patch-preview--review .wc-ui-modal-body-wrap,
.adam-ai-patch-preview--review .wc-ui-modal-body-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    gap: 0;
}

.adam-ai-patch-preview--review .wc-ui-status {
    flex: 0 0 auto;
}

.adam-ai-patch-preview--review .wc-ui-status:empty {
    display: none;
}

.adam-ai-patch-preview--review .adam-ai-patch-preview-body {
    grid-template-columns: clamp(9rem, 12vw, 14rem) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
}

.adam-ai-patch-preview--review .adam-ai-patch-preview-detail {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.adam-ai-patch-review-rail {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    min-height: 0;
    overflow: auto;
    padding: .625rem;
    border: 1px solid var(--nwc-input-border-color, #d7dde5);
    border-radius: var(--bs-border-radius, .5rem);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.adam-ai-patch-review-rail-title {
    font-weight: 600;
    padding-block-end: .25rem;
}

.adam-ai-patch-review-assumption-item {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    padding: .25rem 0;
    color: var(--text-primary, #111827);
    background: var(--surface-card, var(--nwc-ui-surface));
    border: .0625rem solid var(--border-default, #dde3ec);
    border-radius: var(--bs-border-radius);
}

.adam-ai-patch-review-assumption-item:hover {
    background: rgba(0, 137, 123, 0.04);
}

.adam-ai-patch-review-assumption-item:has(.is-selected) {
    border-color: rgb(0, 137, 123);
    box-shadow: inset .1875rem 0 0 rgb(0, 137, 123);
    background: rgba(0, 137, 123, 0.06);
}

.adam-ai-patch-review-assumption-item:has(:focus-visible) {
    outline: .125rem solid rgb(0, 137, 123);
    outline-offset: .0625rem;
}

.adam-ai-patch-review-assumption {
    --nwc-button-min-width: 100%;
    --nwc-button-color: var(--text-primary, #111827);
    --nwc-button-border-color: transparent;
    --nwc-button-border-radius: var(--bs-border-radius);
    --nwc-accent-subtle: transparent;
    --nwc-accent-subtle-strong: transparent;
    --nwc-accent-shadow: none;
    --nwc-inset-shadow: none;
    --button-padding: .25rem .625rem;
    width: 100%;
    justify-content: flex-start;
    white-space: normal;
    overflow-wrap: anywhere;
}

.adam-ai-patch-review-assumption-status {
    padding-inline: .625rem;
    padding-block-end: .25rem;
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: .75rem;
}

.adam-ai-patch-review-context {
    flex: 0 1 auto;
    max-height: 30vh;
    overflow: auto;
}

.adam-ai-patch-review-navigation {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-start;
    gap: .25rem;
    padding-block: .25rem;
    padding-inline-start: 1.5rem;
}

.adam-ai-patch-review-navigation .adam-program-compare-navigation[disabled] {
    --nwc-raw-gray-50: transparent;
    opacity: .5;
}

.adam-ai-patch-preview--review .adam-ai-patch-diff {
    flex: 1 1 0;
    min-height: 14rem;
    height: auto;
}

.adam-ai-patch-preview--review .adam-ai-patch-exact-edits {
    max-height: 30vh;
    overflow: auto;
}

.adam-ai-patch-source-only {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    border: 1px solid var(--wc-color-border, #d7dde5);
}

.adam-ai-patch-source-only > pre {
    min-width: 0;
    margin: 0;
    padding: 1rem;
    overflow: auto;
    white-space: pre;
    border-inline-end: 1px solid var(--wc-color-border, #d7dde5);
    background: var(--wc-color-surface-muted, var(--nwc-ui-surface-soft));
}

.adam-ai-patch-exact-edits pre {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: .5rem;
    background: var(--wc-color-surface-muted, var(--nwc-ui-surface-soft));
}

@media (max-width: 700px) {
    .adam-ai-patch-preview-body {
        grid-template-columns: 1fr;
    }
}

.has-patch-lifecycle .adam-ai-program-verdict-bar {
    display: none;
}

.has-patch-lifecycle .adam-ai-program-legacy-change {
    display: none;
}


.adam-ai-program-choice-actions {
    flex-wrap: wrap;
    gap: 0.375rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--sdtm-gray-200);
}

.adam-ai-program-canonical-state {
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
}

.adam-ai-program-choice-decision {
    padding: 0.5rem 0.75rem;
    border-left: 2px solid var(--sdtm-blue-600);
    background: var(--sdtm-gray-50);
    color: var(--sdtm-gray-900);
}

.adam-ai-program-choice-note,
.adam-ai-program-choice-decision-details {
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.adam-ai-program-choice-note--warning {
    color: var(--sdtm-warn);
}

.adam-ai-program-choice-decision-details pre {
    margin: 0.25rem 0;
    font: inherit;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.adam-ai-patch-status:empty {
    display: none;
}

/* AI assumptions: the rule stays central; controls follow the current task. */
.adam-ai-patch-toolbar {
    position: sticky;
    bottom: 0;
    z-index: 1;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding: 0.5rem 0;
    margin-top: 0.75rem;
    border-top: 1px solid var(--sdtm-gray-200);
    background: var(--surface-card, var(--nwc-ui-surface));
}

.adam-ai-patch-selection-summary {
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.adam-ai-program-choice-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    line-height: 1.5;
}

.adam-ai-program-choice-header {
    flex-wrap: wrap;
    row-gap: 0.375rem;
}

.adam-ai-program-reviewed-details > summary {
    cursor: pointer;
    list-style: none;
}

.adam-ai-program-reviewed-details > summary::-webkit-details-marker {
    display: none;
}

.adam-ai-program-reviewed-details > summary::before {
    content: "›";
    color: var(--sdtm-gray-500);
    font-size: 1rem;
    transition: transform 120ms ease;
}

.adam-ai-program-reviewed-details[open] > summary::before {
    transform: rotate(90deg);
}

.adam-ai-program-reviewed-details[open] > .adam-ai-program-choice-content {
    padding-top: 0.75rem;
}

.adam-ai-program-choice-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.375rem 0.5rem;
}

.adam-ai-program-choice-more {
    flex: 0 0 auto;
}

.adam-ai-patch-editor {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
    margin: 0.25rem 0 0;
    padding: 0.75rem 0 0;
    border: 0;
    border-top: 1px solid var(--sdtm-gray-200);
    border-radius: 0;
}

.adam-ai-patch-editor > *,
.adam-ai-patch-form > * {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.adam-ai-patch-editor > nph-textarea,
.adam-ai-patch-form > nph-textarea {
    width: 100%;
    --input-max-width: 100%;
}

.adam-ai-patch-selection nph-checkbox {
    --label-width: auto;
    --label-input-gap: 0.5rem;
}

.adam-ai-patch-editor-actions,
.adam-ai-patch-issue {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.adam-ai-patch-editor-actions {
    justify-content: flex-end;
}

.adam-ai-patch-editor-hint {
    font-size: 0.8125rem;
    color: var(--sdtm-gray-500);
    line-height: 1.5;
}

.adam-ai-patch-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 0;
}

.adam-ai-patch-form-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sdtm-gray-700);
}

.adam-ai-patch-selection {
    padding-top: 0.25rem;
}

.adam-ai-patch-history {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0 0.75rem;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
}

.adam-ai-patch-editor-status {
    color: var(--sdtm-error);
    font-size: 0.8125rem;
    line-height: 1.5;
}

.adam-ai-patch-toolbar[hidden],
.adam-ai-program-choice-note[hidden],
.adam-ai-patch-editor-status:empty,
.adam-ai-patch-paging:empty,
.adam-ai-program-choice.is-editing-rule .adam-ai-program-choice-actions,
.adam-ai-program-choice.is-editing-rule .adam-ai-patch-selection {
    display: none;
}

.adam-ai-corrections {
    height: 100%;
    min-height: 420px;
}

.adam-ai-corrections-history:not([hidden]),
.adam-ai-corrections-detail:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100%;
    min-height: 420px;
}

.adam-ai-corrections .embedded-grid-panel {
    flex: 1;
    min-height: 340px;
}

.adam-ai-patch-preview-body {
    grid-template-columns: minmax(0, 1fr);
}

.adam-ai-correction-rules {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    margin-block: .75rem;
}

.adam-ai-correction-rule {
    --wc-ui-card-background: linear-gradient(180deg, var(--nwc-ui-surface) 0%, var(--nwc-ui-surface-soft) 100%);
    --wc-ui-card-border-color: rgba(148, 163, 184, 0.24);
    --wc-ui-card-radius: 10px;
    --wc-ui-card-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
    --wc-ui-card-header-padding: .75rem 1rem .35rem;
    --wc-ui-card-body-padding: 0 1rem .75rem;
    --wc-ui-card-title-size: .77rem;
    --wc-ui-card-title-weight: 700;
    --wc-ui-card-title-color: #64748b;
    --wc-ui-card-title-letter-spacing: .08em;
    --wc-ui-card-title-text-transform: uppercase;
    min-width: 0;
}

.adam-ai-correction-rule-copy {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-size: .875rem;
    line-height: 1.5;
    color: var(--wc-color-text, #0f172a);
}

.adam-ai-patch-explanation {
    --wc-ui-card-background: var(--warning-050, #fffaeb);
    --wc-ui-card-border-color: var(--warning-300, #fec84b);
    --wc-ui-card-radius: .5rem;
    --wc-ui-card-shadow: none;
    --wc-ui-card-header-padding: .875rem 1rem .35rem;
    --wc-ui-card-body-padding: 0 1rem .875rem;
    --wc-ui-card-title-color: var(--warning-800, #7a2e0e);
    --wc-ui-card-title-size: .875rem;
    --wc-ui-card-title-weight: 700;
    border-left: .25rem solid var(--warning-500, #f79009);
    margin-block: .75rem;
}

.adam-ai-patch-explanation-copy {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    color: var(--warning-800, #7a2e0e);
    font-size: .8125rem;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.adam-ai-correction-rule-hint {
    color: var(--wc-color-text-secondary);
    font-size: .875rem;
}

.adam-ai-program-decision-status--ready,
.adam-ai-corrections-status-ready {
    background: rgba(124, 58, 237, 0.08);
    color: #6d28d9;
    border: 1px solid rgba(124, 58, 237, 0.20);
}

.adam-ai-corrections-status-running {
    position: relative;
    overflow: hidden;
    padding-bottom: 0.25rem;
}

.adam-ai-corrections-status-running::before,
.adam-ai-corrections-status-running::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    pointer-events: none;
}

.adam-ai-corrections-status-running::before {
    width: 100%;
    background: rgba(24, 105, 180, 0.15);
}

.adam-ai-corrections-status-running::after {
    width: 40%;
    background: currentColor;
    border-radius: 999px;
    animation: adam-ai-corrections-progress 1.4s ease-in-out infinite;
}

@keyframes adam-ai-corrections-progress {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(350%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .adam-ai-corrections-status-running::after {
        animation: none;
        width: 100%;
        opacity: 0.6;
    }
}

.adam-ai-program-rail-all-group > summary {
    display: list-item;
    padding-inline: 0.5rem;
    color: var(--sdtm-gray-500);
    font-size: 0.8125rem;
    cursor: pointer;
}

.adam-ai-program-rail-all-group > summary > .adam-ai-program-rail-all {
    display: inline-flex;
    width: calc(100% - 1rem);
    min-width: 0;
    vertical-align: middle;
}

.adam-ai-program-choice:not(.adam-ai-program-choice--reviewed)
.adam-ai-program-reviewed-details[open] > summary > .adam-ai-program-choice-summary {
    display: none;
}

.adam-ai-program-failure.is-cancelled {
    color: var(--text-primary, var(--nwc-text-primary));
    background: var(--surface-secondary, var(--nwc-ui-surface-soft));
    border-color: var(--border-default, #dde3ec);
}

.cai-sdtm-run-log-controls {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: .5rem;
    flex-shrink: 0;
}

.cai-sdtm-run-log-controls > nph-combobox {
    width: 12rem;
    max-width: 100%;
}

.cai-sdtm-runtime-attempt {
    flex-shrink: 0;
    max-width: 30rem;
    margin-block: .5rem;
}

/* Blinding & Unblinding: read-only folder view + Unblind action */
.bl-folders-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.bl-folders-legend {
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}

.bl-unblinded-banner,
.pf-frozen-banner {
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    border-left: 0.25rem solid #f9a825;
    background: var(--nwc-warning-subtle);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.bl-unblind-confirm-message {
    line-height: 1.6;
}

.milestones-page {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.milestones-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.milestones-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #102a43;
}

.milestones-heading {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.milestones-progress-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.8125rem;
    color: var(--nwc-text-secondary);
}

.milestones-progress-row[hidden] {
    display: none;
}

.milestones-progress-figures {
    font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace);
    color: var(--nwc-text-primary);
}

.milestones-progress-skipped:empty,
.milestones-progress-skipped[hidden] {
    display: none;
}

.milestones-progress-track {
    height: 0.3125rem;
    width: 10rem;
    max-width: 100%;
    border-radius: 0.1875rem;
    background: var(--nwc-ui-surface-soft);
    overflow: hidden;
}

.milestones-progress-fill {
    height: 100%;
    width: var(--milestones-progress, 0%);
    background: var(--po-primary, #00897b);
}

.milestones-error:empty {
    display: none;
}

.milestones-error {
    color: #c62828;
}

.milestones-count-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(7rem, 1fr));
    background: var(--nwc-ui-surface);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.milestones-count-strip[hidden],
.milestones-timeline[hidden] {
    display: none;
}

.milestones-count {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
    cursor: pointer;
}

.milestones-count:last-child {
    border-right: 0;
}

.milestones-count-active {
    background: var(--nwc-accent-subtle);
    box-shadow: inset 0 -0.125rem 0 #00897b;
}

.milestones-count-label {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.65625rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.milestones-count-dot {
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: #9ca3af;
}

.milestones-count-completed .milestones-count-dot {
    background: #22c55e;
}

.milestones-count-ready .milestones-count-dot {
    background: #3b82f6;
}

.milestones-count-pending .milestones-count-dot {
    background: #9ca3af;
}

.milestones-count-overdue .milestones-count-dot {
    background: #ef4444;
}

.milestones-count-skipped .milestones-count-dot {
    background: #d1d5db;
}

.milestones-count-unbound .milestones-count-dot {
    background: #f59e0b;
}

.milestones-count-value {
    font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace);
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
}

.milestones-count-alert .milestones-count-value {
    color: #c62828;
}

.milestones-timeline {
    background: var(--nwc-ui-surface);
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
}

.milestones-timeline-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--nwc-ui-border);
}

.milestones-kicker {
    font-size: 0.65625rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.milestones-timeline-hint,
.milestones-filter-empty {
    font-size: 0.75rem;
    color: var(--nwc-text-muted);
}

.milestones-filter-empty {
    padding: 1rem;
}

.milestones-list {
    display: flex;
    flex-direction: column;
}

.milestones-row {
    display: grid;
    grid-template-columns: 1rem 1.875rem minmax(0, 1fr) auto;
    column-gap: 0.75rem;
    align-items: stretch;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
}

.milestones-row:last-child {
    border-bottom: 0;
}

.milestones-grip {
    display: grid;
    grid-template-columns: repeat(2, 0.25rem);
    gap: 0.1875rem;
    align-self: start;
    padding-top: 0.5rem;
    cursor: grab;
}

.milestones-grip-disabled {
    cursor: default;
    opacity: 0.35;
}

.milestones-grip-dot {
    width: 0.1875rem;
    height: 0.1875rem;
    border-radius: 50%;
    background: #9ca3af;
}

.milestones-rail {
    position: relative;
    width: 1.875rem;
    align-self: stretch;
}

.milestones-rail-line {
    position: absolute;
    top: 1.875rem;
    bottom: -1rem;
    left: 0.8125rem;
    width: 0.125rem;
    background: var(--nwc-ui-surface-soft);
}

.milestones-rail-line-done {
    background: #b2dfdb;
}

.milestones-marker {
    position: relative;
    z-index: 1;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 0.09375rem solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
    color: var(--nwc-text-secondary);
    font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace);
    font-size: 0.75rem;
    font-weight: 500;
}

.milestones-marker-completed {
    border-color: var(--nwc-accent);
    background: var(--nwc-accent);
    color: #fff;
}

.milestones-marker-completed svg {
    width: 1rem;
    height: 1rem;
    stroke-width: 2.5;
}

.milestones-marker-skipped {
    border-style: dashed;
    color: var(--nwc-text-muted);
}

.milestones-marker-ready {
    border-color: var(--nwc-accent);
    color: #0f766e;
}

.milestones-marker-current {
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--nwc-accent) 15%, transparent);
}

.milestones-row-main {
    min-width: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}

.milestones-row-title, .milestones-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.milestones-row-meta {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-wrap: wrap;
}

.milestones-row-actions {
    position: relative;
    align-self: start;
    justify-content: flex-end;
    padding-top: 0.125rem;
}

.milestones-menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0.375rem;
    background: transparent;
    color: var(--nwc-text-secondary);
    cursor: pointer;
}

.milestones-due-date {
    cursor: pointer;
}

.milestones-type-icon {
    width: 1.375rem;
    height: 1.375rem;
    border-radius: 0.3125rem;
    display: grid;
    place-items: center;
    background: #102a43;
    color: #fff;
    flex-shrink: 0;
}

.milestones-row-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--nwc-text-primary);
}

.milestones-row-mode {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--nwc-text-secondary);
}

.milestones-row-tracked {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--nwc-text-secondary);
}

.milestones-tracked-type {
    color: var(--nwc-text-primary);
}

.milestones-tracked-sep {
    color: var(--nwc-text-muted);
}

.milestones-completion, .milestones-owner {
    color: var(--nwc-text-secondary);
    font-size: 0.875rem;
}

.milestones-due {
    font-family: var(--font-mono, ui-monospace, "IBM Plex Mono", Menlo, Consolas, monospace);
    font-size: 0.875rem;
    color: var(--nwc-text-primary);
}

.milestones-due-overdue {
    color: #c53030;
    font-weight: 500;
}

.milestones-avatar {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-primary);
    font-size: 0.625rem;
    font-weight: 700;
}

.milestones-avatar-empty {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-muted);
}

.milestones-unbound-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.25rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.375rem;
    background: var(--nwc-error-subtle);
}

.milestones-unbound-hint {
    color: #c53030;
    font-size: 0.75rem;
}

.milestones-status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    height: 1.625rem;
    padding: 0 0.625rem;
    border-radius: 999px;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.milestones-status-chip::before {
    content: "";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

.milestones-status-chip-completed {
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
}

.milestones-status-chip-completed::before {
    background: #16a34a;
}

.milestones-status-chip-ready {
    background: var(--nwc-info-subtle);
    color: #2563eb;
}

.milestones-status-chip-ready::before {
    background: #3b82f6;
}

.milestones-status-chip-pending {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.milestones-status-chip-pending::before {
    background: #9ca3af;
}

.milestones-status-chip-skipped {
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-secondary);
}

.milestones-status-chip-skipped::before {
    background: #c6cfd8;
}

.milestones-flag-current, .milestones-flag-gap, .milestones-flag-unbound, .milestones-flag-overdue {
    font-size: 0.65625rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.125rem 0.4rem;
    border-radius: 999px;
    background: var(--nwc-ui-surface-soft);
}

.milestones-flag-current {
    background: var(--nwc-accent-subtle);
    color: var(--nwc-accent);
}

.milestones-flag-gap {
    background: var(--nwc-warning-subtle);
    color: var(--cai-text-warning);
}

.milestones-flag-unbound {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
}

.milestones-flag-overdue {
    background: var(--nwc-error-subtle);
    color: var(--cai-text-error);
}

.milestones-menu {
    position: absolute;
    top: calc(100% + 0.25rem);
    right: 0;
    z-index: 5;
    min-width: 11.25rem;
    padding: 0.25rem;
    border: 1px solid var(--nwc-ui-border);
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface);
    box-shadow: 0 0.25rem 1rem rgba(13, 27, 42, 0.12);
}

.milestones-menu-item {
    padding: 0.625rem 0.75rem;
    border-radius: 0.3125rem;
    font-size: 0.9375rem;
    cursor: pointer;
}

.milestones-menu-item:hover {
    background: rgba(13, 27, 42, 0.06);
}

.milestones-menu-danger {
    color: #c62828;
}

.milestones-empty {
    color: var(--nwc-text-secondary);
}

.milestones-empty:empty, .milestones-reorder-hint:empty {
    display: none;
}

.milestones-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 50;
    display: none;
}

.milestones-drawer-backdrop--open {
    display: block;
}

.milestones-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(32.5rem, 100vw);
    background: var(--nwc-ui-surface);
    z-index: 51;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.18s ease;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 0.5rem 2rem rgba(0, 0, 0, 0.18);
    font-family: var(--nwc-font-primary), sans-serif;
    color: var(--nwc-text-primary);
}

.milestones-drawer--open {
    transform: translateX(0);
}

.milestones-drawer-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.125rem 1.5rem;
    border-bottom: 0.0625rem solid var(--nwc-ui-border);
}

.milestones-drawer-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #102a43;
}

.milestones-drawer-subtitle {
    margin-top: 0.125rem;
    font-size: 0.78125rem;
    font-weight: 400;
    color: var(--nwc-text-secondary);
}

.milestones-drawer-close {
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem;
    color: var(--nwc-text-secondary);
}

.milestones-drawer-body {
    flex: 1;
    overflow: auto;
    padding: 1.25rem 1.5rem;
    margin: 0;
}

.milestones-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.milestones-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.milestones-field-label {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #102a43;
}

.milestones-required {
    color: #e53935;
}

.milestones-description {
    min-height: 5.5rem;
}

.milestones-section-label {
    padding-top: 0.5rem;
    border-top: 0.0625rem solid var(--nwc-ui-border);
    font-size: 0.65625rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--nwc-text-secondary);
}

.milestones-modes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.milestones-mode-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.625rem;
    border: 0.0625rem solid var(--nwc-ui-border);
    border-radius: 0.375rem;
    background: var(--nwc-ui-surface);
    cursor: pointer;
}

.milestones-mode-selected {
    border-color: #00897b;
    background: var(--nwc-accent-subtle);
    box-shadow: 0 0 0 0.0625rem #00897b;
}

.milestones-mode-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.milestones-mode-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #102a43;
}

.milestones-mode-desc, .milestones-help {
    font-size: 0.71875rem;
    line-height: 1.35;
    font-weight: 400;
    color: var(--nwc-text-secondary);
}

.milestones-operation-block {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.milestones-rule-note {
    display: flex;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.375rem;
    background: var(--nwc-info-subtle);
    font-size: 0.75rem;
    line-height: 1.45;
    font-weight: 400;
    color: var(--cai-text-info);
}

.milestones-rule-note-changed {
    background: #b2dfdb;
}

.milestones-rule-icon {
    flex-shrink: 0;
    width: 0.875rem;
    height: 0.875rem;
    margin-top: 0.0625rem;
    border: 0.1rem solid #00695c;
    border-radius: 999px;
    color: #00695c;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 0.7rem;
    text-align: center;
}

.milestones-ownership {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0.75rem;
}

.milestones-drawer-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    border-top: 0.0625rem solid var(--nwc-ui-border);
}

.milestones-help[hidden],
.milestones-qualifier-slot[hidden],
.milestones-operation-block[hidden] {
    display: none;
}

.milestones-rail-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: #00897b;
}

.milestones-stepper-card--hidden,
.milestones-stepper-manage--hidden {
    display: none !important;
}

.milestones-stepper-card {
    --wc-ui-card-body-padding: 1.25rem 1.75rem 1.625rem;
}

.milestones-stepper-card .wc-ui-card-header {
    display: none;
}

.milestones-stepper-heading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.milestones-stepper-title {
    color: var(--nwc-text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    line-height: normal;
    text-transform: uppercase;
    white-space: nowrap;
}

.milestones-stepper-progress {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.milestones-stepper-manage {
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: #0f766e;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    align-self: center;
}

.milestones-stepper-bar {
    width: 5rem;
    height: 0.3125rem;
    border-radius: 999px;
    background: var(--nwc-ui-surface-soft);
    overflow: hidden;
}

.milestones-stepper-bar[hidden] {
    display: none !important;
}

.milestones-stepper-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--nwc-accent);
}

.milestones-stepper-summary {
    color: var(--nwc-text-secondary);
    font-size: 0.875rem;
    white-space: nowrap;
}

.milestones-stepper-steps {
    display: flex;
    overflow-x: auto;
    padding: 0.25rem 0 0.25rem;
}

.milestones-step {
    flex: 1 0 5.5rem;
    min-width: 5.5rem;
    text-align: center;
}

.milestones-step-rail {
    display: flex;
    align-items: center;
}

.milestones-step-line {
    flex: 1;
    height: 0.125rem;
    background: #d5dde6;
}

.milestones-step-line-done {
    background: var(--nwc-accent);
}

.milestones-step-line-edge {
    background: transparent;
}

.milestones-step-marker {
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: 999px;
    display: grid;
    place-items: center;
    border: 0.125rem solid var(--nwc-ui-border);
    background: var(--nwc-ui-surface);
    color: var(--nwc-text-secondary);
    font-size: 0.8125rem;
    font-weight: 650;
}

.milestones-step-completed .milestones-step-marker {
    border-color: var(--nwc-accent);
    background: var(--nwc-accent);
    color: #fff;
}

.milestones-step-completed .milestones-step-marker svg {
    width: 0.875rem;
    height: 0.875rem;
    stroke-width: 2.5;
}

.milestones-step-current .milestones-step-marker {
    border-color: var(--nwc-accent);
    color: #0f766e;
    box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--nwc-accent) 15%, transparent);
}

.milestones-step-name {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 650;
    line-height: 1.25;
    color: var(--nwc-text-primary);
}

.milestones-step-date {
    margin-top: 0.125rem;
    font-size: 0.75rem;
    color: var(--nwc-text-secondary);
}

.milestones-step-overdue .milestones-step-date {
    color: #c62828;
}

.milestones-stepper-current {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.625rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 0.0625rem solid var(--nwc-ui-border);
}

.milestones-stepper-current:empty {
    display: none;
    margin: 0;
    padding: 0;
    border: 0;
}

.milestones-stepper-kicker {
    color: var(--nwc-text-secondary);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.milestones-stepper-current-name {
    color: var(--nwc-text-primary);
    font-size: 0.875rem;
    font-weight: 650;
}

.milestones-stepper-current-detail {
    color: var(--nwc-text-secondary);
    font-size: 0.875rem;
}

.adam-ai-program-generation-dialog {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.adam-ai-program-generation-dialog > [hidden] {
    display: none !important;
}

.adam-ai-program-generation-field {
    --label-width: auto;
    --input-max-width: 100%;
    min-width: 0;
    max-width: none;
    width: 100%;
}

.adam-ai-program-workspace-status[data-state="error"] {
    color: var(--sdtm-error, #9b1c1c);
}

.adam-ai-program-workspace-mode-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 0.5rem;
}

.adam-ai-program-workspace-mode-description {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid var(--border-color, #dce2ea);
    border-radius: 0.5rem;
}

.adam-ai-program-workspace-mode-heading {
    font-weight: 600;
}

.adam-ai-program-workspace-mode-note {
    align-self: flex-start;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background: var(--surface-secondary, var(--nwc-ui-surface-soft));
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.8125rem;
    font-weight: 600;
}

.adam-ai-program-generation-decisions {
    --label-width: min(34rem, calc(100vw - 8rem));
    --label-input-gap: 0.5rem;
    --basic-elem-height: auto;
    max-width: 100%;
    width: 100%;
}

.adam-ai-program-version-row {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.adam-ai-program-version-row[hidden] {
    display: none;
}

.adam-ai-program-version-row > .adam-ai-program-version-controls {
    width: 100%;
    max-width: 24rem;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.adam-ai-program-version-controls > .adam-ai-program-history {
    flex: 1 1 auto;
    min-width: 0;
}

.adam-ai-program-generation-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.adam-ai-program-generation-actions > .adam-ai-program-generate {
    margin-left: 0;
}

.adam-ai-program-generation-context {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--nwc-text-secondary);
    font-size: 0.8rem;
}

.audit-filter-bar > .wc-ui-time-range-picker {
    --wc-ui-time-range-trigger-color: var(--af-green);
    --wc-ui-time-range-trigger-hover: var(--af-green-lt);
    --wc-ui-time-range-popup-offset: 4px;
    --wc-ui-time-range-trigger-border-width: 1.5px;
    --wc-ui-time-range-border-width: 1px;
    --wc-ui-time-range-shadow: 0 8px 40px rgba(0, 0, 0, 0.45);
}

/* Keep model choice available in the floating composer as well as the full-page assistant. */
.aria-composer-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.aria-model-picker {
    width: min(10.5rem, 40vw);
    min-width: 0;
    --input-min-height: 1.875rem;
}

.adam-ai-program-background {
    flex: 0 0 auto;
    min-width: 0;
    border: 1px solid var(--sdtm-gray-200);
    border-radius: 0.5rem;
    background: var(--surface-card, var(--nwc-ui-surface));
}

.adam-ai-program-background[hidden],
.adam-ai-program-background [hidden] {
    display: none !important;
}

.adam-ai-program-background-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    flex-wrap: wrap;
}

.adam-ai-program-background-icon {
    display: flex;
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.adam-ai-program-background.is-running .adam-ai-program-background-icon,
.adam-ai-program-background.is-complete .adam-ai-program-background-icon {
    color: #14967d;
}

.adam-ai-program-background.is-failed .adam-ai-program-background-icon,
.adam-ai-program-background-error {
    color: var(--sdtm-error);
}

.adam-ai-program-background-text {
    display: flex;
    flex: 1 1 18rem;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    min-width: 0;
}

.adam-ai-program-background-title {
    font-size: 0.8125rem;
    font-weight: 600;
}

.adam-ai-program-background-status,
.adam-ai-program-background-error {
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.adam-ai-program-background-status {
    color: var(--text-secondary, var(--nwc-text-secondary));
}

.adam-ai-program-background-error {
    display: block;
    padding: 0 0.75rem 0.5rem;
}

.adam-ai-program-background-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-left: auto;
}

.adam-ai-program-background .adam-ai-program-generating {
    overflow: visible;
    padding: 0.75rem;
    border-top: 1px solid var(--sdtm-gray-200);
}

/* Chart popup opened from a summary card's header action. */
.project-oversight-chart-body {
    min-height: 24rem;
    display: flex;
    flex-direction: column;
}

.project-oversight-chart-canvas {
    flex: 1;
    min-height: 20rem;
}

.project-oversight-chart-note {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--po-text-light);
    font-size: 0.95rem;
    text-align: center;
}

/* Chart/Table toggle sits above the chart inside the dialog body, as the mockup has it —
   in the modal header it collided with the dialog's own close control. */
.project-oversight-chart-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-bottom: 0.75rem;
    flex: 0 0 auto;
}

.aria-model-loading {
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary, var(--nwc-text-secondary));
    min-width: 0;
}

.aria-autonomy[aria-pressed="false"] {
    --nwc-button-color: var(--sdtm-error, #dc2626);
}

.aria-autonomy[aria-pressed="true"] {
    --nwc-button-color: var(--af-green, #14967d);
}

.aria-agent-status {
    align-items: center;
    gap: 0.375rem;
    min-width: 0;
    padding: 0.375rem 0.75rem;
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.75rem;
    line-height: 1.25;
}

.aria-agent-status-label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.adam-rstudio-process-details {
    padding: 0.75rem;
    border-top: 1px solid var(--sdtm-gray-200);
}

.adam-rstudio-process-result,
.adam-rstudio-project-paths {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    min-width: 0;
    width: 100%;
}

.adam-rstudio-path-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    max-width: 100%;
    font-size: 0.8125rem;
}

.adam-rstudio-path-value {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-width: 0;
}

.adam-rstudio-project-card {
    padding: 0.875rem 1rem;
    border: 1px solid #b7dfd4;
    border-radius: 0.5rem;
    background: var(--nwc-ui-surface-soft);
}

.adam-rstudio-path-row code {
    flex: 1;
    min-width: 0;
    color: var(--text-primary, var(--nwc-text-primary));
    font-size: 0.75rem;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    user-select: text;
}

.adam-rstudio-copy-path {
    flex-shrink: 0;
}

.adam-rstudio-instructions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem 1.5rem;
    padding: 1rem;
    margin: 0;
    border: 1px solid var(--sdtm-gray-200);
    border-radius: 0.5rem;
    list-style: none;
    counter-reset: rstudio-step;
    font-size: 0.8125rem;
    line-height: 1.6;
}

.adam-rstudio-instructions li {
    position: relative;
    padding-left: 2.25rem;
    counter-increment: rstudio-step;
}

.adam-rstudio-instructions li::before {
    content: counter(rstudio-step);
    position: absolute;
    left: 0;
    top: 0;
    display: grid;
    place-items: center;
    width: 1.625rem;
    height: 1.625rem;
    border-radius: 50%;
    background: var(--nwc-success-subtle);
    color: var(--cai-text-success);
    font-weight: 600;
}

.adam-rstudio-instructions strong {
    color: var(--text-primary, var(--nwc-text-primary));
    font-weight: 600;
}

.adam-rstudio-instructions p {
    margin: 0.25rem 0 0;
    color: var(--nwc-text-secondary);
}

.adam-rstudio-instructions .adam-rstudio-instruction-action {
    color: #0f7a65;
}

.adam-rstudio-instructions code {
    padding: 0.0625rem 0.25rem;
    border-radius: 0.25rem;
    background: var(--nwc-ui-surface-soft);
    color: var(--nwc-text-primary);
    font-family: 'IBM Plex Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
    font-size: 0.75rem;
}

.adam-rstudio-working-copy {
    padding-left: 0.75rem;
    border-left: 2px solid var(--sdtm-gray-200);
    color: var(--text-secondary, var(--nwc-text-secondary));
    font-size: 0.75rem;
    line-height: 1.6;
}

@media (max-width: 800px) {
    .adam-rstudio-instructions {
        grid-template-columns: minmax(0, 1fr);
    }
}
