:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --text: #172024;
  --muted: #66757b;
  --line: #d9e2e2;
  --right: #d83b3b;
  --left: #2372d9;
  --accent: #0f766e;
  --accent-2: #e9b44c;
  --shadow: 0 18px 48px rgba(25, 45, 48, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

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

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

.login-screen {
  align-items: center;
  background:
    radial-gradient(circle at 18% 18%, rgba(15, 118, 110, 0.12), transparent 32%),
    #ffffff;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: #ffffff;
  border: 1px solid rgba(15, 118, 110, 0.16);
  border-radius: 8px;
  box-shadow: 0 22px 70px rgba(25, 45, 48, 0.14);
  display: grid;
  gap: 22px;
  max-width: 440px;
  padding: 34px;
  width: min(100%, 440px);
}

.login-card img {
  height: auto;
  width: min(250px, 80%);
}

.login-card h1 {
  font-size: 1.65rem;
  margin-bottom: 8px;
}

.login-card p,
.login-form p {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

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

.login-form .primary-button {
  min-height: 46px;
  width: 100%;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

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

.dashboard-shell {
  display: grid;
  grid-template-columns: clamp(240px, 18vw, 300px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.88);
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 32px rgba(25, 45, 48, 0.05);
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 100vh;
  padding: 22px 18px;
  min-width: 0;
}

.sidebar-brand {
  align-items: center;
  display: grid;
  gap: 14px;
  grid-template-columns: 38px 1fr;
  min-height: 46px;
}

.sidebar-brand img {
  height: 42px;
  max-width: 176px;
  object-fit: contain;
}

.menu-button,
.notification-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.menu-button svg,
.notification-button svg,
.nav-item svg,
.logout-button svg,
.metric-card svg {
  width: 21px;
  height: 21px;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.nav-item,
.logout-button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: #526169;
  cursor: pointer;
  display: flex;
  gap: 14px;
  min-height: 54px;
  padding: 0 18px;
  text-align: left;
  width: 100%;
}

.nav-item span,
.logout-button span {
  font-weight: 800;
}

.nav-item.is-active {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.14), rgba(15, 118, 110, 0.06));
  color: var(--accent);
}

.nav-item:hover,
.logout-button:hover {
  background: rgba(15, 118, 110, 0.08);
  color: var(--accent);
}

.logout-button {
  margin-top: auto;
}

.main-shell {
  min-width: 0;
}

.dashboard-topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 78px;
  padding: 0 28px;
}

.topbar-user {
  align-items: center;
  display: flex;
  gap: 14px;
}

.topbar-user strong,
.topbar-user span {
  display: block;
}

.topbar-user strong {
  font-size: 0.92rem;
}

