@font-face {
  font-family: "Sampurna Bengali";
  src: url("assets/fonts/NotoSansBengali-Regular.ttf?v=20260812-bengali-diet-pdf-v2") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #68756e;
  --line: #dbe3dd;
  --paper: #fbfcf9;
  --panel: #ffffff;
  --sage: #45675a;
  --teal: #167f7a;
  --coral: #c65c4a;
  --gold: #a97826;
  --wash: #eef5f1;
  --shadow: 0 18px 50px rgba(40, 61, 52, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #f7fbf9 0%, #eef5f1 46%, #fbfcf9 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  color: var(--ink);
}

.login-brand-centered {
  justify-content: center;
  text-align: center;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-otp-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6faf7;
}

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

.login-back {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #20372f;
  color: #f7fbf8;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 92px;
  height: auto;
  display: block;
  border-radius: 8px;
  background: #fff;
}

.login-brand {
  align-items: flex-start;
}

.login-brand .brand-logo {
  width: 128px;
}

.login-brand-centered .brand-logo {
  width: 180px;
  margin: 0 auto;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f6f0dc;
  color: #20372f;
  font-size: 24px;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.mobile-menu-toggle {
  display: none;
}

.brand span,
.sidebar-note {
  color: rgba(247, 251, 248, 0.72);
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.sidebar-note {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  font-size: 13px;
  line-height: 1.5;
}

.main {
  min-width: 0;
  max-width: 100%;
  padding: 28px;
}

.topbar,
.panel-heading,
.detail-head,
.report-toolbar,
menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 20px;
}

.topbar-title {
  display: grid;
  gap: 6px;
}

.crm-history-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(21, 95, 83, 0.2);
  border-radius: 999px;
  background: linear-gradient(135deg, #0f8b78, #245b51);
  color: #fff;
  box-shadow: 0 8px 20px rgba(36, 91, 81, 0.18);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.history-button-forward {
  background: linear-gradient(135deg, #ec6f9f, #0f8b78);
}

.history-button:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.history-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
  filter: grayscale(0.4);
  box-shadow: none;
}

.app-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 14px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-chip {
  min-height: 40px;
  display: grid;
  align-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.login-help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.access-note {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff9f6;
  color: #6a473c;
}

.primary,
.secondary,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 40px;
  color: var(--ink);
  background: var(--panel);
  text-decoration: none;
}

.primary {
  border-color: #245b51;
  background: #245b51;
  color: white;
  font-weight: 700;
}

.secondary:hover,
.primary:hover {
  filter: brightness(0.97);
}

.danger-button {
  border-color: #b34a4a;
  color: #8f2d2d;
  background: #fff6f6;
}

.patient-delete-heading,
.patient-delete-cell {
  width: 48px;
  text-align: center;
}

.patient-delete-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #8f2d2d;
  font-size: 18px;
  line-height: 1;
}

.patient-delete-icon:hover,
.patient-delete-icon:focus-visible {
  border-color: #d9aaaa;
  background: #fff6f6;
}

.patient-recycle-panel {
  margin-bottom: 16px;
}

.patient-recycle-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.patient-recycle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

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

.patient-recycle-row span,
.patient-recycle-row small {
  color: var(--muted);
}

.save-progress-button {
  border-color: #a86b16;
  background: #b97918;
  color: #fff;
}

.small {
  min-height: 32px;
  padding: 6px 10px;
}

.icon-button {
  width: 36px;
  padding: 0;
  font-size: 22px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 24px rgba(40, 61, 52, 0.05);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(22, 127, 122, 0.12);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.kpi-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-section {
  display: grid;
  gap: 10px;
}

.kpi-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.kpi-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.kpi-section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi-section-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.kpi,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 24px rgba(40, 61, 52, 0.05);
}

.kpi {
  padding: 16px;
}

button.kpi {
  width: 100%;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

button.kpi:hover {
  border-color: rgba(22, 127, 122, 0.42);
  transform: translateY(-1px);
}

button.kpi:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.kpi span,
.kpi small,
.panel-heading span,
td span,
.detail-head span,
.activity-item span,
.activity-item small,
.followup-card span,
.followup-card small {
  color: var(--muted);
}

.kpi strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 30px;
  line-height: 1;
}

.dashboard-mode-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.dashboard-mode-row .active {
  border-color: rgba(22, 127, 122, 0.6);
  background: #f4fbf8;
  color: #0f6662;
  font-weight: 800;
}

.management-date-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 240px) minmax(180px, 240px) 1fr;
  gap: 10px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
}

.management-date-toolbar .segmented-control {
  align-self: stretch;
}

.management-date-summary {
  align-self: center;
  justify-self: end;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.today-schedule-panel {
  margin-bottom: 20px;
}

.doctor-schedule-heading {
  align-items: flex-end;
  gap: 18px;
}

.doctor-schedule-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.schedule-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.schedule-kpi strong {
  font-size: 26px;
}

.schedule-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 14px;
}

.schedule-toolbar label {
  width: min(280px, 100%);
}

.doctor-schedule-toolbar {
  align-items: end;
  margin-bottom: 0;
}

.doctor-schedule-toolbar label {
  width: 190px;
}

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

#whatsapp-status,
#doctor-dashboard-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 12px;
  padding: 9px 11px;
  background: #f7faf8;
}

#whatsapp-status[data-tone="pending"],
#doctor-dashboard-status[data-tone="pending"] {
  border-color: #b8d8ff;
  background: #f2f8ff;
  color: #15508f;
}

#whatsapp-status[data-tone="success"],
#doctor-dashboard-status[data-tone="success"] {
  border-color: #a9d8c2;
  background: #effaf4;
  color: #16623f;
}

#whatsapp-status[data-tone="error"],
#doctor-dashboard-status[data-tone="error"] {
  border-color: #f1b6b6;
  background: #fff4f4;
  color: #9c1f1f;
}

.doctor-planning-panel {
  margin-top: 20px;
}

.inline-month-control {
  width: min(220px, 100%);
  margin-left: auto;
}

.schedule-type-section {
  display: grid;
  gap: 10px;
}

.doctor-schedule-grid {
  display: grid;
  gap: 10px;
}

.doctor-appointment-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.doctor-appointment-card.consultation-delayed-row {
  background: #fff9df;
  border-color: #ecd172;
}

.doctor-appointment-card.consultation-done-card,
.reception-card.consultation-done-card,
.dietitian-worklist-card.consultation-done-card,
.schedule-item.consultation-done-card {
  background: #fdd7e4;
  border-color: #ef9fbd;
}

.doctor-appointment-card.visit-day-complete-card,
.reception-card.visit-day-complete-card,
.dietitian-worklist-card.visit-day-complete-card,
.schedule-item.visit-day-complete-card {
  background: #bdc1ff;
  border-color: #858ce8;
}

