:root {
  --bg: #faf8f4;
  --surface: #fffdf9;
  --surface-2: #f3eee6;
  --ink: #263335;
  --muted: #657473;
  --line: #d8ddd7;
  --primary: #1e4d50;
  --primary-strong: #263335;
  --accent: #93aa9b;
  --accent-soft: #e8eee9;
  --aqua: #93aa9b;
  --violet: #c98272;
  --warn: #926334;
  --good: #5f7e6d;
  --danger: #a75d52;
  --sand: #eee7dc;
  --coral: #c98272;
  --shadow: none;
  --radius: 8px;
  font-family: "Manrope", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
}

body:not(.is-authenticated) {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  flex: 0 0 auto;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--sand);
}

.is-authenticated .login-screen {
  display: none;
}

body:not(.is-authenticated) .app-shell {
  display: none;
}

.login-card {
  display: grid;
  gap: 20px;
  width: min(440px, 100%);
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.login-logo {
  width: min(260px, 100%);
  height: auto;
}

.login-heading {
  display: grid;
  gap: 4px;
}

.login-heading h1 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0;
}

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

.login-form input {
  min-height: 44px;
  padding: 0 12px;
}

.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 183, 154, 0.16);
}

.login-submit {
  justify-content: center;
  width: 100%;
  min-height: 44px;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  color: var(--danger);
  background: #fff4f2;
  border: 1px solid #f0c7c0;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
}

.login-public-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 4px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.login-public-links a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.login-public-links a:hover,
.login-public-links a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 14px 12px;
  color: var(--ink);
  background: #ffffff;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-brand {
  align-items: center;
  min-height: 68px;
  padding: 6px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-logo {
  display: block;
  width: min(198px, 100%);
  height: auto;
}

.side-menu {
  display: grid;
  gap: 6px;
}

.side-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  color: #314954;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
}

.side-menu-item:hover,
.side-menu-item.active {
  color: var(--primary-strong);
  background: var(--accent-soft);
  border-color: #bfe8df;
}

.side-menu-item.logout {
  margin-top: 10px;
  color: #8a3c35;
}

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

.brand strong {
  display: block;
  line-height: 1.1;
  font-size: 17px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #effcf8;
  background: var(--primary);
  border-radius: var(--radius);
}

.brand-mark svg {
  width: 27px;
  height: 27px;
}

.nav-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  width: auto;
  padding: 0 12px;
  color: #334047;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: var(--primary-strong);
  background: var(--accent-soft);
  border-color: #bfe8df;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--muted);
  font-size: 13px;
}

.sidebar-patients {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.sidebar-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-section-title strong {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  color: var(--primary-strong);
  background: var(--accent-soft);
  border: 1px solid #bfe8df;
  border-radius: 999px;
}

.sidebar-patient-form {
  display: grid;
  gap: 9px;
  padding: 0;
}

.sidebar-patient-form label {
  color: #334047;
  font-size: 12px;
}

.sidebar-patient-form input,
.sidebar-patient-form select {
  min-height: 36px;
  color: var(--ink);
  background: #ffffff;
  border-color: var(--line);
}

.sidebar-patient-form input:focus,
.sidebar-patient-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 183, 154, 0.16);
}

.sidebar-patient-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.sidebar-patient-item {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 9px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.sidebar-patient-item:hover,
.sidebar-patient-item.active {
  background: var(--accent-soft);
  border-color: #bfe8df;
}

.sidebar-patient-item span {
  color: var(--muted);
  font-size: 12px;
}

.full-button {
  width: 100%;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #59c38d;
  box-shadow: 0 0 0 4px rgba(89, 195, 141, 0.15);
}

.main {
  min-width: 0;
  padding: 14px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "patients actions";
  align-items: start;
  gap: 12px 16px;
  margin-bottom: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.app-header {
  display: none;
}

.header-primary {
  grid-area: brand;
  display: grid;
  align-self: center;
  gap: 10px;
  min-width: 0;
}

.header-patients {
  grid-area: patients;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.header-patients .sidebar-section-title {
  justify-content: flex-start;
  color: #334047;
}

.header-patients .sidebar-section-title strong {
  color: var(--primary-strong);
  background: var(--accent-soft);
  border: 1px solid #cfe5dc;
}

.header-patient-form {
  grid-template-columns: minmax(180px, 1.4fr) minmax(135px, 0.7fr) minmax(130px, 0.65fr) minmax(160px, 0.9fr) max-content;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.header-patient-form label {
  min-width: 0;
  color: #334047;
  font-size: 12px;
}

.header-patient-form .primary-button {
  justify-self: end;
  white-space: nowrap;
}

.header-patient-form input,
.header-patient-form select {
  min-height: 34px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.header-patient-list {
  display: flex;
  gap: 8px;
  max-height: none;
  min-height: 40px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.header-patient-list .empty-state {
  min-width: 220px;
  padding: 10px;
  text-align: left;
}

.header-patient-list .sidebar-patient-item {
  min-width: 180px;
  max-width: 240px;
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line);
}

.header-patient-list .sidebar-patient-item span {
  color: var(--muted);
}

.header-patient-list .sidebar-patient-item:hover,
.header-patient-list .sidebar-patient-item.active {
  background: var(--accent-soft);
  border-color: #bfe8df;
}

.topbar h1,
.panel h2,
.form-section h3,
.template-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 22px;
  line-height: 1.1;
}

.topbar-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  grid-area: actions;
  align-self: start;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.topbar-actions .icon-button,
.topbar-actions .primary-button {
  flex: 0 0 auto;
}

.action-row.compact {
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-button,
.secondary-button,
.danger-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 700;
}

.primary-button {
  padding: 0 14px;
  color: #fff;
  background: var(--primary);
}

.primary-button:hover {
  background: var(--primary-strong);
}

.secondary-button {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: #b9b2a6;
}

.danger-button {
  padding: 0 14px;
  color: #fff;
  background: #b42318;
}

.danger-button:hover {
  background: #8f1d14;
}

.icon-button {
  width: 40px;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.patient-directory-panel {
  display: grid;
  gap: 14px;
}

.patient-page-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.4fr);
  gap: 14px;
  align-items: start;
}

.patient-page-grid--single {
  grid-template-columns: minmax(280px, 760px);
}

.patient-detail-panel {
  display: grid;
  gap: 14px;
}

.patient-page-toolbar {
  display: grid;
  gap: 10px;
}

.patient-directory-list {
  display: grid;
  gap: 6px;
}

.patient-directory-item {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 84px;
  padding: 11px 12px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid transparent;
  border-radius: 6px;
  text-align: left;
}

.patient-directory-item:nth-child(even) {
  background: #f7faf9;
}

.patient-directory-item:hover,
.patient-directory-item.active {
  background: var(--accent-soft);
  border-color: #bfe8df;
}

.patient-directory-item.active {
  border-left-color: var(--primary);
  box-shadow: inset 0 0 0 1px rgba(47, 183, 154, 0.08);
}

.patient-directory-avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 6px;
  color: var(--primary-strong);
  background: #e6f4f1;
  font-size: 12px;
  font-weight: 850;
}

.patient-directory-item.active .patient-directory-avatar {
  color: #ffffff;
  background: var(--primary);
}

.patient-directory-content {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.patient-directory-content > strong {
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-directory-details,
.patient-directory-contact {
  display: flex;
  min-width: 0;
  gap: 5px 12px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.35;
}

.patient-directory-details > span {
  min-width: 0;
}

.patient-directory-contact {
  color: #4f666c;
}

.patient-directory-contact-item {
  display: inline-flex;
  min-width: 0;
  gap: 5px;
  align-items: center;
}

.patient-directory-contact-item svg {
  width: 14px;
  height: 14px;
}

.patient-directory-contact-item.missing {
  color: #87959a;
}

.patient-directory-email {
  overflow-wrap: anywhere;
}

.patient-directory-chevron {
  width: 16px;
  height: 16px;
  color: #849398;
}

.patient-directory-item:hover .patient-directory-chevron,
.patient-directory-item.active .patient-directory-chevron {
  color: var(--primary);
}

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

.instrument-library-panel {
  display: grid;
  gap: 14px;
}

.instrument-library-list {
  display: grid;
  gap: 22px;
}

.instrument-library-group {
  display: grid;
  gap: 8px;
}

.instrument-library-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 7px;
  border-bottom: 1px solid var(--line);
}

.instrument-library-group-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.instrument-library-group-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.instrument-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 6px;
}

.instrument-library-card {
  display: grid;
  grid-template-columns: minmax(78px, 0.38fr) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fbfdfc;
  border: 1px solid var(--line);
  border-left: 3px solid #65bed3;
  border-radius: 6px;
}

.instrument-library-card.test {
  border-left-color: var(--accent);
}

.instrument-library-code {
  padding-right: 10px;
  color: var(--primary-strong);
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.instrument-library-name {
  display: block;
  min-width: 0;
  font-size: 13px;
  line-height: 1.35;
}

.questionnaire-library-panel {
  display: grid;
  gap: 0;
}

.questionnaire-library-body {
  padding: 16px;
}

.questionnaire-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(210px, 280px);
  gap: 10px;
  margin-bottom: 10px;
}

.questionnaire-search {
  width: 100%;
}

.questionnaire-filter-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.questionnaire-filter-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.questionnaire-filter-field select {
  min-width: 0;
}

.questionnaire-compliance-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  color: #4e5f64;
  background: #f4f8f8;
  border: 1px solid #d8e5e6;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
}

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

.questionnaire-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.questionnaire-card.is-available-internal {
  border-left-color: #25806f;
}

.questionnaire-card.is-external-only {
  background: #fbfcfc;
  border-left-color: #54818d;
}

.questionnaire-card.is-not-available {
  background: #fafafa;
  border-left-color: #a7b0b3;
}

.questionnaire-card.is-external-only .questionnaire-card-mark {
  background: #547782;
}

.questionnaire-card.is-not-available .questionnaire-card-mark {
  color: #435157;
  background: #e1e7e8;
}

.questionnaire-card.is-bai {
  border-left-color: #2f8d93;
}

.questionnaire-card.is-bdi {
  border-left-color: #65739a;
}

.questionnaire-card.is-bhs {
  border-left-color: #9b7c39;
}

.questionnaire-card.is-bsi {
  border-left-color: #a54b46;
}

.questionnaire-card.is-bai .questionnaire-card-mark {
  background: #2f7279;
}

.questionnaire-card.is-bdi .questionnaire-card-mark {
  background: #596789;
}

.questionnaire-card.is-bhs .questionnaire-card-mark {
  background: #80652e;
}

.questionnaire-card.is-bsi .questionnaire-card-mark {
  background: #8d3f3b;
}

.questionnaire-card-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: #ffffff;
  background: var(--primary);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 850;
}

.questionnaire-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 20px;
}

.questionnaire-card-content h3 {
  margin: 4px 0 7px;
  font-size: 16px;
  letter-spacing: 0;
}

.questionnaire-card-content p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.questionnaire-card-type {
  color: var(--primary-strong);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.questionnaire-card-meta {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.questionnaire-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  color: #52636a;
  background: #eef3f4;
  border: 1px solid #d6e0e2;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.questionnaire-status-badge.available {
  color: #176251;
  background: #e9f6f1;
  border-color: #bfe2d6;
}

.questionnaire-status-badge.external {
  color: #335e6a;
  background: #edf5f7;
  border-color: #cadfe4;
}

.questionnaire-card-source-link {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.questionnaire-card-source-link:hover {
  text-decoration: underline;
}

.questionnaire-card-actions {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 8px;
}

.questionnaire-card-actions > span {
  color: var(--muted);
  font-size: 11px;
}

.questionnaire-card-actions .primary-button {
  text-decoration: none;
  white-space: nowrap;
}

.questionnaire-card-actions svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.directory-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-heading {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.responsible-fields[hidden] {
  display: none;
}

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

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

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

.responsible-card-header h4 {
  margin: 0;
  font-size: 14px;
}

.patient-registration-actions {
  justify-content: flex-end;
}

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

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 88px;
  padding: 15px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(620px, 1.08fr) minmax(500px, 0.92fr);
  gap: 14px;
  align-items: start;
}

.queue-panel {
  display: none;
}

/* Tela principal simplificada: cabecalho, instrumentos e rascunho. */
#workspace .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
  max-width: 1480px;
  margin: 0 auto;
}

#workspace .metrics-grid,
#workspace .queue-panel,
#workspace .form-panel > .panel-header,
#caseForm > .form-section:not(.report-setup-section):not(.report-documents-section):not(.test-selector-section):not(.test-module) {
  display: none !important;
}

.header-nav {
  display: none;
}

#workspace .form-panel {
  max-height: none;
  overflow: visible;
}

#caseForm {
  gap: 12px;
}

#caseForm > .action-row {
  justify-content: flex-end;
  padding-top: 2px;
}

#checkCaseBtn {
  display: none;
}

#workspace .test-selector-section {
  padding-bottom: 12px;
}

#workspace .test-selector-section .section-heading p,
#workspace .test-module .section-heading p {
  display: none;
}

#workspace .test-selector-grid {
  max-height: none;
  overflow: visible;
}

#workspace .review-panel {
  min-height: min(860px, calc(100vh - 132px));
}

#workspace .workspace-grid > .review-panel {
  display: none;
}

.panel {
  min-width: 0;
  overflow: hidden;
}

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

.panel-header h2 {
  font-size: 18px;
}

.review-title-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-document-type-select {
  width: auto;
  min-width: 230px;
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
}

.review-section-select {
  flex: 0 1 260px;
  min-width: 220px;
  max-width: 320px;
  font-weight: 700;
}

.sticky-section {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.status-chip,
.pill,
.quality-score {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip {
  color: #fff;
  background: #59666b;
}

.status-chip.ready_for_ai,
.status-chip.ai_draft_generated,
.status-chip.in_review {
  background: var(--warn);
}

.status-chip.reviewed {
  background: var(--primary);
}

.status-chip.signed {
  background: var(--good);
}

.pill {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.pill.good {
  color: var(--good);
  background: #e8f5ed;
}

.pill.warn {
  color: var(--warn);
  background: #fff5dd;
}

.pill.muted {
  color: #576268;
}

.quality-score {
  color: var(--primary-strong);
  background: #e6f4ef;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px;
  padding: 0 10px;
  min-height: 40px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.case-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 294px);
  overflow: auto;
  padding: 0 14px 14px;
}

.case-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.case-item:hover,
.case-item.active {
  border-color: var(--primary);
  background: #f1fbf7;
}

.case-item strong {
  display: block;
  overflow-wrap: anywhere;
}

.case-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #e9e3d8;
}

.progress-bar {
  height: 100%;
  width: var(--value, 0%);
  background: var(--primary);
}

.form-panel {
  max-height: calc(100vh - 154px);
  overflow: auto;
}

form {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.form-section {
  display: grid;
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.form-section:last-of-type {
  border-bottom: 0;
}

.form-section h3 {
  font-size: 15px;
}

.report-setup-grid {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) max-content;
  gap: 10px;
  align-items: end;
}

.report-start-control {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.report-start-control .primary-button {
  min-width: 150px;
  white-space: nowrap;
}

.report-registration-info {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.report-patient-field,
.instrument-field {
  display: grid;
  gap: 6px;
  color: #334047;
  font-size: 13px;
  font-weight: 700;
}

.report-patient-combobox,
.instrument-combobox {
  position: relative;
}

.report-patient-trigger,
.instrument-trigger {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  justify-content: space-between;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 650;
  text-align: left;
}

.report-patient-trigger svg,
.instrument-trigger svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.report-patient-trigger span,
.instrument-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-patient-menu,
.instrument-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid #cde1dc;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 18px 36px rgba(13, 36, 38, 0.14);
}

.instrument-menu.instrument-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  border: 0;
  border-radius: 0;
  background: rgb(15 23 42 / 0.34);
  box-shadow: none;
}

.instrument-menu.instrument-modal[hidden] {
  display: none;
}

.instrument-modal-panel {
  width: min(720px, 100%);
  height: min(720px, calc(100vh - 40px));
  height: min(720px, calc(100dvh - 40px));
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.instrument-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.instrument-modal-header span {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instrument-modal-header h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.instrument-modal-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.instrument-modal-search-field {
  position: relative;
  min-width: 0;
}

.instrument-modal-search-field svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 18px;
  height: 18px;
  color: #527078;
  fill: currentColor;
  pointer-events: none;
  transform: translateY(-50%);
}

.instrument-modal-search-field input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding-left: 40px;
}

.instrument-result-count {
  min-width: 92px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-align: right;
  white-space: nowrap;
}

.instrument-modal .instrument-options {
  min-height: 0;
  max-height: none;
  padding: 2px 5px 2px 0;
  overscroll-behavior: contain;
  scrollbar-color: #9db9b6 transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.report-patient-options,
.instrument-options {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
}

.report-patient-option,
.instrument-option {
  align-items: center;
  gap: 12px;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.report-patient-option {
  display: flex;
  justify-content: flex-start;
  min-height: 36px;
  padding: 8px 10px;
  border-radius: 8px;
}

.instrument-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  height: max-content;
  min-height: 54px;
  padding: 9px 11px;
  border-radius: 6px;
  line-height: 1.35;
}

.instrument-option:nth-child(odd) {
  background: #f3f8f7;
}

.instrument-option:nth-child(even) {
  background: #ffffff;
}

.report-patient-option:hover,
.report-patient-option.active,
.instrument-option:not(:disabled):hover,
.instrument-option.active {
  background: #eaf6f3;
}

.instrument-option-content {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.instrument-option-content strong,
.instrument-option-content small {
  display: block;
  overflow-wrap: anywhere;
}

.instrument-option-content strong {
  font-size: 13px;
  line-height: 1.35;
}

.instrument-option-content small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.instrument-option-meta {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.instrument-option-meta-separator {
  color: #9aafb4;
}

.instrument-option.age-incompatible {
  color: #667277;
  cursor: not-allowed;
}

.instrument-option.age-incompatible .instrument-option-content {
  opacity: 0.68;
}

.instrument-option-status {
  justify-self: end;
  padding: 3px 6px;
  border: 1px solid #e1c7bd;
  border-radius: 6px;
  color: #8d3d2e;
  background: #fff5f1;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
}

body.instrument-modal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .instrument-menu.instrument-modal {
    padding: 12px;
  }

  .instrument-modal-panel {
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    padding: 14px;
    border-radius: 8px;
  }
}

@media (max-width: 480px) {
  .instrument-menu.instrument-modal {
    padding: 8px;
  }

  .instrument-modal-panel {
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    gap: 10px;
    padding: 12px;
  }

  .instrument-modal-header h3 {
    font-size: 18px;
  }

  .instrument-modal-search-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .instrument-result-count {
    min-width: 0;
    padding-left: 2px;
    text-align: left;
  }

  .instrument-option {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    padding: 10px;
  }

  .instrument-option-status {
    justify-self: start;
  }
}

@media (max-height: 520px) {
  .instrument-menu.instrument-modal {
    padding: 8px;
  }

  .instrument-modal-panel {
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    gap: 9px;
    padding: 11px;
  }

  .instrument-modal-header span {
    display: none;
  }

  .instrument-modal-search-field input {
    min-height: 40px;
  }
}

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

.report-document-card {
  border: 1px solid #cde7e1;
  border-radius: var(--radius);
  background: #f4fbfa;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(14, 45, 45, 0.04);
}

.report-document-card:nth-child(4n + 2) {
  border-color: #eadfcb;
  background: #fffaf0;
}

.report-document-card:nth-child(4n + 3) {
  border-color: #d8e0f2;
  background: #f6f8fe;
}

.report-document-card:nth-child(4n + 4) {
  border-color: #ead7e2;
  background: #fff6fa;
}

.report-document-card.open {
  border-color: #79b9ad;
  background: #f7fffc;
  box-shadow: 0 14px 34px rgba(16, 79, 70, 0.12);
}

.report-document-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.report-document-title-block {
  min-width: 0;
}

.report-document-title-row {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
}

.report-document-summary strong,
.report-document-summary span {
  display: block;
}

.report-document-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-document-summary span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.report-document-name-input {
  width: min(360px, 100%);
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 8px;
  font-weight: 800;
}

.report-name-edit-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #4f746e;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
}

.report-name-edit-button:hover {
  color: var(--primary-strong);
  background: rgba(15, 79, 70, 0.08);
  border-color: rgba(15, 79, 70, 0.12);
}

.report-name-edit-button svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.report-document-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.report-document-action-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(15, 79, 70, 0.18);
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
}

.report-document-action-button:hover {
  background: #fff;
  border-color: rgba(15, 79, 70, 0.3);
}

.report-document-action-button.danger {
  color: #9f2f2f;
  border-color: rgba(159, 47, 47, 0.18);
}

.report-document-action-button.danger:hover {
  color: #8a1f1f;
  border-color: rgba(159, 47, 47, 0.32);
  background: #fff9f9;
}

.report-document-body {
  display: grid;
  gap: 14px;
  padding: 0 10px 12px;
  color: var(--ink);
  font-size: 14px;
}

.report-document-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 0 2px;
  border-bottom: 1px solid rgba(15, 79, 70, 0.12);
  overflow-x: auto;
  scrollbar-width: thin;
}

.report-document-tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  color: var(--primary-strong);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 79, 70, 0.16);
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.report-document-tab:hover {
  background: #ffffff;
  border-color: rgba(15, 79, 70, 0.34);
}