.topbar-user span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.doctor-avatar {
  align-items: center;
  background: linear-gradient(135deg, #0f766e, #47a67f);
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 0.78rem;
  font-weight: 900;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.view-section {
  display: none;
}

.view-section.is-visible {
  display: block;
}

.dashboard-content,
.patients-page,
.agenda-page,
.exam-history-page,
.exam-header,
#examView .layout,
#examView .exam-selection-screen,
#examView .exam-execution-screen {
  margin: 0;
  max-width: none;
  min-width: 0;
  padding-left: clamp(22px, 3vw, 52px);
  padding-right: clamp(22px, 3vw, 52px);
}

.dashboard-content {
  padding-bottom: 42px;
  padding-top: clamp(24px, 3vw, 40px);
}

.patients-page {
  padding-bottom: 42px;
  padding-top: clamp(24px, 3vw, 40px);
}

.agenda-page {
  padding-bottom: 42px;
  padding-top: clamp(24px, 3vw, 40px);
}

.exam-history-page {
  display: grid;
  gap: 18px;
  padding: 32px 42px 52px;
}

.exam-history-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.exam-history-filter-card,
.exam-history-results-card {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.exam-history-filter-grid {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(320px, 1fr) minmax(220px, 280px) auto;
}

.exam-history-filter-grid select {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 800;
  min-height: 44px;
  padding: 0 12px;
}

.users-page {
  padding: clamp(24px, 3vw, 40px) clamp(22px, 3vw, 52px) 42px;
}

.report-templates-page {
  padding: clamp(24px, 3vw, 40px) clamp(22px, 3vw, 52px) 42px;
}

.report-templates-layout {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(320px, 0.72fr) minmax(580px, 1.5fr);
}

.settings-page {
  display: grid;
  gap: 24px;
  padding: 32px 42px 52px;
}

.settings-tabs {
  align-items: center;
  border-bottom: 1px solid #d7e2e2;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 0 0 10px;
}

.settings-tab {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: #526270;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  min-height: 42px;
  padding: 0 14px;
  white-space: nowrap;
}

.settings-tab.is-active {
  border-bottom-color: #087f65;
  color: #087f65;
}

.settings-panel {
  display: none;
}

.settings-panel.is-active {
  display: grid;
  gap: 18px;
}

.settings-equipment-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(420px, 0.9fr) minmax(520px, 1.1fr);
}

.settings-card,
.settings-info-card {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(15, 43, 55, 0.04);
}

.settings-card {
  padding: 20px;
}

.settings-card-header {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.settings-card h2,
.settings-info-card h3 {
  color: #10202d;
  font-size: 17px;
  margin: 0;
}

.settings-main-equipment-card {
  position: relative;
}

.main-equipment-body {
  align-items: stretch;
  display: grid;
  gap: 22px;
  grid-template-columns: 170px minmax(0, 1fr);
}

.equipment-illustration {
  align-items: center;
  background: linear-gradient(150deg, #edf8f3, #dff3ec);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  min-height: 236px;
}

.equipment-illustration svg {
  fill: #f8fbfb;
  stroke: #087f65;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  width: 132px;
}

.equipment-form {
  display: grid;
  gap: 12px;
}

.equipment-form label,
.settings-placeholder-grid label,
.settings-full-label {
  color: #526270;
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
}

.equipment-form input,
.settings-placeholder-grid input,
.settings-placeholder-grid select,
.settings-full-label textarea {
  background: #fff;
  border: 1px solid #d5e1e1;
  border-radius: 8px;
  color: #10202d;
  font: inherit;
  min-height: 42px;
  padding: 10px 12px;
}

.equipment-form input:disabled,
.settings-placeholder-grid input:disabled {
  background: #f8fbfb;
  color: #22313d;
}

.equipment-validity-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.equipment-validity-row span {
  color: #526270;
  font-size: 13px;
  font-weight: 800;
}

.equipment-validity-row strong {
  color: #087f65;
}

.settings-edit-equipment {
  margin-top: 18px;
  width: fit-content;
}

.settings-form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}

.settings-table-wrap {
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  overflow-x: auto;
}

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

.settings-table th,
.settings-table td {
  border-bottom: 1px solid #e4eded;
  color: #22313d;
  font-size: 14px;
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.settings-table th {
  background: #fbfdfd;
  color: #10202d;
  font-size: 12px;
  font-weight: 900;
}

.settings-table td span {
  color: #657682;
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

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

.settings-equipment-table {
  min-width: 1040px;
}

.settings-status-pill {
  align-items: center;
  background: #eef4f4;
  border-radius: 999px;
  color: #526270;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  justify-content: center;
  padding: 7px 12px;
}

.settings-status-pill.is-valid {
  background: #dff5e9;
  color: #087f65;
}

.settings-status-pill.is-warning {
  background: #fff1d8;
  color: #b86b00;
}

.settings-status-pill.is-danger {
  background: #ffe4e3;
  color: #d72f2f;
}

.settings-row-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.settings-row-actions button {
  background: #fff;
  border: 1px solid #c8dddd;
  border-radius: 8px;
  color: #087f65;
  cursor: pointer;
  font-weight: 900;
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.settings-row-actions .danger-action {
  border-color: #ffd2d0;
  color: #df3030;
}

.settings-state-text,
.settings-muted-action {
  color: #657682;
  font-size: 13px;
  font-weight: 800;
  margin: 12px 0 0;
}

.settings-info-card {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(240px, 1fr) minmax(420px, 1.2fr);
  padding: 22px;
}

.settings-info-icon {
  align-items: center;
  background: #087f65;
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-size: 22px;
  font-weight: 900;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.settings-info-card p {
  color: #526270;
  margin: 6px 0 0;
}

.settings-status-legend {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-status-legend span {
  display: grid;
  gap: 3px;
  grid-template-columns: 24px 1fr;
}

.settings-status-legend small {
  color: #657682;
  grid-column: 2;
}

.status-dot {
  border-radius: 50%;
  display: inline-block;
  grid-row: span 2;
  height: 24px;
  width: 24px;
}

.status-ok {
  background: #087f65;
}

.status-warning {
  background: #ee9b00;
}

.status-danger {
  background: #ef4444;
}

.settings-placeholder-card {
  min-height: 220px;
}

.settings-placeholder-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.settings-check-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 18px;
}

.settings-check-grid label {
  align-items: center;
  background: #f8fbfb;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 14px;
}

.settings-modal {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 70;
}

.settings-modal.is-open {
  display: block;
}

.settings-modal-panel {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(15, 43, 55, 0.18);
  display: grid;
  gap: 20px;
  left: 50%;
  max-width: 760px;
  padding: 24px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(calc(100vw - 32px), 760px);
  z-index: 2;
}

.settings-modal-panel header,
.settings-modal-panel footer {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.settings-modal-panel h2 {
  margin: 0;
}

.settings-modal-panel p {
  color: #657682;
  margin: 4px 0 0;
}

.settings-full-label textarea {
  min-height: 110px;
  resize: vertical;
}

@media (max-width: 1180px) {
  .settings-equipment-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .settings-page {
    padding: 24px;
  }

  .main-equipment-body,
  .settings-info-card {
    grid-template-columns: 1fr;
  }

  .equipment-illustration {
    min-height: 160px;
  }

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

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

  .settings-placeholder-grid,
  .settings-check-grid {
    grid-template-columns: 1fr;
  }

  .settings-card-header,
  .settings-form-actions,
  .settings-modal-panel header,
  .settings-modal-panel footer {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Audiometria tonal: modo de trabalho amplo para desktop */
.dashboard-shell,
.sidebar {
  transition: grid-template-columns 180ms ease, width 180ms ease, padding 180ms ease;
}

.dashboard-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.dashboard-shell.sidebar-collapsed .sidebar {
  padding-left: 10px;
  padding-right: 10px;
}

.dashboard-shell.sidebar-collapsed .sidebar-brand {
  grid-template-columns: 1fr;
}

.dashboard-shell.sidebar-collapsed .sidebar-brand img,
.dashboard-shell.sidebar-collapsed .nav-item span,
.dashboard-shell.sidebar-collapsed .logout-button span {
  display: none;
}

.dashboard-shell.sidebar-collapsed .menu-button,
.dashboard-shell.sidebar-collapsed .nav-item,
.dashboard-shell.sidebar-collapsed .logout-button {
  justify-content: center;
}

body.tonal-exam-mode #examView .exam-execution-screen {
  padding: 14px 16px 24px;
}

body.tonal-exam-mode #examView > .exam-header {
  display: none;
}

body.tonal-exam-mode .dashboard-topbar {
  min-height: 62px;
}

.tonal-control-strip {
  grid-template-columns: auto auto minmax(430px, 1fr) auto;
  padding: 10px 12px;
}

.tonal-control-group {
  align-items: flex-start !important;
  flex-direction: column;
  gap: 5px !important;
}

.tonal-control-strip .segmented-control button {
  min-height: 32px;
  padding: 0 14px;
}

.tonal-control-strip .frequency-pills {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}

.tonal-control-strip .frequency-pills span {
  flex-basis: 100%;
}

.tonal-control-strip .frequency-pills b {
  align-items: center;
  border: 1px solid #86cbb7;
  border-radius: 6px;
  color: #263b38;
  display: inline-flex;
  font-size: 0.75rem;
  height: 31px;
  justify-content: center;
  min-width: 38px;
  padding: 0 5px;
}

.tonal-top-actions {
  display: flex !important;
  flex-wrap: nowrap;
  gap: 8px !important;
  justify-content: flex-end;
}

.tonal-top-actions button {
  font-size: 0.74rem;
  min-height: 38px;
  padding: 0 13px;
  white-space: nowrap;
}

.tonal-top-actions #copyAirToBoneBtn {
  line-height: 1.25;
  max-width: 190px;
  min-width: 190px;
  white-space: normal;
}

.tonal-workspace {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(350px, 0.72fr) minmax(820px, 1.8fr);
  margin-bottom: 10px;
}

.tonal-chart-stack {
  display: grid;
  gap: 10px;
  grid-template-rows: 1fr 1fr;
}

.tonal-chart-stack .ear-chart-card {
  padding: 10px;
}

.tonal-chart-stack .ear-chart-card h3 {
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.tonal-chart-stack .chart-wrap {
  aspect-ratio: auto;
  height: 265px;
  min-height: 0;
}

.tonal-main-column {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.tonal-table-panel {
  min-width: 0;
  padding: 10px;
}

.tonal-table-panel h3 {
  margin-bottom: 8px;
}

.tonal-table-panel .threshold-table {
  max-height: none;
  overflow: auto;
}

.tonal-entry-table {
  min-width: 1010px !important;
  table-layout: fixed;
}

.tonal-entry-table th,
.tonal-entry-table td {
  font-size: 0.68rem;
  padding: 4px !important;
  text-align: center;
}

.tonal-entry-table thead th {
  background: #f5f9f8;
  line-height: 1.2;
}

.tonal-entry-table thead tr:first-child th {
  color: #19332e;
  font-size: 0.72rem;
}

.tonal-entry-table th:first-child {
  width: 62px;
}

.tonal-entry-table th:last-child {
  width: 180px;
}

.tonal-entry-table .right-column,
.tonal-average-table .right-column {
  color: var(--right);
}

.tonal-entry-table .left-column,
.tonal-average-table .left-column {
  color: var(--left);
}

.tonal-entry-table .tonal-db-input {
  height: 28px;
  min-width: 48px;
  padding: 2px 4px;
  text-align: center;
  width: 100%;
}

.tonal-entry-table .tonal-state-check {
  accent-color: var(--accent);
  height: 15px;
  width: 15px;
}

.tonal-entry-table .tonal-cell-unavailable {
  background: #f4f8f7;
}

.tonal-entry-table .tonal-db-input:disabled,
.tonal-entry-table .tonal-state-check:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.tonal-entry-table .tonal-db-input:disabled {
  background: #eef5f3;
  border-style: dashed;
  color: #7b8c91;
}

.tonal-entry-table .tonal-frequency-note {
  height: 28px;
  min-width: 150px;
  padding: 2px 6px;
  width: 100%;
}

.tonal-summary-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.7fr) minmax(270px, 1.25fr) minmax(210px, 0.85fr);
  margin: 0;
}

.tonal-summary-grid > .panel {
  min-height: 190px;
  padding: 11px;
}

.tonal-symbol-table {
  display: grid;
  gap: 5px;
}

.tonal-symbol-table > div {
  align-items: center;
  display: grid;
  font-size: 0.72rem;
  grid-template-columns: minmax(92px, 1fr) 48px 48px;
  text-align: center;
}

.tonal-symbol-table b {
  color: var(--accent);
  text-align: left;
}

.symbol-od-text {
  color: var(--right);
}

.symbol-oe-text {
  color: var(--left);
}

.tonal-average-table {
  border-collapse: collapse;
  margin-top: 10px;
  width: 100%;
}

.tonal-average-table th,
.tonal-average-table td {
  border: 1px solid var(--line);
  font-size: 0.76rem;
  padding: 9px 5px;
  text-align: center;
}

.tonal-summary-grid .notes-panel textarea {
  min-height: 110px;
}

.tonal-summary-grid .result-panel p {
  font-size: 0.75rem;
  margin: 6px 0;
}

.tonal-footer-panel {
  align-items: end;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px 12px;
}

.tonal-footer-panel textarea {
  min-height: 46px;
}

.tonal-footer-status {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-bottom: 8px;
  white-space: nowrap;
}

.no-response-arrow {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  text-anchor: middle;
}

@media (max-width: 1450px) {
  .tonal-control-strip {
    grid-template-columns: auto auto minmax(360px, 1fr);
  }

  .tonal-top-actions {
    grid-column: 1 / -1;
  }

  .tonal-workspace {
    grid-template-columns: minmax(320px, 0.65fr) minmax(720px, 1.5fr);
  }

  .tonal-summary-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

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

  .tonal-chart-stack {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
}

@media (max-width: 720px) {
  .dashboard-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .tonal-control-strip,
  .tonal-chart-stack,
  .tonal-summary-grid,
  .tonal-footer-panel {
    grid-template-columns: 1fr;
  }

  .tonal-top-actions {
    display: grid !important;
  }

  .tonal-footer-status {
    align-items: flex-start;
    flex-direction: column;
    white-space: normal;
  }
}

.report-template-list-panel,
.report-template-editor-panel {
  min-height: 690px;
  padding: 20px;
}

.report-template-list-panel > h2,
.report-template-editor-heading h2 {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.report-template-search {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.report-template-search input,
.report-template-filter select,
.report-template-form-grid input,
.report-template-form-grid select {
  background: #fff;
  border: 1px solid #d3dfdf;
  border-radius: 7px;
  color: #17252a;
  min-height: 44px;
  padding: 0 13px;
  width: 100%;
}

.report-template-search .secondary-button {
  min-width: 88px;
  width: auto;
}

.report-template-filter {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.report-template-filter span,
.report-template-form-grid label > span,
.report-template-text-field > span {
  color: #24353a;
  font-size: 0.78rem;
  font-weight: 800;
}

.report-template-list {
  border: 1px solid #e1e9e8;
  border-radius: 8px;
  max-height: 590px;
  min-height: 460px;
  overflow-y: auto;
}

.report-template-list .dashboard-empty-state {
  min-height: 440px;
}

.report-template-item {
  align-items: center;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e5eceb;
  color: #17252a;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  min-height: 82px;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.report-template-item:last-child {
  border-bottom: 0;
}

.report-template-item:hover,
.report-template-item.is-selected {
  background: #f1faf5;
}

.report-template-item.is-selected {
  box-shadow: inset 3px 0 #07883d;
}

.report-template-document {
  align-items: center;
  background: #e9f7ef;
  border-radius: 50%;
  color: #07883d;
  display: flex;
  font-size: 1rem;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.report-template-item > span:nth-child(2) {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.report-template-item strong {
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-template-item em {
  color: #07883d;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 700;
}

.report-template-item small {
  color: #697a80;
  font-size: 0.67rem;
}

.report-template-status {
  border-radius: 999px;
  font-size: 0.62rem;
  font-style: normal;
  font-weight: 800;
  padding: 4px 7px;
}

.report-template-status.status-ativo {
  background: #e4f5eb;
  color: #07883d;
}

.report-template-status.status-inativo {
  background: #f1f3f3;
  color: #697a80;
}

.report-template-count {
  color: #65767c;
  font-size: 0.75rem;
  margin: 15px 0 0;
}

.report-template-editor-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.report-template-editor-heading span {
  color: #617278;
  font-size: 0.74rem;
  font-weight: 700;
}

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

.report-template-form-grid label {
  display: grid;
  gap: 7px;
}

.report-template-form-grid .report-template-description {
  grid-column: span 1;
}

.report-template-text-field {
  display: grid;
  margin-top: 18px;
}

.report-template-toolbar {
  align-items: center;
  background: #fbfdfd;
  border: 1px solid #d3dfdf;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  display: flex;
  gap: 6px;
  margin-top: 7px;
  min-height: 45px;
  padding: 6px 10px;
}

.report-template-toolbar > * {
  align-items: center;
  background: #fff;
  border: 1px solid #dce5e4;
  border-radius: 5px;
  display: inline-flex;
  font-size: 0.75rem;
  height: 30px;
  justify-content: center;
  min-width: 30px;
  padding: 0 7px;
}

.report-template-text-field textarea {
  border: 1px solid #d3dfdf;
  border-radius: 0 0 7px 7px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.94rem;
  line-height: 1.7;
  min-height: 300px;
  padding: 16px;
  resize: vertical;
}

.report-template-text-field > small {
  color: #66777d;
  font-size: 0.7rem;
  margin-top: -25px;
  padding-right: 12px;
  pointer-events: none;
  text-align: right;
}

.report-template-variables {
  align-items: flex-start;
  background: #f0f9f5;
  border: 1px solid #cfe6da;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: 30px minmax(0, 1fr);
  margin-top: 24px;
  padding: 15px;
}

.report-template-info-icon {
  align-items: center;
  background: #07883d;
  border-radius: 50%;
  color: #fff;
  display: flex;
  font-weight: 800;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.report-template-variables strong {
  color: #087a3c;
  font-size: 0.85rem;
}

.report-template-variables p {
  color: #52666c;
  font-size: 0.74rem;
  margin: 5px 0 10px;
}

#reportTemplateVariables {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#reportTemplateVariables button {
  background: #dfeee7;
  border: 0;
  border-radius: 5px;
  color: #243b33;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 6px 9px;
}

.report-template-actions {
  align-items: center;
  border-top: 1px solid #e0e8e7;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin: 20px -20px -20px;
  padding: 16px 20px;
}

.report-template-actions button {
  width: auto;
}

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

.exam-text-heading h3 {
  margin: 0;
}

.template-picker-button {
  background: #f1faf5;
  border: 1px solid #aad8bd;
  border-radius: 6px;
  color: #07883d;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 800;
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.template-picker-modal {
  display: none;
  inset: 0;
  position: fixed;
  z-index: 100;
}

.template-picker-modal.is-open {
  display: block;
}

.template-picker-modal .preview-backdrop {
  position: absolute;
  z-index: 1;
}

.template-picker-panel {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(11, 36, 28, 0.24);
  left: 50%;
  max-height: min(680px, 86vh);
  max-width: 680px;
  overflow: hidden;
  padding: 20px;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  z-index: 2;
}

.template-picker-panel > header {
  align-items: center;
  border-bottom: 1px solid #e0e9e7;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 14px;
}

.template-picker-panel h2 {
  font-size: 1.15rem;
  margin: 0 0 5px;
}

.template-picker-panel p {
  color: #64767c;
  font-size: 0.78rem;
  margin: 0;
}

.template-picker-panel .secondary-button {
  width: auto;
}

.template-picker-list {
  display: grid;
  gap: 9px;
  max-height: 520px;
  overflow-y: auto;
}

.template-picker-list > button {
  background: #fff;
  border: 1px solid #d8e4e1;
  border-radius: 7px;
  cursor: pointer;
  display: grid;
  gap: 5px;
  padding: 13px;
  text-align: left;
}

.template-picker-list > button:hover {
  background: #f0f9f4;
  border-color: #83c9a0;
}

.template-picker-list strong {
  color: #163027;
}

.template-picker-list span {
  color: #07883d;
  font-size: 0.7rem;
  font-weight: 800;
}

.template-picker-list .dashboard-empty-state {
  min-height: 180px;
}

.dashboard-heading {
  margin-bottom: 20px;
}

.dashboard-heading h1,
.page-heading h1,
.exam-header h1 {
  font-size: 2rem;
  margin-bottom: 14px;
}

.dashboard-heading p {
  font-size: 1rem;
  margin-bottom: 8px;
}

.dashboard-heading span,
.page-heading p,
.exam-header p {
  color: var(--muted);
  font-weight: 700;
}

.page-heading {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.metric-grid {
  display: grid;
  gap: clamp(16px, 1.6vw, 24px);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: clamp(28px, 3vw, 42px);
}

.metric-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(25, 45, 48, 0.08);
  display: flex;
  gap: 16px;
  min-height: clamp(128px, 10vw, 154px);
  padding: clamp(18px, 2vw, 28px);
}

.metric-card svg {
  color: var(--accent);
  flex: 0 0 auto;
  height: 32px;
  width: 32px;
}

.metric-card span,
.metric-card p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric-card strong {
  color: #149447;
  display: block;
  font-size: 2rem;
  line-height: 1.1;
  margin: 5px 0 8px;
}

.recent-exams {
  margin-top: 4px;
  min-width: 0;
}

.dashboard-appointments {
  margin-top: 8px;
  min-width: 0;
}

.dashboard-appointment-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
}

.dashboard-appointment-card,
.dashboard-appointment-empty {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(20, 50, 41, 0.07);
  min-height: 112px;
  padding: 14px;
}

.dashboard-appointment-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-appointment-card header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-appointment-card strong {
  color: #1f2d2f;
  font-size: 1rem;
}

.dashboard-appointment-card span {
  background: #eef8f5;
  border-radius: 999px;
  color: #07883d;
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 9px;
}

.dashboard-appointment-details {
  display: grid;
  gap: 5px;
}

.dashboard-appointment-card p,
.dashboard-appointment-empty {
  color: var(--muted);
  font-weight: 800;
}

.dashboard-appointment-card p {
  font-size: 0.82rem;
  margin: 0;
}

.dashboard-appointment-card p strong {
  color: #334044;
  font-size: inherit;
}

.recent-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.recent-header h2 {
  font-size: 1.15rem;
}

.new-exam-button {
  background: #07883d;
  border: 0;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  min-height: 42px;
  padding: 0 18px;
}

.dashboard-table {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.dashboard-table table {
  min-width: 100%;
}

.dashboard-table th,
.dashboard-table td {
  padding: clamp(13px, 1.3vw, 18px) clamp(14px, 1.5vw, 22px);
  text-align: left;
}

.dashboard-table th {
  background: #fbfdfd;
  color: #263237;
  font-size: 0.9rem;
}

.dashboard-table td {
  color: #263237;
  font-weight: 700;
}

.recent-exam-row {
  cursor: pointer;
}

.recent-exam-row:hover,
.recent-exam-row:focus {
  background: #eef8f5;
  outline: none;
}

.see-all-link {
  color: #07883d;
  display: inline-block;
  font-weight: 900;
  margin: 20px 0 0 12px;
  text-decoration: none;
}

.admin-dashboard-only[hidden],
.standard-dashboard-only[hidden] {
  display: none !important;
}

.dashboard-heading #dashboardCurrentDate {
  color: #07883d;
  display: block;
  font-weight: 700;
}

.admin-dashboard-only.metric-grid {
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 22px;
}

.admin-dashboard-only .metric-card,
.admin-dashboard-only.metric-grid .metric-card {
  box-shadow: 0 8px 24px rgba(26, 52, 44, 0.06);
  gap: 14px;
  min-height: 112px;
  padding: 18px;
}

.admin-dashboard-only.metric-grid .metric-card svg {
  height: 38px;
  width: 38px;
}

.admin-dashboard-only.metric-grid .metric-card strong {
  font-size: 1.85rem;
  margin: 4px 0 5px;
}

.dashboard-quick-actions {
  margin-bottom: 14px;
}

.dashboard-quick-actions > h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}

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

.dashboard-action-grid button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #17252a;
  cursor: pointer;
  display: flex;
  gap: 13px;
  min-height: 80px;
  padding: 14px 16px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.dashboard-action-grid button:hover,
.dashboard-action-grid button:focus-visible {
  border-color: #76c99b;
  box-shadow: 0 10px 24px rgba(7, 136, 61, 0.1);
  outline: none;
  transform: translateY(-1px);
}

.dashboard-action-grid svg {
  color: #07883d;
  fill: none;
  flex: 0 0 auto;
  height: 30px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 30px;
}

.dashboard-action-grid span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.dashboard-action-grid strong {
  color: #07883d;
  font-size: 0.94rem;
}

.dashboard-action-grid small {
  color: #697a80;
  font-size: 0.75rem;
}

.dashboard-operational-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1.15fr 0.95fr 1fr;
  margin-bottom: 14px;
}

.dashboard-operation-card,
.recent-exams {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(26, 52, 44, 0.05);
}

.dashboard-operation-card {
  min-height: 310px;
  padding: 16px;
}

.recent-exams {
  padding: 16px;
}

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

.dashboard-card-heading h2 {
  font-size: 1rem;
  margin: 0;
}

.dashboard-card-heading h2 span {
  color: #718087;
  font-size: 0.78rem;
  font-weight: 600;
}

.dashboard-card-heading button {
  background: #f4fbf7;
  border: 1px solid #b9dfca;
  border-radius: 6px;
  color: #07883d;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 800;
  min-height: 32px;
  padding: 0 10px;
}

.dashboard-next-list,
.dashboard-progress-list {
  display: grid;
}

.dashboard-next-item {
  align-items: center;
  border-bottom: 1px solid #e7eeee;
  display: grid;
  gap: 12px;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  min-height: 50px;
  padding: 8px 2px;
}

.dashboard-next-item:last-child {
  border-bottom: 0;
}

.dashboard-next-item time {
  color: #07883d;
  font-size: 0.88rem;
  font-weight: 800;
}

.dashboard-next-item div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.dashboard-next-item strong,
.dashboard-next-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-next-item strong {
  font-size: 0.84rem;
}

.dashboard-next-item div span {
  color: #65767c;
  font-size: 0.75rem;
}

.dashboard-empty-state {
  align-items: center;
  color: #65767c;
  display: flex;
  font-size: 0.86rem;
  justify-content: center;
  min-height: 220px;
  padding: 22px;
  text-align: center;
}

.dashboard-type-summary {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: 94px minmax(0, 1fr);
  min-height: 230px;
}

.dashboard-type-total {
  align-items: center;
  aspect-ratio: 1;
  background: #f2faf5;
  border: 13px solid #caecd8;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dashboard-type-total strong {
  color: #07883d;
  font-size: 1.65rem;
}

.dashboard-type-total span {
  color: #607077;
  font-size: 0.72rem;
}

.dashboard-type-bars {
  display: grid;
  gap: 12px;
}

.dashboard-type-row {
  display: grid;
  gap: 6px;
}

.dashboard-type-row > div {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 9px minmax(0, 1fr) auto;
}

.dashboard-type-row strong,
.dashboard-type-row small {
  font-size: 0.72rem;
}

.dashboard-type-row small {
  color: #6b7a80;
}

.dashboard-type-dot {
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.dashboard-type-track {
  background: #edf2f1;
  border-radius: 999px;
  display: block;
  height: 6px;
  overflow: hidden;
}

.dashboard-type-track i {
  border-radius: inherit;
  display: block;
  height: 100%;
}

.type-1 { background: #07883d; }
.type-2 { background: #43ad70; }
.type-3 { background: #78c797; }
.type-4 { background: #9bc9df; }

.dashboard-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 5px 9px;
  white-space: nowrap;
}

.dashboard-status.is-complete {
  background: #e9f7ee;
  color: #07883d;
}

.dashboard-exam-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  white-space: nowrap;
}

.dashboard-exam-actions button {
  background: #f7fbf9;
  border: 1px solid #cfe2d7;
  border-radius: 6px;
  color: #087b3b;
  cursor: pointer;
  flex: 0 0 auto;
  font-size: 0.73rem;
  font-weight: 800;
  min-height: 32px;
  padding: 0 9px;
  white-space: nowrap;
}

.admin-dashboard-only + .recent-exams .dashboard-table,
.recent-exams .dashboard-table {
  border: 0;
  border-radius: 0;
  overflow-x: auto;
}

.recent-exams .dashboard-table table {
  min-width: 1040px;
}

.recent-exams .dashboard-table th,
.recent-exams .dashboard-table td {
  padding: 11px 12px;
}

.exam-header {
  align-items: flex-start;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 20px;
  padding-top: clamp(24px, 3vw, 40px);
}

.exam-header .toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.patients-tabs {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
}

.patients-tabs button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #53666c;
  cursor: pointer;
  font-weight: 800;
  min-height: 38px;
  padding: 0 18px;
}

.patients-tabs button.is-active {
  background: #e8f5ee;
  color: var(--accent);
}

.patients-tab-panel[hidden] {
  display: none !important;
}

.patient-form-panel,
.patients-list-panel {
  padding: clamp(24px, 2.4vw, 34px);
  width: 100%;
}

.patient-form-panel {
  background:
    linear-gradient(135deg, rgba(18, 146, 94, 0.1), rgba(255, 255, 255, 0) 46%),
    var(--surface);
  border-color: rgba(15, 118, 110, 0.16);
  overflow: hidden;
}

.patient-form-hero {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 18px;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  margin: 0 0 26px;
  padding-bottom: 22px;
}

.patient-form-icon {
  align-items: center;
  background: linear-gradient(135deg, var(--accent), #49a579);
  border-radius: 8px;
  color: #ffffff;
  display: flex;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.patient-form-icon svg {
  height: 25px;
  width: 25px;
}

.patient-form-hero h2,
.patient-search-card h2 {
  color: #182326;
  font-size: 1.24rem;
}

.patient-form-hero p,
.patient-search-card p {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.45;
  margin-top: 6px;
}

.patient-form-hero span {
  border: 1px solid rgba(18, 146, 94, 0.18);
  border-radius: 999px;
  background: #eef8f5;
  color: var(--accent);
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 7px 11px;
}

.patient-form {
  display: grid;
  gap: 16px 18px;
  grid-template-columns: minmax(260px, 1.5fr) repeat(2, minmax(180px, 1fr));
}

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

.form-group {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.form-section-title {
  align-items: center;
  color: var(--accent);
  display: flex;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 10px;
  letter-spacing: 0.04em;
  margin-top: 4px;
  text-transform: uppercase;
}

.form-section-title::after {
  background: var(--line);
  content: "";
  flex: 1;
  height: 1px;
}

.form-group label,
.search-field {
  color: #263237;
  font-size: 0.84rem;
  font-weight: 900;
}

.form-group input,
.form-group select,
.form-group textarea,
.search-field input {
  width: 100%;
  border: 1px solid #dce8e5;
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  outline: none;
  padding: 13px 14px;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

.form-group textarea {
  min-height: 96px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.search-field input:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(18, 146, 94, 0.1);
}

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

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

.form-actions {
  border-top: 1px solid var(--line);
  display: flex;
  gap: 12px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  margin-top: 4px;
  padding-top: 20px;
}

.form-actions .primary-button,
.form-actions .secondary-button {
  min-width: 150px;
  min-height: 46px;
}

.form-actions .patient-start-exam-button {
  min-width: 210px;
}

.patients-list-panel {
  align-self: start;
}

.patients-list-panel {
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0) 120px),
    var(--surface);
}

.patient-search-toolbar {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.patient-search-wide input {
  min-height: 50px;
}

.patient-filter-button {
  min-height: 50px;
}

.patients-table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  max-width: 100%;
  overflow: hidden;
}

.patients-table-wrap[hidden] {
  display: none;
}

.patients-table {
  table-layout: fixed;
  width: 100%;
}

.patients-table th,
.patients-table td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: middle;
}

.patients-table th {
  background: #fbfdfd;
  color: #263237;
  font-size: 0.85rem;
}

.patients-table td {
  color: #263237;
  font-weight: 700;
}

.patients-table th:nth-child(1) {
  width: 24%;
}

.patients-table th:nth-child(2) {
  width: 14%;
}

.patients-table th:nth-child(3),
.patients-table th:nth-child(4),
.patients-table th:nth-child(5) {
  width: 15%;
}

.patients-table th:nth-child(6) {
  width: 17%;
}

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

.patient-actions-cell .table-link-button {
  background: #f6fbf9;
  border: 1px solid #d5e5e1;
  border-radius: 999px;
  min-height: 30px;
  padding: 0 10px;
}

.patient-actions-cell .danger-link {
  color: #b02d2d;
}

.patients-empty-cell {
  color: var(--muted) !important;
  font-weight: 700 !important;
  text-align: center !important;
}

.agenda-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(340px, 0.35fr) minmax(620px, 0.65fr);
}

.users-layout {
  align-items: start;
  display: grid;
  gap: clamp(22px, 2vw, 34px);
  grid-template-columns: minmax(560px, 0.9fr) minmax(340px, 0.6fr);
}

.agenda-form-panel,
.agenda-list-panel,
.user-form-panel,
.users-list-panel {
  padding: clamp(24px, 2.4vw, 34px);
}

.agenda-form-panel,
.user-form-panel {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.1), rgba(255, 255, 255, 0) 46%),
    var(--surface);
  border-color: rgba(15, 118, 110, 0.16);
}

.appointment-form,
.user-form {
  display: grid;
  gap: 16px 18px;
  grid-template-columns: minmax(240px, 1.35fr) repeat(2, minmax(160px, 1fr));
}

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

.form-group select,
select {
  width: 100%;
  border: 1px solid #dce8e5;
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  outline: none;
  padding: 0 12px;
}

.form-group select:focus,
select:focus {
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(18, 146, 94, 0.1);
}

.appointment-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding: 6px;
}

.appointment-results[hidden] {
  display: none;
}

.appointment-patient-result,
.appointment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.appointment-patient-result {
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: left;
}

.appointment-patient-result:hover {
  border-color: var(--accent);
  background: #eef8f5;
}

.agenda-list-header {
  align-items: end;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 18px;
}

.agenda-list-header h2 {
  font-size: 1.15rem;
}

.agenda-list-header p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 6px;
}

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

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

.appointment-card,
.user-card {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.appointment-time {
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 900;
}

.appointment-status,
.appointment-status-control select {
  background: #eef8f5;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 999px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 900;
  padding: 5px 9px;
}

.appointment-status-control {
  align-items: end;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.appointment-status-control span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.appointment-status-control select {
  cursor: pointer;
  min-height: 30px;
  padding: 0 28px 0 10px;
}

.appointment-card strong,
.user-card strong,
.appointment-patient-result strong {
  color: #182326;
  display: block;
}

.appointment-card span,
.appointment-card p,
.user-card span,
.user-card p,
.appointment-patient-result span,
.appointment-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0;
}

.appointment-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  text-align: center;
}

.agenda-heading {
  align-items: flex-end;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.users-admin-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(360px, 0.38fr) minmax(720px, 0.72fr);
}

.user-admin-form-card,
.user-admin-table-card {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(15, 43, 55, 0.04);
  padding: 24px;
}

.user-admin-card-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 22px;
}

.user-admin-card-header h2 {
  color: #10202d;
  font-size: 18px;
  margin: 0;
}

.user-admin-card-header p {
  color: #526270;
  font-weight: 700;
  margin: 6px 0 0;
}

.user-form-badge {
  background: #dff5e9;
  border: 1px solid #bde8d3;
  border-radius: 999px;
  color: #087f65;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 12px;
  white-space: nowrap;
}

.user-admin-form-card .user-form {
  grid-template-columns: 1fr;
}

.user-admin-form-card .form-actions {
  justify-content: flex-end;
  margin-top: 16px;
}

.form-state-text {
  color: #526270;
  font-size: 13px;
  font-weight: 800;
  margin: 0;
}

.user-table-header {
  align-items: center;
}

.user-table-tools {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 360px;
}

.user-table-tools input {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  color: #10202d;
  font: inherit;
  min-height: 46px;
  padding: 0 14px;
  width: 100%;
}

.users-table-wrap {
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  overflow-x: auto;
}

.users-admin-table {
  border-collapse: collapse;
  min-width: 840px;
  width: 100%;
}

.users-admin-table th,
.users-admin-table td {
  border-bottom: 1px solid #e4eded;
  color: #22313d;
  font-size: 14px;
  padding: 16px 18px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.users-admin-table th {
  background: #fbfdfd;
  color: #10202d;
  font-size: 12px;
  font-weight: 900;
}

.users-admin-table tr:last-child td {
  border-bottom: 0;
}

.users-admin-table tr.is-selected td {
  background: #eef8f5;
}

.user-avatar-small {
  align-items: center;
  background: #dff5e9;
  border-radius: 50%;
  color: #087f65;
  display: inline-flex;
  font-weight: 900;
  height: 46px;
  justify-content: center;
  width: 46px;
}

.user-status-pill {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 7px 12px;
}

.user-status-pill.is-active {
  background: #dff5e9;
  color: #087f65;
}

.user-status-pill.is-inactive {
  background: #f1f4f4;
  color: #7b4f4f;
}

.user-row-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.user-row-actions button {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  color: #087f65;
  cursor: pointer;
  font-weight: 900;
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.user-row-actions .danger-action {
  border-color: #ffd2d0;
  color: #df3030;
}

.user-permissions-panel {
  align-items: center;
  background: linear-gradient(135deg, #f0fbf7, #fff);
  border: 1px solid #bde8d3;
  border-radius: 8px;
  display: grid;
  gap: 22px;
  grid-template-columns: auto minmax(170px, 0.9fr) repeat(4, minmax(145px, 1fr));
  margin-top: 26px;
  padding: 22px 24px;
}

.user-permissions-icon {
  align-items: center;
  background: #087f65;
  border-radius: 8px;
  color: #fff;
  display: flex;
  height: 58px;
  justify-content: center;
  width: 58px;
}

.user-permissions-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 30px;
}

.user-permissions-panel h3 {
  color: #087f65;
  margin: 0;
}

.user-permissions-panel strong {
  color: #22313d;
  display: block;
  margin-bottom: 4px;
}

.user-permissions-panel span {
  color: #526270;
  font-weight: 700;
}

.reports-page {
  display: grid;
  gap: 18px;
  padding: 32px 42px 52px;
}

.reports-export-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.reports-metrics-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
}

.report-metric-card,
.report-card {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(15, 43, 55, 0.04);
}

.report-metric-card {
  align-items: center;
  display: flex;
  gap: 16px;
  min-height: 112px;
  padding: 18px;
}

.report-metric-icon {
  align-items: center;
  background: #e8f6f0;
  border-radius: 8px;
  color: #087f65;
  display: flex;
  font-weight: 900;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.report-metric-icon.is-danger {
  background: #fff0ee;
  color: #d93030;
}

.report-metric-card p {
  color: #526270;
  font-weight: 800;
  margin: 0 0 6px;
}

.report-metric-card strong {
  color: #10202d;
  display: block;
  font-size: 28px;
  line-height: 1;
}

.report-metric-card small {
  color: #087f65;
  display: block;
  font-weight: 800;
  margin-top: 8px;
}

.report-card {
  padding: 20px;
}

.report-card h2 {
  color: #10202d;
  font-size: 17px;
  margin: 0 0 18px;
}

.report-filters-grid {
  align-items: end;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
}

.report-filters-grid label {
  color: #526270;
  display: grid;
  font-size: 13px;
  font-weight: 900;
  gap: 7px;
}

.report-filters-grid input,
.report-filters-grid select {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  color: #10202d;
  font: inherit;
  min-height: 44px;
  padding: 0 12px;
}

.report-filter-actions {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.reports-charts-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-donut-wrap {
  align-items: center;
  display: grid;
  gap: 20px;
  grid-template-columns: 170px 1fr;
}

.report-donut {
  align-items: center;
  border-radius: 50%;
  display: flex;
  height: 160px;
  justify-content: center;
  position: relative;
  width: 160px;
}

.report-donut::after {
  background: #fff;
  border-radius: 50%;
  content: "";
  height: 86px;
  position: absolute;
  width: 86px;
}

.report-donut span {
  color: #10202d;
  font-size: 13px;
  font-weight: 900;
  position: relative;
  text-align: center;
  z-index: 1;
}

.report-chart-legend {
  display: grid;
  gap: 10px;
}

.report-chart-legend span {
  align-items: center;
  color: #526270;
  display: flex;
  gap: 9px;
  font-size: 13px;
  font-weight: 800;
}

.report-chart-legend i {
  border-radius: 3px;
  height: 12px;
  width: 12px;
}

.report-chart-legend strong {
  color: #10202d;
  margin-left: auto;
}

.report-bars {
  display: grid;
  gap: 13px;
}

.report-bar-row {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: 110px 1fr 46px;
}

.report-bar-row span,
.report-bar-row strong {
  color: #526270;
  font-size: 13px;
  font-weight: 800;
}

.report-bar-row div {
  background: #edf4f3;
  border-radius: 999px;
  height: 16px;
  overflow: hidden;
}

.report-bar-row i {
  background: linear-gradient(90deg, #087f65, #45b08c);
  display: block;
  height: 100%;
}

.report-line-chart {
  align-items: end;
  border-bottom: 1px solid #d9e5e5;
  display: flex;
  gap: 18px;
  justify-content: space-around;
  min-height: 190px;
  padding: 12px 8px 0;
}

.report-month-point {
  align-items: center;
  display: grid;
  gap: 7px;
  justify-items: center;
}

.report-month-point strong,
.report-month-point span {
  color: #526270;
  font-size: 12px;
  font-weight: 800;
}

.report-month-point i {
  background: linear-gradient(180deg, rgba(8, 127, 101, 0.85), rgba(8, 127, 101, 0.18));
  border-radius: 999px 999px 0 0;
  display: block;
  width: 18px;
}

.report-results-header,
.report-pagination {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.report-results-header p,
.report-pagination span {
  color: #526270;
  font-weight: 800;
  margin: 0;
}

.report-table-wrap {
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  margin-top: 14px;
  overflow-x: auto;
}

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

.report-results-table th,
.report-results-table td {
  border-bottom: 1px solid #e4eded;
  color: #22313d;
  font-size: 14px;
  padding: 14px 16px;
  text-align: left;
  white-space: nowrap;
}

.report-results-table th {
  background: #fbfdfd;
  color: #10202d;
  font-size: 12px;
  font-weight: 900;
}

.report-status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  padding: 6px 11px;
}

.report-status.is-done {
  background: #dff5e9;
  color: #087f65;
}

.report-status.is-pending {
  background: #fff1d8;
  color: #b86b00;
}

.report-status.is-progress {
  background: #e4f0ff;
  color: #1d6fd1;
}

.report-status.is-cancelled {
  background: #ffe4e3;
  color: #d72f2f;
}

.report-row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
}

.report-row-actions button {
  background: #fff;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  color: #087f65;
  cursor: pointer;
  font-weight: 900;
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.report-pagination {
  margin-top: 16px;
}

.report-pagination div {
  align-items: center;
  display: flex;
  gap: 8px;
}

.exam-patient-meta small {
  color: #526270;
  display: block;
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 8px;
}

.exam-print-builder {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 1.1fr) minmax(280px, 1fr);
  margin-top: 18px;
}

.exam-print-column {
  border-right: 1px solid #d9e5e5;
  display: grid;
  gap: 12px;
  align-content: start;
  padding-right: 24px;
}

.exam-print-column:last-child {
  border-right: 0;
  padding-right: 0;
}

.exam-print-column h3 {
  color: #087f65;
  font-size: 0.96rem;
  margin: 0;
}

.available-exam-list {
  background: #f7fbfa;
  border: 1px solid #d9e5e5;
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.available-exam-item {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  padding: 8px;
}

.available-exam-item > span {
  align-items: center;
  border: 1px solid #087f65;
  border-radius: 50%;
  color: #087f65;
  display: flex;
  flex: 0 0 20px;
  font-size: 12px;
  font-weight: 900;
  height: 20px;
  justify-content: center;
  margin-top: 2px;
  width: 20px;
}

.available-exam-item strong {
  color: #087f65;
  display: block;
  font-size: 0.92rem;
}

.available-exam-item small {
  color: #526270;
  display: block;
  font-weight: 800;
  margin-top: 4px;
}

.report-checkbox-group {
  display: grid;
  gap: 11px;
}

.report-checkbox-group label,
.report-check-line {
  align-items: center;
  color: #22313d;
  display: flex;
  font-weight: 800;
  gap: 10px;
}

.report-checkbox-group input,
.report-check-line input {
  accent-color: #087f65;
  height: 18px;
  width: 18px;
}

.report-checkbox-divider {
  border-top: 1px solid #d9e5e5;
  margin: 8px 0;
}

.print-summary-card {
  background: #f1faf7;
  border: 1px solid #c9e5dc;
  border-radius: 8px;
  margin-top: 8px;
  padding: 16px;
}

.print-summary-card h3 {
  color: #087f65;
  margin-bottom: 12px;
}

.print-summary-card p {
  color: #526270;
  font-weight: 800;
  margin: 8px 0;
}

.print-summary-card strong {
  color: #10202d;
}

.print-alert {
  border-radius: 8px;
  font-weight: 900;
  line-height: 1.45;
  padding: 14px 16px;
}

.print-alert.is-ok {
  background: #e9f8f2;
  border: 1px solid #c9e5dc;
  color: #087f65;
}

.print-alert.is-warning {
  background: #fff6e7;
  border: 1px solid #ffd69b;
  color: #9a5b00;
}

.exam-print-column label.is-disabled {
  color: #8a9aa0;
  cursor: not-allowed;
  opacity: 0.58;
}

.exam-print-column label.is-disabled input {
  cursor: not-allowed;
}

.app-toast {
  align-items: center;
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(15, 36, 43, 0.16);
  color: #fff;
  display: flex;
  font-weight: 800;
  justify-content: center;
  max-width: min(420px, calc(100vw - 32px));
  min-height: 48px;
  opacity: 0;
  padding: 14px 18px;
  pointer-events: none;
  position: fixed;
  right: 24px;
  top: 24px;
  transform: translateY(-12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 3000;
}

.app-toast.is-ok,
.app-toast.is-error,
.app-toast.is-warning {
  opacity: 1;
  transform: translateY(0);
}

.app-toast.is-ok {
  background: #087f65;
}

.app-toast.is-error {
  background: #b42318;
}

.app-toast.is-warning {
  background: #9a5b00;
}

@media (max-width: 1180px) {
  .users-admin-layout,
  .user-permissions-panel,
  .reports-charts-grid {
    grid-template-columns: 1fr;
  }

  .exam-print-builder {
    grid-template-columns: 1fr;
  }

  .exam-print-column {
    border-bottom: 1px solid #d9e5e5;
    border-right: 0;
    padding: 0 0 18px;
  }

  .exam-print-column:last-child {
    border-bottom: 0;
  }

  .reports-metrics-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .report-filters-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .user-table-header {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .exam-history-page {
    padding: 18px;
  }

  .exam-history-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .reports-metrics-grid,
  .report-filters-grid,
  .report-donut-wrap,
  .exam-history-filter-grid,
  .exam-print-builder {
    grid-template-columns: 1fr;
  }

  .exam-print-column {
    border-right: 0;
    border-bottom: 1px solid #d9e5e5;
    padding: 0 0 18px;
  }

  .exam-print-column:last-child {
    border-bottom: 0;
  }

  .reports-export-actions,
  .report-filter-actions,
  .report-results-header,
  .report-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .user-admin-card-header,
  .user-admin-form-card .form-actions,
  .user-table-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .user-row-actions {
    justify-content: flex-start;
  }
}

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

.agenda-date-control {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
}

.agenda-date-control input {
  border: 0;
  min-height: 36px;
  padding: 0;
}

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

.agenda-summary-card {
  align-items: start;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr;
  min-height: 104px;
  padding: 18px;
}

.agenda-summary-card .summary-icon {
  align-items: center;
  background: #eef8f5;
  border: 1px solid rgba(0, 128, 88, 0.18);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  height: 54px;
  justify-content: center;
  width: 54px;
}

.agenda-summary-card .summary-icon svg {
  height: 25px;
  width: 25px;
}

.agenda-summary-card strong {
  color: var(--text);
  display: block;
  font-size: 1.45rem;
  line-height: 1;
  margin-bottom: 5px;
}

.agenda-summary-card span {
  color: var(--text);
  display: block;
  font-weight: 800;
}

.agenda-summary-card small {
  color: var(--muted);
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 3px;
}

.agenda-summary-card p {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0;
}

.agenda-summary-card.is-fit .summary-icon {
  background: #fff7e8;
  border-color: rgba(245, 158, 11, 0.28);
  color: #d97706;
}

.agenda-summary-card.is-confirmed .summary-icon {
  background: #eef7ff;
  border-color: rgba(37, 99, 235, 0.2);
  color: #1d72d8;
}

.agenda-summary-card.is-canceled .summary-icon {
  background: #f7efff;
  border-color: rgba(126, 34, 206, 0.18);
  color: #7e22ce;
}

.agenda-form-panel,
.agenda-list-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.agenda-form-panel {
  padding: 18px;
}

.agenda-list-panel {
  padding: 0;
  overflow: hidden;
}

.agenda-list-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 18px 20px;
}

.agenda-list-header h2,
.agenda-form-panel h2 {
  color: var(--accent);
  font-size: 1.05rem;
}

.agenda-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.agenda-table {
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 1120px;
  width: 100%;
}

.agenda-table th,
.agenda-table td {
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 14px 16px;
  text-align: left;
  vertical-align: middle;
}

.agenda-table th {
  background: #fbfdfd;
  font-size: 0.82rem;
  font-weight: 900;
}

.agenda-table td {
  font-size: 0.9rem;
  font-weight: 700;
}

.agenda-table th:nth-child(1),
.agenda-table td:nth-child(1) {
  width: 100px;
}

.agenda-table th:nth-child(2),
.agenda-table td:nth-child(2) {
  width: 240px;
}

.agenda-table th:nth-child(3),
.agenda-table td:nth-child(3) {
  width: 180px;
}

.agenda-table th:nth-child(4),
.agenda-table td:nth-child(4) {
  width: 160px;
}

.agenda-table th:nth-child(5),
.agenda-table td:nth-child(5) {
  width: 140px;
}

.agenda-table th:nth-child(6),
.agenda-table td:nth-child(6) {
  width: 300px;
}

.agenda-table td:nth-child(2) strong,
.agenda-table td:nth-child(2) span {
  display: block;
}

.agenda-table td:nth-child(2) span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 3px;
}

.agenda-actions {
  align-items: center;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-start;
  white-space: nowrap;
}

.agenda-actions .table-link-button {
  background: #ffffff;
  border: 1px solid #d8e7e4;
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.agenda-actions .table-link-button:hover {
  background: #eef8f5;
  border-color: var(--accent);
}

.agenda-actions .danger-link {
  color: #d92d20;
}

.agenda-status {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.76rem;
  font-weight: 900;
  line-height: 1;
  padding: 8px 11px;
}

.agenda-status-confirmado {
  background: #e9f8ef;
  border-color: #c8ead4;
  color: #087c44;
}

.agenda-status-agendado {
  background: #eef6ff;
  border-color: #cfe4ff;
  color: #1d72d8;
}

.agenda-status-encaixe {
  background: #fff4e5;
  border-color: #ffd9a6;
  color: #e87800;
}

.agenda-status-cancelado {
  background: #f9e9ef;
  border-color: #f1c9d8;
  color: #b42354;
}

.agenda-status-livre {
  background: #f4f7f7;
  border-color: #e4eded;
  color: #66757b;
}

.agenda-free-row td {
  color: #66757b;
  font-weight: 700;
}

.agenda-actions-free {
  justify-content: center;
}

.agenda-fit-row td {
  background: #fffaf1;
}

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

.patient-name-cell strong,
.patient-name-cell span {
  display: block;
}

.patient-name-cell span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  margin-top: 3px;
}

.app-shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo {
  width: clamp(170px, 22vw, 320px);
  height: auto;
  flex: 0 1 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1;
}

h2 {
  font-size: 1rem;
}

.toolbar {
  display: flex;
  gap: 8px;
}

.primary-button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
}

.primary-button:hover {
  background: #0b625c;
}

.secondary-button,
.danger-button {
  min-height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fbfdfd;
  color: var(--text);
}

.secondary-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.danger-button {
  border: 1px solid rgba(216, 59, 59, 0.35);
  background: #fff8f8;
  color: #b02d2d;
}

.danger-button:hover {
  border-color: var(--right);
  color: var(--right);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(20, 35, 38, 0.08);
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.print-button,
.preview-button,
.pdf-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 14px;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(20, 35, 38, 0.08);
}

.print-button:hover {
  background: #0b625c;
}

.pdf-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
}

.preview-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.pdf-button:hover {
  border-color: var(--accent);
  background: #eef8f5;
}

.preview-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.print-button svg,
.preview-button svg,
.pdf-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 430px) minmax(0, 1fr);
  gap: clamp(18px, 2vw, 28px);
  align-items: start;
  min-width: 0;
}

.exam-overview-panel,
.exam-type-section,
.exam-print-panel,
.exam-recent-panel {
  margin-bottom: 18px;
}

.exam-patient-card,
.exam-selection-search,
.exam-print-panel,
.exam-recent-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.exam-patient-card {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 0.34fr) minmax(220px, 0.34fr);
  padding: 20px 22px;
}

.exam-selection-search {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
}

.exam-selection-search h3 {
  color: #172024;
  font-size: 1rem;
}

.exam-selection-search p {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  margin-top: 4px;
}

.exam-patient-avatar,
.exam-type-icon {
  align-items: center;
  background: #e8f5ee;
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  justify-content: center;
}

.exam-patient-avatar {
  align-self: center;
  height: 64px;
  width: 64px;
}

.exam-patient-avatar svg {
  fill: none;
  height: 40px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 40px;
}

.exam-patient-main,
.exam-patient-meta {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.exam-patient-main strong {
  color: #172024;
  font-size: 1.2rem;
  line-height: 1.2;
}

.exam-patient-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  justify-content: space-between;
}

.change-patient-button {
  background: #f6fbf9;
  border: 1px solid #cfe0dc;
  border-radius: 999px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
  min-height: 30px;
  padding: 0 12px;
  white-space: nowrap;
}

.change-patient-button:hover {
  background: #eaf6f1;
  border-color: rgba(15, 118, 110, 0.35);
}

.change-patient-button[hidden],
.exam-selection-search[hidden] {
  display: none !important;
}

.exam-patient-meta span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.exam-patient-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.exam-patient-info-row span {
  align-items: baseline;
  display: inline-flex;
  gap: 6px;
  min-width: max-content;
}

.exam-patient-main em {
  color: #7b8b91;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.exam-patient-main b {
  color: #243034;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.25;
}

.exam-patient-meta {
  border-left: 1px solid var(--line);
  align-content: center;
  padding-left: 20px;
}

.exam-patient-meta strong {
  color: #172024;
  font-size: 0.98rem;
  line-height: 1.3;
}

.exam-requester-select {
  background: #fff;
  border-color: #d6e4e1;
  border-radius: 8px;
  color: #172024;
  font-size: 0.95rem;
  font-weight: 800;
  min-height: 36px;
  padding: 0 10px;
}

.exam-section-heading {
  margin-bottom: 12px;
}

.exam-section-heading h2 {
  color: var(--accent);
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.exam-section-heading p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

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

.exam-type-card {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 12px;
  justify-items: center;
  min-height: 210px;
  padding: 20px;
  text-align: center;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.exam-type-card.is-selected,
.print-option-card.is-selected {
  border-color: var(--accent);
  background: #f2faf6;
}

.exam-type-card:hover {
  border-color: rgba(0, 128, 103, 0.45);
  box-shadow: 0 14px 30px rgba(15, 58, 52, 0.1);
}

.exam-type-icon {
  height: 84px;
  width: 84px;
}

.exam-type-icon svg {
  height: 54px;
  overflow: visible;
  width: 54px;
}

.exam-type-icon svg * {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.exam-type-icon svg .icon-curve {
  stroke-width: 2.8;
}

.exam-type-card.is-selected .exam-type-icon {
  background: #dff2ea;
  color: #006b57;
}

.exam-type-card strong {
  color: var(--accent);
  font-size: 1rem;
}

.exam-type-card small,
.print-option-card small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.45;
}

.exam-type-card em {
  border: 1px solid var(--accent);
  border-radius: 7px;
  color: var(--accent);
  font-style: normal;
  font-weight: 900;
  min-width: 140px;
  padding: 9px 12px;
}

.exam-print-panel,
.exam-recent-panel,
.exam-history-panel {
  padding: 16px;
}

.exam-history-panel[hidden] {
  display: none;
}

.exam-history-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

.exam-history-search {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(320px, 520px) minmax(220px, 1fr);
}

.exam-history-search label {
  color: var(--text);
  display: grid;
  font-size: 0.85rem;
  font-weight: 900;
  gap: 8px;
}

.exam-history-search input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  min-height: 44px;
  padding: 0 14px;
}

.exam-history-search span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.exam-history-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 10px;
}

.exam-history-results[hidden],
.exam-history-table-wrap[hidden] {
  display: none;
}

.exam-history-table-wrap {
  overflow-x: auto;
}

.exam-history-table-wrap table {
  border-collapse: collapse;
  min-width: 1040px;
  width: 100%;
}

.exam-history-table-wrap th,
.exam-history-table-wrap td {
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  padding: 12px;
  text-align: left;
  vertical-align: middle;
}

.exam-history-table-wrap th {
  color: var(--text);
  font-weight: 900;
}

.history-actions {
  flex-wrap: nowrap;
  min-width: 260px;
}

.history-actions button {
  white-space: nowrap;
}

.history-select-cell {
  align-items: center;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  gap: 7px;
  white-space: nowrap;
}

.history-select-cell input {
  accent-color: var(--accent);
  height: 16px;
  margin: 0;
  width: 16px;
}

.history-print-builder {
  align-items: center;
  background: #eef8f5;
  border: 1px solid #c6e1da;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  padding: 14px 16px;
}

.history-print-builder[hidden] {
  display: none;
}

.history-print-builder h3 {
  color: var(--accent);
  font-size: 1rem;
  margin: 0 0 4px;
}

.history-print-builder p {
  color: #314a45;
  font-size: 0.88rem;
  font-weight: 800;
  margin: 0;
}

.history-print-actions {
  flex: 0 0 auto;
}

#availablePatientExams .available-exam-item:nth-of-type(n + 4) {
  display: none;
}

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

.print-option-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 10px;
  min-height: 118px;
  padding: 14px;
  text-align: left;
}

.print-option-card span {
  border: 1px solid #8aa5a0;
  border-radius: 999px;
  height: 18px;
  width: 18px;
}

.print-option-card.is-selected span {
  background: radial-gradient(circle at center, var(--accent) 0 42%, transparent 46%);
  border-color: var(--accent);
}

.print-option-card strong {
  color: #172024;
  font-size: 0.9rem;
}

.print-panel-footer {
  align-items: center;
  background: #eef8f5;
  border-radius: 8px;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 12px;
  padding: 10px 12px;
}

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

.print-panel-actions .print-button,
.print-panel-actions .preview-button,
.print-panel-actions .pdf-button {
  min-width: 170px;
  padding-left: 18px;
  padding-right: 18px;
}

.print-panel-actions .print-button span,
.print-panel-actions .preview-button span,
.print-panel-actions .pdf-button span {
  display: inline;
}

.print-panel-actions .print-button span {
  color: #ffffff;
}

.print-panel-actions .preview-button span,
.print-panel-actions .pdf-button span {
  color: currentColor;
}

.exam-execution-screen[hidden],
.exam-selection-screen[hidden],
[data-exam-workspace][hidden],
[data-exam-workspace].is-workspace-hidden,
.audiometry-control-strip[hidden],
.tonal-workspace[hidden],
.vocal-workspace[hidden],
.imitance-workspace[hidden] {
  display: none !important;
}

.audiometry-page-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.audiometry-page-header h2 {
  color: #172024;
  font-size: 1.35rem;
  margin-top: 10px;
}

.audiometry-page-header p,
.audiometry-date-box span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.audiometry-date-box {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
}

.audiometry-date-box input {
  border: 0;
  height: 34px;
  min-width: 150px;
  padding: 0;
}

.exam-header-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.exam-header-actions:empty,
.exam-header-actions button[hidden] {
  display: none !important;
}

.exam-simple-action-bar {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
  min-height: 58px;
  padding: 10px 14px;
}

.exam-simple-action-bar[hidden] {
  display: none !important;
}

.audiometry-patient-strip,
.audiometry-control-strip,
.ear-chart-card,
.tonal-table-panel,
.tonal-average-panel,
.conclusion-panel,
.symbol-legend-panel,
.notes-panel,
.result-panel,
.additional-notes-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.audiometry-patient-strip {
  align-items: stretch;
  display: grid;
  gap: 18px;
  grid-template-columns: auto minmax(0, 1fr) minmax(220px, 0.32fr) minmax(220px, 0.32fr);
  margin-bottom: 14px;
  padding: 18px 20px;
}

.audiometry-control-strip {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(280px, 0.95fr) minmax(260px, 0.8fr) minmax(320px, 1.2fr);
  margin-bottom: 14px;
  padding: 12px 16px;
}

.audiometry-control-strip > div {
  align-items: center;
  display: flex;
  gap: 10px;
  min-width: 0;
}

.audiometry-control-strip span,
.frequency-pills label {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
}

.segmented-control {
  background: #f7faf9;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  overflow: hidden;
}

.segmented-control button {
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  min-height: 34px;
  padding: 0 16px;
}

.segmented-control button.is-active {
  background: var(--accent);
  color: #ffffff;
}

.tonal-launch-panel {
  align-items: center;
  background: #f6fbfa;
  border: 1px solid rgba(0, 128, 111, 0.18);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
}

.tonal-launch-buttons {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tonal-launch-buttons button {
  background: #ffffff;
  border: 1px solid rgba(0, 128, 111, 0.32);
  border-radius: 7px;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.tonal-launch-buttons button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.tonal-launch-panel label {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 800;
  gap: 5px;
  white-space: nowrap;
}

.tonal-launch-panel input {
  accent-color: var(--accent);
  height: 14px;
  width: 14px;
}

.frequency-pills {
  justify-content: flex-end;
}

.frequency-pills input {
  accent-color: var(--accent);
  height: 14px;
  width: 14px;
}

.audiometry-layout {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) minmax(250px, 0.58fr);
  margin-bottom: 14px;
}

.ear-chart-card,
.tonal-table-panel,
.tonal-average-panel,
.conclusion-panel,
.symbol-legend-panel,
.notes-panel,
.result-panel,
.additional-notes-panel {
  padding: 14px;
}

.ear-chart-card h3,
.tonal-table-panel h3,
.tonal-average-panel h3,
.conclusion-panel h3,
.symbol-legend-panel h3,
.notes-panel h3,
.result-panel h3 {
  color: var(--accent);
  font-size: 0.98rem;
  margin-bottom: 10px;
}

.right-ear-card h3 {
  color: var(--right);
}

.left-ear-card h3 {
  color: var(--left);
}

.ear-chart-card .chart-wrap {
  aspect-ratio: 1.6 / 1;
  min-height: clamp(330px, 23vw, 430px);
  box-shadow: none;
}

.audiometry-side-panel {
  display: grid;
  gap: 14px;
}

.tonal-table-panel .threshold-table {
  max-height: 330px;
}

.tonal-table-panel .threshold-table table {
  min-width: 520px;
}

.tonal-table-panel td,
.tonal-table-panel th {
  padding: 6px;
}

.tonal-table-panel td input {
  height: 30px;
}

.tonal-average-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 12px;
}

.tonal-average-grid div {
  border-left: 1px solid var(--line);
  padding-left: 14px;
}

.tonal-average-grid span {
  color: var(--accent);
  display: block;
  font-weight: 900;
  margin-bottom: 8px;
}

.audiometry-bottom-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(420px, 1.45fr) minmax(320px, 1fr) minmax(250px, 0.7fr);
  margin-bottom: 14px;
}

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

.symbol-legend-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, auto);
  justify-content: center;
  padding: 10px;
}

.symbol-legend-grid strong {
  color: var(--accent);
  grid-column: 1 / -1;
  text-align: center;
}

.symbol-legend-panel > p,
.tonal-average-panel p,
.conclusion-panel p,
.result-panel p {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1.5;
}

.notes-panel textarea {
  min-height: 110px;
}

.additional-notes-panel {
  display: grid;
  gap: 12px;
}

.additional-notes-panel textarea {
  min-height: 70px;
}

.vocal-workspace {
  display: grid;
  gap: 14px;
}

.vocal-workspace[hidden] {
  display: none;
}

.vocal-metrics-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.05fr);
}

