.category-settings-workspace { max-width: 1080px; margin: 0 auto; font-size: 18px; }
.category-settings-list { border-top: 1px solid #a9b9b3; }
.category-settings-row { display: grid; grid-template-columns: minmax(0,1fr) 80px 100px 80px; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #a9b9b3; }
.category-settings-row strong { overflow-wrap: anywhere; }
.category-settings-workspace button { min-height: 48px; }
.category-editor { box-sizing: border-box; width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 24px; border: 1px solid #91a49c; border-radius: 8px; background: #fff; color: #20372e; }
.category-editor::backdrop { background: #13261f88; }
.category-editor h2 { font-size: 22px; margin-top: 0; }
.category-editor label { display: block; margin: 12px 0; font-size: 18px; }
.category-editor input, .category-editor select { box-sizing: border-box; display: block; width: 100%; min-height: 48px; margin-top: 6px; font-size: 18px; border: 1px solid #91a49c; }
.category-editor .category-editor-check { display: flex; gap: 8px; align-items: center; min-height: 48px; }
.category-editor input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; flex: 0 0 20px; margin: 0; }
.category-editor summary { cursor: pointer; padding: 12px 0; font-size: 18px; }
.category-editor footer { display: flex; justify-content: flex-end; gap: 12px; }
.category-editor button { min-height: 48px; font-size: 18px; }
@media (max-width: 600px) {
  .category-settings-row { grid-template-columns: minmax(0,1fr) 64px; gap: 8px; }
}
.individual-record-layout #individualForm .category-check-grid,
.professional-input-page #professionalInputForm .category-check-grid {
  display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 8px;
}
#individualForm .category-check-grid .checkline,
#professionalInputForm .category-check-grid .checkline {
  display: inline-flex; align-items: center; justify-content: flex-start;
  flex: 0 1 auto; width: auto; min-width: 0; max-width: 100%; min-height: 48px;
  box-sizing: border-box; padding: 8px 12px; margin: 0; gap: 8px;
  border: 1px solid #91a49c; border-radius: 6px; box-shadow: none;
  background: #fff; color: #20372e; font-size: 18px; line-height: 1.4;
  overflow-wrap: anywhere; cursor: pointer;
}
#individualForm .category-check-grid .checkline:has(input:checked),
#professionalInputForm .category-check-grid .checkline:has(input:checked) {
  background: #e7f3ed; border-color: #286c51; color: #174c38;
}
#individualForm .category-check-grid .checkline:focus-within,
#professionalInputForm .category-check-grid .checkline:focus-within {
  outline: 2px solid #286c51; outline-offset: 2px;
}
#individualForm .category-check-grid input[type=checkbox],
#professionalInputForm .category-check-grid input[type=checkbox] {
  appearance: none; flex: 0 0 20px; width: 20px; min-width: 20px; max-width: 20px;
  height: 20px; min-height: 20px; padding: 0; margin: 0; accent-color: #286c51;
  opacity: 1; position: relative; box-shadow: none;
  border: 2px solid #62776c; border-radius: 3px; background: #fff;
  display: inline-grid; place-content: center;
}
#individualForm .category-check-grid input[type=checkbox]:checked,
#professionalInputForm .category-check-grid input[type=checkbox]:checked {
  background: #286c51; border-color: #286c51;
}
#individualForm .category-check-grid input[type=checkbox]:checked::before,
#professionalInputForm .category-check-grid input[type=checkbox]:checked::before {
  content: ''; width: 5px; height: 10px; border: solid #fff;
  border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg);
}
@media (forced-colors: active) {
  #individualForm .category-check-grid input[type=checkbox],
  #professionalInputForm .category-check-grid input[type=checkbox] { appearance: auto; }
  #individualForm .category-check-grid input[type=checkbox]::before,
  #professionalInputForm .category-check-grid input[type=checkbox]::before { content: none; }
}
.record-template-library {
  width: min(880px, calc(100% - 32px)); max-height: calc(100dvh - 32px);
  padding: 20px; border: 1px solid #899b95; border-radius: 8px;
  background: #fff; color: #182b26; font: 18px/1.5 system-ui, sans-serif; letter-spacing: 0;
}
.record-template-library::backdrop { background: #13261f88; }
.record-template-library header, .record-template-library footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.record-template-library h2 { margin: 0; font-size: 22px; }
.record-template-library h3 { margin: 0; font-size: 19px; }
.record-template-library button { min-height: 48px; font: inherit; border: 1px solid #a9b9b3; border-radius: 6px; background: #fff; color: inherit; cursor: pointer; padding: 8px 16px; box-shadow: none; }
.record-template-library button:active { background: #e0eee8; }
.record-template-library button:focus-visible, .record-template-library input:focus-visible { outline: 3px solid #286e59; outline-offset: 2px; }
.record-template-library button:disabled { opacity: .5; cursor: default; }
.record-template-library [data-close][aria-label] { width: 48px; padding: 0; font-size: 26px; }
.template-library-search { display: block; margin: 20px 0 16px; }
.template-library-search input { display: block; width: 100%; min-height: 52px; font: inherit; margin-top: 6px; padding: 10px; box-sizing: border-box; }
.template-library-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: min(420px, 48dvh); gap: 20px; }
.template-library-results, .template-library-preview { min-width: 0; overflow-y: auto; overscroll-behavior: contain; }
.template-library-results button { display: block; width: 100%; text-align: left; margin-bottom: 8px; }
.template-library-results button[aria-pressed=true] { border-color: #286e59; background: #edf6f2; }
.template-library-results strong, .template-library-results span { display: block; overflow-wrap: anywhere; }
.template-library-results span { font-size: 16px; color: #52665f; margin-top: 4px; }
.template-library-preview { padding-left: 16px; border-left: 1px solid #c4d1cb; }
.template-library-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.template-library-types, .template-library-status { color: #52665f; font-size: 16px; }
.record-template-library footer { justify-content: flex-end; border-top: 1px solid #c4d1cb; padding-top: 12px; }
.record-template-library [data-apply] { background: #25674f; color: white; border-color: #25674f; }
@media (max-width: 600px) {
  .record-template-library { padding: 16px; }
  .template-library-body { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; height: 52dvh; gap: 12px; }
  .template-library-preview { padding: 12px 0 0; border-left: 0; border-top: 1px solid #c4d1cb; }
}
.shell.top-nav-shell .top-nav { flex-wrap: wrap; }
.shell.top-nav-shell .app-header-main { position: relative; z-index: 2; }
.shell.top-nav-shell .app-header-meta { position: relative; z-index: 1; }
.template-library-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.template-library-tabs [aria-pressed=true] { background: #e7f3ed; border-color: #286c51; }
.personal-template-editor textarea { width: 100%; box-sizing: border-box; min-height: 160px; font: 18px/1.5 system-ui; border: 1px solid #91a49c; border-radius: 6px; padding: 10px; }
.template-workflow-action textarea { width: 100%; box-sizing: border-box; min-height: 100px; font: 18px/1.5 system-ui; border: 1px solid #91a49c; border-radius: 6px; padding: 10px; }
.template-library-filter { display: block; margin-bottom: 16px; font-size: 18px; }
.template-library-filter select { width: 100%; min-height: 48px; font: inherit; }
.template-editor-types { border: 0; padding: 0; margin: 12px 0; min-width: 0; }
.template-editor-types div { display: flex; flex-wrap: wrap; gap: 8px; }
.template-editor-types label { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; min-height: 48px; box-sizing: border-box; border: 1px solid #91a49c; border-radius: 6px; font-size: 18px; }
.template-editor-types input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; margin: 0; flex: 0 0 20px; appearance: auto; accent-color: #286c51; }
.unified-record-workspace { max-width: 1080px; margin: 0 auto; padding: 20px; background: #fff; color: #182b26; }
.unified-record-workspace form { display: flex; flex-direction: column; gap: 20px; font: 18px/1.5 system-ui; }
.unified-record-workspace label { font: inherit; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.unified-record-workspace input:not([type=checkbox]), .unified-record-workspace select, .unified-record-workspace textarea { width: 100%; min-height: 48px; box-sizing: border-box; font: inherit; padding: 10px; border: 1px solid #87998f; border-radius: 6px; }
.unified-record-selection { display: grid; grid-template-columns: 140px 160px minmax(0,1fr); gap: 12px; }
.unified-record-meta { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; }
.unified-resident-summary { margin: 0; background: #edf5f0; padding: 12px; border-left: 3px solid #286c51; overflow-wrap: anywhere; }
.unified-record-workspace fieldset { border: 0; border-top: 1px solid #c4d1cb; padding: 16px 0 0; min-width: 0; }
.unified-record-workspace .category-check-grid label { flex-direction: row; }
.unified-content textarea { min-height: 240px; resize: vertical; }
.unified-record-actions { position: sticky; bottom: 0; z-index: 2; background: #fff; border-top: 1px solid #c4d1cb; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); justify-content: flex-end; }
.unified-record-actions button { min-height: 48px; font-size: 18px; }
.unified-record-actions [data-save-resident] { margin-right: auto; overflow-wrap: anywhere; min-width: 0; font-size: 16px; }
.unified-record-workspace [data-favorites] { display: flex; flex-wrap: wrap; gap: 8px; }
.unified-save-status { margin: 0; overflow-wrap: anywhere; }
.unified-history-list { max-height: 65dvh; overflow-y: auto; }
.unified-history-list article { padding: 16px 0; border-bottom: 1px solid #c4d1cb; }
.unified-history-list p { white-space: pre-wrap; overflow-wrap: anywhere; }
.unified-record-workspace [data-history] { align-self: flex-start; min-height: 48px; font-size: 18px; }
.record-workflow-settings [data-body] { max-height: 65dvh; overflow-y: auto; }
.record-workflow-settings section { padding: 16px 0; border-bottom: 1px solid #c4d1cb; }
.workflow-setting-row { padding: 12px 0; display: grid; grid-template-columns: minmax(100px,1fr) minmax(0,3fr); gap: 12px; border-bottom: 1px solid #e0e6e2; }
.workflow-setting-choices { grid-column: 1/-1; display: flex; flex-wrap: wrap; gap: 8px; }
.workflow-setting-choices label { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; min-height: 48px; }
.workflow-setting-choices input[type=checkbox] { width: 20px; min-height: 20px; height: 20px; margin: 0; appearance: auto; }
.record-workflow-settings select { font: inherit; min-height: 48px; max-width: 100%; }
.review-type-filter[open] { max-height: 320px; overflow-y: auto; }
.review-type-filter label { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 17px; }
.review-type-filter input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; appearance: auto; flex: 0 0 20px; }
#view:has(.enhanced-review-table) { max-width: 1680px; margin-inline: auto; width: 100%; min-width: 0; }
#view:has(.enhanced-review-table) .panel { min-width: 0; border-radius: 8px; }
#view:has(.enhanced-review-table) #recordsReviewForm { display: flex; flex-wrap: wrap; gap: 8px; }
#view:has(.enhanced-review-table) #recordsReviewForm [hidden] { display: none !important; }
#view:has(.enhanced-review-table) #recordsReviewForm input { width: auto; min-width: 0; flex: 1 1 180px; font-size: 17px; }
.records-review-sort { grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr) minmax(0,1fr); }
.records-review-sort select { width: 100%; min-width: 0; font-size: 17px; min-height: 44px; }
.enhanced-review-table { table-layout: fixed; width: 100%; min-width: 0 !important; }
.enhanced-review-table th, .enhanced-review-table td { width: auto !important; min-width: 0 !important; padding: 10px 8px; overflow-wrap: anywhere; font-size: 17px; vertical-align: top; border-bottom: 1px solid #c4d1cb; }
.enhanced-review-table .record-content { min-width: 0; width: auto; white-space: pre-wrap; font-size: 18px; line-height: 1.6; }
.enhanced-review-table th label { min-width: 0; font-size: 16px; }
.enhanced-review-table th select { width: 100%; min-width: 0; }
.enhanced-review-table summary { cursor: pointer; min-height: 44px; padding-block: 8px; }
.enhanced-review-table .review-row-actions button { width: 100%; min-height: 44px; margin: 0 0 8px; padding: 8px 4px; font-size: 16px; }
.revision-modal #revisionModalForm { display: flex; flex-direction: column; gap: 16px; }
.revision-modal #revisionModalForm > label { display: flex; flex-direction: column; gap: 8px; font-size: 18px; }
.revision-modal #revisionModalForm select, .revision-modal #revisionModalForm textarea, .revision-modal #revisionModalForm input:not([type=checkbox]) { width: 100%; min-width: 0; font-size: 18px; }
.revision-modal .revision-category-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.revision-modal .revision-category-grid label { display: inline-flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid #87998f; border-radius: 6px; min-height: 44px; }
.revision-modal .revision-category-grid input[type=checkbox] { width: 20px; height: 20px; min-height: 20px; flex: 0 0 20px; margin: 0; appearance: auto; }
@media(max-width:1000px) {
  #view:has(.enhanced-review-table) .clinical-record-table-wrap { max-height: none; overflow: visible; }
  .enhanced-review-table th { position: static; }
  .enhanced-review-table, .enhanced-review-table thead, .enhanced-review-table tbody { display: block; }
  .enhanced-review-table colgroup { display: none; }
  .enhanced-review-table thead tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .enhanced-review-table thead th:is(:first-child,:nth-child(5),:last-child) { display: none; }
  .enhanced-review-table tbody tr { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 12px 0; border-bottom: 2px solid #87998f; }
  .enhanced-review-table tbody td { display: block; border: 0; }
  .enhanced-review-table tbody td::before { content: attr(data-label); display: block; font-size: 15px; color: #52615b; margin-bottom: 4px; }
  .enhanced-review-table tbody td.record-content, .enhanced-review-table tbody td.review-row-actions { grid-column: 1/-1; }
  .enhanced-review-table .review-row-actions button { width: auto; margin-right: 8px; padding-inline: 16px; }
  .records-review-sort { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media(max-width:600px) {
  .unified-record-workspace { padding: 16px; }
  .unified-record-selection { grid-template-columns: 1fr 1fr; }
  .unified-record-selection label:last-child { grid-column: 1/-1; }
  .unified-record-meta { grid-template-columns: 1fr; }
  .unified-record-actions [data-save-resident] { flex-basis: 100%; }
}