.report-document-tab.active {
  color: #ffffff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(15, 79, 70, 0.18);
}

.report-document-tab.needs-update {
  border-color: rgba(47, 183, 154, 0.55);
  background: #f0fffb;
  box-shadow: 0 0 0 1px rgba(85, 217, 210, 0.18), 0 0 16px rgba(85, 217, 210, 0.18);
  animation: reportTabNeedsUpdate 1.8s ease-in-out infinite;
}

.report-document-tab.active.needs-update {
  background: var(--primary);
  box-shadow: 0 8px 18px rgba(15, 79, 70, 0.18), 0 0 0 2px rgba(85, 217, 210, 0.28);
}

@keyframes reportTabNeedsUpdate {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(85, 217, 210, 0.16), 0 0 10px rgba(85, 217, 210, 0.12);
  }
  50% {
    box-shadow: 0 0 0 2px rgba(85, 217, 210, 0.38), 0 0 22px rgba(85, 217, 210, 0.34);
  }
}

@media (prefers-reduced-motion: reduce) {
  .report-document-tab.needs-update {
    animation: none;
  }
}

.report-document-tab-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.report-section-pane {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d6e7e3;
  border-radius: var(--radius);
  background: #ffffff;
}

.report-section-pane-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.report-section-pane-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
}

.report-section-pane-header p {
  margin: 6px 0 0;
  max-width: 680px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.report-section-pane-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.report-section-pane-actions .primary-button,
.report-section-pane-actions .secondary-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.report-dependency-notice {
  padding: 10px 12px;
  border: 1px solid rgba(47, 183, 154, 0.32);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: #f0fffb;
  color: var(--primary-strong);
  font-size: 13px;
  line-height: 1.45;
}

.report-dependency-notice.tests {
  margin-bottom: 10px;
}

.report-section-entry-list {
  display: grid;
  gap: 8px;
}

.report-patient-record {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #c9e2dc;
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  background: #f7fbfa;
}

.report-patient-record-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.report-patient-record-header strong,
.report-identification-complements > strong {
  color: var(--primary-strong);
  font-size: 13px;
}

.report-patient-record-header span {
  padding: 4px 8px;
  border: 1px solid #b9ddd5;
  border-radius: 999px;
  color: var(--primary-strong);
  background: #eaf7f4;
  font-size: 11px;
  font-weight: 700;
}

.report-patient-record-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}

.report-patient-record-field {
  min-width: 0;
}

.report-patient-record-field.wide {
  grid-column: 1 / -1;
}

.report-patient-record-field dt {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-patient-record-field dd {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.report-identification-complements {
  display: grid;
  gap: 8px;
}

.report-section-entry {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.report-section-entry-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.report-section-entry-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.report-section-entry-actions .primary-button,
.report-section-entry-actions .secondary-button {
  min-height: 34px;
  padding: 0 12px;
}

.report-section-entry-actions [data-assist-manual-section-entry]:not([hidden]) {
  color: var(--primary);
  background: var(--accent-soft);
  border-color: rgba(47, 183, 154, 0.42);
  box-shadow: 0 0 0 1px rgba(85, 217, 210, 0.14), 0 0 16px rgba(85, 217, 210, 0.22);
}

.report-section-entry-actions [data-assist-manual-section-entry]:not([hidden]):hover {
  border-color: rgba(47, 183, 154, 0.7);
  box-shadow: 0 0 0 1px rgba(85, 217, 210, 0.2), 0 0 22px rgba(85, 217, 210, 0.3);
}

.report-section-entry strong {
  color: var(--primary-strong);
  font-size: 12px;
}

.report-section-entry-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  font-family: inherit;
}

.report-section-entry-editor {
  width: 100%;
  min-height: 220px;
  resize: vertical;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid #bcd6d1;
  border-radius: var(--radius);
  padding: 12px;
  font: inherit;
  line-height: 1.5;
}

.results-domain-tables {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d4e9e6;
  border-radius: var(--radius);
  background: #fbfefd;
}

.report-results-automatic {
  display: grid;
  gap: 0;
  min-width: 0;
  border-top: 1px solid #d7e7e5;
  border-bottom: 1px solid #d7e7e5;
}

.report-results-automatic.empty {
  padding: 12px 0;
  border-bottom: 0;
}

.report-results-automatic-header,
.report-results-domain-header,
.report-results-complements-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.report-results-automatic-header {
  padding: 13px 0;
}

.report-results-automatic-header > div,
.report-results-complements-header {
  min-width: 0;
}

.report-results-automatic-header strong,
.report-results-complements-header strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
}

.report-results-automatic-header span:not(.results-auto-status),
.report-results-complements-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.results-auto-status {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: #166b5e;
  font-size: 11px;
  font-weight: 800;
  border: 1px solid #bfe2db;
  border-radius: 999px;
  background: #effaf7;
}

.report-results-domain-list {
  display: grid;
  min-width: 0;
}

.report-results-domain {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 18px 0;
  border-top: 1px solid #e4eeee;
}

.report-results-domain-header h4 {
  margin: 0;
  color: var(--primary-strong);
  font-size: 14px;
  letter-spacing: 0;
}

.report-results-domain-header > div {
  min-width: 0;
}

.report-results-domain-header > div > span {
  display: block;
  margin-top: 3px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.report-results-domain-toggle {
  flex: 0 0 auto;
  min-width: 72px;
  padding: 7px 10px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #c4ddd9;
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.report-results-domain-toggle:hover,
.report-results-domain-toggle:focus-visible {
  border-color: var(--primary);
  background: #f0faf8;
}

.report-results-domain.collapsed {
  gap: 0;
  padding: 12px 0;
}

.report-results-narrative {
  display: grid;
  gap: 9px;
  max-width: 1080px;
}

.report-results-narrative p {
  margin: 0;
  color: #38515a;
  font-size: 13px;
  line-height: 1.58;
}

.report-results-narrative strong {
  color: var(--ink);
}

.report-results-complements {
  display: grid;
  gap: 10px;
  padding-top: 18px;
}

.report-results-complements-header {
  align-items: flex-start;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0;
}

.results-domain-tables.empty {
  background: #fbfdfd;
}

.results-domain-empty {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  color: var(--muted);
  border: 1px dashed #b7dad5;
  border-radius: var(--radius);
  background: #ffffff;
}

.results-domain-empty strong {
  color: var(--primary);
  font-size: 13px;
}

.results-domain-empty span {
  font-size: 12px;
}

.results-domain-table-header,
.results-domain-block-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.results-domain-table-header h4,
.results-domain-block-header h5 {
  margin: 0;
  color: var(--ink);
}

.results-domain-table-header h4 {
  font-size: 17px;
}

.results-domain-block-header h5 {
  font-size: 15px;
}

.results-domain-table-actions,
.results-domain-block-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.results-domain-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: var(--accent-soft);
}

.results-domain-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
  border: 1px solid #cce3df;
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  user-select: none;
}

.results-domain-check.all {
  background: #f5fbfa;
}

.results-domain-check input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--primary);
}

.results-domain-table-list {
  display: grid;
  gap: 12px;
}

.results-domain-block {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(14, 83, 99, 0.13);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #ffffff;
}

.results-domain-table-wrap {
  overflow-x: auto;
  border: 1px solid #e0ecee;
  border-radius: var(--radius);
  background: #ffffff;
}

.results-domain-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 12px;
}

.results-domain-table.compact {
  min-width: 680px;
  table-layout: fixed;
}

.results-domain-table.compact th:nth-child(1) {
  width: 30%;
}

.results-domain-table.compact th:nth-child(2) {
  width: 27%;
}

.results-domain-table.compact th:nth-child(3) {
  width: 18%;
}

.results-domain-table.compact th:nth-child(4) {
  width: 25%;
}

.results-domain-table.compact td {
  overflow-wrap: anywhere;
}

.results-domain-table.compact tbody tr:nth-child(even) {
  background: #f8fbfb;
}

.results-domain-table th,
.results-domain-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid #edf3f4;
}

.results-domain-table th {
  color: var(--primary-strong);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f4faf9;
}

.results-domain-table td {
  color: var(--muted);
  line-height: 1.35;
}

.results-domain-table tr:last-child td {
  border-bottom: 0;
}

.results-domain-interpretation {
  max-width: 320px;
}

.results-classification-chip {
  display: inline-flex;
  max-width: 180px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  background: var(--accent-soft);
}

.results-classification-chip.good {
  color: #0f6758;
  background: #e8f8f5;
}

.results-classification-chip.alert {
  color: #8a5709;
  background: #fff3d8;
}

.results-classification-chip.neutral {
  color: #315c70;
  background: #edf6fa;
}

.report-section-entry.editing {
  border-color: #79b9ad;
  background: #f8fffd;
}

.report-instruments-mount,
.report-review-mount {
  display: grid;
}

.report-instruments-mount .test-selector-section {
  padding: 12px;
  border: 1px solid #d6e7e3;
  border-radius: var(--radius);
  background: #fff;
}

.report-review-mount .review-panel {
  min-height: 0;
  grid-template-rows: auto auto auto;
  border: 1px solid #d6e7e3;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.report-review-mount .review-panel .panel-header {
  background: #f8fcfb;
}

.report-review-mount .report-editor {
  min-height: 320px;
  height: auto;
  resize: vertical;
}

.report-review-mount .review-footer {
  align-self: start;
}

#saveCaseBtn.is-dirty {
  color: var(--primary-strong);
  border-color: #78b9ad;
  background: #eef9f6;
  box-shadow: 0 0 0 3px rgba(48, 183, 158, 0.1);
}

.instrument-picker {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  align-items: center;
}

.instrument-picker .primary-button {
  min-width: 190px;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.age-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  margin: 2px 0 12px;
  padding: 0 10px;
  color: var(--primary-strong);
  background: var(--accent-soft);
  border: 1px solid #cfe5dc;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 800;
}