.vocal-card,
.vocal-curve-panel,
.vocal-text-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.vocal-card h3,
.vocal-curve-panel h3,
.vocal-text-panel h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 14px;
}

.vocal-duo-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

.vocal-result-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 14px;
}

.vocal-auto-box {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.96));
  border-color: rgba(15, 118, 110, 0.24);
}

.vocal-auto-note {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  margin: 10px 0 0;
}

.vocal-result-box span {
  font-size: 0.95rem;
  font-weight: 900;
}

.right-vocal span {
  color: var(--right);
}

.left-vocal span {
  color: var(--left);
}

.vocal-result-box input {
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  color: var(--text);
  font-size: 1.7rem;
  font-weight: 800;
  height: auto;
  max-width: 82px;
  padding: 0;
  width: auto;
}

.vocal-result-box input[readonly] {
  color: var(--accent);
  cursor: default;
}

.vocal-result-box small input {
  font-size: 0.95rem;
  max-width: 48px;
}

.vocal-word-line {
  align-items: center;
  border-top: 1px solid rgba(205, 218, 218, 0.75);
  display: grid !important;
  gap: 8px;
  grid-template-columns: minmax(92px, 1fr) 64px auto;
  padding-top: 8px;
}

.vocal-word-line b {
  color: var(--text);
  font-size: 0.82rem;
}

