:root {
  color-scheme: light;
  --ink: #18231f;
  --muted: #756774;
  --line: #e5d7de;
  --paper: #fcf8fa;
  --panel: #ffffff;
  --sage: #7d2e49;
  --teal: #7d2e49;
  --coral: #7d2e49;
  --gold: #a66a7e;
  --wash: #faf0f5;
  --shadow: 0 18px 50px rgba(125, 46, 73, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  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, #fff9fc 0%, #faf0f5 50%, #f4fbfa 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-form {
  display: grid;
  gap: 14px;
}

.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: #4b1c2c;
  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;
}

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

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

.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;
  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(125, 46, 73, 0.22);
  border-radius: 999px;
  background: linear-gradient(135deg, #7d2e49, #7d2e49);
  color: #fff;
  box-shadow: 0 8px 20px rgba(125, 46, 73, 0.2);
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

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

.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: #7d2e49;
  background: #7d2e49;
  color: white;
  font-weight: 700;
}

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

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

.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(125, 46, 73, 0.12);
}

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.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(125, 46, 73, 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(125, 46, 73, 0.6);
  background: #fbf0f5;
  color: #7d2e49;
  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-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;
}

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

.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: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;
}

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

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

.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;
}

.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: 0 12px 12px;
}

.reception-card-field {
  display: grid;
  gap: 4px;
  align-content: start;
}

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

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

.reception-skip-field {
  align-self: center;
  min-height: 38px;
}

.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;
}

@media (max-width: 1380px) {
  .reception-card-main {
    grid-template-columns: minmax(180px, 1.3fr) minmax(72px, .5fr) minmax(120px, .75fr) minmax(160px, 1fr);
  }

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

  .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: 980px;
  }
}

@media (max-width: 820px) {
  .reception-card-main,
  .reception-card-fields {
    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);
}

.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: #7d2e49;
  border-color: #7d2e49;
}

.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: #7d2e49;
}

.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(125, 46, 73, 0.45);
  background: #f7fbf9;
}

.schedule-item time {
  display: grid;
  place-items: center;
  min-height: 44px;
  border-radius: 8px;
  background: var(--wash);
  color: #7d2e49;
  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;
}

.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(125, 46, 73, 0.6);
  background: #f4fbf8;
  box-shadow: inset 0 0 0 1px rgba(125, 46, 73, 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(125, 46, 73, 0.45);
  background: #f7fbf9;
}

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

.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;
}

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

.lab-dashboard-split.resizing .split-resizer::before {
  background: #7d2e49;
}

.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: #7d2e49;
  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: #7d2e49;
  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 {
  background: #7d2e49;
}

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(125, 46, 73, 0.14);
  border-color: rgba(125, 46, 73, 0.32);
  color: #1f5343;
}

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

.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: hidden;
}

.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;
}

.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;
}

.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));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

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

.modal-form {
  padding: 20px;
}

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 {
  max-height: 88vh;
  overflow: auto;
}

.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 #7d2e49;
}

.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: #7d2e49;
  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, 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: column;
    overflow-x: auto;
  }

  .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;
  }
}

.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(125, 46, 73, 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 #7d2e49;
  background: #7d2e49;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(125, 46, 73, 0.24);
  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 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;
  }
}
