/* Enterprise application shell and shared feature patterns. */
[hidden] {
    display: none !important;
}

.skip-link {
    position: fixed;
    z-index: 5000;
    top: 8px;
    right: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    background: #ffffff;
    color: #082f3a;
    box-shadow: 0 8px 30px rgb(0 0 0 / 0.2);
    transform: translateY(-140%);
}

.skip-link:focus {
    transform: translateY(0);
}

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

button,
input,
select,
textarea {
    font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus-ring) 34%, transparent);
    outline-offset: 2px;
}

body.modal-open {
    overflow: hidden;
}

/* Shell */
.sidebar {
    width: var(--sidebar-width);
    box-shadow: -1px 0 0 rgb(255 255 255 / 0.04);
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 18px 16px 16px;
}

.sidebar-menu {
    gap: 14px;
    padding: 12px 10px;
    overscroll-behavior: contain;
}

.nav-group {
    display: grid;
    gap: 3px;
}

.nav-group-label {
    padding: 0 10px 5px;
    color: #8aa0ae;
    font-size: 10.5px;
    font-weight: 700;
}

.menu-item {
    width: 100%;
    min-height: 39px;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #c3d0d8;
    font-size: 12.5px;
    text-align: right;
    letter-spacing: 0;
}

.menu-item svg {
    flex: 0 0 17px;
    width: 17px;
    height: 17px;
}

.menu-item:hover {
    border-color: rgb(255 255 255 / 0.08);
    background: rgb(255 255 255 / 0.055);
    color: #ffffff;
}

.menu-item.active {
    border-color: rgb(62 185 202 / 0.32);
    background: #08778a;
    box-shadow: none;
}

.menu-count {
    min-width: 20px;
    height: 20px;
    margin-right: auto;
    padding: 0 6px;
    border-radius: 10px;
    background: #d92d20;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    line-height: 20px;
    text-align: center;
}

.sidebar-footer {
    flex: 0 0 auto;
    padding: 10px;
    text-align: initial;
}

.sidebar-account {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid rgb(255 255 255 / 0.08);
    border-radius: 6px;
    background: rgb(255 255 255 / 0.035);
}

.sidebar-account-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: #dff3f5;
    color: #075b69;
    font-size: 12px;
    font-weight: 800;
}

.sidebar-account-copy {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.sidebar-account-copy strong {
    color: #ffffff;
    font-size: 11px;
}

.sidebar-account-copy span {
    overflow: hidden;
    color: #9fb1bc;
    font-family: Consolas, monospace;
    font-size: 9px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sidebar-account-logout {
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #f9a8a8;
    cursor: pointer;
}

.sidebar-account-logout:hover {
    background: rgb(239 68 68 / 0.14);
    color: #fecaca;
}

.sidebar-account-logout svg {
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

.sidebar-version {
    padding: 8px 4px 0;
    color: #718895;
    font-size: 9px;
    text-align: center;
}

.main-wrapper {
    min-width: 0;
    margin-right: var(--sidebar-width);
    padding: 0 28px 40px;
}

.top-header {
    position: sticky;
    z-index: 60;
    top: 0;
    min-height: 84px;
    margin: 0 -28px 22px;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-main);
}

.header-title-section {
    min-width: 0;
    gap: 10px;
}

.header-title-copy {
    min-width: 0;
    padding-right: 12px;
    border-right: 3px solid var(--primary);
}

.page-eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
}

.header-title-copy h1,
.header-title-section h1 {
    margin: 0;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0;
}

.header-title-copy p,
.header-title-section p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 11.5px;
    line-height: 1.5;
}

.header-actions {
    gap: 8px;
}

.header-actions .btn-icon {
    width: 42px;
    height: 42px;
}

.app-section {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
}

/* Shared page and data structures */
.section-toolbar {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.section-toolbar h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 16px;
    font-weight: 800;
}

.section-toolbar p {
    max-width: 720px;
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 11.5px;
    line-height: 1.6;
}

.section-actions,
.toolbar-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.summary-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    margin-bottom: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--border-color);
}