.vocal-word-line input {
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 800;
  height: 36px;
  max-width: none;
  padding: 0 8px;
  text-align: center;
  width: 64px;
}

.vocal-percent-line {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: space-between;
}

.vocal-percent-line output {
  background: rgba(15, 118, 110, 0.1);
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 0.95rem;
  font-weight: 900;
  min-width: 58px;
  padding: 5px 10px;
  justify-content: center;
}

.vocal-result-box label {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

.vocal-result-box em,
.vocal-result-box small {
  color: var(--text);
  font-style: normal;
  font-weight: 800;
}

.vocal-main-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(600px, 1fr) minmax(260px, 0.34fr);
}

.vocal-main-grid.vocal-text-only-grid {
  grid-template-columns: 1fr;
}

.vocal-side-panel {
  display: grid;
  gap: 14px;
}

.vocal-text-only-grid .vocal-side-panel {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

#vocalChart {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  min-height: 330px;
  width: 100%;
}

.vocal-text-panel textarea {
  min-height: 128px;
}

.imitance-workspace {
  display: grid;
  gap: 14px;
}

.imitance-workspace[hidden] {
  display: none;
}

.imitance-tymp-panel,
.reflex-panel,
.imitance-notes-panel,
.imitance-conclusion-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 14px;
}

.imitance-tymp-panel h3,
.reflex-panel h3,
.imitance-notes-panel h3,
.imitance-conclusion-panel h3 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 12px;
}

