/*
 * PLATFORM-06 authenticated module and administration migration layer.
 *
 * This file intentionally defines no competing tokens. It maps existing
 * Release 1 markup to the PLATFORM-05 --at-* contracts while pages migrate to
 * explicit shared primitives. Screen scoping protects official print/PDF
 * presentation and the stylesheet is loaded only for authenticated surfaces.
 */

@media screen {
  body[data-authenticated-ui="true"] :where(.at-page-header, .cd-page-hero, .cd-page-title-row, .cd-module-title-row, .policy-page-heading) {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--at-space-5);
    margin: 0 0 var(--at-space-6);
  }

  body[data-authenticated-ui="true"] :where(.at-page-header, .cd-page-hero, .cd-page-title-row, .cd-module-title-row, .policy-page-heading) h1 {
    margin: 0;
    color: var(--at-text-primary);
    font-size: var(--at-text-2xl);
    line-height: 1.15;
  }

  body[data-authenticated-ui="true"] :where(.at-page-header, .cd-page-hero, .cd-page-title-row, .cd-module-title-row, .policy-page-heading) p {
    max-width: 52rem;
    margin: var(--at-space-2) 0 0;
    color: var(--at-text-secondary);
  }

  body[data-authenticated-ui="true"] :where(.cd-eyebrow, .cd-kicker, .policy-kicker) {
    color: var(--at-text-secondary);
    font-size: var(--at-text-xs);
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
  }

  body[data-authenticated-ui="true"] :where(.at-admin-navigation, .cd-manage-sidebar, .cd-fto-sidebar) {
    min-width: 0;
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    color: var(--at-text-primary);
    background: var(--at-surface-panel);
    box-shadow: var(--at-elevation-1);
  }

  body[data-authenticated-ui="true"] :where(.at-admin-nav-link, .cd-sidebar-link, .cd-fto-sidebar a) {
    min-height: 44px;
    border-inline-start: 3px solid transparent;
    color: var(--at-text-secondary);
  }

  body[data-authenticated-ui="true"] :where(.at-admin-nav-link, .cd-sidebar-link, .cd-fto-sidebar a):hover,
  body[data-authenticated-ui="true"] :where(.at-admin-nav-link, .cd-sidebar-link, .cd-fto-sidebar a)[aria-current="page"],
  body[data-authenticated-ui="true"] :where(.at-admin-nav-link, .cd-sidebar-link, .cd-fto-sidebar a).active {
    border-inline-start-color: var(--at-module-accent, var(--at-brand-cyan));
    color: var(--at-text-primary);
    background: var(--at-surface-selected);
  }

  body.cd-fto-body :where(.cd-fto-tabbar, .cd-fto-dialog-navigation) .cd-sidebar-group-title {
    color: var(--at-text-secondary);
    font-size: var(--at-text-xs);
    letter-spacing: .06em;
  }

  body.cd-fto-body .cd-fto-navigation-trigger {
    display: none;
  }

  body[data-authenticated-ui="true"].at-modal-dialog-open {
    overflow: hidden;
  }

  body[data-authenticated-ui="true"] :where(.at-dialog, .cd-import-dialog) .cd-form-actions {
    display: flex;
    flex-wrap: wrap;
  }

  body[data-authenticated-ui="true"] :where(.at-panel, .at-card, .at-review-panel, .at-audit-panel,
    .cd-dashboard-panel, .cd-settings-panel, .cd-form-panel, .cd-panel, .cd-profile-directory,
    .cd-dor-card, .cd-dor-main-card, .cd-fto-admin-section, .host-form-card, .host-settings-panel,
    .policy-panel, .policy-detail-grid article) {
    min-width: 0;
    border-color: var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    color: var(--at-text-primary);
    background: var(--at-surface-panel);
    box-shadow: var(--at-elevation-1);
  }

  body[data-authenticated-ui="true"] :where(.cd-panel-heading, .host-card-heading, .policy-panel-heading) {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--at-space-4);
  }

  body[data-authenticated-ui="true"] :where(.at-summary-card, .cd-summary-card, .cd-stat-card, .cd-report-metric) {
    min-width: 0;
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    color: var(--at-text-primary);
    background: var(--at-surface-panel);
    box-shadow: var(--at-elevation-1);
  }

  body[data-authenticated-ui="true"] :where(.at-table-region, .cd-table-wrap, .cd-table-card, .cd-review-table-wrap,
    .policy-table-wrap, .cd-enterprise-table) {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    border-color: var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    background: var(--at-surface-panel);
  }

  body[data-authenticated-ui="true"] [data-at-overflowing] {
    scrollbar-gutter: stable both-edges;
    scrollbar-width: auto;
  }

  body[data-authenticated-ui="true"] .cd-group-shift-list {
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  body[data-authenticated-ui="true"] .cd-group-shift-list-row {
    width: max-content;
    min-width: 100%;
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) {
    width: 100%;
    border-collapse: collapse;
    color: var(--at-text-primary);
    background: var(--at-surface-panel);
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th {
    border-color: var(--at-border-subtle);
    color: var(--at-text-secondary);
    background: var(--at-surface-subtle);
    font-size: var(--at-text-sm);
    letter-spacing: normal;
    text-transform: none;
  }

  /* Sort controls inherit the typography of the authenticated light header.
     Legacy dark table headers retain their existing white-link contract. */
  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th .cd-sort-link {
    color: inherit;
    font: inherit;
    font-weight: inherit;
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th .cd-sort-link:hover {
    color: var(--at-interaction-primary-hover);
    text-decoration-thickness: 2px;
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th .cd-sort-link:focus-visible {
    color: var(--at-text-primary);
    border-radius: var(--at-radius-sm);
    outline: 2px solid currentColor;
    outline-offset: 2px;
    box-shadow: var(--at-focus-ring);
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th .cd-sort-link .cd-sort-indicator,
  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) th .cd-sort-link.is-active .cd-sort-indicator {
    color: currentColor;
  }

  body[data-authenticated-ui="true"] :where(.at-table, .cd-data-table, .cd-table, .cd-review-table, .policy-table) td {
    border-color: var(--at-border-subtle);
    color: var(--at-text-primary);
  }

  body[data-authenticated-ui="true"] :where(h1, h2, h3, .cd-agency-name, .cd-agency-route,
    .cd-breadcrumbs, .at-breadcrumbs, .at-my-work-item, .at-notification, .policy-page-heading,
    .cd-module-title-row, .cd-page-title-row) {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  body[data-authenticated-ui="true"] :where(.at-filter-row, .cd-filter-panel, .cd-filters, .cd-filter-row,
    .cd-training-filter-bar, .cd-training-assignment-filters, .cd-fto-pending-filters,
    .cd-fto-report-filters, .policy-filter, .policy-report-filter) {
    min-width: 0;
    gap: var(--at-space-3);
    padding: var(--at-space-4);
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    background: var(--at-surface-panel);
  }

  body[data-authenticated-ui="true"] :where(.cd-filter-panel, .cd-filters, .cd-filter-row,
    .cd-training-filter-bar, .cd-training-assignment-filters, .cd-fto-pending-filters,
    .cd-fto-report-filters, .policy-filter, .policy-form, .cd-form-grid, .host-form-grid) label {
    min-width: 0;
    color: var(--at-text-primary);
    font-size: var(--at-text-sm);
    font-weight: 750;
  }

  body[data-authenticated-ui="true"] .cd-manage-users-filter-grid {
    display: grid;
    grid-template-columns: minmax(8rem, .75fr) minmax(11rem, 1fr) minmax(18rem, 2fr) minmax(8rem, .75fr) auto;
    align-items: end;
  }

  body[data-authenticated-ui="true"] .cd-manage-users-filter-grid > label {
    display: grid;
    align-content: end;
    gap: var(--at-space-2);
    margin: 0;
  }

  body[data-authenticated-ui="true"] .cd-manage-users-filter-actions {
    display: flex;
    align-items: stretch;
    justify-content: flex-end;
    gap: var(--at-space-2);
  }

  body[data-authenticated-ui="true"] .cd-manage-users-actions {
    align-items: center;
    justify-content: flex-end;
  }

  @media (max-width: 1180px) {
    body[data-authenticated-ui="true"] .cd-manage-users-filter-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body[data-authenticated-ui="true"] .cd-manage-users-filter-actions {
      grid-column: 1 / -1;
      justify-content: flex-start;
    }
  }

  @media (max-width: 640px) {
    body[data-authenticated-ui="true"] .cd-manage-users-filter-grid {
      grid-template-columns: minmax(0, 1fr);
    }

    body[data-authenticated-ui="true"] .cd-manage-users-filter-actions {
      grid-column: auto;
      flex-direction: column;
    }

    body[data-authenticated-ui="true"] :where(.cd-manage-users-filter-actions, .cd-manage-users-actions) :where(a, button) {
      width: 100%;
      justify-content: center;
    }
  }

  body[data-authenticated-ui="true"] :where(.cd-form-card, .cd-form-panel, .cd-panel, .cd-settings-panel,
    .cd-review-form, .cd-table-wrap, .at-table-region, .policy-panel, .cd-filter-panel, .cd-filters,
    .cd-filter-row, .cd-training-filter-bar, .cd-training-inline-form, .cd-fto-pending-filters,
    .cd-fto-report-filters, .host-form-card, .policy-filter, .policy-form, .policy-compare-form)
    :where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--at-border-strong);
    border-radius: var(--at-radius-md);
    padding: .625rem .75rem;
    color: var(--at-text-primary);
    background: var(--at-white);
  }

  body[data-authenticated-ui="true"] :where(.cd-form-card, .cd-form-panel, .cd-panel, .cd-settings-panel,
    .cd-review-form, .cd-table-wrap, .at-table-region, .policy-panel, .cd-filter-panel, .cd-filters,
    .cd-filter-row, .cd-training-filter-bar, .cd-training-inline-form, .cd-fto-pending-filters,
    .cd-fto-report-filters, .host-form-card, .policy-filter, .policy-form, .policy-compare-form)
    :where(input[type="checkbox"], input[type="radio"]) {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--at-interaction-primary);
  }

  body[data-authenticated-ui="true"] :where(.at-button, .cd-button, .policy-button, .cd-primary-button,
    .cd-secondary-button, .cd-danger-button) {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: var(--at-space-2);
    border-radius: var(--at-radius-md);
    padding: .65rem 1rem;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
  }

  body[data-authenticated-ui="true"] :where(.at-button--primary, .cd-primary-button, .cd-button-primary, .policy-button-primary) {
    border: 1px solid var(--at-interaction-primary);
    color: var(--at-white);
    background: var(--at-interaction-primary);
  }

  body[data-authenticated-ui="true"] :where(.at-button--secondary, .cd-secondary-button, .cd-button-secondary, .policy-button:not(.policy-button-primary):not(.policy-button-danger)) {
    border: 1px solid var(--at-interaction-primary);
    color: var(--at-interaction-primary);
    background: var(--at-white);
  }

  body[data-authenticated-ui="true"] :where(.at-button--danger, .cd-danger-button, .policy-button-danger) {
    border: 1px solid var(--at-danger);
    color: var(--at-white);
    background: var(--at-danger);
  }

  body[data-authenticated-ui="true"] :where(.at-button--danger, .cd-danger-button, .policy-button-danger):hover {
    border-color: var(--at-danger-hover);
    color: var(--at-white);
    background: var(--at-danger-hover);
  }

  body[data-authenticated-ui="true"] :where(.cd-table-link, .cd-link-button) {
    color: var(--at-interaction-primary);
    text-decoration: underline;
    text-underline-offset: .18em;
  }

  body[data-authenticated-ui="true"] :where(.at-validation-summary, .cd-validation-summary, .validation-summary-errors) {
    border-color: color-mix(in srgb, var(--at-danger) 36%, var(--at-white));
    border-left: 4px solid var(--at-danger);
    border-radius: var(--at-radius-md);
    color: var(--at-danger);
    background: var(--at-danger-surface);
  }

  body[data-authenticated-ui="true"] :where(.cd-validation-summary.validation-summary-valid, .validation-summary-valid) {
    display: none;
  }

  body[data-authenticated-ui="true"] :where(.at-alert, .cd-alert, .cd-alert-success, .policy-alert) {
    border: 1px solid var(--at-border-strong);
    border-left-width: 4px;
    border-radius: var(--at-radius-md);
    padding: var(--at-space-4);
    color: var(--at-text-primary);
    background: var(--at-white);
  }

  body[data-authenticated-ui="true"] :where(.at-alert--success, .cd-alert-success, .cd-alert.cd-alert-success, .policy-alert.is-success) {
    border-left-color: var(--at-success);
    color: var(--at-success);
    background: var(--at-success-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-alert--warning, .cd-alert-warning, .cd-version-warning) {
    border-left-color: var(--at-warning);
    color: var(--at-warning);
    background: var(--at-warning-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-alert--danger, .cd-alert-danger, .policy-alert:not(.is-success):not(.is-information)) {
    border-left-color: var(--at-danger);
    color: var(--at-danger);
    background: var(--at-danger-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-alert--info, .cd-alert-info, .policy-alert.is-information) {
    border-left-color: var(--at-info);
    color: var(--at-info);
    background: var(--at-info-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-status, .at-badge, .cd-badge, .cd-status-pill,
    .cd-status-badge, .cd-readiness-status, .cd-review-status, .policy-status, .policy-due-badge,
    .cd-status-chip, .cd-training-state) {
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    gap: .35rem;
    border: 1px solid currentColor;
    border-radius: var(--at-radius-pill);
    padding: .2rem .65rem;
    color: var(--at-neutral);
    background: var(--at-neutral-surface);
    font-size: var(--at-text-xs);
    font-weight: 750;
    line-height: 1.2;
  }

  body[data-authenticated-ui="true"] :where(.at-status--success, .cd-status-chip-current,
    .cd-readiness-status.is-ready, .policy-status.is-active, .policy-status.is-ready,
    [data-semantic-status="success"]) {
    color: var(--at-success);
    background: var(--at-success-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-status--warning, .cd-status-chip-due,
    .cd-readiness-status.is-needs-attention,
    .policy-status.is-draft, .policy-due-badge.is-duetoday, .policy-due-badge.is-duesoon,
    [data-semantic-status="warning"]) {
    color: var(--at-warning);
    background: var(--at-warning-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-status--danger, .cd-status-chip-overdue,
    .cd-readiness-status.is-blocking,
    .policy-status.is-retired, .policy-status.is-blocking, .policy-due-badge.is-overdue,
    [data-semantic-status="danger"]) {
    color: var(--at-danger);
    background: var(--at-danger-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-status--info, [data-semantic-status="info"]) {
    color: var(--at-info);
    background: var(--at-info-surface);
  }

  body[data-authenticated-ui="true"] :where(.at-empty-state, .cd-empty-state, .cd-empty-row, .policy-empty) {
    color: var(--at-text-secondary);
  }

  body[data-authenticated-ui="true"] :where(.at-my-work-item, .at-notification, .at-evidence-row,
    .at-document-row, .at-history-row, .policy-evidence-row) {
    border-color: var(--at-border-subtle);
    color: var(--at-text-primary);
    background: var(--at-white);
  }

  body[data-authenticated-ui="true"] article.at-evidence-row {
    display: block;
    margin-bottom: var(--at-space-3);
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-lg);
    padding: var(--at-space-4);
    box-shadow: var(--at-elevation-1);
  }

  body[data-authenticated-ui="true"] .cd-recent-row.at-notification {
    grid-template-columns: .6fr .8fr minmax(0, 2fr) 1fr auto;
  }

  body[data-authenticated-ui="true"] :where(.at-my-work-item, .ps-work-group)[data-module="pro-standards"] { border-inline-start: 3px solid var(--at-module-pro-standards); }
  body[data-authenticated-ui="true"] :where(.at-my-work-item, .ps-work-group)[data-module="training"] { border-inline-start: 3px solid var(--at-module-training); }
  body[data-authenticated-ui="true"] :where(.at-my-work-item, .ps-work-group)[data-module="fto"] { border-inline-start: 3px solid var(--at-module-fto); }
  body[data-authenticated-ui="true"] :where(.at-my-work-item, .ps-work-group)[data-module="policy"] { border-inline-start: 3px solid var(--at-module-policy); }
  body[data-authenticated-ui="true"] :where(.at-my-work-item, .ps-work-group)[data-module="policy-compliance"] { border-inline-start: 3px solid var(--at-module-policy); }

  /* Training page-local presentation migrated to the shared authenticated layer. */
  body.cd-training-body :where(.cd-training-assignment-layout, .cd-training-admin-layout) { display: grid; gap: var(--at-space-4); }
  body.cd-training-body .cd-training-assignment-filters { display: flex; flex-wrap: wrap; align-items: end; margin: var(--at-space-3) 0 var(--at-space-4); }
  body.cd-training-body :where(.cd-training-inline-form) { display: grid; min-width: min(34rem, 70vw); gap: var(--at-space-3); }
  body.cd-training-body .cd-training-assignment-layout .cd-training-inline-form { min-width: min(32rem, 70vw); }
  body.cd-training-body .cd-training-assignment-table { min-width: 62rem; }
  body.cd-training-body .cd-training-admin-table { min-width: 58rem; }
  body.cd-training-body .cd-training-review-table { min-width: 66rem; }
  body.cd-training-body :where(.cd-training-edit-details, .cd-training-review-actions) { max-width: 34rem; }
  body.cd-training-body .cd-training-assignment-layout .cd-training-edit-details { max-width: 32rem; }
  body.cd-training-body :where(.cd-training-edit-details, .cd-training-review-actions) summary { cursor: pointer; font-weight: 800; }
  body.cd-training-body .cd-training-row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--at-space-2); }
  body.cd-training-body .cd-late-note { display: block; margin-top: var(--at-space-1); color: var(--at-success); font-size: var(--at-text-sm); font-weight: 800; }

  /* FTO filter/report styles moved from Razor while preserving page print rules. */
  body.cd-fto-body :where(.cd-fto-pending-filters, .cd-fto-report-filters) { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0 0 var(--at-space-4); }
  body.cd-fto-body :where(.cd-fto-pending-filters, .cd-fto-report-filters) label { display: flex; flex-direction: column; gap: var(--at-space-1); }
  body.cd-fto-body .cd-filter-actions { display: flex; align-items: end; gap: var(--at-space-2); }
  body.cd-fto-body :where(.cd-fto-report-tabs, .cd-fto-subtabs, .cd-enterprise-family-nav) { display: flex; flex-wrap: wrap; gap: var(--at-space-2); margin: 0 0 var(--at-space-4); }
  body.cd-fto-body :where(.cd-fto-report-tabs, .cd-fto-subtabs, .cd-enterprise-family-nav) a { min-height: 44px; border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-md); padding: .55rem .75rem; color: var(--at-text-primary); background: var(--at-white); text-decoration: none; }
  body.cd-fto-body :where(.cd-fto-report-tabs, .cd-fto-subtabs, .cd-enterprise-family-nav) a.active { border-color: var(--at-interaction-primary); color: var(--at-white); background: var(--at-interaction-primary); }
  body.cd-fto-body .cd-check-label { flex-direction: row; align-items: center; justify-content: center; }
  body.cd-fto-body .cd-report-title { margin: var(--at-space-4) 0; color: var(--at-text-primary); font-weight: 700; }
  body.cd-fto-body .cd-report-chart { margin-bottom: var(--at-space-4); padding: var(--at-space-4); border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-lg); background: var(--at-white); }
  body.cd-fto-body .cd-chart-name { margin-bottom: var(--at-space-2); font-weight: 700; }
  body.cd-fto-body .cd-chart-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 60px; align-items: center; gap: var(--at-space-3); margin: .35rem 0; font-size: var(--at-text-sm); }
  body.cd-fto-body .cd-chart-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.cd-fto-body .cd-chart-row div { height: 12px; overflow: hidden; border-radius: var(--at-radius-sm); background: var(--at-surface-subtle); }
  body.cd-fto-body .cd-chart-row i { display: block; height: 100%; background: var(--at-module-fto); }
  body.cd-fto-body .cd-report-card-link { color: inherit; text-decoration: none; }
  body.cd-fto-body .cd-timeline-wrap { overflow-x: auto; }
  body.cd-fto-body .cd-timeline-table th span { display: block; color: var(--at-text-muted); font-size: var(--at-text-xs); }
  body.cd-fto-body .cd-score-cell { display: inline-flex; min-width: 36px; justify-content: center; border-radius: var(--at-radius-sm); padding: .2rem .35rem; color: var(--at-neutral); background: var(--at-neutral-surface); }
  body.cd-fto-body .cd-score-cell.low { color: var(--at-danger); background: var(--at-danger-surface); }
  body.cd-fto-body .cd-score-cell.mid { color: var(--at-warning); background: var(--at-warning-surface); }
  body.cd-fto-body .cd-score-cell.high { color: var(--at-success); background: var(--at-success-surface); }
  body.cd-fto-body :where(.cd-score-cell.no, .cd-score-cell.nrt) { color: var(--at-neutral); background: var(--at-neutral-surface); }
  body.cd-fto-body .cd-score-legend { margin: 0 0 var(--at-space-4); color: var(--at-text-secondary); }
  body.cd-fto-body .cd-diff-negative { color: var(--at-danger); font-weight: 700; }
  body.cd-fto-body .cd-diff-positive { color: var(--at-success); font-weight: 700; }
  body.cd-fto-body .cd-report-section-title { margin: var(--at-space-6) 0 var(--at-space-1); color: var(--at-text-primary); font-size: var(--at-text-lg); }
  body.cd-fto-body .cd-report-picker { display: grid; grid-template-columns: minmax(0, .8fr) minmax(20rem, 1.2fr); align-items: end; gap: var(--at-space-5); margin: var(--at-space-5) 0; padding: var(--at-space-5); border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-lg); background: var(--at-white); box-shadow: var(--at-elevation-1); }
  body.cd-fto-body .cd-report-picker h2 { margin: 0 0 var(--at-space-1); }
  body.cd-fto-body .cd-report-picker-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--at-space-2); min-width: 0; }
  body.cd-fto-body .cd-report-picker-form label { grid-column: 1 / -1; color: var(--at-text-secondary); font-size: var(--at-text-sm); font-weight: 750; }
  body.cd-fto-body .cd-report-picker-form select { width: 100%; min-width: 0; }
  body.cd-fto-body .cd-report-picker-form-compact { grid-template-columns: minmax(14rem, 26rem) auto; max-width: 38rem; margin: var(--at-space-4) 0; }
  body.cd-fto-body .cd-report-family-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: var(--at-space-3); margin: var(--at-space-4) 0 1.75rem; }
  body.cd-fto-body .cd-report-family-card { display: flex; min-width: 0; flex-direction: column; gap: var(--at-space-2); padding: var(--at-space-4); border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-lg); color: var(--at-text-primary); background: var(--at-white); box-shadow: var(--at-elevation-1); text-decoration: none; }
  body.cd-fto-body .cd-report-family-card:hover { border-color: var(--at-interaction-primary); box-shadow: var(--at-elevation-2); }
  body.cd-fto-body .cd-report-family-card span { color: var(--at-text-secondary); font-size: var(--at-text-sm); line-height: 1.35; }
  body.cd-fto-body .cd-report-family-card small { margin-top: auto; color: var(--at-interaction-primary); font-weight: 700; }
  body.cd-fto-body .cd-enterprise-report-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--at-space-4); margin: var(--at-space-4) 0; }
  body.cd-fto-body .cd-enterprise-report-heading h2 { margin: var(--at-space-1) 0; }
  body.cd-fto-body .cd-enterprise-report-heading p { margin: 0; color: var(--at-text-secondary); }
  body.cd-fto-body .cd-export-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--at-space-2); }
  body.cd-fto-body .cd-export-menu { position: relative; flex: 0 0 auto; }
  body.cd-fto-body .cd-export-menu summary { display: flex; min-height: 44px; align-items: center; gap: var(--at-space-2); cursor: pointer; list-style: none; }
  body.cd-fto-body .cd-export-menu summary::-webkit-details-marker { display: none; }
  body.cd-fto-body .cd-export-menu-options { position: absolute; z-index: 20; top: calc(100% + var(--at-space-1)); right: 0; display: grid; min-width: 10rem; overflow: hidden; border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-md); background: var(--at-white); box-shadow: var(--at-elevation-2); }
  body.cd-fto-body .cd-export-menu-options a { min-height: 44px; padding: .7rem .85rem; color: var(--at-text-primary); text-decoration: none; }
  body.cd-fto-body .cd-export-menu-options a:hover,
  body.cd-fto-body .cd-export-menu-options a:focus-visible { color: var(--at-interaction-primary); background: var(--at-surface-subtle); }
  body.cd-fto-body .cd-enterprise-family-nav { overflow-x: auto; flex-wrap: nowrap; padding: var(--at-space-1) 0 var(--at-space-3); }
  body.cd-fto-body .cd-enterprise-family-nav a { flex: 0 0 auto; border-radius: var(--at-radius-pill); font-size: var(--at-text-xs); white-space: nowrap; }
  body.cd-fto-body .cd-report-filter-panel { margin: var(--at-space-4) 0; border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-lg); background: var(--at-surface-subtle); }
  body.cd-fto-body .cd-report-filter-panel summary { cursor: pointer; padding: var(--at-space-3) var(--at-space-4); color: var(--at-text-primary); font-weight: 750; }
  body.cd-fto-body .cd-report-filter-panel .cd-fto-report-filters { margin: 0; border: 0; border-top: 1px solid var(--at-border-subtle); border-radius: 0; }
  body.cd-fto-body .cd-report-filter-form { margin: var(--at-space-4) 0; padding: var(--at-space-4); border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-lg); background: var(--at-white); }
  body.cd-fto-body .cd-report-filter-form .cd-panel-heading h3,
  body.cd-fto-body .cd-report-confidentiality h3 { margin: 0; font-size: var(--at-text-md); }
  body.cd-fto-body .cd-report-common-filters .cd-fto-report-filters { margin: var(--at-space-3) 0 0; padding: 0; border: 0; box-shadow: none; }
  body.cd-fto-body .cd-report-confidentiality { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 1fr); gap: var(--at-space-4); margin: var(--at-space-4) 0; padding: var(--at-space-4); border: 1px solid var(--at-warning); border-radius: var(--at-radius-lg); background: var(--at-warning-surface); }
  body.cd-fto-body .cd-report-confidentiality p { margin: var(--at-space-1) 0 0; color: var(--at-text-secondary); font-size: var(--at-text-sm); }
  body.cd-fto-body .cd-report-confidentiality .cd-fto-report-filters { margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; }
  body.cd-fto-body .cd-report-filter-form > .cd-filter-actions { justify-content: flex-end; margin-top: var(--at-space-4); }
  body.cd-fto-body .cd-active-filter-summary { margin: var(--at-space-3) 0 var(--at-space-4); }
  body.cd-fto-body .cd-active-filter-summary h3 { margin: 0 0 var(--at-space-2); font-size: var(--at-text-sm); }
  body.cd-fto-body .cd-active-filter-summary div { display: flex; flex-wrap: wrap; gap: var(--at-space-2); }
  body.cd-fto-body .cd-active-filter-summary span { border: 1px solid var(--at-border-subtle); border-radius: var(--at-radius-pill); padding: .3rem .6rem; color: var(--at-text-secondary); background: var(--at-surface-subtle); font-size: var(--at-text-xs); }
  body.cd-fto-body .cd-report-output-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--at-space-3); margin: var(--at-space-4) 0; color: var(--at-text-secondary); font-size: var(--at-text-sm); }
  body.cd-fto-body .cd-version-context { display: flex; flex-wrap: wrap; gap: var(--at-space-2); margin: var(--at-space-3) 0; }
  body.cd-fto-body .cd-version-context span { border: 1px solid var(--at-info); border-radius: var(--at-radius-pill); padding: .3rem .6rem; color: var(--at-info); background: var(--at-info-surface); font-size: var(--at-text-xs); }
  body.cd-fto-body .cd-report-metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--at-space-3); margin: var(--at-space-4) 0; }
  body.cd-fto-body .cd-report-metric { padding: var(--at-space-3); }
  body.cd-fto-body .cd-report-metric span { display: block; color: var(--at-text-secondary); font-size: var(--at-text-xs); }
  body.cd-fto-body .cd-report-metric strong { display: block; margin-top: var(--at-space-1); color: var(--at-text-primary); font-size: var(--at-text-xl); }
  body.cd-fto-body .cd-report-metric.warning { border-left: 4px solid var(--at-warning); }
  body.cd-fto-body .cd-report-metric.critical { border-left: 4px solid var(--at-danger); }
  body.cd-fto-body .cd-report-metric-link { color: inherit; text-decoration: none; }
  body.cd-fto-body .cd-report-metric-link small { color: var(--at-interaction-primary); font-weight: 700; }
  body.cd-fto-body .cd-training-integration { display: flex; justify-content: space-between; gap: var(--at-space-4); margin: var(--at-space-4) 0; padding: var(--at-space-3) var(--at-space-4); border: 1px solid var(--at-success); border-radius: var(--at-radius-lg); color: var(--at-success); background: var(--at-success-surface); }
  body.cd-fto-body .cd-enterprise-table { overflow: auto; }
  body.cd-fto-body .cd-enterprise-table table { min-width: max-content; }
  body.cd-fto-body .cd-pagination { display: flex; align-items: center; justify-content: flex-end; gap: var(--at-space-2); margin: var(--at-space-4) 0; }
  body.cd-fto-body .cd-pagination span { margin-right: auto; color: var(--at-text-secondary); }
  body.cd-fto-body .cd-historical-groups { display: grid; gap: var(--at-space-5); margin-top: var(--at-space-5); }
  body.cd-fto-body .cd-historical-group { min-width: 0; }
  body.cd-fto-body .cd-historical-group .cd-panel-heading { margin-bottom: var(--at-space-3); }
  body.cd-fto-body .cd-historical-group .cd-panel-heading h2 { margin: 0; font-size: var(--at-text-lg); }
  body.cd-fto-body .cd-historical-grid { grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
  body.cd-fto-body .cd-historical-grid .cd-dashboard-card,
  body.cd-fto-body .cd-fto-admin-grid .cd-dashboard-card { display: flex; flex-direction: column; min-height: 0; padding: var(--at-space-4); }
  body.cd-fto-body .cd-historical-grid .cd-dashboard-card h3 { margin: 0; color: var(--at-text-primary); font-size: var(--at-text-md); line-height: 1.25; }
  body.cd-fto-body .cd-historical-grid .cd-dashboard-card p,
  body.cd-fto-body .cd-fto-admin-grid .cd-dashboard-card p { margin: var(--at-space-2) 0; color: var(--at-text-secondary); font-size: var(--at-text-sm); line-height: 1.45; }
  body.cd-fto-body .cd-card-action { display: block; margin-top: auto; padding-top: var(--at-space-2); color: var(--at-interaction-primary); font-size: var(--at-text-sm); font-weight: 750; }

  @media (max-width: 700px) {
    body.cd-fto-body .cd-report-picker,
    body.cd-fto-body .cd-report-confidentiality { grid-template-columns: minmax(0, 1fr); padding: var(--at-space-4); }
    body.cd-fto-body .cd-report-picker-form,
    body.cd-fto-body .cd-report-picker-form-compact { grid-template-columns: minmax(0, 1fr); max-width: none; }
    body.cd-fto-body .cd-enterprise-report-heading { align-items: stretch; flex-direction: column; }
    body.cd-fto-body .cd-export-menu { align-self: flex-start; }
    body.cd-fto-body .cd-export-menu-options { right: auto; left: 0; }
    body.cd-fto-body .cd-report-filter-form { padding: var(--at-space-3); }
    body.cd-fto-body .cd-report-filter-form > .cd-filter-actions { align-items: stretch; flex-direction: column; }
  }

  /* Policy consumes the shared authenticated typography and UI tokens. */
  body.cd-policy-compliance-body {
    --policy-navy: var(--at-brand-navy);
    --policy-blue: var(--at-interaction-primary);
    --policy-ink: var(--at-text-primary);
    --policy-muted: var(--at-text-muted);
    --policy-line: var(--at-border-subtle);
    --policy-soft: var(--at-surface-subtle);
    --policy-success: var(--at-success);
    --policy-danger: var(--at-danger);
  }

  body.cd-policy-compliance-body .policy-module-nav { border-bottom-color: var(--at-module-policy); }
  body.cd-policy-compliance-body .policy-body { padding-top: var(--ps-common-header-height); }
  body.cd-policy-compliance-body .policy-page { width: min(90rem, calc(100% - 2rem)); }
  body.cd-policy-compliance-body .policy-button-primary { border-color: var(--at-interaction-primary); background: var(--at-interaction-primary); }
  body.cd-policy-compliance-body :where(.policy-document, .policy-redline) { max-width: 100%; overflow-wrap: anywhere; font-family: var(--at-font-sans); }
  body.cd-policy-compliance-body .policy-editor { max-width: 100%; overflow-x: auto; overflow-wrap: anywhere; font-family: var(--at-font-sans); }
  body.cd-policy-compliance-body .policy-editor h1,
  body.cd-policy-compliance-body .policy-editor h2,
  body.cd-policy-compliance-body .policy-editor h3,
  body.cd-policy-compliance-body .policy-document h1,
  body.cd-policy-compliance-body .policy-document h2,
  body.cd-policy-compliance-body .policy-document h3 { font-family: var(--at-font-sans); }
  body.cd-policy-compliance-body .policy-editor-toolbar,
  body.cd-policy-compliance-body .policy-comparison-navigation { top: calc(var(--ps-common-header-height) + var(--at-space-2)); }
  body.cd-policy-compliance-body .policy-comparison-change:focus-visible { outline-color: var(--at-focus-color); }
  body.cd-policy-compliance-body .policy-work-row.at-my-work-item { grid-template-columns: minmax(100px, .55fr) minmax(170px, 1.15fr) minmax(180px, 1.15fr) minmax(190px, 1.25fr) auto; }

  @media (max-width: 56.25rem) {
    body.cd-training-body .cd-training-inline-form { min-width: 0; }
  }

  @media (max-width: 52rem) {
    body[data-authenticated-ui="true"] :where(.at-page-header, .cd-page-hero, .cd-page-title-row, .cd-module-title-row, .policy-page-heading),
    body.cd-fto-body :where(.cd-enterprise-report-heading, .cd-training-integration) {
      align-items: stretch;
      flex-direction: column;
    }

    body.cd-fto-body .cd-export-actions { justify-content: flex-start; }
    body.cd-fto-body .cd-report-family-grid { grid-template-columns: 1fr; }
    body.cd-fto-body .cd-fto-tabbar--desktop { display: none; }
    body.cd-fto-body .cd-fto-navigation-trigger {
      display: flex;
      width: 100%;
      min-width: 0;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--at-space-3);
      text-align: left;
    }
    body.cd-fto-body .cd-fto-navigation-trigger small {
      min-width: 0;
      color: var(--at-text-secondary);
      overflow-wrap: anywhere;
    }
    body.cd-fto-body .cd-fto-navigation-dialog {
      width: min(34rem, calc(100% - 1rem));
      max-height: calc(100dvh - 1rem);
      padding: 0;
    }
    body.cd-fto-body .cd-fto-navigation-dialog::backdrop { background: var(--at-surface-overlay); }
    body.cd-fto-body .cd-fto-navigation-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
    body.cd-fto-body .cd-fto-navigation-dialog-header {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: var(--at-space-3);
      padding: var(--at-space-4);
      border-bottom: 1px solid var(--at-border-subtle);
    }
    body.cd-fto-body .cd-fto-navigation-dialog-header :where(p, h2) { margin: 0; }
    body.cd-fto-body .cd-fto-dialog-navigation {
      display: grid;
      min-height: 0;
      gap: var(--at-space-1);
      overflow-y: auto;
      overscroll-behavior: contain;
      padding: var(--at-space-4);
    }
    body.cd-fto-body .cd-fto-dialog-navigation .cd-sidebar-link { display: flex; align-items: center; padding: var(--at-space-3); }
    body[data-authenticated-ui="true"] .cd-recent-row.at-notification { grid-template-columns: 1fr; }
  }

  @media (max-width: 61.25rem) {
    body.cd-policy-compliance-body .policy-work-row.at-my-work-item { grid-template-columns: minmax(100px, .55fr) 1fr 1fr; }
  }

  @media (max-width: 42.5rem) {
    body.cd-policy-compliance-body .policy-work-row.at-my-work-item { grid-template-columns: 1fr; }
  }

  body.cd-fto-body .cd-fto-test-definition,
  body.cd-fto-body .cd-fto-builder-section,
  body.cd-fto-body .cd-fto-builder-question { min-width: 0; }
  body.cd-fto-body .cd-fto-test-question {
    min-width: 0;
    margin: 0 0 var(--at-space-4);
    padding: var(--at-space-4);
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-md);
  }
  body.cd-fto-body .cd-fto-test-question legend { max-width: 100%; font-weight: 700; overflow-wrap: anywhere; }
  body.cd-fto-body .cd-question-points { margin-left: var(--at-space-2); color: var(--at-text-secondary); font-weight: 400; }
  body.cd-fto-body .cd-required-text { margin-left: var(--at-space-2); color: var(--at-danger); }
  body.cd-fto-body .cd-choice-list { display: grid; gap: var(--at-space-2); }
  body.cd-fto-body .cd-choice-option {
    display: flex;
    min-height: 2.75rem;
    align-items: center;
    gap: var(--at-space-3);
    padding: var(--at-space-3);
    border: 1px solid var(--at-border-subtle);
    border-radius: var(--at-radius-sm);
    cursor: pointer;
    overflow-wrap: anywhere;
  }
  body.cd-fto-body .cd-choice-option:focus-within { outline: 3px solid var(--at-focus-color); outline-offset: 2px; }
  body.cd-fto-body .cd-choice-option input { width: 1.25rem; height: 1.25rem; flex: 0 0 auto; }
  body.cd-fto-body .cd-preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
  body.cd-fto-body .cd-sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: var(--at-space-3);
    padding: var(--at-space-3);
    border: 1px solid var(--at-border-subtle);
    background: var(--at-surface-panel);
  }
  body.cd-fto-body .cd-fto-option-list li { margin-bottom: var(--at-space-3); overflow-wrap: anywhere; }

  @media (max-width: 32rem) {
    body.cd-fto-body .cd-fto-test-question { padding: var(--at-space-3); }
    body.cd-fto-body .cd-sticky-actions { align-items: stretch; flex-direction: column; }
    body.cd-fto-body .cd-sticky-actions :where(button, a) { width: 100%; min-height: 2.75rem; }
  }
}