.vineland-form-block {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.mini-panel-title {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 12px;
  align-items: end;
}

.mini-panel-title h4 {
  margin: 0;
  font-size: 15px;
}

.vineland-form-guidance {
  max-width: 760px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.vineland-form-block .instrument-table {
  min-width: 1180px;
}

.vineland-domain-summary {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.vineland-domain-summary h5,
.vineland-domain-summary p {
  margin: 0;
}

.vineland-domain-summary h5 {
  font-size: 14px;
}

.vineland-domain-summary p {
  color: var(--muted);
  font-size: 12px;
}

.vineland-form-block tr.is-not-applicable {
  background: #f5f7f8;
}

.vineland-form-block tr.is-not-applicable td {
  color: #748188;
}

.vineland-form-block input:disabled {
  cursor: not-allowed;
  color: #748188;
  background: #edf1f2;
}

.computed-value {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ihs2-context-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(300px, 1.2fr);
  gap: 12px;
  margin-bottom: 14px;
}

.ihs2-context-card {
  display: grid;
  align-content: center;
  gap: 4px;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.ihs2-context-card strong,
.ihs2-context-card span {
  display: block;
}

.ihs2-context-card strong {
  color: var(--ink);
  font-size: 13px;
}

.ihs2-context-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ihs2-context-card.is-pending {
  border-left-color: #c58a19;
  background: #fffaf0;
}

label {
  display: grid;
  gap: 6px;
  color: #334047;
  font-size: 13px;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

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

input:disabled,
select:disabled,
textarea:disabled {
  color: #6f7f87;
  background: #eef3f5;
  border-color: #d1dde1;
  cursor: not-allowed;
  opacity: 1;
}

.patient-detail-panel input:disabled,
.patient-detail-panel select:disabled,
.patient-detail-panel textarea:disabled {
  color: #596b74;
  background: #e8eef1;
  border-color: #cad7dc;
  box-shadow: inset 0 0 0 1px rgba(11, 31, 58, 0.03);
}

.patient-detail-panel input:disabled::placeholder,
.patient-detail-panel textarea:disabled::placeholder {
  color: #9aabb2;
}

input,
select {
  min-height: 40px;
  padding: 0 10px;
}

select[multiple] {
  min-height: 164px;
  padding: 8px;
}

textarea {
  resize: vertical;
  min-height: 90px;
  padding: 10px;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 122, 109, 0.14);
}

.result-builder {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.test-selector-list {
  display: grid;
  gap: 12px;
}

.test-selector-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  max-height: 310px;
  overflow: auto;
  padding-right: 3px;
}

.test-selector-item {
  display: grid;
  gap: 8px;
}

.test-toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.test-toggle-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  width: 100%;
  min-height: 58px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: left;
}

.instrument-remove-button {
  align-self: stretch;
  min-height: 58px;
  color: #8a3c35;
  background: #fff;
}

.instrument-remove-button:hover {
  border-color: #d8a39e;
  background: #fff5f3;
}

.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(15 23 42 / 0.34);
  overflow-y: auto;
}

.confirm-dialog-backdrop[hidden] {
  display: none;
}

.confirm-dialog {
  width: min(520px, 100%);
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.confirm-dialog h2,
.confirm-dialog p {
  margin: 0;
}

.confirm-dialog p {
  color: var(--muted);
  line-height: 1.55;
}

.confirm-dialog strong {
  color: var(--ink);
}

.dialog-field {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.dialog-field input {
  width: 100%;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.section-draft-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.section-draft-dialog-body {
  display: grid;
  min-height: 0;
  gap: 16px;
  padding: 2px 6px 4px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.section-draft-dialog-actions {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.section-draft-dialog textarea {
  min-height: 190px;
}

.section-draft-context-preview {
  display: grid;
  gap: 8px;
}

.section-draft-context-preview[hidden] {
  display: none;
}

.section-context-card {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 79, 70, 0.14);
  border-radius: var(--radius-sm);
  background: #f7fbfa;
}

.section-context-card strong {
  color: var(--primary-strong);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.section-context-card.pending {
  border-color: rgba(43, 126, 210, 0.36);
  background: #eef7ff;
}

.section-context-card.pending strong,
.section-context-card.pending pre {
  color: #0b4f85;
}

.section-context-card.removed {
  border-color: rgba(172, 47, 47, 0.34);
  background: #fff3f2;
}

.section-context-card.removed strong,
.section-context-card.removed pre {
  color: #9f2f2f;
}

.section-context-card pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  line-height: 1.45;
}

.section-attachment-field input {
  padding: 8px 10px;
}

.section-attachment-summary,
.section-draft-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.section-draft-status.error {
  color: #a3382f;
  font-weight: 700;
}

.section-draft-status.success {
  color: var(--primary);
  font-weight: 700;
}

.assist-blocking-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(15 23 42 / 0.45);
}

.assist-blocking-backdrop[hidden] {
  display: none;
}

.assist-blocking-dialog {
  width: min(440px, 100%);
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 26px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.assist-blocking-dialog h2,
.assist-blocking-dialog p {
  margin: 0;
}

.assist-blocking-dialog h2 {
  color: var(--ink);
  font-size: 18px;
}

.assist-blocking-dialog p {
  color: var(--muted);
  line-height: 1.5;
}

.assist-spinner {
  width: 38px;
  height: 38px;
  border: 4px solid #d8ece7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: assist-spin 0.8s linear infinite;
}

@keyframes assist-spin {
  to {
    transform: rotate(360deg);
  }
}

.test-toggle-card strong,
.test-toggle-card span,
.test-toggle-card small {
  min-width: 0;
}

.test-toggle-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
}

.test-toggle-card .test-toggle-meta {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 2px 7px;
  color: var(--primary-strong);
  background: var(--accent-soft);
  border: 1px solid #cfe5dc;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 800;
}

.test-toggle-card .test-toggle-status {
  color: var(--good);
  font-weight: 800;
}

.test-toggle-action {
  align-self: center;
  min-width: 78px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary-strong);
  background: #f7fbfa;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.test-toggle-card.open {
  border-color: #bfe8df;
}

.test-toggle-card.open .test-toggle-action {
  border-color: #bfe8df;
  background: #eaf6f3;
}

.test-toggle-card.has-data {
  background: #f1fbf7;
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary);
}

.instrument-inline-slot {
  display: grid;
  min-width: 0;
}

.instrument-inline-slot > .test-module {
  margin: 0 0 8px 0;
  padding: 12px;
  border: 1px solid #cfe5dc;
  border-radius: var(--radius);
  background: var(--surface-2);
}

.test-module[hidden] {
  display: none !important;
}

.generic-test-panels {
  display: grid;
  gap: 12px;
}

.generic-test-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.structured-test-table {
  min-width: 900px;
}

.structured-test-table input {
  min-height: 34px;
  min-width: 78px;
  padding: 0 8px;
}

.computed-cell {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.computed-cell strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
}

.generic-test-panel h4 {
  margin: 0;
  font-size: 15px;
}

.generic-test-fields {
  display: grid;
  gap: 10px;
}

.instrument-save-footer {
  display: grid;
  justify-items: end;
  padding-top: 2px;
}

.instrument-save-footer .full-button {
  max-width: 360px;
}

.htp-test-panel {
  gap: 16px;
  background: var(--surface);
}

.htp-upload-heading,
.htp-analysis-actions,
.htp-analysis-output-heading,
.htp-image-slot-title,
.htp-image-file-meta,
.htp-image-slot-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.htp-upload-heading > div,
.htp-analysis-output-heading > div {
  display: grid;
  gap: 3px;
}

.htp-upload-heading strong,
.htp-analysis-output-heading strong {
  font-size: 14px;
}

.htp-upload-heading span,
.htp-analysis-output-heading span,
.htp-analysis-actions > span,
.htp-image-slot-title span,
.htp-image-file-meta small {
  color: var(--muted);
  font-size: 12px;
}

.htp-count {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 28px;
  padding: 0 9px;
  color: var(--primary-strong) !important;
  font-weight: 700;
  background: var(--accent-soft);
  border: 1px solid #bfe9df;
  border-radius: var(--radius);
}

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

.htp-image-slot {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.htp-image-slot.has-image {
  border-color: #a9dcd1;
  background: #f2fbf8;
}

.htp-image-slot-title strong {
  font-size: 13px;
}

.htp-image-preview,
.htp-empty-upload {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px dashed #b9d1d6;
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.htp-image-preview {
  display: grid;
  place-items: center;
}

.htp-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.htp-empty-upload {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  min-height: 150px;
  color: var(--primary);
}

.htp-empty-upload:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.htp-image-file-meta {
  min-width: 0;
}

.htp-image-file-meta > span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.htp-image-file-meta small {
  flex: 0 0 auto;
}

.htp-image-slot-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.htp-image-slot-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.htp-analysis-actions {
  padding-top: 2px;
}

.htp-analysis-actions .primary-button {
  flex: 0 0 auto;
}

.htp-panel-message,
.htp-analysis-warning {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid var(--accent);
  color: var(--primary-strong);
  font-size: 12px;
  line-height: 1.45;
  background: var(--accent-soft);
}

.htp-panel-message.error,
.htp-analysis-warning {
  border-left-color: var(--danger);
  color: var(--danger);
  background: #fff5f4;
}

.htp-analysis-output {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.htp-analysis-output textarea {
  width: 100%;
  min-height: 220px;
  resize: vertical;
}

.htp-analysis-indicators {
  display: grid;
  gap: 8px;
}

.htp-analysis-indicators > strong {
  font-size: 13px;
}

.htp-indicator-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.htp-indicator-list details {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.htp-indicator-list summary {
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.htp-indicator-list p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.generic-test-preview {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.generic-test-preview .instrument-card {
  background: var(--surface-2);
}

.instrument-card-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

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

#wiscInputTable {
  min-width: 1180px;
}

#waisInputTable {
  min-width: 1180px;
}

#resultsTable {
  min-width: 1260px;
}

.results-table th,
.results-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.wisc-grid,
.instrument-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.wisc-table input,
.instrument-table input {
  min-height: 34px;
  min-width: 82px;
  padding: 0 8px;
}

.wisc-subtest-interpretation {
  min-width: 280px;
  line-height: 1.45;
}

.wais-subtest-interpretation {
  min-width: 280px;
  line-height: 1.45;
}

#resultsTable td:nth-child(8) {
  min-width: 240px;
  line-height: 1.45;
}

.instrument-table textarea {
  min-height: 56px;
  min-width: 230px;
  resize: vertical;
}

.instrument-table .table-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.wisc-results,
.instrument-results {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
}

.wisc-index-cards,
.instrument-cards {
  display: none;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.wisc-results .chart-title,
.instrument-results .chart-title {
  display: none;
}

.wisc-index-card,
.instrument-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.wisc-index-card strong,
.instrument-card strong {
  font-size: 14px;
}

.wisc-index-meta,
.instrument-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.wisc-index-meta span,
.instrument-card-meta span {
  display: block;
}

.wisc-index-card p,
.instrument-card p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.wisc-index-classification {
  color: var(--primary-strong);
  font-weight: 800;
}

.results-table th {
  color: #334047;
  background: var(--surface-2);
  font-size: 12px;
}

.empty-table {
  color: var(--muted);
  text-align: center;
}

#resultsTable td:last-child,
#resultsTable th:last-child {
  width: 44px;
  text-align: right;
}

.table-action {
  width: 30px;
  min-height: 30px;
  color: var(--danger);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
}

.table-action:hover {
  background: #fff0ed;
  border-color: #f0c9c3;
}

.chart-title {
  color: #334047;
  font-size: 13px;
  font-weight: 800;
}

.child-only-block {
  display: grid;
  gap: 12px;
}

.review-panel {
  display: grid;
  min-height: calc(100vh - 154px);
  grid-template-rows: auto auto auto minmax(420px, 1fr) auto;
}

.alert-list {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.alert-item {
  display: grid;
  gap: 4px;
  padding: 10px;
  border-left: 4px solid var(--warn);
  background: #fff8e8;
  border-radius: var(--radius);
}

.alert-item.high {
  border-left-color: var(--danger);
  background: #fff0ed;
}

.alert-item.good {
  border-left-color: var(--good);
  background: #edf8f0;
}

.alert-item strong {
  font-size: 13px;
}

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

.ai-settings {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.ai-settings label {
  font-size: 12px;
}

.ai-settings input {
  min-height: 34px;
  background: #fff;
}

.ai-status {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.report-editor {
  min-height: 360px;
  height: 100%;
  border: 0;
  border-radius: 0;
  padding: 16px;
  font-family: "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  background: #fff;
}

.report-editor:focus {
  box-shadow: none;
}

.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.tiny-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.wide-panel {
  min-height: calc(100vh - 132px);
}

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

.template-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 180px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.template-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.audit-log {
  display: grid;
  gap: 10px;
  padding: 16px;
}

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

.audit-item strong {
  font-size: 14px;
}

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

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

@media (max-width: 1280px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .form-panel,
  .review-panel {
    max-height: none;
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    gap: 10px;
    height: auto;
    max-height: none;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-brand {
    padding-bottom: 10px;
  }

  .side-menu {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-behavior: smooth;
    scroll-padding-inline: 12px;
    scrollbar-width: thin;
  }

  .side-menu-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 116px;
    min-height: 40px;
    scroll-snap-align: center;
  }

  .side-menu-item span {
    white-space: nowrap;
  }

  .side-menu-item.logout {
    margin-top: 0;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 18px;
  }

  .sidebar-footer {
    margin-top: 18px;
  }

  .topbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
    grid-template-areas:
      "patients"
      "actions";
    position: static;
  }

  .topbar-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .metrics-grid,
  .template-grid,
  .wisc-grid,
  .instrument-grid,
  .instrument-picker,
  .generic-test-panel,
  .mini-panel-title,
  .patient-page-grid,
  .report-setup-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .header-patient-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .header-patient-form .primary-button {
    justify-self: stretch;
  }

  .case-list,
  .form-panel {
    max-height: none;
  }

  #workspace .review-panel {
    min-height: auto;
  }

  #workspace .test-selector-grid {
    max-height: none;
    overflow: visible;
  }

  .results-domain-table-header,
  .results-domain-block-header,
  .report-results-automatic-header,
  .report-results-domain-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .results-domain-table-actions,
  .results-domain-block-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

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

  .report-patient-record-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.structured-test-group-row th {
  padding: 9px 10px;
  border-top: 1px solid #b9d9cf;
  border-bottom: 1px solid #cfe5dc;
  background: #edf8f4;
  color: #0b5260;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.section-context-card.loading-context span {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 560px) {
  html {
    min-width: 0;
  }

  .main {
    padding: 8px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .nav-list,
  .side-menu,
  .field-grid.two,
  .field-grid.three,
  .ihs2-context-grid,
  .header-patient-form,
  .instrument-picker,
  .report-setup-grid,
  .test-toggle-row,
  .test-selector-grid {
    grid-template-columns: 1fr;
  }

  .results-domain-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .patient-directory-item {
    grid-template-columns: 36px minmax(0, 1fr) 14px;
    gap: 9px;
    padding: 10px;
  }

  .htp-image-grid,
  .htp-indicator-list {
    grid-template-columns: 1fr;
  }

  .htp-analysis-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .htp-analysis-actions .primary-button {
    width: 100%;
  }

  #openPatientRegistrationBtn {
    padding-inline: 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .patient-directory-avatar {
    width: 34px;
    height: 34px;
  }

  .instrument-library-grid,
  .instrument-library-card {
    grid-template-columns: 1fr;
  }

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

  .questionnaire-toolbar,
  .questionnaire-filter-field {
    grid-template-columns: 1fr;
  }

  .questionnaire-card-content {
    align-items: stretch;
    flex-direction: column;
  }

  .questionnaire-card-actions {
    justify-items: stretch;
  }

  .questionnaire-card-actions > span {
    text-align: left;
  }

  .instrument-library-code {
    padding: 0 0 5px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .review-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .report-document-summary {
    grid-template-columns: 1fr;
  }

  .report-document-actions {
    justify-content: stretch;
  }

  .report-section-pane-header {
    align-items: stretch;
    flex-direction: column;
  }

  .report-patient-record-grid {
    grid-template-columns: 1fr;
  }

  .report-patient-record-field.wide {
    grid-column: auto;
  }

  .report-section-entry-header {
    align-items: stretch;
    flex-direction: column;
  }

  .report-section-entry-actions {
    justify-content: stretch;
  }

  .report-section-entry-actions .primary-button,
  .report-section-entry-actions .secondary-button {
    flex: 1;
  }

  .report-section-pane-actions {
    width: 100%;
    justify-content: stretch;
  }

  .report-section-pane-actions .primary-button,
  .report-section-pane-actions .secondary-button {
    flex: 1 1 190px;
    width: 100%;
  }

  .report-document-actions .report-document-action-button {
    flex: 1;
    width: 100%;
  }

  .action-row,
  .topbar-actions {
    width: 100%;
  }

  .action-row > .primary-button,
  .action-row > .danger-button,
  .action-row > .secondary-button,
  .topbar-actions > .primary-button,
  .topbar-actions > .danger-button,
  .topbar-actions > .secondary-button,
  .confirm-dialog-actions > .primary-button,
  .confirm-dialog-actions > .danger-button,
  .confirm-dialog-actions > .secondary-button {
    flex: 1 1 160px;
  }

  .review-section-select {
    flex: 1 1 100%;
    max-width: none;
  }

  .topbar-actions .icon-button {
    flex: 0 0 44px;
  }

  .panel-header {
    padding: 10px 12px;
  }

  #caseForm {
    gap: 10px;
    padding: 8px;
  }

  .report-document-summary {
    padding: 8px;
  }

  .report-document-body {
    gap: 10px;
    padding: 0 4px 8px;
  }

  .report-section-pane,
  .report-instruments-mount .test-selector-section {
    gap: 10px;
    padding: 10px;
  }

  .report-instruments-mount .instrument-inline-slot > .test-module,
  .report-instruments-mount .generic-test-panel {
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .report-document-tabs,
  .agenda-settings-tabs {
    scroll-padding-inline: 28px;
  }

  .report-document-tab {
    min-height: 34px;
    padding-inline: 10px;
  }

  .patient-directory-panel > .panel-header,
  .patient-detail-panel > .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .patient-directory-panel > .panel-header .primary-button,
  .patient-detail-panel > .panel-header .action-row,
  .patient-detail-panel > .panel-header .secondary-button {
    width: 100%;
  }

  .confirm-dialog-backdrop,
  .assist-blocking-backdrop {
    padding: 8px;
  }

  .confirm-dialog {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
    overflow-y: auto;
  }

  .section-draft-dialog {
    overflow: hidden;
  }

  .section-draft-dialog-body {
    padding-right: 2px;
  }

  .table-wrap,
  .results-domain-table-wrap,
  .report-document-tabs,
  .agenda-settings-tabs,
  .side-menu {
    overscroll-behavior-inline: contain;
    touch-action: pan-x pan-y;
  }

  .report-section-pane-header > div,
  .report-document-title-block,
  .section-heading > div,
  .panel-header > div,
  .test-toggle-card > span,
  .test-toggle-card > strong {
    min-width: 0;
  }

  .report-section-pane-header h3,
  .report-section-pane-header p,
  .report-document-title-row,
  .section-heading,
  .test-toggle-card,
  .instrument-save-footer button {
    overflow-wrap: anywhere;
  }

  .whatsapp-editor-group > summary {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .whatsapp-editor-summary-meta {
    justify-content: space-between;
    width: 100%;
  }

  .whatsapp-summary-progress {
    text-align: left;
  }
}

.diagnostic-workflow-pane {
  gap: 18px;
}

.diagnostic-model-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #9bcac6;
  border-radius: 6px;
  background: #eef9f7;
  color: #0c5b62;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  white-space: nowrap;
}

.diagnostic-progress {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.diagnostic-progress-step {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfc;
}

.diagnostic-progress-step.active {
  border-color: #68b8b1;
  background: #eef9f7;
}

.diagnostic-progress-step.completed {
  border-color: #aaccc7;
  background: #f2faf7;
}

.diagnostic-progress-step.locked {
  color: var(--muted);
  background: #f4f6f7;
}

.diagnostic-progress-number {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  background: #dfeaec;
  color: #31515a;
  font-weight: 800;
}

.diagnostic-progress-step.active .diagnostic-progress-number,
.diagnostic-progress-step.completed .diagnostic-progress-number {
  background: #0d6470;
  color: #fff;
}

.diagnostic-progress-step strong,
.diagnostic-progress-step small {
  display: block;
}

.diagnostic-progress-step small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.diagnostic-stage-list {
  display: grid;
  gap: 12px;
}

.diagnostic-stage-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid #8ba5ab;
  border-radius: 7px;
  background: #fff;
}

.diagnostic-stage-card.active {
  border-left-color: #138477;
}

.diagnostic-stage-card.completed {
  border-left-color: #28a08e;
}

.diagnostic-stage-card.locked {
  border-left-color: #b8c2c5;
  background: #f7f8f8;
}

.diagnostic-stage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.diagnostic-stage-header > div:first-child {
  min-width: 0;
  max-width: 780px;
}

.diagnostic-stage-header span {
  color: #0d6470;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.diagnostic-stage-header h4 {
  margin: 4px 0 6px;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0;
}

.diagnostic-stage-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.diagnostic-stage-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.diagnostic-stage-actions button {
  min-height: 38px;
}

.diagnostic-stage-output {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.diagnostic-stage-output-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.diagnostic-stage-output-meta strong {
  color: #173f48;
  font-size: 0.84rem;
}

.diagnostic-stage-output-meta span {
  color: var(--muted);
  font-size: 0.74rem;
}

.diagnostic-stage-output pre {
  max-height: 520px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid #dbe7e8;
  border-radius: 6px;
  background: #fbfdfd;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  white-space: pre-wrap;
}

.diagnostic-stage-locked-message {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid #b8c2c5;
  background: #eef1f2;
  color: var(--muted);
  font-size: 0.82rem;
}

.diagnostic-review-note {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid #d1a541;
  background: #fff9e9;
  color: #5c4b20;
  font-size: 0.8rem;
  line-height: 1.45;
}

.intervention-profile-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid #badbd5;
  border-left: 4px solid #238879;
  border-radius: 7px;
  background: #f2faf7;
}

.intervention-profile-note.missing {
  border-color: #ead49b;
  border-left-color: #c59221;
  background: #fff9e9;
}

.intervention-profile-note strong,
.intervention-profile-note span {
  display: block;
}

.intervention-profile-note strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.intervention-profile-note > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 760px) {
  .diagnostic-progress {
    grid-template-columns: 1fr;
  }

  .diagnostic-stage-header,
  .diagnostic-stage-output-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .diagnostic-stage-actions {
    justify-content: stretch;
  }

  .diagnostic-stage-actions button {
    flex: 1 1 100%;
    width: 100%;
  }

  .intervention-profile-note {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* WhatsApp assistant foundation */
.whatsapp-page-panel {
  min-height: min(720px, calc(100vh - 48px));
  overflow: hidden;
}

.whatsapp-page-header {
  align-items: center;
  gap: 18px;
}

.whatsapp-page-header > div {
  min-width: 0;
}

.whatsapp-page-header h2,
.whatsapp-dialog-header h2,
.whatsapp-connection-copy h3 {
  margin: 0;
  letter-spacing: 0;
}

.whatsapp-page-header p:not(.eyebrow),
.whatsapp-connection-copy p,
.whatsapp-handoff-heading p,
.whatsapp-custom-heading p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.whatsapp-system-message {
  margin: 0 18px 14px;
  padding: 10px 12px;
  color: #1a4f49;
  background: #edf9f6;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 13px;
}

.whatsapp-system-message.error {
  color: #8a2e28;
  background: #fff3f1;
  border-left-color: var(--danger);
}

.whatsapp-assistant-list {
  display: grid;
  gap: 0;
  padding: 14px 18px 24px;
}

.whatsapp-assistant-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-bottom: 0;
  text-align: left;
}

.whatsapp-assistant-row:first-child {
  border-radius: var(--radius) var(--radius) 0 0;
}

.whatsapp-assistant-row:last-child {
  border-bottom: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}

.whatsapp-assistant-row:only-child {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius);
}

.whatsapp-assistant-row:hover {
  background: #f5fbfa;
  border-color: #b9ded8;
}

.whatsapp-assistant-row-copy {
  min-width: 0;
}

.whatsapp-assistant-row-copy strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-assistant-row-copy small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.whatsapp-status-badge,
.whatsapp-connection-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  color: #53656d;
  background: #eef2f3;
  border: 1px solid #d7e0e2;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.whatsapp-status-badge.active,
.whatsapp-connection-badge.connected {
  color: #11624f;
  background: #e8f8f2;
  border-color: #a8dfce;
}

.whatsapp-row-chevron {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.whatsapp-empty-state {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 64px 20px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #c6dadd;
  border-radius: var(--radius);
  background: #fbfdfd;
}

.whatsapp-empty-state svg {
  width: 34px;
  height: 34px;
  fill: #6fa69d;
}

.whatsapp-empty-state strong {
  color: var(--ink);
  font-size: 16px;
}

.whatsapp-connection-summary {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  margin: 0 18px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.whatsapp-connection-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #fff;
  background: #1d786d;
  border-radius: 50%;
}

.whatsapp-connection-mark svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

.agenda-integration-row.agenda-whatsapp-integration {
  display: block;
  padding: 12px 0;
}

.agenda-whatsapp-integration .whatsapp-system-message {
  margin: 0 0 10px;
}

.whatsapp-connection-summary--integration {
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  background: #fbfefd;
  border: 1px solid #cfe2e1;
  border-radius: 6px;
}

.whatsapp-connection-summary--integration .whatsapp-connection-mark {
  width: 40px;
  height: 40px;
  background: #25d366;
}

.whatsapp-connection-summary--integration .whatsapp-connection-mark svg {
  width: 23px;
  height: 23px;
}

.whatsapp-connection-summary--integration .eyebrow {
  margin-bottom: 2px;
  font-size: 10px;
  letter-spacing: 0;
}

.whatsapp-connection-summary--integration .whatsapp-connection-copy h3 {
  font-size: 15px;
  line-height: 1.25;
}

.whatsapp-connection-summary--integration .whatsapp-connection-copy p {
  margin-top: 2px;
  font-size: 11px;
}

.whatsapp-connection-summary--integration .whatsapp-connection-badge {
  min-height: 24px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}

.whatsapp-connection-summary--integration .primary-button {
  min-height: 32px;
  padding: 0 11px;
  font-size: 11px;
  font-weight: 700;
}

.whatsapp-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(10, 31, 44, 0.48);
}

.whatsapp-modal-backdrop[hidden] {
  display: none;
}

.whatsapp-assistant-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(920px, 100%);
  max-height: calc(100vh - 36px);
  overflow: hidden;
  background: #fff;
  border: 1px solid #aebec2;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(9, 30, 43, 0.22);
}

.whatsapp-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  background: #fbfdfd;
  border-bottom: 1px solid var(--line);
}

.whatsapp-dialog-heading {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.whatsapp-dialog-heading h2 {
  margin: 0;
}

.whatsapp-assistant-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 2px;
}

.whatsapp-assistant-id {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.whatsapp-assistant-id strong {
  color: #52676e;
  font-weight: 650;
}

.whatsapp-dialog-header-actions,
.whatsapp-dialog-footer,
.whatsapp-handoff-heading,
.whatsapp-custom-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.whatsapp-dialog-header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.whatsapp-simulate-button svg,
.whatsapp-simulation-reset svg,
.whatsapp-simulation-send svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.whatsapp-simulate-button {
  color: #075f5c;
  background: #eef9f7;
  border-color: #9bd4ce;
}

.whatsapp-simulate-button:hover {
  background: #e1f4f1;
  border-color: #70beb7;
}

.whatsapp-active-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 9px 3px 5px;
  color: #53686f;
  background: #f3f7f7;
  border: 1px solid #ccdadd;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.whatsapp-active-control:focus-within {
  outline: 3px solid rgba(30, 150, 141, 0.18);
  outline-offset: 2px;
}

.whatsapp-active-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.whatsapp-switch-track {
  position: relative;
  flex: 0 0 auto;
  width: 32px;
  height: 18px;
  background: #9aabad;
  border-radius: 999px;
  transition: background-color 160ms ease;
}

.whatsapp-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(10, 35, 45, 0.25);
  transition: transform 160ms ease;
}

.whatsapp-active-control input:checked + .whatsapp-switch-track {
  background: #18a89d;
}

.whatsapp-active-control input:checked + .whatsapp-switch-track::after {
  transform: translateX(14px);
}

.whatsapp-active-control:has(input:checked) {
  color: #075f5c;
  background: #eef9f7;
  border-color: #9bd4ce;
}

.whatsapp-assistant-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.whatsapp-dialog-body {
  min-height: 0;
  padding: 16px 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-dialog-body .whatsapp-system-message {
  margin: 0 0 12px;
}

.whatsapp-editor-group {
  margin-bottom: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #d4e0e2;
  border-radius: 7px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.whatsapp-editor-group:last-child {
  margin-bottom: 0;
}

.whatsapp-editor-group[open] {
  border-color: #9fd3ce;
  box-shadow: 0 2px 8px rgba(16, 72, 79, 0.06);
}

.whatsapp-editor-group > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 11px 14px;
  background: #fbfdfd;
  cursor: pointer;
  list-style: none;
  transition: background-color 160ms ease;
}

.whatsapp-editor-group > summary:hover {
  background: #f4f9f8;
}

.whatsapp-editor-group[open] > summary {
  background: #f1faf8;
  border-bottom: 1px solid #d3e8e5;
}

.whatsapp-editor-group > summary::-webkit-details-marker {
  display: none;
}

.whatsapp-editor-summary-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.whatsapp-editor-summary-copy strong {
  color: #0b2f4b;
  font-size: 14px;
  line-height: 1.3;
}

.whatsapp-editor-group > summary small,
.whatsapp-editor-grid label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.whatsapp-editor-summary-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 12px;
}

.whatsapp-summary-progress {
  color: #5c7178;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.whatsapp-summary-action {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: #08716d;
  font-size: 0;
  font-weight: 850;
  border-radius: 5px;
}

.whatsapp-summary-action::after {
  content: "+";
  font-size: 19px;
  line-height: 1;
}

.whatsapp-editor-group[open] .whatsapp-summary-action::after {
  content: "−";
}

.whatsapp-editor-grid {
  display: grid;
  gap: 14px;
  padding: 16px 14px;
}

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

.whatsapp-editor-grid label {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

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

.whatsapp-editor-grid textarea {
  resize: vertical;
}

.whatsapp-agenda-integration {
  display: grid;
  grid-template-columns: minmax(200px, .85fr) repeat(2, minmax(230px, 1fr));
  align-items: center;
  gap: 16px;
  margin: 0 14px 16px;
  padding: 14px 16px;
  background: #f1f9f8;
  border: 1px solid #c5dfdc;
  border-left: 4px solid #18a89d;
  border-radius: 6px;
}

.whatsapp-agenda-integration-copy {
  display: grid;
  gap: 5px;
}

.whatsapp-agenda-integration-copy strong,
.whatsapp-agenda-permission strong {
  color: #0b3654;
  font-size: 13px;
  line-height: 1.35;
}

.whatsapp-agenda-integration-copy p,
.whatsapp-agenda-permission small {
  margin: 0;
  color: #5b727a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.whatsapp-agenda-permission {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid #bfd4d7;
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.whatsapp-agenda-permission:hover {
  border-color: #78bdb7;
}

.whatsapp-agenda-permission.is-disabled {
  opacity: .58;
  cursor: not-allowed;
}

.whatsapp-agenda-permission:focus-within {
  outline: 3px solid rgba(30, 150, 141, 0.18);
  outline-offset: 2px;
}

.whatsapp-agenda-permission:has(input:checked) {
  background: #f8fdfc;
  border-color: #64b7af;
  box-shadow: 0 0 0 1px rgba(24, 168, 157, 0.08);
}

.whatsapp-agenda-permission input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.whatsapp-checkbox-mark {
  position: relative;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 1.5px solid #879ba0;
  border-radius: 4px;
  transition: background-color 160ms ease, border-color 160ms ease;
}

.whatsapp-agenda-permission input:checked + .whatsapp-checkbox-mark {
  background: #15998f;
  border-color: #15998f;
}

.whatsapp-agenda-permission input:checked + .whatsapp-checkbox-mark::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 6px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.whatsapp-agenda-permission > span:last-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.whatsapp-handoff-heading,
.whatsapp-custom-heading {
  justify-content: space-between;
}

.whatsapp-handoff-heading p,
.whatsapp-custom-heading p {
  font-size: 12px;
}

.whatsapp-handoff-list,
.whatsapp-custom-field-list {
  display: grid;
  gap: 10px;
}

.whatsapp-handoff-row,
.whatsapp-custom-field-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: end;
  gap: 10px;
  padding: 12px;
  background: #f6f9f9;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.whatsapp-custom-field-content {
  display: grid;
  grid-template-columns: minmax(180px, .45fr) minmax(0, 1fr);
  gap: 10px;
}

.whatsapp-dialog-footer {
  min-height: 68px;
  padding: 12px 20px;
  background: #fbfdfd;
  border-top: 1px solid var(--line);
}

.whatsapp-dialog-spacer {
  flex: 1 1 auto;
}

.subtle-danger {
  min-height: 42px;
  padding: 0 12px;
  color: #9b332d;
  background: transparent;
  border: 1px solid #e6bbb6;
  border-radius: var(--radius);
}

body.whatsapp-modal-open,
body.whatsapp-simulation-open,
body.whatsapp-tools-open {
  overflow: hidden;
}

.whatsapp-editor-group-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  background: #fbfdfd;
  border-top: 1px solid #dbe6e7;
}

.whatsapp-editor-group-actions button {
  min-height: 38px;
  padding: 0 14px;
}

.whatsapp-conversations-button svg,
.whatsapp-diagnosis-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.whatsapp-conversations-button,
.whatsapp-diagnosis-button {
  min-height: 40px;
  color: #17485d;
  background: #fff;
  border-color: #c8d9dc;
}

.whatsapp-conversations-button:hover,
.whatsapp-diagnosis-button:hover {
  color: #075f5c;
  background: #eef9f7;
  border-color: #8bc9c2;
}

.whatsapp-tool-backdrop {
  position: fixed;
  inset: 0;
  z-index: 158;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(8, 28, 39, 0.58);
}

.whatsapp-tool-backdrop.nested {
  z-index: 172;
  background: rgba(8, 28, 39, 0.66);
}

.whatsapp-tool-backdrop[hidden] {
  display: none;
}

.whatsapp-tool-dialog,
.whatsapp-conversations-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(760px, 100%);
  max-height: min(880px, calc(100dvh - 32px));
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid #aebec2;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(9, 30, 43, 0.3);
}

.whatsapp-tool-dialog.compact {
  width: min(620px, 100%);
}

.whatsapp-tool-dialog.wide {
  width: min(1180px, 100%);
}

.whatsapp-connection-dialog {
  grid-template-rows: auto minmax(0, 1fr);
}

.whatsapp-connection-dialog-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-connection-dialog-body > .whatsapp-system-message {
  margin: 16px 20px 0;
}

.whatsapp-connection-form,
.whatsapp-connection-qr {
  min-height: 0;
}

.whatsapp-connection-setup {
  display: grid;
  gap: 15px;
  padding: 20px 20px 0;
}

.whatsapp-connection-setup label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 750;
}

.whatsapp-connection-setup label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.whatsapp-connection-setup .whatsapp-tool-footer {
  margin: 4px -20px 0;
}

.whatsapp-connection-qr {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 20px 20px 0;
  text-align: center;
}

.whatsapp-connection-qr[hidden] {
  display: none;
}

.whatsapp-qr-frame {
  display: grid;
  place-items: center;
  width: min(320px, 100%);
  aspect-ratio: 1;
  padding: 10px;
  background: #fff;
  border: 1px solid #cbdadd;
  border-radius: 6px;
}

.whatsapp-qr-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.whatsapp-qr-copy {
  max-width: 470px;
}

.whatsapp-qr-copy strong {
  color: #0b2f4b;
}

.whatsapp-qr-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.whatsapp-connection-qr .whatsapp-tool-footer {
  width: calc(100% + 40px);
}

.whatsapp-tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 20px;
  background: #fbfdfd;
  border-bottom: 1px solid #d7e2e4;
}

.whatsapp-tool-header > div:first-child {
  min-width: 0;
}

.whatsapp-tool-header h2,
.whatsapp-tool-header h3 {
  margin: 0;
  color: #0b2f4b;
  letter-spacing: 0;
}

.whatsapp-tool-header h2 {
  font-size: 21px;
}

.whatsapp-tool-header p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.whatsapp-tool-form {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
}

.whatsapp-tool-body {
  min-height: 0;
  padding: 18px 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-tool-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  min-height: 66px;
  padding: 11px 20px;
  background: #fbfdfd;
  border-top: 1px solid #d7e2e4;
}

.whatsapp-tool-field,
.whatsapp-contact-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.whatsapp-tool-note {
  margin: 12px 0 16px;
  padding: 10px 12px;
  color: #365c64;
  background: #f1f8f7;
  border-left: 3px solid #65b9b0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.whatsapp-tool-body .whatsapp-system-message,
.whatsapp-contact-form-grid .whatsapp-system-message,
.whatsapp-export-options .whatsapp-system-message {
  margin: 12px 0 0;
}

.whatsapp-tutorial-intro {
  margin: 0 0 16px;
  color: #4d656d;
  line-height: 1.55;
}

.whatsapp-tutorial-list {
  display: grid;
  gap: 0;
  border-top: 1px solid #d9e4e6;
}

.whatsapp-tutorial-list article {
  display: grid;
  gap: 4px;
  padding: 13px 2px;
  border-bottom: 1px solid #d9e4e6;
}

.whatsapp-tutorial-list strong {
  color: #0b3654;
  font-size: 14px;
}

.whatsapp-tutorial-list p,
.whatsapp-tutorial-list small {
  margin: 0;
  color: #526a72;
  font-size: 12px;
  line-height: 1.5;
}

.whatsapp-help-questions {
  display: grid;
  gap: 12px;
}

.whatsapp-help-question {
  display: grid;
  gap: 6px;
  color: #173a50;
  font-size: 13px;
  font-weight: 700;
}

.whatsapp-help-question textarea {
  min-height: 70px;
  resize: vertical;
}

.diagnosis-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.35fr) minmax(0, 0.65fr);
  gap: 18px;
  padding: 0;
  overflow: hidden;
}