.imitance-tymp-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(360px, 1fr) minmax(360px, 1fr) minmax(240px, 0.55fr);
}

.tymp-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.tymp-card header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

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

.right-vocal header strong {
  color: var(--right);
}

.left-vocal header strong {
  color: var(--left);
}

.tymp-card header label {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  font-weight: 900;
}

.tymp-card header input {
  border: 0;
  font-weight: 900;
  height: auto;
  padding: 0;
  width: 34px;
}

.tymp-card svg {
  display: block;
  min-height: 218px;
  width: 100%;
}

.tymp-card .grid-line {
  stroke: #edf3f3;
  stroke-width: 0.7;
}

.tymp-card .axis-line {
  stroke: #d9e4e4;
  stroke-width: 0.9;
}

.tymp-card .chart-line-right,
.tymp-card .chart-line-left {
  stroke-width: 1.8;
}

.tymp-axis-label,
.tymp-axis-unit {
  fill: #53666c;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: 16px !important;
  font-weight: normal !important;
  dominant-baseline: middle;
  text-anchor: middle;
  text-shadow: none !important;
  font-synthesis: none;
  stroke: none !important;
}

.tymp-axis-unit {
  font-size: 14px !important;
  text-anchor: start;
}

.tymp-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
}

.tymp-fields label {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  font-size: 0.72rem;
  gap: 4px;
  padding: 8px;
  text-align: center;
}

