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

.access-requests-page {
    padding: 2rem var(--grid-margin);
}

/* Breadcrumb */
.access-requests-breadcrumb {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.access-requests-breadcrumb a {
    color: #256585;
    text-decoration: underline;
}

.access-requests-breadcrumb a:hover {
    color: #256585;
    text-decoration: underline;
}

.access-requests-breadcrumb a:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

.access-requests-breadcrumb .breadcrumb-separator {
    margin: 0 0.5rem;
    color: #565C65;
}

.access-requests-breadcrumb .breadcrumb-current {
    color: #3d4551;
}

/* MudBlazor's .mud-tabs-tabbar applies its own var(--mud-palette-surface) background;
   override here (pinned to the installed DHCS.MESMD.Lib.UI package version, whose
   tabs.css doesn't yet win that specificity tie) so the tab bar matches the page background. */
.access-requests-page .mud-tabs-tabbar {
    background-color: transparent;
}

/* MudTabs uses ApplyEffectsToContainer="true", so the same DOM element carries both
   .mud-tab and .mud-ripple. app.css's global ".mud-ripple" rule
   (rgba(23, 49, 90, 0.15) !important, for click-ripple effects on buttons elsewhere)
   was therefore tinting the tab bar statically — including persistently on the active
   tab after a click, since it beats the (non-!important) active/focus rules shipped in
   the installed DHCS.MESMD.Lib.UI package regardless of state. Reset unconditionally at
   low specificity (3 classes) here, then re-win the background for genuine hover/focus/
   active-hover states below via a higher-specificity !important rule for each, so it
   can't silently persist outside those states. */
.access-requests-page .mud-tab.mud-ripple {
    background-color: transparent !important;
}

.access-requests-page .mud-tab.mud-ripple:hover:not(.mud-disabled) {
    background-color: var(--dhcs-color-bg-grey-hover) !important;
}

.access-requests-page .mud-tab.mud-ripple:focus-visible {
    background-color: transparent !important;
}

.access-requests-page .mud-tab.mud-ripple:focus-visible:hover {
    background-color: var(--dhcs-color-bg-grey-hover) !important;
}

.access-requests-page .mud-tab.mud-ripple.mud-tab-active:hover {
    background-color: var(--dhcs-color-bg-grey-hover) !important;
}

/* Match tab labels to their associated panel headings. The library Tabs component
   accepts text only, so this page uses MudTabs to render the pending-count pill.
   text-transform: none overrides MudBlazor's default uppercase on .mud-tab. */
.access-requests-page .ar-tab-label {
    font-family: "Public Sans", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: none;
}

.access-requests-page .ar-tab-heading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.access-requests-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
}

.access-requests-header h1 {
    font-family: "Public Sans", sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.5rem 0;
}

.access-requests-subtitle {
    font-family: "Public Sans", sans-serif;
    font-size: 1rem;
    color: var(--dhcs-color-text-muted);
    margin: 0;
}

.access-requests-loading,
.access-requests-error {
    padding: 3rem;
    text-align: center;
    color: var(--dhcs-color-text-dark);
    font-family: "Public Sans", sans-serif;
}

/* Section */
.ar-section {
    background: var(--dhcs-color-bg-white);
    border: 1px solid var(--dhcs-color-border-default);
    border-radius: 8px;
    box-shadow: 0 3px 6px 0 rgba(27, 27, 27, 0.27);
    overflow: hidden;
}