.doctor-appointment-main {
  display: grid;
  grid-template-columns: minmax(72px, 0.45fr) minmax(180px, 1.2fr) minmax(220px, 1.5fr) minmax(180px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.doctor-time-block,
.doctor-patient-block,
.doctor-status-control {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.doctor-time-block strong,
.doctor-patient-block strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.15;
}

.doctor-time-block span,
.doctor-patient-block span,
.doctor-status-control span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.doctor-appointment-detail {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7faf8;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.25;
}

.doctor-status-control select {
  width: 100%;
}

.doctor-card-actions {
  justify-content: flex-end;
  min-width: 190px;
}

.doctor-appointment-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.doctor-appointment-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fbf9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.doctor-appointment-meta strong {
  color: var(--ink);
}

.schedule-type-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #eef5f1;
}

.schedule-type-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.schedule-type-head.sub-head {
  background: #f7fbf9;
  border: 1px solid var(--line);
}

.reception-confirmation-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.reception-doctor-section,
.reception-bucket-section,
.reception-confirmation-section {
  display: grid;
  gap: 10px;
}

.reception-bucket-section + .reception-bucket-section {
  margin-top: 8px;
}

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

.marketing-grid .wide {
  grid-column: 1 / -1;
}

.marketing-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.marketing-card strong {
  color: var(--ink);
}

.marketing-card span,
.marketing-card small {
  color: var(--muted);
}

.marketing-card p {
  margin: 4px 0 0;
}

.marketing-history-section {
  display: grid;
  gap: 12px;
}

.marketing-history-section + .marketing-history-section {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.marketing-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.marketing-history-heading h3 {
  margin: 0;
  font-size: 18px;
}

.marketing-history-heading span,
.marketing-month-heading {
  color: var(--muted);
  font-weight: 800;
}

.marketing-month-group {
  display: grid;
  gap: 8px;
}

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

.marketing-filter-bar {
  display: grid;
  grid-template-columns: auto repeat(4, minmax(160px, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf8;
}

.marketing-filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control.compact {
  align-self: end;
  min-height: 42px;
}

.segmented-control.compact button {
  min-height: 40px;
  padding: 0 14px;
}

.dashboard-visit-date-filter {
  grid-column: 1 / -1;
}

.is-hidden {
  display: none !important;
}

.next-date-pending-field,
.reception-date-pending-field {
  align-self: end;
  min-height: 42px;
}

.map-link-button {
  width: fit-content;
}

.modal-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.marketing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reception-break {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.marketing-followup {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.marketing-followup-row {
  display: grid;
  grid-template-columns: 145px 170px 145px 145px minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.marketing-lead-followup-card {
  cursor: default;
}

.schedule-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.schedule-table {
  min-width: 1120px;
}

.schedule-table th {
  background: #dcefd4;
  color: #20372f;
}

.schedule-table td {
  background: #fff;
}

.schedule-table tbody tr:nth-child(odd) td {
  background: #fffef3;
}

.schedule-table tbody tr.patient-row-even td {
  background: #fff;
}

.schedule-table tbody tr.patient-row-odd td {
  background: #fffef3;
}

.schedule-table tbody tr.consultation-delayed-row td,
.schedule-table tbody tr.consultation-delayed-row:hover td,
.schedule-table .doctor-referral-row.consultation-delayed-row td,
.schedule-table .reception-progress-row.consultation-delayed-row td,
.schedule-table .doctor-referral-row.consultation-delayed-row:hover td,
.schedule-table .reception-progress-row.consultation-delayed-row:hover td {
  background: #fff2ad;
}

.schedule-table tbody tr.consultation-done-card td,
.schedule-table tbody tr.consultation-done-card:hover td,
.schedule-table .doctor-referral-row.consultation-done-card td,
.schedule-table .reception-progress-row.consultation-done-card td,
.schedule-table .doctor-referral-row.consultation-done-card:hover td,
.schedule-table .reception-progress-row.consultation-done-card:hover td {
  background: #fdd7e4;
}

.schedule-table tbody tr.visit-day-complete-card td,
.schedule-table tbody tr.visit-day-complete-card:hover td,
.schedule-table .doctor-referral-row.visit-day-complete-card td,
.schedule-table .reception-progress-row.visit-day-complete-card td,
.schedule-table .doctor-referral-row.visit-day-complete-card:hover td,
.schedule-table .reception-progress-row.visit-day-complete-card:hover td {
  background: #bdc1ff;
}

.schedule-table tbody tr:hover td {
  background: #eef8f4;
}

.schedule-table .doctor-referral-row td,
.schedule-table .reception-progress-row td {
  padding-top: 0;
}

.schedule-table .doctor-referral-row:hover td,
.schedule-table .reception-progress-row:hover td {
  background: #eef8f4;
}

.schedule-table td:nth-child(1),
.schedule-table td:nth-child(2) {
  white-space: nowrap;
}

.schedule-table td:nth-child(4),
.schedule-table td:nth-child(6),
.schedule-table td:nth-child(8),
.schedule-table td:nth-child(9) {
  min-width: 150px;
}

.schedule-table .appointment-detail-cell {
  font-weight: 800;
  color: #0f201a;
}

.schedule-status-select {
  min-width: 190px;
  padding: 7px 9px;
  font-size: 12px;
}

.reception-table textarea {
  min-height: 42px;
  height: 42px;
  min-width: 180px;
}

.reception-table {
  min-width: 1720px;
}

.reception-card-list {
  display: grid;
  gap: 10px;
}

.reception-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(40, 61, 52, 0.05);
}

.reception-card.patient-row-odd {
  background: #fffef3;
}

.reception-card.consultation-delayed-card {
  background: #fff2ad;
  border-color: #e3c85a;
}

.reception-card.consultation-done-card {
  background: #fdd7e4;
  border-color: #ef9fbd;
}

.reception-card.visit-day-complete-card {
  background: #bdc1ff;
  border-color: #858ce8;
}

.reception-card-main {
  display: grid;
  grid-template-columns: minmax(170px, 1.45fr) minmax(70px, .55fr) minmax(110px, .8fr) minmax(150px, 1fr) minmax(190px, 1.15fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  background: #f8fbf8;
  border-bottom: 1px solid #e7eee9;
}

.reception-card-patient strong {
  display: block;
  font-size: 13px;
}

.reception-card-patient span,
.field-caption {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.reception-card-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 10px;
  padding: 12px;
}

.reception-card-field {
  display: grid;
  gap: 4px;
  align-content: start;
  min-height: 62px;
  padding: 9px 10px;
  border: 1px solid #e7eee9;
  border-radius: 6px;
  background: #fff;
}

.reception-wide-field {
  grid-column: span 2;
}

.reception-arrival-field {
  grid-column: span 2;
}

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

.arrival-id-grid .mini-label {
  min-width: 0;
}

.arrival-id-grid .arrival-address-field {
  grid-column: 1 / -1;
}

.arrival-id-grid textarea {
  min-height: 42px;
  resize: vertical;
}

.arrival-unmarried-note {
  align-self: end;
  margin: 0;
  padding: 10px 12px;
  border: 1px dashed #d5e2d9;
  border-radius: 6px;
  background: #f8fbf8;
}

.reception-skip-field {
  align-self: center;
  min-height: 38px;
  padding: 9px 10px;
  border: 1px solid #e7eee9;
  border-radius: 6px;
  background: #fff;
}

.reception-progress-panel {
  border-top: 1px solid var(--line);
  padding: 10px 12px;
}

.reception-progress-panel .staff-progress {
  max-width: none;
  margin: 0;
  background: transparent;
}

.reception-card textarea {
  min-height: 40px;
  height: 40px;
  resize: vertical;
}

.reception-card .muted-cell > * {
  display: none;
}

.reception-card .muted-cell {
  display: none;
}

.reception-card .muted-cell::after {
  content: none;
}

.reception-confirmation-table {
  min-width: 1120px;
}

.reception-progress-row .staff-progress {
  max-width: none;
  margin: 0;
  background: transparent;
}

.reception-progress-row .consult-progress-track {
  flex: 1 1 auto;
}

.reception-table .muted-cell > * {
  display: none;
}

.reception-table .muted-cell::after {
  content: "-";
  color: var(--muted);
  font-weight: 800;
}

.view,
.panel,
.schedule-type-section,
.schedule-table-wrap,
.table-wrap,
.detail-panel,
.table-panel {
  min-width: 0;
  max-width: 100%;
}

.schedule-table-wrap {
  overflow-x: hidden;
}

.schedule-table {
  width: 100%;
  min-width: 0;
}

.schedule-table th,
.schedule-table td {
  min-width: 0 !important;
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: break-word;
}

.schedule-table select,
.schedule-table input,
.schedule-table textarea,
.reception-card select,
.reception-card input,
.reception-card textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.marketing-reception-table,
.reception-confirmation-table {
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0 10px;
}

.marketing-reception-table thead,
.reception-confirmation-table thead {
  display: none;
}

.marketing-reception-table tbody,
.marketing-reception-table tr,
.marketing-reception-table td,
.reception-confirmation-table tbody,
.reception-confirmation-table tr,
.reception-confirmation-table td {
  display: block;
  width: 100%;
}

.marketing-reception-table tr,
.reception-confirmation-table tr {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  align-items: stretch;
}

.marketing-reception-table tr.patient-row-odd,
.reception-confirmation-table tr.patient-row-odd {
  background: #fffef3;
}

.marketing-reception-table td,
.reception-confirmation-table td {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  grid-column: span 2;
  align-content: start;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid #e6eee8;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72) !important;
}

.marketing-reception-table td::before,
.reception-confirmation-table td::before {
  content: attr(data-label);
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1.2;
}

.marketing-reception-table td[data-label="Lead"],
.marketing-reception-table td[data-label="Referral / Source"],
.marketing-reception-table td[data-label="Last Remarks"],
.reception-confirmation-table td[data-label="Patient"],
.reception-confirmation-table td[data-label="Visit"],
.reception-confirmation-table td[data-label="Appointment Remarks"] {
  grid-column: span 3;
}

.reception-confirmation-table td[data-label="Appointment Remarks"] {
  grid-column: span 4;
}

.marketing-reception-table td[data-label="Status"],
.reception-confirmation-table td[data-label="Status"],
.reception-confirmation-table td[data-label="Appointment Type"] {
  grid-column: span 3;
}

.marketing-reception-table td[data-label="Actions"],
.reception-confirmation-table td[data-label="Actions"] {
  display: flex;
  justify-content: flex-end;
  align-self: end;
  grid-column: span 2;
  min-height: 58px;
  border: 0;
  background: transparent !important;
  padding: 0;
}

.marketing-reception-table td[hidden],
.reception-confirmation-table td[hidden],
.reception-card-field[hidden] {
  display: none !important;
}

.marketing-reception-table .marketing-actions,
.reception-confirmation-table .compact-actions {
  width: 100%;
  justify-content: flex-end;
  align-items: flex-end;
}

.marketing-reception-table textarea,
.reception-confirmation-table textarea {
  min-height: 40px;
  height: 40px;
  resize: vertical;
}

@media (max-width: 1380px) {
  .reception-card-main {
    grid-template-columns: minmax(180px, 1.25fr) minmax(72px, .55fr) minmax(120px, .8fr) minmax(160px, 1fr) minmax(190px, 1.15fr) auto;
  }

  .reception-card-main > button {
    grid-column: auto;
  }

  .reception-card-fields {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .reception-wide-field,
  .reception-arrival-field {
    grid-column: span 3;
  }

  .reception-confirmation-table {
    min-width: 0;
  }
}

@media (max-width: 820px) {
  .marketing-reception-table tr,
  .reception-confirmation-table tr {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .marketing-reception-table td,
  .reception-confirmation-table td {
    grid-column: span 3;
  }

  .marketing-reception-table td[data-label="Lead"],
  .marketing-reception-table td[data-label="Referral / Source"],
  .marketing-reception-table td[data-label="Last Remarks"],
  .reception-confirmation-table td[data-label="Patient"],
  .reception-confirmation-table td[data-label="Visit"],
  .reception-confirmation-table td[data-label="Appointment Remarks"],
  .marketing-reception-table td[data-label="Actions"],
  .reception-confirmation-table td[data-label="Actions"] {
    grid-column: 1 / -1;
  }

  .reception-card-main,
  .reception-card-fields {
    grid-template-columns: 1fr;
  }

  .arrival-id-grid {
    grid-template-columns: 1fr;
  }

  .reception-card-main > button,
  .reception-wide-field,
  .reception-arrival-field {
    grid-column: auto;
  }
}

.schedule-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 210px;
}

.muted-note {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.mini-label {
  display: grid;
  gap: 4px;
  min-width: 170px;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}

.mini-label input {
  margin-top: 2px;
}

.consult-progress-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  max-width: 760px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.doctor-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: none;
  padding: 8px 10px;
  margin: 0;
  background: #f8fbf9;
}

.doctor-progress-break {
  width: 1px;
  height: 28px;
  background: var(--line);
}

.doctor-refer-label {
  font-size: 12px;
  white-space: nowrap;
}

.doctor-progress .consult-progress-track {
  flex: 1 1 560px;
  gap: 10px;
}

.consult-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.consult-progress-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.check-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
}

.check-label input {
  width: auto;
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.switch-label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  width: 42px;
  height: 22px;
  border-radius: 999px;
  background: #d8dfdc;
  border: 1px solid var(--line);
  transition: background 0.16s ease, border-color 0.16s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 4px rgba(32, 55, 47, 0.18);
  transition: transform 0.16s ease;
}

.switch-label input:checked + .switch-ui {
  background: #16845c;
  border-color: #16845c;
}

.switch-label input:checked + .switch-ui::after {
  transform: translateX(20px);
}

.consult-progress-track {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}

.consult-task-row {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f5;
  align-content: start;
}

.doctor-progress .consult-task-row {
  display: grid;
  align-items: center;
  min-width: 210px;
  padding: 6px 9px;
  border-color: #d8e1dc;
  background: #fff;
}

.doctor-progress .consult-task-pill {
  white-space: nowrap;
}

.doctor-referral-remarks {
  color: #51645c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
}

.doctor-progress .consult-task-row.pending .consult-task-pill::after,
.doctor-progress .consult-task-row.done .consult-task-pill::after {
  display: inline-flex;
}

.consult-task-row.pending {
  border-color: #e7c65b;
  background: #fff8da;
}

.consult-task-row.done {
  border-color: #81c79d;
  background: #eefaf2;
}

.consult-task-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.25;
}

.consult-task-pill input {
  width: auto;
  accent-color: #16845c;
}

.consult-task-row.pending .consult-task-pill::after,
.consult-task-row.done .consult-task-pill::after {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 6px;
  font-size: 9px;
  font-weight: 900;
}

.consult-task-row.pending .consult-task-pill::after {
  content: "PENDING";
  background: #ffeaa0;
  color: #745600;
}

.consult-task-row.done .consult-task-pill::after {
  content: "DONE";
  background: #c9f2d7;
  color: #17613b;
}

.task-status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.1;
}

.task-status-pill.pending {
  background: #fff3bf;
  color: #745600;
}

.task-status-pill.done {
  background: #c9f2d7;
  color: #17613b;
}

.consult-task-row select,
.consult-task-row input[data-consult-task-remarks],
.next-appointment-row input,
.next-appointment-row textarea {
  padding: 7px 8px;
  font-size: 12px;
}

.task-worklist-table textarea {
  min-width: 240px;
  min-height: 42px;
  height: 42px;
}

.visit-progress-detail {
  display: grid;
  gap: 10px;
}

.visit-progress-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.visit-progress-card > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.visit-progress-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.visit-progress-card li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.visit-progress-card small,
.visit-progress-card span {
  color: var(--muted);
}

.next-appointment-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(150px, 1fr);
  gap: 8px;
}

.next-appointment-row .full {
  grid-column: 1 / -1;
}

.schedule-item {
  width: 100%;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.schedule-item:hover {
  border-color: rgba(22, 127, 122, 0.45);
  background: #f7fbf9;
}

.schedule-item time {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 8px;
  background: var(--wash);
  color: #245b51;
  font-weight: 900;
}

.schedule-item strong,
.schedule-item span,
.schedule-item small {
  display: block;
}

.schedule-item span,
.schedule-item small {
  color: var(--muted);
}

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

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

.brand-settings {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.logo-preview {
  width: 108px;
  height: 108px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f0dc;
  color: #20372f;
  font-size: 48px;
  font-weight: 800;
}

.logo-preview img,
.brand-mark img,
.print-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.compact-actions {
  align-items: center;
  margin-top: 0;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 7px 10px;
}

.duplicate-patient-row {
  background: #fff8e8;
}

.duplicate-warning-pill {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid #e3b84c;
  border-radius: 999px;
  color: #7a5600;
  background: #fff1bf;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  line-height: 1.1;
}

.settings-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.settings-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.large-textarea {
  min-height: 160px;
}

.template-editor {
  min-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.storage-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.storage-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.storage-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.print-report-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.report-letterhead-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  color: var(--ink);
  white-space: nowrap;
}

.print-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #dce5df;
  border-radius: 8px;
  background: #f6f0dc;
  color: #20372f;
  font-size: 26px;
  font-weight: 800;
  flex: 0 0 auto;
}

.pdf-steps,
.followup-types {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.step-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 24px rgba(40, 61, 52, 0.05);
}

.step-card span,
.step-card small {
  color: var(--muted);
}

.step-card strong {
  font-size: 15px;
}

.step-card.active {
  border-color: rgba(22, 127, 122, 0.6);
  background: #f4fbf8;
  box-shadow: inset 0 0 0 1px rgba(22, 127, 122, 0.16);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.wide {
  grid-column: 1 / -1;
}

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

.bar-list,
.activity-list,
.followup-list,
.call-slots {
  display: grid;
  gap: 10px;
}

.followup-queue {
  display: grid;
  gap: 8px;
}

.followup-queue + .followup-queue {
  margin-top: 14px;
}

.followup-queue > small {
  color: var(--muted);
  line-height: 1.4;
}

.bar-row {
  display: block;
}

button.bar-row {
  width: 100%;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

button.bar-row:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 4px;
}

button.bar-row:hover .bar-label span {
  color: var(--teal);
}

button.bar-row:hover .bar-track {
  background: #e7f1ed;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

.bar-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--wash);
}

.bar-track div {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--gold));
}

.activity-item,
.followup-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  text-align: left;
}

.activity-item:hover,
.followup-card:hover,
.followup-card.selected {
  border-color: rgba(22, 127, 122, 0.45);
  background: #f7fbf9;
}

.followup-card.muted-followup {
  opacity: 0.72;
}

.clinical-counselling-panel {
  margin-top: 14px;
}

.split.clinic-manager-workspace-split {
  --clinic-manager-list-width: 400px;
  grid-template-columns: clamp(260px, var(--clinic-manager-list-width), max(260px, calc(100% - 420px))) 8px minmax(0, 1fr);
  gap: 10px;
}

.clinic-manager-workspace-split > * {
  min-width: 0;
}

.clinic-manager-patient-list .followup-card strong {
  font-size: 13px;
  line-height: 1.25;
}

.clinic-manager-patient-list .followup-card span {
  font-size: 12px;
  line-height: 1.3;
}

.clinic-manager-patient-list .followup-card small {
  font-size: 11px;
  line-height: 1.3;
}

.clinical-counselling-profile {
  margin-bottom: 12px;
}

.clinic-remarks-entry {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.clinic-history-remarks {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.clinic-history-remarks > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.clinic-history-remarks p {
  margin: 4px 0 0;
  white-space: pre-wrap;
}

.activity-item strong,
.activity-item span,
.activity-item small,
.followup-card strong,
.followup-card span,
.followup-card small {
  display: block;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(380px, 0.8fr);
  gap: 20px;
  align-items: start;
}

.patient-detail-split {
  --patient-list-width: 340px;
  grid-template-columns: minmax(260px, var(--patient-list-width)) 8px minmax(0, 1fr);
  gap: 10px;
}

.patient-detail-split .table-panel {
  min-width: 0;
}

.patient-detail-split .detail-panel {
  min-width: 0;
}

.lab-dashboard-split {
  --lab-list-width: 520px;
  grid-template-columns: minmax(360px, var(--lab-list-width)) 8px minmax(0, 1fr);
  gap: 10px;
}

.dietitian-dashboard-split {
  --dietitian-list-width: 620px;
  grid-template-columns: minmax(420px, var(--dietitian-list-width)) 8px minmax(0, 1fr);
  gap: 10px;
}

.lab-dashboard-split .table-panel,
.lab-dashboard-split .detail-panel,
.dietitian-dashboard-split .table-panel,
.dietitian-dashboard-split .detail-panel {
  min-width: 0;
}

.lab-dashboard-split.resizing .split-resizer::before,
.dietitian-dashboard-split.resizing .split-resizer::before {
  background: #2b6b5a;
}

.ivf-lab-cycle-form {
  display: grid;
  gap: 14px;
}

.lab-department-section {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.lab-department-section legend {
  padding: 0 6px;
  color: #25453b;
  font-weight: 900;
}

.patient-detail-split table {
  table-layout: fixed;
}

.patient-detail-split th:first-child,
.patient-detail-split td:first-child {
  width: 52%;
}

.patient-detail-split th:last-child,
.patient-detail-split td:last-child {
  width: 48%;
}

.patient-detail-split td strong,
.patient-detail-split td > span:not(.compact-status-pill) {
  overflow-wrap: anywhere;
}

.compact-status-pill {
  display: block;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #25453b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  white-space: normal;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.split-resizer {
  align-self: stretch;
  width: 8px;
  min-height: 560px;
  border-radius: 999px;
  cursor: col-resize;
  background: transparent;
  position: relative;
}

.split-resizer::before {
  content: "";
  position: absolute;
  inset: 18px 3px;
  border-radius: 999px;
  background: #d4ded9;
  transition: background 0.15s ease, width 0.15s ease;
}

.split-resizer:hover::before,
.patient-detail-split.resizing .split-resizer::before,
.clinic-manager-workspace-split.resizing .split-resizer::before {
  background: #2b6b5a;
}

body.patient-split-resizing {
  cursor: col-resize;
  user-select: none;
}

.table-panel,
.detail-panel {
  min-height: 560px;
}

.table-wrap {
  overflow: auto;
  max-height: 68vh;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact {
  max-height: 70vh;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8f4;
  color: #4f6258;
  text-align: left;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  vertical-align: top;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #f7fbf9;
}

td strong,
td span {
  display: block;
}

.detail-head {
  align-items: flex-start;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-detail-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.report-detail-head > div:first-child {
  justify-self: start;
}

.report-detail-head .compact-actions {
  justify-self: end;
}

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

.patient-detail-section {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.patient-detail-section h3 {
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: #20372f;
  font-size: 13px;
  text-transform: uppercase;
}

.dietitian-form {
  display: grid;
  gap: 16px;
}

.dietitian-patient-picker {
  min-width: 280px;
}

.dietitian-patient-picker input {
  min-width: 280px;
}

.diet-consultation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.diet-consultation-pill {
  border-radius: 999px;
}

.diet-consultation-pill.active {
  background: rgba(33, 92, 73, 0.14);
  border-color: rgba(33, 92, 73, 0.32);
  color: #1f5343;
}

.checkbox-line {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
  min-height: 44px;
}

.checkbox-line input {
  width: auto;
}

.hidden {
  display: none !important;
}

.queue-filter {
  align-items: end;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin: -2px 0 12px;
}

.queue-filter label {
  flex: 0 0 auto;
  margin: 0;
  min-width: 180px;
  width: auto;
}

.queue-filter input {
  width: 190px;
}

.segmented-control {
  align-items: center;
  background: #eef5f1;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
}

.segmented-control button {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: #426055;
  cursor: pointer;
  font-weight: 800;
  min-height: 36px;
  padding: 7px 13px;
}

.segmented-control button.active {
  background: #236653;
  color: #fff;
  box-shadow: 0 2px 8px rgba(35, 102, 83, 0.18);
}

.dietitian-worklist {
  display: grid;
  gap: 10px;
}

.dietitian-worklist-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.dietitian-worklist-card.selected {
  background: #f1f8f4;
  border-color: rgba(35, 102, 83, 0.34);
}

.dietitian-card-main {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.dietitian-card-main strong {
  display: block;
  color: #17251f;
}

.dietitian-card-main span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.dietitian-card-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(150px, 190px) minmax(220px, 1fr) auto;
}

.dietitian-card-controls label {
  margin: 0;
}

.diet-plan-table {
  min-width: 760px;
}

.dietitian-followup-panel {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.compact-heading h3 {
  margin: 0;
}

.compact-followup-list {
  margin-top: 10px;
}

.diet-plan-table th,
.diet-plan-table td {
  vertical-align: middle;
}

.diet-plan-table td textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
  overflow-y: hidden;
  max-height: none;
  line-height: 1.35;
}

.detail-diet-plan-table td,
.detail-diet-plan-table th {
  padding: 10px 12px;
}

.diet-footnote {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.detail-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.detail-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-grid strong {
  font-size: 13px;
  word-break: break-word;
}

.remarks-block {
  margin-top: 16px;
  padding: 14px;
  border-left: 4px solid var(--coral);
  background: #fff9f6;
  border-radius: 0 8px 8px 0;
}

.remarks-block h3 {
  margin-bottom: 8px;
}

.remarks-block p {
  color: #5d493f;
  line-height: 1.55;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.detail-list span,
.detail-list p {
  color: var(--muted);
  line-height: 1.45;
}

.usg-detail-list {
  gap: 12px;
}

.usg-detail-card {
  gap: 12px;
  background: #fff;
}

.usg-detail-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.usg-detail-card-head strong,
.usg-detail-card-head span {
  display: block;
}

.usg-detail-card-head em {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f6f1;
  color: #1e6e5f;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.usg-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.usg-detail-field,
.usg-detail-note {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fcfa;
}

.usg-detail-field span,
.usg-detail-note span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.usg-detail-field strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.usg-detail-notes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

.usg-detail-note p {
  margin: 0;
  color: var(--ink);
  white-space: normal;
  overflow-wrap: anywhere;
}

.usg-detail-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.usg-detail-table-wrap > strong {
  display: block;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f3faf7;
}

.usg-detail-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.usg-detail-table th,
.usg-detail-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.usg-detail-table th {
  background: #dcefd4;
  color: #20372f;
  font-size: 11px;
  text-transform: uppercase;
}

.folder-link {
  display: inline-block;
  margin-top: 14px;
  color: var(--teal);
  font-weight: 800;
}

.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}

.call-slot {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.call-slot h3 {
  margin-bottom: 12px;
}

.call-slot-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.call-slot-head h3 {
  margin-bottom: 0;
}

.followup-stop-call {
  align-self: end;
  padding: 10px 0;
}

.appointment-manager {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.appointment-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.appointment-add-details {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 8px 12px;
}

.appointment-add-details > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--green);
}

.appointment-add-details[open] > summary {
  margin-bottom: 10px;
}

.appointment-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.appointment-card textarea {
  min-height: 48px;
}

#usg-monitoring-form textarea {
  min-height: 96px;
}

.usg-paper-form {
  display: grid;
  gap: 14px;
}

.usg-paper-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef8;
  padding: 16px;
}

.usg-paper-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 12px;
}

.usg-paper-head strong,
.usg-paper-card h3,
.usg-paper-card h4 {
  color: var(--ink);
  font-weight: 900;
}

.usg-paper-head span,
.usg-paper-table-section .field-hint {
  color: var(--muted);
  font-weight: 700;
}

.usg-paper-patient-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px 14px;
}

.usg-paper-patient-grid label,
.usg-paper-block-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.usg-paper-blank {
  min-width: 130px;
  max-width: 100%;
  border: 0;
  border-bottom: 1px solid #22382f;
  border-radius: 0;
  background: #fff;
  padding: 4px 6px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
}

.usg-paper-blank:focus,
.usg-paper-area:focus {
  outline: 2px solid rgba(31, 111, 77, 0.2);
  border-color: var(--green);
}

.usg-paper-area {
  display: block;
  width: 100%;
  min-height: 64px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 8px;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  resize: vertical;
}

.usg-paper-advice h3 {
  margin: 0 0 12px;
  text-align: center;
}

.usg-paper-lines {
  display: grid;
  gap: 10px;
  margin: 0 0 14px 20px;
  padding: 0;
  line-height: 1.6;
}

.usg-paper-lines li {
  padding-left: 4px;
}

.usg-paper-lines .usg-paper-blank {
  width: min(260px, 100%);
}

.usg-paper-lines .usg-paper-area {
  min-height: 48px;
}

.usg-paper-table-section {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.usg-paper-table-section .schedule-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.usg-paper-table-section table input {
  min-width: 92px;
}

@media (max-width: 900px) {
  .usg-paper-patient-grid {
    grid-template-columns: 1fr;
  }

  .usg-paper-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

.pregnancy-status-select {
  border-width: 2px;
  font-weight: 700;
}

.pregnancy-status-pending {
  background: #fff6bf;
  border-color: #d5ad16;
  color: #6c5400;
}

.pregnancy-status-positive {
  background: #dff3e4;
  border-color: #2f8a4b;
  color: #1d6233;
}

.pregnancy-status-negative {
  background: #f9dddd;
  border-color: #c44747;
  color: #8b2525;
}

.pregnancy-status-missed {
  background: #ffe2b8;
  border-color: #c97913;
  color: #7b4300;
}

.read-only-section {
  opacity: 0.72;
}

.prescription-patient-picker {
  display: grid;
  grid-template-columns: minmax(260px, 460px) auto;
  align-items: end;
  gap: 8px;
}

.prescription-patient-picker label,
.rx-form label,
.rx-master-picker label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  min-width: 0;
}

.rx-workspace-grid {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rx-history-panel {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 10px;
}

.rx-history-list { display: grid; gap: 6px; }
.rx-history-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}
.rx-history-item span { color: var(--muted); font-size: 12px; }
.rx-history-item.active { border-color: var(--accent); background: #edf7f4; }

.rx-form { min-width: 0; }
.rx-form-head,
.rx-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.rx-form-head { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.rx-form-head h2 { margin: 2px 0 4px; }
.rx-form-section { padding: 16px 0; border-bottom: 1px solid var(--line); }
.rx-form-section h3 { margin: 0 0 10px; }
.rx-form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.rx-wide { grid-column: span 2; }
.rx-form textarea { min-height: 58px; resize: vertical; }
.rx-large-textarea { width: 100%; min-height: 82px; margin-top: 8px; }
.rx-vitals-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }

.rx-medicine-row { padding: 12px 0; border-top: 1px solid var(--line); }
.rx-medicine-row:first-child { border-top: 0; }
.rx-medicine-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rx-medicine-grid { display: grid; grid-template-columns: 0.55fr 1.5fr repeat(5, minmax(100px, 0.75fr)); gap: 8px; }
.rx-medicine-name { min-width: 180px; }
.rx-medicine-instructions { grid-column: span 3; }
.rx-master-picker { display: grid; grid-template-columns: minmax(220px, 500px) auto; align-items: end; gap: 8px; }
.rx-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 12px 0; background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--line); }
.prescription-print-root { display: none; }

@media (max-width: 1100px) {
  .rx-medicine-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rx-vitals-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .prescription-patient-picker,
  .rx-workspace-grid,
  .rx-form-grid,
  .rx-vitals-grid,
  .rx-medicine-grid,
  .rx-master-picker { grid-template-columns: 1fr; }
  .rx-history-panel { position: static; }
  .rx-wide,
  .rx-medicine-instructions { grid-column: auto; }
  .rx-form-head { flex-direction: column; }
}

@media print {
  @page { size: A4; margin: 0; }
  body.prescription-printing { margin: 0; background: #fff; }
  body.prescription-printing > *:not(#prescription-print-root) { display: none !important; }
  body.prescription-printing #prescription-print-root { display: block !important; }
  body.prescription-printing #report-modal { display: none !important; }

  .rx-print-sheet {
    position: relative;
    box-sizing: border-box;
    width: 210mm;
    min-height: 297mm;
    padding: 51mm 12mm 22mm;
    overflow: hidden;
    color: #111;
    background: #fff;
    font-family: Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.35;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .rx-letterhead-image {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 210mm;
    height: 297mm;
    object-fit: fill;
  }

  .rx-print-identity,
  .rx-print-body { position: relative; z-index: 1; }
  .rx-print-identity {
    display: grid;
    grid-template-columns: 2fr 0.55fr 1.8fr 0.55fr 1fr;
    gap: 4mm;
    min-height: 13mm;
    padding: 2mm 1mm 3mm;
    border-bottom: 0.25mm solid #777;
  }
  .rx-print-identity div { display: grid; gap: 1mm; min-width: 0; }
  .rx-print-identity span { font-size: 7.5pt; color: #555; text-transform: uppercase; }
  .rx-print-identity strong { overflow-wrap: anywhere; }
  .rx-print-body { display: grid; grid-template-columns: 54mm minmax(0, 1fr); gap: 6mm; padding-top: 4mm; }
  .rx-print-body aside { padding-right: 4mm; border-right: 0.25mm solid #aaa; }
  .rx-print-body section { margin: 0 0 4mm; break-inside: avoid; }
  .rx-print-body h3 { margin: 0 0 1.5mm; padding-bottom: 1mm; border-bottom: 0.2mm solid #aaa; font-size: 9pt; text-transform: uppercase; }
  .rx-print-body p { margin: 0 0 1.5mm; white-space: pre-wrap; }
  .rx-print-body ul { margin: 0; padding-left: 5mm; }
  .rx-symbol { margin: 0 0 3mm; font: italic 700 17pt Georgia, serif; }
  .rx-print-medicines { width: 100%; border-collapse: collapse; margin-bottom: 5mm; font-size: 8.5pt; }
  .rx-print-medicines th,
  .rx-print-medicines td { padding: 2mm 1.5mm; border-bottom: 0.2mm solid #bbb; vertical-align: top; text-align: left; }
  .rx-print-medicines th { font-size: 7.5pt; text-transform: uppercase; }
  .rx-print-medicines td span { display: block; margin-top: 1mm; color: #444; }
  .rx-signature-space { height: 25mm; margin-top: 8mm; border-bottom: 0.2mm solid #999; display: flex; align-items: end; justify-content: flex-end; }
  .rx-signature-space span { padding-bottom: 1mm; color: #777; font-size: 8pt; }
}

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

.patient-flow {
  display: grid;
  gap: 10px;
  max-height: 68vh;
  overflow: auto;
  padding-right: 4px;
}

.patient-flow details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.patient-flow summary {
  cursor: pointer;
  padding: 13px 14px;
  color: var(--ink);
  font-weight: 800;
}

.update-status-card {
  display: grid;
  grid-template-columns: 1fr minmax(220px, 280px);
  gap: 16px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbf9;
  padding: 14px;
}

.update-status-card span,
.update-status-card strong {
  display: block;
}

.update-status-card span {
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.update-status-card strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.patient-flow details .form-grid {
  padding: 0 14px 14px;
}

#patient-modal .patient-flow details .form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#patient-modal .address-field {
  grid-column: span 2;
}

#patient-modal .address-field textarea {
  min-height: 42px;
  height: 42px;
}

.form-grid.tight {
  gap: 10px;
}

.check-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px 12px;
}

.check-field legend {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  padding: 0 6px;
}

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

.check-option {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.check-option input {
  width: auto;
}

.full {
  grid-column: 1 / -1;
}

dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(18, 31, 26, 0.36);
}

.modal-form {
  padding: 20px;
  max-height: calc(100dvh - 32px);
  overflow: auto;
}

menu {
  margin: 18px 0 0;
  padding: 0;
  justify-content: flex-end;
}

.report-dialog {
  width: min(980px, calc(100vw - 24px));
  max-height: 92vh;
  overflow: auto;
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.split-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.split-toolbar h2 {
  margin: 0;
}

.split-toolbar span {
  color: var(--muted);
  font-size: 13px;
}

.pipeline-dialog {
  width: min(1080px, calc(100vw - 28px));
  max-height: 88vh;
  overflow: hidden;
}

.pipeline-dialog .modal-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 44px);
  overflow: hidden;
}

.pipeline-dialog .split-toolbar,
.pipeline-dialog .dashboard-modal-filters,
.pipeline-dialog .modal-pagination {
  flex: 0 0 auto;
}

.pipeline-dialog .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overflow-x: hidden;
}

.dashboard-modal-filters {
  margin-bottom: 14px;
}

.printable-report {
  box-sizing: border-box;
  width: min(794px, 100%);
  margin: 0 auto;
  padding: 34px;
  background: #fff;
  color: #1f2924;
}

.printable-report header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid #245b51;
}

.printable-report header h1 {
  font-size: 26px;
}

.printable-report header p {
  margin: 6px 0;
  color: var(--muted);
}

.printable-report .letter-intro {
  margin-bottom: 18px;
  line-height: 1.6;
}

.printable-report section {
  margin-bottom: 18px;
}

.printable-report h3 {
  margin-bottom: 8px;
  color: #245b51;
  font-size: 15px;
}

.printable-report th {
  position: static;
  width: 34%;
  background: #f5f8f4;
}

.printable-report td,
.printable-report th {
  border: 1px solid #dce5df;
  padding: 9px 10px;
}

.printable-report footer {
  margin-top: 28px;
}

.clinical-doc-template {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 1040px;
  overflow: visible;
  background: #fff;
  font-family: "Times New Roman", Georgia, "Sampurna Bengali", "Noto Serif Bengali", "Noto Sans Bengali", "Nirmala UI", "Bangla Sangam MN", "Kohinoor Bangla", serif;
  color: #111;
}

.printable-report .clinical-doc-template {
  margin: -34px;
}

.clinical-letterhead {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 6px;
}

.clinical-watermark {
  position: absolute;
  top: 330px;
  left: 50%;
  width: 290px;
  opacity: 0.08;
  transform: translateX(-50%);
  pointer-events: none;
}

.clinical-doc-body {
  position: relative;
  z-index: 1;
  padding: 0 34px 72px;
}

.clinical-date {
  margin: 0 0 8px;
  text-align: right;
}

.clinical-footer {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: auto;
  margin-top: auto;
}

.clinical-doc-template h1 {
  margin: 12px 0 14px;
  text-align: center;
  font-family: Arial, sans-serif;
  font-size: 18px;
  font-weight: 800;
  text-decoration: underline;
}

.clinical-doc-template h2 {
  margin: 14px 0 6px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  text-decoration: underline;
}

.clinical-ref,
.clinical-line,
.clinical-paragraph {
  margin: 7px 0;
  font-size: 14px;
  line-height: 1.35;
}

.clinical-subtitle {
  margin: 0 0 16px;
  font-size: 13px;
  font-weight: 700;
  color: #34554a;
}

.diet-report-subtitle {
  text-align: center;
}

.clinical-section {
  margin-bottom: 10px;
}

.clinical-section table {
  border-collapse: collapse;
  width: 100%;
  table-layout: fixed;
}

.diet-report-table col.diet-report-col-meal {
  width: 22%;
}

.diet-report-table col.diet-report-col-food {
  width: 46%;
}

.diet-report-table col.diet-report-col-instruction {
  width: 32%;
}

.clinical-section th,
.clinical-section td {
  border: 1px solid #111;
  padding: 6px 7px;
  font-size: 13px;
  line-height: 1.25;
  vertical-align: middle;
}

.clinical-section th {
  width: 28%;
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.clinical-section td {
  width: 22%;
}

.clinical-signoff {
  margin-top: 22px;
  font-size: 14px;
  line-height: 1.35;
}

.clinical-sign-space {
  width: 140px;
  border-bottom: 1px solid #202020;
  margin: 16px 0 10px;
}

.clinical-signoff img {
  display: block;
  width: 145px;
  height: auto;
  margin: 22px 0 2px;
}

.referral-letter-page {
  padding-top: 18px;
}

.referral-letter-body {
  font-size: 16px;
  line-height: 1.65;
}

.clinical-page-break {
  margin-top: 28px;
  border-top: 1px dashed #c8d7d0;
  padding-top: 28px;
}

.signature-space {
  display: block;
  height: 42px;
}

.empty {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.empty strong {
  overflow-wrap: anywhere;
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    padding: 14px 18px;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }

  .nav {
    grid-auto-flow: row;
    overflow-x: hidden;
  }

  .sidebar-note {
    display: none;
  }

  .filters,
  .kpi-grid,
  .schedule-kpis,
  .dashboard-grid,
  .admin-grid,
  .pdf-steps,
  .followup-types,
  .split {
    grid-template-columns: 1fr;
  }

  .split-resizer {
    display: none;
  }

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

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .topbar,
  .panel-heading,
  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .schedule-kpis,
  .detail-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-mode-row,
  .schedule-toolbar {
    justify-content: stretch;
  }

  .schedule-toolbar label {
    width: 100%;
  }

  .doctor-appointment-main {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .doctor-card-actions {
    justify-content: stretch;
    min-width: 0;
  }

  .doctor-card-actions button {
    flex: 1 1 140px;
  }

  .schedule-item {
    grid-template-columns: 1fr;
  }

  .schedule-item time {
    width: 92px;
  }

  #patient-modal .patient-flow details .form-grid {
    grid-template-columns: 1fr;
  }

  #patient-modal .address-field {
    grid-column: 1 / -1;
  }

  .update-status-card {
    grid-template-columns: 1fr;
  }

  .filters {
    padding: 12px;
  }

  h1 {
    font-size: 26px;
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 132px;
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    font-size: 15px;
    background: #f7faf7;
    max-width: 100%;
    overflow-x: clip;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 12px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 12px 28px rgba(24, 35, 31, 0.16);
    max-width: 100vw;
    overflow: hidden;
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .brand-logo {
    width: 58px;
    border-radius: 6px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand span {
    font-size: 12px;
  }

  .mobile-menu-toggle {
    width: 44px;
    height: 44px;
    display: inline-grid;
    align-self: center;
    place-items: center;
    gap: 4px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    display: block;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.18s ease, opacity 0.18s ease;
  }

  body.mobile-menu-open .mobile-menu-toggle span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  body.mobile-menu-open .mobile-menu-toggle span:nth-child(2) {
    opacity: 0;
  }

  body.mobile-menu-open .mobile-menu-toggle span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .nav {
    grid-column: 1 / -1;
    display: none;
    gap: 8px;
    min-width: 0;
    max-width: 100%;
    contain: inline-size;
    padding: 8px;
    overflow: visible;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.12);
  }

  body.mobile-menu-open .nav {
    display: grid;
    grid-template-columns: 1fr;
  }

  .nav::-webkit-scrollbar,
  .top-actions::-webkit-scrollbar,
  .dashboard-mode-row::-webkit-scrollbar {
    display: none;
  }

  .nav-button {
    width: 100%;
    min-height: 38px;
    padding: 11px 12px;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    white-space: normal;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.06);
  }

  .nav-button.active {
    background: #fff;
    color: #20372f;
    border-color: #fff;
  }

  .main {
    padding: 12px;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .marketing-history-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 12px;
  }

  .topbar-title {
    gap: 4px;
  }

  .crm-history-actions {
    order: -1;
  }

  .history-button {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 17px;
  }

  .top-actions {
    display: flex;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 0 0 4px;
    contain: inline-size;
    overflow-x: auto;
    overscroll-behavior-x: contain;
  }

  .top-actions > * {
    flex: 0 0 auto;
  }

  .user-chip {
    max-width: 190px;
    min-height: 38px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }

  .primary,
  .secondary,
  .icon-button,
  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .primary,
  .secondary {
    padding: 10px 13px;
  }

  .filters {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
  }

  .filters label:first-child,
  .filters button {
    grid-column: 1 / -1;
  }

  .panel,
  .kpi,
  .filters,
  dialog {
    box-shadow: 0 4px 16px rgba(40, 61, 52, 0.06);
  }

  .panel {
    border-radius: 8px;
  }

  .panel-heading,
  .detail-head,
  .report-toolbar {
    gap: 10px;
  }

  .panel-heading > *,
  .detail-head > *,
  .report-toolbar > * {
    min-width: 0;
  }

  .dashboard-mode-row {
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    padding: 0 0 4px;
    contain: inline-size;
    overflow-x: auto;
  }

  .dashboard-mode-row button {
    flex: 0 0 auto;
    border-radius: 999px;
  }

  .kpi-grid,
  .schedule-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 12px;
  }

  .kpi strong {
    font-size: 24px;
  }

  .dashboard-grid,
  .admin-grid,
  .pdf-steps,
  .followup-types,
  .form-grid,
  .form-grid.tight,
  .modal-form,
  .split,
  .patient-detail-split,
  .lab-dashboard-split {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .split-resizer {
    display: none;
  }

  .table-panel,
  .detail-panel {
    min-height: 0;
  }

  .table-wrap,
  .compact {
    max-height: none;
    overflow: visible;
    border: 0;
  }

  .patient-detail-split table,
  .lab-dashboard-split table,
  .table-wrap table,
  .schedule-table-wrap table {
    border-collapse: separate;
    border-spacing: 0 10px;
    font-size: 14px;
  }

  .patient-detail-split thead,
  .lab-dashboard-split thead,
  .table-wrap thead,
  .schedule-table-wrap thead {
    display: none;
  }

  .patient-detail-split tbody,
  .patient-detail-split tr,
  .patient-detail-split td,
  .lab-dashboard-split tbody,
  .lab-dashboard-split tr,
  .lab-dashboard-split td,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td,
  .schedule-table-wrap tbody,
  .schedule-table-wrap tr,
  .schedule-table-wrap td {
    display: block;
    width: 100%;
  }

  .patient-detail-split tr,
  .lab-dashboard-split tr,
  .table-wrap tr,
  .schedule-table-wrap tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .patient-detail-split td,
  .lab-dashboard-split td,
  .table-wrap td,
  .schedule-table-wrap td {
    display: grid;
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    background: transparent !important;
    min-width: 0 !important;
    white-space: normal !important;
  }

  .patient-detail-split td:last-child,
  .lab-dashboard-split td:last-child,
  .table-wrap td:last-child,
  .schedule-table-wrap td:last-child {
    border-bottom: 0;
  }

  .patient-detail-split td::before,
  .lab-dashboard-split td::before,
  .table-wrap td::before,
  .schedule-table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0;
  }

  .schedule-table,
  .reception-table,
  .reception-confirmation-table {
    min-width: 0;
  }

  .schedule-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .doctor-appointment-card,
  .reception-card,
  .activity-item,
  .followup-card,
  .schedule-item,
  .marketing-card {
    border-radius: 8px;
  }

  .doctor-appointment-main,
  .doctor-appointment-meta,
  .reception-card-main,
  .reception-card-fields,
  .marketing-followup-row,
  .schedule-item {
    grid-template-columns: 1fr;
  }

  .doctor-card-actions,
  .schedule-actions,
  .marketing-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    min-width: 0;
  }

  .doctor-card-actions button,
  .schedule-actions button,
  .marketing-actions button {
    width: 100%;
  }

  .doctor-progress .consult-progress-track,
  .reception-progress-panel .consult-progress-track,
  .reception-progress-row .consult-progress-track,
  .staff-progress .consult-progress-track {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .consult-task-row,
  .doctor-progress .consult-task-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .consult-task-pill {
    width: 100%;
    justify-content: flex-start;
  }

  .reception-wide-field,
  .reception-arrival-field {
    grid-column: auto;
  }

  .reception-card-main > button {
    grid-column: auto;
  }

  .monthly-calendar-heading,
  .monthly-calendar-toolbar {
    align-items: stretch;
  }

  .monthly-calendar-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    justify-content: stretch;
  }

  .monthly-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    overflow: visible;
    padding-bottom: 0;
    border: 1px solid var(--line);
    background: var(--line);
    scroll-snap-type: none;
  }

  .monthly-calendar-weekday {
    display: grid;
    min-height: 30px;
    place-items: center;
    padding: 4px 2px;
    font-size: 9px;
    line-height: 1.1;
  }

  .monthly-calendar-cell {
    min-width: 0;
    min-height: 86px;
    padding: 4px;
    border: 0;
    border-radius: 0;
    scroll-snap-align: none;
  }

  .monthly-calendar-cell.outside {
    min-height: 86px;
  }

  .calendar-cell-actions {
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
  }

  .month-day {
    font-size: 11px;
  }

  .monthly-calendar-cell textarea {
    min-height: 46px;
    padding: 2px;
    font-size: 10px;
    line-height: 1.2;
  }

  .monthly-calendar-cell:focus-within {
    z-index: 2;
    box-shadow: 0 0 0 2px rgba(18, 128, 108, 0.28);
  }

  .monthly-calendar-cell:focus-within .calendar-cell-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .calendar-cell-save,
  .calendar-cell-highlight {
    min-height: 26px;
    padding: 4px 5px;
    border-radius: 5px;
    font-size: 9px;
  }

  dialog {
    width: calc(100vw - 18px);
    max-width: none;
    max-height: calc(100dvh - 18px);
    padding: 14px;
    border-radius: 10px;
  }

  .report-dialog {
    width: calc(100vw - 10px);
  }

  menu {
    flex-direction: column;
    align-items: stretch;
    padding: 0;
  }

  menu button {
    width: 100%;
  }

  .app-footer {
    margin-top: 18px;
    padding-bottom: max(18px, env(safe-area-inset-bottom));
    font-size: 11px;
  }
}

@media (max-width: 420px) {
  .main {
    padding: 10px;
  }

  .filters,
  .kpi-grid,
  .schedule-kpis {
    grid-template-columns: 1fr;
  }

  .doctor-card-actions,
  .schedule-actions,
  .marketing-actions {
    grid-template-columns: 1fr;
  }

  .patient-detail-split td,
  .lab-dashboard-split td,
  .table-wrap td,
  .schedule-table-wrap td {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .monthly-calendar-cell {
    min-height: 78px;
  }
}

.monthly-calendar-heading {
  align-items: flex-end;
  gap: 16px;
}

.monthly-calendar-toolbar {
  margin: 0;
  justify-content: flex-end;
}

.monthly-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--border);
}

.monthly-calendar-weekday {
  padding: 10px;
  background: #dcefd3;
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.monthly-calendar-cell {
  min-height: 126px;
  padding: 10px;
  background: #fffef7;
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 6px;
}

.monthly-calendar-cell:nth-child(14n + 8),
.monthly-calendar-cell:nth-child(14n + 9),
.monthly-calendar-cell:nth-child(14n + 10),
.monthly-calendar-cell:nth-child(14n + 11),
.monthly-calendar-cell:nth-child(14n + 12),
.monthly-calendar-cell:nth-child(14n + 13),
.monthly-calendar-cell:nth-child(14n + 14) {
  background: #f6fbf3;
}

.monthly-calendar-cell.outside {
  background: #f0f2ee;
  color: #9aa49d;
  opacity: 0.72;
}

.monthly-calendar-cell.today {
  box-shadow: inset 0 0 0 2px var(--green);
}

.monthly-calendar-cell.highlighted {
  background: #fff7f7;
  color: #c5162e;
}

.month-day {
  font-weight: 900;
  text-align: right;
  color: var(--ink);
}

.monthly-calendar-cell.highlighted .month-day,
.monthly-calendar-cell.highlighted textarea,
.monthly-calendar-cell.highlighted .calendar-cell-text {
  color: #c5162e;
}

.monthly-calendar-cell textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  line-height: 1.35;
  padding: 4px;
}

.monthly-calendar-cell textarea:focus {
  outline: 2px solid rgba(18, 128, 108, 0.25);
  background: #fff;
}

.monthly-calendar-cell textarea:disabled {
  color: #8f9992;
  cursor: not-allowed;
}

.calendar-cell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.calendar-cell-save {
  min-height: 34px;
  padding: 7px 16px;
  border-radius: 7px;
  border: 1px solid #0a5f4f;
  background: #0a5f4f;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(10, 95, 79, 0.22);
  transition: filter 0.12s ease;
}

.calendar-cell-highlight {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid #c5162e;
  background: #fff;
  color: #c5162e;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: filter 0.12s ease, background 0.12s ease, color 0.12s ease;
}

.calendar-cell-highlight.active {
  background: #c5162e;
  color: #fff;
}

.monthly-calendar-cell:focus-within .calendar-cell-actions {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.calendar-cell-save:hover,
.calendar-cell-highlight:hover {
  filter: brightness(1.06);
}

.calendar-cell-text {
  white-space: pre-wrap;
  font-weight: 800;
  line-height: 1.35;
}

.calendar-cell-meta {
  display: none;
}

.monthly-calendar-todo-list {
  display: grid;
  gap: 8px;
}

.monthly-calendar-todo-item {
  display: grid;
  grid-template-columns: minmax(150px, 190px) 1fr;
  gap: 14px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.monthly-calendar-todo-item strong,
.monthly-calendar-todo-item span,
.monthly-calendar-todo-item p {
  margin: 0;
}

.monthly-calendar-todo-item span {
  display: block;
  color: var(--muted);
  font-weight: 700;
}

.monthly-calendar-todo-item p {
  white-space: pre-wrap;
  font-weight: 800;
  line-height: 1.35;
}

@media (max-width: 980px) {
  .monthly-calendar-grid {
    grid-template-columns: repeat(7, minmax(104px, 1fr));
  }

  .monthly-calendar-cell {
    min-height: 112px;
    padding: 8px;
  }

  .monthly-calendar-todo-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .monthly-calendar-heading,
  .monthly-calendar-toolbar {
    align-items: stretch;
  }

  .monthly-calendar-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    justify-content: stretch;
  }

  .monthly-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    overflow: visible;
    padding-bottom: 0;
    border: 1px solid var(--line);
    background: var(--line);
    scroll-snap-type: none;
  }

  .monthly-calendar-weekday {
    display: grid;
    min-height: 30px;
    place-items: center;
    padding: 4px 2px;
    font-size: 9px;
    line-height: 1.1;
  }

  .monthly-calendar-cell {
    min-width: 0;
    min-height: 86px;
    padding: 4px;
    border: 0;
    border-radius: 0;
    scroll-snap-align: none;
  }

  .monthly-calendar-cell.outside {
    min-height: 86px;
  }

  .calendar-cell-actions {
    gap: 2px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
  }

  .month-day {
    font-size: 11px;
  }

  .monthly-calendar-cell textarea {
    min-height: 46px;
    padding: 2px;
    font-size: 10px;
    line-height: 1.2;
  }

  .monthly-calendar-cell:focus-within {
    z-index: 2;
    box-shadow: 0 0 0 2px rgba(18, 128, 108, 0.28);
  }

  .monthly-calendar-cell:focus-within .calendar-cell-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .calendar-cell-save,
  .calendar-cell-highlight {
    min-height: 26px;
    padding: 4px 5px;
    border-radius: 5px;
    font-size: 9px;
  }
}

@media (max-width: 420px) {
  .monthly-calendar-cell {
    min-height: 78px;
  }

  .monthly-calendar-cell textarea {
    min-height: 40px;
    font-size: 9px;
  }
}

/* Final overflow guards: rows should wrap into new lines instead of creating sideways scroll. */
html,
body,
.app-shell,
.main,
.view,
.panel,
.table-panel,
.detail-panel,
.schedule-table-wrap,
.table-wrap,
.report-dialog,
.pipeline-dialog,
.monthly-calendar-grid {
  max-width: 100%;
  overflow-x: hidden;
}

.top-actions,
.dashboard-mode-row,
.schedule-toolbar,
.report-toolbar,
.button-row,
.compact-actions {
  flex-wrap: wrap;
  overflow-x: hidden;
}

.monthly-calendar-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .queue-filter {
    justify-content: flex-start;
  }

  .dietitian-card-main,
  .dietitian-card-controls {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .dietitian-card-main {
    display: grid;
  }
}

.content-studio-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.15fr) minmax(360px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.content-studio-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.content-kpi {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
  padding: 12px;
  min-height: 92px;
}

.content-kpi span,
.content-kpi small {
  display: block;
  color: var(--muted);
}

.content-kpi strong {
  display: block;
  margin: 4px 0;
  font-size: 1.7rem;
  line-height: 1;
}

.content-studio-commandbar {
  display: grid;
  grid-template-columns: minmax(260px, 1.3fr) minmax(160px, 0.7fr) minmax(180px, 0.8fr);
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
}

.content-studio-board,
.content-editor {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
}

.content-studio-toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.content-studio-toolbar .field {
  flex: 1;
}

.content-calendar-weekdays,
.content-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.content-calendar-weekdays {
  margin: 12px 0 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.78rem;
  text-align: center;
}

.content-calendar-cell {
  min-height: 96px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fffef7;
  padding: 8px;
  text-align: left;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.content-calendar-cell:hover,
.content-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(21, 91, 72, 0.08);
}

.content-calendar-cell.muted {
  opacity: 0.45;
  background: #f4f7f5;
}

.content-calendar-cell strong {
  font-size: 0.9rem;
}

.content-calendar-cell span,
.content-calendar-cell small {
  display: block;
  border-radius: 6px;
  padding: 3px 5px;
  background: #eef7f3;
  color: #184f40;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.content-calendar-cell span.warning { background: #fff3c4; color: #6b5600; }
.content-calendar-cell span.success { background: #dff6e9; color: #116044; }
.content-calendar-cell span.info { background: #e4f0ff; color: #204b7a; }

.content-card-list {
  margin-top: 16px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.content-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
}

.content-card.selected {
  border-color: var(--accent);
  background: #eef8f4;
}

.content-card strong {
  font-size: 0.95rem;
}

.content-card span,
.content-card small {
  color: var(--muted);
}

.content-card span,
.content-card small {
  grid-column: 1 / 2;
}

.content-status-pill {
  grid-row: 1 / span 3;
  grid-column: 2;
  align-self: start;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 5px 8px;
  font-style: normal;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
}

.content-status-pill.warning { background: #fff3c4; border-color: #efd17d; color: #6b5600; }
.content-status-pill.success { background: #dff6e9; border-color: #9ad8b6; color: #116044; }
.content-status-pill.info { background: #e4f0ff; border-color: #a9c8ec; color: #204b7a; }

.content-lanes {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.content-lane {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fbf9;
  padding: 10px;
  min-height: 190px;
}

.content-lane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.content-lane-head span {
  border-radius: 999px;
  background: #e6f3ed;
  color: var(--accent);
  font-weight: 800;
  padding: 2px 8px;
}

.content-lane-card {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
}

.content-lane-card:hover {
  border-color: var(--accent);
}

.content-lane-card.warning { background: #fff9df; border-color: #efd17d; }
.content-lane-card.success { background: #effaf4; border-color: #9ad8b6; }
.content-lane-card.info { background: #f0f6ff; border-color: #a9c8ec; }

.content-lane-card strong {
  font-size: 0.9rem;
}

.content-lane-card span,
.content-lane-card small {
  color: var(--muted);
  font-size: 0.78rem;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 8px;
}

.checkbox-pill {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 9px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  font-weight: 800;
}

.content-comment {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
}

.content-comment strong,
.content-comment span {
  display: block;
}

.content-comment span {
  color: var(--muted);
  font-size: 0.82rem;
}

.content-comment p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.authority-comment {
  border-color: #9ad8b6;
  background: #f2fbf6;
}

@media (max-width: 1100px) {
  .content-studio-layout {
    grid-template-columns: 1fr;
  }

  .content-studio-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .content-studio-kpis,
  .content-studio-commandbar,
  .content-lanes {
    grid-template-columns: 1fr;
  }

  .content-studio-toolbar {
    display: grid;
  }

  .content-calendar-cell {
    min-height: 74px;
    padding: 6px;
  }

  .content-calendar-cell span,
  .content-calendar-cell small {
    font-size: 0.66rem;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: #fff;
  }

  .app-shell,
  .report-toolbar {
    display: none;
  }

  #report-modal {
    display: block;
    position: static;
    width: auto;
    max-height: none;
    border: 0;
    padding: 0;
    box-shadow: none;
    overflow: visible;
  }

  #report-modal::backdrop {
    display: none;
  }

  #printable-report {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    box-shadow: none;
  }

  .clinical-doc-template {
    min-height: auto;
    overflow: visible;
  }

  .printable-report .clinical-doc-template {
    margin: 0;
  }

  .clinical-page-break {
    break-before: page;
    page-break-before: always;
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }
}

.handover-panel {
  margin-bottom: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
}

.handover-heading {
  align-items: flex-start;
  gap: 14px;
}

.handover-heading-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.handover-role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(22, 127, 122, 0.22);
  border-radius: 999px;
  background: #edf8f4;
  color: #0f6662 !important;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.handover-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(22, 127, 122, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: #0f6662;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.handover-toggle:hover {
  border-color: rgba(22, 127, 122, 0.48);
  background: #f4fbf8;
}

.handover-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #edf8f4;
  line-height: 1;
}

.handover-panel.is-collapsed {
  background: #ffffff;
}

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

.handover-card {
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.handover-card span,
.handover-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.handover-card strong {
  display: block;
  margin: 5px 0;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.handover-card.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.handover-card.danger {
  border-color: #f0a3a3;
  background: #fff5f5;
}

.handover-card.ok {
  border-color: #a7dfbd;
  background: #f1fbf5;
}

.handover-list {
  display: grid;
  gap: 8px;
}

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

.handover-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.handover-section.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.handover-section.danger {
  border-color: #f0a3a3;
  background: #fff5f5;
}

.handover-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.handover-row.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.handover-row.danger {
  border-color: #f0a3a3;
  background: #fff5f5;
}

.handover-row:hover {
  border-color: rgba(22, 127, 122, 0.38);
  background: #fbfefd;
}

.handover-row span,
.handover-row small,
.handover-more {
  color: var(--muted);
}

.handover-row strong,
.handover-row span,
.handover-row small {
  overflow-wrap: anywhere;
}

.handover-more {
  margin: 10px 0 0;
  font-size: 13px;
  font-weight: 800;
}

@media (max-width: 980px) {
  .handover-card-grid,
  .handover-section-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .handover-card-grid,
  .handover-section-grid,
  .handover-row {
    grid-template-columns: 1fr;
  }
}

.production-audit-panel {
  border-color: rgba(15, 102, 98, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f5fbf8 100%);
}

.production-audit-heading {
  align-items: flex-start;
}

.production-audit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.production-audit-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
}

.mini-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.mini-heading strong {
  color: var(--ink);
  font-size: 15px;
}

.mini-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.production-risk-list {
  display: grid;
  gap: 8px;
}

.production-risk-row {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.production-risk-row:hover {
  border-color: rgba(22, 127, 122, 0.38);
  background: #fbfefd;
}

.production-risk-row.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.production-risk-row.danger {
  border-color: #f0a3a3;
  background: #fff5f5;
}

.production-risk-row.ok {
  border-color: #a7dfbd;
  background: #f1fbf5;
}

.production-risk-row strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.production-risk-row span,
.production-risk-row small,
.production-audit-note {
  color: var(--muted);
}

.production-risk-row span {
  font-size: 12px;
  font-weight: 800;
}

.production-risk-row small {
  font-size: 12px;
  line-height: 1.35;
}

.production-risk-row strong,
.production-risk-row span,
.production-risk-row small {
  overflow-wrap: anywhere;
}

.production-audit-note {
  margin-top: 12px;
  text-align: left;
}

.handover-row em {
  display: inline-flex;
  width: fit-content;
  margin-top: 3px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(22, 127, 122, 0.09);
  color: var(--brand);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.notification-log-panel {
  border-color: rgba(15, 102, 98, 0.18);
}

.notification-log-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.notification-log-summary span {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.notification-log-summary .ok {
  border-color: #a7dfbd;
  background: #f1fbf5;
  color: #24723e;
}

.notification-log-summary .warn {
  border-color: #f2c94c;
  background: #fffaf0;
  color: #8a6a00;
}

.notification-log-summary .danger {
  border-color: #f0a3a3;
  background: #fff5f5;
  color: #a53636;
}

.notification-log-table td strong,
.notification-log-table td span {
  display: block;
}

.notification-log-table td span {
  color: var(--muted);
  font-size: 12px;
}

.notification-log-table .warn-row {
  background: #fffaf0;
}

.notification-log-table .danger-row {
  background: #fff5f5;
}

.task-sla-panel {
  border-color: rgba(15, 102, 98, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfa 100%);
}

.task-sla-heading {
  align-items: flex-end;
}

.task-sla-heading label {
  display: grid;
  gap: 5px;
  min-width: 190px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.task-sla-heading input {
  height: 42px;
}

.task-sla-grid {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.8fr;
  gap: 12px;
  margin-top: 14px;
}

.task-sla-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.task-sla-departments {
  display: grid;
  gap: 8px;
}

.task-sla-departments article,
.task-sla-staff-list div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-sla-departments article.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.task-sla-departments article.danger {
  border-color: #f0a3a3;
  background: #fff5f5;
}

.task-sla-departments article.ok {
  border-color: #a7dfbd;
  background: #f1fbf5;
}

.task-sla-departments strong,
.task-sla-staff-list strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
}

.task-sla-departments span,
.task-sla-departments small,
.task-sla-staff-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.task-sla-staff-list {
  display: grid;
  gap: 8px;
}

.patient-timeline-panel {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
}

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

.patient-timeline-summary article {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.patient-timeline-summary article.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.patient-timeline-summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.patient-timeline-summary strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.patient-milestone-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.patient-milestone-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.patient-milestone-grid article.done {
  border-color: #a7dfbd;
  background: #f1fbf5;
}

.patient-milestone-grid article.warn {
  border-color: #f2c94c;
  background: #fffaf0;
}

.patient-milestone-grid article.active {
  border-color: #9cc9ff;
  background: #f2f8ff;
}

.patient-milestone-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.patient-milestone-grid strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.patient-timeline-groups {
  display: grid;
  gap: 10px;
}

.patient-timeline-groups details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.patient-timeline-groups details:not([open]) {
  background: #fbfefd;
}

.patient-timeline-groups summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  background: #f4faf7;
}

.patient-timeline-groups summary::after {
  content: "Collapse";
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(22, 127, 122, 0.08);
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.patient-timeline-groups details:not([open]) summary::after {
  content: "Open";
}

.patient-timeline-groups summary::-webkit-details-marker {
  display: none;
}

.patient-timeline-groups summary strong {
  color: var(--ink);
  font-size: 15px;
}

.patient-timeline-groups summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.patient-timeline-list {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.patient-timeline-item {
  display: grid;
  grid-template-columns: 92px minmax(170px, 0.7fr) minmax(260px, 1.25fr) minmax(150px, 0.6fr);
  gap: 12px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfefd;
}

.patient-timeline-item.staff-update {
  background: #f8f8f6;
}

.patient-timeline-item div {
  min-width: 0;
}

.patient-timeline-item strong,
.patient-timeline-item span,
.patient-timeline-item p,
.patient-timeline-item small,
.patient-timeline-item time {
  overflow-wrap: anywhere;
}

.patient-timeline-item strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.patient-timeline-item span {
  display: inline-flex;
  margin-top: 4px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.patient-timeline-item p {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.patient-timeline-item small,
.patient-timeline-item time {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.patient-timeline-item time {
  color: var(--brand);
  font-weight: 900;
  text-align: left;
  white-space: nowrap;
}

.patient-timeline-item small {
  justify-self: start;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(22, 127, 122, 0.08);
  color: var(--brand);
  font-weight: 900;
}

@media (max-width: 1180px) {
  .marketing-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .management-date-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .management-date-toolbar .segmented-control,
  .management-date-summary {
    grid-column: 1 / -1;
  }

  .management-date-summary {
    justify-self: start;
  }

  .marketing-filter-bar .segmented-control {
    grid-column: 1 / -1;
  }

  .production-audit-grid {
    grid-template-columns: 1fr;
  }

  .task-sla-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .task-sla-heading {
    align-items: stretch;
  }

  .task-sla-heading label {
    min-width: 0;
    width: 100%;
  }

  .patient-timeline-summary,
  .patient-milestone-grid {
    grid-template-columns: 1fr 1fr;
  }

  .patient-timeline-item {
    grid-template-columns: 1fr;
  }

  .patient-timeline-item time {
    text-align: left;
  }
}

/* Modal scroll lock: keep one working scrollbar inside list modals, never two. */
dialog.pipeline-dialog[open] {
  display: flex;
  flex-direction: column;
  width: min(1080px, calc(100vw - 28px));
  height: min(88dvh, calc(100dvh - 28px));
  max-height: min(88dvh, calc(100dvh - 28px));
  overflow: hidden !important;
}

dialog.pipeline-dialog[open] .modal-form {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  max-height: none;
  overflow: hidden !important;
}

dialog.pipeline-dialog[open] .split-toolbar,
dialog.pipeline-dialog[open] .dashboard-modal-filters,
dialog.pipeline-dialog[open] .modal-pagination {
  flex: 0 0 auto;
}

dialog.pipeline-dialog[open] .table-wrap {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain;
}

dialog.pipeline-dialog[open] table {
  table-layout: fixed;
}

dialog.pipeline-dialog[open] th,
dialog.pipeline-dialog[open] td {
  overflow-wrap: anywhere;
}

.doctor-registry-request {
  border: 1px solid #efd17d;
  background: #fffbea;
  border-radius: 8px;
  padding: 12px;
}

.doctor-registry-request .inline-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.doctor-registry-request .inline-heading span {
  color: var(--muted);
  font-size: 0.9rem;
}

.visiting-doctor-registry .status-pill.pending {
  background: #fff3c4;
  border-color: #efd17d;
  color: #6b5600;
}

.save-state-button.is-saved,
button.is-saved {
  background: #1f6f55 !important;
  border-color: #1f6f55 !important;
  color: #fff !important;
}

.save-state-button.is-unsaved,
button.is-unsaved {
  background: #f4c542 !important;
  border-color: #d3a414 !important;
  color: #1e2b23 !important;
}

.save-state-button.is-saving,
button.is-saving {
  background: #d8ece6 !important;
  border-color: #8bc2b0 !important;
  color: #145b48 !important;
}

.department-edit-actions {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}

#pipeline-modal .schedule-table {
  min-width: 980px;
  table-layout: auto;
}

#pipeline-modal .schedule-table th:nth-child(7),
#pipeline-modal .schedule-table td:nth-child(7),
#pipeline-modal .schedule-table td[data-label="Contact"] {
  min-width: 150px;
  white-space: nowrap;
}

#pipeline-modal .schedule-table th:nth-child(8),
#pipeline-modal .schedule-table td:nth-child(8),
#pipeline-modal .schedule-table td[data-label="Action"] {
  min-width: 150px;
}

#pipeline-modal .compact-actions {
  align-items: stretch;
  gap: 8px;
}

#pipeline-modal .compact-actions .secondary.small {
  white-space: nowrap;
}

.clinic-manager-menu {
  margin-bottom: 14px;
}

.patient-detail-records,
.patient-remarks-shell,
.patient-update-tools {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0;
  overflow: hidden;
}

.patient-detail-records > summary,
.patient-remarks-shell > summary,
.patient-update-tools > summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  cursor: pointer;
  padding: 14px 16px;
  color: var(--ink);
  background: #f7faf8;
  border-bottom: 1px solid var(--line);
}

.patient-detail-records > summary span,
.patient-remarks-shell > summary span,
.patient-update-tools > summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.patient-detail-records > .patient-detail-section,
.patient-update-tools > .backdated-appointment-tool,
.patient-update-tools > .patient-remarks-shell {
  margin: 14px;
}

.patient-remarks-grid {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.patient-remarks-grid .patient-remarks-section {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #fbfcfb;
}

.patient-remark-compose textarea {
  min-height: 72px;
}

.patient-remark-list {
  gap: 8px;
}

.patient-remark-item {
  padding: 10px;
  border-radius: 8px;
  background: #fff;
}

.clinic-manager-treatment-tracker {
  background: #fbfdfc;
}

.clinic-manager-treatment-tracker fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  background: #fff;
}

.clinic-manager-treatment-tracker legend {
  padding: 0 6px;
  font-weight: 800;
  color: var(--green);
}

.clinic-tracker-glance {
  margin-bottom: 14px;
}

.clinic-cycle-history {
  margin-bottom: 12px;
}

.clinic-cycle-history article.warn {
  border-color: #d9a441;
  background: #fffaf0;
}

.clinic-followup-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(170px, 230px) minmax(200px, 280px) auto;
  gap: 12px;
  margin: 12px 0;
}

.clinic-counselling-latest {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 6px solid #c9d2ce;
  border-radius: 6px;
  background: #fff;
}

.clinic-counselling-latest.colour-green { border-left-color: #16803d; background: #eff9f2; }
.clinic-counselling-latest.colour-yellow { border-left-color: #b77900; background: #fffae8; }
.clinic-counselling-latest.colour-red { border-left-color: #d92d20; background: #fff4f3; }
.clinic-counselling-record > details { margin-top: 14px; }
.clinic-counselling-record > details > summary { cursor: pointer; }
.clinic-counselling-timeline { margin-top: 12px; }

.clinic-counselling-history-disclosure {
  border: 2px solid #24695c;
  border-radius: 7px;
  background: #f4fbf7;
  overflow: hidden;
}

.clinic-counselling-history-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 13px 15px;
  background: #dff2e8;
  color: #174f43;
  list-style-position: inside;
}

.clinic-counselling-history-disclosure > summary span {
  color: #44675e;
  font-size: 12px;
  font-weight: 800;
}

.clinic-counselling-history-disclosure[open] > summary { border-bottom: 1px solid #a9ccbc; }
.clinic-counselling-history-disclosure > .clinic-counselling-timeline { padding: 12px; margin: 0; }

.clinic-history-day {
  padding: 0;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: 6px;
  overflow: hidden;
}

.clinic-history-day > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 11px 13px;
  cursor: pointer;
}

.clinic-history-day > summary > span { display: grid; gap: 3px; }
.clinic-history-day > summary small { color: var(--muted); font-weight: 700; }
.clinic-history-day > summary em { color: var(--green); font-size: 12px; font-style: normal; font-weight: 800; }
.clinic-history-day[open] > summary { border-bottom: 1px solid var(--line); }
.clinic-history-day-content { display: grid; gap: 9px; padding: 12px 13px; }
.clinic-history-day-content > span { color: var(--muted); font-size: 12px; }
.clinic-history-day-content > p { margin: 0; }

.clinic-followup-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.clinic-followup-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.clinic-followup-kpi {
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.clinic-followup-kpi span,
.clinic-followup-kpi strong {
  display: block;
}

.clinic-followup-kpi span {
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.clinic-followup-kpi strong {
  margin-top: 4px;
  font-size: 25px;
}

.clinic-followup-kpi.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(21, 128, 116, 0.15);
}

.clinic-followup-kpi.tone-red,
.clinic-followup-row.colour-red,
.clinic-history-entry.colour-red { border-left: 5px solid #c94c4c; background: #fff4f3; }
.clinic-followup-kpi.tone-yellow,
.clinic-followup-row.colour-yellow,
.clinic-history-entry.colour-yellow { border-left: 5px solid #d2a21f; background: #fffae8; }
.clinic-followup-kpi.tone-green,
.clinic-followup-row.colour-green,
.clinic-history-entry.colour-green { border-left: 5px solid #31865a; background: #eff9f2; }
.clinic-followup-row.colour-white,
.clinic-history-entry.colour-white { border-left: 5px solid #c9d2ce; background: #fff; }

.followup-colour-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.followup-colour-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.followup-colour-legend i {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(20, 45, 38, 0.18);
  border-radius: 50%;
}

.followup-colour-legend .colour-white { background: #fff; }
.followup-colour-legend .colour-green { background: #64b181; }
.followup-colour-legend .colour-yellow { background: #e3bd45; }
.followup-colour-legend .colour-red { background: #d96a64; }

.followup-card.followup-colour-white { border-left: 5px solid #c9d2ce; }
.followup-card.followup-colour-green { border-left: 5px solid #31865a; background: #eff9f2; }
.followup-card.followup-colour-yellow { border-left: 5px solid #d2a21f; background: #fffae8; }
.followup-card.followup-colour-red { border-left: 5px solid #c94c4c; background: #fff4f3; }

.clinic-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.clinic-profile-grid > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8faf9;
}

.clinic-profile-grid span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.clinic-profile-grid strong { overflow-wrap: anywhere; }

.clinical-counselling-profile-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.clinical-counselling-profile-grid > div {
  align-self: start;
}

.clinical-counselling-address {
  grid-column: 1 / -1;
}

.clinical-counselling-address strong {
  font-weight: 700;
  line-height: 1.35;
}

.clinic-colour-field {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.clinic-colour-field legend { padding: 0 5px; color: var(--muted); font-size: 12px; font-weight: 800; }
.clinic-colour-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.clinic-colour-option { display: grid; grid-template-columns: auto 18px 1fr; align-items: center; gap: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.clinic-colour-swatch { width: 16px; height: 16px; border: 1px solid #aab5b0; border-radius: 3px; }
.clinic-colour-option.colour-white .clinic-colour-swatch { background: #fff; }
.clinic-colour-option.colour-red .clinic-colour-swatch { background: #c94c4c; }
.clinic-colour-option.colour-yellow .clinic-colour-swatch { background: #e1ba38; }
.clinic-colour-option.colour-green .clinic-colour-swatch { background: #31865a; }

.medical-history-panel {
  margin-top: 14px;
}

.medical-history-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 560px) auto;
  align-items: end;
  gap: 10px;
  margin: 12px 0 16px;
}

.medical-history-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.medical-history-subject-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f7f5;
}

.medical-history-subject-tabs[hidden] { display: none; }

.medical-history-subject-tabs button {
  min-height: 38px;
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.medical-history-subject-tabs button.active {
  background: var(--brand-dark);
  color: #fff;
}

.medical-history-patient-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.medical-history-patient-head h2 { margin: 2px 0 4px; }

.medical-history-section {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.medical-history-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  cursor: pointer;
  background: #edf7f4;
  color: var(--ink);
}

.medical-history-section > summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.medical-history-section > .medical-form-grid,
.medical-history-section > .medical-repeat-list,
.medical-history-section > .medical-pathology-grid,
.medical-history-section > .medical-field,
.medical-history-section > .medical-attachment,
.medical-history-section > button {
  margin: 14px;
}

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

.medical-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.medical-field > span,
.medical-attachment label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.medical-field-wide { grid-column: span 2; }
.medical-field textarea { min-height: 74px; resize: vertical; }

.medical-repeat-list { display: grid; gap: 10px; }
.medical-repeat-row { padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fafcfb; }
.medical-repeat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

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

.medical-test-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(130px, 0.65fr) minmax(160px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.medical-test-row strong { font-size: 12px; }
.medical-attachment { display: flex; align-items: end; gap: 10px; }
.medical-attachment label { display: grid; gap: 6px; }

.medical-history-savebar {
  position: sticky;
  bottom: 0;
  z-index: 4;
  display: flex;
  justify-content: flex-end;
  padding: 12px 0;
  background: rgba(251, 252, 249, 0.96);
  border-top: 1px solid var(--line);
}

@media (max-width: 900px) {
  .clinic-followup-toolbar,
  .clinic-colour-options { grid-template-columns: 1fr; }

  .medical-history-toolbar,
  .medical-form-grid,
  .medical-pathology-grid { grid-template-columns: 1fr; }

  .medical-field-wide { grid-column: auto; }
  .medical-test-row { grid-template-columns: 1fr; }
  .medical-history-patient-head { flex-direction: column; }
  .split.clinic-manager-workspace-split { grid-template-columns: 1fr; }
  .clinical-counselling-profile-grid { grid-template-columns: 1fr; }
  .clinical-counselling-address { grid-column: auto; }
  dialog.pipeline-dialog[open] {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
  }

  dialog.pipeline-dialog[open] .modal-form {
    padding: 12px;
  }

  dialog.pipeline-dialog[open] .table-wrap {
    border: 0;
    background: transparent;
  }
}

/* Keep clinic workspaces resizable above the mobile stacking breakpoint. */
@media (min-width: 901px) {
  .clinic-manager-workspace-split > .split-resizer { display: block; }
}

/* Stronger status colours only in the Clinic Manager follow-up dashboard. */
#clinic-followup-panel .clinic-followup-kpi.tone-red,
#clinic-followup-panel .clinic-followup-row.colour-red,
#clinic-followup-panel .clinic-history-entry.colour-red,
#clinic-followup-panel .clinic-colour-option.colour-red {
  background: #ffc9c5;
  border-left: 6px solid #d92d20;
  color: #172f27;
}
#clinic-followup-panel .followup-colour-legend .colour-red,
#clinic-followup-panel .clinic-colour-option.colour-red .clinic-colour-swatch { background: #d92d20; }
#clinic-followup-panel .clinic-followup-kpi.tone-yellow,
#clinic-followup-panel .clinic-followup-row.colour-yellow,
#clinic-followup-panel .clinic-history-entry.colour-yellow,
#clinic-followup-panel .clinic-colour-option.colour-yellow {
  background: #ffe68a;
  border-left: 6px solid #b77900;
  color: #172f27;
}
#clinic-followup-panel .followup-colour-legend .colour-yellow,
#clinic-followup-panel .clinic-colour-option.colour-yellow .clinic-colour-swatch { background: #b77900; }
#clinic-followup-panel .clinic-followup-kpi.tone-green,
#clinic-followup-panel .clinic-followup-row.colour-green,
#clinic-followup-panel .clinic-history-entry.colour-green,
#clinic-followup-panel .clinic-colour-option.colour-green {
  background: #b5edc4;
  border-left: 6px solid #16803d;
  color: #172f27;
}
#clinic-followup-panel .followup-colour-legend .colour-green,
#clinic-followup-panel .clinic-colour-option.colour-green .clinic-colour-swatch { background: #16803d; }
#clinic-followup-panel .clinic-followup-row.selected {
  outline: 2px solid #174f43;
  outline-offset: -2px;
}
#clinic-followup-panel .clinic-followup-kpi span,
#clinic-followup-panel .clinic-followup-row span,
#clinic-followup-panel .clinic-followup-row small { color: #29483c; }

.clinic-followup-all-months input { width: 20px; height: 20px; }

@media (min-width: 901px) {
  .clinic-followup-toolbar { align-items: end; }
}
/* Read-only live replacement for the legacy Patient Followup Tracksheet. */
.patient-tracksheet-panel {
  margin-bottom: 14px;
  padding: 0;
  overflow: hidden;
}

.patient-tracksheet-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #e9f3ef;
  color: #183a31;
  font-weight: 800;
  cursor: pointer;
}

.patient-tracksheet-toolbar {
  display: grid;
  grid-template-columns: 180px minmax(260px, 1fr) 220px 220px auto;
  gap: 10px;
  align-items: end;
  padding: 14px 16px;
  border-bottom: 1px solid #dce5e0;
}

.patient-tracksheet-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: #5b6c65;
  font-size: 12px;
  font-weight: 700;
}

.patient-tracksheet-wrap {
  max-height: 58vh;
  overflow: auto;
  border: 0;
}

.patient-tracksheet-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  font-size: 12px;
}

.patient-tracksheet-table th,
.patient-tracksheet-table td {
  min-width: 128px;
  max-width: 260px;
  padding: 8px 10px;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: top;
}

.patient-tracksheet-table th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #1e5f50;
  color: #fff;
}

.patient-tracksheet-table th:nth-child(2),
.patient-tracksheet-table td:nth-child(2) {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f7fbf9;
}

.patient-tracksheet-table th:nth-child(2) {
  z-index: 4;
  background: #184e42;
}

.patient-tracksheet-table th:nth-child(3),
.patient-tracksheet-table td:nth-child(3) {
  position: sticky;
  left: 128px;
  z-index: 2;
  background: #f7fbf9;
}

.patient-tracksheet-table th:nth-child(3) {
  z-index: 4;
  background: #184e42;
}

@media (max-width: 980px) {
  .patient-tracksheet-toolbar { grid-template-columns: 1fr 1fr; }
  .patient-tracksheet-toolbar label:nth-child(2) { grid-column: 1 / -1; }
}