.tymp-fields input {
  border: 0;
  color: var(--text);
  font-weight: 900;
  height: auto;
  padding: 0;
  text-align: center;
}

.tymp-fields span {
  color: var(--text);
  font-weight: 900;
}

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

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

.reflex-panel-heading h3 {
  margin: 0;
}

.reflex-auto-toggle {
  align-items: center;
  background: #fff;
  border: 1px solid rgba(0, 125, 101, 0.35);
  border-radius: 8px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  min-height: 34px;
  padding: 7px 12px;
  white-space: nowrap;
}

.reflex-auto-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

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

.reflex-table-wrap table {
  min-width: 760px;
}

.reflex-table-wrap th,
.reflex-table-wrap td {
  font-size: 0.78rem;
  padding: 8px;
}

.reflex-response {
  align-items: center;
  display: inline-flex;
  gap: 6px;
  justify-content: center;
  min-width: 92px;
  white-space: nowrap;
}

.reflex-response.present {
  color: #087f5b;
}

.reflex-response.absent {
  color: #d92d20;
}

.reflex-value-input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 700;
  min-width: 92px;
  text-align: center;
}

.reflex-value-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 125, 101, 0.12);
  outline: none;
}

.reflex-value-input[readonly],
.reflex-auto-value[readonly] {
  background: #f5faf8;
  color: #314a45;
  cursor: default;
  font-weight: 600;
  min-width: 92px;
  text-align: center;
}

