@font-face {
  font-family: "Vazirmatn";
  src: url("/assets/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #212529;
  --muted: #6c757d;
  --line: #dee2e6;
  --primary: #08b7de;
  --primary-2: #02e198;
  --primary-3: #0d6efd;
  --dark: #393939;
  --green: #198754;
  --yellow: #b7791f;
  --red: #dc3545;
  --risk-green-surface: #edf8f1;
  --risk-green-border: #a8d9bb;
  --risk-yellow-surface: #fff7dc;
  --risk-yellow-border: #e6cf82;
  --risk-red-surface: #fff0f1;
  --risk-red-border: #efb0b7;
  --shadow: 0 0 30px rgba(0, 0, 0, 0.08);
}

@media screen {
  .summary.form-submit-actions {
    display: flex;
    order: 2;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    padding: 14px;
  }

  .summary.form-submit-actions .risk-print-summary {
    display: none;
  }
}

.notification-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
}

.notification-button.has-unread {
  border-color: #0aa7c7;
}

.notification-button b {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 5px;
  border-radius: 50%;
  color: #fff;
  background: var(--red);
  font-size: 11px;
}

.modal-panel.decision-modal {
  width: min(94vw, 720px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.decision-modal-body {
  min-height: 0;
  padding: 16px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.decision-recommendation {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

.decision-recommendation > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.decision-recommendation p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.finalization-warning {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid #f0b8b8;
  border-right: 4px solid var(--red);
  border-radius: 6px;
  background: #fff7f7;
  color: #8f1f2c;
}

.finalization-warning[hidden] {
  display: none;
}

.finalization-warning p {
  margin: 0;
  color: #714047;
  font-size: 12px;
  line-height: 1.7;
}

.lock-confirmation-modal {
  width: min(94vw, 520px);
  overflow: hidden;
}

.lock-confirmation-body {
  display: grid;
  gap: 8px;
  margin: 16px 18px;
  padding: 16px;
  border: 1px solid #f0b8b8;
  border-right: 4px solid var(--red);
  border-radius: 7px;
  background: #fff7f7;
}

.lock-confirmation-body strong {
  color: #8f1f2c;
}

.lock-confirmation-body p {
  margin: 0;
  color: #5f4a4d;
  font-size: 13px;
  line-height: 1.8;
}

.danger-confirm-button {
  background: var(--red);
}

.cancel-followup-modal {
  width: min(94vw, 560px);
  overflow: hidden;
}

.cancel-followup-body {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
}

.cancel-followup-warning {
  display: grid;
  gap: 5px;
  padding: 13px 14px;
  border: 1px solid #f0c2c6;
  border-right: 4px solid var(--red);
  border-radius: 7px;
  background: #fff7f7;
}

.cancel-followup-warning strong {
  color: #8f1f2c;
}

.cancel-followup-warning p,
.cancel-followup-body > small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.cancel-followup-body label {
  font-size: 13px;
  font-weight: 750;
}

.cancel-followup-body label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.cancel-followup-body textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
}

.cancel-request-button {
  border: 1px solid #e5a7ad;
  background: #fff;
  color: #a32632;
}

.cancel-request-button:hover {
  border-color: var(--red);
  background: #fff4f5;
}

.decision-modal .risk-decision {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.follow-up-schedule-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.follow-up-schedule-fields label {
  display: grid;
  align-content: start;
  gap: 6px;
  font-weight: 700;
}

.jalali-date-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  font-weight: 700;
}

.jalali-date-field legend {
  width: 100%;
  margin-bottom: 6px;
  padding: 0;
}

.jalali-date-picker {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 6px;
}

.jalali-date-picker label {
  position: relative;
  display: block;
}

.jalali-date-picker label > span {
  position: absolute;
  top: 4px;
  right: 10px;
  z-index: 1;
  color: var(--muted);
  font-size: 10px;
  pointer-events: none;
}

.jalali-date-picker select {
  width: 100%;
  min-height: 48px;
  padding: 17px 9px 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.jalali-date-picker select:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(8, 183, 222, 0.16);
}

.jalali-date-field small {
  display: block;
  min-height: 20px;
  margin-top: 5px;
}

.jalali-date-field small.is-error {
  color: var(--red);
}

.follow-up-schedule-fields input,
.follow-up-schedule-fields textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.follow-up-schedule-fields small {
  color: var(--primary-3);
}

.required-mark {
  color: var(--red);
  font-size: 11px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  margin: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.decision-modal .modal-actions button {
  width: auto;
  min-width: 130px;
  height: 42px;
  padding-inline: 18px;
}

.modal-panel.notification-modal {
  width: min(92vw, 760px);
  min-height: 0;
  max-height: min(720px, calc(100dvh - 48px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notification-modal .modal-header {
  position: static;
  padding: 14px 16px;
}

.notification-modal .modal-header > div {
  min-width: 0;
}

.notification-modal .modal-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.notification-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.notification-toolbar > div {
  display: flex;
  gap: 6px;
}

.notification-toolbar button {
  width: auto;
  height: 36px;
  min-width: 0;
  padding-inline: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  font-size: 11.5px;
  font-weight: 700;
}

.notification-toolbar button:disabled {
  cursor: default;
  opacity: 0.52;
}

.notification-filters button {
  color: var(--muted);
  background: var(--surface-2);
}

.notification-filters button.active {
  color: #fff;
  background: var(--primary-3);
}

.notification-list {
  display: grid;
  gap: 8px;
  flex: 0 1 auto;
  min-height: 0;
  max-height: min(480px, calc(100dvh - 190px));
  padding: 10px 14px 14px;
  overflow-y: auto;
  overscroll-behavior: contain;
  align-content: start;
}

.notification-list > .empty {
  align-self: center;
  justify-self: center;
  min-height: 150px;
  margin: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  font-size: 12.5px;
}

.notification-list:has(> .empty) {
  place-content: center;
}

.decision-modal .modal-header h2,
.notification-modal .modal-header h2 {
  font-size: 18px;
  line-height: 1.45;
}

.decision-modal .modal-header .ghost-button,
.notification-modal .modal-header .ghost-button {
  width: auto;
  height: 38px;
  padding-inline: 14px;
  border: 1px solid var(--line);
}

.notification-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  min-height: 76px;
  border-right: 3px solid var(--primary-3);
  border-radius: 6px;
  background: #fff;
}

.notification-item.priority-urgent {
  border-right-color: var(--red);
}

.notification-item.priority-high {
  border-right-color: var(--yellow);
}

.notification-item.is-read {
  background: #fafbfc;
}

.notification-item.is-unread {
  background: color-mix(in srgb, var(--primary-3) 4%, #fff);
}

.notification-item.patient-risk-green {
  background: var(--risk-green-surface);
}

.notification-item.patient-risk-yellow {
  background: var(--risk-yellow-surface);
}

.notification-item.patient-risk-red {
  background: var(--risk-red-surface);
}

.notification-item > button:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 9px 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: right;
  cursor: pointer;
}

.notification-item p,
.notification-item time {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
}

.notification-item strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.55;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item p {
  overflow: hidden;
  line-height: 1.65;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-item-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.notification-item-meta time {
  flex: 0 0 auto;
  direction: rtl;
  font-variant-numeric: tabular-nums;
}

.notification-type {
  color: var(--primary-3);
  font-size: 10.5px;
  font-weight: 700;
}

.notification-item.is-read .notification-type {
  color: var(--muted);
}

.notification-read-button {
  width: auto;
  min-width: 66px;
  height: 34px;
  margin-left: 10px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--primary-3) 30%, var(--line));
  border-radius: 6px;
  color: var(--primary-3);
  background: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.notification-read-button:hover {
  color: #fff;
  background: var(--primary-3);
}

.notification-read-state {
  margin-left: 12px;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .follow-up-schedule-fields {
    grid-template-columns: 1fr;
  }

  .notification-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .notification-toolbar > div {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notification-toolbar button {
    width: 100%;
  }

  .notification-list {
    max-height: calc(100dvh - 240px);
    padding-inline: 10px;
  }

  .notification-item {
    grid-template-columns: minmax(0, 1fr);
  }

  .notification-read-button,
  .notification-read-state {
    justify-self: start;
    margin: 0 12px 9px;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-panel.decision-modal,
  .modal-panel.notification-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .modal-header {
    padding: 12px 14px;
  }

  .decision-modal .modal-header h2,
  .notification-modal .modal-header h2 {
    font-size: 17px;
  }

  .decision-modal-body {
    padding: 12px 14px;
  }

  .decision-modal .modal-actions {
    padding: 10px 14px;
  }

  .decision-modal .modal-actions button {
    flex: 1;
    min-width: 0;
    padding-inline: 10px;
  }

  .form-submit-actions {
    flex-wrap: wrap;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", "IRANSans", "Segoe UI", Tahoma, Arial, sans-serif;
  font-weight: 400;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.modal-open {
  overflow: hidden;
}

body.print-workspace-mode .topbar {
  display: none;
}

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

[hidden] {
  display: none !important;
}

.print-root {
  display: none;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 183, 222, 0.18), rgba(2, 225, 152, 0.2)),
    var(--bg);
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(92vw, 430px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1 {
  text-align: center;
  font-size: 22px;
}

.login-card p {
  color: var(--muted);
  text-align: center;
  line-height: 1.9;
  font-size: 13px;
}

.login-company {
  display: grid;
  gap: 7px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.8;
}

.login-company strong {
  color: var(--text);
  font-size: 13px;
}

.login-company a {
  color: var(--primary-dark);
  text-decoration: none;
}

.login-company a:hover {
  text-decoration: underline;
}

.login-company-phones {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
}

.login-mark {
  color: #fff;
  background: #fff;
}

.form-error {
  min-height: 20px;
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.app-frame {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 22px 18px;
  overflow: hidden;
  background: linear-gradient(180deg, #0ba9d2, #08c9b5);
  color: #fff;
}

.sidebar > .brand-mark,
.sidebar > .brand-copy {
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border: 3px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.16);
  overflow: hidden;
}

.brand-mark span {
  font-size: 24px;
  font-weight: 750;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  padding: 5px;
  object-fit: contain;
}

.brand-copy {
  display: grid;
  gap: 5px;
  margin-bottom: 26px;
  text-align: center;
}

.brand-copy strong {
  font-size: 17px;
}

.brand-copy small {
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.side-nav {
  display: grid;
  flex: 1;
  min-height: 0;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.7) transparent;
  padding: 3px;
}

.side-nav button {
  height: auto;
  min-height: 44px;
  border: 0;
  padding: 11px 12px;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.side-nav button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -2px;
}

.side-nav button:hover,
.side-nav button.active {
  background: rgba(255, 255, 255, 0.2);
}

.side-nav .followup-section-nav {
  margin-right: 12px;
  padding-right: 14px;
  border-right: 2px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.side-nav .followup-section-nav.active {
  border-right-color: #fff;
  background: rgba(255, 255, 255, 0.28);
}

.sub-nav {
  display: grid;
  gap: 6px;
  margin: -2px 12px 8px 0;
  padding: 8px 10px 8px 0;
  border-right: 2px solid rgba(255, 255, 255, 0.45);
}

.sub-nav button {
  height: 34px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 700;
}

.sub-nav button:hover,
.sub-nav button.active {
  background: rgba(255, 255, 255, 0.26);
}

.view {
  display: block;
}

.ghost-button {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--dark);
}

.shell {
  width: min(1240px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 76px;
  margin-bottom: 14px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.45;
}

h2 {
  font-size: 15px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip {
  min-width: 116px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--dark);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.status-pill {
  min-width: 150px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.toast {
  position: sticky;
  top: 12px;
  z-index: 5;
  margin: -4px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(25, 115, 74, 0.25);
  border-radius: 8px;
  background: #eef8f2;
  color: var(--green);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
}

.toast.error {
  border-color: rgba(180, 35, 24, 0.28);
  background: #fff1ef;
  color: var(--red);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metrics article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metrics span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metrics strong {
  color: var(--primary);
  font-size: 24px;
}

.workspace-filters {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 10px;
}

.workspace-filter-heading > div {
  min-width: 0;
}

.workspace-filter-heading span {
  display: block;
  margin-bottom: 2px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.workspace-filter-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.5;
}

.workspace-filter-heading > strong {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 6px;
  background: #eef8f9;
  color: #087e93;
  font-size: 12px;
}

.workspace-filter-controls {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(5, minmax(140px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 16px 16px;
  border-top: 1px solid #edf0f2;
  background: var(--surface-2);
}

.workspace-filter-controls label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--dark);
  font-size: 12px;
  font-weight: 700;
}

.workspace-filter-controls input,
.workspace-filter-controls select {
  width: 100%;
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

.workspace-filter-controls input:focus,
.workspace-filter-controls select:focus {
  border-color: var(--primary-3);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.12);
}

.workspace-filter-controls input::placeholder {
  color: #8a939b;
}

.workspace-filter-clear {
  min-height: 44px;
  white-space: nowrap;
}

.workspace-filter-controls.all-forms-primary {
  grid-template-columns: minmax(240px, 2fr) minmax(170px, 1fr) minmax(140px, 0.8fr) auto auto;
  gap: 12px;
}

.workspace-filter-controls.all-forms-advanced {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  background: var(--surface);
}

.all-forms-filter-mode .workspace-filter-heading {
  padding-bottom: 14px;
}

.all-forms-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  white-space: nowrap;
}

.all-forms-filter-toggle[aria-expanded="true"] {
  border-color: #789da6;
  background: #edf5f7;
  color: #285b67;
}

.all-forms-filter-chevron {
  font-size: 16px;
}

.all-forms-filter-toggle[aria-expanded="true"] .all-forms-filter-chevron {
  transform: rotate(180deg);
}

.all-forms-filter-count {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #e4eff2;
  color: #285b67;
  font-size: 12px;
}

.all-forms-primary .workspace-filter-clear {
  padding: 0 12px;
  color: #586b74;
  background: transparent;
  font-size: 12px;
}

.all-forms-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 16px;
}

.all-forms-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.all-forms-heading h2 {
  margin: 0;
  font-size: 17px;
}

.all-forms-heading > span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.all-forms-sort {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.all-forms-sort select {
  width: 170px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--dark);
}

.all-forms-table table {
  min-width: 1050px;
}

.all-forms-table td {
  vertical-align: middle;
}

.all-forms-table .all-forms-title {
  min-width: 200px;
  max-width: 340px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.all-forms-actions {
  display: grid;
  grid-template-columns: 132px;
  gap: 6px;
}

.all-forms-actions .all-forms-view-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid #cbd5dc;
  border-radius: 6px;
  background: #f8fafb;
  color: #31434f;
  white-space: nowrap;
}

.all-forms-view-button svg {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.all-forms-actions .all-forms-view-button:hover {
  border-color: #91aab4;
  background: #edf3f6;
  color: #1c4c5e;
}

.all-forms-actions .all-forms-view-button:focus-visible,
.all-forms-filter-toggle:focus-visible {
  outline: 2px solid #267f99;
  outline-offset: 2px;
}

.all-forms-actions .edit-draft-button {
  height: 44px;
  border-radius: 6px;
  white-space: nowrap;
}

.all-forms-form-name {
  display: grid;
  gap: 6px;
  line-height: 1.65;
}

.all-forms-form-name strong {
  font-size: 13px;
}

.all-forms-form-name small {
  color: #596b74;
  font-size: 12px;
}

.encounter-status.open {
  background: #edf4f6;
  color: #49636e;
}

.all-forms-risk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.all-forms-risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8b969d;
  flex: 0 0 8px;
}

.all-forms-risk-dot.red { background: #c43f4c; }
.all-forms-risk-dot.yellow { background: #c08a16; }
.all-forms-risk-dot.green { background: #278457; }

.disease-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.disease-tabs button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--dark);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
}

.disease-tabs button:hover,
.disease-tabs button.active {
  border-color: rgba(2, 225, 152, 0.55);
  background: linear-gradient(90deg, rgba(8, 183, 222, 0.14), rgba(2, 225, 152, 0.18));
  color: #066776;
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

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

.single-section .workflow-grid.two {
  grid-template-columns: 1fr;
}

.form-mode > .metrics,
.form-mode #workflowFilters,
.form-mode #followUpWorkspace > .workflow-grid,
.form-mode #noCaseState {
  display: none;
}

.form-mode #formWorkspace {
  display: block;
}

.form-mode #followUpForm {
  width: min(100%, 920px);
  margin: 0 auto;
}

.form-mode #recentSection {
  display: none;
}

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

.work-list {
  display: grid;
  gap: 8px;
  max-height: none;
  overflow: visible;
}

.work-list.wide {
  display: block;
  max-height: none;
  overflow: visible;
}

.work-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.operational-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 78px;
}

.work-item-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.requester-meta {
  color: var(--muted);
}

.requester-meta strong {
  color: var(--text);
  font-weight: 750;
}

.work-item.selected {
  border-color: rgba(8, 183, 222, 0.65);
  background: linear-gradient(90deg, rgba(8, 183, 222, 0.09), rgba(2, 225, 152, 0.11));
}

.finalized-case-row {
  cursor: pointer;
  background: #fff;
}

.finalized-case-row:hover,
.finalized-case-row:focus-visible {
  border-color: rgba(8, 183, 222, 0.6);
  background: rgba(8, 183, 222, 0.04);
  outline: none;
}

.work-item.patient-risk-green,
.work-item.patient-risk-green:hover,
.work-item.patient-risk-green:focus-visible {
  border-color: var(--risk-green-border);
  background: var(--risk-green-surface);
}

.work-item.patient-risk-yellow,
.work-item.patient-risk-yellow:hover,
.work-item.patient-risk-yellow:focus-visible {
  border-color: var(--risk-yellow-border);
  background: var(--risk-yellow-surface);
}

.work-item.patient-risk-red,
.work-item.patient-risk-red:hover,
.work-item.patient-risk-red:focus-visible {
  border-color: var(--risk-red-border);
  background: var(--risk-red-surface);
}

.finalized-case-summary {
  display: flex;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
}

.finalized-case-summary .badge {
  min-width: 54px;
  text-align: center;
}

.case-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-item strong {
  font-size: 13px;
  line-height: 1.5;
}

.work-item small,
.work-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.work-item p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-item .table-actions {
  justify-content: flex-start;
}

.operational-row .table-actions {
  justify-content: flex-end;
  min-width: 300px;
  flex-wrap: nowrap;
}

.operational-row .table-actions button {
  width: auto;
  min-width: 132px;
  height: 38px;
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pagination-bar > div {
  display: flex;
  gap: 8px;
}

.pagination-bar button {
  min-width: 88px;
}

.case-history {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.empty-history {
  color: var(--muted);
}

.compact-history span,
.compact-history time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.compact-history b {
  color: var(--dark);
  font-weight: 750;
}

.patient-list-table {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow-x: auto;
}

.patient-status-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.patient-status-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.status-swatch {
  width: 12px;
  height: 12px;
  border: 1px solid transparent;
  border-radius: 3px;
}

.status-swatch.sent {
  border-color: #9bd0ad;
  background: #eaf7ef;
}

.status-swatch.pending {
  border-color: #e5c97c;
  background: #fff8df;
}

.status-swatch.cancelled {
  border-color: #e4a1a8;
  background: #fff0f1;
}

.patient-list-table .admin-table {
  min-width: 1200px;
  table-layout: fixed;
}

.patient-list-table th:nth-child(1) {
  width: 15%;
}

.patient-list-table th:nth-child(2),
.patient-list-table th:nth-child(4) {
  width: 11%;
}

.patient-list-table th:nth-child(3) {
  width: 5%;
}

.patient-list-table th:nth-child(5) {
  width: 8%;
}

.patient-list-table th:nth-child(6) {
  width: 12%;
}

.patient-list-table th:nth-child(7) {
  width: 9%;
}

.patient-list-table th:nth-child(8) {
  width: 10%;
}

.patient-list-table th:nth-child(9) {
  width: 19%;
}

.patient-list-table th,
.patient-list-table td {
  white-space: normal;
  overflow-wrap: anywhere;
}

.patient-cell {
  display: grid;
  gap: 4px;
}

.patient-cell small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.patient-list-table tbody tr td {
  transition: background-color 160ms ease;
}

.patient-list-table .request-sent-row td {
  background: #f1faf4;
}

.patient-list-table .request-sent-row td:first-child {
  box-shadow: inset -4px 0 #42a56a;
}

.patient-list-table .request-pending-row td {
  background: #fffaf0;
}

.patient-list-table .request-pending-row td:first-child {
  box-shadow: inset -4px 0 #d6a72b;
}

.patient-list-table .request-cancelled-row td {
  background: #fff5f5;
}

.patient-list-table .request-cancelled-row td:first-child {
  box-shadow: inset -4px 0 var(--red);
}

.patient-list-table .selected-row {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}

.badge.pending {
  color: #8a6410;
  background: #fff1bd;
}

.request-state-note {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}

.cancellation-reason {
  color: #9f2732 !important;
}

.patient-list-table .ward-row-actions {
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 6px;
}

.patient-list-table .ward-row-actions button {
  flex: 0 0 auto;
  height: 40px;
  min-height: 40px;
  min-width: 0;
  border-radius: 6px;
  white-space: nowrap;
}

.patient-list-table .ward-row-actions svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
}

.patient-list-table .ward-icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 40px;
  padding: 0;
  border: 1px solid #ccd7dc;
  background: var(--surface);
  color: #35535d;
}

.patient-list-table .ward-icon-button:hover {
  border-color: #86b9bd;
  background: #eaf5f4;
  color: #146b70;
}

.patient-list-table .ward-action-count {
  position: absolute;
  top: -6px;
  left: -6px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border-radius: 9px;
  background: #146b70;
  color: #fff;
  font-size: 10px;
  line-height: 1;
}

.patient-list-table .ward-primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  background: #157b55;
  color: #fff;
  font-size: 12px;
}

.patient-list-table .ward-primary-button:hover { background: #0d6746; }

.patient-list-table .ward-row-actions button:focus-visible {
  outline: 2px solid #007b99;
  outline-offset: 2px;
}

.patient-list-table .admin-table td { padding-block: 10px; }

.patient-list-table td:nth-child(2),
.patient-list-table td:nth-child(3),
.patient-list-table td:nth-child(4),
.patient-list-table td:nth-child(7) { white-space: nowrap; }

.patient-list-table td:last-child {
  overflow-wrap: normal;
}

.patient-request-status {
  display: grid;
  justify-items: start;
  gap: 5px;
}

.patient-request-status small {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.modal-panel.referral-editor-modal {
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}

.referral-editor-modal .modal-header {
  flex: 0 0 auto;
}

.referral-editor-modal .modal-header h2 {
  overflow-wrap: anywhere;
  font-size: 18px;
}

.referral-editor-modal .modal-header > div {
  min-width: 0;
}

.referral-editor-modal .modal-header button {
  flex: 0 0 auto;
}

.referral-editor-summary {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0 !important;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.referral-editor-summary strong {
  color: var(--dark);
}

.referral-editor-modal #requestForm {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 0;
}

.referral-editor-modal .form-actions {
  position: sticky;
  z-index: 1;
  bottom: 0;
  flex-wrap: wrap;
  margin: 0 -20px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

@media screen and (max-width: 640px) {
  .modal-panel.referral-editor-modal {
    width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .referral-editor-modal .modal-header {
    flex-direction: row;
    align-items: center;
  }

  .referral-editor-modal #requestForm {
    padding-inline: 14px;
  }

  .referral-editor-modal .form-actions {
    margin-inline: -14px;
    padding-inline: 14px;
  }
}

.empty-state {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 24px;
  border: 1px dashed rgba(8, 183, 222, 0.45);
  border-radius: 8px;
  background: rgba(8, 183, 222, 0.06);
  color: var(--dark);
  text-align: center;
}

.empty-state strong {
  font-size: 16px;
}

.empty-state p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}

.patient-identity {
  display: grid;
  gap: 12px;
}

.patient-identity.compact {
  margin-bottom: 12px;
}

.identity-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.identity-grid div,
.identity-note {
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.identity-grid span,
.identity-note span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.identity-grid strong,
.identity-note p {
  color: var(--dark);
  font-size: 13px;
  line-height: 1.8;
}

.status-pill.green {
  color: var(--green);
  border-color: rgba(25, 115, 74, 0.35);
  background: #eef8f2;
}

.status-pill.yellow {
  color: var(--yellow);
  border-color: rgba(149, 99, 11, 0.35);
  background: #fff7e6;
}

.status-pill.red {
  color: var(--red);
  border-color: rgba(180, 35, 24, 0.35);
  background: #fff1ef;
}

.form-selection-panel {
  border-color: rgba(8, 183, 222, 0.22);
  background: linear-gradient(90deg, rgba(8, 183, 222, 0.05), rgba(255, 255, 255, 0.96));
}

.form-selection-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.form-selection-row button {
  min-width: 180px;
  min-height: 44px;
}

.locked-form-notice {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.locked-form-notice[hidden] {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.modal-panel {
  width: min(640px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.modal-header span {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.modal-header h2 {
  margin: 0;
  color: var(--dark);
  font-size: 20px;
}

.followup-modal > .panel {
  margin: 14px;
}

.followup-modal > .panel + .panel {
  margin-top: 0;
}

.encounter-modal {
  width: min(1120px, calc(100vw - 32px));
}

.encounter-modal-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.case-history-tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.case-history-tabs button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.case-history-tabs button.active {
  border-bottom-color: var(--primary-3);
  color: var(--dark);
}

.case-history-tabs button:focus-visible {
  outline: 2px solid var(--primary-3);
  outline-offset: -2px;
}

.case-history-tabs span {
  color: var(--muted);
  font-size: 11px;
}

.case-history-panel {
  min-width: 0;
}

.case-call-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.case-call-summary > span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
}

.case-call-summary strong {
  color: var(--dark);
}

.case-call-summary label {
  display: grid;
  gap: 4px;
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 11px;
}

.case-call-summary select {
  min-width: 142px;
  min-height: 34px;
}

.case-call-table {
  min-width: 900px;
}

.case-call-table .case-call-notes {
  max-width: 220px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.case-call-table .ghost-button {
  min-height: 32px;
  padding: 5px 9px;
  white-space: nowrap;
}

.encounter-modal-toolbar {
  display: flex;
  justify-content: flex-start;
}

.encounter-group-list {
  display: grid;
  gap: 10px;
}

.encounter-group-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  height: auto;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--dark);
  text-align: right;
  cursor: pointer;
}

.encounter-group-item:hover,
.encounter-group-item:focus-visible {
  border-color: rgba(2, 175, 153, 0.42);
  background: #eef8f2;
}

.encounter-group-item > span:first-child {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.encounter-group-item strong {
  font-size: 14px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.encounter-group-item small,
.encounter-group-meta {
  color: var(--muted);
  font-size: 12px;
}

.encounter-group-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.encounter-group-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.encounter-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}

.encounter-status.draft {
  color: #8a5800;
  background: #fff4cf;
}

.encounter-status.final {
  color: #146c43;
  background: #e6f7ee;
}

.encounter-status.closed {
  color: #4f5962;
  background: #edf0f2;
}

.encounter-status.overdue {
  color: #a12c38;
  background: #fff0f1;
}

.overdue-case-row {
  border-inline-start: 4px solid #d04452;
}

.encounter-card-statuses {
  display: flex;
  align-items: center;
  gap: 7px;
}

.encounter-modal-toolbar {
  gap: 8px;
  flex-wrap: wrap;
}

.edit-draft-button {
  color: #8a5800;
  border-color: #e8cc73;
  background: #fff9e8;
}

.encounter-record-list {
  display: grid;
  gap: 10px;
}

.encounter-record-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  height: auto;
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--dark);
  text-align: right;
  cursor: pointer;
}

.encounter-record-item:hover,
.encounter-record-item:focus-visible {
  border-color: rgba(8, 183, 222, 0.45);
  background: #f7fcfd;
}

.encounter-record-item > span:first-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.encounter-record-item strong {
  font-size: 13px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.encounter-record-item small {
  color: var(--muted);
  font-size: 12px;
}

.encounter-record-item p {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  white-space: normal;
  overflow-wrap: anywhere;
}

.encounter-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.encounter-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.encounter-card header div {
  display: grid;
  gap: 4px;
}

.encounter-card header strong {
  color: var(--dark);
  font-size: 15px;
}

.encounter-card header small,
.encounter-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.encounter-card h3 {
  margin: 0 0 8px;
  color: var(--dark);
  font-size: 13px;
}

.encounter-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.encounter-field {
  display: grid;
  gap: 4px;
  min-height: 54px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.encounter-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.encounter-field strong {
  color: var(--dark);
  font-size: 12px;
}

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

.discharge-checklist-print {
  display: none;
}

.checklist-document-scroll {
  overflow-x: auto;
}

.checklist-document {
  min-width: 620px;
  padding: 20px 18px 28px;
  background: #fff;
  color: #171717;
  font-family: "Vazirmatn", "IRANSans", Tahoma, sans-serif;
  font-size: 12px;
  line-height: 1.65;
}

.checklist-document-header {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin: 0 0 24px;
  padding: 8px 0 0;
  border: 0;
  text-align: center;
}

.checklist-document-logo {
  display: grid;
  place-items: center;
  height: 88px;
  width: 120px;
}

.checklist-document-logo img {
  max-width: 100%;
  max-height: 88px;
  object-fit: contain;
}

.checklist-document-header p,
.checklist-document-header h3 {
  margin: 0;
  color: #171717;
}

.checklist-document-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.checklist-document-header small {
  color: #333;
  font-size: 11px;
}

.checklist-metadata-table,
.checklist-question-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  color: #171717;
  text-align: center;
}

.checklist-metadata-table {
  margin: 0 0 14px;
}

.checklist-metadata-table th,
.checklist-metadata-table td,
.checklist-question-table th,
.checklist-question-table td {
  border: 1px solid #222;
  padding: 8px 6px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.checklist-metadata-table th,
.checklist-question-table th {
  background: #e1e2e3;
  font-weight: 700;
}

.checklist-metadata-table td {
  height: 42px;
}

.checklist-topic {
  margin: 22px 0 0;
}

.checklist-topic h3,
.checklist-notes-section h3 {
  margin: 0 0 12px;
  padding: 9px 12px;
  border-radius: 6px;
  background: #e1e2e3;
  color: #171717;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.checklist-number-column { width: 7%; }
.checklist-question-column { width: 65%; }
.checklist-answer-column { width: 8%; }
.checklist-partial-column { width: 12%; }
.supplement-question-column { width: 57%; }
.supplement-answer-column { width: 12%; }

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

.supplement-entry-grid > label,
.supplement-entry-grid > strong {
  display: grid;
  gap: 5px;
  font-weight: 600;
}

.supplement-entry-grid input,
.supplement-entry-grid select,
.supplement-entry-grid textarea,
.supplement-text-value,
.supplement-print-notes {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #555;
  border-radius: 0;
  background: #fff;
  color: #171717;
  font: inherit;
  white-space: pre-wrap;
}

.supplement-interventions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  grid-column: 1 / -1;
}

.supplement-interventions label {
  display: flex;
  align-items: center;
  gap: 7px;
}

.supplement-interventions input { min-height: auto; }
.supplement-inline-detail { text-align: right; }
.discharge-checklist-print > .checklist-document + .checklist-document,
.encounter-supplement-document + .encounter-supplement-document { break-before: page; page-break-before: always; }
.supplement-print-notes { margin: 0; min-height: 70px; }

.psychology-document-title {
  margin: 20px 0 8px;
  text-align: center;
  font-size: 16px;
}

.psychology-supplement .checklist-document {
  min-width: 0;
}

.psychology-supplement .checklist-document-logo:empty,
.psychology-document .checklist-document-logo:empty {
  display: none;
}

.psychology-section {
  padding: 14px 2px;
  border-bottom: 1px solid #c9cdd0;
  break-inside: avoid;
}

.psychology-section h5 {
  margin: 0 0 7px;
  font-size: 14px;
}

.psychology-section p {
  margin: 0 0 10px;
  line-height: 1.8;
}

.psychology-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
}

.psychology-choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  cursor: pointer;
}

.psychology-choice input {
  appearance: none;
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  border: 1.5px solid #4e565b;
  border-radius: 2px;
  background: white;
  cursor: pointer;
}

.psychology-choice input:checked::after {
  content: "✓";
  color: #136f50;
  font-size: 17px;
  line-height: 1;
}

.psychology-choice input:focus-visible {
  outline: 2px solid #168d75;
  outline-offset: 2px;
}

.psychology-conditional {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
}

.psychology-conditional[hidden] { display: none; }

.psychology-subquestion,
.psychology-detail {
  display: grid;
  gap: 7px;
}

.psychology-detail input {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid #8d969b;
  background: white;
  color: #171717;
  font: inherit;
}

.psychology-detail .supplement-text-value {
  min-height: 34px;
}

@media print {
  .psychology-section { break-inside: avoid-page; }
}

@media (max-width: 680px) {
  .supplement-entry-grid,
  .supplement-interventions { grid-template-columns: 1fr; }
}

.checklist-question-table th {
  white-space: nowrap;
}

.checklist-question-table td {
  min-height: 46px;
  height: 46px;
}

.checklist-question-text {
  text-align: right;
}

.checklist-answer-cell {
  padding: 0 !important;
}

.checklist-answer-choice {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 46px;
  cursor: pointer;
}

.checklist-answer-choice input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.checklist-answer-choice:focus-within {
  outline: 2px solid #16836b;
  outline-offset: -3px;
}

.checklist-answer-choice:hover,
.checklist-answer-choice:has(input:checked) {
  background: #eef7f3;
}

.checklist-check {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border: 1.5px solid #333;
  color: #111;
  font-size: 17px;
  font-weight: 700;
  line-height: 1;
}

.checklist-answer-choice:has(input:checked) .checklist-check::after {
  content: "✓";
}

.checklist-legacy-answer {
  display: block;
  padding: 4px 0;
  color: #555;
}

.checklist-notes-section {
  margin-top: 22px;
}

.discharge-checklist-notes {
  display: grid;
  gap: 8px;
  font-weight: 600;
}

.discharge-checklist-notes textarea,
.discharge-checklist-notes p {
  width: 100%;
  min-height: 130px;
  margin: 0;
  padding: 10px;
  border: 1px solid #222;
  border-radius: 0;
  background: #fff;
  color: #171717;
  font: inherit;
  white-space: pre-wrap;
  resize: vertical;
}

.encounter-supplement-document {
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
  overflow-x: auto;
}

.archived-paper-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.archived-paper-form {
  min-width: 700px;
  margin: 0 auto;
}

.archived-paper-form input:disabled,
.archived-paper-form select:disabled,
.archived-paper-form textarea:disabled {
  opacity: 1;
  -webkit-text-fill-color: #111;
  cursor: default;
}

.archived-paper-summary {
  margin-top: -1px;
  padding: 10px 12px;
  border: 1px solid #222;
  background: #fff;
  color: #111;
}

.archived-paper-summary h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.archived-paper-summary > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
}

.archived-paper-summary p { margin: 10px 0 0; white-space: pre-wrap; }
.archived-call-history { border: 1px solid #222; background: #fff; }

.print-form {
  --paper-line: #202020;
  --paper-soft-line: #555;
  gap: 0;
  padding: 14px;
  border: 1px solid var(--paper-line);
  background: #fff;
  color: #111;
  box-shadow: none;
  font-size: 12px;
}

.print-sheet-header {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
  padding: 0 0 10px;
  border-bottom: 0;
}

.print-header-meta {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr) 174px;
  grid-template-areas: "logo title file";
  align-items: stretch;
  direction: ltr;
  gap: 14px;
  min-height: 120px;
}

.print-logo-box {
  grid-area: logo;
  display: grid;
  place-items: center;
  align-self: center;
  width: 100px;
  min-height: 96px;
  border: 0;
  color: #081f6f;
  font-size: 24px;
  font-weight: 750;
  text-align: center;
}

.print-logo-box img {
  max-width: 100px;
  max-height: 94px;
  object-fit: contain;
}

.print-title-box {
  grid-area: title;
  display: grid;
  justify-items: center;
  align-content: start;
  direction: rtl;
  gap: 3px;
  color: #111;
  text-align: center;
}

.print-title-box strong {
  font-size: 14px;
  line-height: 1.5;
}

.print-title-box h2 {
  margin: 8px 0 0;
  color: #111;
  font-size: 24px;
  line-height: 1.35;
}

.print-title-box p {
  margin: 0;
  direction: ltr;
  font-family: Arial, sans-serif;
  font-size: 16px;
  font-weight: 750;
  letter-spacing: 0;
}

.print-file-box {
  grid-area: file;
  display: grid;
  direction: rtl;
  align-self: start;
  min-height: 88px;
  border: 2px solid var(--paper-line);
}

.print-file-box div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 7px;
  border-bottom: 1px solid var(--paper-line);
  color: #111;
  font-weight: 700;
}

.print-file-box div:last-child {
  border-bottom: 0;
}

.print-file-box span {
  color: #111;
}

.print-patient-table {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--paper-line);
  border-right: 1px solid var(--paper-line);
  background: #fff;
}

.print-patient-table div {
  display: grid;
  align-content: start;
  min-height: 48px;
  padding: 6px 8px;
  border-left: 1px solid var(--paper-line);
  border-bottom: 1px solid var(--paper-line);
  color: #111;
}

.print-patient-table span {
  margin-bottom: 4px;
  margin-left: 0;
  font-weight: 750;
}

.print-patient-table strong {
  min-height: 22px;
  font-weight: 700;
}

.print-form .panel,
.print-form .summary,
.print-signature-row {
  border: 1px solid var(--paper-line);
  border-radius: 0;
  box-shadow: none;
}

.print-form .panel {
  margin-top: -1px;
  padding: 0;
}

.print-form .patient-identity-panel {
  display: none;
}

.print-form .section-title {
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  margin: 0;
  padding: 5px 8px;
  border-bottom: 1px solid var(--paper-line);
  background: #e4e4e4;
}

.print-form .section-title span {
  min-width: auto;
  height: auto;
  background: transparent;
  color: #111;
  font-weight: 750;
}

.print-form .section-title h2 {
  color: #111;
  font-size: 13px;
}

.print-form .fields,
.print-form .identity-grid,
.print-form .check-list,
.print-form .toggle-list {
  gap: 0;
  padding: 0;
}

.print-form .fields.four,
.print-form .dynamic-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.print-form label,
.print-form .identity-grid div,
.print-form .identity-note {
  margin-right: -1px;
  margin-bottom: -1px;
  border: 1px solid var(--paper-soft-line);
  border-radius: 0;
  background: #fff;
}

.print-form label {
  min-height: 44px;
  padding: 6px 8px;
  color: #111;
  font-size: 11px;
  line-height: 1.6;
}

.print-form input,
.print-form select,
.print-form textarea {
  border: 0;
  border-bottom: 1px dotted #555;
  border-radius: 0;
  background: transparent;
  color: #111;
  font-size: 12px;
  min-height: 30px;
}

.print-form .check-list label,
.print-form .toggle-list label {
  min-height: 36px;
  border-color: var(--paper-soft-line);
}

.print-form .symptom-matrix {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.print-form .symptom-matrix label {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 10.5px;
}

.print-form #selfCareList {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.print-form .summary {
  position: static;
  margin-top: 0;
  border-top: 0;
  background: #d6d6d6;
}

.print-form .summary p,
.print-form .summary strong {
  color: #111;
}

.print-form .summary button {
  min-height: 48px;
}

.print-signature-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: -1px;
  background: #fff;
}

.print-signature-row > div {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 8px;
  border-left: 1px solid var(--paper-line);
}

.print-signature-row > div:first-child {
  border-left: 0;
}

.print-signature-row strong {
  color: #111;
  font-size: 12px;
}

.print-signature-row span {
  color: #333;
  font-size: 11px;
  font-weight: 700;
}

.signature-box {
  display: grid;
  place-items: center;
  min-height: 62px;
  border: 1px dashed #777;
  color: #777;
  font-size: 11px;
}

.signature-box img {
  max-width: 160px;
  max-height: 58px;
  object-fit: contain;
}

.diabetes-paper {
  direction: rtl;
  width: min(100%, 980px);
  margin: 0 auto;
  border: 1.5px solid #111;
  background: #fff;
  color: #000;
  font-family: "Vazirmatn", "IRANSans", Tahoma, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.6;
  overflow: hidden;
}

.diabetes-paper .paper-section {
  border-bottom: 1.5px solid #111;
}

.diabetes-paper .paper-section:last-child {
  border-bottom: 0;
}

.diabetes-paper h3 {
  margin: 0;
  padding: 3px 9px;
  border-bottom: 1.5px solid #111;
  background: #d9d9d9;
  color: #000;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.7;
  text-align: right;
}

.diabetes-paper .paper-row {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 32px;
  border-bottom: 1px solid #222;
}

.diabetes-paper .paper-row:last-child {
  border-bottom: 0;
}

.diabetes-paper .paper-row > div,
.diabetes-paper .paper-row:not(:has(div)) {
  min-width: 0;
  padding: 3px 8px;
  color: #000;
  font-weight: 500;
}

.diabetes-paper .paper-row > div {
  border-left: 1px solid #222;
}

.diabetes-paper .paper-row > div:first-child {
  border-left: 1px solid #222;
}

.diabetes-paper .paper-row > div:last-child,
.diabetes-paper .paper-row.paper-no-dividers > div {
  border-left: 0;
}

.diabetes-paper .paper-cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.diabetes-paper .paper-cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.diabetes-paper .paper-cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.print-form-diabetes .print-patient-table {
  display: none;
}

.diabetes-paper .paper-nowrap,
.diabetes-paper .paper-nowrap * {
  white-space: nowrap;
}

.diabetes-paper .paper-a-main {
  grid-template-columns: 1.55fr 1fr 0.72fr 1.1fr;
}

.diabetes-paper .paper-patient-interview {
  grid-template-columns: 0.78fr 2.55fr;
}

.diabetes-paper .paper-a-demographics {
  grid-template-columns: 1.15fr 1fr 1fr 1fr;
}

.diabetes-paper .paper-a-contact {
  grid-template-columns: 1fr 1fr;
}

.diabetes-paper .paper-clinical-summary {
  min-height: 112px;
  padding: 5px 8px 3px;
  border-bottom: 1px solid #222;
}

.diabetes-paper .paper-clinical-line {
  display: grid;
  align-items: center;
  min-height: 34px;
  font-weight: 500;
}

.diabetes-paper .paper-clinical-primary {
  grid-template-columns: 1.05fr 0.8fr 1.15fr;
}

.diabetes-paper .paper-clinical-allergy {
  grid-template-columns: 0.78fr 0.9fr 1.25fr 1.05fr;
}

.diabetes-paper .paper-clinical-environment {
  grid-template-columns: 1fr;
}

.diabetes-paper .paper-b-duration {
  grid-template-columns: 1fr 1fr;
}

.diabetes-paper .paper-value {
  display: inline-block;
  min-width: 52px;
  padding: 0 3px;
  font-weight: 650;
}

.print-form .diabetes-paper label,
.diabetes-paper label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #000;
  font: inherit;
  font-weight: 500;
  line-height: inherit;
}

.print-form .diabetes-paper input,
.print-form .diabetes-paper select,
.print-form .diabetes-paper textarea,
.diabetes-paper input,
.diabetes-paper select,
.diabetes-paper textarea {
  min-height: 0;
  border-radius: 0;
  background: transparent;
  color: #000;
  font: inherit;
  font-weight: 600;
  line-height: inherit;
}

.diabetes-paper .paper-input {
  width: 112px;
  height: 22px;
  padding: 0 3px;
  border: 0;
  border-bottom: 1px dotted #111;
  text-align: center;
}

.diabetes-paper .paper-input.short-line {
  width: 72px;
}

.diabetes-paper .paper-input.long-line {
  width: 190px;
}

.diabetes-paper .paper-options {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  vertical-align: middle;
}

.diabetes-paper .paper-options input[type="checkbox"],
.diabetes-paper .paper-options input[type="radio"] {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.diabetes-paper .paper-options input[type="radio"] {
  border-radius: 0;
}

.diabetes-paper .paper-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.diabetes-paper .paper-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 142px;
  border-bottom: 1px solid #222;
}

.diabetes-paper .paper-triple-box {
  display: grid;
  grid-template-columns: 0.8fr 1.28fr 1.1fr;
  min-height: 150px;
  border-bottom: 1px solid #222;
}

.diabetes-paper .paper-box {
  min-width: 0;
  padding: 6px 8px;
  border-left: 1px solid #222;
  color: #000;
  font-weight: 500;
}

.diabetes-paper .paper-box:first-child {
  border-left: 1px solid #222;
}

.diabetes-paper .paper-box:last-child {
  border-left: 0;
}

.diabetes-paper .paper-box ol {
  margin: 5px 18px 0 0;
  padding: 0;
}

.diabetes-paper .paper-box li {
  margin: 0;
}

.diabetes-paper .paper-chronic-box,
.diabetes-paper .paper-chronic-detail,
.diabetes-paper .paper-action-box {
  display: block;
}

.diabetes-paper .paper-chronic-detail {
  line-height: 1.9;
}

.diabetes-paper .paper-action-box {
  text-align: center;
}

.diabetes-paper .paper-action-box ol {
  display: inline-block;
  text-align: right;
}

.diabetes-paper .paper-action-box .paper-options {
  justify-content: center;
}

.diabetes-paper .paper-check-grid {
  padding: 6px 8px;
  border-bottom: 1px solid #222;
}

.diabetes-paper .paper-check-grid .paper-options {
  gap: 5px 13px;
}

.diabetes-paper .paper-mental-row {
  padding: 4px 8px;
  border-bottom: 1px solid #222;
  color: #000;
  font-weight: 500;
}

.diabetes-paper .paper-mental-row:last-child {
  border-bottom: 0;
}

.diabetes-paper .paper-mental-primary {
  min-height: 58px;
}

.diabetes-paper .paper-mental-line,
.diabetes-paper .paper-mental-compact {
  white-space: nowrap;
}

.diabetes-paper .paper-mental-drug {
  margin-top: 3px;
}

.diabetes-paper .paper-mental-compact {
  min-height: 32px;
}

.diabetes-paper .paper-symptoms-body {
  min-height: 132px;
  padding: 6px 8px;
  color: #000;
  font-weight: 500;
}

.diabetes-paper .paper-symptoms-general > .paper-options {
  display: flex;
  gap: 5px 13px;
  line-height: 2;
}

.diabetes-paper .paper-other-symptom {
  display: inline-flex;
  align-items: center;
  margin-top: 2px;
}

.diabetes-paper .paper-late-complications {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-top: 4px;
  line-height: 2;
}

.diabetes-paper .paper-late-complications strong {
  font-weight: 700;
}

.diabetes-paper .paper-late-complications .paper-options {
  gap: 4px 13px;
}

.diabetes-paper .paper-frequency-row {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 3px 8px;
  color: #000;
  font-weight: 500;
  white-space: nowrap;
}

.diabetes-paper .paper-frequency-row > .paper-options {
  flex: 1 1 auto;
  justify-content: space-between;
  flex-wrap: nowrap;
}

.diabetes-paper .paper-questionnaire {
  display: grid;
  grid-template-columns: 1.18fr 1fr;
}

.diabetes-paper .paper-q-text,
.diabetes-paper .paper-q-answer {
  min-height: 34px;
  padding: 4px 8px;
  border-bottom: 1px solid #222;
  color: #000;
  font-weight: 500;
  line-height: 1.65;
}

.diabetes-paper .paper-q-text {
  display: flex;
  align-items: center;
}

.diabetes-paper .paper-q-answer {
  display: flex;
  align-items: center;
  border-right: 1px solid #222;
}

.diabetes-paper .paper-answer-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 12px;
  width: 100%;
}

.diabetes-paper .paper-answer-multiline > span {
  flex: 1 1 100%;
}

.diabetes-paper .paper-answer-stack .answer-line {
  width: 150px;
}

.diabetes-paper h3.paper-section-tail-heading {
  border-bottom: 0;
}

.diabetes-paper .paper-lab-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 3px 8px;
  border-bottom: 1px solid #222;
  color: #000;
  font-weight: 500;
  line-height: 1.6;
}

.diabetes-paper .paper-lab-row:last-child {
  border-bottom: 0;
}

.diabetes-paper .paper-row-marker {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.diabetes-paper .paper-medication-row {
  white-space: nowrap;
}

.diabetes-paper .paper-evaluation-row {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 3px 8px;
  color: #000;
  font-weight: 500;
  white-space: nowrap;
}

.diabetes-paper .paper-notes {
  margin: 0;
  padding: 7px 10px;
  list-style: none;
  color: #000;
  font-weight: 500;
  line-height: 1.85;
}

.diabetes-paper .paper-notes li {
  position: relative;
  padding-right: 14px;
}

.diabetes-paper .paper-notes li::before {
  position: absolute;
  top: 0;
  right: 0;
  content: "-";
}

.diabetes-paper .paper-note-field {
  display: grid;
  gap: 4px;
  padding: 7px 8px;
}

.diabetes-paper .paper-note-field textarea {
  width: 100%;
  min-height: 64px;
  padding: 4px;
  border: 1px dotted #111;
  resize: vertical;
}

.htn-paper .htn-clinical-summary {
  min-height: 118px;
}

.htn-paper .htn-clinical-primary {
  grid-template-columns: 1.05fr 0.8fr 1.15fr;
}

.htn-paper .htn-clinical-secondary {
  grid-template-columns: 1fr 1fr;
}

.htn-paper .htn-clinical-allergy {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.htn-paper .htn-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
}

.htn-paper .htn-symptoms-body {
  min-height: 88px;
}

.htn-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.htn-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.mi-paper .mi-clinical-summary {
  min-height: 126px;
}

.mi-paper .mi-clinical-primary {
  grid-template-columns: 1.05fr 0.8fr 1.15fr;
}

.mi-paper .mi-clinical-allergy {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.mi-paper .mi-clinical-environment {
  grid-template-columns: 1fr 1fr 1fr;
}

.mi-paper .mi-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 164px;
}

.mi-paper .mi-symptoms-body {
  min-height: 108px;
}

.mi-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.mi-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.chf-paper .chf-clinical-summary {
  min-height: 132px;
}

.chf-paper .chf-clinical-primary {
  grid-template-columns: 1.05fr 0.8fr 1.15fr;
}

.chf-paper .chf-clinical-secondary {
  grid-template-columns: 1fr 1fr;
}

.chf-paper .chf-clinical-allergy {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.chf-paper .chf-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 164px;
}

.chf-paper .chf-symptoms-body {
  min-height: 102px;
}

.chf-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.chf-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.burn-paper .burn-clinical-summary {
  min-height: 142px;
}

.burn-paper .burn-clinical-primary,
.burn-paper .burn-details-line {
  grid-template-columns: 1fr 0.85fr 0.85fr 1.1fr;
}

.burn-paper .burn-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.burn-paper .burn-mobility-row {
  min-height: 58px;
}

.burn-paper .burn-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.burn-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.burn-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.burn-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.burn-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.burn-paper .burn-symptoms-body {
  min-height: 112px;
}

.burn-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.burn-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.copd-paper .copd-clinical-summary {
  min-height: 120px;
}

.copd-paper .copd-clinical-primary {
  grid-template-columns: 1fr 0.9fr 0.85fr 1.15fr;
}

.copd-paper .copd-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.copd-paper .copd-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.copd-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.copd-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.copd-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.copd-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.copd-paper .copd-symptoms-body {
  min-height: 126px;
}

.copd-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.copd-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.cva-paper .cva-clinical-summary {
  min-height: 120px;
}

.cva-paper .cva-clinical-primary {
  grid-template-columns: 1fr 0.9fr 0.85fr 1.15fr;
}

.cva-paper .cva-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.cva-paper .cva-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.cva-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.cva-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cva-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.cva-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.cva-paper .cva-symptoms-body {
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 126px;
}

.cva-paper .cva-symptom-line {
  line-height: 1.8;
}

.cva-paper .cva-rehab-services .paper-options {
  justify-content: flex-start;
}

.cva-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.cva-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.cancer-paper .cancer-clinical-summary {
  min-height: 154px;
}

.cancer-paper .cancer-clinical-primary {
  grid-template-columns: 1fr 0.85fr 1.15fr;
}

.cancer-paper .cancer-clinical-secondary {
  grid-template-columns: 1fr 1fr;
}

.cancer-paper .cancer-treatment-line > div {
  width: 100%;
}

.cancer-paper .cancer-treatment-line .paper-options {
  justify-content: space-around;
}

.cancer-paper .cancer-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.cancer-paper .cancer-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.cancer-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.cancer-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cancer-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.cancer-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.cancer-paper .cancer-symptoms-body {
  min-height: 112px;
}

.cancer-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.cancer-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.psychiatric-paper .psychiatric-clinical-summary {
  min-height: 154px;
}

.psychiatric-paper .psychiatric-clinical-primary {
  grid-template-columns: 1fr 0.85fr 0.85fr 1.15fr;
}

.psychiatric-paper .psychiatric-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.psychiatric-paper .psychiatric-treatment-line > div {
  width: 100%;
}

.psychiatric-paper .psychiatric-treatment-line .paper-options {
  justify-content: space-around;
}

.psychiatric-paper .psychiatric-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.psychiatric-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.psychiatric-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.psychiatric-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.psychiatric-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.psychiatric-paper .psychiatric-assessment-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px 12px;
  min-height: 82px;
  padding: 10px 14px;
  border-bottom: 1px solid #222;
  align-content: center;
}

.psychiatric-paper .psychiatric-assessment-grid > div {
  min-width: 0;
  white-space: nowrap;
}

.psychiatric-paper .psychiatric-history-row {
  min-height: 42px;
  padding: 7px 14px;
  border-bottom: 1px solid #222;
  line-height: 1.8;
}

.psychiatric-paper .psychiatric-history-row:last-child {
  border-bottom: 0;
}

.psychiatric-paper .psychiatric-symptoms-body {
  min-height: 116px;
}

.psychiatric-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.psychiatric-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.ckd-paper .ckd-clinical-summary {
  min-height: 146px;
}

.ckd-paper .ckd-clinical-primary {
  grid-template-columns: 1fr 0.85fr 0.85fr 1.15fr;
}

.ckd-paper .ckd-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.ckd-paper .ckd-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.ckd-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.ckd-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ckd-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.ckd-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.ckd-paper .ckd-symptoms-body {
  min-height: 154px;
}

.ckd-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

.ckd-paper .paper-questionnaire-section h3 {
  break-after: avoid;
  page-break-after: avoid;
}

.amputation-paper .amputation-clinical-summary {
  min-height: 166px;
}

.amputation-paper .amputation-clinical-primary {
  grid-template-columns: 1fr 0.85fr 0.85fr 1.15fr;
}

.amputation-paper .amputation-cause-line > div {
  width: 100%;
}

.amputation-paper .amputation-cause-line .paper-options {
  justify-content: space-around;
}

.amputation-paper .amputation-allergy-line {
  grid-template-columns: 0.8fr 1.1fr 1fr;
}

.amputation-paper .amputation-triple-box {
  grid-template-columns: 0.8fr 1.05fr 1.05fr;
  min-height: 188px;
}

.amputation-paper .burn-action-options {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  text-align: right;
}

.amputation-paper .burn-action-options label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.amputation-paper .burn-action-options input {
  appearance: none;
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin: 0;
  border: 1.5px solid #111;
  background: #fff;
}

.amputation-paper .burn-action-options input:checked {
  background:
    linear-gradient(135deg, transparent 42%, #111 43% 57%, transparent 58%),
    linear-gradient(45deg, transparent 42%, #111 43% 57%, transparent 58%);
}

.diabetes-paper .paper-options input:checked,
.burn-paper .burn-action-options input:checked,
.copd-paper .burn-action-options input:checked,
.cva-paper .burn-action-options input:checked,
.cancer-paper .burn-action-options input:checked,
.psychiatric-paper .burn-action-options input:checked,
.ckd-paper .burn-action-options input:checked,
.amputation-paper .burn-action-options input:checked {
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2 6.2 4.7 8.8 10 3' fill='none' stroke='%23111' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.diabetes-paper .paper-options input:focus,
.burn-paper .burn-action-options input:focus,
.copd-paper .burn-action-options input:focus,
.cva-paper .burn-action-options input:focus,
.cancer-paper .burn-action-options input:focus,
.psychiatric-paper .burn-action-options input:focus,
.ckd-paper .burn-action-options input:focus,
.amputation-paper .burn-action-options input:focus {
  outline: none;
  box-shadow: none;
}

.amputation-paper .amputation-symptoms-body {
  min-height: 104px;
}

.amputation-paper .amputation-wound-answer {
  align-items: flex-start;
  line-height: 1.75;
}

.amputation-paper .paper-questionnaire-section {
  break-inside: auto;
  page-break-inside: auto;
}

@page {
  size: A4 portrait;
  margin: 8mm;
}

@media print {
  html,
  body {
    width: auto;
    min-height: auto;
    background: #fff !important;
  }

  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  * {
    box-sizing: border-box;
  }

  body.print-root-mode > :not(#printRoot) {
    display: none !important;
  }

  body.print-root-mode #printRoot {
    display: block !important;
    width: 180mm !important;
    max-width: 180mm !important;
    margin: 0 auto !important;
    background: #fff !important;
    color: #000 !important;
    font-family: "Vazirmatn", "IRANSans", Tahoma, Arial, sans-serif;
    overflow: hidden;
  }

  body.print-root-mode .archived-paper-form {
    width: 180mm;
    max-width: 180mm;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    overflow: visible;
  }

  body.print-root-mode .archived-call-history {
    margin-top: 4mm;
    border: 0;
  }

  body.print-root-mode .print-root-title {
    display: grid;
    gap: 1mm;
    padding: 3mm;
    border: 1pt solid #000;
    border-bottom: 0;
    background: #fff !important;
    text-align: center;
  }

  body.print-root-mode .print-root-title span {
    color: #000;
    font-size: 8pt;
    font-weight: 750;
  }

  body.print-root-mode .print-root-title h1 {
    margin: 0;
    color: #000;
    font-size: 13pt;
    line-height: 1.35;
  }

  body.print-root-mode .encounter-card {
    display: grid;
    gap: 0;
    padding: 0;
    border: 1pt solid #000;
    border-radius: 0;
    background: #fff !important;
    color: #000;
    box-shadow: none !important;
    break-inside: auto;
    page-break-inside: auto;
  }

  body.print-root-mode .encounter-card header {
    min-width: 0;
    padding: 2mm 3mm;
    border-bottom: 1pt solid #000;
  }

  body.print-root-mode .encounter-card header strong {
    color: #000;
    font-size: 10pt;
  }

  body.print-root-mode .encounter-card header small,
  body.print-root-mode .encounter-card p {
    color: #111;
    font-size: 8pt;
    line-height: 1.55;
  }

  body.print-root-mode .encounter-card section {
    padding: 2mm 3mm;
    border-bottom: 1px solid #555;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-root-mode .encounter-card h3 {
    margin: 0 0 1.4mm;
    color: #000;
    font-size: 9pt;
  }

  body.print-root-mode .encounter-fields {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    min-width: 0;
  }

  body.print-root-mode .encounter-field {
    display: grid;
    gap: 1mm;
    min-height: 9mm;
    margin-right: -1px;
    margin-bottom: -1px;
    padding: 1.4mm 2mm;
    border: 1px solid #555;
    border-radius: 0;
    background: #fff !important;
    min-width: 0;
  }

  body.print-root-mode .encounter-field span {
    color: #111;
    font-size: 7.2pt;
    font-weight: 750;
  }

  body.print-root-mode .encounter-field strong {
    color: #000;
    font-size: 8pt;
    overflow-wrap: anywhere;
  }

  body.print-root-mode .badge {
    min-height: 6mm;
    border: 1px solid #555;
    border-radius: 0;
    background: #fff !important;
    color: #000 !important;
  }

  body.print-encounter-mode .sidebar,
  body.print-encounter-mode .topbar,
  body.print-encounter-mode .toast,
  body.print-encounter-mode #dashboardView,
  body.print-encounter-mode #settingsView,
  body.print-encounter-mode #followupsView > :not(#encounterModal) {
    display: none !important;
  }

  body.print-encounter-mode .app-frame,
  body.print-encounter-mode .shell,
  body.print-encounter-mode #followupsView {
    display: block !important;
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.print-encounter-mode #encounterModal {
    position: static !important;
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.print-encounter-mode .encounter-modal {
    width: 180mm !important;
    max-width: 180mm !important;
    max-height: none !important;
    margin: 0 auto !important;
    overflow: visible !important;
    border: 1pt solid #000;
    border-radius: 0;
    background: #fff !important;
    box-shadow: none !important;
  }

  body.print-encounter-mode .modal-header {
    position: static;
    padding: 3mm;
    border-bottom: 1pt solid #000;
    background: #fff !important;
  }

  body.print-encounter-mode .modal-header button,
  body.print-encounter-mode .encounter-modal-toolbar {
    display: none !important;
  }

  body.print-encounter-mode .modal-header span {
    color: #000;
    font-size: 8pt;
  }

  body.print-encounter-mode .modal-header h2 {
    color: #000;
    font-size: 13pt;
  }

  body.print-encounter-mode .encounter-modal-body {
    gap: 0;
    padding: 0;
  }

  body.print-encounter-mode .encounter-card {
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #fff !important;
    color: #000;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-encounter-mode .encounter-card header {
    padding: 2mm 3mm;
    border-bottom: 1pt solid #000;
  }

  body.print-encounter-mode .encounter-card header strong {
    color: #000;
    font-size: 10pt;
  }

  body.print-encounter-mode .encounter-card header small,
  body.print-encounter-mode .encounter-card p {
    color: #111;
    font-size: 8pt;
  }

  body.print-encounter-mode .encounter-card section {
    padding: 2.2mm 3mm;
    border-bottom: 1px solid #555;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body.print-encounter-mode .encounter-card h3 {
    margin-bottom: 1.5mm;
    color: #000;
    font-size: 9pt;
  }

  body.print-encounter-mode .encounter-fields {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
  }

  body.print-encounter-mode .encounter-field {
    min-height: 10mm;
    margin-right: -1px;
    margin-bottom: -1px;
    padding: 1.5mm 2mm;
    border: 1px solid #555;
    border-radius: 0;
    background: #fff !important;
  }

  body.print-encounter-mode .encounter-field span {
    color: #111;
    font-size: 7.3pt;
  }

  body.print-encounter-mode .encounter-field strong {
    color: #000;
    font-size: 8pt;
  }

  body.print-encounter-mode .badge {
    min-height: 6mm;
    border: 1px solid #555;
    border-radius: 0;
    background: #fff !important;
    color: #000 !important;
  }

  body.print-root-mode.print-encounter-mode .encounter-card {
    border: 1pt solid #000;
  }

  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) .sidebar,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) .topbar,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) .toast,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #dashboardView,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #settingsView,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followupsView > .metrics,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #workflowFilters,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followUpWorkspace > .workflow-grid,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #wardWorkspace,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #noCaseState,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #formModal,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #encounterModal,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #formSelectionPanel,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #recentSection {
    display: none !important;
  }

  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) .app-frame,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) .shell,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followupsView,
  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #formWorkspace {
    display: block !important;
    width: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followUpForm.print-form {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    width: 180mm !important;
    max-width: 180mm !important;
    margin: 0 auto !important;
    padding: 0 !important;
    border: 1pt solid #000;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    font-family: "Vazirmatn", "IRANSans", Tahoma, Arial, sans-serif;
    font-size: 8.5pt;
    line-height: 1.35;
    overflow: hidden;
  }

  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followUpForm.print-form-diabetes {
    display: block !important;
    border: 0;
    overflow: visible;
  }

  body.print-workspace-mode:not(.print-root-mode):not(.print-encounter-mode) #followUpForm.print-form:has(.discharge-checklist-print:not([hidden])) {
    overflow: visible;
  }

  body.print-workspace-mode .discharge-checklist-print:not([hidden]) {
    display: block !important;
    grid-column: 1 / -1;
    width: 180mm;
    max-width: 180mm;
    margin: 0 auto;
    padding: 0;
    break-before: page;
    page-break-before: always;
    color: #000;
  }

  body.print-root-mode .encounter-supplement-document {
    width: 180mm;
    max-width: 180mm;
    margin: 0 auto;
    padding: 0;
    border: 0;
    overflow: visible;
    break-before: page;
    page-break-before: always;
  }

  .checklist-document {
    min-width: 0;
    padding: 0;
    font-size: 8.5pt;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .checklist-document-header {
    margin-bottom: 6mm;
  }

  .checklist-document-logo,
  .checklist-document-logo img {
    height: 24mm;
    max-height: 24mm;
  }

  .checklist-document-header h3 {
    font-size: 11pt;
  }

  .checklist-metadata-table {
    margin-bottom: 4mm;
  }

  .checklist-metadata-table th,
  .checklist-metadata-table td,
  .checklist-question-table th,
  .checklist-question-table td {
    padding: 2mm 1.5mm;
    border-color: #000;
  }

  .checklist-topic {
    margin-top: 7mm;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .checklist-topic.checklist-print-page-start {
    break-before: page;
    page-break-before: always;
  }

  .checklist-topic h3,
  .checklist-notes-section h3 {
    margin-bottom: 3mm;
    padding: 2mm;
    font-size: 9pt;
  }

  .checklist-question-table td,
  .checklist-answer-choice {
    height: 12mm;
    min-height: 12mm;
  }

  .checklist-notes-section {
    margin-top: 7mm;
  }

  .discharge-checklist-notes p {
    min-height: 34mm;
  }

  .print-form-diabetes .print-sheet-header,
  .print-form-diabetes .print-signature-row,
  .print-form-diabetes .summary {
    width: 180mm;
    max-width: 180mm;
    margin-right: auto;
    margin-left: auto;
    border-right: 1pt solid #000;
    border-left: 1pt solid #000;
  }

  .print-form-diabetes .diabetes-paper {
    width: 180mm !important;
    max-width: 180mm !important;
    margin: 0 auto !important;
    border: 1pt solid #000;
    background: #fff !important;
    color: #000 !important;
    font-size: 7.6pt;
    line-height: 1.42;
    overflow: hidden;
  }

  .print-form-diabetes .diabetes-paper .paper-section {
    border-bottom: 1pt solid #000;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-diabetes .diabetes-paper .paper-page-break {
    break-before: page;
    page-break-before: always;
  }

  .print-form-diabetes .diabetes-paper h3 {
    padding: 0.6mm 2mm;
    border-bottom: 1pt solid #000;
    background: #d9d9d9 !important;
    font-size: 8.8pt;
    line-height: 1.35;
  }

  .print-form-diabetes .diabetes-paper .paper-row {
    min-height: 7mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-row > div,
  .print-form-diabetes .diabetes-paper .paper-row:not(:has(div)) {
    padding: 0.7mm 1.8mm;
  }

  .print-form-diabetes .diabetes-paper .paper-row > div {
    border-left: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-row > div:last-child,
  .print-form-diabetes .diabetes-paper .paper-row.paper-no-dividers > div {
    border-left: 0;
  }

  .print-form-diabetes .diabetes-paper .paper-nowrap,
  .print-form-diabetes .diabetes-paper .paper-nowrap * {
    white-space: nowrap;
  }

  .print-form-diabetes .diabetes-paper .paper-patient-interview {
    grid-template-columns: 48mm 130mm;
  }

  .print-form-diabetes .diabetes-paper .paper-a-main {
    grid-template-columns: 62mm 40mm 29mm 47mm;
  }

  .print-form-diabetes .diabetes-paper .paper-a-demographics {
    grid-template-columns: 50mm 43mm 43mm 42mm;
  }

  .print-form-diabetes .diabetes-paper .paper-a-contact {
    grid-template-columns: 89mm 89mm;
  }

  .print-form-diabetes .diabetes-paper .paper-clinical-summary {
    min-height: 26mm;
    padding: 1mm 1.8mm 0.6mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-clinical-line {
    min-height: 7.5mm;
  }

  .print-form-diabetes .diabetes-paper .paper-clinical-primary {
    grid-template-columns: 62mm 48mm 68mm;
  }

  .print-form-diabetes .diabetes-paper .paper-clinical-allergy {
    grid-template-columns: 38mm 42mm 54mm 44mm;
  }

  .print-form-htn .htn-paper .htn-clinical-summary {
    min-height: 31mm;
  }

  .print-form-htn .htn-paper .htn-clinical-primary {
    grid-template-columns: 62mm 48mm 68mm;
  }

  .print-form-htn .htn-paper .htn-clinical-secondary {
    grid-template-columns: 89mm 89mm;
  }

  .print-form-htn .htn-paper .htn-clinical-allergy {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-mi .mi-paper .mi-clinical-summary {
    min-height: 32mm;
  }

  .print-form-mi .mi-paper .mi-clinical-primary {
    grid-template-columns: 62mm 48mm 68mm;
  }

  .print-form-mi .mi-paper .mi-clinical-allergy {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-mi .mi-paper .mi-clinical-environment {
    grid-template-columns: 55mm 58mm 65mm;
  }

  .print-form-chf .chf-paper .chf-clinical-summary {
    min-height: 34mm;
  }

  .print-form-chf .chf-paper .chf-clinical-primary {
    grid-template-columns: 62mm 48mm 68mm;
  }

  .print-form-chf .chf-paper .chf-clinical-secondary {
    grid-template-columns: 89mm 89mm;
  }

  .print-form-chf .chf-paper .chf-clinical-allergy {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-burn .burn-paper .burn-clinical-summary {
    min-height: 36mm;
  }

  .print-form-burn .burn-paper .burn-clinical-primary,
  .print-form-burn .burn-paper .burn-details-line {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-burn .burn-paper .burn-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-copd .copd-paper .copd-clinical-summary {
    min-height: 31mm;
  }

  .print-form-copd .copd-paper .copd-clinical-primary {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-copd .copd-paper .copd-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-cva .cva-paper .cva-clinical-summary {
    min-height: 31mm;
  }

  .print-form-cva .cva-paper .cva-clinical-primary {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-cva .cva-paper .cva-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-cancer .cancer-paper .cancer-clinical-summary {
    min-height: 38mm;
  }

  .print-form-cancer .cancer-paper .cancer-clinical-primary {
    grid-template-columns: 62mm 48mm 68mm;
  }

  .print-form-cancer .cancer-paper .cancer-clinical-secondary {
    grid-template-columns: 89mm 89mm;
  }

  .print-form-cancer .cancer-paper .cancer-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-clinical-summary {
    min-height: 38mm;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-clinical-primary {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-ckd .ckd-paper .ckd-clinical-summary {
    min-height: 36mm;
  }

  .print-form-ckd .ckd-paper .ckd-clinical-primary {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-ckd .ckd-paper .ckd-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-amputation .amputation-paper .amputation-clinical-summary {
    min-height: 40mm;
  }

  .print-form-amputation .amputation-paper .amputation-clinical-primary {
    grid-template-columns: 45mm 42mm 42mm 49mm;
  }

  .print-form-amputation .amputation-paper .amputation-allergy-line {
    grid-template-columns: 48mm 66mm 64mm;
  }

  .print-form-diabetes .diabetes-paper .paper-b-duration {
    grid-template-columns: 89mm 89mm;
  }

  .print-form-diabetes .diabetes-paper .paper-input {
    width: 25mm;
    height: 4.2mm;
    padding: 0 0.6mm;
    border: 0;
    border-bottom: 0.75pt dotted #111;
  }

  .print-form-diabetes .diabetes-paper .paper-input.short-line {
    width: 16mm;
  }

  .print-form-diabetes .diabetes-paper .paper-input.long-line {
    width: 39mm;
  }

  .print-form-diabetes .diabetes-paper .paper-options {
    gap: 0.8mm 3mm;
  }

  .print-form-diabetes .diabetes-paper .paper-options input[type="checkbox"],
  .print-form-diabetes .diabetes-paper .paper-options input[type="radio"] {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-diabetes .diabetes-paper .paper-split {
    min-height: 31mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-triple-box {
    grid-template-columns: 44mm 72mm 62mm;
    min-height: 37mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-htn .htn-paper .htn-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 37mm;
  }

  .print-form-mi .mi-paper .mi-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 39mm;
  }

  .print-form-chf .chf-paper .chf-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 39mm;
  }

  .print-form-burn .burn-paper .burn-mobility-row {
    min-height: 13mm;
  }

  .print-form-burn .burn-paper .burn-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-burn .burn-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-burn .burn-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-copd .copd-paper .copd-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-copd .copd-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-copd .copd-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-cva .cva-paper .cva-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-cva .cva-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-cva .cva-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-cancer .cancer-paper .cancer-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-cancer .cancer-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-cancer .cancer-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-psychiatric .psychiatric-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-psychiatric .psychiatric-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-assessment-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 1.2mm 2mm;
    min-height: 20mm;
    padding: 1.2mm 1.8mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-history-row {
    min-height: 8mm;
    padding: 0.7mm 1.8mm;
    border-bottom: 0.75pt solid #222;
    line-height: 1.55;
  }

  .print-form-ckd .ckd-paper .ckd-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-ckd .ckd-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-ckd .ckd-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-amputation .amputation-paper .amputation-triple-box {
    grid-template-columns: 48mm 65mm 65mm;
    min-height: 44mm;
  }

  .print-form-amputation .amputation-paper .burn-action-options {
    gap: 0.4mm;
    margin-top: 0.8mm;
  }

  .print-form-amputation .amputation-paper .burn-action-options input {
    width: 3mm;
    height: 3mm;
    border: 0.75pt solid #111;
  }

  .print-form-diabetes .diabetes-paper .paper-box {
    padding: 1.2mm 1.8mm;
    border-left: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-box:last-child {
    border-left: 0;
  }

  .print-form-diabetes .diabetes-paper .paper-chronic-detail {
    line-height: 1.9;
  }

  .print-form-diabetes .diabetes-paper .paper-box ol {
    margin-top: 0.8mm;
  }

  .print-form-diabetes .diabetes-paper .paper-check-grid {
    padding: 1.2mm 1.8mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-mental-row {
    padding: 0.7mm 1.8mm;
    border-bottom: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-mental-row:last-child {
    border-bottom: 0;
  }

  .print-form-diabetes .diabetes-paper .paper-mental-primary {
    min-height: 14mm;
  }

  .print-form-diabetes .diabetes-paper .paper-mental-compact {
    min-height: 7mm;
  }

  .print-form-diabetes .diabetes-paper .paper-mental-drug {
    margin-top: 0.5mm;
  }

  .print-form-diabetes .diabetes-paper .paper-symptoms-body {
    min-height: 29mm;
    padding: 1.2mm 1.8mm;
  }

  .print-form-htn .htn-paper .htn-symptoms-body {
    min-height: 20mm;
  }

  .print-form-mi .mi-paper .mi-symptoms-body {
    min-height: 24mm;
  }

  .print-form-chf .chf-paper .chf-symptoms-body {
    min-height: 23mm;
  }

  .print-form-burn .burn-paper .burn-symptoms-body {
    min-height: 25mm;
  }

  .print-form-copd .copd-paper .copd-symptoms-body {
    min-height: 28mm;
  }

  .print-form-cva .cva-paper .cva-symptoms-body {
    gap: 1mm;
    min-height: 27mm;
  }

  .print-form-cancer .cancer-paper .cancer-symptoms-body {
    min-height: 24mm;
  }

  .print-form-psychiatric .psychiatric-paper .psychiatric-symptoms-body {
    min-height: 26mm;
  }

  .print-form-ckd .ckd-paper .ckd-symptoms-body {
    min-height: 34mm;
  }

  .print-form-amputation .amputation-paper .amputation-symptoms-body {
    min-height: 24mm;
  }

  .print-form-amputation .amputation-paper .amputation-wound-answer {
    line-height: 1.5;
  }

  .print-form-diabetes .diabetes-paper .paper-symptoms-general > .paper-options,
  .print-form-diabetes .diabetes-paper .paper-late-complications {
    line-height: 1.8;
  }

  .print-form-diabetes .diabetes-paper .paper-late-complications {
    gap: 0.6mm 2mm;
    margin-top: 0.6mm;
  }

  .print-form-diabetes .diabetes-paper .paper-frequency-row {
    min-height: 8mm;
    padding: 0.7mm 1.8mm;
  }

  .print-form-diabetes .diabetes-paper .paper-q-text,
  .print-form-diabetes .diabetes-paper .paper-q-answer {
    min-height: 6.5mm;
    padding: 0.8mm 1.8mm;
    border-bottom: 0.75pt solid #222;
    font-weight: 500;
    line-height: 1.45;
  }

  .print-form-diabetes .diabetes-paper .paper-q-answer {
    border-right: 0.75pt solid #222;
  }

  .print-form-diabetes .diabetes-paper .paper-questionnaire {
    grid-template-columns: 1.18fr 1fr;
  }

  .print-form-htn .htn-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-htn .htn-paper .paper-q-text,
  .print-form-htn .htn-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-mi .mi-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-mi .mi-paper .paper-q-text,
  .print-form-mi .mi-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-chf .chf-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-chf .chf-paper .paper-q-text,
  .print-form-chf .chf-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-burn .burn-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-burn .burn-paper .paper-q-text,
  .print-form-burn .burn-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-copd .copd-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-copd .copd-paper .paper-q-text,
  .print-form-copd .copd-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-cva .cva-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-cva .cva-paper .paper-q-text,
  .print-form-cva .cva-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-cancer .cancer-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-cancer .cancer-paper .paper-q-text,
  .print-form-cancer .cancer-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-psychiatric .psychiatric-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-psychiatric .psychiatric-paper .paper-q-text,
  .print-form-psychiatric .psychiatric-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-ckd .ckd-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-ckd .ckd-paper .paper-q-text,
  .print-form-ckd .ckd-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-amputation .amputation-paper .paper-questionnaire-section {
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-form-amputation .amputation-paper .paper-q-text,
  .print-form-amputation .amputation-paper .paper-q-answer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form-diabetes .diabetes-paper .paper-answer-stack {
    gap: 0.4mm 2mm;
  }

  .print-form-diabetes .diabetes-paper .paper-answer-stack .answer-line {
    width: 31mm;
  }

  .print-form-diabetes .diabetes-paper h3.paper-section-tail-heading {
    border-bottom: 0;
  }

  .print-form-diabetes .diabetes-paper .paper-lab-row {
    min-height: 6.8mm;
    padding: 0.7mm 1.8mm;
    border-bottom: 0.75pt solid #222;
    line-height: 1.4;
  }

  .print-form-diabetes .diabetes-paper .paper-lab-row:last-child {
    border-bottom: 0;
  }

  .print-form-diabetes .diabetes-paper .paper-row-marker {
    font-size: 9pt;
  }

  .print-form-diabetes .diabetes-paper .paper-evaluation-row {
    min-height: 7mm;
    padding: 0.7mm 1.8mm;
  }

  .print-form-diabetes .diabetes-paper .paper-notes {
    padding: 1.5mm 2mm;
    font-weight: 500;
    line-height: 1.5;
  }

  .print-form-diabetes .diabetes-paper .paper-notes li {
    padding-right: 3mm;
  }

  .print-form-diabetes .diabetes-paper .paper-note-field {
    padding: 1.5mm 2mm;
  }

  .print-form-diabetes .diabetes-paper .paper-note-field textarea {
    min-height: 15mm;
    padding: 1mm;
    border: 0.75pt dotted #111;
  }

  .print-form .print-sheet-header,
  .print-form .contact-panel,
  .print-form .clinical-panel,
  .print-form .symptoms-panel,
  .print-form .self-care-panel,
  .print-form .education-panel,
  .print-form .outcome-panel,
  .print-form .print-signature-row,
  .print-form .summary {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-form .print-sheet-header {
    padding: 3mm 3mm 2mm;
  }

  .print-form .print-header-meta {
    grid-template-columns: 28mm minmax(0, 1fr) 34mm;
    gap: 3mm;
    min-height: 25mm;
  }

  .print-form .print-logo-box {
    width: 24mm;
    min-height: 23mm;
  }

  .print-form .print-logo-box img {
    max-width: 24mm;
    max-height: 22mm;
  }

  .print-form .print-title-box {
    gap: 0.8mm;
  }

  .print-form .print-title-box strong {
    font-size: 9pt;
    line-height: 1.3;
  }

  .print-form .print-title-box h2 {
    margin-top: 1.5mm;
    font-size: 14pt;
    line-height: 1.25;
  }

  .print-form .print-title-box p {
    font-size: 9.5pt;
  }

  .print-form .print-file-box {
    min-height: 18mm;
    border-width: 1.5pt;
  }

  .print-form .print-file-box div {
    padding: 1.8mm;
  }

  .print-form .print-patient-table {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .print-form .print-patient-table div {
    min-height: 12mm;
    padding: 1.8mm 2mm;
  }

  .print-form .print-patient-table span {
    margin-bottom: 1mm;
  }

  .print-form .print-patient-table strong {
    min-height: 4mm;
  }

  .print-form .section-title {
    min-height: 7mm;
    padding: 1.4mm 2mm;
  }

  .print-form .section-title h2 {
    font-size: 8.8pt;
  }

  .print-form label {
    min-height: 9.5mm;
    padding: 1.4mm 2mm;
    font-size: 7.8pt;
    line-height: 1.35;
  }

  .print-form input,
  .print-form select,
  .print-form textarea {
    min-height: 6mm;
    padding: 0;
    font-size: 8.3pt;
    line-height: 1.35;
  }

  .print-form textarea {
    height: 18mm;
    resize: none;
  }

  .print-form .fields.four,
  .print-form .dynamic-fields {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .print-form .fields.two {
    margin-top: 0;
  }

  .print-form .check-list.compact {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .print-form .check-list label,
  .print-form .toggle-list label {
    grid-template-columns: 4mm 1fr;
    min-height: 8mm;
    gap: 1.4mm;
    padding: 1.3mm 1.8mm;
  }

  .print-form input[type="checkbox"] {
    width: 3.5mm;
    height: 3.5mm;
  }

  .print-form .symptom-matrix {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .print-form .symptom-matrix label {
    min-height: 7.2mm;
    padding: 1.2mm 1.7mm;
    font-size: 7.4pt;
  }

  .print-form #selfCareList {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .print-form .summary {
    grid-template-columns: 1fr 1.3fr 1fr;
    gap: 0;
    padding: 0;
    background: #d6d6d6 !important;
  }

  .print-form .summary > div {
    min-height: 12mm;
    padding: 2mm;
    border-left: 1px solid #202020;
  }

  .print-form .summary button {
    display: none !important;
  }

  .print-form .risk-decision > :not(p):not(.risk-final-print) {
    display: none !important;
  }

  .print-form .risk-final-print {
    display: block;
  }

  .print-form .print-signature-row > div {
    min-height: 26mm;
    padding: 2mm;
  }

  .print-form .signature-box {
    min-height: 14mm;
  }

  .print-form .signature-box img {
    max-width: 38mm;
    max-height: 13mm;
  }

  .print-form.print-form-dense {
    font-size: 7.8pt;
  }

  .print-form.print-form-dense .clinical-panel {
    break-after: page;
    page-break-after: always;
  }

  .print-form.print-form-dense .dynamic-fields,
  .print-form.print-form-dense .symptom-matrix {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .print-form.print-form-dense label {
    min-height: 8.2mm;
    font-size: 7.1pt;
  }

  .print-form.print-form-dense input,
  .print-form.print-form-dense select,
  .print-form.print-form-dense textarea {
    font-size: 7.5pt;
  }

  .print-form.print-form-dense .symptom-matrix label {
    min-height: 6.5mm;
    font-size: 6.9pt;
  }

  .print-form.print-form-dense textarea {
    height: 14mm;
  }
}

.panel,
.summary,
.recent {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 15px;
}

.span-2 {
  grid-column: 1 / -1;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.section-title span {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  border-radius: 8px;
  background: rgba(2, 225, 152, 0.12);
  color: var(--primary);
  font-weight: 700;
}

.fields {
  display: grid;
  gap: 12px;
}

.fields.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fields.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fields.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.dynamic-fields {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

label {
  display: grid;
  gap: 7px;
  color: #314048;
  font-size: 12px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 10px;
}

textarea {
  resize: vertical;
  padding: 11px;
  line-height: 1.8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.16);
}

.check-list,
.toggle-list {
  display: grid;
  gap: 10px;
}

.check-list.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-list label,
.toggle-list label {
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 600;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.notes {
  margin-top: 14px;
}

.summary {
  display: grid;
  grid-template-columns: minmax(130px, 0.8fr) minmax(190px, 1fr) minmax(360px, 1.45fr) auto auto auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  position: sticky;
  bottom: 12px;
  z-index: 2;
}

.summary button {
  white-space: nowrap;
}

.summary p {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.summary strong {
  font-size: 15px;
}

.risk-decision {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.risk-level-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.risk-level-options label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.risk-level-options input {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
}

.risk-level-options label:has(input:checked) {
  border-color: currentColor;
  box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 18%, transparent);
}

.risk-level-options .green { color: #16784a; }
.risk-level-options .yellow { color: #8a6400; }
.risk-level-options .red { color: #b42318; }

.risk-schedule-suggestion {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #d8e3e7;
  border-radius: 5px;
  background: #f7fafb;
  color: #4e5f67;
  font-size: 13px;
  line-height: 1.7;
}

.case-closure-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #d8e3e7;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.case-closure-option[hidden] {
  display: none;
}

.case-closure-option:has(input:checked) {
  border-color: #bf7a82;
  background: #fff7f7;
}

.case-closure-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.case-closure-option span {
  display: grid;
  gap: 3px;
}

.case-closure-option small {
  color: var(--muted);
  font-weight: 600;
  line-height: 1.7;
}

.follow-up-schedule-fields.is-disabled {
  opacity: 0.5;
  pointer-events: none;
}

.risk-confirmation-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.risk-confirmation-check input {
  width: 17px;
  height: 17px;
  min-height: 0;
  margin: 0;
}

.risk-decision small {
  color: var(--muted);
  line-height: 1.6;
}

.risk-final-print {
  display: none;
}

button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 20px;
  background: var(--primary-2);
  color: white;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: #05c486;
}

.side-nav button {
  background: transparent;
}

.side-nav button:hover,
.side-nav button.active {
  background: rgba(255, 255, 255, 0.2);
}

.disease-tabs button {
  background: var(--surface);
  color: var(--dark);
}

.disease-tabs button:hover,
.disease-tabs button.active {
  background: linear-gradient(90deg, rgba(8, 183, 222, 0.14), rgba(2, 225, 152, 0.18));
  color: #066776;
}

.ghost-button {
  background: var(--surface);
  color: var(--dark);
}

.ghost-button:hover {
  background: var(--surface-2);
}

.secondary-button {
  background: #6c757d;
}

.secondary-button:hover {
  background: #5c636a;
}

.form-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.contact-summary-modal {
  width: min(94vw, 760px);
  max-height: min(760px, calc(100dvh - 36px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contact-summary-modal .modal-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.contact-summary-body {
  display: grid;
  gap: 14px;
  padding: 16px 18px;
  overflow-y: auto;
  background: var(--surface-2);
}

.supplement-picker {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.contact-summary-body .supplement-picker select {
  min-height: 42px;
  margin: 0;
}

.attached-supplement-list {
  display: grid;
  gap: 6px;
}

.attached-supplement {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.attached-supplement strong {
  min-width: 0;
  font-size: 12px;
}

.attached-supplement-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}

.attached-supplement-actions button {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 11px;
}

.supplement-modal {
  width: min(94vw, 900px);
  max-height: min(860px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.supplement-modal .modal-header p {
  margin: 4px 0 0;
}

.supplement-modal-body {
  min-height: 0;
  padding: 8px 18px 18px;
  overflow-y: auto;
}

.contact-summary-body label,
.contact-result-field legend {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.contact-summary-body input,
.contact-summary-body select,
.contact-summary-body textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.contact-result-field {
  margin: 0;
  padding: 0;
  border: 0;
}

.contact-result-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 7px;
}

.contact-result-options label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.contact-result-options input {
  width: auto;
  margin: 0;
}

.contact-result-options label:has(input:checked).successful {
  border-color: #2f9b68;
  color: #177348;
  background: #eef9f4;
}

.contact-result-options label:has(input:checked).unsuccessful {
  border-color: #d69a2d;
  color: #8b5d06;
  background: #fff8e8;
}

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

.contact-time-grid > .compact-jalali-field {
  grid-column: 1 / -1;
}

.compact-jalali-field,
.persian-time-field {
  min-width: 0;
  margin: 0;
  padding: 8px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.compact-jalali-field legend,
.persian-time-field legend {
  padding: 0 5px;
  color: var(--dark);
  font-size: 12px;
  font-weight: 750;
}

.compact-jalali-selects,
.persian-time-selects {
  display: grid;
  align-items: center;
  gap: 6px;
}

.compact-jalali-selects {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.persian-time-selects {
  direction: ltr;
  grid-template-columns: minmax(92px, 1.2fr) minmax(62px, 1fr) 8px minmax(62px, 1fr);
  grid-template-areas: "period minute separator hour";
}

.hour-only-time .persian-time-selects {
  grid-template-columns: minmax(112px, 1.35fr) minmax(72px, 1fr);
  grid-template-areas: "period hour";
}

.persian-time-selects [data-time-part="hour"] { grid-area: hour; }
.persian-time-selects [data-time-part="minute"] { grid-area: minute; }
.persian-time-selects [data-time-part="period"] { grid-area: period; }
.persian-time-selects > span { grid-area: separator; }

.compact-jalali-selects select,
.persian-time-selects select {
  width: 100%;
  min-width: 0;
  height: 40px;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--dark);
  font: inherit;
}

.persian-time-selects select[data-time-part="period"] {
  direction: rtl;
  padding-inline: 5px;
  font-size: 11px;
}

.persian-time-selects > span {
  color: var(--muted);
  font-weight: 800;
}

[data-persian-date-input] {
  direction: rtl;
  cursor: pointer;
}

.nested-modal {
  z-index: 1500;
}

.persian-date-modal {
  width: min(520px, calc(100vw - 32px));
}

.persian-date-modal-body {
  padding: 20px;
}

.persian-date-modal-body small {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-weight: 650;
}

.persian-date-modal-body small.is-error {
  color: var(--danger);
}

.persian-calendar-toolbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.persian-calendar-toolbar strong {
  text-align: center;
  font-size: 16px;
}

.calendar-nav-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.persian-calendar-weekdays,
.persian-calendar-days {
  direction: rtl;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.persian-calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.persian-calendar-days button,
.persian-calendar-days .calendar-empty {
  aspect-ratio: 1;
  min-width: 0;
}

.persian-calendar-days button {
  padding: 0;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--dark);
  font: inherit;
}

.persian-calendar-days button:hover,
.persian-calendar-days button:focus-visible {
  border-color: var(--primary);
  background: #eef7f8;
}

.persian-calendar-days button.is-today {
  border-color: #86abb0;
}

.persian-calendar-days button.is-selected {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.next-attempt-grid {
  grid-template-columns: 1fr;
}

.next-attempt-grid > * {
  grid-column: 1;
}

.unsuccessful-contact-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ecd79f;
  border-radius: 6px;
  background: #fffaf0;
}

.unsuccessful-contact-fields[hidden] {
  display: none;
}

.contact-persian-date {
  margin-top: -8px;
  color: var(--primary-3);
  font-weight: 700;
}

.contact-entry-note {
  margin: 0;
  color: var(--muted);
  font-size: 11.5px;
}

.call-attempt-history {
  grid-column: 1 / -1;
}

.call-attempt-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.call-attempt-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 12px;
}

.call-attempt-table th,
.call-attempt-table td {
  padding: 9px 10px;
  border: 1px solid var(--line);
  text-align: center;
  white-space: nowrap;
}

.call-attempt-table th {
  background: #eceff1;
  font-weight: 750;
}

.call-result {
  font-weight: 750;
}

.call-result.successful { color: #177348; }
.call-result.unsuccessful { color: #a96c00; }

@media (max-width: 720px) {
  .contact-time-grid,
  .next-attempt-grid {
    grid-template-columns: 1fr;
  }

  .persian-time-selects {
    grid-template-columns: minmax(88px, 1.2fr) minmax(58px, 1fr) 8px minmax(54px, 1fr);
  }
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-toolbar .section-title {
  margin-bottom: 0;
}

.settings-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid rgba(8, 183, 222, 0.18);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(8, 183, 222, 0.08), rgba(2, 225, 152, 0.08));
}

.settings-hero .section-title {
  margin-bottom: 10px;
}

.hospital-name-preview {
  margin-bottom: 6px;
  color: var(--dark);
  font-size: 20px;
  font-weight: 750;
}

.settings-hero small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hospital-logo-preview {
  display: grid;
  place-items: center;
  flex: 0 0 86px;
  width: 86px;
  height: 86px;
  border: 1px dashed rgba(8, 183, 222, 0.45);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
}

.hospital-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.settings-form,
.admin-editor {
  display: grid;
  gap: 16px;
}

.settings-form fieldset,
.admin-editor fieldset {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.settings-form legend,
.admin-editor legend {
  padding: 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
}

.file-upload input {
  padding: 8px 10px;
  height: auto;
  background: #fff;
}

.settings-editor {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(8, 183, 222, 0.24);
  border-radius: 8px;
  background: #fbfdfe;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-header strong {
  color: var(--dark);
  font-size: 16px;
}

.editor-actions {
  align-items: center;
}

.permission-groups {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.8fr;
  gap: 12px;
}

.permission-groups section {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.permission-groups h3 {
  margin: 0 0 4px;
  color: var(--dark);
  font-size: 13px;
}

.permission-groups label {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 600;
}

.permission-groups label:has(input:checked) {
  border-color: rgba(2, 225, 152, 0.4);
  background: #eef8f2;
  color: #16724c;
}

.permission-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-tags span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  background: #eef8f2;
  color: #16724c;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

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

.admin-grid article {
  min-height: 118px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.admin-grid strong {
  display: block;
  margin-bottom: 10px;
  color: var(--dark);
}

.admin-grid p {
  color: var(--muted);
  line-height: 1.9;
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}

.admin-table th,
.admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
}

.admin-table th {
  background: var(--surface-2);
  color: var(--dark);
}

.table-actions {
  display: flex;
  gap: 8px;
}

.table-actions button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.active {
  color: var(--green);
  background: #eef8f2;
}

.badge.inactive {
  color: var(--red);
  background: #fff1ef;
}

.badge.neutral {
  color: var(--muted);
  background: #f3f6f8;
}

.badge.info {
  color: #066776;
  background: #e7f8fb;
}

.recent {
  margin-top: 16px;
  padding: 18px;
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.recent-item small {
  color: var(--muted);
}

@media screen and (max-width: 1500px) {
  .workspace-filter-controls {
    grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(150px, 1fr));
  }
}

@media screen and (max-width: 1200px) {
  .workspace-filter-controls.all-forms-primary {
    grid-template-columns: minmax(220px, 2fr) minmax(140px, 1fr) minmax(130px, 1fr);
  }

  .all-forms-primary .all-forms-filter-toggle {
    grid-column: 1;
    justify-self: start;
  }

  .all-forms-primary .workspace-filter-clear {
    grid-column: 2 / -1;
    justify-self: end;
  }
}

@media screen and (max-width: 920px) {
  .app-frame {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .side-nav {
    flex: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    overflow: visible;
    scrollbar-gutter: auto;
  }

  .sub-nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 0;
    border-right: 0;
  }

  .fields.four,
  .fields.three,
  .fields.two,
  .case-history-row,
  .operational-row,
  .encounter-fields,
  .permission-groups,
  .summary,
  .metrics,
  .disease-tabs,
  .form-selection-row,
  .workflow-grid,
  .workflow-grid.two,
  .work-list.wide,
  .identity-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .operational-row .table-actions {
    justify-content: stretch;
    min-width: 0;
    flex-wrap: wrap;
  }

  .operational-row .table-actions button {
    width: 100%;
  }

  .encounter-group-item,
  .encounter-record-item {
    grid-template-columns: 1fr;
  }

  .encounter-group-meta {
    justify-content: flex-start;
  }

  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace-filter-controls.all-forms-primary,
  .workspace-filter-controls.all-forms-advanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .all-forms-primary .workspace-filter-clear {
    grid-column: 2;
    width: auto;
  }

  .workspace-search-field {
    grid-column: 1 / -1;
  }

  .workspace-filter-clear {
    width: 100%;
  }

  .print-header-meta,
  .print-patient-table,
  .print-signature-row,
  .print-form .symptom-matrix,
  .print-form #selfCareList,
  .print-form .fields.four,
  .print-form .dynamic-fields {
    grid-template-columns: 1fr;
  }

  .print-header-meta {
    min-height: 0;
  }

  .print-logo-box {
    justify-self: center;
  }

  .panel {
    grid-column: 1 / -1;
  }
}

@media screen and (max-width: 640px) {
  .workspace-filter-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-filter-controls {
    grid-template-columns: 1fr;
  }

  .workspace-filter-controls.all-forms-primary,
  .workspace-filter-controls.all-forms-advanced {
    grid-template-columns: 1fr;
  }

  .all-forms-primary .all-forms-filter-toggle,
  .all-forms-primary .workspace-filter-clear {
    grid-column: auto;
    justify-self: stretch;
    width: 100%;
  }

  .all-forms-heading {
    flex-wrap: wrap;
  }

  .all-forms-sort {
    width: 100%;
    justify-content: space-between;
  }

  .all-forms-sort select {
    flex: 1;
    max-width: 220px;
  }

  .workspace-search-field {
    grid-column: auto;
  }

  .modal-backdrop {
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100dvh - 20px);
  }

  .modal-header {
    align-items: stretch;
    flex-direction: column;
  }

  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-hero,
  .section-toolbar,
  .editor-header {
    align-items: stretch;
    flex-direction: column;
  }

  .hospital-logo-preview {
    align-self: start;
  }

  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .side-nav {
    grid-template-columns: 1fr 1fr;
  }

  .sub-nav {
    grid-template-columns: 1fr 1fr;
  }

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

  .attached-supplement {
    align-items: flex-start;
    flex-direction: column;
  }

  .check-list.compact {
    grid-template-columns: 1fr;
  }

  .permission-groups {
    grid-template-columns: 1fr;
  }
}

.patient-document-field {
  display: grid;
  gap: 7px;
}

.patient-document-field > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.patient-document-field input[type="file"],
.patient-document-upload input[type="file"] {
  width: 100%;
  padding: 9px;
  border: 1px dashed #b9c5ce;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.patient-document-field small,
.patient-document-upload small {
  color: var(--muted);
  font-size: 11px;
}

.patient-document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.patient-document-toolbar > div:first-child {
  display: grid;
  gap: 2px;
}

.patient-document-toolbar strong {
  color: var(--dark);
  font-size: 13px;
}

.patient-document-toolbar small {
  color: var(--muted);
  font-size: 11px;
}

.patient-document-toolbar-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.patient-document-toolbar-actions button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.modal-panel.patient-document-modal {
  width: min(1120px, calc(100vw - 32px));
  overflow: hidden;
}

.patient-document-modal-body {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  min-height: min(650px, calc(100dvh - 150px));
  direction: rtl;
}

.patient-document-sidebar {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-left: 1px solid var(--line);
  background: #f8fafb;
}

.patient-document-upload {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.patient-document-upload label {
  color: var(--dark);
  font-size: 13px;
  font-weight: 750;
}

.patient-document-upload button {
  min-height: 38px;
}

.patient-document-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  overflow: auto;
}

.patient-document-item {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: right;
}

.patient-document-item:hover,
.patient-document-item.active {
  border-color: var(--primary);
  background: rgba(8, 183, 222, 0.07);
}

.patient-document-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-document-item span,
.patient-document-item small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.patient-document-preview {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 520px;
  overflow: auto;
  background: #e9edf0;
  direction: rtl;
}

.patient-document-preview > p {
  max-width: 420px;
  margin: 24px;
  color: var(--muted);
  text-align: center;
}

.patient-document-preview iframe {
  width: 100%;
  height: 100%;
  min-height: 620px;
  border: 0;
  background: #fff;
}

.patient-document-preview img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 175px);
  margin: auto;
  object-fit: contain;
}

.operational-row .table-actions {
  flex-wrap: wrap;
}

@media screen and (max-width: 760px) {
  .patient-document-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .patient-document-toolbar-actions,
  .patient-document-toolbar-actions button {
    width: 100%;
  }

  .patient-document-toolbar-actions {
    flex-direction: column;
  }

  .patient-document-modal-body {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 105px);
    overflow: auto;
  }

  .patient-document-sidebar {
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

  .patient-document-list {
    max-height: 240px;
  }

  .patient-document-preview,
  .patient-document-preview iframe {
    min-height: 390px;
  }
}

@media print {
  .patient-document-toolbar,
  #patientDocumentModal {
    display: none !important;
  }
}

/* Management reporting */
.report-page {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.report-toolbar,
.report-commandbar,
.report-chart-panel,
.report-detail-section,
.report-builder-tools,
.report-builder-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(27, 36, 45, 0.05);
}

.report-toolbar {
  padding: 16px;
}

.report-toolbar-heading,
.report-commandbar,
.report-section-header,
.report-chart-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.report-toolbar-heading {
  margin-bottom: 14px;
}

.report-toolbar-heading span,
.report-section-header span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.report-toolbar-heading h2,
.report-section-header h3,
.report-chart-panel h3 {
  margin: 2px 0 0;
  color: #1f2933;
  letter-spacing: 0;
}

.report-toolbar-heading h2 {
  font-size: 20px;
}

.report-toolbar-heading small,
.report-chart-panel header span {
  color: var(--muted);
  font-size: 11px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(125px, 1fr));
  align-items: end;
  gap: 10px;
}

.report-filters label,
.report-builder-controls label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.report-filters label > span,
.report-builder-controls label > span,
.report-builder-presets > span {
  color: #59636f;
  font-size: 11px;
  font-weight: 700;
}

.report-filters select,
.report-filters input,
.report-builder-controls select,
.report-builder-controls input,
.report-template-actions input,
.report-template-actions select {
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
}

.report-filters button {
  min-height: 38px;
  white-space: nowrap;
}

.report-commandbar {
  min-height: 50px;
  padding: 7px 10px;
}

.report-tabs,
.report-export-actions,
.report-quick-filters,
.report-builder-presets,
.report-template-actions,
.report-pagination div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.report-tabs button,
.report-export-actions button,
.report-quick-filters button,
.report-builder-presets button,
.report-pagination button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #4a5561;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.report-tabs button.active,
.report-quick-filters button.active,
.report-builder-presets button.active {
  border-color: #b9d5f4;
  background: #eaf3fd;
  color: #0b63c7;
}

.report-export-actions button {
  border-color: var(--line);
  background: #fff;
}

.report-export-actions button:hover,
.report-pagination button:hover:not(:disabled) {
  border-color: #9cbfe7;
  color: #0b63c7;
}

.report-tab-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.report-kpi {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 10px;
  min-height: 92px;
  padding: 13px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-kpi::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #1473e6;
  content: "";
}

.report-kpi span {
  color: #59636f;
  font-size: 12px;
  font-weight: 700;
}

.report-kpi strong {
  grid-row: span 2;
  color: #1c2731;
  font-size: 25px;
  letter-spacing: 0;
}

.report-kpi small {
  color: #7b8490;
  font-size: 10px;
}

.report-kpi.tone-green::before { background: #16865c; }
.report-kpi.tone-yellow::before { background: #d89a20; }
.report-kpi.tone-red::before { background: #d83a4b; }
.report-kpi.tone-cyan::before { background: #0f8b8d; }
.report-kpi.tone-purple::before { background: #7356a6; }

.report-attention {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #f1c5ca;
  border-right: 4px solid var(--red);
  border-radius: 7px;
  background: #fff8f8;
}

.report-attention > span {
  color: #8d2633;
  font-size: 12px;
  font-weight: 800;
}

.report-attention > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-attention button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border: 1px solid #efcfd3;
  border-radius: 6px;
  background: #fff;
  color: #65353b;
  font: inherit;
  cursor: pointer;
}

.report-attention button strong { color: var(--red); }

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 10px;
}

.report-chart-panel {
  grid-column: span 4;
  min-width: 0;
  padding: 14px 15px 12px;
}

.report-chart-panel.report-chart-wide { grid-column: span 8; }
.report-chart-panel header { min-height: 38px; }
.report-chart-panel h3 { font-size: 14px; }
.report-chart-panel canvas { display: block; max-width: 100%; }

.report-chart-legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  min-height: 24px;
}

.report-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #59636f;
  font-size: 10px;
}

.report-chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.report-chart-legend b { color: #27313b; }

.report-funnel {
  display: grid;
  gap: 12px;
  padding: 14px 0 4px;
}

.report-funnel > div {
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 9px;
  font-size: 11px;
}

.report-funnel > div > div {
  height: 13px;
  overflow: hidden;
  border-radius: 3px;
  background: #edf0f2;
}

.report-funnel i {
  display: block;
  height: 100%;
  background: #0f8b8d;
}

.report-detail-section,
.report-builder-result {
  min-width: 0;
  padding: 14px;
}

.report-section-header {
  margin-bottom: 12px;
}

.report-section-header h3 { font-size: 16px; }
.report-table-wrap { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }

.report-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  color: #2d3741;
  font-size: 11px;
}

.report-table th,
.report-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e4e8eb;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}

.report-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f7f9;
  color: #49535e;
  font-weight: 800;
}

.report-table tbody tr:hover { background: #f8fbfd; }
.report-table tbody tr.is-overdue { background: #fff7f7; }
.report-table td strong { display: block; color: #202830; }
.report-table td small { display: block; margin-top: 2px; color: #7c8690; font-size: 9px; }

.report-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef1f4;
  color: #59636f;
  font-size: 10px;
  font-weight: 800;
}

.report-badge.risk-red,
.report-badge.status-danger { background: #fdebed; color: #a92838; }
.report-badge.risk-yellow { background: #fff4da; color: #91640d; }
.report-badge.risk-green,
.report-badge.status-success { background: #e7f6ef; color: #14744f; }
.report-badge.status-progress { background: #e9f2fd; color: #0f65c5; }
.report-badge.status-info { background: #edf0f3; color: #56616c; }

.report-date { display: grid; gap: 1px; }
.report-date.overdue { color: #b22d3d; font-weight: 800; }
.report-date.due { color: #91640d; font-weight: 800; }

.report-row-action {
  padding: 5px 9px;
  border: 1px solid #c9d9e8;
  border-radius: 5px;
  background: #fff;
  color: #0f65c5;
  font: inherit;
  cursor: pointer;
}

.report-empty { padding: 30px !important; color: var(--muted); text-align: center !important; }

.report-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding-top: 9px;
  color: #68727d;
  font-size: 11px;
}

.report-pagination button { border-color: var(--line); background: #fff; }
.report-pagination button:disabled { opacity: 0.45; cursor: not-allowed; }

.report-builder-tools {
  display: grid;
  gap: 13px;
  padding: 14px;
}

.report-builder-presets { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.report-builder-controls { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)); gap: 10px; }

.report-column-picker {
  margin: 0;
  padding: 10px 12px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.report-column-picker legend { padding: 0 6px; color: #59636f; font-size: 11px; font-weight: 800; }
.report-column-picker > div { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 7px; }
.report-column-picker label { display: flex; align-items: center; gap: 6px; color: #414b55; font-size: 11px; }
.report-column-picker input { accent-color: #1473e6; }
.report-template-actions { padding-top: 2px; }
.report-template-actions input { width: min(260px, 100%); }
.report-template-actions select { width: min(230px, 100%); }
.text-danger-button { border: 0; background: transparent; color: var(--red); font: inherit; cursor: pointer; }
.report-group-row td { background: #edf3f8; color: #24445e; font-weight: 800; }

.report-detail-modal { width: min(94vw, 920px); max-height: calc(100dvh - 40px); overflow: hidden; }
.report-detail-body { padding: 16px; overflow: auto; }
.report-detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); border-right: 1px solid var(--line); }
.report-detail-grid > div { display: grid; gap: 5px; min-height: 72px; padding: 10px; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.report-detail-grid span,
.report-detail-note span { color: #6c7680; font-size: 10px; font-weight: 700; }
.report-detail-grid strong { color: #202830; font-size: 12px; overflow-wrap: anywhere; }
.report-detail-note { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: #f8f9fa; }
.report-detail-note p { margin: 5px 0 0; color: #3e4852; font-size: 12px; line-height: 1.8; }

@media screen and (max-width: 1280px) {
  .report-filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  .report-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-chart-panel,
  .report-chart-panel.report-chart-wide { grid-column: span 6; }
  .report-column-picker > div { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
}

@media screen and (max-width: 820px) {
  .report-toolbar-heading,
  .report-commandbar,
  .report-section-header { align-items: stretch; flex-direction: column; }
  .report-filters,
  .report-builder-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-chart-panel,
  .report-chart-panel.report-chart-wide { grid-column: 1 / -1; }
  .report-column-picker > div { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media screen and (max-width: 520px) {
  .report-filters,
  .report-kpis,
  .report-builder-controls,
  .report-column-picker > div,
  .report-detail-grid { grid-template-columns: 1fr; }
  .report-kpi { min-height: 78px; }
  .report-attention { grid-template-columns: 1fr; }
  .report-funnel > div { grid-template-columns: 95px 1fr 35px; }
}

@media print {
  body.report-print-mode .print-root { display: block !important; }
  .report-print-sheet { page: reportPage; direction: rtl; width: 100%; color: #111; font-family: "Vazirmatn", Tahoma, sans-serif; }
  .report-print-sheet header { display: grid; gap: 4px; margin-bottom: 10mm; padding-bottom: 4mm; border-bottom: 2px solid #222; text-align: center; }
  .report-print-sheet header div { display: grid; gap: 2px; }
  .report-print-sheet h1 { margin: 3mm 0 1mm; font-size: 18pt; }
  .report-print-sheet header small { color: #444; font-size: 8pt; }
  .report-print-sheet table { width: 100%; border-collapse: collapse; font-size: 7.5pt; }
  .report-print-sheet th,
  .report-print-sheet td { padding: 2mm; border: 1px solid #555; text-align: right; overflow-wrap: anywhere; }
  .report-print-sheet th { background: #e6e6e6 !important; font-weight: 800; }
  .report-print-sheet tr { break-inside: avoid; }
}

@page reportPage {
  size: A4 landscape;
  margin: 8mm;
}

/* User profile */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font: inherit;
}

.user-chip:hover {
  border-color: #a9dce7;
  background: #f1fbfd;
}

.user-chip-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 50%;
  background: #dff6fa;
  color: #087d94;
  font-size: 12px;
  font-weight: 800;
}

.user-chip-avatar img,
.profile-avatar img,
.profile-image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-page {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.profile-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.profile-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  overflow: hidden;
  border: 1px solid #bfe8ef;
  border-radius: 50%;
  background: #e8f8fb;
  color: #087d94;
  font-size: 21px;
  font-weight: 800;
}

.profile-heading span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.profile-heading h2 {
  margin-top: 3px;
  color: #202830;
  font-size: 20px;
}

.profile-heading p,
.profile-panel-title p,
.profile-session-action p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
}

.profile-tabs {
  display: flex;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
}

.profile-tabs button {
  min-height: 46px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: #66717c;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.profile-tabs button:hover {
  color: #087d94;
}

.profile-tabs button.active {
  border-bottom-color: var(--primary);
  color: #087d94;
}

.profile-panel {
  padding: 22px;
}

.profile-panel-title,
.profile-session-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.profile-panel-title {
  margin-bottom: 18px;
}

.profile-panel-title h2 {
  color: #26313b;
  font-size: 16px;
}

.profile-status {
  padding: 5px 10px;
  border-radius: 999px;
  background: #e7f6ef;
  color: #14744f;
  font-size: 10px;
  font-weight: 800;
}

.profile-status.is-inactive {
  background: #fdecef;
  color: #b22d3d;
}

.profile-form {
  display: grid;
  gap: 18px;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-fields label,
.profile-password-form label {
  display: grid;
  gap: 6px;
  color: #4b5661;
  font-size: 11px;
  font-weight: 750;
}

.profile-fields input,
.profile-password-form input,
.profile-notification-list select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #26313b;
  font: inherit;
}

.profile-fields input[readonly] {
  border-color: #e3e7ea;
  background: #f5f6f7;
  color: #69737d;
  cursor: default;
}

.profile-fields .editable-field input {
  border-color: #9edce8;
  background: #fff;
}

.profile-image-editor {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #edf0f2;
}

.profile-image-preview {
  display: grid;
  place-items: center;
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 1px dashed #b8c3cc;
  border-radius: 50%;
  background: #fafbfc;
  color: #7b858e;
  font-size: 9px;
  text-align: center;
}

.profile-upload {
  display: inline-flex !important;
  width: max-content;
  min-height: 40px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid #b9dce3;
  border-radius: 6px;
  background: #f5fbfc;
  color: #087d94;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.profile-image-editor small {
  display: block;
  margin-top: 6px;
  color: #7c8690;
  font-size: 9px;
}

.profile-metadata {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 11px 13px;
  border-block: 1px solid #edf0f2;
  color: #727d87;
  font-size: 10px;
}

.profile-metadata b {
  margin-right: 5px;
  color: #3f4a54;
}

.profile-signature-preview {
  display: grid;
  place-items: center;
  width: min(520px, 100%);
  min-height: 180px;
  padding: 16px;
  border: 1px dashed #b8c3cc;
  background: #fafbfc;
  color: #7b858e;
  font-size: 11px;
}

.profile-signature-preview img {
  display: block;
  max-width: 100%;
  max-height: 150px;
  object-fit: contain;
}

.profile-password-form {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
}

.profile-password-form .form-actions {
  grid-column: 1 / -1;
}

.profile-session-action {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-session-action strong {
  color: #303a44;
  font-size: 12px;
}

.profile-notification-list {
  border-top: 1px solid var(--line);
}

.profile-notification-list > label {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line);
}

.profile-notification-list span {
  display: grid;
  gap: 3px;
}

.profile-notification-list strong {
  color: #34404a;
  font-size: 12px;
}

.profile-notification-list small {
  color: #7a858f;
  font-size: 10px;
}

.profile-notification-list input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  accent-color: #15966a;
}

.profile-notification-list select {
  width: 170px;
}

.profile-notification-list .is-disabled {
  opacity: 0.55;
}

.license-settings {
  display: grid;
  gap: 24px;
}

.license-status-badge {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #5d6872;
  background: #f7f9fa;
  font-size: 11px;
  font-weight: 800;
}

.license-status-badge.active {
  border-color: #9bd4bd;
  color: #087a50;
  background: #edf9f4;
}

.license-status-badge.warning {
  border-color: #e8c46d;
  color: #8b6200;
  background: #fff9e9;
}

.license-status-badge.expired {
  border-color: #e4a4aa;
  color: #ac2836;
  background: #fff1f2;
}

.license-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: 1px solid var(--line);
}

.license-summary > div {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 18px;
  border-inline-start: 1px solid var(--line);
}

.license-summary > div:first-child {
  border-inline-start: 0;
}

.license-summary span {
  color: #77828c;
  font-size: 10px;
}

.license-summary strong {
  overflow-wrap: anywhere;
  color: #303b45;
  font-size: 12px;
}

.license-editor {
  display: grid;
  gap: 16px;
}

.license-editor fieldset {
  display: grid;
  gap: 16px;
}

.license-editor textarea {
  resize: vertical;
}

.license-history {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.empty-table-cell {
  padding: 28px !important;
  color: #77828c;
  text-align: center !important;
}

.form-access-settings {
  display: grid;
  gap: 20px;
}

.form-access-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding-block: 12px;
  border-block: 1px solid var(--line);
  color: #68747e;
  font-size: 11px;
}

.form-access-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.form-access-legend i {
  width: 10px;
  height: 10px;
  border: 2px solid #168b63;
  border-radius: 2px;
  background: #eaf8f2;
}

.form-access-legend i.restricted {
  border-color: #b37a08;
  background: #fff6dc;
}

.form-access-table td {
  vertical-align: top;
}

.form-access-table td > strong,
.form-access-updated {
  display: grid;
  gap: 4px;
}

.form-access-table td > small,
.form-access-updated small {
  display: block;
  color: #7c8790;
  font-size: 9px;
}

.form-access-table select {
  min-width: 120px;
  min-height: 42px;
}

.department-scope-picker {
  position: relative;
  min-width: 180px;
}

#userDepartmentField {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
}

#userDepartmentField[hidden] {
  display: none;
}

#userDepartmentSummary {
  overflow-wrap: anywhere;
}

.department-scope-picker summary {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  list-style-position: inside;
}

.department-scope-picker[open] > div {
  display: grid;
  gap: 4px;
  max-height: 220px;
  margin-top: 6px;
  padding: 8px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 20px rgb(31 42 51 / 10%);
}

.department-scope-picker label {
  display: flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 6px;
  cursor: pointer;
}

.department-scope-picker input,
.form-access-toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  accent-color: #168b63;
}

.form-access-toggle {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.form-access-updated {
  min-width: 145px;
  color: #4b5862;
}

@media screen and (max-width: 860px) {
  .license-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .license-summary > div:nth-child(3) {
    border-inline-start: 0;
  }

  .profile-fields,
  .profile-password-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-tabs {
    overflow-x: auto;
    padding-inline: 10px;
  }

  .profile-tabs button {
    flex: 0 0 auto;
  }
}

@media screen and (max-width: 560px) {
  .license-summary {
    grid-template-columns: 1fr;
  }

  .license-summary > div {
    border-inline-start: 0;
    border-bottom: 1px solid var(--line);
  }

  .license-summary > div:last-child {
    border-bottom: 0;
  }

  .profile-heading,
  .profile-panel {
    padding: 16px;
  }

  .profile-fields,
  .profile-password-form {
    grid-template-columns: 1fr;
  }

  .profile-panel-title,
  .profile-session-action {
    align-items: flex-start;
    flex-direction: column;
  }

  .profile-notification-list > label {
    align-items: flex-start;
  }

  .notification-time-setting {
    flex-direction: column;
  }

  .profile-notification-list select {
    width: 100%;
  }
}

.referral-section-heading {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--dark);
  font-size: 15px;
  font-weight: 800;
}

.referral-fields { margin-top: 0 !important; }
#referralPresetControls {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
#referralPresetControls legend { padding-inline: 6px; color: var(--dark); font-weight: 800; }
#referralPresetControls p { margin: 0 0 12px; color: var(--text); font-size: 12px; line-height: 1.9; }
#referralPresetControls small { display: block; margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.referral-preset-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.referral-preset-actions button { min-width: 0; white-space: normal; }
#requestSubmitterFields {
  min-width: 0;
  margin: 0;
  padding: 14px;
  border: 1px solid #83c5ef;
  border-inline-start: 4px solid #1875aa;
  border-radius: 8px;
  background: #eef8ff;
}
#requestSubmitterFields legend {
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid #83c5ef;
  border-radius: 5px;
  background: #eef8ff;
  color: #124e78;
  font-size: 13px;
  font-weight: 800;
}
#requestSubmitterHint {
  margin: 0 0 12px;
  color: #124e78;
  font-size: 12px;
  line-height: 1.8;
}
#requestSubmitterFields label {
  color: #124e78;
}
#requestSubmitterFields input {
  background: var(--surface);
}
.referral-fields > label { align-content: start; }
.referral-fields small { color: var(--muted); font-weight: 500; line-height: 1.6; }
.referral-readonly-field {
  display: grid;
  align-content: start;
  gap: 7px;
  min-width: 0;
  color: #314048;
  font-size: 12px;
  font-weight: 700;
}
.referral-readonly-field strong {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}
#referralFrequencyOtherField { grid-column: 1; }
#referralDurationOtherField { grid-column: 2; }
.referral-consent { display: flex; align-items: center; gap: 10px; line-height: 1.8; }
.referral-consent input { width: 18px; height: 18px; flex: 0 0 18px; margin: 0; }
.referral-modal { width: min(800px, calc(100vw - 32px)); }
.referral-modal-body { padding: 18px; }
.referral-sheet { border: 1px solid var(--line); color: var(--dark); }
.referral-sheet header { padding: 16px; border-bottom: 1px solid var(--line); text-align: center; }
.referral-sheet header span, .referral-sheet header small { display: block; color: var(--muted); }
.referral-sheet header h3 { margin: 4px 0; font-size: 17px; }
.referral-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.referral-field { min-width: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.referral-field:nth-child(odd) { border-left: 1px solid var(--line); }
.referral-field span, .referral-sheet-notes span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.referral-field strong, .referral-sheet-notes p { margin: 0; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.referral-sheet-notes { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: pre-wrap; }
.referral-sheet-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding: 12px; font-size: 12px; }
.referral-sheet-footer img { width: auto; max-width: 150px; max-height: 64px; object-fit: contain; }

@media screen and (max-width: 680px) {
  .referral-sheet-grid { grid-template-columns: 1fr; }
  .referral-field:nth-child(odd) { border-left: 0; }
}

@media screen and (max-width: 920px) {
  #referralFrequencyOtherField,
  #referralDurationOtherField { grid-column: auto; }
}

@media print {
  body.print-referral-mode .referral-sheet { border: 1pt solid #333; }
  body.print-referral-mode .referral-sheet header { padding: 3mm; border-bottom: 1pt solid #333; }
  body.print-referral-mode .referral-sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.print-referral-mode .referral-field { padding: 2mm; border-bottom: 1px solid #555; }
  body.print-referral-mode .referral-field:nth-child(odd) { border-left: 1px solid #555; }
  body.print-referral-mode .referral-sheet-notes { padding: 2mm; }
  body.print-referral-mode .referral-sheet-footer { padding: 2mm; }
}
/* Site appearance is owner-managed and independent of clinical form branding. */
.site-appearance-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); gap: 24px; }
.site-appearance-layout > * { min-width: 0; }
.site-appearance-preview { border-inline-start: 1px solid #dce3e8; padding-inline-start: 24px; overflow-wrap: anywhere; }
.site-logo-image { width: 96px; height: 96px; object-fit: contain; display: block; margin-block: 12px; }
.site-preview-contact { display: grid; gap: 12px; margin-block-start: 24px; }
.site-logo-fields .file-upload { margin-block: 12px; }
#siteAppearanceForm input[type="color"] { width: 64px; height: 42px; padding: 4px; cursor: pointer; }
.site-appearance-preview p, #siteOrganizationAddress, #siteLoginDescription { white-space: pre-line; overflow-wrap: anywhere; }
#siteLoginTitle, #siteName, #siteSubtitle, #siteOrganizationName { overflow-wrap: anywhere; }
@media (max-width: 900px) {
  .site-appearance-layout { grid-template-columns: minmax(0, 1fr); }
  .site-appearance-preview { border-inline-start: 0; border-block-start: 1px solid #dce3e8; padding-inline-start: 0; padding-block-start: 16px; }
}