.whatsapp-diagnosis-request,
.whatsapp-diagnosis-result {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-diagnosis-request {
  background: #f8fbfb;
  border-right: 1px solid #d8e3e5;
}

.whatsapp-diagnosis-result {
  background: #fff;
}

.whatsapp-diagnosis-history-block {
  margin-top: 18px;
  border-top: 1px solid #d5e1e3;
}

.whatsapp-diagnosis-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0 8px;
  color: #173a50;
  font-size: 13px;
}

.whatsapp-diagnosis-history {
  display: grid;
  gap: 6px;
}

.whatsapp-diagnosis-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #d3dfe1;
  border-radius: 6px;
  text-align: left;
}

.whatsapp-diagnosis-history-item:hover,
.whatsapp-diagnosis-history-item.selected {
  background: #edf8f6;
  border-color: #8bc9c2;
}

.whatsapp-diagnosis-history-item span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.whatsapp-diagnosis-history-item strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-diagnosis-history-item small {
  color: var(--muted);
  font-size: 11px;
}

.whatsapp-diagnosis-history-item em,
.whatsapp-conversation-row-heading em {
  padding: 3px 7px;
  color: #5d6e74;
  background: #edf2f3;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.whatsapp-diagnosis-history-item em.applied {
  color: #0b6b57;
  background: #e4f6ef;
}

.whatsapp-diagnosis-history-item em.dismissed {
  color: #76584e;
  background: #f3eeee;
}

.whatsapp-diagnosis-empty,
.whatsapp-conversation-detail-empty,
.whatsapp-conversation-empty,
.whatsapp-mini-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 160px;
  padding: 24px;
  color: #647980;
  text-align: center;
}

.whatsapp-diagnosis-empty strong,
.whatsapp-conversation-detail-empty strong,
.whatsapp-conversation-empty strong {
  color: #173a50;
}

.whatsapp-diagnosis-empty span,
.whatsapp-conversation-detail-empty span,
.whatsapp-conversation-empty span {
  max-width: 440px;
  font-size: 12px;
  line-height: 1.5;
}

.whatsapp-diagnosis-summary {
  padding-bottom: 16px;
  border-bottom: 1px solid #d8e3e5;
}

.whatsapp-diagnosis-scope {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 8px;
  color: #086a64;
  background: #e7f6f2;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.whatsapp-diagnosis-summary h3,
.whatsapp-diagnosis-block h4 {
  margin: 0;
  letter-spacing: 0;
}

.whatsapp-diagnosis-summary h3 {
  color: #0b2f4b;
  font-size: 19px;
}

.whatsapp-diagnosis-summary p,
.whatsapp-diagnosis-block p,
.whatsapp-diagnosis-block li,
.whatsapp-diagnosis-note {
  color: #405a63;
  font-size: 13px;
  line-height: 1.55;
}

.whatsapp-diagnosis-summary p {
  margin: 8px 0 0;
}

.whatsapp-diagnosis-block {
  padding: 15px 0;
  border-bottom: 1px solid #e0e8e9;
}

.whatsapp-diagnosis-block h4 {
  color: #173a50;
  font-size: 14px;
}

.whatsapp-diagnosis-block > p,
.whatsapp-diagnosis-block > ul {
  margin: 8px 0 0;
}

.whatsapp-diagnosis-block ul {
  padding-left: 18px;
}

.whatsapp-diagnosis-suggestions,
.whatsapp-diagnosis-scenarios {
  display: grid;
  gap: 9px;
  margin-top: 9px;
}

.whatsapp-diagnosis-suggestion,
.whatsapp-diagnosis-scenarios article {
  padding: 12px;
  background: #f8fbfb;
  border: 1px solid #d7e3e5;
  border-left: 4px solid #9eb4b9;
  border-radius: 6px;
}

.whatsapp-diagnosis-suggestion.safe {
  border-left-color: #23a58e;
}

.whatsapp-diagnosis-suggestion.manual {
  border-left-color: #cc932f;
}

.whatsapp-diagnosis-suggestion-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.whatsapp-diagnosis-suggestion-heading strong,
.whatsapp-diagnosis-scenarios strong {
  color: #153b50;
  font-size: 13px;
}

.whatsapp-diagnosis-suggestion-heading span {
  flex: 0 0 auto;
  color: #506970;
  font-size: 10px;
  font-weight: 800;
}

.whatsapp-diff {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 4px;
}

.whatsapp-diff.remove {
  color: #812e28;
  background: #fff0ee;
}

.whatsapp-diff.add {
  color: #0b664f;
  background: #eaf8f2;
}

.whatsapp-diff small,
.whatsapp-diagnosis-scenarios p span {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.whatsapp-diff p,
.whatsapp-diagnosis-scenarios p {
  margin: 0;
  color: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.whatsapp-diagnosis-small-list {
  margin-top: 9px;
}

.whatsapp-diagnosis-small-list strong {
  font-size: 11px;
}

.whatsapp-diagnosis-small-list ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.whatsapp-diagnosis-note {
  margin-top: 14px;
  padding: 11px 12px;
  background: #f3f7f7;
  border-left: 3px solid #91aeb3;
  border-radius: 4px;
}

.whatsapp-inline-error,
.whatsapp-diagnosis-history-empty {
  margin: 0;
  padding: 10px;
  color: #7d3c35;
  font-size: 12px;
}

.whatsapp-conversations-dialog {
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1180px, 100%);
  height: min(840px, calc(100dvh - 32px));
}

.whatsapp-conversations-header {
  align-items: center;
}

.whatsapp-conversations-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.whatsapp-conversations-message {
  margin: 0;
  border-radius: 0;
}

.whatsapp-conversations-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.34fr) minmax(0, 0.66fr);
  min-height: 0;
  overflow: hidden;
}