.reflex-value-input.is-auto[readonly] {
  background: #eef8f4;
  color: var(--accent);
}

.reflex-value-input.is-absent[readonly],
.reflex-auto-value.is-absent[readonly] {
  color: #d92d20;
}

.reflex-difference-value[readonly] {
  background: #eef8f4;
  color: var(--accent);
  font-weight: 900;
}

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

.imitance-notes-panel textarea,
.imitance-conclusion-panel textarea {
  min-height: 150px;
}

.audiometry-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.save-exam-button {
  align-items: center;
  background: #087f5b;
  border: 1px solid #087f5b;
  border-radius: 8px;
  box-shadow: 0 12px 22px rgba(8, 127, 91, 0.18);
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 900;
  gap: 8px;
  height: 42px;
  justify-content: center;
  padding: 0 16px;
  white-space: nowrap;
}

.save-exam-button:hover {
  background: #066c4e;
  border-color: #066c4e;
}

.save-exam-button svg {
  height: 18px;
  width: 18px;
}

.audiometry-actions #graphState {
  flex: 1 1 260px;
  text-align: left;
}

.print-panel-footer span {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.status-pill {
  background: #e3f5e9;
  border-radius: 999px;
  color: #087a39;
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 6px 10px;
}

.table-actions {
  display: flex;
  gap: 10px;
}

.table-actions button {
  background: transparent;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  padding: 4px;
}

.table-link-button {
  background: #eef8f5;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 7px;
  color: var(--accent);
  cursor: pointer;
  font-weight: 900;
  padding: 8px 12px;
}

.table-link-button:hover {
  background: #dff2ed;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
}

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

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  min-width: 0;
}

.section-title p,
.section-title span,
.summary-card p {
  color: var(--muted);
  font-size: 0.9rem;
}

.compact {
  margin-top: 18px;
}

.exam-patient-search {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0) 70%),
    #fbfdfd;
  border: 1px solid rgba(15, 118, 110, 0.14);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px;
}

.exam-patient-search h3 {
  color: #182326;
  font-size: 0.98rem;
  margin: 0;
}

.exam-patient-search p {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 4px 0 0;
}

.exam-patient-results {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.exam-patient-results[hidden] {
  display: none;
}

.exam-patient-result {
  background: #ffffff;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 4px;
  padding: 10px;
  text-align: left;
}

.exam-patient-result:hover {
  border-color: var(--accent);
  background: #eef8f5;
}

.exam-patient-result strong,
.exam-patient-result span {
  display: block;
}

.exam-patient-result strong {
  font-size: 0.9rem;
}

.exam-patient-result span,
.exam-patient-empty {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.exam-patient-empty {
  margin: 0;
  padding: 8px;
}

.patient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--text);
  outline: none;
}

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

textarea {
  resize: vertical;
  padding: 10px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 390px;
}

.threshold-table table {
  min-width: 620px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: center;
}

th {
  background: var(--surface-2);
  font-size: 0.78rem;
  color: #4f6268;
}

td:first-child {
  color: var(--muted);
  font-weight: 800;
}

td input {
  height: 34px;
  padding: 0 6px;
  text-align: center;
}

tr:last-child td {
  border-bottom: 0;
}

.notes-label {
  margin-top: 14px;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.chart-actions,
.legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chart-actions {
  justify-content: flex-end;
}

.legend-row {
  justify-content: space-between;
  margin: -4px 0 12px;
}

#graphState {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
}

.switch {
  display: inline-flex;
  align-items: center;
  grid-template-columns: none;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--text);
  cursor: pointer;
  padding: 0 10px;
  white-space: nowrap;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

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

.legend-symbol {
  align-items: center;
  display: inline-flex;
  font-size: 0.8rem;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  line-height: 1;
  min-width: 18px;
}

.symbol-od {
  border: 2px solid var(--right);
  border-radius: 50%;
  color: transparent;
}

.symbol-oe,
.symbol-bone {
  color: var(--left);
}

.symbol-bone {
  min-width: 26px;
}

.symbol-od-masked {
  border-bottom: 17px solid var(--right);
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  height: 0;
  min-width: 0;
  width: 0;
}

.symbol-oe-masked {
  border: 2px solid var(--left);
  height: 17px;
  min-width: 17px;
  width: 17px;
}

.chart-wrap {
  width: 100%;
  aspect-ratio: 1.6 / 1;
  min-height: clamp(360px, 42vw, 620px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#ffffff, #fbfdfd);
  overflow: hidden;
  min-width: 0;
}

#audiogram,
#leftAudiogram {
  cursor: crosshair;
  width: 100%;
  height: 100%;
  display: block;
}

.grid-line {
  stroke: #dfe7e7;
  stroke-width: 1;
}

.axis-line {
  stroke: #7b8b91;
  stroke-width: 1.5;
}

.threshold-25-line {
  stroke: #111827;
  stroke-width: 2.2;
}

.axis-label {
  fill: #53666c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
  font-weight: normal;
  stroke: none;
  text-shadow: none;
  font-synthesis: none;
}

.audiometry-axis-label {
  fill: #53666c;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 20px;
  font-weight: normal;
  stroke: none;
  text-shadow: none;
  font-synthesis: none;
}

.chart-line-right,
.chart-line-left,
.chart-line-bone {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-line-right {
  stroke: var(--right);
}

.chart-line-left {
  stroke: var(--left);
}

.chart-line-bone {
  stroke-dasharray: 8 8;
}

.point-label {
  font-size: 22px;
  font-weight: 400;
  dominant-baseline: middle;
  text-anchor: middle;
}

.bone-point-label {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 32px;
  font-weight: 500;
}

.point-symbol {
  fill: #ffffff;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.no-response-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 1.6vw, 24px);
}

.summary-card {
  padding: 18px;
  min-height: 140px;
}

.card-kicker {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.summary-card h3 {
  font-size: 1.35rem;
  margin-bottom: 12px;
}

.guidance {
  border-color: rgba(233, 180, 76, 0.5);
}

.print-sheet {
  display: none;
}

.preview-modal {
  display: none;
}

.preview-modal.is-open {
  display: block;
}

.preview-backdrop {
  background: rgba(16, 24, 28, 0.55);
  inset: 0;
  position: fixed;
  z-index: 80;
}

.preview-panel {
  background: #f4f7f8;
  border-left: 1px solid var(--line);
  bottom: 0;
  box-shadow: -18px 0 48px rgba(16, 24, 28, 0.2);
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  width: min(920px, 100vw);
  z-index: 90;
}

.exam-record-panel {
  max-width: min(760px, calc(100vw - 28px));
}

.exam-record-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 20px;
}

.exam-record-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
  padding: 14px;
}

.exam-record-summary span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.exam-record-summary strong,
.exam-record-summary p {
  color: var(--text);
  font-weight: 800;
  margin: 0;
}

.preview-toolbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.preview-toolbar h2 {
  font-size: 1.1rem;
  margin: 0 0 3px;
}