.ar-section-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--dhcs-color-border-input);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ar-section-header h2 {
    font-family: "Public Sans", sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.ar-count {
    background-color: var(--dhcs-color-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 8px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Story 3.1: Pending approvals count badge uses warning color per AC
   ("Tag AlertStatus.Warning") to draw producer attention to outstanding
   work. Falls back to a WCAG-AA-compliant amber (#b45309 ≈ 4.7:1 on white)
   when the CSS variable is unavailable. Finding #3: changed fallback from
   #d97706 to #b45309 for WCAG 2.1 AA compliance (4.5:1 contrast). */
.ar-count-warning {
    background-color: var(--dhcs-color-status-warning, #b45309);
    color: white;
}

/* Story 3.4: custom claims panel — inline in the expanded producer row. */
.ar-claims-panel {
    padding: 1rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.ar-claims-heading {
    font-family: "Public Sans", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}
.ar-claim-field {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    /* Reset browser fieldset defaults so the multiselect variant matches the
       scalar <div> variant visually — the fieldset is only used for a11y
       (native label-to-group association via <legend>). */
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;
}
.ar-claim-field .dhcs-select {
    max-width: 460px;
}
.ar-claim-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: "Public Sans", sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dhcs-color-text-primary);
}
.ar-claim-error {
    color: var(--dhcs-color-status-error, #b91c1c);
    font-family: "Public Sans", sans-serif;
    font-size: 0.8125rem;
    font-weight: 600;
}

/* Story 3.6: "Request More Info" inline panel */
.ar-more-info-panel {
    padding: 1rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ar-more-info-textarea {
    width: 100%;
    max-width: 640px;
    padding: 8px;
    font-family: "Public Sans", sans-serif;
    font-size: 0.875rem;
    border: 1px solid var(--dhcs-color-border-input);
    border-radius: 4px;
    background-color: var(--dhcs-color-bg-white);
    color: var(--dhcs-color-text-primary);
    resize: vertical;
}
.ar-more-info-textarea.ar-claim-field-invalid {
    border-color: var(--dhcs-color-status-error, #b91c1c);
}

.ar-section-desc {
    font-family: "Public Sans", sans-serif;
    font-size: 0.875rem;
    color: var(--dhcs-color-text-dark);
    margin: 0;
    width: 100%;
}

.ar-empty {
    padding: 2rem 1.5rem;
    color: var(--dhcs-color-text-dark);
    font-family: "Public Sans", sans-serif;
    font-size: 0.9rem;
}

/* Story 3.10: empty state with a CTA — used on "My team's requests"
   when the user hasn't submitted any access requests yet. */
.ar-empty-with-cta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}
.ar-empty-with-cta p {
    margin: 0;
}
.ar-empty-cta {
    display: inline-block;
    padding: 8px 16px;
    background-color: var(--dhcs-color-primary, #17315A);
    color: white !important;
    text-decoration: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.875rem;
}
.ar-empty-cta:hover,
.ar-empty-cta:focus-visible {
    background-color: var(--dhcs-color-primary-hover, #0e2244);
}

/* Table */
.ar-table-wrapper {
    overflow-x: auto;
}

.ar-table {
    width: 100%;
    border-collapse: collapse;
    font-family: "Public Sans", sans-serif;
    font-size: 0.875rem;
}

.ar-table thead tr {
    background-color: var(--dhcs-color-bg-light);
    border-bottom: 1px solid var(--dhcs-color-border-input);
}

.ar-table th {
    padding: 12px;
    min-height: 44px;
    text-align: left;
    font-weight: 700;
    color: var(--dhcs-color-text-heading);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.ar-table td {
    padding: 12px;
    color: var(--dhcs-color-text-primary);
    border-bottom: 1px solid var(--dhcs-color-bg-neutral);
    vertical-align: middle;
}

.ar-table tbody tr:last-child td {
    border-bottom: none;
}

.ar-table tbody tr:hover td {
    background-color: var(--dhcs-color-bg-light);
}

.ar-api-name {
    font-weight: 600;
    color: var(--primary) !important;
}

.ar-primary {
    color: var(--primary) !important;
}

.ar-email {
    color: var(--primary) !important;
    font-size: 0.825rem !important;
}

.ar-date {
    color: var(--primary) !important;
    font-size: 0.825rem !important;
    white-space: nowrap;
}

.ar-client-id {
    font-family: "Courier New", monospace !important;
    font-size: 0.775rem !important;
    color: var(--primary) !important;
    min-width: 280px;
    max-width: 420px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status badges */
.ar-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.ar-status-requested {
    background-color: var(--dhcs-color-badge-warning-bg);
    color: var(--dhcs-color-badge-warning-text);
}

.ar-status-approved {
    background-color: var(--dhcs-color-badge-warning-bg);
    color: var(--dhcs-color-badge-warning-text);
}

.ar-status-denied {
    background-color: var(--dhcs-color-badge-error-bg);
    color: var(--dhcs-color-badge-error-text);
}

.ar-status-provisioned {
    background-color: var(--dhcs-color-badge-info-bg);
    color: var(--dhcs-color-badge-info-text);
}

.ar-status-revoked {
    background-color: var(--dhcs-color-bg-neutral);
    color: var(--dhcs-color-text-heading);
}

/* Expiry countdown (Story 2.1 / UX-DR10) */
.ar-expiry {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.ar-expiry-neutral {
    color: var(--dhcs-color-text-body, inherit);
}

.ar-expiry-warning {
    color: var(--dhcs-color-badge-warning-text, #8a6116);
    font-weight: 600;
}

.ar-expiry-error {
    color: var(--dhcs-color-badge-error-text, #a12622);
    font-weight: 600;
}

/* Environment badges */
.ar-env {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
    background-color: var(--dhcs-color-bg-neutral);
    color: var(--dhcs-color-text-heading);
}

.ar-env-prod {
    background-color: var(--dhcs-color-badge-error-bg);
    color: var(--dhcs-color-badge-error-text);
}

.ar-env-sit {
    background-color: var(--dhcs-color-badge-warning-bg);
    color: var(--dhcs-color-badge-warning-text);
}

.ar-env-dev {
    background-color: var(--dhcs-color-badge-info-bg);
    color: var(--dhcs-color-badge-info-text);
}

/* Toolbar above table */
.ar-table-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid var(--dhcs-color-bg-neutral);
    background: var(--dhcs-color-bg-surface);
    flex-wrap: wrap;
}

.ar-search-label {
    display: flex;
    align-items: center;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 360px;
}

.ar-search-input {
    width: 100%;
    font-family: "Public Sans", sans-serif;
    font-size: 0.875rem;
    color: var(--dhcs-color-text-primary);
    border: 1px solid var(--dhcs-color-border-input);
    border-radius: 4px;
    padding: 11px 10px 11px 32px;
    min-height: 44px;
    background: var(--dhcs-color-bg-white) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235c636a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E") no-repeat 8px center;
    background-size: 16px 16px;
    transition: border-color 0.15s ease;
}

.ar-search-input:focus {
    outline: 2px solid var(--border-focus);
    outline-offset: 0;
    box-shadow: none;
}

.ar-search-input::-webkit-search-cancel-button {
    cursor: pointer;
}

.ar-results-label {
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
    color: var(--dhcs-color-text-dark);
}

.ar-page-size-label {
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
    color: var(--dhcs-color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}

.ar-page-size-text {
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
    color: var(--dhcs-color-text-muted);
    white-space: nowrap;
}

.ar-page-size-label .ar-page-size-select {
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
    color: var(--dhcs-color-text-dark);
    padding: 10px 10px;
    border: 1px solid var(--dhcs-color-border, #bfc6ce);
    border-radius: 4px;
    background-color: #fff;
    cursor: pointer;
    width: 80px;
    min-height: 44px;
    appearance: auto;
}

.ar-page-size-label .ar-page-size-select:focus {
    outline: 2px solid var(--dhcs-color-primary, #0d6efd);
    outline-offset: 1px;
}

/* Library Select component in toolbar — 44px touch target (WCAG 2.5.8) */
.ar-page-size-label .dhcs-select {
    width: 90px;
    gap: 0;
}

.ar-page-size-label .dhcs-select .mud-input-control {
    margin: 0 !important;
}

.ar-page-size-label .dhcs-select .mud-input-helper-text,
.ar-page-size-label .dhcs-select .mud-input-control-helper-container {
    display: none;
}

.ar-page-size-label .dhcs-select .mud-input {
    height: 44px;
}

.ar-page-size-label .dhcs-select .mud-input-slot {
    padding: 0 0 0 14px !important;
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
}

/* Sortable column headers */
.ar-th-sortable {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.ar-th-sortable:hover {
    background-color: var(--dhcs-color-bg-neutral);
}

.ar-sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 0.75rem;
}

.ar-sort-inactive {
    color: var(--dhcs-color-text-muted);
}

.ar-sort-active {
    color: var(--dhcs-color-primary);
}

/* Pagination */
.ar-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 24px;
    border-top: 1px solid var(--dhcs-color-bg-neutral);
}

.ar-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 8px;
    border: 1px solid var(--dhcs-color-border-input);
    border-radius: 4px;
    background: var(--dhcs-color-bg-white);
    font-family: "Public Sans", sans-serif;
    font-size: 0.825rem;
    color: var(--dhcs-color-text-primary);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ar-page-btn:hover:not(:disabled) {
    background-color: var(--dhcs-color-bg-neutral);
    border-color: var(--dhcs-color-border-disabled);
}

.ar-page-btn:disabled {
    color: var(--dhcs-color-text-muted);
    cursor: not-allowed;
    background: var(--dhcs-color-bg-light);
}

.ar-page-btn.active {
    background-color: var(--dhcs-color-primary);
    border-color: var(--dhcs-color-primary);
    color: var(--dhcs-color-text-white);
    font-weight: 700;
}

.ar-page-btn:focus-visible {
    outline: 2px solid var(--dhcs-color-secondary-dark);
    outline-offset: 2px;
}

.ar-page-btn:focus-visible {
    outline: 2px solid var(--dhcs-color-secondary-dark);
    outline-offset: -2px;
}

/* ═══════════════════════════════════════════════════════════════════════
   EXPANDABLE ROWS — Pending approval rows expand to show details
   ═══════════════════════════════════════════════════════════════════════ */

/* Toggle column */
.ar-th-toggle {
    width: 40px;
    min-width: 40px;
    padding: 0 !important;
}

.ar-td-toggle {
    width: 40px;
    min-width: 40px;
    text-align: center;
    padding: 0 8px !important;
}

.ar-chevron {
    color: var(--dhcs-color-text-muted, #565c65);
    transition: transform 0.2s ease;
    vertical-align: middle;
}

.ar-chevron-open {
    transform: rotate(90deg);
}

/* Expandable row */
.ar-row-expandable {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ar-row-expandable:hover {
    background-color: var(--dhcs-color-bg-light, #f9fafb);
}

.ar-row-expanded {
    background-color: var(--dhcs-color-bg-light, #f9fafb);
    border-bottom-color: transparent;
}

.ar-row-expandable:focus-visible {
    outline: 2px solid var(--border-focus);
    outline-offset: -2px;
}

/* Expansion row */
.ar-expand-row {
    background-color: var(--dhcs-color-bg-white, #fff);
}

.ar-expand-row > td {
    padding: 0 !important;
    border-bottom: 1px solid var(--dhcs-color-border-input, #dfe1e2);
}

/* Expansion panel */
.ar-expand-panel {
    padding: 24px 32px 24px 56px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-top: 1px solid var(--dhcs-color-border-input, #dfe1e2);
}

/* Detail grid */
.ar-expand-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 32px;
}

.ar-detail-field {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ar-detail-field-full {
    grid-column: 1 / -1;
}

.ar-detail-label {
    font-family: "Public Sans", sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--dhcs-color-text-muted, #565c65);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 0;
}

.ar-detail-value {
    font-family: "Source Sans 3", "Source Sans Pro", sans-serif;
    font-size: 15px;
    color: var(--dhcs-color-text-primary, #1b1b1b);
    word-break: break-word;
    margin: 0;
}

.ar-detail-monospace {
    font-family: "Source Code Pro", monospace;
    font-size: 14px;
}

.ar-detail-reason {
    white-space: pre-wrap;
}

/* Action buttons row */
.ar-expand-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 4px;
}

/* 44px button touch target (WCAG 2.5.8) */
.ar-expand-actions .mud-button-root {
    min-height: 44px !important;
    height: 44px !important;
}

/* Beats the DHCS lib's 4-class !important rule (.dhcs-button-wrapper .mud-button-root.dhcs-button-outlined.dhcs-button-primary). */
.dhcs-button-wrapper .mud-button-root.dhcs-button-outlined.dhcs-button-primary.dhcs-button-danger {
    color: #b42318 !important;
    border-color: #b42318 !important;
    background-color: transparent !important;
}

.ar-new-request-cta {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-family: "Public Sans", sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary, #17315A);
    text-decoration: underline;
}

.ar-new-request-cta:hover,
.ar-new-request-cta:focus-visible {
    color: var(--primary-dark, #0f2340);
}

/* Button with tooltip wrapper */
.ar-btn-with-tooltip {
    position: relative;
    display: inline-flex;
}

.ar-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background-color: var(--primary, #17315A);
    color: #fff;
    font-family: "Public Sans", sans-serif;
    font-size: 13px;
    line-height: 1.4;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.ar-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 16px;
    border: 6px solid transparent;
    border-top-color: var(--primary, #17315A);
}

.ar-btn-with-tooltip:hover .ar-tooltip {
    display: block;
}