.whatsapp-conversation-list-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  overflow: hidden;
  background: #f7fafa;
  border-right: 1px solid #d7e2e4;
}

.whatsapp-conversation-list {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-conversation-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: start;
  border-bottom: 1px solid #dce6e8;
}

.whatsapp-conversation-row:hover,
.whatsapp-conversation-row.selected {
  background: #edf8f6;
}

.whatsapp-conversation-row.selected::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #189b90;
}

.whatsapp-conversation-open {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px 8px 13px 14px;
  color: var(--ink);
  background: transparent;
  border: 0;
  text-align: left;
}

.whatsapp-conversation-row-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.whatsapp-conversation-row-heading strong {
  overflow: hidden;
  color: #10344d;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-conversation-row-heading em.bot {
  color: #0b6758;
  background: #dff5ee;
}

.whatsapp-conversation-row-heading em.handoff {
  color: #76500b;
  background: #fff2d7;
}

.whatsapp-conversation-row-heading em.closed {
  color: #5f6d73;
  background: #e9eeee;
}

.whatsapp-conversation-open > small,
.whatsapp-conversation-row-meta {
  color: #647980;
  font-size: 11px;
}

.whatsapp-conversation-open > p {
  display: -webkit-box;
  margin: 3px 0;
  overflow: hidden;
  color: #405a63;
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.whatsapp-conversation-row-actions {
  align-self: center;
  display: grid;
  gap: 6px;
  margin-right: 7px;
}

.whatsapp-conversation-row-actions .icon-button {
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
}

.whatsapp-conversation-quick-control.pause {
  color: #80581a;
  background: #fff8e8;
}

.whatsapp-conversation-quick-control.resume {
  color: #0b6758;
  background: #e6f7f1;
}

.whatsapp-conversation-quick-control span {
  display: block;
  font-size: 13px;
  line-height: 1;
}

.whatsapp-load-more {
  margin: 10px;
}

.whatsapp-conversation-detail-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 0;
  overflow: hidden;
  background: #eef3f3;
}

.whatsapp-conversation-detail-empty {
  grid-row: 1 / -1;
  min-height: 100%;
}

.whatsapp-conversation-detail-empty svg {
  width: 38px;
  height: 38px;
  fill: #78aaa5;
}

.whatsapp-conversation-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #d5e0e2;
}

.whatsapp-conversation-detail-header h3 {
  margin: 0;
  color: #0d314a;
  font-size: 17px;
  letter-spacing: 0;
}

.whatsapp-conversation-detail-header p {
  margin: 3px 0 0;
  color: #5e747b;
  font-size: 11px;
  line-height: 1.45;
}

.whatsapp-conversation-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #f8fbfb;
  border-bottom: 1px solid #d7e2e4;
}

.whatsapp-conversation-control p {
  display: grid;
  gap: 2px;
  margin: 0;
}

.whatsapp-conversation-control p strong,
.whatsapp-conversation-control label {
  color: #173a50;
  font-size: 12px;
  font-weight: 800;
}

.whatsapp-conversation-control p span {
  color: #5a7178;
  font-size: 11px;
}

.whatsapp-conversation-control label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.whatsapp-conversation-control select {
  min-height: 38px;
  width: auto;
}

.whatsapp-conversation-messages {
  min-height: 0;
  padding: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.whatsapp-conversation-message {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin-bottom: 13px;
}

.whatsapp-conversation-message.client {
  justify-items: end;
}

.whatsapp-conversation-message.system {
  justify-items: center;
}

.whatsapp-conversation-message > span {
  padding: 0 4px;
  color: #60767c;
  font-size: 10px;
  font-weight: 750;
}

.whatsapp-conversation-message > p {
  max-width: min(82%, 600px);
  margin: 0;
  padding: 9px 11px;
  color: #173247;
  background: #fff;
  border: 1px solid #d2dfe1;
  border-radius: 7px;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.whatsapp-conversation-message.client > p {
  color: #fff;
  background: #126975;
  border-color: #126975;
}

.whatsapp-conversation-message.system > p {
  max-width: 90%;
  color: #5e6870;
  background: #f3f6f6;
  text-align: center;
}

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

.whatsapp-contact-form-grid .full-column {
  grid-column: 1 / -1;
}

.whatsapp-export-options {
  display: grid;
  gap: 10px;
}

.whatsapp-export-options > p:first-child {
  margin: 0 0 4px;
  color: #536970;
  font-size: 13px;
}

.whatsapp-export-options label {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 11px;
  color: #173a50;
  background: #f8fbfb;
  border: 1px solid #d5e1e3;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 750;
}

.whatsapp-export-options input {
  width: 18px;
  height: 18px;
}

.whatsapp-simulation-backdrop {
  position: fixed;
  inset: 0;
  z-index: 145;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 28, 39, 0.58);
}

.whatsapp-simulation-backdrop[hidden] {
  display: none;
}

.whatsapp-simulation-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(220px, 1fr) auto auto;
  width: min(680px, 100%);
  height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  background: #f6f9f9;
  border: 1px solid #aebec2;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(9, 30, 43, 0.28);
}

.whatsapp-simulation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 16px 18px;
  background: #fff;
  border-bottom: 1px solid #d7e2e4;
}

.whatsapp-simulation-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.whatsapp-simulation-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  color: #fff;
  background: #0e6470;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 850;
}

.whatsapp-simulation-identity > div {
  min-width: 0;
}

.whatsapp-simulation-identity h2 {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-simulation-identity p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.whatsapp-simulation-header-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
}

.whatsapp-simulation-reset {
  min-height: 38px;
}

.whatsapp-simulation-safety {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 18px;
  color: #315d5b;
  background: #eaf7f4;
  border-bottom: 1px solid #c8e3df;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.whatsapp-simulation-safety svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  fill: #188f85;
}

.whatsapp-simulation-messages {
  min-height: 0;
  padding: 20px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #eef3f3;
}

.whatsapp-simulation-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  min-height: 100%;
  padding: 30px;
  color: #62777d;
  text-align: center;
}

.whatsapp-simulation-empty svg {
  width: 38px;
  height: 38px;
  fill: #75aaa4;
}

.whatsapp-simulation-empty strong {
  color: #17374c;
  font-size: 15px;
}

.whatsapp-simulation-empty span {
  max-width: 380px;
  font-size: 13px;
  line-height: 1.5;
}

.whatsapp-simulation-message {
  display: grid;
  justify-items: start;
  gap: 4px;
  margin: 0 0 14px;
}

.whatsapp-simulation-message.patient {
  justify-items: end;
}

.whatsapp-simulation-message.system {
  justify-items: center;
}

.whatsapp-simulation-message-label {
  padding: 0 4px;
  color: #60747a;
  font-size: 11px;
  font-weight: 700;
}

.whatsapp-simulation-bubble {
  max-width: min(82%, 520px);
  padding: 10px 12px;
  color: #173247;
  background: #fff;
  border: 1px solid #d2dfe1;
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(11, 42, 53, 0.05);
  font-size: 13px;
  line-height: 1.52;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.whatsapp-simulation-message.patient .whatsapp-simulation-bubble {
  color: #fff;
  background: #126975;
  border-color: #126975;
}

.whatsapp-simulation-message.system .whatsapp-simulation-bubble {
  max-width: 90%;
  padding: 7px 10px;
  color: #7c3b34;
  background: #fff3f1;
  border-color: #efd0cc;
  font-size: 12px;
  text-align: center;
}

.whatsapp-simulation-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 50px;
  min-height: 18px;
}

.whatsapp-simulation-typing span {
  width: 6px;
  height: 6px;
  background: #789096;
  border-radius: 50%;
  animation: whatsapp-typing-pulse 1s infinite ease-in-out;
}

.whatsapp-simulation-typing span:nth-child(2) {
  animation-delay: 120ms;
}

.whatsapp-simulation-typing span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes whatsapp-typing-pulse {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.whatsapp-simulation-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(82%, 520px);
}

.whatsapp-simulation-choice {
  min-height: 34px;
  padding: 6px 10px;
  color: #075f5c;
  background: #fff;
  border: 1px solid #9dcfc9;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
}

.whatsapp-simulation-choice:hover {
  background: #eaf7f4;
  border-color: #62b3ab;
}

.whatsapp-simulation-transfer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(82%, 520px);
  padding: 6px 9px;
  color: #6d4b12;
  background: #fff8e8;
  border: 1px solid #ecd7a2;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 750;
}

.whatsapp-simulation-error {
  margin: 0;
  padding: 10px 18px;
  color: #8c3029;
  background: #fff2f0;
  border-top: 1px solid #efd0cc;
  font-size: 12px;
}

.whatsapp-simulation-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 16px 10px;
  background: #fff;
  border-top: 1px solid #d5e0e2;
}

.whatsapp-simulation-composer textarea {
  min-height: 48px;
  max-height: 128px;
  resize: vertical;
}

.whatsapp-simulation-send {
  min-width: 104px;
  min-height: 48px;
}

.whatsapp-simulation-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  grid-column: 1 / -1;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.whatsapp-simulation-delay-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
}

.whatsapp-simulation-delay-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.whatsapp-simulation-delay-control .whatsapp-switch-track {
  width: 28px;
  height: 16px;
}

.whatsapp-simulation-delay-control .whatsapp-switch-track::after {
  top: 3px;
  left: 3px;
  width: 10px;
  height: 10px;
}

.whatsapp-simulation-delay-control input:checked + .whatsapp-switch-track {
  background: #18a89d;
}

.whatsapp-simulation-delay-control input:checked + .whatsapp-switch-track::after {
  transform: translateX(12px);
}

.whatsapp-simulation-delay-control:focus-within {
  outline: 3px solid rgba(30, 150, 141, 0.18);
  outline-offset: 3px;
  border-radius: 4px;
}

@media (max-width: 900px) {
  .whatsapp-connection-summary {
    grid-template-columns: 52px minmax(0, 1fr) auto;
  }

  .whatsapp-connection-summary .primary-button {
    grid-column: 1 / -1;
    justify-self: stretch;
  }
}

@media (max-width: 760px) {
  .whatsapp-page-panel {
    min-height: auto;
  }

  .whatsapp-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .whatsapp-page-header .primary-button {
    justify-content: center;
    width: 100%;
  }

  .whatsapp-assistant-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .whatsapp-row-chevron {
    display: none;
  }

  .whatsapp-connection-summary {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 12px;
  }

  .whatsapp-connection-mark {
    width: 44px;
    height: 44px;
  }

  .whatsapp-connection-badge,
  .whatsapp-connection-summary .primary-button {
    grid-column: 1 / -1;
    justify-self: stretch;
  }

  .whatsapp-modal-backdrop {
    align-items: stretch;
    padding: 8px;
  }

  .whatsapp-assistant-dialog {
    max-height: calc(100vh - 16px);
  }

  .whatsapp-dialog-header {
    align-items: flex-start;
    padding: 14px;
  }

  .whatsapp-dialog-header-actions {
    flex: 0 0 auto;
  }

  .whatsapp-simulate-button,
  .whatsapp-conversations-button,
  .whatsapp-diagnosis-button {
    width: 40px;
    padding: 0;
    font-size: 0;
  }

  .whatsapp-simulate-button svg,
  .whatsapp-conversations-button svg,
  .whatsapp-diagnosis-button svg {
    width: 20px;
    height: 20px;
  }

  .whatsapp-assistant-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .whatsapp-dialog-body {
    padding: 10px 14px 18px;
  }

  .whatsapp-editor-group > summary {
    align-items: flex-start;
    padding: 11px 12px;
  }

  .whatsapp-editor-summary-meta {
    gap: 6px;
  }

  .whatsapp-summary-progress {
    white-space: normal;
    text-align: right;
  }

  .whatsapp-editor-grid.two-columns,
  .whatsapp-custom-field-content,
  .whatsapp-agenda-integration {
    grid-template-columns: 1fr;
  }

  .whatsapp-agenda-integration {
    margin: 0 12px 14px;
    padding: 13px;
  }

  .whatsapp-editor-grid .full-column {
    grid-column: auto;
  }

  .whatsapp-handoff-heading,
  .whatsapp-custom-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .whatsapp-dialog-footer {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .whatsapp-dialog-spacer {
    display: none;
  }

  .whatsapp-dialog-footer button {
    flex: 1 1 140px;
    min-height: 44px;
  }

  .whatsapp-simulation-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .whatsapp-simulation-dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .whatsapp-simulation-header {
    align-items: flex-start;
    padding: 12px;
  }

  .whatsapp-simulation-avatar {
    width: 38px;
    height: 38px;
  }

  .whatsapp-simulation-identity {
    align-items: flex-start;
    gap: 9px;
  }

  .whatsapp-simulation-identity h2 {
    max-width: 145px;
    font-size: 17px;
  }

  .whatsapp-simulation-identity p {
    display: none;
  }

  .whatsapp-simulation-reset {
    width: 40px;
    padding: 0;
    font-size: 0;
  }

  .whatsapp-simulation-safety {
    align-items: flex-start;
    padding: 8px 12px;
  }

  .whatsapp-simulation-messages {
    padding: 16px 12px;
  }

  .whatsapp-simulation-bubble,
  .whatsapp-simulation-choices,
  .whatsapp-simulation-transfer {
    max-width: 88%;
  }

  .whatsapp-simulation-composer {
    grid-template-columns: minmax(0, 1fr) 48px;
    padding: 10px 12px 8px;
  }

  .whatsapp-simulation-send {
    width: 48px;
    min-width: 48px;
    padding: 0;
    font-size: 0;
  }

  .whatsapp-simulation-send svg {
    width: 21px;
    height: 21px;
  }

  .whatsapp-simulation-composer-meta {
    align-items: flex-start;
  }

  .whatsapp-editor-group-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px 12px;
  }

  .whatsapp-editor-group-actions button {
    min-height: 44px;
  }

  .whatsapp-tool-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .whatsapp-tool-dialog,
  .whatsapp-tool-dialog.compact,
  .whatsapp-tool-dialog.wide,
  .whatsapp-conversations-dialog {
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .whatsapp-tool-header {
    padding: 13px 14px;
  }

  .whatsapp-tool-header h2 {
    font-size: 18px;
  }

  .whatsapp-connection-setup,
  .whatsapp-connection-qr {
    padding: 14px 14px 0;
  }

  .whatsapp-connection-setup .whatsapp-tool-footer {
    margin: 4px -14px 0;
  }

  .whatsapp-connection-qr .whatsapp-tool-footer {
    width: calc(100% + 28px);
  }

  .whatsapp-tool-body,
  .whatsapp-diagnosis-request,
  .whatsapp-diagnosis-result {
    padding: 14px;
  }

  .whatsapp-tool-footer {
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .whatsapp-tool-footer button {
    flex: 1 1 130px;
    min-height: 44px;
  }

  .diagnosis-layout {
    display: block;
    overflow-y: auto;
  }

  .whatsapp-diagnosis-request,
  .whatsapp-diagnosis-result {
    overflow: visible;
  }

  .whatsapp-diagnosis-request {
    border-right: 0;
    border-bottom: 1px solid #d8e3e5;
  }

  .whatsapp-conversations-header {
    align-items: flex-start;
  }

  .whatsapp-conversations-header p {
    display: none;
  }

  .whatsapp-conversations-header-actions {
    display: grid;
    grid-template-columns: 40px 40px 40px;
    gap: 6px;
  }

  .whatsapp-conversations-header-actions .secondary-button {
    width: 40px;
    min-height: 40px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .whatsapp-conversations-header-actions .secondary-button::before {
    color: currentColor;
    font-size: 17px;
  }

  #whatsappExportContactsBtn::before {
    content: "↓";
  }

  #whatsappRefreshConversationsBtn::before {
    content: "↻";
  }

  .whatsapp-conversations-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(150px, 0.32fr) minmax(0, 0.68fr);
  }

  .whatsapp-conversation-list-pane {
    border-right: 0;
    border-bottom: 1px solid #d7e2e4;
  }

  .whatsapp-conversation-row {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .whatsapp-conversation-open {
    padding: 11px;
  }

  .whatsapp-conversation-row-heading {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }

  .whatsapp-conversation-open > p {
    -webkit-line-clamp: 1;
  }

  .whatsapp-conversation-row-actions {
    display: grid;
  }

  .whatsapp-conversation-detail-header {
    align-items: flex-start;
    padding: 11px 12px;
  }

  .whatsapp-conversation-detail-header .secondary-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    overflow: hidden;
    font-size: 0;
  }

  .whatsapp-conversation-detail-header .secondary-button::before {
    content: "✎";
    font-size: 16px;
  }

  .whatsapp-conversation-control {
    align-items: stretch;
    flex-direction: column;
    padding: 9px 12px;
  }

  .whatsapp-conversation-control label {
    align-items: stretch;
    flex-direction: column;
  }

  .whatsapp-conversation-control select,
  .whatsapp-conversation-control button {
    width: 100%;
  }

  .whatsapp-conversation-messages {
    padding: 14px 10px;
  }

  .whatsapp-conversation-message > p {
    max-width: 94%;
  }

  .whatsapp-contact-form-grid {
    grid-template-columns: 1fr;
  }

  .whatsapp-contact-form-grid .full-column {
    grid-column: auto;
  }
}