.preview-toolbar p {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.preview-scroll {
  overflow: auto;
  padding: 24px;
}

#previewMount {
  background: #fff;
  box-shadow: 0 18px 48px rgba(16, 24, 28, 0.18);
  margin: 0 auto;
  min-height: 297mm;
  padding: 12mm;
  transform-origin: top center;
  width: 210mm;
}

#previewMount .print-sheet {
  display: block;
  min-height: 273mm;
  width: 186mm;
}

.print-header,
.print-info,
.print-summary,
.print-notes,
.print-footer {
  color: #172024;
}

.print-header {
  align-items: center;
  border-bottom: 2px solid #0f766e;
  display: flex;
  gap: 16px;
  padding-bottom: 10mm;
}

.print-header img {
  height: 22mm;
  object-fit: contain;
  width: auto;
}

.print-header h2 {
  font-size: 18pt;
  margin: 0 0 2mm;
}

.print-header p {
  color: #66757b;
  font-size: 10pt;
}

.print-info {
  display: grid;
  gap: 4mm;
  grid-template-columns: repeat(4, 1fr);
  margin: 8mm 0;
}

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

.print-info div,
.print-summary article,
.print-notes {
  border: 1px solid #d9e2e2;
  border-radius: 4px;
  padding: 4mm;
}

.print-info span,
.print-summary span,
.print-notes span {
  color: #66757b;
  display: block;
  font-size: 8pt;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 1.5mm;
  text-transform: uppercase;
}

.print-info strong,
.print-summary strong {
  display: block;
  font-size: 10pt;
}

.print-chart {
  border: 1px solid #d9e2e2;
  border-radius: 4px;
  margin-bottom: 7mm;
  padding: 4mm;
}

#printChartMount {
  display: flex;
  gap: 4mm;
}

#printChartMount svg {
  display: block;
  flex: 1 1 0;
  height: auto;
  min-width: 0;
  width: 100%;
}

.print-summary {
  display: grid;
  gap: 5mm;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 7mm;
}

.print-summary p,
.print-notes p {
  color: #172024;
  font-size: 9pt;
  margin: 1mm 0 0;
}

.print-notes {
  min-height: 20mm;
}

.print-footer {
  align-items: center;
  border-top: 1px solid #d9e2e2;
  color: #66757b;
  display: flex;
  font-size: 8pt;
  justify-content: space-between;
  margin-top: 7mm;
  padding-top: 4mm;
}

@media (max-width: 1180px) {
  .report-templates-layout {
    grid-template-columns: minmax(290px, 0.8fr) minmax(480px, 1.2fr);
  }

  .admin-dashboard-only.metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .dashboard-operation-card:last-child {
    grid-column: 1 / -1;
  }

  .audiometry-page-header,
  .audiometry-control-strip {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .audiometry-patient-strip {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .audiometry-patient-strip .exam-patient-meta {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  .audiometry-layout,
  .audiometry-bottom-grid {
    grid-template-columns: 1fr;
  }

  .symbol-legend-grid,
  .print-option-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .exam-patient-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .exam-patient-meta {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  .exam-patient-info-row {
    gap: 8px 14px;
  }

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

  .dashboard-appointment-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

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

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

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

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

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

@media (max-width: 980px) {
  .report-templates-layout {
    grid-template-columns: 1fr;
  }

  .report-template-list-panel,
  .report-template-editor-panel {
    min-height: auto;
  }

  .report-template-list {
    max-height: 390px;
    min-height: 280px;
  }

  .report-template-list .dashboard-empty-state {
    min-height: 260px;
  }

  .dashboard-shell {
    grid-template-columns: 92px 1fr;
  }

  .sidebar {
    padding: 18px 12px;
  }

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

  .sidebar-brand img,
  .nav-item span,
  .logout-button span {
    display: none;
  }

  .menu-button,
  .nav-item,
  .logout-button {
    justify-content: center;
  }

  .exam-header {
    flex-direction: column;
  }

  .layout,
  #examView .layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 720px) {
  .report-templates-page {
    padding: 20px 14px 36px;
  }

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

  .report-template-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .report-template-actions button {
    width: 100%;
  }

  .exam-text-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .template-picker-button {
    width: 100%;
  }

  .admin-dashboard-only.metric-grid,
  .dashboard-action-grid,
  .dashboard-operational-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-operation-card:last-child {
    grid-column: auto;
  }

  .dashboard-type-summary {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .dashboard-action-grid button {
    min-height: 70px;
  }

  .agenda-heading,
  .agenda-top-actions {
    align-items: stretch;
    display: grid;
    justify-content: stretch;
  }

  .agenda-summary-grid,
  .appointment-form {
    grid-template-columns: 1fr;
  }

  .agenda-table th,
  .agenda-table td {
    padding: 12px 10px;
  }

  .audiometry-patient-strip,
  .symbol-legend-grid {
    grid-template-columns: 1fr;
  }

  .audiometry-control-strip > div,
  .frequency-pills,
  .audiometry-actions {
    align-items: stretch;
    display: grid;
    justify-content: stretch;
  }

  .segmented-control {
    display: grid;
  }

  .print-panel-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .exam-patient-card,
  .exam-type-grid,
  .print-option-grid {
    grid-template-columns: 1fr;
  }

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

  .dashboard-appointment-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    border-right: 0;
    gap: 12px;
    min-height: auto;
    overflow: hidden;
    padding: 12px;
    position: sticky;
    top: 0;
    z-index: 40;
  }

  .sidebar-brand {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .sidebar-brand img,
  .nav-item span,
  .logout-button span {
    display: block;
  }

  .sidebar-nav {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    padding-bottom: 0;
    width: 100%;
  }

  .nav-item,
  .logout-button {
    min-height: 44px;
    padding: 0 14px;
    width: 100%;
  }

  .logout-button {
    display: none;
  }

  .topbar-user strong,
  .topbar-user span {
    display: none;
  }

  .dashboard-topbar {
    min-height: 58px;
    padding: 14px;
  }

  .dashboard-content,
  .patients-page,
  .agenda-page,
  .exam-header,
  #examView .layout {
    padding-left: 14px;
    padding-right: 14px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 112px;
  }

  .recent-header {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading,
  .list-toolbar,
  .patient-form-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .page-heading {
    gap: 12px;
    margin-bottom: 18px;
  }

  .patient-form-panel,
  .patients-list-panel {
    padding: 16px;
  }

  .patient-form-hero {
    gap: 12px;
  }

  .patient-form-hero span {
    justify-self: start;
    width: fit-content;
  }

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

  .appointment-form {
    grid-template-columns: 1fr;
  }

  .user-form {
    grid-template-columns: 1fr;
  }

  .exam-record-summary {
    grid-template-columns: 1fr;
  }

  .agenda-list-header {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-actions .primary-button,
  .form-actions .secondary-button {
    width: 100%;
  }

  .dashboard-table {
    overflow-x: auto;
  }

  .dashboard-table table {
    min-width: 680px;
  }

  .exam-header .toolbar {
    justify-content: stretch;
    width: 100%;
  }

  .print-button,
  .preview-button,
  .pdf-button {
    flex: 1 1 180px;
  }

  .app-shell {
    padding: 14px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand-block {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-logo {
    width: min(100%, 320px);
  }

  .chart-actions,
  .legend-row {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button,
  .danger-button,
  .switch {
    width: 100%;
    justify-content: center;
  }

  #graphState {
    text-align: left;
  }

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

  .chart-wrap {
    min-height: 320px;
  }

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

  .preview-toolbar,
  .preview-actions {
    align-items: stretch;
    flex-direction: column;
  }

  #previewMount {
    transform: scale(0.55);
    transform-origin: top left;
  }
}

@media (min-width: 1500px) {
  .dashboard-content,
  .patients-page,
  .exam-header,
  #examView .layout {
    padding-left: 64px;
    padding-right: 64px;
  }

  .layout {
    grid-template-columns: minmax(380px, 470px) minmax(0, 1fr);
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .toolbar {
    display: none;
  }

  .dashboard-shell {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    box-shadow: none;
    break-inside: avoid;
  }
}

/* Mantem a composicao tonal acima das regras legadas declaradas anteriormente. */
.audiometry-control-strip.tonal-control-strip {
  grid-template-columns: 260px 200px minmax(390px, 1fr) minmax(500px, auto);
}

.tonal-table-panel .threshold-table {
  max-height: none;
}

.audiometry-bottom-grid.tonal-summary-grid {
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.7fr) minmax(270px, 1.25fr) minmax(210px, 0.85fr);
}

@media (max-width: 1450px) {
  .audiometry-control-strip.tonal-control-strip {
    grid-template-columns: auto auto minmax(360px, 1fr);
  }

  .audiometry-bottom-grid.tonal-summary-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 720px) {
  .audiometry-control-strip.tonal-control-strip,
  .audiometry-bottom-grid.tonal-summary-grid {
    grid-template-columns: 1fr;
  }
}

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

  body {
    background: #fff;
  }

  .app-shell {
    display: none;
  }

  .dashboard-shell {
    display: none;
  }

  .preview-modal {
    display: none !important;
  }

  .print-sheet {
    background: #fff;
    display: block;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    min-height: 273mm;
    width: 186mm;
  }
}

/* Responsividade isolada da tela de Audiometria Tonal. */
#examView,
#examView .exam-execution-screen,
#examView .tonal-workspace,
#examView .tonal-main-column,
#examView .tonal-table-panel {
  min-width: 0;
  max-width: 100%;
}

#examView .exam-execution-screen {
  width: 100%;
}

#examView .exam-content {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(340px, 34%) minmax(720px, 1fr);
  width: 100%;
  max-width: 100%;
}

#examView .charts-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  width: 100%;
}

#examView .limiares-panel {
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

#examView .limiares-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
}

#examView .limiares-table {
  border-collapse: collapse;
  min-width: 980px !important;
  width: 100%;
}

#examView .chart-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#examView .chart-card .chart-wrap {
  width: 100%;
  min-width: 0;
  height: clamp(240px, 28vh, 360px);
  min-height: 240px;
  max-width: 100%;
  overflow: hidden;
}

#examView .audiogram-chart {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

#examView [data-exam-workspace][hidden],
#examView [data-exam-workspace].is-workspace-hidden,
#examView .audiometry-control-strip.tonal-control-strip[hidden],
#examView .audiometry-control-strip.tonal-control-strip.is-workspace-hidden {
  display: none !important;
}

#examView .exam-toolbar {
  align-items: center;
  display: flex !important;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  max-width: 100%;
}

#examView .exam-toolbar > * {
  min-width: 0;
}

#examView .exam-toolbar .frequency-pills {
  flex: 1 1 390px;
}

#examView .exam-toolbar-actions {
  align-items: center;
  display: flex !important;
  flex: 0 1 auto;
  flex-wrap: wrap;
  gap: 8px !important;
  justify-content: flex-end;
  margin-left: auto;
  min-width: 0;
}

@media (max-width: 1400px) {
  #examView .exam-content {
    grid-template-columns: minmax(320px, 32%) minmax(680px, 1fr);
  }

  #examView .exam-toolbar-actions {
    flex-basis: 100%;
  }
}

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

  #examView .charts-column {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
  }

  #examView .limiares-table-wrapper {
    overflow-x: auto;
  }
}

@media (max-width: 800px) {
  #examView .charts-column {
    grid-template-columns: 1fr;
  }

  #examView .exam-toolbar .frequency-pills,
  #examView .exam-toolbar-actions {
    flex-basis: 100%;
  }

  #examView .exam-toolbar-actions {
    justify-content: flex-start;
    margin-left: 0;
  }
}