.summary-metric {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}

.summary-metric > span {
    display: block;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
}

.summary-metric strong span {
    display: inline;
    margin: 0;
    color: inherit;
    font: inherit;
}

.summary-metric strong {
    display: block;
    margin-top: 4px;
    color: var(--text-main);
    font-size: 20px;
    font-weight: 800;
}

.data-surface {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.data-surface + .data-surface {
    margin-top: 16px;
}

.data-surface-header {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.data-surface-header h3 {
    margin: 0;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 800;
}

.data-surface-header p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 10.5px;
}

.segmented-control {
    display: inline-flex;
    width: fit-content;
    gap: 2px;
    margin-bottom: 16px;
    padding: 3px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-subtle);
}

.segmented-control button {
    min-height: 40px;
    padding: 7px 13px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11.5px;
    font-weight: 700;
}

.segmented-control button[aria-selected="true"],
.segmented-control button.active {
    background: var(--bg-card);
    color: var(--primary-dark);
    box-shadow: 0 1px 3px rgb(15 23 42 / 0.12);
}

body.dark-theme .segmented-control button[aria-selected="true"],
body.dark-theme .segmented-control button.active {
    color: #8bd7e2;
}

.filter-row {
    display: flex;
    align-items: end;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-control {
    min-width: 150px;
    display: grid;
    gap: 4px;
}

.filter-control label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.compact-search {
    width: min(320px, 100%);
}

.result-count {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.empty-state {
    display: grid;
    min-height: 180px;
    place-items: center;
    gap: 6px;
    padding: 32px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state strong {
    color: var(--text-main);
    font-size: 14px;
}

.empty-state p {
    max-width: 460px;
    font-size: 11.5px;
}

.table-responsive {
    border-radius: 0;
}

.data-surface .table-responsive {
    border: 0;
}

table {
    table-layout: auto;
}

table caption {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

th {
    white-space: nowrap;
}

td {
    vertical-align: middle;
}

.row-primary {
    color: var(--text-main);
    font-size: 12.5px;
    font-weight: 750;
    line-height: 1.55;
}

.row-secondary {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

#policiesSection .policy-code {
    min-width: 92px;
    white-space: nowrap;
}

#policiesSection .policy-file {
    min-width: 94px;
}

#policiesSection .policy-actions {
    min-width: 126px;
}

#policiesSection .policy-actions .row-actions {
    flex-wrap: nowrap;
}

.status-pill {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 750;
    white-space: nowrap;
}

.status-pill::before {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    content: "";
}

.status-pill.success { border-color: #a6e7c8; background: #e9f9f1; color: #087443; }
.status-pill.warning { border-color: #f8d796; background: #fff8e8; color: #8a5800; }
.status-pill.danger { border-color: #f6b8b8; background: #fff0f0; color: #b42318; }
.status-pill.info { border-color: #afddeb; background: #eef9fc; color: #08677a; }
.status-pill.neutral { border-color: #d7dee4; background: #f4f6f8; color: #475467; }

body.dark-theme .status-pill { background: transparent; }

/* Platform administration */
.platform-tabs {
    margin-bottom: 16px;
}

.platform-panel[hidden] {
    display: none;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.settings-block {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.settings-block-icon {
    display: grid;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 6px;
    background: #e8f5f7;
    color: #086779;
    font-size: 17px;
    font-weight: 800;
}

.settings-block h3 {
    margin: 0;
    font-size: 14px;
}

.settings-block p {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.6;
}

.settings-block > .btn {
    grid-column: 1 / -1;
    width: fit-content;
}

.visually-hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

/* Existing feature cleanup */
.card {
    border-radius: 6px;
    box-shadow: none;
}

.card:hover {
    transform: none;
}

.stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.stat-card {
    min-height: 112px;
    border-radius: 6px;
}

button.stat-card {
    width: 100%;
    appearance: none;
    border: 1px solid var(--border-color);
    color: inherit;
    font: inherit;
    text-align: right;
    cursor: pointer;
}

button.stat-card:hover {
    border-color: color-mix(in srgb, var(--primary) 42%, var(--border-color));
    background: color-mix(in srgb, var(--bg-card) 96%, var(--primary));
}

.hospitals-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

.hospital-card {
    min-height: 156px;
    border-radius: 6px;
    text-align: right;
}

.hospital-detail-header,
.calendar-wrapper {
    border-radius: 6px;
    box-shadow: none;
}

.hospital-tabs .tab-btn {
    min-width: max-content;
    flex: 0 0 auto;
}

@media (max-width: 700px) {
    .hospital-tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        overflow: visible;
        padding: 4px;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--surface-subtle);
    }

    .hospital-tabs .tab-btn {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        padding: 7px 8px;
        border-radius: 4px;
        white-space: normal;
    }

    .hospital-tabs .tab-btn.active {
        border-bottom-color: transparent;
        background: var(--bg-card);
        box-shadow: 0 1px 3px rgb(15 23 42 / 0.1);
    }
}

.btn,
.btn-icon,
.tab-btn {
    min-height: 40px;
    border-radius: 6px;
    letter-spacing: 0;
}

.btn {
    white-space: nowrap;
}

.btn-icon {
    min-width: 40px;
}

.form-control,
.form-select {
    min-height: 42px;
    border-radius: 6px;
}

textarea.form-control {
    min-height: 92px;
}

.compact-row-select {
    min-width: 118px;
}

#govActionPlanTableBody td:last-child {
    min-width: 72px;
}

.modal-content {
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border-radius: 7px;
}

.modal-content > form {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.modal-header,
.modal-footer {
    flex: 0 0 auto;
}

.modal-body {
    min-height: 0;
    overflow-y: auto;
    flex: 1 1 auto;
    overscroll-behavior: contain;
}

.modal-header,
.modal-footer {
    background: var(--bg-card);
}

.modal-description {
    margin-top: 3px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.55;
}

.modal-heading {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.modal-heading .modal-title {
    margin: 0;
}

fieldset.form-section {
    min-width: 0;
    margin: 0 0 18px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

fieldset.form-section legend {
    padding: 0 7px;
    color: var(--text-main);
    font-size: 12px;
    font-weight: 800;
}

.form-help {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.standalone-filter-header {
    margin-bottom: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.records-list,
.initiative-list {
    display: grid;
    gap: 12px;
}

.record-list-item {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.record-list-header {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.record-list-header h3,
.agenda-copy h3,
.committee-minutes-panel h4 {
    margin: 0;
    color: var(--text-main);
    font-size: 13.5px;
    font-weight: 800;
    line-height: 1.55;
}

.record-list-header p,
.agenda-copy p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 10.5px;
}

.record-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--border-color);
}

.record-summary-grid > div {
    min-width: 0;
    padding: 12px 16px;
    background: var(--bg-card);
}

.record-summary-grid > .record-summary-wide {
    grid-column: 1 / -1;
}

.record-summary-grid span {
    display: block;
    margin-bottom: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.record-summary-grid p {
    margin: 0;
    color: var(--text-main);
    font-size: 11.5px;
    line-height: 1.75;
    white-space: pre-wrap;
}

.record-list-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: var(--surface-subtle);
}

.governance-workspace .layout-grid {
    grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr);
    align-items: start;
}

.calendar-wrapper {
    overflow: hidden;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.calendar-header {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto minmax(280px, 1fr);
    gap: 14px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--border-color);
    border-radius: 0;
}

.calendar-navigation {
    display: flex;
    gap: 6px;
}

.calendar-month-title {
    align-self: center;
    font-size: 16px;
    text-align: center;
}

.calendar-view-switch {
    justify-self: end;
    margin: 0;
}

.calendar-scroll {
    padding: 12px;
}

.calendar-grid {
    gap: 6px;
}

.calendar-day {
    min-height: 108px;
    justify-content: flex-start;
    gap: 5px;
    padding: 6px;
    border-radius: 5px;
}

.calendar-day.is-today {
    border-color: var(--primary);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.calendar-day-add {
    display: grid;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    align-self: flex-end;
    place-items: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
}

.calendar-day-add:hover,
.calendar-day.is-today .calendar-day-add {
    background: var(--primary);
    color: #ffffff;
}

.calendar-day-events {
    width: 100%;
    max-height: 68px;
}

.calendar-event-indicator {
    width: 100%;
    min-height: 23px;
    padding: 3px 5px;
    border: 0;
    border-radius: 3px;
    color: #ffffff;
    font-size: 9px;
    line-height: 1.4;
    text-align: right;
}

.calendar-event-indicator.onsite { background: #08778a; }
.calendar-event-indicator.remote { background: #287a55; }

.calendar-agenda {
    padding: 12px;
}

.agenda-item {
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.agenda-date {
    display: grid;
    min-height: 54px;
    place-items: center;
    border-radius: 5px;
    background: var(--surface-subtle);
    text-align: center;
}

.agenda-date strong {
    font-size: 18px;
}

.agenda-date span {
    color: var(--text-muted);
    font-size: 9.5px;
}

.shared-committee-layout {
    display: grid;
    grid-template-columns: minmax(220px, 0.75fr) minmax(0, 1.5fr);
    gap: 1px;
    background: var(--border-color);
}

.shared-committee-layout > * {
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
}

.compact-summary-grid {
    grid-template-columns: 1fr;
    align-content: start;
    padding: 0;
}

.committee-minutes-panel {
    display: grid;
    gap: 10px;
}

.inline-upload-form {
    display: grid;
    grid-template-columns: minmax(150px, 0.55fr) minmax(220px, 1fr) auto;
    align-items: end;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.inline-upload-form .form-group {
    margin: 0;
}

.file-picker-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.file-input-enhanced {
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 8px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.file-input-enhanced .btn {
    min-height: 40px;
    padding: 5px 10px;
}

.selected-file-name {
    min-width: 0;
    flex: 1 1 140px;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.initiative-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.initiative-controls .segmented-control {
    flex: 0 0 auto;
    margin: 0;
}

.initiative-card {
    margin: 0 !important;
}

.milestone-check {
    min-width: 0;
    display: flex;
    min-height: 40px;
    flex: 1 1 auto;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.milestone-check input {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    margin: 0;
    accent-color: var(--secondary);
}

.milestone-check input:checked + span {
    color: var(--text-muted);
    text-decoration: line-through;
}

#modalAddSentinel .modal-content {
    width: min(920px, calc(100vw - 24px));
}

.workflow-stepper {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
    padding: 0;
    list-style: none;
}

.workflow-stepper li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-muted);
}

.workflow-stepper li span {
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    border-radius: 50%;
    background: var(--surface-subtle);
    font-size: 10px;
    font-weight: 800;
}

.workflow-stepper li strong {
    overflow: hidden;
    font-size: 10.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-stepper li.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--bg-card) 94%, var(--primary));
    color: var(--primary-dark);
}

.workflow-stepper li.active span,
.workflow-stepper li.complete span {
    background: var(--primary);
    color: #ffffff;
}

.workflow-step {
    min-height: 360px;
}

.workflow-step[hidden] {
    display: none;
}

.workflow-step-title {
    margin: 0 0 14px;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 800;
}

.form-error-summary {
    margin-bottom: 14px;
    padding: 10px 12px;
    border: 1px solid #f2a7a7;
    border-right: 4px solid #d92d20;
    border-radius: 5px;
    background: #fff2f2;
    color: #9d1c16;
    font-size: 11.5px;
    font-weight: 700;
}

body.dark-theme .form-error-summary {
    background: transparent;
    color: #ffb4ae;
}

.department-picker-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.selection-count {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}

#modalAddSentinel #sentinelDeptsContainer {
    max-height: 310px !important;
}

#modalAddSentinel #sentinelDeptsContainer label {
    min-height: 42px;
    padding: 7px 9px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-card);
}

#modalAddSentinel #sentinelDeptsContainer label:has(input:checked) {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--bg-card) 93%, var(--primary));
}

@media (min-width: 1280px) {
    .stats-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    :root {
        --sidebar-width: min(320px, 86vw);
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    .main-wrapper {
        width: 100%;
        margin-right: 0;
        padding: 0 12px 28px;
    }

    .top-header {
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        min-height: 72px;
        margin: 0 -12px 14px;
        padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    }

    .header-title-copy {
        padding-right: 0;
        border-right: 0;
        text-align: center;
    }

    .page-eyebrow {
        display: none;
    }

    .header-title-copy h1,
    .header-title-section h1 {
        overflow: visible;
        font-size: 16px;
        line-height: 1.35;
        white-space: normal;
    }

    .header-title-copy p,
    .header-title-section p {
        overflow: hidden;
        font-size: 10px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .header-actions {
        grid-column: auto;
        justify-content: flex-end;
    }

    .header-actions .btn-icon {
        display: grid;
        width: 44px;
        height: 44px;
    }

    .nav-group-label {
        font-size: 11px;
    }

    .menu-item {
        min-height: 44px;
        font-size: 13px;
    }

    .sidebar-footer {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }

    .section-toolbar,
    .data-surface-header {
        align-items: stretch;
        flex-direction: column;
    }

    .standalone-filter-header,
    .record-list-header,
    .initiative-controls {
        align-items: stretch;
        flex-direction: column;
    }

    .section-toolbar {
        padding: 14px;
    }

    .section-actions,
    .toolbar-actions,
    .filter-row {
        width: 100%;
    }

    .section-actions .btn,
    .toolbar-actions .btn {
        flex: 1 1 130px;
        justify-content: center;
    }

    .summary-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .segmented-control {
        width: 100%;
        overflow-x: auto;
    }

    .segmented-control button {
        flex: 1 0 auto;
        min-height: 44px;
    }

    .filter-control,
    .compact-search {
        width: 100%;
        min-width: 0;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .governance-workspace .layout-grid,
    .shared-committee-layout {
        grid-template-columns: 1fr;
    }

    .calendar-header {
        grid-template-columns: 1fr;
    }

    .calendar-month-title {
        grid-row: 1;
    }

    .calendar-navigation,
    .calendar-view-switch {
        width: 100%;
        justify-self: stretch;
    }

    .calendar-navigation .btn,
    .calendar-view-switch button {
        flex: 1 1 0;
        justify-content: center;
    }

    .inline-upload-form {
        grid-template-columns: 1fr;
    }

    table[data-mobile-layout="cards"] {
        min-width: 0 !important;
        border: 0;
        background: transparent;
    }

    table[data-mobile-layout="cards"] thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    table[data-mobile-layout="cards"],
    table[data-mobile-layout="cards"] tbody,
    table[data-mobile-layout="cards"] tr,
    table[data-mobile-layout="cards"] td {
        display: block;
        width: 100%;
    }

    table[data-mobile-layout="cards"] tbody {
        padding: 10px;
    }

    table[data-mobile-layout="cards"] tr {
        margin-bottom: 10px;
        overflow: hidden;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        background: var(--bg-card);
    }

    table[data-mobile-layout="cards"] tr:last-child {
        margin-bottom: 0;
    }

    table[data-mobile-layout="cards"] td {
        display: grid;
        min-height: 42px;
        grid-template-columns: minmax(94px, 34%) minmax(0, 1fr);
        align-items: center;
        gap: 10px;
        padding: 9px 11px;
        border-bottom: 1px solid var(--border-color);
        white-space: normal;
    }

    table[data-mobile-layout="cards"] td::before {
        color: var(--text-muted);
        content: attr(data-label);
        font-size: 10px;
        font-weight: 750;
    }

    table[data-mobile-layout="cards"] td:last-child {
        border-bottom: 0;
    }

    table[data-mobile-layout="cards"] td[colspan] {
        display: block;
        padding: 24px 14px;
        text-align: center;
    }

    table[data-mobile-layout="cards"] td[colspan]::before {
        content: none;
    }

    .row-actions,
    table[data-mobile-layout="cards"] td:last-child .row-actions {
        width: 100%;
    }

    .row-actions .btn {
        flex: 1 1 110px;
        justify-content: center;
    }

    .modal-content {
        max-height: calc(100dvh - 8px);
    }

    .modal-footer {
        position: static;
    }
}

@media (max-width: 520px) {
    .summary-strip {
        grid-template-columns: 1fr 1fr;
    }

    .summary-metric {
        padding: 12px;
    }

    .summary-metric strong {
        font-size: 18px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .section-toolbar h2 {
        font-size: 15px;
    }
}

/* RCA case workspace */
.rca-registry-header {
    align-items: end;
}

.rca-registry-header .segmented-control {
    flex: 0 0 auto;
    margin: 0;
}

.progress-inline {
    min-width: 112px;
    display: grid;
    gap: 5px;
}

.progress-inline > span {
    color: var(--text-muted);
    font-size: 10.5px;
}

.progress-track {
    width: 100%;
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--border-color);
}

.progress-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--secondary);
}

.record-page-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) minmax(150px, 190px);
    align-items: center;
    gap: 18px;
    margin-bottom: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.record-back {
    align-self: start;
}

.record-heading {
    min-width: 0;
}

.record-heading-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.record-heading-line h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 17px;
    line-height: 1.55;
}

.record-heading-line .btn-icon {
    flex: 0 0 36px;
    width: 36px;
    min-width: 36px;
    height: 36px;
    min-height: 36px;
}

.record-metadata {
    display: flex;
    gap: 8px 18px;
    margin-top: 7px;
    color: var(--text-muted);
    font-size: 10.5px;
    flex-wrap: wrap;
}

.record-metadata strong {
    color: var(--text-main);
    font-weight: 700;
}

.record-stage-control {
    display: grid;
    gap: 4px;
}

.record-stage-control label {
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.record-context-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(300px, 2fr);
    gap: 1px;
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--border-color);
}

.record-context-bar > div {
    min-width: 0;
    padding: 10px 14px;
    background: var(--bg-card);
}

.record-context-bar > div > span {
    display: block;
    margin-bottom: 3px;
    color: var(--text-muted);
    font-size: 9.5px;
    font-weight: 700;
}

.record-context-bar strong {
    display: block;
    font-size: 11.5px;
    line-height: 1.55;
}

.tag-list {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.tag-list span {
    padding: 3px 7px;
    border: 1px solid #b8dfe6;
    border-radius: 10px;
    background: #eef9fb;
    color: #08667a;
    font-size: 9.5px;
    font-weight: 700;
}

body.dark-theme .tag-list span {
    background: transparent;
}

.record-tabs {
    position: sticky;
    z-index: 20;
    top: 90px;
    width: 100%;
    margin-bottom: 12px;
    background: var(--surface-subtle);
}

.record-tabs button {
    flex: 1 1 0;
}

.record-panel {
    min-height: 280px;
}

.record-panel[hidden] {
    display: none;
}

.case-overview-grid,
.documents-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.detail-block {
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.full-width-block {
    margin-top: 14px;
}

.detail-block-heading,
.panel-heading,
.verification-item-header,
.action-item-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.detail-block h3,
.panel-heading h3,
.side-form h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
}

.panel-heading {
    margin-bottom: 12px;
}

.panel-heading p,
.side-form > p,
.verification-item-header p {
    margin: 3px 0 0;
    color: var(--text-muted);
    font-size: 10.5px;
    line-height: 1.55;
}

.completion-meter {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
}

.completion-meter > div {
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--border-color);
}

.completion-meter > div span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--secondary);
}

.completion-meter strong {
    font-size: 12px;
    text-align: left;
}

.detail-list,
.narrative-list,
.action-meta {
    display: grid;
    margin: 0 0 16px;
}

.detail-list > div,
.narrative-list > div {
    display: grid;
    grid-template-columns: minmax(110px, 32%) minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-list > div:last-child,
.narrative-list > div:last-child {
    border-bottom: 0;
}

.detail-list dt,
.narrative-list dt,
.action-meta dt {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
}

.detail-list dd,
.narrative-list dd,
.action-meta dd {
    margin: 0;
    color: var(--text-main);
    font-size: 11.5px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.analysis-form {
    max-width: 980px;
    margin-inline: auto;
    padding: 18px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.case-split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 330px);
    align-items: start;
    gap: 14px;
}

.side-form {
    position: sticky;
    top: 148px;
    display: grid;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.action-plan-list,
.verification-list,
.document-list {
    display: grid;
    gap: 10px;
}

.action-item,
.verification-item {
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-card);
}

.action-item-heading h4,
.verification-item-header h4 {
    margin: 0;
    color: var(--text-main);
    font-size: 12.5px;
    line-height: 1.65;
}

.action-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 12px 0;
}

.action-meta > div {
    min-width: 0;
    padding: 8px 10px;
    border-radius: 5px;
    background: var(--surface-subtle);
}

.action-meta dd {
    margin-top: 3px;
}

.action-item-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.inline-select-label {
    display: grid;
    max-width: 520px;
    gap: 4px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 700;
}

.verification-controls {
    display: grid;
    grid-template-columns: minmax(130px, 0.7fr) minmax(220px, 2fr) minmax(180px, 1fr) auto;
    align-items: end;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    border-radius: 6px;
    background: var(--surface-subtle);
}

.verification-controls .form-group {
    margin-bottom: 0;
}

.verification-history {
    display: grid;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.verification-history li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-right: 3px solid var(--primary);
    background: var(--surface-subtle);
}

.verification-history p {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 10.5px;
}

.document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.document-row > div:first-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.document-row strong {
    overflow-wrap: anywhere;
    font-size: 11.5px;
}

.document-row span {
    color: var(--text-muted);
    font-size: 10px;
}

.document-upload {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 10px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.document-upload label {
    grid-column: 1 / -1;
}

.compact-empty {
    min-height: 120px;
}

@media (max-width: 1050px) {
    .verification-controls {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .rca-registry-header {
        align-items: stretch;
    }

    .rca-registry-header .segmented-control {
        width: 100%;
    }

    .record-page-header {
        grid-template-columns: minmax(0, 1fr) minmax(125px, 160px);
    }

    .record-back {
        grid-column: 1 / -1;
        width: fit-content;
    }

    .record-context-bar,
    .case-overview-grid,
    .documents-layout,
    .case-split-layout {
        grid-template-columns: 1fr;
    }

    .record-tabs {
        top: 74px;
    }

    .side-form {
        position: static;
    }
}

@media (max-width: 620px) {
    .file-input-enhanced .btn,
    .milestone-check {
        min-height: 44px;
    }

    .workflow-stepper li {
        grid-template-columns: 1fr;
        justify-items: center;
        padding: 7px 4px;
        text-align: center;
    }

    .workflow-stepper li strong {
        width: 100%;
        font-size: 9px;
    }

    .department-picker-tools {
        grid-template-columns: 1fr;
    }

    .selection-count {
        white-space: normal;
    }

    .record-page-header {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .record-stage-control {
        width: 100%;
    }

    .record-tabs {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px;
        overflow: visible;
        padding: 4px;
    }

    .record-tabs button {
        width: 100%;
        min-width: 0;
        min-height: 44px;
        white-space: normal;
    }

    .record-tabs button:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .detail-list > div,
    .narrative-list > div {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .action-meta,
    .verification-controls {
        grid-template-columns: 1fr;
    }

    .action-item-actions .btn,
    .verification-controls .btn {
        width: 100%;
        justify-content: center;
    }

    .verification-history li,
    .document-row {
        align-items: stretch;
        flex-direction: column;
    }

    .document-upload {
        grid-template-columns: 1fr;
    }

    .record-summary-grid,
    .agenda-item {
        grid-template-columns: 1fr;
    }

    .record-summary-grid > .record-summary-wide {
        grid-column: auto;
    }

    .agenda-date {
        width: 64px;
    }

    .agenda-item .btn,
    .record-list-header .btn,
    .inline-upload-form .btn {
        width: 100%;
        justify-content: center;
    }
}