@media (max-width: 430px) {
  .whatsapp-dialog-header {
    gap: 10px;
  }

  .whatsapp-dialog-header-actions {
    display: grid;
    grid-template-columns: repeat(2, 40px);
    gap: 6px;
  }

  .whatsapp-conversations-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .whatsapp-conversation-detail-header h3 {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .diagnosis-footer .whatsapp-dialog-spacer {
    display: none;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell {
    display: block;
  }

  .sidebar,
  .topbar,
  .metrics-grid,
  .queue-panel,
  .form-panel,
  .panel-header,
  .alert-list,
  .review-footer,
  #templates,
  #audit {
    display: none !important;
  }

  .main {
    padding: 0;
  }

  .review-panel {
    display: block;
    border: 0;
    box-shadow: none;
    min-height: 0;
  }

  .ai-settings {
    display: none !important;
  }

  .report-editor {
    min-height: 0;
    height: auto;
    padding: 0;
    white-space: pre-wrap;
    border: 0;
  }
}

/* Agenda */
.agenda-panel,
.agenda-settings-panel {
  max-width: 1560px;
  margin: 0 auto;
}

.agenda-page-header {
  min-height: 66px;
}

.agenda-system-message {
  margin: 12px 14px 0;
  padding: 10px 12px;
  color: #25414c;
  background: #edf6f8;
  border-left: 3px solid #4e8b99;
  border-radius: 4px;
  font-size: 13px;
}

.agenda-system-message.success {
  color: #17624f;
  background: #ebf8f3;
  border-color: #2fb79a;
}

.agenda-system-message.warning {
  color: #725015;
  background: #fff8e8;
  border-color: #d5a332;
}

.agenda-system-message.error {
  color: #8b2f27;
  background: #fff2f0;
  border-color: #ba4b42;
}

.agenda-filter-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) repeat(3, minmax(150px, 0.7fr));
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.agenda-filter-toolbar > label:not(.search-box),
.agenda-settings-grid > label,
.agenda-time-fields > label,
.agenda-settings-row > label {
  display: grid;
  gap: 5px;
  color: #304b56;
  font-size: 12px;
  font-weight: 700;
}

.agenda-filter-toolbar select,
.agenda-settings-grid input,
.agenda-settings-grid select,
.agenda-settings-grid textarea,
.agenda-settings-row input,
.agenda-settings-row select,
.agenda-appointment-fields input,
.agenda-appointment-fields select,
.agenda-appointment-fields textarea {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cddfe3;
  border-radius: 6px;
}

.agenda-filter-toolbar select:focus,
.agenda-settings-grid input:focus,
.agenda-settings-grid select:focus,
.agenda-settings-grid textarea:focus,
.agenda-settings-row input:focus,
.agenda-settings-row select:focus,
.agenda-appointment-fields input:focus,
.agenda-appointment-fields select:focus,
.agenda-appointment-fields textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 183, 154, 0.13);
}

.agenda-search-field {
  min-height: 40px;
}

.agenda-period-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, auto) minmax(310px, 1fr);
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.agenda-period-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.agenda-period-toolbar h3 {
  margin: 0;
  font-size: 15px;
  text-align: center;
}

.compact-button {
  min-height: 38px;
  padding: 0 12px;
}

.agenda-view-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  justify-self: end;
  overflow: hidden;
  min-width: 310px;
  border: 1px solid #cddfe3;
  border-radius: 6px;
}

.agenda-view-switch button {
  min-height: 36px;
  color: #4e6670;
  background: #fff;
  border: 0;
  border-right: 1px solid #dce8ea;
  font-size: 13px;
  font-weight: 700;
}

.agenda-view-switch button:last-child {
  border-right: 0;
}

.agenda-view-switch button:hover {
  background: #f4faf9;
}

.agenda-view-switch button.active {
  color: #fff;
  background: var(--primary);
}

.agenda-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 8px 14px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
}

