:root {
  --ink: #25211f;
  --muted: #6c655f;
  --line: #dcd8d3;
  --panel: #ffffff;
  --bg: #f7f8f7;
  --accent: #0f766e;
  --accent-2: #b45309;
  --accent-3: #2c6f88;
  --danger: #b91c1c;
  --soft: #edf4f2;
  --shadow: 0 18px 42px rgba(35, 31, 28, .08);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; display: grid; grid-template-columns: 264px 1fr; }
.sidebar {
  background: #263532;
  color: #f6fbfa;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 8px;
  display: grid; place-items: center;
  background: #fff; color: var(--accent); font-weight: 800;
}
.brand-mark.image-logo { padding: 2px; overflow: hidden; }
.brand-mark.image-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand strong, .brand span { display: block; }
.brand span { color: #b9cbc7; font-size: 12px; margin-top: 3px; }
.nav-tabs { display: grid; gap: 8px; }
.nav-tab {
  border: 1px solid rgba(255,255,255,.12);
  background: transparent; color: #e6eeee;
  padding: 12px 14px; border-radius: 8px; text-align: left;
}
.nav-tab.active { background: #f6fbfa; color: #102522; }
.reception-nav-tab { position: relative; }
.nav-count { position: absolute; top: -6px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; display: inline-grid; place-items: center; border-radius: 999px; background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 900; box-shadow: 0 2px 8px rgba(24, 32, 30, .18); }
.tenant-card {
  margin-top: auto; border: 1px solid rgba(255,255,255,.14);
  padding: 14px; border-radius: 8px; background: rgba(255,255,255,.06);
}
.tenant-card strong, .tenant-card small { display: block; }
.tenant-card small { color: #c6d5d2; margin-top: 6px; line-height: 1.35; }
.main { padding: 22px; min-width: 0; }
.topbar, .section-head, .toolbar, .summary-grid, .agenda-layout, .record-layout { display: flex; }
.topbar { align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 21px; }
h3 { font-size: 16px; margin-bottom: 12px; }
.eyebrow { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; font-weight: 700; margin-bottom: 5px; }
.toolbar { gap: 8px; align-items: center; flex-wrap: wrap; }
select, input, textarea {
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  padding: 10px 11px; min-width: 0; width: 100%;
}
textarea { min-height: 86px; resize: vertical; }
.hidden { display: none !important; }
.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  background: #fff7ed;
  color: var(--accent-2);
  white-space: nowrap;
}
.source-badge.api {
  background: var(--soft);
  color: var(--accent);
}
.source-badge.error {
  background: #fee2e2;
  color: var(--danger);
}
.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: #fbfdfc;
}
.icon-btn, .primary, .secondary {
  border-radius: 8px; border: 1px solid var(--line); min-height: 40px; padding: 0 13px;
  background: #fff; color: var(--ink);
}
.icon-btn { width: 42px; font-size: 22px; line-height: 1; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.secondary { background: #fff; color: var(--accent); font-weight: 700; }
.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric, .panel, .patient-card, .doc-card, .prenatal-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow);
}
.metric { padding: 15px; }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { font-size: 28px; margin-top: 5px; display: block; }
.metric.alert strong { color: var(--danger); }
.view { display: none; }
.view.active { display: block; }
.section-head { align-items: center; justify-content: space-between; gap: 14px; margin: 8px 0 14px; }
.section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.section-actions .search { min-width: min(320px, 100%); }
.agenda-main-actions { align-items: stretch; }
.action-new-appointment {
  min-width: 148px;
  background: #0f766e;
  box-shadow: 0 10px 22px rgba(15, 118, 110, .20);
}
.segmented { display: inline-grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.segmented button { border: 0; padding: 9px 14px; background: #fff; }
.segmented button.active { background: var(--soft); color: var(--accent); font-weight: 700; }
.agenda-toolbar {
  display: grid;
  grid-template-columns: auto minmax(180px, 240px) auto auto auto minmax(240px, 1fr);
  gap: 8px;
  align-items: end;
  margin-bottom: 12px;
}
.agenda-date-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.agenda-search-control { display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 8px; align-items: end; }
.agenda-search-control .search { width: 100%; max-width: none; }
.agenda-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.agenda-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}
.agenda-stats span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin-bottom: 3px;
}
.agenda-stats strong { display: block; font-size: 16px; line-height: 1.2; }
.agenda-layout { gap: 14px; align-items: flex-start; }
.schedule { flex: 1; display: grid; gap: 10px; }
.appointment-sidebar { width: 320px; display: grid; gap: 12px; }
.appointment-sidebar .panel.compact { width: 100%; }
.appointment-detail-card { border-color: #c9d9d4; background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%); }
.appointment-detail-body { display: grid; gap: 12px; }
.appointment-detail-patient { display: grid; gap: 4px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.appointment-detail-patient strong { font-size: 18px; line-height: 1.2; }
.appointment-detail-patient span { color: var(--muted); font-size: 12px; font-weight: 800; }
.appointment-detail-grid { display: grid; gap: 8px; }
.appointment-detail-grid div { display: grid; gap: 3px; }
.appointment-detail-grid span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
.appointment-detail-grid strong { font-size: 13px; line-height: 1.35; }
.appointment-detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding-top: 2px; }
.appointment-detail-actions button { min-height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 7px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 850; }
.appointment-detail-actions button:hover { border-color: var(--accent); background: var(--soft); color: var(--accent); }
.appointment-detail-actions button[data-appointment-action="record"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.appointment-detail-actions button[data-appointment-action="cancel"] { border-color: #fecaca; color: var(--danger); background: #fffafa; }
.agenda-search-summary { margin: 0; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1d4ed8; }
.month-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.month-weekday { padding: 9px 7px; background: #f1f6f4; color: var(--accent); font-size: 12px; font-weight: 900; text-align: center; }
.month-day { min-height: 122px; padding: 7px; background: #fff; display: grid; align-content: start; gap: 6px; }
.month-day.empty { background: #f9fbfa; }
.month-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.month-day-number { width: 30px; min-height: 28px; padding: 0; border: 0; border-radius: 7px; background: transparent; color: var(--ink); font-weight: 900; text-align: center; }
.month-day-number:hover { background: var(--soft); color: var(--accent); }
.month-day-appointments { display: grid; gap: 4px; }
.month-appointment { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px; align-items: baseline; width: 100%; border: 1px solid #cfe4de; border-left: 4px solid var(--accent); border-radius: 6px; padding: 5px; background: #f7fffb; color: var(--ink); font-size: 10px; text-align: left; overflow: hidden; }
.month-appointment strong { color: var(--accent); font-size: 10px; }
.month-appointment span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.month-appointment.pending { border-left-color: var(--accent-2); background: #fffaf1; }
.month-appointment.cancelled { border-left-color: var(--danger); background: #fffafa; }
.month-appointment.done { border-left-color: #166534; background: #f0fdf4; }
.month-appointment.missed { border-left-color: #7f1d1d; background: #fffafa; }
.month-appointment.room { border-left-color: var(--accent-3); background: #eff6ff; }
.year-calendar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.year-month { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.year-month-title { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 9px 10px; background: #f1f6f4; color: var(--accent); font-size: 13px; font-weight: 900; text-align: left; text-transform: capitalize; }
.year-month-title:hover { background: var(--soft); }
.year-weekdays, .year-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.year-weekdays { padding: 7px 7px 0; }
.year-weekdays span { color: var(--muted); font-size: 9px; font-weight: 900; text-align: center; }
.year-days { gap: 1px; padding: 7px; }
.year-day { position: relative; min-height: 28px; border: 0; border-radius: 5px; padding: 0; background: transparent; color: var(--ink); font-size: 11px; font-weight: 800; }
.year-day:hover { background: var(--soft); color: var(--accent); }
.year-day.empty { pointer-events: none; }
.year-day.today { outline: 2px solid var(--accent); outline-offset: -1px; }
.year-day.has-appointments { background: #e7f5ef; color: #0f5e4e; }
.year-day em { position: absolute; top: 1px; right: 1px; display: inline-grid; place-items: center; min-width: 12px; height: 12px; padding: 0 2px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 8px; font-style: normal; line-height: 1; }
.agenda-day-summary { display: grid; gap: 3px; padding: 12px 14px; border: 1px solid #cfe4de; border-radius: 8px; background: #f7fffb; color: var(--accent); }
.agenda-day-summary span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.agenda-day-summary strong { font-size: 16px; }
.week-calendar-scroll { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.week-calendar { display: grid; grid-template-columns: repeat(7, minmax(145px, 1fr)); min-width: 1015px; gap: 1px; }
.week-day { min-height: 300px; padding: 8px; background: #fff; display: grid; align-content: start; gap: 8px; }
.week-day.today { box-shadow: inset 0 0 0 2px var(--accent); }
.week-day-heading { display: grid; gap: 4px; width: 100%; border: 0; border-radius: 7px; padding: 8px; background: #f1f6f4; color: var(--accent); text-align: left; }
.week-day-heading span { font-size: 13px; font-weight: 900; text-transform: capitalize; }
.week-day-heading strong { color: var(--muted); font-size: 11px; }
.week-day-heading:hover { background: var(--soft); }
.week-day-appointments { display: grid; gap: 6px; }
.week-appointment { display: grid; gap: 3px; width: 100%; border: 1px solid #cfe4de; border-left: 4px solid var(--accent); border-radius: 7px; padding: 7px; background: #f7fffb; color: var(--ink); text-align: left; }
.week-appointment strong { color: var(--accent); font-size: 12px; }
.week-appointment span { font-size: 12px; font-weight: 900; line-height: 1.25; }
.week-appointment small { color: var(--muted); font-size: 10px; line-height: 1.25; }
.week-appointment.pending { border-left-color: var(--accent-2); background: #fffaf1; }
.week-appointment.cancelled { border-left-color: var(--danger); background: #fffafa; }
.week-appointment.done { border-left-color: #166534; background: #f0fdf4; }
.week-appointment.missed { border-left-color: #7f1d1d; background: #fffafa; }
.week-appointment.room { border-left-color: var(--accent-3); background: #eff6ff; }
.appointment {
  display: grid; grid-template-columns: 86px minmax(0, 1fr) auto minmax(250px, auto); gap: 12px; align-items: center;
  background: #fff; border: 1px solid var(--line); border-left: 5px solid var(--accent); border-radius: 8px; padding: 12px;
}
.appointment.pending { border-left-color: var(--accent-2); }
.appointment.cancelled { border-left-color: var(--danger); background: #fffafa; }
.appointment.done { border-left-color: #166534; }
.appointment.missed { border-left-color: #7f1d1d; }
.appointment.room { border-left-color: var(--accent-3); }
.appointment .time { display: grid; gap: 3px; font-weight: 800; color: var(--accent); }
.appointment .time span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.appointment-body { min-width: 0; display: grid; gap: 4px; }
.appointment-body p, .appointment-body small { color: var(--muted); line-height: 1.35; }
.appointment-body small { font-size: 12px; font-weight: 800; }
.appointment-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.appointment-actions button,
.patient-card-actions button,
.profile-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 34px;
  padding: 0 9px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}
.appointment-actions button:hover,
.patient-card-actions button:hover,
.profile-actions button:hover { border-color: var(--accent); background: var(--soft); color: var(--accent); }
.appointment-actions button[data-appointment-action="reschedule"] { border-color: #bfdbfe; color: #1d4ed8; background: #eff6ff; }
.appointment-actions button[data-appointment-action="confirm"],
.appointment-actions button[data-appointment-action="attended"] { border-color: #bbf7d0; color: #166534; background: #f0fdf4; }
.appointment-actions .danger-inline { color: var(--danger); border-color: #fecaca; background: #fffafa; }
.status { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--soft); color: var(--accent); }
.status.pending { background: #fff7ed; color: var(--accent-2); }
.status.cancelled { background: #fee2e2; color: var(--danger); }
.status.done { background: #dcfce7; color: #166534; }
.status.missed { background: #fee2e2; color: #7f1d1d; }
.status.room { background: #eff6ff; color: var(--accent-3); }
.panel { padding: 16px; }
.panel.compact { width: 320px; display: grid; gap: 10px; }
.form-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.form-title-row h3 { margin-bottom: 0; }
.mini-action { min-height: 32px; padding: 0 10px; font-size: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.patient-grid, .docs-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.patient-card, .doc-card { padding: 15px; display: grid; gap: 10px; }
.patient-card.selected, .doc-card.selected-doc { outline: 2px solid var(--accent); }
.patient-card h3, .doc-card h3 { margin: 0; }
.patient-card-actions, .profile-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.profile-actions { margin-top: 2px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; border-radius: 999px; padding: 5px 8px; background: #eef2ff; color: #3730a3; font-weight: 700; }
.tag.risk { background: #fee2e2; color: var(--danger); }
.tag.ok { background: var(--soft); color: var(--accent); }
.search { max-width: 320px; }
.record-layout { gap: 14px; align-items: flex-start; }
.patient-profile { width: 310px; display: grid; gap: 12px; }
.form-panel { flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.form-grid label:first-child, .form-grid label:nth-child(10), .form-grid label:nth-child(12) { grid-column: span 4; }
.prenatal-card { padding: 18px; }
.prenatal-header { display: flex; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--accent); padding-bottom: 12px; margin-bottom: 14px; }
.prenatal-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.prenatal-grid .wide { grid-column: span 2; }
.prenatal-actions .inline-control { min-width: 220px; }
.prenatal-card-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.prenatal-card-actions button { min-height: 42px; }
.prenatal-card-actions .dating-action { background: #0f766e; box-shadow: 0 8px 18px rgba(15, 118, 110, .18); }
.prenatal-tracking-card {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #c9d9d4;
  border-radius: 10px;
  background: #fff;
}
.prenatal-tracking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid #c9d9d4;
  background: linear-gradient(135deg, #f7faf8 0%, #edf5f1 100%);
}
.prenatal-tracking-header .eyebrow { margin-bottom: 2px; }
.prenatal-tracking-header h3 { margin: 0; color: var(--ink); font-size: 18px; }
.prenatal-tracking-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.prenatal-tracking-flags span {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  border: 1px solid #c9d9d4;
  border-radius: 999px;
  background: #fff;
  padding: 4px 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}
.prenatal-tracking-flags strong { color: var(--accent); }
.prenatal-tracking-table { padding: 0 12px 12px; }
.prenatal-tracking-table table { min-width: 640px; margin-top: 12px; }
.prenatal-tracking-table th { background: #f0f6f3; color: #1b6051; font-size: 11px; }
.prenatal-tracking-table td:last-child { min-width: 230px; line-height: 1.35; }
.prenatal-tracking-table .table-action { margin-top: 8px; }
.table-action {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--soft);
  color: var(--accent);
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}
.field { border: 1px solid var(--line); border-radius: 8px; padding: 10px; min-height: 64px; background: #fbfdfc; }
.field span { color: var(--muted); font-size: 12px; display: block; margin-bottom: 5px; }
.table-scroll { width: 100%; overflow-x: auto; }
.table-scroll table { min-width: 760px; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 13px; }
th, td { border: 1px solid var(--line); padding: 9px; text-align: left; vertical-align: top; }
th { background: var(--soft); color: var(--accent); }
.toast { position: fixed; right: 18px; bottom: 18px; background: #102522; color: #fff; padding: 12px 14px; border-radius: 8px; opacity: 0; transform: translateY(10px); transition: .2s ease; pointer-events: none; }
.toast.show { opacity: 1; transform: translateY(0); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 2; padding: 12px; }
  .nav-tabs { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .nav-tab { text-align: center; padding: 10px 6px; }
  .tenant-card { display: none; }
  .summary-grid, .patient-grid, .docs-grid, .agenda-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .agenda-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .agenda-toolbar .agenda-search-control { grid-column: 1 / -1; }
  .year-calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prenatal-card-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment { grid-template-columns: 78px minmax(0, 1fr); align-items: start; }
  .appointment-meta, .appointment-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .agenda-layout, .record-layout { flex-direction: column; }
  .month-day { min-height: 105px; }
  .appointment-sidebar, .panel.compact, .patient-profile { width: 100%; }
  .form-grid, .prenatal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid label:first-child, .form-grid label:nth-child(10), .form-grid label:nth-child(12) { grid-column: span 2; }
}
@media (max-width: 620px) {
  .main { padding: 14px; }
  .topbar, .section-head { align-items: stretch; flex-direction: column; }
  .toolbar { display: grid; grid-template-columns: 1fr; width: 100%; }
  .toolbar select, .toolbar button, .toolbar .source-badge { width: 100%; justify-content: center; }
  .section-actions { display: grid; grid-template-columns: 1fr; justify-content: stretch; }
  .section-actions .search, .section-actions button, .prenatal-actions .inline-control { width: 100%; max-width: none; }
  .summary-grid, .patient-grid, .docs-grid, .prenatal-grid, .agenda-stats, .agenda-toolbar { grid-template-columns: 1fr; }
  .agenda-search-control { grid-template-columns: 1fr; }
  .prenatal-card-actions { grid-template-columns: 1fr; }
  .appointment { grid-template-columns: 1fr; }
  .month-calendar { overflow-x: auto; grid-template-columns: repeat(7, minmax(116px, 1fr)); }
  .month-day { min-height: 108px; }
  .year-calendar { grid-template-columns: 1fr; }
  .appointment-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .appointment-actions button { width: 100%; }
  .patient-card-actions, .profile-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label:first-child, .form-grid label:nth-child(10), .form-grid label:nth-child(12) { grid-column: span 1; }
  .prenatal-grid .wide, .patient-form-grid .wide, .prenatal-form-grid .wide { grid-column: span 1; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .summary-grid, .section-head, .toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .view { display: none !important; }
  #view-prenatal { display: block !important; }
  body.printing-record #view-prenatal { display: none !important; }
  body.printing-record #view-expediente { display: block !important; }
  body.printing-record #view-expediente > .section-head { display: flex !important; }
body.printing-record .record-actions,
  body.printing-record .review-overview,
  body.printing-record .record-section-nav,
  body.printing-record .clinical-action-grid,
  body.printing-record .template-panel,
  body.printing-record .correction-panel { display: none !important; }
  body.printing-record .record-review-shell { display: block; }
  body.printing-record .patient-profile { position: static; width: 100%; margin-bottom: 12px; box-shadow: none; }
  body.printing-record .record-section, body.printing-record .record-alert { box-shadow: none; }
  .prenatal-card { box-shadow: none; border: 1px solid #222; }
  body.printing-document .shell,
  body.printing-document .document-modal,
  body.printing-document .toast,
  body.printing-document #view-prenatal,
  body.printing-document #view-expediente { display: none !important; }
  body.printing-document .print-document-area { display: block !important; }
  body.printing-document .generated-document { box-shadow: none; border: 1px solid #222; }
}

.permission-panel {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}
.permission-panel span {
  display: block;
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(255,255,255,.10);
  color: #d9e8e5;
  font-size: 12px;
  font-weight: 700;
}
.permission-panel span.denied {
  color: #ffd6d6;
}
button[disabled], input[disabled], select[disabled], textarea[disabled] {
  opacity: .62;
  cursor: not-allowed;
}
.template-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: #fbfdfc;
}
.template-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.template-panel-head select {
  max-width: 190px;
}
.template-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.template-btn {
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  display: grid;
  gap: 3px;
}
.template-btn strong {
  font-size: 13px;
}
.template-btn span {
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 980px) {
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .template-panel-head { align-items: stretch; flex-direction: column; }
  .template-panel-head select { max-width: none; }
  .template-grid { grid-template-columns: 1fr; }
}
.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
  gap: 14px;
  align-items: start;
}
.config-form .form-grid label:nth-child(2),
.config-form .form-grid label:nth-child(3),
.config-form .form-grid label:nth-child(5),
.config-form .form-grid label:nth-child(8),
.config-form .form-grid label:nth-child(9) {
  grid-column: span 2;
}
.doc-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.doc-preview-head {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-bottom: 4px solid var(--preview-primary);
}
.doc-logo {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--preview-primary);
  color: #fff;
  font-weight: 800;
}
.doc-preview h3 { margin: 0 0 4px; }
.doc-preview p { color: var(--muted); margin-top: 3px; }
.doc-preview-body { padding: 16px; display: grid; gap: 8px; }
.doc-signature {
  margin: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--preview-secondary);
  display: grid;
  gap: 3px;
  max-width: 280px;
}
.doc-signature span { font-weight: 800; }
.doc-signature small { color: var(--muted); }
.doc-preview footer {
  padding: 10px 16px;
  background: #f6f8f7;
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 980px) {
  .config-layout { grid-template-columns: 1fr; }
}

.record-review-shell {
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.record-main { display: grid; gap: 14px; min-width: 0; }
.patient-profile { position: sticky; top: 18px; width: auto; }
.profile-head { display: grid; gap: 8px; }
.profile-name { font-size: 18px; line-height: 1.2; }
.profile-meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.field span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 5px; }
.field strong { display: block; line-height: 1.35; }
.record-alerts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.record-alert {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 12px;
  min-height: 74px;
  box-shadow: var(--shadow);
}
.record-alert.risk { border-left-color: var(--danger); background: #fffafa; }
.record-alert.warn { border-left-color: var(--accent-2); background: #fffaf3; }
.record-alert span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.record-alert strong { font-size: 15px; line-height: 1.3; }
.record-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.record-section { min-width: 0; }
.record-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.record-section-head h3 { margin-bottom: 0; }
.clinical-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.clinical-grid .field.wide { grid-column: 1 / -1; }
.record-form-grid label:first-child,
.record-form-grid label:nth-child(10),
.record-form-grid label:nth-child(12) { grid-column: 1 / -1; }
.record-form-grid .clinical-note-field {
  display: grid;
  gap: 9px;
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 13px;
}
.clinical-field-title { font-size: 18px; font-weight: 900; line-height: 1.1; }
.record-form-grid .clinical-note-field input,
.record-form-grid .clinical-note-field textarea { background: #fff; color: var(--ink); font-size: 14px; font-weight: 650; }
.record-form-grid .exam-field { background: #f4fbfb; border-left-color: #0f766e; }
.record-form-grid .exam-field .clinical-field-title { color: #0b5d56; }
.record-form-grid .diagnosis-field { background: #f1faf6; border-color: #bde2d6; border-left-color: #187245; }
.record-form-grid .diagnosis-field .clinical-field-title { color: #176344; }
.record-form-grid .diagnosis-field input { border-color: #9fcfbe; color: #173f33; }
.record-form-grid .plan-field { background: #fffbea; border-color: #e8d58a; border-left-color: #29895d; }
.record-form-grid .plan-field .clinical-field-title { color: #187245; }
.record-form-grid .plan-field textarea { border-color: #b9d8c8; }
.timeline-list { display: grid; gap: 10px; }
.timeline-item {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  background: #fbfdfc;
}
.timeline-date { color: var(--muted); font-size: 12px; font-weight: 800; }
.timeline-item strong { display: block; margin-bottom: 4px; }
.timeline-item p { color: var(--muted); line-height: 1.4; }
.timeline-clinical-snapshot {
  display: grid;
  gap: 3px;
  margin: 9px 0;
  border-left: 3px solid #0f766e;
  padding: 8px 10px;
  background: #f2faf7;
  border-radius: 0 7px 7px 0;
}
.timeline-clinical-snapshot.menstrual { border-left-color: #7c3aed; background: #faf8ff; }
.timeline-clinical-snapshot span { color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; }
.timeline-clinical-snapshot strong { margin: 0; font-size: 12px; line-height: 1.4; }
.correction-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 14px; align-items: start; }
#reviewNotes { min-height: 142px; }
.review-checklist { display: grid; gap: 9px; }
.review-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfdfc;
}
.review-checklist input { width: auto; }
.review-status { color: var(--muted); font-size: 12px; font-weight: 800; padding: 4px 2px; }

@media (max-width: 980px) {
  .record-review-shell, .record-section-grid, .correction-grid { grid-template-columns: 1fr; }
  .patient-profile { position: static; width: 100%; }
  .record-alerts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .visit-vitals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .menstrual-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .nav-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record-alerts, .clinical-grid { grid-template-columns: 1fr; }
  .record-section-head { align-items: stretch; flex-direction: column; }
  .timeline-item { grid-template-columns: 1fr; }
  .section-head .secondary, .record-section-head .secondary { width: 100%; }
}
.record-titlebar { align-items: end; }
.record-actions {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  gap: 8px;
  align-items: end;
}
.record-clinical-actions { display: flex; gap: 8px; align-items: end; justify-content: flex-end; flex-wrap: wrap; }
.record-clinical-actions button { min-height: 38px; }
.inline-control { color: var(--muted); font-size: 12px; font-weight: 800; }
.subtle-action { color: var(--muted); }
.clinical-patient-banner {
  display: grid;
  grid-template-columns: minmax(230px, 1.1fr) minmax(140px, .5fr) minmax(290px, 1.25fr) auto;
  gap: 14px;
  align-items: center;
  margin: 0 0 14px;
  padding: 16px 18px;
  border: 1px solid #dce9e5;
  border-radius: 12px;
  background: linear-gradient(135deg, #fff 0%, #f6fbf9 100%);
  box-shadow: 0 12px 30px rgba(24, 59, 78, .06);
}
.clinical-patient-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.clinical-patient-avatar { display: grid; flex: 0 0 auto; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 900; }
.clinical-patient-identity h3 { margin: 2px 0 3px; font-size: 20px; line-height: 1.2; }
.clinical-patient-identity p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.clinical-patient-meta { display: grid; gap: 4px; padding-left: 14px; border-left: 1px solid #dce9e5; }
.clinical-patient-meta span { color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
.clinical-patient-meta strong { font-size: 14px; line-height: 1.35; }
.clinical-allergy-state { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 11px 12px; border: 1px solid #bde2d6; border-radius: 10px; background: #f1faf6; color: #176344; }
.clinical-allergy-state.pending { border-color: #f1d38b; background: #fffbeb; color: #9a6700; }
.clinical-allergy-state.risk { border-color: #f1b7b7; background: #fff5f5; color: #b42318; }
.clinical-alert-cluster { display: grid; gap: 8px; min-width: 0; }
.clinical-history-state.important { border-color: #bdccf0; background: #f4f7ff; color: #294f9b; }
.clinical-history-state.pending { border-color: #d8dde8; background: #f8fafc; color: #607084; }
.clinical-allergy-icon { display: grid; flex: 0 0 auto; place-items: center; width: 25px; height: 25px; border-radius: 999px; background: currentColor; color: #fff; font-weight: 900; }
.clinical-allergy-state strong, .clinical-allergy-state small { display: block; overflow-wrap: anywhere; }
.clinical-allergy-state strong { font-size: 13px; line-height: 1.25; }
.clinical-allergy-state small { margin-top: 2px; color: inherit; font-size: 11px; opacity: .85; }
.clinical-patient-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.clinical-patient-actions button { min-height: 34px; padding: 0 10px; border: 1px solid #b9d8ce; border-radius: 7px; background: #fff; color: var(--accent); font-size: 12px; font-weight: 900; white-space: nowrap; }
.clinical-patient-actions button:hover { background: var(--soft); border-color: var(--accent); }
.clinical-patient-actions button[disabled] { opacity: .56; cursor: not-allowed; }
body:not(.online-review-mode) #sectionReview,
body:not(.online-review-mode) #internalReviewBtn { display: none !important; }
body:not(.online-review-mode) #view-expediente .patient-profile { display: none; }
body:not(.online-review-mode) #view-expediente .record-review-shell { grid-template-columns: minmax(0, 1fr); }
.note-templates,
.note-advanced-fields { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 8px; background: #fbfdfc; }
.note-templates > summary,
.note-advanced-fields > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; padding: 0 13px; cursor: pointer; color: var(--ink); font-size: 13px; font-weight: 900; }
.note-templates > summary span,
.note-advanced-fields > summary span { color: var(--muted); font-size: 11px; font-weight: 800; }
.note-templates[open] > summary,
.note-advanced-fields[open] > summary { border-bottom: 1px solid var(--line); }
.note-templates .template-panel { margin: 12px; }
.note-specialty-fields { padding: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.encounter-clinical-card {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
  border: 1px solid #d8e8e3;
  border-radius: 12px;
  padding: 15px;
  background: linear-gradient(135deg, #ffffff 0%, #f7fbfa 100%);
  box-shadow: 0 8px 22px rgba(24, 59, 78, .05);
}
.encounter-vitals-card { border-left: 5px solid #0f766e; }
.menstrual-history-card { border-left: 5px solid #7c3aed; background: linear-gradient(135deg, #ffffff 0%, #faf8ff 100%); }
.encounter-card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.encounter-card-head h4 { margin: 2px 0 0; font-size: 18px; line-height: 1.2; }
.encounter-reference {
  max-width: 52%;
  border: 1px solid #dce9e5;
  border-radius: 999px;
  padding: 7px 11px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  text-align: right;
}
.encounter-card-help { margin: -3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.visit-vitals-grid,
.menstrual-history-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.menstrual-history-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.visit-vitals-grid label,
.menstrual-history-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 850; }
.record-form-grid .visit-vitals-grid label,
.record-form-grid .menstrual-history-grid label { grid-column: auto; }
.input-with-unit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px; }
.input-with-unit small { min-width: 33px; color: var(--muted); font-size: 10px; font-weight: 850; }
.calculated-output {
  display: flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  background: #f8faf9;
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}
.record-form-grid .reason-field { background: #f4fbfb; border-left-color: var(--accent); }
.record-form-grid .reason-field .clinical-field-title { color: var(--accent); }
.clinical-documents-panel { display: grid; gap: 12px; }
.clinical-action-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}
.clinical-action {
  --action-color: var(--accent);
  --action-bg: var(--soft);
  border: 1px solid var(--action-color);
  border-radius: 8px;
  background: var(--action-color);
  color: #fff;
  min-height: 104px;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 6px;
  align-content: start;
}
.clinical-action strong { font-size: 17px; line-height: 1.2; color: #fff; }
.clinical-action span { color: rgba(255,255,255,.90); font-size: 12px; font-weight: 800; line-height: 1.3; }
.clinical-action .action-code {
  width: 44px;
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  color: var(--action-color);
  font-size: 12px;
  font-weight: 900;
}
.clinical-action:hover { box-shadow: 0 12px 26px rgba(23, 33, 31, .18); transform: translateY(-1px); filter: saturate(1.08); }
.clinical-action[disabled] { opacity: .62; cursor: not-allowed; }
.action-prescription { --action-color: #0f766e; --action-bg: #e7f3f1; }
.action-request { --action-color: #2563eb; --action-bg: #eff6ff; }
.action-referral { --action-color: #7c3aed; --action-bg: #f5f3ff; }
.action-certificate { --action-color: #b45309; --action-bg: #fff7ed; }
.action-attachment { --action-color: #be185d; --action-bg: #fdf2f8; }
.action-ultrasound { --action-color: #0f766e; --action-bg: #ecfdf5; }
.docs-action-bar { margin-bottom: 14px; }
.record-doc-list { display: grid; gap: 8px; }
.record-doc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  color: var(--ink);
  padding: 10px;
  text-align: left;
  width: 100%;
}
.record-doc-summary {
  display: grid;
  grid-template-columns: minmax(160px, .42fr) minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.record-doc-row strong, .record-doc-row span { display: block; }
.record-doc-row span { color: var(--muted); font-size: 12px; font-weight: 800; margin-top: 3px; }
.record-doc-row p { color: var(--muted); line-height: 1.35; }
.record-doc-row:hover { border-color: var(--accent); background: var(--soft); }
.attachment-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 11px;
  border-radius: 6px;
  background: #0f766e;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}
.attachment-open-link:hover { background: #0b5f58; color: #fff; }
.attachment-pending { color: #9b5d00; font-size: 12px; font-weight: 800; }
.prenatal-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.prenatal-mini-grid .wide { grid-column: span 2; }
.doc-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}
.doc-card-head span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}
.doc-card {
  text-align: left;
  color: var(--ink);
}
.doc-card:hover {
  border-color: var(--accent);
  background: var(--soft);
}
.document-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 37, 34, .46);
}
.document-modal-panel {
  width: min(1180px, 100%);
  max-height: calc(100vh - 36px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(16, 37, 34, .28);
  overflow: hidden;
}
.document-modal-panel.compact-modal {
  width: min(920px, 100%);
}
.document-modal-head,
.document-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.document-modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.document-modal-body {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(360px, 1.1fr);
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  background: var(--bg);
}
.document-form,
.document-preview-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.document-form textarea { min-height: 110px; }
.attachment-picker { gap: 8px; }
.attachment-picker-control { position: relative; display: inline-flex; width: fit-content; }
.attachment-picker-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.attachment-picker-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid #be185d;
  border-radius: 6px;
  background: #fdf2f8;
  color: #9d174d;
  font-weight: 900;
}
.attachment-picker-control input:focus-visible + .attachment-picker-button { outline: 3px solid rgba(190, 24, 93, .25); outline-offset: 2px; }
.attachment-file-status { color: var(--muted); font-size: 12px; font-weight: 800; }
.attachment-file-status.ready { color: #0b6b45; }
.attachment-preview-action { display: flex; justify-content: flex-start; }
.modal-form {
  padding: 14px 16px;
  overflow: auto;
  background: var(--bg);
}
.auth-modal-panel { width: min(460px, 100%); }
.auth-form { display: grid; gap: 14px; }
.auth-form label { display: grid; gap: 6px; font-weight: 800; color: var(--ink); }
.password-field-row { display: flex; align-items: stretch; gap: 8px; }
.password-field-row input { min-width: 0; flex: 1; }
.password-toggle { width: auto; padding: 0 12px; white-space: nowrap; }
.form-status { min-height: 20px; margin: 0; color: var(--muted); font-size: 13px; font-weight: 700; }
body.clinical-auth-pending,
body.clinical-locked { background: #edf4ef; }
body.clinical-auth-pending .shell,
body.clinical-locked .shell { display: none; }
body.clinical-locked #authModal {
  display: grid !important;
  z-index: 90;
  padding: 24px;
  background: #edf4ef;
}
body.clinical-locked .auth-modal-panel {
  width: min(460px, 100%);
  max-height: none;
  border-color: #cfe1dc;
  box-shadow: 0 20px 54px rgba(23, 49, 42, .14);
}
body.clinical-locked #closeAuthModalBtn { display: none; }
.auth-modal-head { align-items: flex-start; }
.auth-gate-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.auth-gate-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}
.auth-gate-mark.image-logo { padding: 2px; background: #fff; border: 1px solid var(--line); }
.auth-gate-mark.image-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.auth-gate-subtitle { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
@media (max-width: 620px) {
  body.clinical-locked #authModal { padding: 16px; }
  body.clinical-locked .auth-modal-panel { border-radius: 8px; }
}
.setup-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #edf4ef; }
.setup-shell { width: min(520px, 100%); }
.setup-panel { display: grid; gap: 14px; padding: 28px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 20px 54px rgba(23, 49, 42, .14); }
.setup-panel h1 { margin: 0; font-size: 26px; }
.setup-panel > p { margin: 0; color: var(--muted); }
.setup-logo { width: 150px; height: auto; }
.setup-form { display: grid; gap: 12px; }
.setup-form label { display: grid; gap: 6px; font-weight: 800; }
.setup-hint { margin: 0; color: var(--muted); font-size: 13px; }
.patient-form-grid,
.prenatal-form-grid {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.patient-form-grid label:first-child,
.patient-form-grid label:nth-child(10),
.patient-form-grid label:nth-child(12),
.prenatal-form-grid label:first-child,
.prenatal-form-grid label:nth-child(10),
.prenatal-form-grid label:nth-child(12) {
  grid-column: auto;
}
.patient-form-grid .wide,
.prenatal-form-grid .wide { grid-column: 1 / -1; }
.patient-calculator-action { align-self: end; min-height: 42px; width: fit-content; }
.prenatal-clinical-summary,
.prenatal-followup-summary {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfdfc;
}
.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 14px;
}
.section-title-row h3,
.section-title-row p { margin: 0; }
.section-title-row small { color: var(--muted); max-width: 340px; text-align: right; }
.prenatal-summary-form-grid,
.prenatal-followup-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.prenatal-followup-grid article,
.dating-result-card {
  display: grid;
  gap: 5px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.prenatal-followup-grid span,
.dating-result-card span { color: var(--muted); font-size: 12px; font-weight: 800; }
.prenatal-followup-grid strong,
.dating-result-card strong { color: var(--ink); font-size: 14px; }
.dating-result-card small { color: var(--muted); line-height: 1.4; }
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 2px;
  color: var(--ink);
}
.check-field input { width: auto; }
.document-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.document-form-grid .wide { grid-column: 1 / -1; }
.document-patient-strip {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 11px;
}
.document-patient-strip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.document-specific-fields { display: grid; gap: 10px; }
.request-format-note {
  align-self: end;
  margin: 0;
  border: 1px solid #b8d7cf;
  border-radius: 7px;
  background: #eef8f5;
  padding: 10px;
  color: #14665a;
  font-size: 12px;
  font-weight: 800;
}
.laboratory-catalog {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfdfc;
  padding: 12px;
}
.laboratory-catalog-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.laboratory-catalog-head div { display: grid; gap: 3px; }
.laboratory-catalog-head span { color: var(--muted); font-size: 12px; }
.laboratory-catalog-head > span {
  border-radius: 999px;
  background: #e5f3ef;
  padding: 5px 9px;
  color: var(--accent-2);
  font-weight: 800;
  white-space: nowrap;
}
.laboratory-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.laboratory-group { margin: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px; }
.laboratory-group legend { padding: 0 6px; color: var(--accent-2); font-weight: 900; }
.laboratory-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 8px; }
.laboratory-options label { display: flex; flex-direction: row; align-items: flex-start; gap: 6px; min-width: 0; font-size: 12px; line-height: 1.25; }
.laboratory-options input { width: auto; margin-top: 2px; flex: 0 0 auto; }
.laboratory-options span { min-width: 0; }
.laboratory-other { display: grid; gap: 5px; }
.generated-doc-preview { min-width: 0; }
.generated-document {
  --document-primary: var(--accent);
  --document-secondary: var(--accent-2);
  display: grid;
  gap: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.generated-document header {
  display: flex;
  gap: 12px;
  border-bottom: 4px solid var(--document-primary);
  padding-bottom: 12px;
}
.generated-document .doc-logo:not(.image-logo) { background: var(--document-primary); }
.generated-document header h2 { margin: 0 0 4px; font-size: 20px; }
.generated-document header p,
.generated-document footer p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.generated-document-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: end;
}
.generated-document-title h3 { font-size: 22px; margin: 0; }
.generated-document-title div:last-child {
  display: grid;
  gap: 4px;
  text-align: right;
}
.generated-document-title strong { font-size: 14px; }
.generated-document-title span { color: var(--muted); font-size: 12px; font-weight: 800; }
.generated-patient {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.generated-patient.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.generated-patient div,
.generated-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}
.generated-patient span,
.generated-block span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.generated-patient strong,
.generated-block p {
  color: var(--ink);
  line-height: 1.42;
  white-space: pre-wrap;
}
.generated-document-referral { gap: 12px; }
.generated-document-referral .generated-document-title h3 { font-size: 24px; }
.referral-destination-card,
.referral-safety-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, .28fr);
  gap: 8px;
}
.referral-destination-card div,
.referral-safety-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}
.referral-destination-card { border-left: 4px solid #7c3aed; }
.referral-destination-card span,
.referral-safety-grid span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.referral-destination-card strong,
.referral-safety-grid strong { display: block; color: var(--ink); line-height: 1.38; white-space: pre-wrap; }
.referral-safety-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.referral-safety-grid div:first-child { border-left: 4px solid #b42318; background: #fffafa; }
.referral-safety-grid div:last-child { border-left: 4px solid #294f9b; background: #f5f7ff; }
.generated-document footer {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.generated-signature {
  max-width: 320px;
  padding-top: 22px;
  border-top: 1px solid var(--accent-2);
}
.generated-signature span,
.generated-signature small { display: block; }
.generated-signature span { font-weight: 800; }
.generated-signature small { color: var(--muted); margin-top: 3px; }
.generated-document-duplicate {
  display: grid;
  gap: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.generated-document-compact {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
.compact-document-copy {
  display: grid;
  grid-template-rows: auto auto auto 1fr auto auto;
  gap: 9px;
  min-height: 430px;
  padding: 16px;
  border: 1px solid #2d3a3a;
  border-radius: 0;
  background: #fff;
  color: #172222;
  box-shadow: var(--shadow);
}
.compact-document-header {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--document-primary);
}
.compact-doc-logo {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--document-primary);
  font-size: 12px;
  font-weight: 900;
}
.compact-doc-logo.image-logo, .doc-logo.image-logo { padding: 0; overflow: hidden; background: #fff; }
.compact-doc-logo.image-logo img, .doc-logo.image-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
.compact-clinic-meta { display: grid; gap: 1px; min-width: 0; }
.compact-clinic-meta strong { font-size: 14px; line-height: 1.15; }
.compact-clinic-meta span { font-size: 11px; font-weight: 800; }
.compact-clinic-meta small { color: var(--muted); font-size: 9px; line-height: 1.2; }
.compact-copy-label {
  align-self: start;
  padding: 4px 6px;
  border: 1px solid var(--accent-2);
  color: var(--accent-2);
  font-size: 9px;
  font-weight: 900;
  text-align: center;
}
.compact-document-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.compact-document-heading h3 { margin: 0; font-size: 17px; line-height: 1.2; }
.compact-document-heading span { color: var(--muted); font-size: 10px; font-weight: 900; white-space: nowrap; }
.compact-patient-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(60px, .45fr) minmax(78px, .7fr);
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.compact-patient-row div { min-width: 0; }
.compact-patient-row span,
.compact-document-field > span,
.compact-rest-row span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}
.compact-patient-row strong { display: block; font-size: 11px; line-height: 1.2; overflow-wrap: anywhere; }
.compact-document-content { display: grid; align-content: start; gap: 8px; }
.compact-document-field { padding-bottom: 7px; border-bottom: 1px solid #d7dfdf; }
.compact-document-field p { margin: 0; color: #172222; font-size: 11px; line-height: 1.32; white-space: pre-wrap; }
.compact-instructions p { font-size: 10px; }
.compact-rest-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #d7dfdf;
}
.compact-rest-row strong { display: block; font-size: 11px; }
.compact-signature-block {
  display: grid;
  width: min(48%, 310px);
  min-height: 104px;
  align-content: end;
  justify-self: end;
}
.compact-signature-space { min-height: 54px; }
.compact-signature-rule { border-top: 1px solid #172222; }
.compact-signature-block strong,
.compact-signature-block span,
.compact-signature-block small { display: block; }
.compact-signature-block strong { margin-top: 3px; font-size: 10px; }
.compact-signature-block span { margin-top: 2px; font-size: 10px; font-weight: 800; }
.compact-signature-block small { color: var(--muted); font-size: 9px; }
.compact-document-footer {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 5px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 8px;
  line-height: 1.2;
}
.compact-document-footer span:last-child { text-align: right; }
.clinical-note-item { align-items: start; }
.clinical-note-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clinical-note-version {
  border: 1px solid #b8d7cf;
  border-radius: 999px;
  padding: 2px 7px;
  color: #14665a;
  background: #eef8f5;
  font-size: 11px;
  font-weight: 800;
}
.clinical-note-meta { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.clinical-note-history { margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfdfc; padding: 8px 10px; }
.clinical-note-history summary { cursor: pointer; color: var(--accent-2); font-weight: 800; }
.clinical-note-history section { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.clinical-note-history section span,
.clinical-note-history section small { display: block; color: var(--muted); font-size: 11px; }
.clinical-note-history section p { margin: 4px 0; white-space: pre-wrap; }
.clinical-note-correct { margin-top: 9px; }
.correction-notice { margin: 0; border-left: 3px solid #1f7a6d; padding: 8px 10px; color: var(--muted); background: #eef8f5; font-size: 13px; line-height: 1.4; }
@media (max-width: 620px) {
  .compact-document-copy { min-height: 0; padding: 13px; }
  .compact-document-header { grid-template-columns: 32px minmax(0, 1fr); }
  .compact-doc-logo { width: 32px; height: 32px; }
  .compact-copy-label { grid-column: 1 / -1; justify-self: start; }
  .compact-patient-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .compact-signature-block { width: 70%; }
  .compact-document-footer { display: grid; }
  .compact-document-footer span:last-child { text-align: left; }
  .prenatal-tracking-header { align-items: flex-start; flex-direction: column; }
  .prenatal-tracking-flags { justify-content: flex-start; }
  .referral-destination-card,
  .referral-safety-grid { grid-template-columns: 1fr; }
  .laboratory-groups, .laboratory-options { grid-template-columns: 1fr; }
  .laboratory-catalog-head { align-items: stretch; flex-direction: column; }
  .laboratory-catalog-head > span { justify-self: start; }
}
.generated-document-prescription { gap: 18px; padding: 24px; }
.generated-document-prescription .generated-document-title h3 { font-size: 26px; }
.generated-document-prescription .generated-patient strong { font-size: 15px; }
.generated-document-prescription .generated-block { padding: 13px; }
.generated-document-prescription .prescription-treatment p,
.generated-document-prescription .prescription-instructions p { font-size: 18px; font-weight: 700; line-height: 1.5; }
.generated-document-prescription .prescription-notes p { font-size: 16px; font-weight: 700; }
@media print {
  @page { size: Letter portrait; margin: 0.32in; }
  body.printing-document .generated-document-duplicate { gap: 4mm; }
  body.printing-document .generated-document-compact { width: 100%; }
  body.printing-document .compact-document-copy {
    box-sizing: border-box;
    min-height: 126mm;
    height: 126mm;
    padding: 4mm 5mm;
    border-color: #222;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.printing-document .compact-document-header { padding-bottom: 2mm; }
  body.printing-document .compact-document-heading h3 { font-size: 13pt; }
  body.printing-document .compact-patient-row { padding: 1.5mm 0; }
  body.printing-document .compact-patient-row span,
  body.printing-document .compact-document-field > span,
  body.printing-document .compact-rest-row span { font-size: 7.5pt; }
  body.printing-document .compact-patient-row strong,
  body.printing-document .compact-document-field p,
  body.printing-document .compact-rest-row strong { font-size: 9.5pt; }
  body.printing-document .compact-document-content { gap: 1.8mm; }
  body.printing-document .compact-signature-block { min-height: 20mm; }
  body.printing-document .compact-signature-space { min-height: 11mm; }
  body.printing-document .compact-document-footer { font-size: 7pt; }
  body.printing-document .generated-document-referral { min-height: 247mm; box-sizing: border-box; }
}
.print-document-area { display: none; }
.review-overview { display: grid; gap: 8px; }
.internal-review-panel {
  padding: 0;
  overflow: hidden;
  box-shadow: none;
  background: #fbfdfc;
}
.internal-review-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.internal-review-summary::-webkit-details-marker { display: none; }
.internal-review-summary strong { display: block; line-height: 1.25; }
.internal-review-body {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 14px;
  background: #fff;
}
.internal-subpanel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 14px;
}
.online-review-guide {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(0, 1.2fr);
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f7fffb;
  padding: 12px;
}
.online-review-guide strong { display: block; margin-bottom: 4px; }
.online-review-guide p,
.online-review-guide li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.online-review-guide ol {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 18px;
}
body.online-review-mode .internal-review-panel {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}
body.online-review-mode .internal-review-summary {
  background: var(--soft);
}
.review-filter-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.review-filter-bar button {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 58px;
  padding: 8px;
  text-align: left;
}
.review-filter-bar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.review-filter-bar span { font-size: 11px; font-weight: 800; line-height: 1.2; }
.review-filter-bar strong { font-size: 18px; line-height: 1; }
.review-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfdfc;
  padding: 14px;
  font-weight: 800;
  text-align: center;
}
.meeting-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.meeting-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.meeting-head h4 { margin: 0; font-size: 16px; }
.meeting-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.meeting-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}
.meeting-actions button:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.meeting-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.meeting-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 9px;
}
.meeting-stats span { display: block; color: var(--muted); font-size: 11px; font-weight: 800; margin-bottom: 4px; }
.meeting-stats strong { display: block; font-size: 17px; }
.meeting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.meeting-grid section { border-top: 1px solid var(--line); padding-top: 9px; }
.meeting-grid strong { display: block; margin-bottom: 6px; }
.meeting-grid ul { display: grid; gap: 5px; padding-left: 18px; color: var(--muted); line-height: 1.35; }
.review-sessions {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}
.session-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.session-head h4 { margin: 0; font-size: 16px; }
.session-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.session-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}
.session-actions button:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.session-actions button:disabled { opacity: .45; cursor: not-allowed; }
.session-caption { color: var(--muted); font-size: 12px; font-weight: 800; }
.session-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.session-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 11px;
}
.session-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.session-card-head strong { line-height: 1.25; }
.session-card-head span { color: var(--muted); font-size: 12px; font-weight: 800; text-align: right; }
.session-mini-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.session-mini-stats span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  padding: 7px;
}
.session-mini-stats strong { display: block; color: var(--ink); font-size: 15px; }
.session-card ul { display: grid; gap: 5px; padding-left: 18px; color: var(--muted); line-height: 1.35; }
.review-findings {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.findings-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}
.findings-head h4 { margin: 0; font-size: 16px; }
.findings-head > span { color: var(--muted); font-size: 12px; font-weight: 800; }
.findings-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.finding-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px;
  text-align: left;
}
.finding-card.high { border-left-color: var(--danger); background: #fffafa; }
.finding-card.pending { border-left-color: var(--accent-2); background: #fffdf7; }
.finding-card.resolved { border-left-color: var(--accent); background: #f7fffb; }
.finding-card-head { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.finding-card-head strong { line-height: 1.25; }
.finding-card-head span, .finding-card small { color: var(--muted); font-size: 12px; font-weight: 800; }
.finding-card p { color: var(--muted); line-height: 1.35; }
.finding-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.finding-tags span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  background: #fbfdfc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.finding-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.finding-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}
.finding-actions button:last-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.finding-card.resolved .finding-actions button:last-child { background: #fff; border-color: var(--line); color: var(--ink); }
.findings-subhead {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding-top: 4px;
}
.review-queue {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.review-patient {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 74px;
  padding: 10px;
  text-align: left;
  display: grid;
  gap: 5px;
}
.review-patient.active { outline: 2px solid var(--accent); background: var(--soft); }
.review-patient strong { line-height: 1.25; }
.review-patient span { color: var(--muted); font-size: 12px; font-weight: 800; }
.review-patient.reviewed span { color: var(--accent); }
.review-patient.pending span { color: var(--accent-2); }
.validation-panel { display: grid; gap: 10px; }
.validation-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fbfdfc;
}
.clinical-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.clinical-check {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.clinical-check.ok { border-left-color: var(--accent); background: #f7fffb; }
.clinical-check.revisar { border-left-color: var(--danger); background: #fffafa; }
.clinical-check.pending { border-left-color: var(--accent-2); background: #fffdf7; }
.clinical-check strong { display: block; line-height: 1.25; }
.clinical-check p { color: var(--muted); font-size: 13px; line-height: 1.35; margin-top: 4px; }
.clinical-check-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.clinical-check-actions button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 34px;
  padding: 0 8px;
  font-weight: 800;
  font-size: 12px;
}
.clinical-check-actions button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (max-width: 980px) {
  .record-actions { grid-template-columns: 1fr; width: 100%; }
  .record-clinical-actions { justify-content: flex-start; }
  .clinical-patient-banner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clinical-patient-actions { justify-content: flex-start; }
  .note-specialty-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clinical-action-grid, .prenatal-mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .document-modal-body { grid-template-columns: 1fr; }
  .generated-patient { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .online-review-guide { grid-template-columns: 1fr; }
  .review-filter-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .review-queue, .clinical-checklist, .findings-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .record-actions, .clinical-action-grid, .record-doc-row, .record-doc-summary, .prenatal-mini-grid, .document-form-grid, .generated-patient, .generated-patient.compact, .review-queue, .clinical-checklist, .findings-list, .meeting-grid, .session-list { grid-template-columns: 1fr; }
  .record-clinical-actions, .clinical-patient-banner, .note-specialty-fields, .visit-vitals-grid, .menstrual-history-grid { display: grid; grid-template-columns: 1fr; }
  .encounter-card-head { align-items: stretch; flex-direction: column; }
  .encounter-reference { max-width: none; border-radius: 8px; text-align: left; }
  .record-clinical-actions button { width: 100%; }
  .clinical-patient-meta { padding-left: 0; padding-top: 10px; border-left: 0; border-top: 1px solid #dce9e5; }
  .clinical-patient-actions { display: grid; grid-template-columns: 1fr; }
  .clinical-patient-actions button { width: 100%; }
  .prenatal-mini-grid .wide { grid-column: span 1; }
  .document-modal { padding: 0; }
  .document-modal-panel { max-height: 100vh; border-radius: 0; }
  .document-modal-head, .document-modal-actions, .generated-document-title { align-items: stretch; flex-direction: column; }
  .document-modal-actions { display: grid; grid-template-columns: 1fr; }
  .generated-document-title div:last-child { text-align: left; }
  .generated-document header { flex-direction: column; }
  .meeting-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-filter-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .internal-review-summary, .findings-head, .meeting-head, .session-head { align-items: stretch; flex-direction: column; }
  .meeting-actions, .session-actions { display: grid; grid-template-columns: 1fr; }
  .record-titlebar { align-items: stretch; }
}
.record-section-nav {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(246, 248, 247, .96);
}
.record-section-nav button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
  font-weight: 800;
}
.record-section-nav button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.record-section-nav .record-save-inline {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  min-width: 126px;
}
.record-section-nav .record-save-inline.dirty {
  background: #b45309;
  border-color: #b45309;
}
.record-save-status {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fffb;
  color: var(--accent);
  white-space: nowrap;
  font-size: 12px;
  font-weight: 900;
}
.record-save-status.dirty {
  background: #fff7ed;
  color: #b45309;
  border-color: #fed7aa;
}
.correction-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
body.presentation-mode .sidebar,
body.presentation-mode .topbar,
body.presentation-mode .summary-grid { display: none !important; }
body.presentation-mode .shell { display: block; min-height: 100vh; }
body.presentation-mode .main { max-width: 1180px; margin: 0 auto; padding: 18px; }
body.presentation-mode .record-titlebar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--line);
}
body.presentation-mode .record-section-nav { top: 78px; }
body.presentation-mode .record-review-shell { grid-template-columns: minmax(240px, 300px) minmax(0, 1fr); }

@media (max-width: 620px) {
  .record-section-nav { top: 0; }
  .correction-actions { display: grid; grid-template-columns: 1fr; }
  body.presentation-mode .main { padding: 12px; }
  body.presentation-mode .record-titlebar { position: static; }
  body.presentation-mode .record-section-nav { top: 0; }
}
.feedback-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.feedback-toolbar .secondary { min-height: 34px; padding: 0 10px; }
.feedback-toolbar .danger-action { border-color: var(--danger); color: var(--danger); background: #fffafa; }
.hidden-file { display: none !important; }
.feedback-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}
.feedback-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
  padding: 10px;
}
.feedback-stat span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; margin-bottom: 4px; }
.feedback-stat strong { display: block; font-size: 18px; }
.review-checklist label.review-field {
  display: grid;
  align-items: stretch;
  color: var(--muted);
}
.review-checklist label.review-field input,
.review-checklist label.review-field select { width: 100%; }
.review-patient.priority-alta { border-color: var(--danger); }
.review-patient.priority-media { border-color: var(--accent-2); }
.review-patient.priority-baja { border-color: var(--accent); }
.review-patient.resolved { border-color: var(--accent); background: #f7fffb; }

@media (max-width: 980px) {
  .feedback-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .feedback-toolbar { justify-content: stretch; }
  .feedback-toolbar .secondary { flex: 1 1 160px; }
}
@media (max-width: 620px) {
  .feedback-summary { grid-template-columns: 1fr; }
  .feedback-toolbar { display: grid; grid-template-columns: 1fr; }
  .section-title-row { display: grid; }
  .section-title-row small { max-width: none; text-align: left; }
  .prenatal-summary-form-grid,
  .prenatal-followup-grid { grid-template-columns: 1fr; }
}

.form-status.privacy-ready { color: #176344; font-weight: 800; }
.attachment-save-guide,
.attachment-section-help { color: var(--muted); font-size: 12px; line-height: 1.45; }
.attachment-inline-preview { margin: 12px 0; display: grid; gap: 6px; }
.attachment-inline-preview img,
.attachment-upload-image img { display: block; width: 100%; max-height: 430px; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: #f6faf8; }
.attachment-inline-preview figcaption,
.attachment-upload-image figcaption { color: var(--muted); font-size: 12px; font-weight: 800; }
.attachment-upload-preview { display: grid; gap: 14px; min-height: 380px; align-content: start; }
.attachment-upload-preview-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.attachment-upload-preview-head div { display: grid; gap: 3px; }
.attachment-upload-preview-head span,
.attachment-upload-preview-head small { color: var(--muted); font-size: 12px; font-weight: 800; }
.attachment-upload-empty,
.attachment-upload-pdf { min-height: 280px; display: grid; place-items: center; align-content: center; gap: 8px; border: 2px dashed #b7cec7; border-radius: 12px; background: #f7fbfa; text-align: center; color: var(--muted); }
.attachment-upload-empty span,
.attachment-upload-pdf span { color: #176344; font-size: 22px; font-weight: 950; }
.attachment-upload-description { margin: 0; padding: 10px 12px; border-radius: 8px; background: #f4f8f6; }
.record-image-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.record-image-card { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.record-image-preview { display: grid; place-items: center; min-height: 180px; overflow: hidden; border-radius: 9px; background: #eff5f2; text-decoration: none; }
.record-image-preview img { width: 100%; height: 210px; object-fit: cover; }
.record-image-preview.pdf-preview { align-content: center; gap: 7px; color: #176344; }
.record-image-preview.pdf-preview span { font-size: 28px; font-weight: 950; }
.record-image-info { display: grid; gap: 4px; }
.record-image-info span,
.record-image-info p { color: var(--muted); font-size: 12px; margin: 0; }
.record-image-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.record-image-actions a { display: inline-flex; align-items: center; text-decoration: none; }
.image-empty-state { display: grid; gap: 5px; grid-column: 1 / -1; }
.timeline-encounter-content { display: grid; gap: 10px; }
.timeline-encounter-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.timeline-encounter-head span { color: var(--muted); font-size: 11px; font-weight: 800; }
.timeline-note-block,
.timeline-event-block { display: grid; gap: 5px; padding: 10px 12px; border: 1px solid #dce9e5; border-radius: 9px; background: #fbfdfc; }
.timeline-note-block p,
.timeline-event-block p { margin: 0; }
@media (max-width: 980px) { .record-image-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .record-image-gallery { grid-template-columns: 1fr; } }
.agenda-cancelled-toggle { white-space: nowrap; }
.agenda-cancelled-toggle.active { border-color: #f1b7b7; background: #fff5f5; color: #b42318; }
.appointment-archive-note { display: grid; gap: 3px; padding: 10px 12px; border: 1px solid #f1b7b7; border-radius: 8px; background: #fff5f5; color: #8f1d18; }
.appointment-archive-note span { font-size: 12px; line-height: 1.35; }
.appointment-actions button[data-appointment-action="reactivate"],
.appointment-detail-actions button[data-appointment-action="reactivate"] { border-color: #86cbb5; background: #effaf6; color: #176344; }
.timeline-encounter { display: block; padding: 0; overflow: hidden; background: #fff; }
.timeline-encounter-summary { position: relative; display: grid; grid-template-columns: minmax(210px, .85fr) minmax(220px, 1.3fr) auto; gap: 12px; align-items: center; padding: 13px 44px 13px 14px; cursor: pointer; list-style: none; background: #f7fbf9; }
.timeline-encounter-summary::-webkit-details-marker { display: none; }
.timeline-encounter-summary::after { content: "+"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--accent); font-size: 22px; font-weight: 900; }
.timeline-encounter[open] .timeline-encounter-summary::after { content: "−"; }
.timeline-encounter[open] .timeline-encounter-summary { border-bottom: 1px solid var(--line); }
.timeline-encounter-summary strong { margin: 0; color: var(--ink); }
.timeline-encounter-summary small { color: var(--muted); font-size: 11px; font-weight: 800; text-align: right; }
.timeline-encounter-date { color: #176344; font-size: 12px; font-weight: 900; text-transform: capitalize; }
.timeline-encounter .timeline-encounter-content { padding: 12px; }
@media (max-width: 760px) {
  .timeline-encounter-summary { grid-template-columns: 1fr; gap: 5px; }
  .timeline-encounter-summary small { text-align: left; }
}

.reception-mode-banner { margin-bottom: 14px; padding: 13px 15px; border: 1px solid #f2c97d; border-radius: 8px; background: #fff9e9; color: #7a4b08; font-weight: 700; line-height: 1.4; }
body[data-active-view="recepcion"] .main > .summary-grid { display: none; }
.reception-mode-banner.live { border-color: #9bd2bf; background: #edf9f4; color: #176344; }
.reception-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.reception-toolbar { display: flex; align-items: end; gap: 12px; margin-bottom: 14px; box-shadow: none; }
.reception-toolbar label { display: grid; gap: 5px; min-width: 210px; color: var(--muted); font-size: 12px; font-weight: 800; }
.reception-updated-at { margin-left: auto; padding-bottom: 10px; color: var(--muted); font-size: 12px; }
.reception-layout { display: grid; grid-template-columns: minmax(340px, .9fr) minmax(380px, 1.1fr); gap: 14px; align-items: start; }
.reception-list-panel, .reception-detail-panel { min-height: 430px; }
.reception-panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.reception-panel-head h3 { margin-bottom: 0; }
.reception-task-list { display: grid; gap: 9px; margin-top: 14px; }
.reception-task { width: 100%; display: grid; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-align: left; }
.reception-task:hover, .reception-task.selected { border-color: #77b8ae; background: #f2faf8; }
.reception-task-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.reception-task > span:not(.reception-task-head), .reception-task small { color: var(--muted); }
.reception-status { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 11px; font-weight: 900; white-space: nowrap; }
.reception-status.shadow { background: #fff4cf; color: #8a5600; }
.reception-status.pending_staff_review { background: #e6f4ff; color: #1d5e8c; }
.reception-status.approved, .reception-status.resolved { background: #e9f8f1; color: #176344; }
.reception-status.rejected, .reception-status.cancelled { background: #fff0f0; color: #9f1d1d; }
.reception-task-detail { display: grid; gap: 14px; }
.reception-detail-list { display: grid; gap: 0; margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.reception-detail-list div { display: grid; grid-template-columns: 135px 1fr; gap: 12px; padding: 11px 12px; border-bottom: 1px solid var(--line); }
.reception-detail-list div:last-child { border-bottom: 0; }
.reception-detail-list dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.reception-detail-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.reception-created, .reception-safety-note { color: var(--muted); font-size: 12px; line-height: 1.45; }
.reception-safety-note { padding: 10px 12px; border-radius: 8px; background: #fff9e9; color: #7a4b08; }
.reception-detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secondary.danger { border-color: #efb1b1; color: var(--danger); }

@media (max-width: 980px) {
  .reception-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reception-layout { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .reception-summary-grid { grid-template-columns: 1fr; }
  .reception-toolbar { align-items: stretch; flex-direction: column; }
  .reception-toolbar label { min-width: 0; }
  .reception-updated-at { margin-left: 0; padding-bottom: 0; }
  .reception-task-head, .reception-panel-head { flex-direction: column; }
  .reception-detail-list div { grid-template-columns: 1fr; gap: 4px; }
  .reception-detail-actions { display: grid; grid-template-columns: 1fr; }
}