.agenda-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.agenda-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.agenda-legend .scheduled { background: #397ba8; }
.agenda-legend .confirmed { background: #278669; }
.agenda-legend .completed { background: #667780; }
.agenda-legend .no-show { background: #cc7c25; }
.agenda-legend .canceled { background: #b54c45; }
.agenda-legend .block { background: #89959b; }
.agenda-legend .google-event { background: #85b6dd; }

.agenda-calendar {
  min-height: 480px;
  background: #fff;
}

.agenda-month-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
  scrollbar-color: #9bb8bf #edf3f4;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.agenda-month-scroll:focus-visible {
  outline: 3px solid rgba(47, 183, 154, 0.28);
  outline-offset: -3px;
}

.agenda-month-scroll::-webkit-scrollbar {
  height: 9px;
}

.agenda-month-scroll::-webkit-scrollbar-thumb {
  background: #9bb8bf;
  border: 2px solid #edf3f4;
  border-radius: 8px;
}

.agenda-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  min-width: 840px;
  border-left: 1px solid var(--line);
}

.agenda-month-weekday {
  padding: 8px;
  color: #526b75;
  background: #f5f9fa;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.agenda-month-day {
  position: relative;
  min-height: 118px;
  padding: 5px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.agenda-month-day.outside {
  color: #93a2a8;
  background: #f8fafb;
}

.agenda-month-day.today {
  box-shadow: inset 0 0 0 2px #2fb79a;
}

.agenda-month-day.holiday {
  background: #fff6f6;
}

.agenda-month-date {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.agenda-month-date:hover {
  background: var(--accent-soft);
}

.agenda-holiday-name {
  display: block;
  margin: 0 2px 4px;
  overflow: hidden;
  color: #954c54;
  font-size: 9px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-month-items {
  display: grid;
  gap: 3px;
}

.agenda-compact-item,
.agenda-more-button {
  display: block;
  overflow: hidden;
  width: 100%;
  min-height: 20px;
  padding: 3px 5px;
  color: #fff;
  background: #397ba8;
  border: 0;
  border-radius: 4px;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-compact-item span {
  margin-right: 4px;
  font-weight: 800;
}

button.agenda-compact-item:hover,
button.agenda-compact-item:focus-visible,
button.agenda-timed-item:hover,
button.agenda-timed-item:focus-visible {
  filter: brightness(1.07);
  outline: 2px solid rgba(5, 43, 78, 0.26);
  outline-offset: 1px;
}

.agenda-more-button {
  color: var(--primary);
  background: transparent;
  font-weight: 800;
}

.agenda-day-add {
  position: absolute;
  top: 4px;
  right: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  color: #607881;
  background: transparent;
  border: 0;
  border-radius: 50%;
  opacity: 0;
}

.agenda-month-day:hover .agenda-day-add,
.agenda-day-add:focus-visible {
  background: #edf7f5;
  opacity: 1;
}

.agenda-week-scroll {
  overflow: auto;
  max-height: calc(100vh - 280px);
  min-height: 520px;
}

.agenda-week-grid {
  display: grid;
  grid-template-columns: 54px minmax(980px, 1fr);
  min-width: 1034px;
}

.agenda-week-corner {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 8;
  min-height: 42px;
  background: #f5f9fa;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.agenda-week-headers {
  position: sticky;
  top: 0;
  z-index: 7;
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  min-height: 42px;
  background: #f5f9fa;
}

.agenda-week-headers button {
  color: #405a65;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.agenda-week-headers button.today {
  color: #176a5d;
  background: #eaf8f4;
}

.agenda-week-time-column {
  position: relative;
  background: #f8fafb;
  border-right: 1px solid var(--line);
}

.agenda-week-time-column span {
  position: absolute;
  right: 7px;
  color: #6d8189;
  font-size: 10px;
  transform: translateY(-6px);
}

.agenda-week-time-column span:first-child {
  transform: translateY(4px);
}

.agenda-week-columns {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
}

.agenda-week-day-column {
  position: relative;
  border-right: 1px solid var(--line);
  background: repeating-linear-gradient(to bottom, #fff 0, #fff 31px, #e7eff1 31px, #e7eff1 32px);
}

.agenda-week-day-column.today {
  background: repeating-linear-gradient(to bottom, #f4fbf8 0, #f4fbf8 31px, #d6ebe5 31px, #d6ebe5 32px);
}

.agenda-week-slot {
  display: block;
  width: 100%;
  height: 32px;
  padding: 0;
  background: transparent;
  border: 0;
}

.agenda-week-slot:hover:not(.closed) {
  background: rgba(47, 183, 154, 0.08);
}

.agenda-week-slot.closed {
  cursor: not-allowed;
  background: rgba(116, 132, 139, 0.09);
}

.agenda-timed-item {
  position: absolute;
  z-index: 3;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: hidden;
  min-height: 16px;
  padding: 4px 5px;
  color: #fff;
  background: #397ba8;
  border: 1px solid rgba(0, 0, 0, 0.16);
  border-radius: 4px;
  text-align: left;
}

.agenda-timed-item strong,
.agenda-timed-item span {
  overflow: hidden;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-timed-item strong { font-size: 10px; }
.agenda-timed-item span { font-size: 9px; opacity: 0.92; }

.agenda-card-recurrence {
  display: block;
  max-width: 100%;
  padding-top: 1px;
  overflow: hidden;
  font-size: 8px !important;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-timed-item[draggable="true"] {
  cursor: grab;
}

.agenda-timed-item[draggable="true"]:active {
  cursor: grabbing;
}

.agenda-timed-item.block,
.agenda-compact-item.block {
  cursor: default;
}

.agenda-timed-item.agenda-drag-source {
  opacity: 0.4;
}

.agenda-drag-preview {
  position: absolute;
  right: 4px;
  left: 4px;
  z-index: 12;
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 4px;
  padding: 4px 6px;
  overflow: hidden;
  border: 2px solid #168b78;
  border-radius: 4px;
  background: rgba(66, 201, 171, 0.24);
  color: #0c554a;
  pointer-events: none;
}

.agenda-drag-preview.invalid {
  border-color: #c24c55;
  background: rgba(235, 103, 113, 0.22);
  color: #872e35;
}

.agenda-drag-preview strong,
.agenda-drag-preview span {
  overflow: hidden;
  font-size: 9px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-drag-feedback {
  position: sticky;
  right: 12px;
  bottom: 12px;
  z-index: 20;
  float: right;
  max-width: min(360px, calc(100% - 24px));
  margin: -46px 12px 12px auto;
  padding: 8px 11px;
  border: 1px solid #79bfb0;
  border-radius: 5px;
  background: #e9f8f4;
  color: #145f53;
  box-shadow: 0 5px 16px rgba(13, 53, 63, 0.16);
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.agenda-drag-feedback.invalid {
  border-color: #e0a1a6;
  background: #fff0f1;
  color: #8c3038;
}

.agenda-compact-item.confirmed,
.agenda-timed-item.confirmed,
.agenda-status-badge.confirmed { background: #278669; }
.agenda-compact-item.canceled,
.agenda-timed-item.canceled,
.agenda-status-badge.canceled { background: #b54c45; }
.agenda-compact-item.archived-canceled,
.agenda-timed-item.archived-canceled,
.agenda-status-badge.archived-canceled,
.agenda-compact-item.completed,
.agenda-timed-item.completed,
.agenda-status-badge.completed { background: #667780; }
.agenda-compact-item.no-show,
.agenda-timed-item.no-show,
.agenda-status-badge.no-show { background: #cc7c25; }
.agenda-compact-item.block,
.agenda-timed-item.block,
.agenda-status-badge.block { background: #89959b; }

.agenda-compact-item.google-event,
.agenda-timed-item.google-event,
.agenda-status-badge.google-event {
  color: #174b75;
  background: #e8f3ff;
  border-color: #85b6dd;
}

.agenda-list-row.google-event {
  color: #173b59;
  background: #f3f8fd;
  border-left-color: #4f91c4;
}

@keyframes agenda-devolutiva-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(211, 159, 42, 0.85); }
  50% { box-shadow: 0 0 0 3px rgba(211, 159, 42, 0.22); }
}

.agenda-timed-item.devolutiva {
  border-color: #e0ae39;
  animation: agenda-devolutiva-pulse 1.8s ease-in-out infinite;
}

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

.agenda-chronological-header div {
  display: grid;
  gap: 3px;
}

.agenda-chronological-header span {
  color: var(--muted);
  font-size: 12px;
}

.agenda-chronological-list {
  display: grid;
}

.agenda-list-row {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 68px;
  padding: 10px 14px;
  color: var(--ink);
  background: #fff;
  border: 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

button.agenda-list-row:hover {
  background: #f5faf9;
}

.agenda-list-date,
.agenda-list-main {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agenda-list-date strong,
.agenda-list-main strong { font-size: 13px; }
.agenda-list-date span,
.agenda-list-main span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-status-badge,
.agenda-readiness-badge {
  padding: 5px 8px;
  color: #fff;
  background: #397ba8;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.agenda-readiness-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  align-self: start;
  width: max-content;
  min-width: 76px;
  min-height: 28px;
  padding: 0 11px;
  line-height: 1;
  text-align: center;
}

.agenda-empty-state,
.agenda-loading {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 360px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.agenda-empty-state strong { color: var(--ink); }
.agenda-empty-state span { font-size: 13px; }

.agenda-loading {
  grid-auto-flow: column;
  justify-content: center;
  font-size: 13px;
}

.agenda-loading span {
  width: 18px;
  height: 18px;
  border: 2px solid #c8dadd;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: agenda-spin 0.8s linear infinite;
}

@keyframes agenda-spin { to { transform: rotate(360deg); } }

/* Configurações da agenda */
.agenda-settings-tabs {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.agenda-settings-tabs button {
  min-height: 34px;
  padding: 0 11px;
  color: #4a626c;
  background: #fff;
  border: 1px solid #d3e2e5;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
}

.agenda-settings-tabs button.active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.agenda-settings-form {
  min-height: 460px;
}

.agenda-settings-section {
  display: none;
  padding: 18px 20px 24px;
}

.agenda-settings-section.active {
  display: block;
}

.agenda-settings-section > .section-heading {
  margin-bottom: 16px;
}

.agenda-settings-section .section-heading h3,
.agenda-settings-section .section-heading p {
  margin: 0;
}

.agenda-settings-section .section-heading h3 {
  font-size: 16px;
}

.agenda-settings-section .section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.agenda-settings-grid {
  display: grid;
  gap: 12px;
}

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

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

.agenda-settings-grid .span-2 {
  grid-column: span 2;
}

.agenda-brand-profile {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 18px;
}

.agenda-brand-logo-field,
.agenda-brand-main-fields,
.agenda-brand-subsection {
  min-width: 0;
  padding: 14px;
  background: #f8fbfb;
  border: 1px solid #d8e6e8;
  border-radius: 6px;
}

.agenda-brand-logo-field {
  display: grid;
  align-content: start;
  gap: 8px;
}

.agenda-brand-field-label,
.agenda-brand-logo-field small {
  color: #304b56;
  font-size: 12px;
  font-weight: 700;
}

.agenda-brand-logo-field small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.45;
}

.agenda-brand-logo-preview {
  width: 100%;
  height: 86px;
  display: grid;
  place-items: center;
  padding: 9px;
  overflow: hidden;
  background: #fff;
  border: 1px dashed #b7ced3;
  border-radius: 5px;
}

.agenda-brand-logo-preview img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
}

.agenda-brand-logo-placeholder {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #75929b;
}

.agenda-brand-logo-placeholder svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.agenda-brand-logo-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.agenda-brand-logo-actions .compact-button {
  min-height: 34px;
}

.agenda-brand-logo-actions .text-button {
  min-height: 30px;
  padding: 4px 5px;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.agenda-brand-main-fields {
  align-content: center;
}

.agenda-brand-subsection {
  margin-top: 12px;
}

.agenda-brand-subsection-heading {
  margin-bottom: 12px;
}

.agenda-brand-subsection-heading h4,
.agenda-brand-subsection-heading p {
  margin: 0;
}

.agenda-brand-subsection-heading h4 {
  color: var(--ink);
  font-size: 14px;
}

.agenda-brand-subsection-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.agenda-brand-address-grid {
  grid-template-columns: minmax(150px, 0.7fr) repeat(3, minmax(0, 1fr));
}

.agenda-brand-cep-field > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
}

.agenda-brand-cep-field .icon-button {
  width: 38px;
  min-height: 38px;
}

.agenda-brand-cep-field .icon-button.loading svg {
  animation: patient-record-spin 0.8s linear infinite;
}

.agenda-brand-inline-status {
  margin: 10px 0 0;
  padding: 7px 9px;
  color: #315c67;
  background: #eff8f8;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.45;
}

.agenda-brand-inline-status.success {
  color: #25604f;
  background: #edf8f3;
  border-left-color: #31a683;
}

.agenda-brand-inline-status.error {
  color: #8b2f27;
  background: #fff2f0;
  border-left-color: #ba4b42;
}

.agenda-brand-inline-status[hidden] {
  display: none;
}

.agenda-settings-grid textarea,
.agenda-appointment-fields textarea {
  resize: vertical;
}

.agenda-settings-grid input[readonly] {
  color: #62777f;
  background: #f0f4f5;
}

.agenda-safety-note {
  margin-top: 14px;
  padding: 10px 12px;
  color: #37535d;
  background: #eff7f7;
  border-left: 3px solid #5b96a0;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
}

.agenda-reminder-variables {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  background: #f4f9f8;
  border: 1px solid #d2e3e1;
  border-radius: 6px;
}

.agenda-reminder-variables-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.agenda-reminder-variables-heading strong {
  color: #173e4b;
  font-size: 12px;
}

.agenda-reminder-variables-heading span {
  color: var(--muted);
  font-size: 11px;
}

.agenda-reminder-variable-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.agenda-reminder-variable-list button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 9px;
  color: #174452;
  background: #fff;
  border: 1px solid #bcd6d3;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  text-align: left;
}

.agenda-reminder-variable-list button:hover {
  color: #0a5b66;
  background: #eaf6f4;
  border-color: #72afa8;
}

.agenda-reminder-variable-list button:focus-visible {
  outline: 2px solid #278e92;
  outline-offset: 2px;
}

.agenda-reminder-variable-list code {
  color: #60787f;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  font-weight: 600;
}

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

.agenda-settings-row {
  display: grid;
  align-items: end;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid #e5edef;
}

.agenda-settings-row.hours-row {
  grid-template-columns: minmax(150px, 1fr) 100px 150px 150px;
}

.agenda-settings-row.professional-row {
  grid-template-columns: minmax(180px, 1.4fr) minmax(150px, 1fr) minmax(130px, 0.8fr) 120px 78px 40px;
}

.agenda-settings-row.simple-row {
  grid-template-columns: minmax(220px, 1fr) 80px 40px;
}

.agenda-settings-row.service-row {
  grid-template-columns: minmax(220px, 1fr) 90px 80px 40px;
}

.agenda-settings-row.availability-row {
  grid-template-columns: minmax(180px, 1fr) 150px 120px 120px 80px 40px;
}

.agenda-settings-row.block-row {
  grid-template-columns: minmax(170px, 1fr) 135px 105px 105px minmax(160px, 0.9fr) minmax(150px, 0.8fr) 75px 40px;
}

.agenda-settings-row > strong {
  align-self: center;
  font-size: 13px;
}

.agenda-inline-checkbox,
.agenda-checkbox-field {
  display: flex !important;
  align-items: center;
  gap: 7px !important;
  min-height: 38px;
}

.agenda-inline-checkbox input,
.agenda-checkbox-field input {
  width: 16px !important;
  min-height: 16px !important;
  margin: 0;
}

.danger-icon {
  width: 36px;
  min-height: 36px;
  color: var(--danger);
  font-size: 22px;
}

.agenda-settings-empty {
  margin: 0;
  padding: 18px 0;
  color: var(--muted);
  font-size: 13px;
}

.agenda-integration-list {
  display: grid;
}

.agenda-integration-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 8px 16px;
  padding: 14px 0;
  border-bottom: 1px solid #e2ecee;
}

.agenda-integration-row strong,
.agenda-integration-row p {
  margin: 0;
}

.agenda-integration-row p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.agenda-readiness-badge.pending {
  align-self: start;
  color: #79540f;
  background: #fff0c9;
}

.agenda-readiness-badge.ready {
  background: #278669;
}

.agenda-env-list {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  color: #5c727b;
  font-size: 11px;
}

.agenda-env-list code {
  overflow-wrap: anywhere;
  color: #25414c;
}

.agenda-google-integration-body {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: end;
  gap: 12px;
  padding: 13px 14px;
  background: #f5faf9;
  border: 1px solid #d6e9e5;
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}

.agenda-google-account {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agenda-google-account span,
.agenda-google-account small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.agenda-google-account .agenda-google-sync-error {
  color: #9a3412;
  font-weight: 700;
}

.agenda-google-account strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-google-account.muted {
  grid-column: span 2;
}

.agenda-google-calendar-field {
  display: grid;
  gap: 5px;
  color: #29464f;
  font-size: 11px;
  font-weight: 800;
}

.agenda-google-calendar-field select {
  width: 100%;
  min-height: 38px;
}

.agenda-google-sync-mode {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.agenda-google-sync-mode legend {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: #29464f;
  font-size: 11px;
  font-weight: 800;
}

.agenda-google-sync-mode label {
  position: relative;
  display: grid;
  gap: 3px;
  min-height: 66px;
  padding: 10px 12px 10px 36px;
  border: 1px solid #cfdee2;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.agenda-google-sync-mode label.selected {
  border-color: #2e9d8b;
  background: #edf9f6;
  box-shadow: inset 0 0 0 1px rgba(46, 157, 139, 0.15);
}

.agenda-google-sync-mode input {
  position: absolute;
  top: 14px;
  left: 12px;
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.agenda-google-sync-mode span {
  color: #173b47;
  font-size: 12px;
  font-weight: 800;
}

.agenda-google-sync-mode small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.agenda-google-blocking-option {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 11px 12px;
  background: #fff;
  border: 1px solid #cfdee2;
  border-left: 3px solid #8ca9b1;
  border-radius: 6px;
  cursor: pointer;
}

.agenda-google-blocking-option.selected {
  background: #edf9f6;
  border-color: #79c7b8;
  border-left-color: var(--accent);
}

.agenda-google-blocking-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.agenda-google-blocking-copy strong {
  color: #173b47;
  font-size: 12px;
  font-weight: 800;
}

.agenda-google-blocking-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.agenda-google-blocking-toggle {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
}

.agenda-google-blocking-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.agenda-google-blocking-track {
  position: relative;
  width: 36px;
  height: 20px;
  background: #8fa4aa;
  border-radius: 999px;
  transition: background-color 160ms ease;
}

.agenda-google-blocking-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(10, 35, 45, 0.24);
  transition: transform 160ms ease;
}

.agenda-google-blocking-toggle input:checked + .agenda-google-blocking-track {
  background: #18a89d;
}

.agenda-google-blocking-toggle input:checked + .agenda-google-blocking-track::after {
  transform: translateX(16px);
}

.agenda-google-blocking-option:focus-within {
  outline: 3px solid rgba(30, 150, 141, 0.18);
  outline-offset: 2px;
}

.agenda-integration-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.agenda-integration-actions .compact-button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
}

.agenda-integration-actions .text-button {
  min-height: 30px;
  padding: 4px 6px;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.agenda-integration-actions .text-button:hover {
  text-decoration: underline;
}

/* Modal de agendamento */
.dialog-open {
  overflow: hidden;
}

.agenda-dialog-backdrop {
  overflow-y: auto;
  padding: 24px;
}

.agenda-appointment-dialog {
  width: min(1080px, 100%);
  max-width: 1080px;
  max-height: calc(100vh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
}

.agenda-dialog-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.agenda-dialog-header h2,
.agenda-dialog-header p {
  margin: 0;
}

.agenda-appointment-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 420px;
}

.agenda-appointment-summary {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 20px;
  color: #294650;
  background: #f0f7f7;
  border-right: 1px solid var(--line);
}

.agenda-appointment-summary-content {
  display: grid;
  gap: 8px;
}

.agenda-appointment-summary strong {
  color: var(--ink);
  font-size: 16px;
}

.agenda-appointment-summary span {
  font-size: 12px;
  line-height: 1.5;
}

.agenda-appointment-fields {
  padding: 20px;
}

.agenda-recurrence-create {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe1e4;
  border-radius: 6px;
  background: #f8fbfc;
}

.agenda-recurrence-create[hidden] {
  display: none;
}

.agenda-recurrence-toggle {
  min-height: 24px;
  font-size: 13px;
  font-weight: 800;
}

.agenda-recurrence-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.agenda-recurrence-fields[hidden],
.agenda-recurrence-series-panel[hidden] {
  display: none;
}

.agenda-number-with-unit {
  display: grid;
  grid-template-columns: minmax(88px, 130px) 1fr;
  align-items: center;
  gap: 8px;
}

.agenda-number-with-unit > span {
  color: var(--muted);
  font-size: 11px;
}

.agenda-recurrence-end {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.agenda-recurrence-end legend {
  padding: 0 4px;
  font-size: 11px;
  font-weight: 800;
}

.agenda-recurrence-end label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 11px;
}

.agenda-recurrence-end input {
  width: 15px;
  height: 15px;
}

.agenda-recurrence-preview {
  padding: 9px 10px;
  color: #2b6158;
  background: #eaf7f4;
  border-left: 3px solid #2fa589;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.45;
}

.agenda-recurrence-preview.error {
  color: #8b332d;
  background: #fff1ef;
  border-left-color: #c2564c;
}

.agenda-recurrence-series-panel {
  display: grid;
  gap: 11px;
  margin-top: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #bfdbd5;
  border-radius: 6px;
}

.agenda-recurrence-series-panel > div:first-child {
  display: grid;
  gap: 6px;
}

.agenda-recurrence-series-panel strong {
  font-size: 12px;
  line-height: 1.4;
}

.agenda-recurrence-series-panel label {
  display: grid;
  gap: 5px;
  color: #526b75;
  font-size: 10px;
  font-weight: 800;
}

.agenda-recurrence-series-panel input {
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid #c7d9dd;
  border-radius: 5px;
  background: #fff;
}

.agenda-recurrence-badge {
  justify-self: start;
  padding: 4px 7px;
  color: #176859;
  background: #ddf4ee;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 900;
}

.agenda-recurrence-actions {
  display: grid;
  gap: 7px;
}

.agenda-recurrence-actions button {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 10px;
}

.agenda-move-confirm-dialog {
  width: min(520px, calc(100vw - 32px));
}

.agenda-move-periods {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 4px;
}

.agenda-move-periods div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7fafb;
}

.agenda-move-periods span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.agenda-move-periods strong {
  font-size: 12px;
  line-height: 1.4;
}

.agenda-touch-dragging {
  overflow: hidden;
  user-select: none;
}

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

.agenda-dialog-status {
  margin: 0 18px 12px;
  padding: 9px 11px;
  color: #8b2f27;
  background: #fff2f0;
  border-left: 3px solid #ba4b42;
  border-radius: 4px;
  font-size: 12px;
}

.agenda-dialog-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 12px 18px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.agenda-dialog-actions-spacer {
  flex: 1 1 auto;
}

.subtle-danger {
  color: var(--danger);
  background: #fff;
  border-color: #e4bab5;
}

@media (prefers-reduced-motion: reduce) {
  .agenda-timed-item.devolutiva,
  .agenda-loading span {
    animation: none;
  }
}

@media (max-width: 1100px) {
  .agenda-filter-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-period-toolbar {
    grid-template-columns: 1fr auto;
  }

  .agenda-period-toolbar h3 {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .agenda-settings-row.professional-row,
  .agenda-settings-row.availability-row,
  .agenda-settings-row.block-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agenda-settings-row .danger-icon {
    justify-self: end;
  }

  .agenda-brand-address-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .side-menu {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .side-menu-item {
    flex: 0 0 auto;
    width: auto;
    min-width: 108px;
    min-height: 42px;
    padding: 8px;
    font-size: 12px;
  }

  .side-menu-item span {
    white-space: nowrap;
  }

  .side-menu-item.logout {
    margin-top: 0;
  }

  .agenda-page-header {
    align-items: stretch;
    flex-direction: column;
  }

  .agenda-page-header .primary-button {
    flex: 0 0 auto;
    min-height: 44px;
    height: auto;
    justify-content: center;
    width: 100%;
  }

  .agenda-settings-section .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .agenda-filter-toolbar,
  .agenda-period-toolbar,
  .agenda-settings-grid.two-columns,
  .agenda-brand-address-grid,
  .agenda-settings-row.hours-row,
  .agenda-settings-row.professional-row,
  .agenda-settings-row.simple-row,
  .agenda-settings-row.service-row,
  .agenda-settings-row.availability-row,
  .agenda-settings-row.block-row,
  .agenda-appointment-layout,
  .agenda-list-row {
    grid-template-columns: 1fr;
  }

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

  .agenda-brand-logo-field {
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
  }

  .agenda-brand-logo-field .agenda-brand-field-label,
  .agenda-brand-logo-field small {
    grid-column: 1 / -1;
  }

  .agenda-settings-grid .span-2 {
    grid-column: auto;
  }

  .agenda-reminder-variables-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .agenda-reminder-variable-list button {
    flex: 1 1 180px;
    justify-content: space-between;
  }

  .agenda-period-toolbar h3 {
    grid-column: auto;
    grid-row: auto;
    order: -1;
  }

  .agenda-view-switch {
    justify-self: stretch;
    min-width: 0;
  }

  .agenda-period-actions {
    justify-content: center;
  }

  .agenda-month-grid {
    grid-template-columns: repeat(7, minmax(104px, 1fr));
  }

  .agenda-day-add {
    background: #edf7f5;
    opacity: 1;
  }

  .agenda-list-row {
    justify-items: start;
  }

  .agenda-appointment-summary {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .agenda-dialog-backdrop {
    padding: 8px;
  }

  .agenda-appointment-dialog {
    max-height: calc(100vh - 16px);
  }

  .agenda-dialog-actions {
    flex-wrap: wrap;
  }

  .agenda-dialog-actions-spacer {
    display: none;
  }

  .agenda-dialog-actions button {
    flex: 1 1 150px;
  }

  .agenda-recurrence-fields,
  .agenda-move-periods {
    grid-template-columns: 1fr;
  }

  .agenda-settings-section {
    padding: 16px 14px 22px;
  }

  .agenda-integration-row {
    grid-template-columns: 1fr;
  }

  .agenda-readiness-badge {
    justify-self: start;
  }

  .agenda-env-list {
    grid-column: auto;
  }

  .agenda-google-integration-body {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .agenda-google-account.muted {
    grid-column: auto;
  }

  .agenda-google-sync-mode {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .agenda-integration-actions {
    grid-column: auto;
    justify-content: flex-start;
  }
}

/* Ficha unificada do paciente */
.agenda-open-patient-record {
  width: 100%;
  min-height: 38px;
  margin-top: 8px;
  justify-content: center;
  color: var(--primary);
  background: #fff;
  border-color: #b9d7dc;
}

.patient-record-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1250;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgb(11 31 58 / 0.46);
}

.patient-record-backdrop[hidden] {
  display: none;
}

.patient-record-dialog {
  width: min(1280px, 100%);
  height: min(900px, calc(100dvh - 40px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #bfd5da;
  border-radius: 8px;
  box-shadow: 0 24px 72px rgb(11 31 58 / 0.24);
}

.patient-record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.patient-record-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.patient-record-heading h2,
.patient-record-heading p {
  margin: 0;
}

.patient-record-heading h2 {
  overflow: hidden;
  font-size: 20px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-record-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  border-radius: 50%;
  font-size: 16px;
  font-weight: 800;
}

.patient-record-identity {
  overflow: hidden;
  margin-top: 3px !important;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-record-tabs {
  display: flex;
  gap: 2px;
  min-height: 48px;
  padding: 0 18px;
  overflow-x: auto;
  background: #f8fbfc;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.patient-record-tabs button {
  position: relative;
  flex: 0 0 auto;
  min-width: 116px;
  min-height: 47px;
  padding: 10px 14px;
  color: #4d6873;
  background: transparent;
  border: 0;
  border-radius: 0;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.patient-record-tabs button::after {
  content: "";
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 3px;
  background: transparent;
  border-radius: 3px 3px 0 0;
}

.patient-record-tabs button:hover {
  color: var(--primary);
  background: #eef6f7;
}

.patient-record-tabs button.active {
  color: var(--primary);
  background: #fff;
}

.patient-record-tabs button.active::after {
  background: var(--accent);
}

.patient-record-message {
  margin: 10px 18px 0;
  padding: 9px 11px;
  color: #1f5f50;
  background: #edf9f5;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
}

.patient-record-message.error {
  color: #8b2f27;
  background: #fff2f0;
  border-left-color: var(--danger);
}

.patient-record-content {
  min-height: 0;
  overflow: auto;
  padding: 18px;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.patient-record-content:focus {
  outline: none;
}

.patient-record-loading,
.patient-record-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.patient-record-loading::before {
  content: "";
  width: 26px;
  height: 26px;
  border: 3px solid #d8e8eb;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: patient-record-spin 0.8s linear infinite;
}

.patient-record-empty strong {
  color: var(--ink);
}

.patient-record-empty span {
  max-width: 520px;
  line-height: 1.55;
}

.patient-record-empty.error strong {
  color: var(--danger);
}

@keyframes patient-record-spin {
  to { transform: rotate(360deg); }
}

.patient-record-section {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.patient-record-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.patient-record-section-header h3,
.patient-record-section-header p,
.patient-record-section-header span {
  margin: 0;
}

.patient-record-section-header h3 {
  font-size: 17px;
  line-height: 1.3;
}

.patient-record-section-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.patient-record-actions,
.patient-record-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.patient-record-editor-actions {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  margin: 4px -18px -18px;
  padding: 12px 18px;
  background: rgb(255 255 255 / 0.96);
  border-top: 1px solid var(--line);
}

.patient-record-details-form,
.patient-record-note-form,
.patient-record-document-form {
  display: grid;
  gap: 18px;
}

.patient-record-details-section fieldset {
  min-width: 0;
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid #e6eff1;
}

.patient-record-details-section fieldset:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.patient-record-details-section legend {
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.patient-record-field-grid {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.patient-record-field-grid.four-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.patient-record-field-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.patient-record-field,
.patient-record-inline-filter,
.patient-attachment-file {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.patient-record-field input,
.patient-record-field select,
.patient-record-field textarea,
.patient-record-inline-filter select,
.patient-appointment-filter input,
.patient-appointment-filter select,
.patient-attachment-file input {
  width: 100%;
  min-width: 0;
}

.patient-record-field textarea,
.patient-document-content {
  line-height: 1.55;
  resize: vertical;
}

.patient-record-field.full-width,
.patient-record-field.span-3,
.patient-record-checkbox.span-3 {
  grid-column: 1 / -1;
}

.patient-record-field.span-2,
.patient-record-checkbox.span-2 {
  grid-column: span 2;
}

.patient-record-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-top: 19px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.patient-record-checkbox input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.patient-record-details-form.readonly input,
.patient-record-details-form.readonly select,
.patient-record-details-form.readonly textarea {
  color: #536b75;
  background: #eef3f4;
  border-color: #dbe5e7;
  box-shadow: none;
  cursor: not-allowed;
}

.patient-record-details-form.editing input:not([readonly]),
.patient-record-details-form.editing select:not(:disabled),
.patient-record-details-form.editing textarea:not([readonly]) {
  background: #fff;
}

.patient-record-legend-row,
.patient-record-responsible header,
.patient-record-editor-header,
.patient-record-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.patient-record-responsible {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #f8fbfc;
  border-left: 3px solid #badbe0;
}

.patient-record-inline-filter {
  grid-template-columns: auto minmax(150px, 220px);
  align-items: center;
}

.patient-appointment-filter-bar {
  min-width: min(100%, 610px);
  display: grid;
  grid-template-columns: repeat(3, minmax(128px, 1fr)) auto;
  align-items: end;
  gap: 8px;
}

.patient-appointment-filter {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 750;
}

.patient-appointments-export-button {
  white-space: nowrap;
}

.patient-appointments-export-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: currentColor;
}

.patient-record-filter-warning {
  margin: -4px 0 0;
  padding: 9px 11px;
  color: #8d2f27;
  background: #fff4f2;
  border-left: 3px solid #c55a50;
  font-size: 12px;
  font-weight: 700;
}

.patient-appointment-list,
.patient-attachment-list {
  display: grid;
  gap: 10px;
}

.patient-appointment-card {
  display: grid;
  grid-template-columns: minmax(126px, 0.22fr) minmax(0, 1fr) auto;
  align-items: stretch;
  column-gap: 16px;
  min-height: 82px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #8ca5ad;
  border-radius: 6px;
}

.patient-appointment-card.confirmed,
.patient-appointment-card.completed {
  border-left-color: var(--accent);
}

.patient-appointment-card.canceled,
.patient-appointment-card.archived-canceled,
.patient-appointment-card.no-show {
  border-left-color: #c55a50;
}

.patient-appointment-date {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding-right: 16px;
  color: var(--ink);
  border-right: 1px solid var(--line);
  font-size: 12px;
  font-style: normal;
}

.patient-appointment-date strong {
  font-size: 17px;
  line-height: 1.2;
  white-space: nowrap;
}

.patient-appointment-main {
  grid-column: 2;
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
}

.patient-appointment-main strong,
.patient-appointment-main span {
  overflow-wrap: anywhere;
}

.patient-appointment-main > span {
  color: var(--muted);
  font-size: 12px;
}

.patient-record-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.patient-record-badges span,
.patient-record-status-pill,
.patient-record-list-title i {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 3px 7px;
  color: #4d6873;
  background: #edf3f4;
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.patient-record-status-pill.finalized,
.patient-record-list-title i.finalized {
  color: #17644f;
  background: #e6f6f0;
}

.patient-record-status-pill.draft,
.patient-record-list-title i.draft {
  color: #805d13;
  background: #fff5d9;
}

.patient-appointment-actions {
  grid-column: 3;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  white-space: nowrap;
}

.patient-record-split-layout,
.patient-record-document-layout {
  min-height: 510px;
  display: grid;
  grid-template-columns: minmax(230px, 0.32fr) minmax(0, 1fr);
  gap: 16px;
}

.patient-record-list-panel {
  min-width: 0;
  max-height: 620px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-right: 8px;
  overflow: auto;
  border-right: 1px solid var(--line);
}

.patient-record-editor-panel {
  min-width: 0;
}

.patient-document-create-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
  padding: 2px 8px 16px 0;
  border-bottom: 1px solid var(--line);
}

.patient-document-create-panel h4,
.patient-document-create-panel p,
.patient-document-list-heading h4,
.patient-document-editor-heading h4,
.patient-document-editor-heading p {
  margin: 0;
}

.patient-document-create-panel > .primary-button {
  justify-content: center;
}

.patient-document-create-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.patient-document-list-heading,
.patient-document-editor-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.patient-document-list-heading {
  min-height: 34px;
}

.patient-document-list-heading .text-button {
  padding: 5px 4px;
  color: var(--primary);
  background: transparent;
  border: 0;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.patient-document-editor-heading {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.patient-document-editor-heading h4 {
  margin-top: 2px;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.patient-document-source {
  max-width: 44%;
  padding: 5px 8px;
  color: #4d6873;
  background: #eef5f6;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  overflow-wrap: anywhere;
  text-align: right;
}

.patient-record-list-item {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid transparent;
  border-radius: 5px;
  text-align: left;
  cursor: pointer;
}

.patient-record-list-item:nth-child(odd) {
  background: #f4f8f9;
}

.patient-record-list-item:hover,
.patient-record-list-item.active {
  background: #edf8f5;
  border-color: #a9d5ca;
}

.patient-record-list-title {
  min-width: 0;
}

.patient-record-list-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-record-list-item > span:not(.patient-record-list-title),
.patient-record-list-empty {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.patient-record-list-empty {
  margin: 0;
  padding: 16px 10px;
}

.patient-record-note-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 12px;
}

.patient-record-field-heading,
.patient-record-capture-controls,
.patient-record-capture-microphone,
.patient-record-capture-button {
  display: flex;
  align-items: center;
}

.patient-record-field-heading {
  min-height: 34px;
  justify-content: space-between;
  gap: 10px;
}

.patient-record-field-heading > label {
  font-weight: 700;
}

.patient-record-capture-controls {
  min-width: 0;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.patient-record-capture-microphone {
  gap: 6px;
  color: #526c76;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.patient-record-capture-microphone input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.patient-record-capture-button {
  min-width: 154px;
  min-height: 34px;
  justify-content: center;
  gap: 7px;
}

.patient-record-capture-button svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  fill: currentColor;
}

.patient-record-capture-button.recording {
  color: #8f2e28;
  background: #fff0ef;
  border-color: #e6aaa5;
  box-shadow: 0 0 0 2px rgb(184 59 50 / 0.08);
}

.patient-record-capture-button.processing {
  color: var(--primary);
  background: #edf7f7;
  border-color: #a8d4d7;
}

.patient-record-capture-status {
  min-height: 30px;
  margin: 0;
  padding: 7px 9px;
  color: #315c67;
  background: #eff8f8;
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
}

.patient-record-capture-status[hidden] {
  display: none;
}

.patient-record-capture-spinner {
  animation: patient-record-spin 0.8s linear infinite;
}

.patient-record-observation-field {
  position: relative;
}

.patient-record-mic {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: #fff;
}

.patient-record-mic.recording {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.patient-document-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 7px;
  background: #f4f8f9;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.patient-document-toolbar button,
.patient-document-toolbar select {
  min-height: 34px;
}

.patient-document-content {
  min-height: 320px;
  font-family: Calibri, Arial, sans-serif;
}

.patient-document-template-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1330;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(11 31 58 / 0.58);
}

.patient-document-template-backdrop[hidden] {
  display: none;
}

.patient-document-template-dialog {
  width: min(1180px, 100%);
  height: min(840px, calc(100dvh - 48px));
  min-height: 520px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--ink);
  background: #fff;
  border: 1px solid #b9d4d9;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgb(11 31 58 / 0.3);
}

.patient-document-template-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.patient-document-template-header h2,
.patient-document-template-header p {
  margin: 0;
}

.patient-document-template-header h2 {
  font-size: 20px;
}

.patient-document-template-header > div > p:last-child {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.patient-document-template-content {
  min-height: 0;
  padding: 18px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.patient-document-template-content:focus {
  outline: none;
}

.patient-document-template-layout {
  min-height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(310px, 0.8fr);
  gap: 20px;
}

.patient-document-template-form {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 15px;
}

.patient-document-template-form-heading,
.patient-document-template-list-heading,
.patient-document-template-item > span,
.patient-document-template-item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.patient-document-template-form-heading h3,
.patient-document-template-form-heading p,
.patient-document-template-list-heading h3,
.patient-document-template-list-heading p {
  margin: 0;
}

.patient-document-template-active {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.patient-document-template-active input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.patient-document-variable-section {
  display: grid;
  gap: 9px;
  padding: 12px;
  background: #f4f9fa;
  border-left: 3px solid #82c9bd;
}

.patient-document-variable-section > div:first-child {
  display: grid;
  gap: 2px;
}

.patient-document-variable-section span {
  color: var(--muted);
  font-size: 11px;
}

.patient-document-variable-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.patient-document-variable {
  min-height: 30px;
  padding: 5px 8px;
  color: #174f5f;
  background: #fff;
  border: 1px solid #bdd9dd;
  border-radius: 4px;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.patient-document-variable:hover,
.patient-document-variable:focus-visible {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.patient-document-template-form textarea {
  min-height: 330px;
  line-height: 1.55;
  resize: vertical;
}

.patient-document-template-form .patient-record-editor-actions {
  bottom: -18px;
}

.patient-document-template-form .patient-record-editor-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 11px;
}

.patient-document-template-list {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.patient-document-template-list-heading {
  min-height: 45px;
  margin-bottom: 2px;
}

.patient-document-template-list-heading > span {
  min-width: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: #eaf5f5;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
}

.patient-document-template-item {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid #a9c4ca;
  border-radius: 5px;
}

.patient-document-template-item.active {
  background: #f0faf7;
  border-color: #9cd1c6;
  border-left-color: var(--accent);
}

.patient-document-template-select {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.patient-document-template-select > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.patient-document-template-select strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-document-template-select i {
  flex: 0 0 auto;
  padding: 3px 6px;
  color: #25644f;
  background: #e5f5ef;
  border-radius: 3px;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
}

.patient-document-template-select i.inactive {
  color: #725f35;
  background: #f4efe2;
}

.patient-document-template-select small {
  color: var(--muted);
  font-size: 10px;
}

.patient-document-template-select p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #4f6872;
  font-size: 11px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.patient-document-template-item-actions {
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid #e6eff1;
}

.patient-attachment-upload {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  align-items: start;
  gap: 12px;
  padding: 14px;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.patient-attachment-file input,
.patient-attachment-upload .patient-record-field input {
  min-height: 42px;
  padding: 5px 8px;
  background: #fff;
}

.patient-attachment-file input::file-selector-button {
  min-height: 30px;
  margin-right: 10px;
  padding: 5px 10px;
  color: var(--primary);
  background: #eaf4f5;
  border: 1px solid #bfd8dc;
  border-radius: 4px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.patient-attachment-upload-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.patient-attachment-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.patient-attachment-card:nth-child(even) {
  background: #f7fafb;
}

.patient-attachment-card > div:not(.patient-record-actions) {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.patient-attachment-card strong,
.patient-attachment-card span {
  overflow-wrap: anywhere;
}

.patient-attachment-card div > span {
  color: var(--muted);
  font-size: 11px;
}

.patient-attachment-card p {
  margin: 2px 0 0;
  color: #405a65;
  font-size: 12px;
  line-height: 1.45;
}

.patient-attachment-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--primary);
  background: #eaf4f5;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 900;
}

@media (prefers-reduced-motion: reduce) {
  .patient-record-loading::before {
    animation: none;
  }
}

@media (max-width: 980px) {
  .patient-record-field-grid.four-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .patient-record-note-grid {
    grid-template-columns: 1fr;
  }

  .patient-document-template-layout {
    grid-template-columns: 1fr;
  }

  .patient-document-template-list {
    padding: 18px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .patient-record-field-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .patient-record-capture-controls {
    width: 100%;
    justify-content: space-between;
  }

  .patient-attachment-upload {
    grid-template-columns: 1fr 1fr;
  }

  .patient-attachment-upload-actions {
    grid-column: 1 / -1;
  }

  .patient-appointment-card {
    grid-template-columns: minmax(126px, 0.28fr) minmax(0, 1fr) auto;
  }

  .patient-appointment-filter-bar {
    min-width: min(100%, 430px);
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .patient-record-backdrop {
    padding: 0;
  }

  .patient-document-template-backdrop {
    padding: 0;
  }

  .patient-record-dialog {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .patient-document-template-dialog {
    width: 100%;
    height: 100dvh;
    min-height: 0;
    border: 0;
    border-radius: 0;
  }

  .patient-document-template-header,
  .patient-document-template-content {
    padding-inline: 12px;
  }

  .patient-record-header {
    min-height: 74px;
    padding: 10px 12px;
  }

  .patient-record-heading h2 {
    max-width: calc(100vw - 112px);
    font-size: 17px;
  }

  .patient-record-avatar {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .patient-record-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    padding: 0 8px;
  }

  .patient-record-tabs button {
    flex: 1 1 112px;
    min-width: 0;
    padding-inline: 10px;
  }

  .patient-record-content {
    padding: 14px 12px;
  }

  .patient-record-message {
    margin-inline: 12px;
  }

  .patient-record-section-header,
  .patient-record-editor-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .patient-record-section-header .patient-record-actions,
  .patient-record-section-header .patient-appointment-filter-bar,
  .patient-record-section-header > button {
    width: 100%;
  }

  .patient-record-section-header .patient-record-actions button,
  .patient-record-section-header > button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .patient-record-field-grid.four-columns,
  .patient-record-field-grid.three-columns,
  .patient-record-field-grid.two-columns,
  .patient-record-note-grid,
  .patient-record-split-layout,
  .patient-record-document-layout,
  .patient-attachment-upload,
  .patient-appointment-card,
  .patient-attachment-card {
    grid-template-columns: 1fr;
  }

  .patient-record-field.span-2,
  .patient-record-checkbox.span-2 {
    grid-column: auto;
  }

  .patient-record-checkbox {
    padding-top: 0;
  }

  .patient-record-inline-filter {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .patient-appointment-filter-bar {
    grid-template-columns: 1fr;
  }

  .patient-appointment-date {
    grid-row: auto;
    grid-template-columns: auto auto;
    justify-content: start;
    justify-items: start;
    gap: 5px;
    padding: 0 0 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .patient-appointment-date strong {
    font-size: 15px;
  }

  .patient-appointment-main,
  .patient-appointment-actions {
    grid-column: auto;
  }

  .patient-appointment-actions,
  .patient-record-actions,
  .patient-record-editor-actions {
    justify-content: stretch;
  }

  .patient-appointment-actions button,
  .patient-record-editor-actions button {
    flex: 1 1 140px;
  }

  .patient-record-split-layout,
  .patient-record-document-layout {
    min-height: 0;
  }

  .patient-record-list-panel {
    max-height: 360px;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .patient-document-editor-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .patient-document-source {
    max-width: 100%;
    text-align: left;
  }

  .patient-record-editor-actions {
    bottom: -14px;
    margin: 4px -12px -14px;
    padding: 10px 12px;
  }

  .patient-attachment-card .patient-record-actions {
    justify-content: flex-start;
  }

  .patient-attachment-upload-actions,
  .patient-attachment-upload-actions button {
    width: 100%;
  }

  .patient-attachment-upload-actions button {
    justify-content: center;
  }
}

.plans-page {
  display: grid;
  gap: 24px;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.plans-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 390px);
  align-items: end;
  gap: 24px;
  padding: 4px 2px 0;
}

.plans-page-header h2,
.plans-comparison-heading h3 {
  margin: 2px 0 6px;
}

.plans-page-header > div > p:last-child,
.plans-comparison-heading p,
.plan-card-header p,
.plans-commercial-note {
  color: var(--muted);
}

.plans-preview-note {
  margin: 0;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: #eef9f7;
  color: #184c54;
  font-size: 13px;
  line-height: 1.5;
}

.plans-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}

.plan-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.plan-card.featured {
  border-color: #8bc9c0;
  box-shadow: inset 0 3px 0 var(--accent);
}

.plan-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 83, 99, 0.13);
}

.plan-card-header {
  display: grid;
  gap: 5px;
}

.plan-card-header h3,
.plan-card-header p,
.plan-card-step,
.plan-price,
.plan-professional-note {
  margin: 0;
}

.plan-card-header h3 {
  color: var(--primary-strong);
  font-size: 19px;
  line-height: 1.25;
}

.plan-card-header p:last-child {
  min-height: 42px;
  font-size: 13px;
  line-height: 1.55;
}

.plan-card-step {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.plan-recommended-badge {
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 5px;
  background: #dff6f1;
  color: #075c58;
  font-size: 11px;
  font-weight: 800;
}

.plan-price {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.plan-price strong {
  color: var(--primary-strong);
  font-size: 27px;
  line-height: 1;
}

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

.plan-feature-list {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plan-feature-list li {
  position: relative;
  padding-left: 22px;
  color: #294756;
  font-size: 13px;
  line-height: 1.45;
}

.plan-feature-list li::before {
  position: absolute;
  top: 0;
  left: 0;
  color: #16806f;
  content: "✓";
  font-weight: 900;
}

.plan-professional-note {
  padding: 10px 11px;
  border-left: 3px solid #7b88a5;
  background: #f5f7fa;
  color: #42566b;
  font-size: 12px;
  line-height: 1.45;
}

.plan-select-button {
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-top: auto;
  gap: 12px;
}

.plan-select-button strong {
  font-size: 12px;
}

.plan-select-button[aria-pressed="true"] {
  border-color: var(--primary);
  background: #e9f6f4;
  color: var(--primary);
}

.plans-selection-message {
  margin: -6px 0 0;
  padding: 10px 12px;
  border: 1px solid #a8d8d0;
  border-radius: 6px;
  background: #effaf7;
  color: #0d5b58;
  font-size: 13px;
  font-weight: 700;
}

.plans-comparison {
  display: grid;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.plans-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
}

.plans-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

.plans-table th,
.plans-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.plans-table th:first-child {
  width: 40%;
  text-align: left;
}

.plans-table thead th {
  background: #edf5f6;
  color: var(--primary-strong);
  font-size: 12px;
}

.plans-table tbody tr:nth-child(even) {
  background: #f9fbfc;
}

.plans-table tbody tr:last-child th,
.plans-table tbody tr:last-child td {
  border-bottom: 0;
}

.plan-check {
  color: #117563;
  font-weight: 800;
}

.plan-unavailable {
  color: #91a1a8;
}

.plans-commercial-note {
  margin: 0;
  max-width: 860px;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 1280px) {
  .plans-page-header {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .plan-card:last-child {
    grid-column: 1 / -1;
  }

  .plan-card-header p:last-child {
    min-height: 0;
  }
}

@media (max-width: 700px) {
  .plans-page {
    gap: 18px;
  }

  .plans-grid {
    grid-template-columns: 1fr;
  }

  .plan-card:last-child {
    grid-column: auto;
  }

  .plan-card {
    padding: 16px;
  }

  .plans-preview-note {
    padding: 10px 12px;
  }
}

/* Avynela public identity */
.login-screen {
  background: var(--sand);
}

.login-card {
  background: var(--bg);
  border-color: #d4d7cf;
}

.login-logo {
  width: min(300px, 100%);
  margin-inline: auto;
}

.login-form input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(147, 170, 155, 0.22);
}

.sidebar {
  color: var(--bg);
  background: var(--primary);
  border-right-color: #163b3d;
}

.sidebar-brand {
  border-bottom-color: rgba(250, 248, 244, 0.2);
}

.brand-logo {
  width: min(188px, 100%);
}

.side-menu-item {
  color: #eef3ef;
}

.side-menu-item:hover,
.side-menu-item.active {
  color: var(--ink);
  background: var(--sand);
  border-color: rgba(238, 231, 220, 0.84);
}

.side-menu-item.logout {
  color: #f1c7bd;
}

.side-menu-item.logout:hover,
.side-menu-item.logout.active {
  color: #6f342d;
  background: #f4ded8;
  border-color: #dca99d;
}

.primary-button:hover {
  background: #163b3d;
}

.eyebrow {
  color: #60716f;
}

.panel,
.topbar,
.report-section-pane,
.patient-directory-item,
.instrument-library-item,
.agenda-settings-panel,
.whatsapp-assistant-item {
  border-color: var(--line);
}

.report-document-tab.needs-update {
  border-color: rgba(147, 170, 155, 0.72);
  background: #edf1ec;
  box-shadow: 0 0 0 1px rgba(147, 170, 155, 0.18);
}

.report-document-tab.active.needs-update {
  background: var(--primary);
  box-shadow: 0 0 0 2px rgba(147, 170, 155, 0.42);
}

.report-section-entry-actions [data-assist-manual-section-entry]:not([hidden]) {
  color: var(--primary);
  background: var(--accent-soft);
  border-color: rgba(147, 170, 155, 0.62);
  box-shadow: 0 0 0 1px rgba(147, 170, 155, 0.18);
}

.report-section-entry-actions [data-assist-manual-section-entry]:not([hidden]):hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(147, 170, 155, 0.26);
}

@media (max-width: 900px) {
  .sidebar {
    border-bottom-color: #163b3d;
  }

  .sidebar-brand {
    justify-content: flex-start;
  }

  .brand-logo {
    width: min(170px, 56vw);
  }
}
