@font-face {
  font-family: "Inter";
  src: url("fontes/Inter-400.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fontes/Inter-500.ttf") format("truetype");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fontes/Inter-600.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fontes/Inter-700.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("fontes/Inter-800.ttf") format("truetype");
  font-style: normal;
  font-weight: 800;
  font-display: swap;
}

:root {
  --bg: #e8f7f6;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --border: #b8dedc;
  --text: #1f2b33;
  --muted: #527573;
  --accent: #009E9A;
  --accent-dark: #007a77;
  --accent-light: #4fc4c1;
  --soft: #e0f3f2;
  --shadow: 0 24px 70px rgba(0, 122, 119, 0.14);
}

* {
  box-sizing: border-box;
}

/* Agenda de exames */
.schedule-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.schedule-toolbar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.schedule-month-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.schedule-month-nav h3 {
  min-width: 190px;
  margin: 0;
  color: var(--text);
  font-size: 17px;
  text-align: center;
  text-transform: capitalize;
}

.schedule-month-nav button,
.schedule-toolbar > button {
  width: auto;
  min-width: 38px;
  height: 36px;
  padding: 0 13px;
  border-radius: 9px;
}

.schedule-month-nav button {
  padding: 0;
  font-size: 24px;
}

.schedule-secondary {
  color: var(--accent-dark);
  background: #eef7f2;
  border: 1px solid var(--border);
}

#agendaHoje {
  width: max-content;
  min-width: 64px;
  padding: 0 16px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  line-height: 1;
}

.schedule-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(300px, 360px);
  gap: 12px;
}

.schedule-calendar-card,
.schedule-day-panel {
  min-height: 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.schedule-calendar-card {
  display: grid;
  grid-template-rows: 34px 1fr;
}

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

.schedule-weekdays {
  align-items: center;
  color: var(--muted);
  background: #f5faf7;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
}

.schedule-calendar {
  grid-template-rows: repeat(6, minmax(70px, 1fr));
}

.schedule-day {
  width: 100%;
  height: 100%;
  min-height: 70px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 4px;
  color: var(--text);
  background: #ffffff;
  border-right: 1px solid #e3eee9;
  border-bottom: 1px solid #e3eee9;
  border-radius: 0;
  text-align: left;
}

.schedule-day:hover {
  background: #f2faf6;
}

.schedule-day.outside {
  color: #9aada6;
  background: #fafcfb;
}

.schedule-day.today .schedule-day-number {
  color: #ffffff;
  background: var(--accent);
}

.schedule-day.selected {
  box-shadow: inset 0 0 0 2px var(--accent);
  background: #eef8f3;
}

.schedule-day.full small {
  color: #b83b4b;
  background: #fff0f2;
}

.schedule-day-number {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.schedule-day small,
.schedule-day strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
}

.schedule-day small {
  padding: 3px 5px;
  color: var(--accent-dark);
  background: #e9f7f0;
  border-radius: 5px;
}

.schedule-day strong {
  color: var(--muted);
  font-weight: 600;
}

.schedule-day-panel {
  display: flex;
  flex-direction: column;
}

.schedule-day-panel > header {
  padding: 15px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.schedule-day-panel header small,
.schedule-dialog header small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.schedule-day-panel h3,
.schedule-dialog h3 {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  text-transform: capitalize;
}

#agendaDiaVagas {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
}

#agendaDiaVagas.available {
  color: var(--accent-dark);
}

#agendaDiaVagas.unavailable {
  color: #b83b4b;
}

#agendaNovo {
  width: auto;
  min-width: 92px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 11px;
}

#agendaNovo:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.schedule-day-list {
  flex: 1;
  min-height: 0;
  padding: 10px;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
}

.schedule-appointment {
  width: 100%;
  height: auto;
  min-height: 58px;
  padding: 9px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: #f6faf8;
  border: 1px solid #dcebe5;
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  text-align: left;
}

.schedule-appointment:hover {
  background: #eef8f3;
}

.schedule-appointment time {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.schedule-appointment span,
.schedule-appointment strong,
.schedule-appointment small {
  min-width: 0;
  display: block;
}

.schedule-appointment strong,
.schedule-appointment small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-appointment strong {
  font-size: 11px;
}

.schedule-appointment small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.schedule-appointment em {
  padding: 4px 6px;
  color: var(--accent-dark);
  background: #e5f4ed;
  border-radius: 5px;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.schedule-appointment.status-cancelado {
  opacity: 0.58;
  border-left-color: #8a9993;
}

.schedule-appointment.status-realizado {
  border-left-color: #2f75b5;
}

.schedule-appointment.status-faltou {
  border-left-color: #b83b4b;
}

.schedule-empty {
  grid-column: 1 / -1;
  margin: auto;
  padding: 24px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.schedule-dialog {
  position: relative;
  width: min(760px, calc(100vw - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(20, 60, 47, 0.24);
  overflow: hidden;
}

.schedule-dialog-title {
  color: var(--accent-dark);
  font-size: 18px !important;
  font-weight: 800;
}

.schedule-dialog::backdrop {
  background: rgba(15, 31, 26, 0.48);
  backdrop-filter: blur(2px);
}

.schedule-search-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: none;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.88);
  border-radius: inherit;
}

.schedule-search-overlay.active {
  display: grid;
}

.schedule-search-overlay strong {
  font-size: 12px;
}

.schedule-dialog form {
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  padding: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.schedule-dialog header,
.schedule-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.schedule-dialog header {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.schedule-dialog-close {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: #eef5f2;
  border-radius: 8px;
  font-size: 22px;
}

.dialog-back-button {
  order: -1;
  flex: 0 0 32px;
  align-self: flex-start;
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef5f2;
  border-radius: 8px;
}

.dialog-back-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.schedule-form-grid {
  flex: 1 1 auto;
  min-height: 0;
  padding-right: 4px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.schedule-form-grid label {
  margin: 0;
  font-size: 9px;
}

.schedule-form-grid input,
.schedule-form-grid select,
.schedule-form-grid textarea {
  width: 100%;
  height: 37px;
  margin-top: 5px;
  padding: 0 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  font: inherit;
  font-size: 11px;
  text-transform: none;
}

.schedule-form-grid textarea {
  height: 65px;
  padding: 9px 10px;
  resize: vertical;
}

.schedule-form-grid input:focus,
.schedule-form-grid select:focus,
.schedule-form-grid textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 158, 154, 0.18);
}

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

.schedule-exam-link {
  padding: 10px;
  background: rgba(0, 158, 154, 0.07);
  border: 1px solid rgba(0, 158, 154, 0.24);
  border-radius: 9px;
}

.schedule-exam-link small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.schedule-form-error {
  flex: 0 0 auto;
  min-height: 18px;
  margin: 7px 0;
  color: #b83b4b;
  font-size: 10px;
}

.schedule-dialog footer {
  flex: 0 0 auto;
  padding-top: 2px;
  justify-content: flex-end;
}

.schedule-dialog footer button {
  width: auto;
  min-width: 130px;
  height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 11px;
}

.schedule-dialog footer .schedule-print-button {
  margin-right: auto;
}

@media (max-width: 1050px) {
  .schedule-layout {
    grid-template-columns: minmax(500px, 1fr) 300px;
  }

  .schedule-day {
    padding: 5px;
  }
}

@media (max-width: 820px) {
  .schedule-page {
    overflow: auto;
  }

  .schedule-layout {
    grid-template-columns: minmax(620px, 1fr);
  }

  .schedule-calendar-card {
    min-height: 560px;
  }

  .schedule-day-panel {
    min-height: 330px;
  }
}

@media (max-width: 620px) {
  .schedule-form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-field-wide {
    grid-column: auto;
  }

  .schedule-dialog form {
    padding: 14px;
  }

  .schedule-dialog footer {
    flex-wrap: wrap;
  }

  .schedule-dialog footer .schedule-print-button {
    flex: 1 0 100%;
    margin-right: 0;
  }

  .schedule-dialog footer #agendaCancelar,
  .schedule-dialog footer button[type="submit"] {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
  }
}

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

html,
body {
  width: 100%;
  max-width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: "Inter", Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app-viewport {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.app-viewport body {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: 100%;
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}

button,
input,
select {
  font: inherit;
}

.login-page {
  height: 100dvh;
  min-height: 0;
  padding: 14px 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.login-shell {
  width: min(1100px, calc(100vw - 36px));
  height: calc(100dvh - 28px);
  min-height: 0;
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #ffffff 0%, #e8f7f6 100%);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.brand-header {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-mark {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: 30px;
  line-height: 1.05;
}

h2 {
  margin-bottom: 18px;
  font-size: 25px;
}

p,
li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 14px;
}

.panel {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 24px;
}

.login-card {
  min-height: 0;
  padding: 20px 18px 18px;
}

label {
  display: block;
  margin: 14px 0 8px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 17px;
  outline: none;
}

select {
  color-scheme: light;
}

select option,
select optgroup {
  color: #006f6c;
  background: #ffffff;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 158, 154, 0.25);
}

.form-note {
  margin: 14px 0 12px;
}

button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 15px;
  color: #fff;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.97);
}

.side-stack {
  display: grid;
  align-content: start;
  min-height: 0;
  gap: 14px;
}

.info-card,
.session-card {
  padding: 20px 16px;
}

ul {
  margin: 0;
  padding-left: 18px;
}

.session-card {
  background: linear-gradient(180deg, #e8f7f6 0%, #ffffff 100%);
}

.hub-page {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

.hub-layout {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.hub-layout.menu-collapsed {
  grid-template-columns: 74px 1fr;
}

.hub-sidebar {
  padding: 22px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--accent-dark);
  color: #fff;
}

.menu-toggle {
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
}

.hub-sidebar .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 24px;
}

.hub-sidebar h1 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 22px;
}

.hub-sidebar p {
  color: #d4f1ef;
}

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

.hub-nav button {
  height: 42px;
  padding: 0 14px;
  text-align: left;
  border-radius: 10px;
  background: transparent;
  color: #ffffff;
}

.menu-collapsed .hub-sidebar {
  padding: 16px;
  align-items: center;
}

.menu-collapsed .hub-nav button {
  width: 42px;
  padding: 0;
  overflow: hidden;
  text-align: center;
  font-size: 0;
}

.menu-collapsed .hub-brand-bottom {
  display: none;
}

.hub-nav button:hover,
.hub-nav button.active {
  background: var(--accent);
}

.hub-brand-bottom {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

.hub-brand-bottom .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 20px;
}

.hub-brand-bottom strong {
  color: #ffffff;
  font-size: 20px;
  line-height: 42px;
}

.hub-main {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  padding: 26px;
  overflow: hidden;
}

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

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

.account-button {
  width: auto;
  min-width: 164px;
  height: 44px;
  padding: 0 14px 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: 0 10px 28px rgba(0, 122, 119, 0.08);
}

.reload-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(0, 158, 154, 0.18);
}

.reload-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  place-items: center;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
}

.loading-overlay.active {
  display: grid;
}

.loading-content {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 24px 28px;
  color: var(--accent-dark);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.loading-content p {
  max-width: min(300px, calc(100vw - 64px));
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.loading-spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--soft);
  border-top-color: var(--accent-dark);
  border-radius: 999px;
  animation: loading-spin 0.8s linear infinite;
}

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

/* Login novo */
.login-page {
  padding: 0;
  background: #eef1f0;
}

.login-shell {
  width: min(980px, calc(100vw - 22px));
  height: min(520px, calc(100dvh - 22px));
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  background: #ffffff;
  border-radius: 8px;
  border: 0;
  box-shadow: 0 18px 55px rgba(0, 122, 119, 0.08);
}

.login-welcome {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  align-self: stretch;
  justify-self: stretch;
  padding: 28px;
  color: #ffffff;
  background:
    linear-gradient(rgba(0, 122, 119, 0.42), rgba(0, 122, 119, 0.42)),
    url("imagens/login.png") center / cover no-repeat;
  overflow: hidden;
}

.login-form-panel,
.login-welcome {
  min-height: 0;
}

.brand-mini {
  position: absolute;
  top: 14px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffffff;
  font-size: 11px;
}

.brand-mini span {
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
}

.welcome-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.welcome-center h1 {
  margin-bottom: 12px;
  color: #ffffff;
  font-size: 30px;
  font-weight: 800;
}

.welcome-center p {
  max-width: 230px;
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  line-height: 1.55;
}

.ghost-button {
  width: 112px;
  height: 28px;
  margin-top: 15px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 999px;
  color: #ffffff;
  background: transparent;
  font-size: 9px;
  font-weight: 800;
}

.welcome-shape {
  display: none;
}

.shape-a {
  top: -42px;
  right: -22px;
}

.shape-b {
  top: 92px;
  left: -46px;
}

.shape-c {
  right: -42px;
  bottom: -28px;
}

.forgot-link {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
  text-decoration: none;
}

.forgot-link:hover {
  color: var(--accent-dark);
}

.login-form-panel {
  display: grid;
  place-items: center;
  padding: 34px;
}

.login-card {
  width: 330px;
  padding: 0;
}

.login-mobile-logo {
  display: none;
}

.login-card h2 {
  margin-bottom: 14px;
  color: var(--accent-dark);
  text-align: center;
  font-size: 30px;
  font-weight: 800;
}

.login-card .form-note {
  margin: 0 0 16px;
  text-align: center;
  color: #a8b5b1;
  font-size: 13px;
}

.social-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
}

.social-row span {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid #dbe2e0;
  border-radius: 999px;
  color: #8ba09a;
  font-size: 10px;
  font-weight: 800;
}

.login-field {
  height: 44px;
  margin: 0 0 11px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: #f4f7f6;
  border: 1px solid #dce8e4;
  border-radius: 4px;
  overflow: hidden;
}

.login-field:focus-within {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(0, 158, 154, 0.18);
}

.login-card .form-note.error {
  color: #b83b4b;
}

.login-field.error {
  border-color: #b83b4b;
  box-shadow: 0 0 0 3px rgba(184, 59, 75, 0.13);
}

.login-field span {
  width: 20px;
  color: #8ba09a;
  text-align: center;
  font-size: 13px;
}

.login-field input {
  flex: 1;
  width: 0;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
  font-size: 13px;
}

.login-field input:focus {
  border: 0 !important;
  box-shadow: none !important;
}

.login-field input::placeholder {
  color: #9aa9a5;
  font-size: 13px;
}

.login-card button {
  width: 142px;
  height: 36px;
  margin: 18px auto 0;
  display: block;
  border-radius: 999px;
  background: #009E9A;
  font-size: 12px;
  text-transform: uppercase;
}

.login-card button:disabled {
  opacity: 0.65;
  cursor: wait;
}

  @media (max-width: 720px) {
  .login-shell {
    height: calc(100dvh - 24px);
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
  }

  .login-form-panel {
    padding: 24px;
  }
}

.account-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  font-size: 13px;
  font-weight: 800;
}

.hub-content {
  width: 100%;
  max-width: 100%;
  height: calc(100dvh - 116px);
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  padding: 22px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: 18px;
}

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

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

.exam-actions button {
  width: auto;
  min-width: 104px;
  padding: 0 14px;
}

.exam-filters {
  display: grid;
  grid-template-columns: 1.4fr 170px 150px 170px;
  gap: 10px;
  margin-bottom: 14px;
}

.exam-filters label {
  margin: 0;
}

.exam-filters input,
.exam-filters select {
  height: 40px;
  margin-top: 6px;
  border-radius: 10px;
}

.exam-table-wrap,
.viewer-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #ffffff;
}

.exam-table-wrap {
  height: calc(100% - 160px);
}

.exam-table {
  width: 100%;
  border-collapse: collapse;
}

.exam-table th,
.exam-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.exam-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--accent-dark);
  background: #f3faf6;
  font-size: 11px;
  text-transform: uppercase;
}

.exam-table tbody tr {
  cursor: pointer;
}

.exam-table tbody tr:hover,
.exam-table tbody tr:focus {
  outline: none;
  background: #f3faf6;
}

.exam-table strong,
.exam-table small {
  display: block;
}

.exam-table small {
  margin-top: 3px;
  color: var(--muted);
}

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

.viewer-header button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.viewer-header button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

#btnViewerInverter svg path:last-child {
  fill: currentColor;
  stroke: none;
}

.viewer-header-simple .viewer-tools > button:not(#btnViewerMedir):not(#btnViewerInverter):not(#btnViewerEspelharH):not(#btnViewerEspelharV):not(#btnViewerMiniaturas):not(#btnViewerTelaCheia):not(#btnViewerGizmo):not(#btnViewerCentralizar3D):not(#btnViewerMpr) {
  display: none !important;
}

#btnViewerMiniaturas {
  display: none !important;
}

.viewer-header-simple {
  min-height: 44px;
  padding: 4px;
  gap: 4px;
  background: #0b1211;
  border: 1px solid #263c37;
  border-radius: 11px;
}

.viewer-header-simple .viewer-tools {
  width: 0;
  min-width: 0;
  max-width: 100%;
  flex: 1 1 0;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: #48625c #101916;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.viewer-header-simple .viewer-tools > * {
  flex-shrink: 0;
}

.viewer-header-simple .viewer-tools::-webkit-scrollbar {
  height: 5px;
}

.viewer-header-simple .viewer-tools::-webkit-scrollbar-track {
  background: #101916;
  border-radius: 999px;
}

.viewer-header-simple .viewer-tools::-webkit-scrollbar-thumb {
  background: #48625c;
  border-radius: 999px;
}

.viewer-tool-tooltip {
  position: fixed;
  z-index: 12000;
  display: block;
  max-width: 150px;
  padding: 5px 8px;
  color: #f4fffc;
  background: #07100e;
  border: 1px solid #36534c;
  border-radius: 6px;
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.38);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  pointer-events: none;
}

.viewer-tool-tooltip.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.series-selection-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: min(720px, calc(100dvh - 24px));
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 16px;
  overflow: visible;
}

.series-selection-dialog::backdrop {
  background: rgba(4, 14, 12, 0.72);
  backdrop-filter: blur(3px);
}

.series-selection-card {
  max-height: min(720px, calc(100dvh - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

.series-selection-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.series-selection-head > div {
  min-width: 0;
}

.series-selection-head strong,
.series-selection-head small {
  display: block;
}

.series-selection-head strong {
  font-size: 16px;
}

.series-selection-head small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.series-selection-back {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
}

.series-selection-back svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.series-selection-list {
  min-height: 0;
  display: grid;
  gap: 8px;
  overflow-y: auto;
}

.series-selection-option {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px;
  color: var(--text);
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
}

.series-selection-preview {
  position: relative;
  width: 112px;
  height: 80px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--muted);
  background: #07100e;
  border-radius: 7px;
}

.series-selection-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.series-selection-preview img.ready {
  opacity: 1;
}

.series-selection-preview-placeholder {
  position: absolute;
  inset: 0;
  padding: 8px;
  display: grid;
  place-items: center;
  place-content: center;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
}

.series-selection-preview-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: series-preview-spin 0.75s linear infinite;
}

.series-selection-preview-placeholder.error .series-selection-preview-spinner {
  display: none;
}

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

.series-selection-copy {
  min-width: 0;
  display: grid;
  justify-items: start;
  gap: 4px;
}

.series-selection-option:hover,
.series-selection-option:focus-visible {
  color: #ffffff;
  background: #009E9A;
  border-color: #009E9A;
}

.series-selection-option strong {
  font-size: 12px;
}

.series-selection-option span,
.series-selection-option small {
  color: var(--muted);
  font-size: 10px;
}

.series-selection-option:hover span,
.series-selection-option:hover small,
.series-selection-option:focus-visible span,
.series-selection-option:focus-visible small {
  color: rgba(255, 255, 255, 0.86);
}

@media (max-width: 520px) {
  .series-selection-card {
    padding: 12px;
  }

  .series-selection-option {
    min-height: 82px;
    grid-template-columns: 86px minmax(0, 1fr);
    gap: 9px;
  }

  .series-selection-preview {
    width: 86px;
    height: 66px;
  }
}

.viewer-header-simple button,
.viewer-header.viewer-header-simple .viewer-layout-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  color: #d8ebe7;
  background: #172522;
  border: 1px solid #2b4540;
  border-radius: 8px;
  box-shadow: none;
}

.viewer-header-simple button:hover {
  color: #ffffff;
  background: #203630;
}

.viewer-header-simple button.active,
.viewer-header-simple button[aria-pressed="true"] {
  color: #ffffff;
  background: #008f8b;
  border-color: #19b5b0;
}

.viewer-header-simple #btnViewerMedir.active,
.viewer-header-simple #btnViewerMedir[aria-pressed="true"] {
  color: #ffffff !important;
  background: #009E9A !important;
  border-color: #009E9A !important;
  box-shadow: 0 0 0 2px rgba(0, 158, 154, 0.22), 0 0 12px rgba(0, 158, 154, 0.3);
}

.viewer-header-simple #btnViewerMedir.active svg,
.viewer-header-simple #btnViewerMedir[aria-pressed="true"] svg {
  stroke: #ffffff !important;
}

.viewer-header-simple .viewer-tools .viewer-tool.active,
.viewer-header-simple .viewer-tools .viewer-tool[aria-pressed="true"] {
  color: #ffffff !important;
  background: #009E9A !important;
  border-color: #009E9A !important;
}

.viewer-fullscreen-host.viewer-measuring-active .viewer-tools #btnViewerMedir {
  color: #ffffff !important;
  background: #009E9A !important;
  border-color: #009E9A !important;
  box-shadow: 0 0 0 2px rgba(0, 158, 154, 0.22), 0 0 12px rgba(0, 158, 154, 0.3) !important;
}

.viewer-fullscreen-host.viewer-measuring-active .viewer-tools #btnViewerMedir svg {
  stroke: #ffffff !important;
}

.viewer-header-simple .viewer-layout-switcher {
  gap: 4px;
  padding: 0;
  flex: 0 0 auto;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.viewer-fullscreen-host:fullscreen,
.viewer-fullscreen-host:-webkit-full-screen,
.viewer-fullscreen-host.viewer-fullscreen-fallback {
  width: 100vw !important;
  height: 100dvh !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  background: #0f1714;
  border-radius: 0 !important;
}

.viewer-fullscreen-host.viewer-fullscreen-fallback {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000;
}

body.viewer-fullscreen-active {
  overflow: hidden;
}

.viewer-fullscreen-host:fullscreen > .viewer-body,
.viewer-fullscreen-host:-webkit-full-screen > .viewer-body,
.viewer-fullscreen-host.viewer-fullscreen-fallback > .viewer-body {
  height: calc(100% - 50px);
}

.viewer-gizmo-button,
.viewer-3d-reset-button {
  display: none !important;
}

.viewer-gizmo-button.visible,
.viewer-3d-reset-button.visible {
  display: inline-flex !important;
}

.viewer-mobile-warning {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 19, 15, 0.72);
}

.viewer-mobile-warning-card {
  width: min(390px, 100%);
  padding: 22px;
  color: var(--text);
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  text-align: center;
}

.viewer-mobile-warning-card strong {
  display: block;
  font-size: 16px;
}

.viewer-mobile-warning-card p {
  margin: 12px 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.viewer-mobile-warning-card button {
  min-width: 110px;
}

.viewer-rotation-gizmo {
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 8;
  width: min(48%, 360px);
  aspect-ratio: 1;
  display: none;
  transform: translate(-50%, -50%) scale(var(--gizmo-zoom, 1));
  transform-origin: center;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.viewer-rotation-gizmo.is-visible {
  display: block;
}

.viewer-rotation-gizmo .gizmo-axis {
  fill: none;
  stroke-width: 8;
  vector-effect: non-scaling-stroke;
  pointer-events: stroke;
  cursor: grab;
}

.viewer-rotation-gizmo .gizmo-axis:active {
  cursor: grabbing;
}

.viewer-rotation-gizmo .gizmo-axis-x { stroke: #ff4b4b; }
.viewer-rotation-gizmo .gizmo-axis-y { stroke: #3fe36f; }
.viewer-rotation-gizmo .gizmo-axis-z { stroke: #4294ff; }

.viewer-layout-switcher {
  display: inline-flex;
  position: relative;
  gap: 3px;
  padding: 3px;
  background: rgba(15, 23, 20, 0.08);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.viewer-header .viewer-layout-btn {
  width: 32px;
  min-width: 32px;
  height: 30px;
  border-radius: 7px;
}

.viewer-layout-btn.active,
.viewer-header button.active {
  color: #fff;
  background: #006f6c;
}

.viewer-body {
  height: calc(100% - 44px);
  position: relative;
  overflow: hidden;
  padding: 12px;
  background: #0f1714;
}

.viewer-vtk {
  position: absolute;
  top: 12px;
  right: 206px;
  bottom: 12px;
  left: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #0f1714;
  border-radius: 10px;
}

.viewer-body.viewer-3d .viewer-vtk {
  left: 12px;
}

.viewer-body.viewer-3d .viewer-thumbs,
.viewer-2d-only {
  display: none !important;
}

.viewer-body.viewer-3d .viewer-medidas {
  display: block;
  left: 12px;
}

.viewer-body.viewer-3d .viewer-hud {
  left: 16px;
  max-width: calc(100% - 238px);
}

.viewer-body.viewer-3d .viewer-vtk canvas {
  display: block;
}

.viewer-body.viewer-3d .viewer-vtk.viewer-flip-horizontal canvas {
  transform: scaleX(-1);
}

.viewer-body.viewer-3d .viewer-vtk.viewer-flip-vertical canvas {
  transform: scaleY(-1);
}

.viewer-body.viewer-3d .viewer-vtk.viewer-flip-horizontal.viewer-flip-vertical canvas {
  transform: scale(-1, -1);
}

.viewer-mpr-crosshair {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.viewer-mpr-crosshair.visible {
  display: block;
}

.viewer-mpr-crosshair line {
  stroke-width: 1.25;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 1px #000);
}

.viewer-image-grid {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid;
  gap: 3px;
  padding: 3px;
  background: #050807;
}

.viewer-image-grid-1 {
  grid-template-columns: 1fr;
}

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

.viewer-image-grid-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.viewer-image-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
}

.viewer-image-cell:hover {
  border-color: rgba(124, 224, 168, 0.65);
}

.viewer-image-cell.active {
  border-color: #7ce0a8;
  box-shadow: inset 0 0 0 1px #7ce0a8;
}

.viewer-image-cell.empty {
  cursor: default;
  opacity: 0.45;
}

.viewer-body .viewer-image-cell .dicom-preview {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
}

.viewer-image-number {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 2;
  padding: 2px 5px;
  color: #fff;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 4px;
  font-size: 10px;
  pointer-events: none;
}

.vtk-view-label {
  position: absolute;
  z-index: 2;
  padding: 4px 7px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(0, 0, 0, 0.52);
  border-radius: 5px;
  font-size: 11px;
  pointer-events: none;
}

.vtk-view-label-volume {
  top: 8px;
  left: 8px;
}

.vtk-view-label-axial {
  top: 8px;
  left: calc(50% + 8px);
}

.vtk-view-label-coronal {
  top: calc(50% + 8px);
  left: 8px;
}

.vtk-view-label-sagital {
  top: calc(50% + 8px);
  left: calc(50% + 8px);
}

.viewer-medidas {
  position: absolute;
  top: 12px;
  right: 206px;
  bottom: 12px;
  left: 124px;
  width: auto;
  height: auto;
  z-index: 3;
  pointer-events: none;
}

.viewer-thumbs {
  position: absolute;
  top: 12px;
  left: 12px;
  bottom: 12px;
  z-index: 2;
  width: 100px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  padding: 10px 8px;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
}

.viewer-thumbs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
}

.viewer-thumbs-head strong {
  font-size: 12px;
}

.viewer-thumbs-head small {
  color: rgba(255, 255, 255, 0.72);
}

.viewer-thumbs-list {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 2px;
}

.viewer-thumb-item {
  position: relative;
  flex: 0 0 auto;
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 4px;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  line-height: 1.1;
}

.viewer-thumb-item:disabled {
  cursor: wait;
}

.viewer-thumb-item.active {
  background: rgba(124, 224, 168, 0.18);
  border-color: rgba(124, 224, 168, 0.7);
}

.viewer-thumb-item.loading canvas {
  opacity: 0.45;
}

.viewer-thumb-item canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #000;
  border-radius: 6px;
  image-rendering: pixelated;
}

.viewer-thumb-loading {
  position: absolute;
  inset: 4px 4px 20px;
  display: none;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  font-size: 9px;
  line-height: 1;
}

.viewer-thumb-loading::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.viewer-thumb-item.loading .viewer-thumb-loading {
  display: flex;
}

.viewer-thumb-item span {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  text-align: center;
}

.viewer-thumb-item .viewer-thumb-loading {
  margin-top: 0;
}

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

.viewer-hud {
  position: absolute;
  left: 128px;
  bottom: 12px;
  max-width: calc(100% - 352px);
  padding: 8px 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.3;
}

.viewer-tool,
.viewer-side input,
.viewer-side select {
  font: inherit;
}

.viewer-tool.active {
  background: #d6ffe7;
  color: #0f1714;
}

.viewer-side {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: grid;
  align-content: start;
  gap: 8px;
  width: 182px;
  min-width: 182px;
  max-width: 182px;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 10px;
  color: #fff;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.viewer-side label {
  min-width: 0;
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.viewer-range-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.viewer-range-heading output {
  color: var(--accent-light);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: right;
}

.viewer-plane-control {
  display: none !important;
}

.viewer-plane-control.visible {
  display: grid !important;
}

.viewer-3d-unused {
  display: none !important;
}

.viewer-measure-mode {
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.viewer-measure-mode .viewer-rotation-gizmo,
.viewer-measure-mode .viewer-rotation-gizmo * {
  pointer-events: none !important;
}

.viewer-body.viewer-3d .viewer-measure-mode canvas {
  pointer-events: none;
}

.viewer-body.viewer-measuring .viewer-medidas {
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.viewer-3d-controls {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.viewer-3d-model-selectors {
  min-width: 0;
  max-width: 100%;
  display: grid;
  gap: 8px;
}

.viewer-3d-controls small {
  max-width: 170px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  line-height: 1.35;
}

.viewer-3d-controls label.active {
  color: #7ce0a8;
}

.viewer-player {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.viewer-player button {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 0;
  border-radius: 8px;
}

.viewer-player svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-side input,
.viewer-side select {
  width: 100%;
  padding: 4px 7px;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
}

.viewer-side input[type="range"] {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 18px !important;
  margin: 0;
  padding: 0;
  color-scheme: dark;
  accent-color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 0;
  outline: 0;
  box-shadow: none;
}

.viewer-side input[type="range"]:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.viewer-side select {
  color-scheme: dark;
  background: #050807;
}

.viewer-side select option,
.viewer-side select optgroup {
  color: #ffffff;
  background: #050807;
}

.viewer-body p {
  color: #ffffff;
}

.viewer-body .dicom-preview {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #000;
}

.exam-row {
  width: 100%;
  color: var(--text);
  background: #f3faf6;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.dicom-preview {
  width: 100%;
  max-height: calc(100% - 80px);
  object-fit: contain;
  background: #111;
  border-radius: 10px;
}

.upload-manual {
  display: grid;
  gap: 0;
  max-width: 920px;
  height: calc(100dvh - 88px);
  min-height: calc(100dvh - 88px);
  margin: 0 auto;
  align-content: stretch;
  overflow: hidden;
}

.upload-manual-form {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-self: stretch;
  height: 100%;
  min-height: 0;
  padding: 14px;
  background:
    radial-gradient(circle at top right, rgba(62, 176, 129, 0.14), transparent 30%),
    linear-gradient(180deg, #f8fdf9 0%, #eef8f2 100%);
  border: 1px solid rgba(25, 89, 61, 0.12);
  border-radius: 20px;
  box-shadow: 0 18px 36px rgba(23, 44, 33, 0.08);
}

.upload-manual-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.upload-manual-form input,
.upload-manual-form select {
  width: 100%;
}

.upload-dropzone {
  display: grid;
  place-items: center;
  min-height: 110px;
  padding: 12px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(220, 243, 229, 0.82));
  border: 2px dashed rgba(42, 132, 92, 0.35);
  border-radius: 18px;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.upload-dropzone.is-dragover {
  background: rgba(0, 158, 154, 0.12);
  border-color: #009e9a;
  box-shadow: 0 0 0 4px rgba(0, 158, 154, 0.12);
}

.upload-dropzone input {
  display: none;
}

.upload-dropzone strong {
  display: block;
  color: #103926;
  font-size: 18px;
}

.upload-dropzone span {
  color: #4a6b5b;
  font-size: 13px;
}

.upload-manual-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upload-manual-list-card {
  display: block;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  padding: 6px;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid rgba(25, 89, 61, 0.12);
  border-radius: 16px;
}

.upload-manual-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  color: #234734;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(25, 89, 61, 0.1);
  border-radius: 12px;
}

.upload-item-remove {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #8a2f2f;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(138, 47, 47, 0.16);
  border-radius: 10px;
}

.upload-item-remove svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-manual-message {
  min-height: 18px;
  margin: 0;
  color: #18736f;
  font-size: 13px;
}

.upload-manual-message.erro {
  color: #a93434;
}

.upload-manual-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
  padding-top: 4px;
}

.upload-manual-actions button {
  min-width: 130px;
  height: 38px;
  padding: 0 14px;
  font-size: 13px;
}

.upload-manual-total-box {
  text-align: right;
}

.upload-manual-total-box small {
  display: block;
  margin-bottom: 4px;
  color: #587060;
  font-size: 12px;
}

.upload-manual-total-box strong {
  color: #006f6c;
}

.upload-manual-actions .secondary {
  background: #fff;
  color: #1f4733;
  border: 1px solid rgba(25, 89, 61, 0.18);
}

@media (max-width: 820px) {
  .login-page {
    padding: 8px;
  }

  .login-shell {
    height: calc(100dvh - 16px);
    max-height: none;
    padding: 14px;
    border-radius: 20px;
  }

  .login-grid {
    grid-template-columns: 1fr;
  }

  .hub-layout,
  .hub-topbar {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .side-stack {
    grid-template-columns: 1fr 1fr;
  }

  .info-card,
  .session-card {
    padding: 12px;
  }

  .hub-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: 100dvh;
  }

  .hub-layout.menu-collapsed {
    grid-template-columns: 1fr;
  }

  .hub-sidebar {
    padding: 12px;
  }

  .hub-nav {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    margin-top: 0;
  }

  .menu-toggle {
    display: none;
  }

  .hub-brand-bottom {
    display: none;
  }

  .hub-nav button {
    height: 36px;
    padding: 0 8px;
    text-align: center;
  }

  .hub-main {
    padding: 12px;
  }

  .hub-topbar {
    margin-bottom: 10px;
  }

  .account-button {
    min-width: 0;
    width: 100%;
    max-width: 220px;
  }

  .hub-content {
    height: calc(100dvh - 156px);
    padding: 14px;
  }

  .exam-header,
  .exam-actions,
  .viewer-header {
    flex-direction: column;
  }

  .viewer-thumbs {
    width: 84px;
  }

  .viewer-vtk,
  .viewer-medidas {
    left: 108px;
    right: 174px;
  }

  .viewer-hud {
    left: 112px;
    max-width: calc(100% - 294px);
  }

  .viewer-side {
    position: static;
    margin-top: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .viewer-body.viewer-3d .viewer-vtk {
    left: 12px;
    right: 182px;
  }

  .viewer-body.viewer-3d .viewer-medidas {
    left: 12px;
    right: 182px;
  }

  .viewer-body.viewer-3d .viewer-side {
    position: absolute;
    top: 12px;
    right: 12px;
    margin-top: 0;
    width: 150px;
    min-width: 150px;
    max-width: 150px;
  }

  #btnViewerMiniaturas {
    display: inline-flex !important;
  }

  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-thumbs {
    display: none !important;
  }

  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-vtk,
  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-medidas {
    left: 12px;
  }

  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-hud {
    left: 16px;
    max-width: calc(100% - 206px);
  }

  .viewer-image-grid-8 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(4, minmax(0, 1fr));
  }

  .exam-actions,
  .exam-actions button {
    width: 100%;
  }

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

  .exam-table-wrap {
    height: calc(100% - 330px);
  }
}

@media (max-width: 560px) {
  .viewer-header {
    flex-direction: row;
    align-items: center;
  }

  .viewer-tools {
    flex-wrap: nowrap;
    gap: 4px;
    max-width: calc(100% - 42px);
    overflow-x: auto;
  }

  .viewer-header button {
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .viewer-header button svg {
    width: 17px;
    height: 17px;
  }

  .viewer-layout-switcher {
    flex: 0 0 auto;
    gap: 2px;
    padding: 2px;
  }

  .viewer-header .viewer-layout-btn {
    width: 28px;
    min-width: 28px;
    height: 28px;
  }

  .viewer-thumbs {
    top: 12px;
    bottom: 190px;
    left: 6px;
    width: 76px;
    display: grid;
    gap: 5px;
    padding: 6px 4px;
  }

  .viewer-thumbs-head {
    display: grid;
    justify-items: center;
    gap: 1px;
    line-height: 1.1;
  }

  .viewer-thumbs-head strong {
    font-size: 10px;
  }

  .viewer-thumbs-head small {
    font-size: 9px;
    white-space: nowrap;
  }

  .viewer-thumbs-list {
    gap: 6px;
    padding-right: 1px;
  }

  .viewer-thumb-item {
    padding: 3px;
  }

  .viewer-thumb-item canvas {
    width: 100%;
    height: 58px;
    object-fit: contain;
  }

  .viewer-thumb-item span {
    margin-top: 3px;
    font-size: 9px;
  }

  .viewer-vtk,
  .viewer-medidas {
    left: 90px;
    right: 12px;
    bottom: 190px;
  }

  .viewer-hud {
    left: 94px;
    max-width: calc(100% - 110px);
  }

  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-hud {
    max-width: calc(100% - 32px);
  }

  .viewer-body:not(.viewer-3d) .viewer-side {
    position: absolute;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 90px;
    width: auto;
    min-width: 0;
    max-width: none;
    height: 166px;
    margin: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    overflow-y: auto;
  }

  .viewer-body:not(.viewer-3d) .viewer-side > label,
  .viewer-body:not(.viewer-3d) .viewer-side > select {
    min-width: 0;
    margin: 0;
  }

  .viewer-body:not(.viewer-3d) .viewer-player,
  .viewer-body:not(.viewer-3d) .viewer-side > select {
    grid-column: 1 / -1;
  }

  .viewer-fullscreen-host.viewer-thumbs-hidden .viewer-body:not(.viewer-3d) .viewer-side {
    left: 12px;
  }

  .viewer-body.viewer-3d .viewer-vtk {
    top: 12px;
    right: 12px;
    bottom: 268px;
    left: 12px;
    min-height: 220px;
  }

  .viewer-body.viewer-3d .viewer-medidas {
    top: 12px;
    right: 12px;
    bottom: 268px;
    left: 12px;
  }

  .viewer-body.viewer-3d .viewer-side {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
    max-height: 238px;
    grid-template-columns: minmax(112px, 1.5fr) repeat(2, minmax(62px, 1fr));
    align-items: end;
    overflow-y: auto;
  }

  .viewer-body.viewer-3d .viewer-side > label {
    min-width: 0;
    margin: 0;
  }

  .viewer-body.viewer-3d .viewer-player {
    align-self: end;
    gap: 4px;
  }

  .viewer-body.viewer-3d .viewer-player button,
  .viewer-body.viewer-3d .viewer-side > label > input {
    height: 38px;
  }

  .viewer-body.viewer-3d .viewer-side > select {
    grid-column: 1 / -1;
    height: 38px;
    margin: 0;
  }

  .viewer-body.viewer-3d .viewer-hud {
    bottom: 276px;
    max-width: calc(100% - 32px);
  }

  .viewer-3d-controls {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
  }

  .viewer-3d-controls label {
    min-width: 0;
    margin: 0;
  }

  .viewer-3d-model-selectors {
    gap: 6px;
  }

  .viewer-3d-controls small {
    max-width: none;
  }

  .login-shell {
    padding: 12px;
    border-radius: 18px;
  }

  .brand-header {
    margin-bottom: 10px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 15px;
    font-size: 23px;
  }

  .brand-header p,
  .side-stack {
    display: none;
  }

  .login-card {
    padding: 14px;
  }

  .eyebrow {
    margin-bottom: 5px;
    font-size: 9px;
  }

  h1 {
    margin-bottom: 0;
    font-size: 21px;
  }

  h2 {
    margin-bottom: 8px;
    font-size: 19px;
  }

  label {
    margin: 8px 0 4px;
    font-size: 10px;
  }

  input,
  select {
    height: 38px;
    border-radius: 13px;
  }

  .form-note {
    margin: 8px 0;
    font-size: 11px;
    line-height: 1.35;
  }

  button {
    height: 38px;
    border-radius: 13px;
  }
}

@media (max-height: 640px) and (min-width: 821px) {
  .login-shell {
    padding: 0;
  }

  .brand-header {
    margin-bottom: 16px;
  }

  .brand-mark {
    width: 66px;
    height: 66px;
    border-radius: 20px;
    font-size: 30px;
  }

  h1 {
    font-size: 28px;
    margin-bottom: 8px;
  }

  h2 {
    margin-bottom: 12px;
    font-size: 23px;
  }

  label {
    margin: 10px 0 6px;
  }

  input,
  select {
    height: 42px;
  }

  .login-card,
  .info-card,
  .session-card {
    padding: 16px;
  }

  .form-note {
    margin: 10px 0;
  }
}

@media (max-width: 380px) {
  .login-shell {
    padding: 10px;
  }

  .brand-header {
    gap: 8px;
  }

  .brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 20px;
  }

  h1 {
    font-size: 18px;
  }

  h2 {
    font-size: 17px;
  }

  .login-card {
    padding: 11px;
  }

  input,
  select,
  button {
    height: 34px;
  }
}

/* Sidebar estilo painel claro */
.hub-layout {
  grid-template-columns: 252px 1fr;
  background: #ffffff;
}

.hub-layout.menu-collapsed {
  grid-template-columns: 72px 1fr;
}

.hub-sidebar {
  padding: 14px 10px;
  background: #ffffff;
  color: var(--text);
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 22px rgba(0, 122, 119, 0.06);
}

.sidebar-profile {
  position: relative;
  display: grid;
  grid-template-columns: 42px 1fr 24px;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin-bottom: 18px;
}

.sidebar-profile .account-avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
}

.sidebar-profile-text {
  min-width: 0;
}

.sidebar-profile-text strong,
.sidebar-profile-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-text strong {
  color: var(--text);
  font-size: 13px;
  line-height: 1.25;
}

.sidebar-profile-text small {
  color: var(--muted);
  font-size: 10px;
}

.menu-toggle {
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  font-size: 12px;
  line-height: 24px;
}

.hub-nav {
  gap: 8px;
}

.hub-nav button {
  height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.hub-nav button span,
.logout-button span {
  width: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--accent-dark);
}

.hub-nav button:hover {
  background: #eef7f2;
}

.hub-nav button.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(0, 158, 154, 0.2);
}

.hub-nav button.active span {
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.hub-brand-bottom {
  padding: 12px 4px 8px;
  border-top: 1px solid var(--border);
}

.hub-brand-bottom strong {
  color: var(--text);
  font-size: 14px;
  line-height: 32px;
}

.hub-brand-bottom .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
}

.logout-button {
  height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: transparent;
  border-top: 1px solid var(--border);
  border-radius: 0;
  font-size: 12px;
  font-weight: 600;
}

.logout-button:hover {
  background: #eef7f2;
}

.menu-collapsed .hub-sidebar {
  padding: 14px;
}

.menu-collapsed .sidebar-profile {
  grid-template-columns: 42px;
  justify-content: center;
}

.menu-collapsed .sidebar-profile-text,
.menu-collapsed .hub-brand-bottom strong,
.menu-collapsed .logout-button {
  display: none;
}

.menu-collapsed .menu-toggle {
  position: absolute;
  top: 8px;
  right: -26px;
  display: grid;
  place-items: center;
}

.menu-collapsed .hub-nav button {
  width: 44px;
  padding: 0;
  justify-content: center;
  font-size: 0;
}

.menu-collapsed .hub-nav button span {
  width: auto;
  font-size: 15px;
}

/* Sidebar final */
.hub-layout {
  grid-template-columns: 252px 1fr;
}

.hub-layout.menu-collapsed {
  grid-template-columns: 72px 1fr;
}

.hub-sidebar {
  padding: 14px 10px;
  background: #ffffff;
  border-right: 1px solid var(--border);
  box-shadow: 8px 0 22px rgba(0, 122, 119, 0.06);
}

.sidebar-profile {
  grid-template-columns: 42px 1fr 24px;
  gap: 10px;
  margin-bottom: 20px;
}

.menu-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  color: #ffffff;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  right: -24px;
  top: 50%;
  transform: translateY(-50%);
  border: 3px solid #ffffff;
  box-shadow: 0 6px 14px rgba(0, 122, 119, 0.18);
  z-index: 3;
}

.menu-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
}

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

.hub-nav button,
.logout-button {
  height: 44px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.hub-nav svg,
.logout-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hub-nav button:hover,
.logout-button:hover {
  background: #eef7f2;
}

.hub-nav button.active {
  color: #ffffff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(0, 158, 154, 0.2);
}

.sidebar-footer {
  margin-top: auto;
}

.sidebar-logo {
  display: block;
  width: min(160px, 100%);
  height: auto;
  margin: 0 auto 10px;
  border-radius: 8px;
  object-fit: contain;
}

.menu-collapsed .sidebar-logo {
  width: 44px;
  margin-bottom: 8px;
}

.logout-button {
  width: 100%;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

.menu-collapsed .hub-sidebar {
  padding: 14px;
  align-items: center;
}

.menu-collapsed .sidebar-profile {
  display: grid;
  grid-template-columns: 42px;
  justify-items: center;
  width: 44px;
}

.menu-collapsed .sidebar-profile-text {
  display: none;
}

.menu-collapsed .menu-toggle {
  transform: translateY(-50%) rotate(180deg);
}

.menu-collapsed .hub-nav button,
.menu-collapsed .logout-button {
  width: 44px;
  padding: 0;
  justify-content: center;
}

.menu-collapsed .hub-nav button span,
.menu-collapsed .logout-button span {
  display: none;
}

.sidebar-profile .menu-toggle,
.menu-collapsed .sidebar-profile .menu-toggle {
  top: 50%;
  right: -24px;
}

.menu-collapsed .logout-button {
  display: flex;
}

.menu-collapsed .logout-button svg {
  display: block;
}

.hub-sidebar {
  position: relative;
}

.sidebar-profile {
  position: static;
}

.sidebar-profile .menu-toggle,
.menu-collapsed .sidebar-profile .menu-toggle {
  top: 50%;
  right: -15px;
}

/* Tela de exames compacta */
.hub-main {
  padding: 14px;
}

.hub-topbar {
  min-height: 44px;
  margin-bottom: 10px;
  padding: 0 10px;
}

.hub-topbar h2 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 22px;
}

.hub-topbar > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.hub-content {
  height: calc(100dvh - 68px);
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.exam-header {
  margin-bottom: 8px;
}

.exam-header p {
  margin-bottom: 0;
}

.exam-actions button {
  height: 36px;
  min-width: 92px;
  border-radius: 9px;
}

.exam-filters {
  grid-template-columns: minmax(220px, 1fr) 150px 150px 140px;
  gap: 8px;
  margin-bottom: 8px;
}

.exam-filters label {
  font-size: 10px;
}

.exam-filters input,
.exam-filters select {
  height: 34px;
  margin-top: 4px;
  padding: 0 10px;
  border-radius: 8px;
}

.exam-table-wrap {
  height: calc(100% - 83px);
  border-radius: 10px;
}

.exam-table th,
.exam-table td {
  padding: 9px 10px;
}

.exam-table th:nth-child(1),
.exam-table td:nth-child(1) {
  width: 58%;
}

.exam-table th:nth-child(2),
.exam-table td:nth-child(2) {
  width: 28%;
}

.exam-table th:nth-child(3),
.exam-table td:nth-child(3) {
  width: 14%;
}

.hub-topbar {
  min-height: 38px;
  align-items: center;
}

.hub-topbar h2 {
  font-size: 20px;
  line-height: 38px;
}

.reload-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
}

.reload-button svg {
  width: 20px;
  height: 20px;
}

body.hub-page .hub-layout.viewer-mode,
body.hub-page .hub-layout.viewer-mode.menu-collapsed {
  grid-template-columns: minmax(0, 1fr);
}

body.hub-page .hub-layout.viewer-mode .hub-sidebar,
body.hub-page .hub-layout.viewer-mode .hub-topbar {
  display: none !important;
}

body.hub-page .hub-layout.viewer-mode .hub-main {
  padding: 0;
}

body.hub-page .hub-layout.viewer-mode .hub-content {
  height: 100dvh;
  padding: 0;
}

.viewer-mode .viewer-header-simple {
  margin: 0;
  border-radius: 0;
}

.viewer-mode .viewer-body {
  border: 0;
  border-radius: 0;
}

.login-shell {
  padding: 0 !important;
}

body.login-page .login-card .login-field {
  width: 100%;
  height: 44px;
  padding: 0;
  display: flex;
  align-items: center;
  background: #f4f7f6;
  border: 1px solid #dce8e4;
  border-radius: 4px;
  overflow: hidden;
}

body.login-page .login-card .login-field span {
  width: 40px;
  flex: 0 0 40px;
  height: 100%;
  display: grid;
  place-items: center;
  color: #009E9A;
}

body.login-page .login-card .login-field svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.login-page .login-card .password-toggle {
  width: 40px;
  height: 100%;
  margin: 0;
  padding: 0;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: #eef4ff;
  color: #009E9A;
  cursor: pointer;
}

body.login-page .login-card .password-toggle svg {
  width: 17px;
  height: 17px;
}

body.login-page .login-card .login-field input {
  flex: 1 1 auto;
  width: 100% !important;
  min-width: 0;
  height: 100% !important;
  padding: 0 12px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  background: #eef4ff !important;
}

body.login-page .login-card .login-field input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px #eef4ff inset !important;
  -webkit-text-fill-color: #0f1f1a !important;
}

body.login-page {
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.login-page > .login-shell {
  margin: auto;
}

.company-choice {
  width: min(100%, 380px);
  display: grid;
  gap: 14px;
}

.company-choice[hidden] {
  display: none !important;
}

.company-choice h2,
.company-choice p {
  margin: 0;
  text-align: center;
}

.company-choice h2 {
  color: var(--accent-dark);
  font-size: 26px;
}

.company-choice p {
  color: #71817c;
  font-size: 13px;
}

.company-choice-list {
  display: grid;
  gap: 10px;
  max-height: min(420px, 52vh);
  overflow-y: auto;
}

.company-choice-item {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  color: #17352c;
  background: #f4f9f7;
  border: 1px solid #d6e9e3;
  border-radius: 12px;
  text-align: left;
}

.company-choice-item:hover,
.company-choice-item:focus-visible {
  background: #e9f8f3;
  border-color: #009e9a;
  box-shadow: 0 0 0 3px rgba(0, 158, 154, 0.14);
}

.company-choice-item:disabled {
  opacity: 0.6;
  cursor: wait;
}

.company-choice-logo {
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: #009e9a;
  border-radius: 10px;
  font-weight: 800;
}

.company-choice-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.company-choice-back {
  justify-self: center;
  padding: 8px 18px;
  color: #507168;
  background: transparent;
  border: 0;
}

@media (max-width: 720px) {
  body.login-page {
    padding: 0;
  }

  body.login-page .login-shell {
    width: 100%;
    height: auto;
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    max-width: none;
    max-height: none;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    border-radius: 0;
  }

  body.login-page .login-welcome {
    display: none;
  }

  body.login-page .login-form-panel {
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    padding:
      max(24px, env(safe-area-inset-top))
      max(24px, env(safe-area-inset-right))
      max(24px, env(safe-area-inset-bottom))
      max(24px, env(safe-area-inset-left));
    display: grid;
    place-items: center;
    align-content: center;
  }

  body.login-page .login-card {
    width: min(100%, 360px);
  }

  body.login-page .login-mobile-logo {
    width: 220px;
    max-width: 82%;
    height: auto;
    margin: 0 auto 28px;
    display: block;
  }
}

@media (max-width: 820px) {
  body.hub-page .hub-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: 1fr;
    height: 100dvh;
  }

  body.hub-page .hub-layout.menu-collapsed {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  body.hub-page .hub-sidebar {
    width: 220px;
    min-height: 100dvh;
    padding: 12px 10px;
    border-right: 1px solid var(--border);
    border-bottom: 0;
  }

  body.hub-page .hub-layout.menu-collapsed .hub-sidebar {
    width: 72px;
    padding: 12px 8px;
  }

  body.hub-page .sidebar-profile {
    grid-template-columns: 42px 1fr;
    justify-items: stretch;
    margin-bottom: 18px;
  }

  body.hub-page .hub-layout.menu-collapsed .sidebar-profile {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  body.hub-page .hub-layout.menu-collapsed .sidebar-profile-text,
  body.hub-page .hub-layout.menu-collapsed .hub-nav button span,
  body.hub-page .hub-layout.menu-collapsed .logout-button span {
    display: none;
  }

  body.hub-page .menu-toggle {
    display: flex;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
  }

  body.hub-page .hub-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 0;
  }

  body.hub-page .hub-nav button {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    justify-content: flex-start;
  }

  body.hub-page .hub-layout.menu-collapsed .hub-nav button {
    width: 48px;
    padding: 0;
    justify-content: center;
  }

  body.hub-page .sidebar-footer {
    margin-top: auto;
  }

  body.hub-page .logout-button {
    width: 100%;
    height: 48px;
    padding: 0 12px;
    justify-content: flex-start;
  }

  body.hub-page .hub-layout.menu-collapsed .logout-button {
    width: 48px;
    padding: 0;
    justify-content: center;
  }

  body.hub-page .hub-main {
    min-width: 0;
    padding: 10px;
  }

  body.hub-page .hub-topbar {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  body.hub-page .hub-content {
    height: calc(100dvh - 82px);
  }
}

[hidden] {
  display: none !important;
}

/* Configurações do usuário */
.settings-page {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.settings-card {
  width: 100%;
  min-height: 82px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.settings-card h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.settings-card p {
  margin: 0;
  font-size: 10px;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.settings-profile-card {
  align-items: flex-start;
  justify-content: flex-start;
}

.settings-profile-photo {
  width: 150px;
  flex: 0 0 150px;
  display: grid;
  justify-items: center;
  gap: 8px;
}

.settings-profile-preview {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  font-size: 32px;
  font-weight: 800;
}

.settings-profile-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-profile-photo button {
  width: auto;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  font-size: 9px;
}

.settings-profile-photo small {
  color: var(--muted);
  font-size: 8px;
  text-align: center;
}

.settings-profile-form {
  min-width: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
}

.settings-profile-heading,
.settings-profile-actions {
  grid-column: 1 / -1;
}

.settings-profile-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.settings-profile-form input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-transform: none;
}

.settings-profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-profile-actions .settings-message {
  margin: 0;
}

.settings-profile-actions button {
  width: auto;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 9px;
}

.settings-switch {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-transform: none;
}

.settings-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.settings-switch > span {
  position: relative;
  width: 44px;
  height: 24px;
  background: #aebdb7;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.settings-switch > span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
  transition: transform 0.2s ease;
}

.settings-switch input:checked + span {
  background: var(--accent);
}

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

.settings-switch strong {
  min-width: 62px;
  color: var(--text);
  font-size: 10px;
}

.settings-quality-card {
  align-items: flex-start;
}

.settings-quality-heading {
  max-width: 360px;
}

.settings-quality-form {
  min-width: min(100%, 520px);
  display: grid;
  grid-template-columns: minmax(170px, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.settings-quality-form label,
.settings-quality-field {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 10px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: none;
}

.settings-quality-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 12px;
}

.settings-quality-fields input[type="range"] {
  --range-progress: 0%;
  width: 100%;
  min-width: 0;
  height: 32px;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: transparent;
  box-shadow: none;
  touch-action: manipulation;
}

.viewer-layout-menu {
  padding: 2px;
}

.viewer-layout-popover {
  position: fixed;
  z-index: 10020;
  display: none;
  width: 92px;
  padding: 9px;
  color: #d9e7e2;
  background: #202321;
  border: 1px solid #424743;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.viewer-layout-menu.open .viewer-layout-popover {
  display: block;
}

.viewer-layout-grid {
  display: grid;
  grid-template-columns: repeat(2, 28px);
  grid-template-rows: repeat(2, 28px);
  justify-content: center;
  gap: 3px;
}

.viewer-header .viewer-layout-popover .viewer-layout-cell {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 0;
  background: #272b29;
  border: 1px solid #4a504c;
  border-radius: 2px;
}

.viewer-header .viewer-layout-popover .viewer-layout-cell.selected,
.viewer-header .viewer-layout-popover .viewer-layout-cell.preview {
  background: rgba(0, 158, 154, 0.3);
  border-color: #00a19c;
  box-shadow: inset 0 0 0 1px rgba(0, 158, 154, 0.25);
}

.viewer-layout-selection-label {
  display: block;
  min-height: 14px;
  margin-top: 7px;
  color: #b8c8c2;
  font-size: 9px;
  line-height: 1.3;
  text-align: center;
  white-space: nowrap;
}

.viewer-layout-menu-2d .viewer-layout-popover {
  width: 124px;
}

.viewer-layout-grid-2d {
  grid-template-columns: repeat(4, 22px);
  grid-template-rows: repeat(2, 22px);
}

.viewer-header .viewer-layout-grid-2d .viewer-layout-cell {
  width: 22px;
  min-width: 22px;
  height: 22px;
}

.settings-quality-field > label {
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.settings-quality-fields input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0,
    var(--accent) var(--range-progress),
    var(--border) var(--range-progress),
    var(--border) 100%
  );
}

.settings-quality-fields input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -9px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.settings-quality-fields input[type="range"]::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0,
    var(--accent) var(--range-progress),
    var(--border) var(--range-progress),
    var(--border) 100%
  );
}

.settings-quality-fields input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: transparent;
}

.settings-quality-fields input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

.settings-quality-fields input[type="range"]:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}

.settings-quality-value {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
}

.settings-quality-value input[type="number"] {
  width: 48px;
  height: 30px;
  padding: 0 5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  box-shadow: none;
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  appearance: textfield;
  -moz-appearance: textfield;
}

.settings-quality-value input[type="number"]::-webkit-inner-spin-button,
.settings-quality-value input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.settings-quality-form button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  white-space: nowrap;
  font-size: 9px;
}

.settings-message {
  min-height: 18px;
  margin: 8px 2px;
  color: var(--accent-dark);
  font-size: 9px;
}

.settings-logo-card {
  align-items: center;
}

.settings-logo-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.settings-logo-preview {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 20px;
  font-weight: 800;
}

.settings-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
}

.settings-logo-control button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  font-size: 10px;
}

.settings-logo-select {
  color: var(--accent-dark);
  background: var(--soft);
  border: 1px solid var(--border);
}

.settings-logo-control button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.settings-message.error {
  color: #e06a78;
}

@media (max-width: 760px) {
  body.hub-page .hub-main {
    width: 100%;
    padding: 8px;
    overflow: hidden;
  }

  body.hub-page .hub-topbar {
    min-height: 42px;
    padding: 0 6px;
  }

  body.hub-page .hub-topbar h2 {
    font-size: clamp(17px, 5vw, 21px);
  }

  body.hub-page .hub-content {
    width: 100%;
    height: calc(100dvh - 64px);
    padding: 0;
    overflow: hidden;
  }

  .settings-page {
    width: 100%;
    min-width: 0;
    padding: 0 2px 12px;
    gap: 8px;
    overflow-x: hidden;
  }

  .settings-card,
  .settings-logo-card {
    min-width: 0;
    min-height: 0;
    padding: 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .settings-logo-control {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .settings-profile-photo {
    width: 100%;
    flex: 0 0 auto;
  }

  .settings-profile-form {
    min-width: 0;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .settings-profile-form label,
  .settings-profile-form input,
  .settings-profile-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-profile-actions button,
  .settings-quality-form button {
    width: 100%;
  }

  .settings-quality-form {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .settings-quality-fields {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .settings-quality-field,
  .settings-quality-fields input {
    min-width: 0;
  }

  .settings-quality-heading {
    max-width: none;
  }

  .settings-switch {
    width: 100%;
    justify-content: space-between;
  }

  .settings-logo-control button {
    flex: 1 1 130px;
  }
}

@media (max-width: 420px) {
  body.hub-page .hub-layout.menu-collapsed {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  body.hub-page .hub-layout.menu-collapsed .hub-sidebar {
    width: 62px;
    padding-inline: 7px;
  }

  body.hub-page .hub-layout.menu-collapsed .hub-nav button,
  body.hub-page .hub-layout.menu-collapsed .logout-button {
    width: 46px;
  }

  .settings-profile-preview {
    width: 96px;
    height: 96px;
  }

  .settings-logo-control {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .settings-logo-control button {
    width: 100%;
    grid-column: 1 / -1;
  }
}

/* Estrutura responsiva da tela de configurações */
.settings-page {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 2px 2px 18px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-areas:
    "profile profile"
    "appearance appearance"
    "company company"
    "quality quality"
    "whatsapp whatsapp"
    "reports reports"
    "message message";
  grid-auto-rows: max-content;
  align-content: start;
  gap: 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: none;
}

.settings-page > .settings-profile-card {
  grid-area: profile;
}

.settings-page > .settings-card:nth-of-type(2) {
  grid-area: appearance;
}

.settings-page:not(.has-company-logo-settings) > .settings-card:nth-of-type(2) {
  grid-column: 1 / -1;
}

.settings-page > .settings-quality-card {
  grid-area: quality;
}

.settings-page > .settings-logo-card {
  grid-area: company;
}

.settings-page > .settings-whatsapp-card {
  grid-area: whatsapp;
}

.settings-page > .settings-report-templates {
  grid-area: reports;
}

.settings-page > #configuracoesMensagem {
  grid-area: message;
}

.communication-page {
  max-width: 520px;
  margin: 0 auto;
  padding: 8px;
  grid-template-areas: "whatsapp";
  grid-template-columns: 1fr;
  align-content: center;
  justify-content: center;
  gap: 16px;
}

.hub-page-description {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.hub-main.communication-mode .hub-topbar {
  min-height: 56px;
}

.hub-main.communication-mode .hub-topbar h2 {
  line-height: 1.2;
}

.communication-page .settings-whatsapp-card > #comunicacaoMensagem {
  width: 100%;
  min-height: 0;
  text-align: center;
}

.communication-page > .settings-whatsapp-card,
.communication-page > .settings-whatsapp-card[data-status="qr"] {
  width: 100%;
  min-height: 500px;
  padding: 22px;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  gap: 4px;
  border-radius: 18px;
  text-align: center;
}

.communication-page .settings-whatsapp-heading,
.communication-page .settings-whatsapp-control {
  width: 100%;
  min-width: 0;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.communication-page .settings-whatsapp-heading {
  background: transparent;
  border: 0;
}

.communication-page .settings-whatsapp-heading h3 {
  font-size: 18px;
}

.communication-page .settings-whatsapp-status {
  margin-top: 14px;
  justify-content: center;
}

.communication-page .settings-whatsapp-status strong {
  font-size: 17px;
}

.communication-page .settings-whatsapp-control {
  gap: 10px;
  background: transparent;
  border: 0;
}

.communication-page .settings-whatsapp-control p {
  max-width: 420px;
  font-size: 12px;
  line-height: 1.55;
}

.communication-page .settings-whatsapp-control img {
  width: min(220px, 45dvh, 100%);
}

.communication-page .settings-whatsapp-qr-placeholder {
  position: relative;
  width: min(220px, 45dvh, 100%);
  aspect-ratio: 1;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.communication-page .settings-whatsapp-qr-placeholder::before {
  content: "";
  position: absolute;
  inset: 8px;
  background: #ffffff url("imagens/qr-claria-representacao.svg") center / contain no-repeat;
  filter: blur(4px);
  opacity: 0.38;
  transform: scale(1.04);
}

.communication-page .settings-whatsapp-qr-placeholder img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.communication-page #configuracaoWhatsappConectar {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 154px;
  min-height: 42px;
  transform: translate(-50%, -50%);
  box-shadow: 0 8px 22px rgba(0, 91, 86, 0.28);
}

.communication-page #configuracaoWhatsappConectar[hidden] {
  display: none;
}

.communication-page .settings-whatsapp-actions button {
  min-width: 150px;
  min-height: 38px;
}

.settings-card,
.settings-logo-card {
  min-width: 0;
  min-height: 104px;
  height: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-auto-rows: max-content;
  align-items: center;
  align-self: start;
  gap: 18px;
  overflow: visible;
}

.settings-card > div,
.settings-card form,
.settings-card label {
  min-width: 0;
}

.settings-card h3,
.settings-card p {
  overflow-wrap: anywhere;
}

.settings-profile-card {
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: start;
}

.settings-profile-photo {
  width: 100%;
  min-width: 0;
  flex: none;
}

.settings-profile-form {
  width: 100%;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-profile-actions {
  min-width: 0;
  flex-wrap: wrap;
}

.settings-quality-card {
  grid-template-columns: minmax(220px, 0.65fr) minmax(430px, 1.35fr);
  align-items: start;
}

.settings-quality-form {
  width: 100%;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
}

.settings-quality-fields {
  min-width: 0;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-quality-fields[hidden],
.settings-hosted-warning[hidden] {
  display: none !important;
}

.settings-logo-control {
  min-width: 0;
  flex-wrap: wrap;
}

.settings-logo-control button {
  max-width: 100%;
  white-space: nowrap;
}

.settings-logo-preview img {
  background: transparent;
}

.settings-whatsapp-card {
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1.25fr);
  align-items: start;
}

.settings-whatsapp-card[data-status="qr"] {
  grid-template-columns: minmax(0, 1fr);
}

.settings-whatsapp-card[data-status="qr"] .settings-whatsapp-control {
  width: 100%;
}

.settings-whatsapp-heading small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
}

.settings-whatsapp-status {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-whatsapp-status > span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #a8b3af;
  box-shadow: 0 0 0 4px rgba(168, 179, 175, 0.18);
}

.settings-whatsapp-card[data-status="conectado"] .settings-whatsapp-status > span {
  background: #25d366;
  box-shadow: 0 0 0 4px rgba(37, 211, 102, 0.18);
}

.settings-whatsapp-card[data-status="qr"] .settings-whatsapp-status > span,
.settings-whatsapp-card[data-status="conectando"] .settings-whatsapp-status > span {
  background: #e5a400;
  box-shadow: 0 0 0 4px rgba(229, 164, 0, 0.18);
}

.settings-whatsapp-card[data-status="erro"] .settings-whatsapp-status > span,
.settings-whatsapp-card[data-status="indisponivel"] .settings-whatsapp-status > span {
  background: #d94747;
  box-shadow: 0 0 0 4px rgba(217, 71, 71, 0.18);
}

.settings-whatsapp-control {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 10px;
  text-align: center;
}

.settings-whatsapp-control img {
  width: min(280px, 100%);
  aspect-ratio: 1;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.settings-whatsapp-control p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.settings-whatsapp-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.settings-whatsapp-actions button {
  min-height: 38px;
}

.viewer-mpr-button {
  min-width: 42px;
  padding-inline: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.viewer-mpr-settings {
  display: none;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(124, 224, 168, 0.3);
  border-radius: 7px;
  background: rgba(124, 224, 168, 0.06);
}

.viewer-mpr-settings.visible {
  display: grid;
}

.viewer-mpr-settings > strong {
  color: #7ce0a8;
  font-size: 12px;
}

.viewer-mpr-settings input[type="number"] {
  width: 100%;
}

/* Padrao unico dos botoes da tela de configuracoes */
.settings-page button {
  width: auto;
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.settings-report-templates {
  align-items: start;
  grid-template-columns: minmax(220px, 0.7fr) minmax(220px, auto);
}

.settings-report-templates-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-report-templates-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.settings-page .settings-report-template-item {
  width: 100%;
  min-height: 58px;
  height: auto;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: left;
}

.settings-report-template-item span,
.settings-report-template-item strong,
.settings-report-template-item small {
  min-width: 0;
  display: block;
}

.settings-report-template-item strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-report-template-item small,
.settings-report-template-item em,
.settings-report-templates-empty {
  color: var(--muted);
  font-size: 9px;
}

.settings-report-template-item small { margin-top: 4px; }
.settings-report-template-item em { font-style: normal; }
.settings-report-templates-empty { grid-column: 1 / -1; margin: 0; }
.settings-report-templates > .settings-message { grid-column: 1 / -1; }

.report-template-dialog {
  width: min(1040px, calc(100vw - 30px));
}

.report-template-fields {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.35fr);
  gap: 10px;
}

.report-template-fields label,
.report-template-picker {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.report-template-fields input,
.report-template-picker select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.report-template-picker {
  margin-bottom: 10px;
}

.report-template-dialog .ql-editor {
  min-height: 360px;
}

#modeloLaudoExcluir {
  margin-right: auto;
  color: #b83b4b;
}

@media (max-width: 620px) {
  .report-template-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-report-templates-actions {
    justify-content: stretch;
  }

  .settings-report-templates-actions button {
    flex: 1 1 140px;
  }
}

@media (max-width: 820px) {
  .settings-whatsapp-card {
    grid-template-columns: 1fr;
  }

  .settings-whatsapp-control img,
  .settings-whatsapp-actions,
  .communication-page .settings-whatsapp-qr-placeholder {
    display: none !important;
  }

  .communication-page {
    padding: 8px 2px 20px;
  }

  .communication-page > .settings-whatsapp-card,
  .communication-page > .settings-whatsapp-card[data-status="qr"] {
    min-height: 0;
    padding: 12px;
    grid-template-columns: 1fr;
    gap: 12px;
    border-radius: 14px;
  }

  .communication-page .settings-whatsapp-heading,
  .communication-page .settings-whatsapp-control {
    padding: 20px;
  }
}

@media (max-width: 1100px) {
  .settings-page {
    display: flex;
    flex-direction: column;
  }

  .settings-page > .settings-card,
  .settings-page > .settings-logo-card,
  .settings-page > #configuracoesMensagem {
    flex: 0 0 auto;
  }

  .settings-quality-card {
    grid-template-columns: minmax(200px, 0.55fr) minmax(0, 1.45fr);
  }
}

@media (max-width: 760px) {
  body.hub-page .hub-content {
    min-width: 0;
    overflow: hidden;
  }

  .settings-page {
    padding: 0 0 16px;
    gap: 10px;
  }

  .settings-card,
  .settings-logo-card,
  .settings-profile-card,
  .settings-quality-card {
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-height: none;
    height: max-content;
    flex: 0 0 auto;
    padding: 14px;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: max-content;
    align-items: stretch;
    align-self: auto;
    gap: 14px;
    overflow: visible;
  }

  .settings-profile-photo {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: stretch;
    gap: 8px 12px;
  }

  .settings-profile-preview {
    width: 96px;
    height: 96px;
    grid-row: 1 / -1;
  }

  .settings-profile-photo button {
    width: 100%;
  }

  .settings-profile-photo small {
    text-align: left;
  }

  .settings-profile-form,
  .settings-quality-form,
  .settings-quality-fields {
    width: 100%;
    min-width: 0;
    height: max-content;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-profile-heading,
  .settings-profile-actions,
  .settings-quality-fields,
  .settings-hosted-warning {
    grid-column: 1;
  }

  .settings-profile-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .settings-profile-actions button,
  .settings-quality-form button {
    width: 100%;
  }

  .settings-switch {
    width: 100%;
    justify-content: flex-start;
  }

  .settings-logo-control {
    width: 100%;
    display: grid;
    grid-template-columns: 64px minmax(0, 1fr);
    justify-content: stretch;
    gap: 8px;
  }

  .settings-logo-preview {
    width: 64px;
    height: 64px;
    grid-row: span 2;
  }

  .settings-logo-control button {
    width: 100%;
    min-width: 0;
    grid-column: 2;
  }
}

@media (max-width: 420px) {
  .settings-profile-photo {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .settings-profile-preview {
    width: 78px;
    height: 78px;
  }

  .settings-card,
  .settings-logo-card,
  .settings-profile-card,
  .settings-quality-card {
    padding: 12px;
  }

  .settings-logo-control {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .settings-logo-preview {
    width: 54px;
    height: 54px;
  }
}

/* Logo da empresa: titulo acima, logo a esquerda e acoes a direita */
.settings-page .settings-logo-card {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
}

.settings-page .settings-logo-heading {
  width: 100%;
}

.settings-page .settings-logo-control {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-page .settings-logo-preview {
  grid-row: auto;
}

.settings-page .settings-logo-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
}

.settings-page .settings-logo-actions button {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
  grid-column: auto;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .settings-page .settings-logo-actions {
    flex: 1 1 auto;
  }

  .settings-page .settings-logo-actions button {
    flex: 1 1 0;
    padding-inline: 8px;
  }
}

@media (max-width: 820px) {
  .viewer-body.viewer-3d {
    --viewer-controls-height: min(156px, 29%);
  }

  .viewer-body.viewer-3d .viewer-vtk,
  .viewer-body.viewer-3d .viewer-medidas {
    top: 12px;
    right: 12px;
    bottom: calc(var(--viewer-controls-height) + 24px);
    left: 12px;
    min-height: 0;
  }

  .viewer-body.viewer-3d .viewer-side {
    position: absolute;
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    min-width: 0;
    max-width: none;
    height: var(--viewer-controls-height);
    max-height: none;
    gap: 6px;
    padding: 8px;
    grid-template-columns: minmax(112px, 1.5fr) repeat(2, minmax(62px, 1fr));
    align-items: end;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .viewer-body.viewer-3d .viewer-side > label {
    min-width: 0;
    margin: 0;
    gap: 2px;
    font-size: 11px;
  }

  .viewer-body.viewer-3d .viewer-side > label > input:not([type="range"]),
  .viewer-body.viewer-3d .viewer-side > select {
    height: 30px;
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .viewer-body.viewer-3d .viewer-side > select,
  .viewer-body.viewer-3d .viewer-3d-controls {
    grid-column: 1 / -1;
  }

  .viewer-body.viewer-3d .viewer-player button {
    height: 26px;
  }

  .viewer-body.viewer-3d .viewer-hud {
    bottom: calc(var(--viewer-controls-height) + 16px);
  }

  .viewer-body.viewer-3d .viewer-hud.viewer-hud-volume-progress {
    width: max-content;
    max-width: min(320px, calc(100% - 40px));
    padding: 5px 8px;
    z-index: 4;
    overflow: hidden;
    border-radius: 6px;
    font-size: 9px;
    line-height: 1.2;
    white-space: nowrap;
    text-overflow: ellipsis;
    pointer-events: none;
  }
}

.viewer-volume-progress-mobile {
  display: none;
}

@media (max-width: 560px) {
  .viewer-body.viewer-3d {
    --viewer-controls-height: min(150px, 31%);
  }

  .viewer-body.viewer-3d .viewer-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .viewer-body.viewer-3d .viewer-player {
    grid-column: 1 / -1;
  }

  .viewer-body.viewer-3d .viewer-hud.viewer-hud-volume-progress {
    right: auto;
    bottom: calc(var(--viewer-controls-height) + 16px);
    left: 16px;
    background: rgba(15, 23, 20, 0.94);
  }

  .viewer-hud-volume-progress .viewer-volume-progress-desktop {
    display: none;
  }

  .viewer-hud-volume-progress .viewer-volume-progress-mobile {
    display: inline;
  }

}

/* Tema escuro */
html[data-theme="dark"] {
  --bg: #0d1a1a;
  --surface: #152626;
  --surface-strong: #152626;
  --border: #31504f;
  --text: #edf8f7;
  --muted: #9bbab8;
  --accent: #009E9A;
  --accent-dark: #62d3cf;
  --accent-light: #2ab5b1;
  --soft: #213b3a;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

html[data-theme="dark"] body,
html[data-theme="dark"] .hub-main {
  background: var(--bg);
}

html[data-theme="dark"] .hub-layout {
  background: var(--bg);
}

html[data-theme="dark"] .hub-sidebar {
  color: var(--text);
  background: #121d19;
  border-right-color: var(--border);
  box-shadow: 8px 0 22px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .sidebar-profile-text strong,
html[data-theme="dark"] .hub-nav button,
html[data-theme="dark"] .logout-button {
  color: var(--text);
}

html[data-theme="dark"] .sidebar-profile-text small {
  color: var(--muted);
}

/* Navegação mobile por menu da conta */
.mobile-account-button,
.mobile-menu-backdrop {
  display: none;
}

@media (max-width: 820px) {
  body.hub-page .hub-layout,
  body.hub-page .hub-layout.menu-collapsed {
    display: block;
    width: 100%;
    height: 100dvh;
  }

  body.hub-page .hub-main {
    width: 100%;
    height: 100dvh;
  }

  body.hub-page .hub-topbar {
    position: relative;
    z-index: 31;
    gap: 8px;
  }

  body.hub-page .hub-topbar > div:first-child {
    flex: 1 1 auto;
  }

  body.hub-page .hub-topbar-actions {
    margin-left: auto;
  }

  .mobile-account-button {
    display: grid;
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: transparent;
  }

  .mobile-account-button .account-avatar {
    width: 40px;
    height: 40px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--accent-light), var(--accent-dark));
    box-shadow: 0 5px 14px rgba(0, 122, 119, 0.22);
  }

  body.hub-page .hub-sidebar,
  body.hub-page .hub-layout.menu-collapsed .hub-sidebar {
    position: fixed;
    z-index: 40;
    top: 60px;
    right: 10px;
    bottom: auto;
    left: auto;
    width: min(310px, calc(100vw - 20px));
    min-height: 0;
    max-height: calc(100dvh - 72px);
    padding: 14px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 55px rgba(12, 45, 44, 0.24);
    transform: none;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
  }

  body.hub-page .hub-layout.menu-collapsed .hub-sidebar {
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px) scale(0.98);
  }

  body.hub-page .hub-layout:not(.menu-collapsed) .mobile-menu-backdrop {
    display: block;
    position: fixed;
    z-index: 30;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(8, 30, 29, 0.32);
  }

  body.hub-page .sidebar-profile,
  body.hub-page .hub-layout.menu-collapsed .sidebar-profile {
    display: none !important;
  }

  body.hub-page .hub-layout.menu-collapsed .sidebar-profile-text,
  body.hub-page .hub-layout.menu-collapsed .hub-nav button span,
  body.hub-page .hub-layout.menu-collapsed .logout-button span {
    display: block;
  }

  body.hub-page .menu-toggle {
    display: none;
  }

  body.hub-page .hub-nav,
  body.hub-page .hub-layout.menu-collapsed .hub-nav {
    display: grid;
    grid-template-columns: 1fr;
    margin: 0;
  }

  body.hub-page .hub-nav button,
  body.hub-page .hub-layout.menu-collapsed .hub-nav button,
  body.hub-page .logout-button,
  body.hub-page .hub-layout.menu-collapsed .logout-button {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    justify-content: flex-start;
  }

  body.hub-page .sidebar-logo,
  body.hub-page .hub-layout.menu-collapsed .sidebar-logo {
    width: 112px;
    margin-top: 10px;
  }

  body.hub-page .hub-sidebar .sidebar-footer {
    display: none !important;
  }
}

html[data-theme="dark"] .hub-nav button:hover,
html[data-theme="dark"] .hub-nav button.active {
  color: #ffffff;
  background: var(--accent);
}

html[data-theme="dark"] .menu-toggle {
  border-color: #121d19;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .permissions-card,
html[data-theme="dark"] .settings-card,
html[data-theme="dark"] .schedule-calendar-card,
html[data-theme="dark"] .schedule-day-panel,
html[data-theme="dark"] .schedule-dialog,
html[data-theme="dark"] .schedule-pdf-dialog,
html[data-theme="dark"] .permissions-group-dialog,
html[data-theme="dark"] .report-dialog,
html[data-theme="dark"] .exam-table-wrap,
html[data-theme="dark"] .viewer-body {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] select,
html[data-theme="dark"] select option,
html[data-theme="dark"] select optgroup {
  color-scheme: dark;
  color: var(--text);
  background: var(--surface);
}

html[data-theme="dark"] .exam-table th,
html[data-theme="dark"] .schedule-weekdays,
html[data-theme="dark"] .permissions-group-item,
html[data-theme="dark"] .permissions-user-list button,
html[data-theme="dark"] .schedule-appointment {
  color: var(--text);
  background: #202e29;
}

html[data-theme="dark"] .exam-report-button,
html[data-theme="dark"] .exam-share-button {
  background: #203534;
  border-color: #395655;
}

html[data-theme="dark"] .exam-report-button {
  color: #b7d8cf;
}

html[data-theme="dark"] .exam-patient-link-button {
  color: #45e0da;
}

html[data-theme="dark"] .exam-print-button {
  color: #77c9e8;
}

html[data-theme="dark"] .exam-delete-button {
  color: #ff6578;
}

html[data-theme="dark"] .exam-share-button:disabled {
  color: #91aaa7;
  opacity: 0.68;
}

html[data-theme="dark"] .exam-report-button.reported {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

html[data-theme="dark"] .exam-whatsapp-button {
  color: #ffffff;
  background: #25d366;
  border-color: #25d366;
}

html[data-theme="dark"] .schedule-calendar {
  background: #111f1f;
}

html[data-theme="dark"] .schedule-weekdays {
  background: #1b302f;
  border-bottom-color: var(--border);
}

html[data-theme="dark"] .schedule-day {
  color: var(--text);
  background: #172827;
  border-color: var(--border);
}

html[data-theme="dark"] .schedule-day.outside {
  color: #789492;
  background: #101d1d;
}

html[data-theme="dark"] .schedule-day small {
  color: var(--accent-dark);
  background: #203b37;
}

html[data-theme="dark"] .schedule-day.full small {
  color: #ff9aa6;
  background: #48282e;
}

html[data-theme="dark"] .schedule-day strong {
  color: var(--muted);
}

html[data-theme="dark"] .schedule-appointment {
  background: #1b302e;
  border-color: var(--border);
  border-left-color: var(--accent);
}

html[data-theme="dark"] .schedule-appointment.status-cancelado {
  border-left-color: #8a9993;
}

html[data-theme="dark"] .schedule-appointment.status-realizado {
  border-left-color: #5fa7e5;
}

html[data-theme="dark"] .schedule-appointment.status-faltou {
  border-left-color: #e16e7b;
}

html[data-theme="dark"] .schedule-appointment em {
  color: var(--accent-dark);
  background: #203b37;
}

html[data-theme="dark"] .exam-table tbody tr:hover,
html[data-theme="dark"] .exam-table tbody tr:focus,
html[data-theme="dark"] .permissions-user-list button.active,
html[data-theme="dark"] .permissions-grid fieldset label:hover,
html[data-theme="dark"] .schedule-day:hover,
html[data-theme="dark"] .schedule-day.selected {
  background: #263b34;
}

html[data-theme="dark"] .schedule-day.selected {
  background: #21423f;
  box-shadow: inset 0 0 0 2px var(--accent);
}

html[data-theme="dark"] .schedule-appointment:hover {
  background: #25413d;
}

html[data-theme="dark"] .schedule-day,
html[data-theme="dark"] .permissions-grid fieldset,
html[data-theme="dark"] .permissions-mode-selector > label,
html[data-theme="dark"] .permissions-group-item {
  border-color: var(--border);
}

html[data-theme="dark"] .schedule-secondary {
  color: var(--text);
  background: #263832;
}

html[data-theme="dark"] .dialog-back-button,
html[data-theme="dark"] .schedule-dialog-close {
  color: var(--accent-dark);
  background: #203633;
  border: 1px solid var(--border);
  box-shadow: none;
}

html[data-theme="dark"] .dialog-back-button:hover,
html[data-theme="dark"] .dialog-back-button:focus-visible,
html[data-theme="dark"] .schedule-dialog-close:hover,
html[data-theme="dark"] .schedule-dialog-close:focus-visible {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

html[data-theme="dark"] #permissoesUsuarioRodape {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] .loading-overlay,
html[data-theme="dark"] .share-loading,
html[data-theme="dark"] .schedule-search-overlay,
html[data-theme="dark"] .permissions-delete-loading {
  color: var(--text);
  background: rgba(16, 24, 21, 0.88);
}

/* Business Intelligence */
body.hub-page .hub-main.bi-mode .hub-topbar {
  min-height: 58px;
  margin-bottom: 12px;
  padding: 0 14px;
  flex-direction: row;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

body.hub-page .hub-main.bi-mode .hub-topbar > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

body.hub-page .hub-main.bi-mode .hub-topbar h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 750;
  line-height: 1.2;
}

body.hub-page .hub-main.bi-mode .hub-topbar-actions {
  flex: 0 0 auto;
}

body.hub-page .hub-main.bi-mode .hub-content {
  height: calc(100dvh - 98px);
}

.bi-page {
  height: 100%;
  min-height: 0;
  padding-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-x: hidden;
  overflow-y: auto;
}

.bi-screen {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bi-screen[hidden] {
  display: none !important;
}

.bi-view-switcher {
  position: relative;
}

.bi-view-menu-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  border-radius: 9px;
}

.bi-view-menu-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.bi-view-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 290px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  box-shadow: 0 16px 42px rgba(20, 55, 44, 0.2);
}

.bi-view-menu[hidden] {
  display: none !important;
}

.bi-view-menu button {
  min-height: 90px;
  padding: 10px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 9px;
}

.bi-view-menu button:hover,
.bi-view-menu button.active {
  color: var(--accent-dark);
  background: var(--soft);
  border-color: var(--border);
}

.bi-view-menu svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bi-filters {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  align-items: end;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
}

.bi-mode .bi-filters {
  padding: 12px;
  flex: 0 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.bi-filters label {
  min-width: 0;
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.bi-filters input,
.bi-filters select,
.bi-filters button {
  height: 38px;
  margin-top: 4px;
  border-radius: 8px;
  font-size: 11px;
}

.bi-mode .bi-filters input,
.bi-mode .bi-filters select,
.bi-mode .bi-filters button {
  height: 44px;
  font-size: 13px;
}

.bi-filters button {
  width: auto;
  min-width: 110px;
  padding: 0 12px;
}

.bi-kpis {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.bi-kpis article,
.bi-chart-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
}

.bi-kpis article {
  min-height: 112px;
  padding: 14px;
}

.bi-kpis small,
.bi-kpis strong,
.bi-kpis span {
  display: block;
}

.bi-kpis small,
.bi-chart-card header small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.bi-kpis strong {
  margin: 5px 0 3px;
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.bi-kpis span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-charts {
  min-height: 630px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(280px, auto) minmax(320px, auto);
  gap: 9px;
}

#biTelaGeral .bi-charts > .bi-chart-card:nth-child(2) {
  grid-column: 2;
  grid-row: 1;
}

#biTelaGeral .bi-charts > .bi-chart-card:nth-child(3) {
  grid-column: 1 / -1;
  grid-row: 2;
}

.bi-location-screen {
  min-height: 720px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: minmax(350px, auto) minmax(340px, auto);
  align-items: stretch;
}

.bi-location-screen .bi-chart-card {
  min-height: 0;
}

.bi-location-screen .bi-chart-card:nth-child(3) {
  grid-column: 1 / -1;
}

.bi-map {
  flex: 1;
  min-height: 350px;
  overflow: hidden;
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 9px;
}

.bi-map iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.bi-map-placeholder {
  width: 100%;
  height: 100%;
  min-height: 350px;
  display: grid;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.bi-map-placeholder strong,
.bi-map-placeholder span {
  display: block;
}

.bi-map-placeholder strong {
  color: var(--text);
  font-size: 11px;
}

.bi-map-placeholder span,
.bi-map-caption {
  font-size: 7px;
}

.bi-activity-side {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.bi-recent-activity {
  min-height: 0;
  padding-top: 8px;
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
  border-top: 1px solid var(--border);
}

.bi-recent-activity > div {
  padding-bottom: 6px;
  display: grid;
  gap: 2px;
  border-bottom: 1px solid var(--border);
}

.bi-recent-activity strong,
.bi-recent-activity span,
.bi-recent-activity small {
  display: block;
}

.bi-recent-activity strong {
  color: var(--text);
  font-size: 8px;
}

.bi-recent-activity span,
.bi-recent-activity small {
  color: var(--muted);
  font-size: 7px;
}

.bi-map-caption {
  min-height: 12px;
  margin-top: 7px;
  color: var(--muted);
}

.bi-period-chart {
  flex: 1;
  min-height: 350px;
  padding: 15px 6px 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(38px, 1fr));
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}

.bi-period-column {
  height: 100%;
  min-width: 0;
  display: grid;
  grid-template-rows: 18px minmax(0, 1fr) 28px;
  align-items: end;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.bi-period-column strong {
  color: var(--text);
  font-size: 9px;
}

.bi-period-column > span {
  width: min(34px, 80%);
  height: 100%;
  margin: auto;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  background: var(--soft);
  border-radius: 7px 7px 0 0;
}

.bi-period-column i {
  width: 100%;
  min-height: 2px;
  display: block;
  background: linear-gradient(180deg, var(--accent-light), var(--accent));
  border-radius: inherit;
}

.bi-period-column small {
  overflow: hidden;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-chart-card {
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bi-chart-card header {
  margin-bottom: 8px;
}

.bi-chart-card h3 {
  margin: 3px 0 0;
  color: var(--text);
  font-size: 12px;
}

.bi-donut-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(110px, 0.9fr) minmax(120px, 1.1fr);
  align-items: center;
  gap: 14px;
}

.bi-donut {
  width: min(160px, 100%);
  aspect-ratio: 1;
  margin: auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.bi-donut > span {
  width: 57%;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  color: var(--text);
  background: var(--surface);
  border-radius: 50%;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
}

.bi-donut span small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 600;
}

.bi-legend {
  max-height: 210px;
  display: grid;
  gap: 7px;
  overflow: auto;
}

.bi-legend > div {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 8px;
}

.bi-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.bi-line-chart {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
}

.bi-line-chart svg {
  width: 100%;
  height: 100%;
  min-height: 190px;
  overflow: visible;
}

.bi-axis {
  stroke: var(--border);
  stroke-width: 1;
}

.bi-line-area {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
}

.bi-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bi-line-chart circle {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 3;
}

.bi-line-chart text {
  fill: var(--muted);
  font-size: 8px;
}

.bi-doctors-chart {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 9px;
  overflow: auto;
}

.bi-doctor-row {
  display: grid;
  grid-template-columns: minmax(90px, 0.9fr) minmax(80px, 1fr) 26px;
  align-items: center;
  gap: 7px;
}

.bi-doctor-row strong,
.bi-doctor-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bi-doctor-row strong {
  color: var(--text);
  font-size: 8px;
}

.bi-doctor-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 6px;
}

.bi-doctor-row > span {
  height: 7px;
  overflow: hidden;
  background: var(--soft);
  border-radius: 999px;
}

.bi-doctor-row i {
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: inherit;
}

.bi-doctor-row b {
  color: var(--text);
  font-size: 9px;
  text-align: right;
}

.bi-empty,
.bi-message {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.bi-message {
  min-height: 14px;
  color: #b83b4b;
}

@media (max-width: 1100px) {
  .bi-page {
    overflow: auto;
  }

  .bi-filters {
    grid-template-columns: repeat(5, minmax(160px, 1fr));
  }

  .bi-kpis {
    grid-template-columns: repeat(5, minmax(170px, 1fr));
  }

  .bi-charts {
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  #biTelaGeral .bi-charts > .bi-chart-card:nth-child(2),
  #biTelaGeral .bi-charts > .bi-chart-card:nth-child(3) {
    grid-column: auto;
    grid-row: auto;
  }

  .bi-chart-card {
    min-height: 300px;
  }

  .bi-location-screen {
    min-height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }

  .bi-location-screen .bi-chart-card {
    min-height: 420px;
  }

  .bi-location-screen .bi-chart-card:nth-child(3) {
    grid-column: auto;
  }
}

@media (max-width: 820px) {
  body.hub-page .hub-main.bi-mode .hub-topbar {
    min-height: 56px;
    margin-bottom: 10px;
    padding: 0 10px;
  }

  body.hub-page .hub-main.bi-mode .hub-topbar h2 {
    font-size: 20px;
    line-height: 1.2;
  }

  body.hub-page .hub-main.bi-mode .hub-content {
    height: calc(100dvh - 82px);
  }

  .bi-mode .bi-filters {
    min-height: 86px;
    padding: 10px;
  }

  .bi-mode .bi-filters label {
    flex-basis: 160px;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
    height: 68px;
    font-size: 12px;
  }

  .bi-mode .bi-kpis article {
    min-height: 108px;
  }
}

/* Laudos */
.exams-page {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.exams-page .exam-header,
.exams-page .exam-filters {
  margin: 0;
}

.exams-page .exam-filters {
  grid-template-columns: minmax(170px, 1fr) 190px minmax(180px, 1fr) 155px 115px 125px 145px;
  min-width: 0;
  align-items: end;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  overscroll-behavior-x: contain;
  touch-action: auto;
  scrollbar-width: thin;
}

#filtroPeriodo {
  cursor: pointer;
}

.date-filter-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
}

.date-filter-dialog::backdrop {
  background: rgba(15, 23, 42, 0.35);
}

.date-filter-dialog form {
  padding: 20px;
}

.date-filter-dialog header,
.date-filter-dialog footer,
.date-filter-fields {
  display: flex;
  align-items: center;
  gap: 12px;
}

.date-filter-dialog header {
  justify-content: space-between;
  margin-bottom: 18px;
}

.date-filter-dialog header button {
  border: 0;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.date-filter-fields label {
  flex: 1;
  font-size: 12px;
}

.date-filter-fields input {
  width: 100%;
  margin-top: 6px;
}

.date-filter-dialog footer {
  justify-content: flex-end;
  margin-top: 20px;
}

@media (max-width: 520px) {
  .date-filter-fields {
    align-items: stretch;
    flex-direction: column;
  }
}

.exams-page .exam-filters label {
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.exams-page .exam-filters input,
.exams-page .exam-filters select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.exams-page .exam-table-wrap {
  height: auto;
  min-height: 0;
  overflow-x: auto;
  overflow-y: auto;
  overscroll-behavior-x: contain;
  overscroll-behavior-y: contain;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

.exam-table {
  table-layout: fixed;
  min-width: 760px;
}

.exam-table th,
.exam-table td,
.exam-table strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.exam-table th:nth-child(1),
.exam-table td:nth-child(1) {
  width: 36%;
}

.exams-page:not(.can-share-exams) .exam-table th:nth-child(1),
.exams-page:not(.can-share-exams) .exam-table td:nth-child(1) {
  width: 48%;
}

.exam-table th:nth-child(2),
.exam-table td:nth-child(2) {
  width: 20%;
}

.exam-table th:nth-child(3),
.exam-table td:nth-child(3) {
  width: 12%;
}

.exam-table th:nth-child(4),
.exam-table td:nth-child(4) {
  width: 10%;
}

.exam-report-heading,
.exam-report-cell {
  width: 10% !important;
  text-align: center;
  vertical-align: middle;
}

.exam-patient-heading,
.exam-patient-cell,
.exam-share-heading,
.exam-share-cell,
.exam-delete-heading,
.exam-delete-cell {
  padding-right: 6px !important;
  padding-left: 6px !important;
  text-align: center;
  vertical-align: middle;
}

.exams-page.can-share-exams .exam-table {
  min-width: 980px;
}

.exams-page.can-share-exams .exam-table th:first-child,
.exams-page.can-share-exams .exam-table td:first-child {
  width: 26%;
}

.exams-page.can-share-exams .exam-table th:nth-child(2),
.exams-page.can-share-exams .exam-table td:nth-child(2) {
  width: 18%;
}

.exams-page.can-share-exams .exam-table th:nth-child(3),
.exams-page.can-share-exams .exam-table td:nth-child(3) {
  width: 10%;
}

.exams-page.can-share-exams .exam-table th:nth-child(4),
.exams-page.can-share-exams .exam-table td:nth-child(4),
.exams-page.can-share-exams .exam-report-heading,
.exams-page.can-share-exams .exam-report-cell,
.exam-delete-heading,
.exam-delete-cell {
  width: 8% !important;
}

.exam-patient-heading,
.exam-patient-cell {
  width: 10% !important;
}

.exam-share-heading,
.exam-share-cell {
  width: 12% !important;
}

.exam-table th:first-child,
.exam-table td:first-child {
  text-align: left;
  vertical-align: middle;
}

.exam-table th:not(:first-child),
.exam-table td:not(:first-child) {
  text-align: center;
  vertical-align: middle;
}

.exam-report-cell,
.exam-patient-cell,
.exam-share-cell,
.exam-delete-cell {
  line-height: 0;
  white-space: nowrap;
}

.exam-report-button,
.exam-share-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: #72877f;
  background: #eef4f1;
  border: 1px solid #d8e6e0;
  border-radius: 8px;
}

.exam-report-button.reported {
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.exam-report-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.exam-share-button {
  color: var(--accent);
}

.exam-share-button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.45;
}

.exam-print-button {
  color: #3f6475;
}

.schedule-pdf-dialog {
  width: min(900px, calc(100vw - 30px));
  height: min(760px, calc(100dvh - 30px));
  padding: 14px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.schedule-pdf-dialog::backdrop {
  background: rgba(15, 31, 26, 0.48);
}

.schedule-pdf-dialog header,
.schedule-pdf-dialog footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.schedule-pdf-dialog header {
  min-height: 32px;
}

.schedule-pdf-dialog header h3 {
  margin: 0;
  line-height: 32px;
  font-size: 16px;
}

.schedule-pdf-dialog header .dialog-back-button {
  align-self: center;
}

.schedule-pdf-dialog iframe {
  width: 100%;
  height: calc(100% - 94px);
  margin: 12px 0;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.schedule-pdf-dialog footer {
  justify-content: flex-end;
}

.exam-delete-button {
  color: #b83b4b;
}

.exam-share-cell .exam-share-button + .exam-share-button {
  margin-left: 5px;
}

.exam-whatsapp-button,
.share-whatsapp-send {
  color: #fff;
  background: #25d366;
  border-color: #25d366;
}

.exam-whatsapp-button:hover,
.share-whatsapp-send:hover {
  background: #1fb457;
  border-color: #1fb457;
}

.exam-whatsapp-button svg {
  fill: none;
  stroke: currentColor;
}

.exam-whatsapp-button,
.exam-whatsapp-button:disabled {
  color: #000000;
}

html[data-theme="dark"] .exam-whatsapp-button,
html[data-theme="dark"] .exam-whatsapp-button:disabled {
  color: #ffffff;
}

.exam-share-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.report-dialog {
  width: min(1040px, calc(100vw - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(20, 60, 47, 0.24);
}

.report-dialog::backdrop {
  background: rgba(15, 31, 26, 0.5);
  backdrop-filter: blur(2px);
}

.report-dialog form {
  padding: 18px;
}

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

.report-dialog header {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.schedule-dialog header,
.schedule-pdf-dialog header {
  justify-content: flex-start;
}

.report-dialog header small {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.report-dialog h3 {
  margin: 3px 0;
  font-size: 16px;
}

#laudoExameInfo {
  color: var(--muted);
  font-size: 10px;
}

#compartilharExameInfo {
  color: var(--muted);
  font-size: 10px;
}

#vincularPacienteExameInfo {
  color: var(--muted);
  font-size: 10px;
}

.exam-patient-link-button {
  color: var(--accent-dark);
}

.exam-patient-link-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.patient-link-dialog {
  width: min(760px, calc(100vw - 30px));
}

.patient-link-dialog form {
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.patient-link-dialog header,
.patient-link-dialog footer,
.patient-link-filters {
  flex: 0 0 auto;
}

.patient-link-filters {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.patient-link-filters label {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
}

.patient-link-filters input,
.patient-link-filters select {
  width: 100%;
  height: 38px;
  margin-top: 5px;
  padding: 0 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.patient-link-list {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 50dvh;
  padding: 4px;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.patient-link-list.loading,
.patient-link-empty {
  place-content: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.patient-link-appointment {
  margin: 0;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}

.patient-link-appointment:hover,
.patient-link-appointment:has(input:checked) {
  background: var(--soft);
  border-color: var(--accent);
}

.patient-link-appointment:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.patient-link-appointment input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.patient-link-appointment span,
.patient-link-appointment strong,
.patient-link-appointment small {
  min-width: 0;
  display: block;
}

.patient-link-appointment strong,
.patient-link-appointment small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.patient-link-appointment strong {
  font-size: 11px;
}

.patient-link-appointment small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.patient-link-appointment em {
  padding: 5px 7px;
  color: var(--accent-dark);
  background: var(--soft);
  border-radius: 6px;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.share-dialog {
  position: relative;
  width: min(700px, calc(100vw - 30px));
  overflow: hidden;
}

@media (max-width: 620px) {
  .patient-link-filters {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .patient-link-appointment {
    grid-template-columns: 20px minmax(0, 1fr);
  }

  .patient-link-appointment em {
    grid-column: 2;
    width: max-content;
  }
}

.share-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(2px);
}

.share-loading.active {
  display: grid;
}

.share-loading strong {
  font-size: 12px;
}

.delete-exam-dialog {
  width: min(520px, calc(100vw - 30px));
}

.delete-exam-warning {
  margin: 4px 0 16px;
  padding: 12px;
  color: #7b2834;
  background: #fff1f3;
  border: 1px solid #f2c6cc;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
}

.delete-exam-password {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.delete-exam-password input {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  color: var(--text);
  background: #fbfdfc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.delete-exam-confirm {
  color: #ffffff;
  background: #b83b4b;
}

#excluirExameFechar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  color: var(--muted);
  background: #eef5f2;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

#excluirExameInfo {
  color: var(--muted);
  font-size: 10px;
}

.share-access-box {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-bottom: 16px;
  padding: 14px;
  background: rgba(0, 158, 154, 0.08);
  border: 1px solid rgba(0, 158, 154, 0.2);
  border-radius: 10px;
}

.share-access-box span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.share-access-box strong {
  color: var(--accent);
  font-size: 22px;
  letter-spacing: 0.12em;
}

.share-access-box a {
  max-width: 100%;
  color: var(--accent);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.share-email-row {
  display: block;
}

.share-email-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.share-email-row input {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  color: var(--text);
  background: #fbfdfc;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.share-patient-status {
  min-height: 18px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 10px;
}

#compartilharFechar {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  flex: 0 0 32px;
  color: var(--muted);
  background: #eef5f2;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

#compartilharExameDialog footer {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

#compartilharExameDialog footer button {
  width: 100%;
  min-width: 0;
}

@media (max-width: 680px) {
  #compartilharExameDialog footer {
    grid-template-columns: 1fr;
  }
}

#laudoFechar {
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--muted);
  background: #eef5f2;
  border-radius: 8px;
  font-size: 22px;
}

.report-editor-shell {
  overflow: hidden;
  background: #eef3f1;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.report-editor-shell .ql-toolbar.ql-snow {
  min-height: 46px;
  padding: 6px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  overflow-x: auto;
  background: #f4f8f6;
  border: 0;
  border-bottom: 1px solid var(--border);
}

.report-editor-shell .ql-toolbar.ql-snow .ql-formats {
  margin: 2px 8px 2px 0;
}

.report-editor-shell .ql-toolbar.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.report-editor-shell .ql-container.ql-snow {
  border: 0;
  font: 14px/1.6 Arial, sans-serif;
}

.report-editor-shell .ql-editor {
  min-height: 440px;
  max-height: 58dvh;
  padding: 34px 42px;
  overflow-y: auto;
  color: #000000 !important;
  caret-color: #000000;
  background: #ffffff;
  outline: none;
}

.report-editor-shell .ql-editor p,
.report-editor-shell .ql-editor li,
.report-editor-shell .ql-editor h1,
.report-editor-shell .ql-editor h2,
.report-editor-shell .ql-editor h3,
.report-editor-shell .ql-editor blockquote {
  color: inherit;
}

.report-editor-shell .ql-editor.ql-blank::before {
  color: #7f928d;
  font-style: normal;
  left: 42px;
  right: 42px;
}

.report-editor-shell .ql-editor p {
  margin: 0 0 10px;
}

.report-editor-shell .ql-editor h1 { font-size: 24px; }
.report-editor-shell .ql-editor h2 { font-size: 20px; }
.report-editor-shell .ql-editor h3 { font-size: 17px; }

.report-editor-shell .ql-editor[contenteditable="false"] {
  background: #f7faf9;
}

.report-editor-shell .ql-editor:focus {
  box-shadow: inset 0 0 0 2px rgba(0, 158, 154, 0.35);
}

.report-metadata {
  min-height: 26px;
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  color: var(--muted);
  font-size: 9px;
}

.report-error {
  min-height: 18px;
  margin: 6px 0;
  color: #b83b4b;
  font-size: 10px;
}

.report-dialog footer {
  justify-content: flex-end;
  flex-wrap: wrap;
}

html[data-theme="dark"] .report-editor-shell,
html[data-theme="dark"] .report-editor-shell .ql-toolbar.ql-snow {
  background: #142322;
  border-color: var(--border);
}

html[data-theme="dark"] .report-editor-shell .ql-stroke {
  stroke: #d7efec;
}

html[data-theme="dark"] .report-editor-shell .ql-fill,
html[data-theme="dark"] .report-editor-shell .ql-picker {
  color: #d7efec;
  fill: #d7efec;
}

html[data-theme="dark"] .report-editor-shell .ql-picker-options {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

@media (max-width: 620px) {
  .report-dialog form {
    padding: 10px;
  }

  .report-editor-shell .ql-editor {
    min-height: 390px;
    padding: 22px 18px;
  }

  .report-editor-shell .ql-editor.ql-blank::before {
    left: 18px;
    right: 18px;
  }

  .report-dialog footer > button,
  .report-dialog footer > select {
    flex: 1 1 130px;
  }
}

.report-dialog footer select,
.report-dialog footer button {
  width: auto;
  min-width: 130px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 10px;
}

/* Gestao de permissoes */
.invite-accept-shell {
  width: min(460px, calc(100% - 32px));
  margin: auto;
}

.invite-accept-card {
  width: 100%;
}

.invite-accept-card > label {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.invite-accept-card > label input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.invite-login-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent-dark);
  font-weight: 700;
}

.permissions-page {
  height: 100%;
  display: grid;
  grid-template-columns: 220px minmax(410px, 1fr) minmax(280px, 340px);
  gap: 12px;
}

.permissions-card {
  min-height: 0;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
}

.permissions-card > header {
  margin-bottom: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.permissions-card header small {
  display: block;
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.permissions-card h3 {
  margin: 0;
  font-size: 14px;
}

.permissions-user-list {
  display: grid;
  gap: 6px;
}

.permissions-user-filters {
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  align-items: end;
  gap: 7px;
}

.permissions-user-filters label {
  margin: 0;
}

.permissions-user-filters input,
.permissions-user-filters select {
  width: 100%;
}

.permissions-user-empty {
  margin: 12px 4px;
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.permissions-user-list button {
  height: 52px;
  padding: 7px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text);
  background: #f6faf8;
  border: 1px solid transparent;
  border-radius: 9px;
  text-align: left;
}

.permissions-user-list button > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--accent);
  border-radius: 9px;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}

.permissions-user-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.permissions-user-list button strong,
.permissions-user-list button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.permissions-user-list button strong {
  font-size: 10px;
}

.permissions-user-list button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.permissions-user-list button.active {
  background: #e9f6f0;
  border-color: var(--accent);
}

.permissions-editor {
  display: flex;
  flex-direction: column;
}

.permissions-editor header label {
  width: 180px;
  margin: 0;
}

.permissions-card label {
  margin: 8px 0;
  font-size: 8px;
}

.permissions-card input,
.permissions-card select {
  height: 34px;
  margin-top: 4px;
  padding: 0 9px;
  border-radius: 8px;
  font-size: 10px;
  text-transform: none;
}

#permissoesUsuarioModo {
  display: block;
  margin-top: 5px;
  color: var(--accent-dark);
  font-size: 9px;
}

.permissions-user-details {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  color: var(--muted);
  font-size: 9px;
}

.permissions-user-details[hidden] {
  display: none;
}

.permissions-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 9px;
  overflow: auto;
}

.permissions-grid.compact {
  grid-template-columns: 1fr;
  max-height: calc(100dvh - 330px);
  margin: 10px 0;
}

.permissions-grid fieldset {
  min-width: 0;
  margin: 0;
  padding: 8px;
  border: 1px solid #deebe5;
  border-radius: 9px;
}

.permissions-grid legend {
  padding: 0 5px;
  color: var(--accent-dark);
  font-size: 9px;
  font-weight: 800;
}

.permissions-grid fieldset label {
  margin: 2px 0;
  padding: 5px;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) 18px;
  gap: 6px;
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  text-transform: none;
}

.permissions-info {
  position: relative;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: var(--soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  font-size: 9px;
  font-style: normal;
  font-weight: 800;
  cursor: help;
}

.permissions-info::after {
  content: attr(data-tooltip);
  position: absolute;
  right: -5px;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: 230px;
  padding: 8px 9px;
  color: #ffffff;
  background: #006f6c;
  border-radius: 7px;
  box-shadow: 0 8px 24px rgba(12, 35, 28, 0.25);
  font-size: 8px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.permissions-info:hover::after,
.permissions-info:focus::after {
  opacity: 1;
  transform: translateY(0);
}

.permissions-grid fieldset label:hover {
  background: #f1f8f5;
}

.permissions-grid input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.permissions-grid strong,
.permissions-grid small {
  display: block;
}

.permissions-grid strong {
  font-size: 9px;
}

.permissions-grid small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 7px;
}

.permissions-card footer {
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

#permissoesUsuarioRodape {
  position: sticky;
  bottom: 0;
  z-index: 4;
  margin: auto -14px -14px;
  padding: 10px 14px 14px;
  background: #ffffff;
  border-top: 1px solid var(--border);
}

.permissions-card footer button {
  width: auto;
  min-width: 110px;
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-message {
  min-height: 16px;
  margin: 5px 0;
  color: var(--accent-dark);
  font-size: 9px;
}

.permissions-message.error {
  color: #b83b4b;
}

@media (max-width: 1180px) {
  .permissions-page {
    grid-template-columns: 190px minmax(390px, 1fr) 280px;
  }
}

@media (max-width: 900px) {
  .permissions-page {
    grid-template-columns: 190px minmax(500px, 1fr);
    overflow: auto;
  }

  .permissions-groups {
    grid-column: 1 / -1;
    min-height: 400px;
  }

  .exam-filters {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
  }
}

/* Filtros do hub mobile: uma única linha horizontal */
@media (max-width: 820px) {
  .exams-page {
    overflow-y: auto;
  }

  .exams-page .exam-filters,
  .bi-filters {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 16px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 64px;
    margin: 0;
    padding: 0 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }

  .exams-page .exam-filters label,
  .bi-filters label {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    flex: 0 0 145px;
    gap: 6px;
    width: 145px;
    min-width: 145px;
    max-width: 145px;
    height: 62px;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: 11px;
    white-space: nowrap;
  }

  .exams-page .exam-filters label:first-child {
    flex-basis: 180px;
    width: 180px;
    min-width: 180px;
    max-width: 180px;
  }

  .exams-page .exam-filters input,
  .exams-page .exam-filters select,
  .bi-filters input,
  .bi-filters select {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: 42px;
    min-height: 42px;
    max-height: 42px;
    flex: 0 0 42px;
    margin-top: 0;
    box-sizing: border-box;
    font: inherit;
    line-height: normal;
    vertical-align: middle;
  }

  .exams-page .exam-filters input[type="date"],
  .bi-filters input[type="date"] {
    position: relative;
    -webkit-appearance: none;
    appearance: none;
    padding-top: 0;
    padding-bottom: 0;
    line-height: 42px;
    text-align: left;
  }

  .exams-page .exam-filters input[type="date"]::-webkit-date-and-time-value,
  .bi-filters input[type="date"]::-webkit-date-and-time-value {
    min-height: 42px;
    margin: 0;
    padding: 0;
    line-height: 42px;
    text-align: left;
  }

  .exams-page .exam-filters input[type="date"]::-webkit-calendar-picker-indicator,
  .bi-filters input[type="date"]::-webkit-calendar-picker-indicator {
    margin: 0;
    padding: 4px;
  }

  .exams-page .exam-table-wrap {
    min-height: 320px;
  }

  .exam-patient-cell .exam-share-button,
  .exam-share-cell .exam-share-button,
  .exam-delete-cell .exam-share-button {
    width: 36px;
    height: 36px;
  }

  .bi-page {
    overflow-y: auto;
  }
}

/* Ferramentas do visualizador: linha superior compacta no celular */
@media (max-width: 560px) {
  .viewer-header.viewer-header-simple {
    position: sticky;
    top: 0;
    z-index: 80;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: center;
    width: 100%;
    min-height: 42px;
    margin: 0;
    padding: 4px;
    gap: 4px;
    box-sizing: border-box;
  }

  .viewer-header.viewer-header-simple > #btnVoltarExames,
  .viewer-header.viewer-header-simple .viewer-tools > button,
  .viewer-header.viewer-header-simple .viewer-layout-btn {
    width: 30px;
    min-width: 30px;
    height: 30px;
    flex: 0 0 30px;
    padding: 0;
  }

  .viewer-header.viewer-header-simple .viewer-tools {
    display: flex;
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    align-items: center;
    width: auto;
    min-width: 0;
    max-width: none;
    gap: 3px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #48625c #101916;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
  }

  .viewer-header.viewer-header-simple .viewer-tools::-webkit-scrollbar {
    display: block;
    height: 4px;
  }

  .viewer-header.viewer-header-simple .viewer-layout-switcher {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
    padding: 0;
  }

  .viewer-header.viewer-header-simple button svg {
    width: 17px;
    height: 17px;
  }
}

.schedule-cpf-status {
  min-height: 15px;
  margin-top: 5px;
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  text-transform: none;
}

.schedule-cpf-status.found {
  color: var(--accent-dark);
}

.schedule-cpf-status.not-found {
  color: #a66514;
}

.schedule-cpf-status.error {
  color: #b83b4b;
}

.schedule-patient-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 20px;
}

.schedule-form-grid input[readonly] {
  cursor: not-allowed;
  color: var(--muted);
  background: #f1f4f7;
}

/* Navegacao das pre-configuracoes */
.permissions-page {
  grid-template-columns: minmax(0, 1fr);
}

.permissions-users {
  width: 100%;
}

.permissions-users > header h3 {
  font-size: 16px;
}

.permissions-user-search {
  width: min(100%, 460px);
}

.permissions-user-list {
  grid-template-columns: minmax(0, 1fr);
}

.permissions-user-list > button {
  width: 100%;
  min-height: 68px;
  height: auto;
  padding: 10px;
  grid-template-columns: 42px minmax(0, 1fr) auto;
}

.permissions-user-list > button > span {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  font-size: 14px;
}

.permissions-user-list > button strong {
  font-size: 11px;
}

.permissions-user-list > button small {
  font-size: 9px;
}

.permissions-user-identity,
.permissions-user-access {
  min-width: 0;
}

.permissions-user-access {
  display: grid;
  justify-items: end;
  gap: 3px;
  text-align: right;
}

.permissions-user-access em,
.permissions-invite-expiration em {
  padding: 3px 7px;
  color: #176b50;
  background: #def3e9;
  border-radius: 999px;
  font-size: 8px;
  font-style: normal;
  font-weight: 800;
}

.permissions-user-access em.individual {
  color: #685316;
  background: #fff1bd;
}

.permissions-user-access time,
.permissions-invite-expiration time {
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.permissions-group-dialog.permissions-user-dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 55px rgba(19, 48, 37, 0.25);
}

.permissions-group-dialog.permissions-user-dialog::backdrop {
  background: rgba(13, 28, 23, 0.52);
}

.permissions-user-dialog .permissions-editor {
  width: 100%;
  max-height: calc(100dvh - 32px);
  padding: 18px;
  border: 0;
  border-radius: 0;
}

.permissions-user-dialog .permissions-editor > header {
  flex: 0 0 auto;
}

.permissions-user-dialog #permissoesConfiguracaoUsuario {
  min-height: 0;
  overflow: auto;
}

.permissions-user-dialog #permissoesUsuarioRodape {
  margin: auto -18px -18px;
  padding: 12px 18px 18px;
}

.permissions-delete-user-button {
  margin-right: auto;
}

.permissions-user-dialog .dialog-back-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

#permissoesAbrirGrupos {
  width: auto;
  min-width: 148px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 8px;
  font-size: 9px;
}

#permissoesAbrirConvite {
  width: auto;
  min-width: 96px;
  height: 34px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-user-list .permissions-pending-invite {
  width: 100%;
  height: auto;
  min-height: 62px;
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  gap: 7px;
  color: var(--text);
  background: #fff8df;
  border: 1px solid #ead18c;
  border-radius: 9px;
  text-align: left;
}

.permissions-pending-invite strong,
.permissions-pending-invite small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.permissions-invite-expiration {
  display: grid;
  justify-items: end;
  gap: 5px;
  text-align: right;
}

.permissions-pending-invite.expired {
  background: #fff1f2;
  border-color: #e6b5bb;
}

.permissions-pending-invite.expired .permissions-invite-expiration em {
  color: #9d3140;
  background: #f9dadd;
}

html[data-theme="dark"] .permissions-user-access em,
html[data-theme="dark"] .permissions-invite-expiration em {
  color: #9be0c7;
  background: #23483c;
}

html[data-theme="dark"] .permissions-user-access em.individual {
  color: #f0d984;
  background: #4d431f;
}

html[data-theme="dark"] .permissions-pending-invite.expired {
  background: #3d262b;
  border-color: #70424a;
}

html[data-theme="dark"] .permissions-pending-invite.expired .permissions-invite-expiration em {
  color: #ffadb7;
  background: #5c3038;
}

.permissions-pending-invite strong { font-size: 9px; }
.permissions-pending-invite small { margin-top: 3px; color: #8a6515; font-size: 8px; }
.permissions-invite-open-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #7a5400;
}

#permissoesListaMensagem:empty {
  display: none;
}
.permissions-invite-dialog { width: min(680px, calc(100vw - 24px)); }

.permissions-invite-dialog > form > label {
  font-size: 10px;
}

.permissions-invite-dialog #permissoesConviteEmail {
  height: 42px;
  margin-top: 6px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  text-transform: none;
}

.permissions-invite-dialog footer {
  flex-wrap: wrap;
}

.permissions-invite-delete-button {
  margin-right: auto;
}

#permissoesAbrirGrupos svg,
.permissions-back-button svg,
.permissions-group-edit svg,
.permissions-group-delete svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.permissions-admin-notice {
  padding: 16px;
  display: grid;
  gap: 5px;
  color: #754f05;
  background: #fff8df;
  border: 1px solid #ead18c;
  border-radius: 10px;
}

.permissions-admin-notice strong {
  font-size: 11px;
}

.permissions-admin-notice span {
  font-size: 9px;
  line-height: 1.5;
}

.permissions-admin-notice[hidden],
#permissoesConfiguracaoUsuario[hidden],
#permissoesUsuarioRodape[hidden],
.permissions-mode-panel[hidden] {
  display: none !important;
}

.permissions-mode-selector {
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.permissions-mode-selector > label {
  min-height: 62px;
  margin: 0;
  padding: 10px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
  text-transform: none;
}

.permissions-mode-selector > label:has(input:checked) {
  background: #e9f6f0;
  border-color: var(--accent);
}

.permissions-mode-selector input[type="radio"] {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.permissions-mode-selector strong,
.permissions-mode-selector small {
  display: block;
}

.permissions-mode-selector strong {
  font-size: 10px;
}

.permissions-mode-selector small,
.permissions-mode-help {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.4;
  text-transform: none;
}

.permissions-mode-panel > label {
  width: 100%;
  display: block;
}

.permissions-mode-panel > label select {
  width: 100%;
}

.permissions-presets-page {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.hub-main.permissions-groups-mode .hub-topbar {
  display: none;
}

.hub-main.permissions-groups-mode .hub-content {
  height: calc(100dvh - 28px);
}

.permissions-presets-page[hidden] {
  display: none;
}

.permissions-presets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.permissions-presets-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.permissions-presets-header small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.permissions-presets-header h3 {
  margin: 0;
  font-size: 14px;
}

.permissions-back-button {
  width: auto;
  min-width: 82px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-presets-page .permissions-groups {
  width: 100%;
  height: 100%;
}

.permissions-create-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 9px;
}

.permissions-custom-create {
  margin-top: 10px;
  padding-top: 10px;
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(170px, 1fr) minmax(140px, 0.8fr) auto;
  align-items: end;
  gap: 9px;
  border-top: 1px solid var(--border);
}

.permissions-custom-create[hidden] {
  display: none !important;
}

.permissions-custom-create label {
  width: 100%;
  margin: 0;
}

.permissions-custom-create input {
  width: 100%;
}

.permissions-custom-create button {
  width: auto;
  min-width: 145px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-create-group label {
  width: 100%;
  margin: 0;
}

.permissions-create-group label input {
  width: 100%;
}

.permissions-create-group button {
  width: auto;
  min-width: 110px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-groups-list {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 8px;
}

.permissions-group-item {
  min-width: 0;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f6faf8;
  border: 1px solid #deebe5;
  border-radius: 9px;
}

.permissions-group-item strong,
.permissions-group-item small {
  display: block;
}

.permissions-group-item strong {
  color: var(--text);
  font-size: 10px;
}

.permissions-group-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.permissions-group-edit,
.permissions-group-delete,
.permissions-dialog-close {
  min-width: 34px;
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
}

.permissions-group-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.permissions-group-delete,
.permissions-danger-button {
  color: #ffffff;
  background: #b83b4b;
  border-color: #b83b4b;
}

.permissions-group-delete:hover,
.permissions-danger-button:hover {
  background: #982c3b;
  border-color: #982c3b;
}

.permissions-group-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 18px 55px rgba(19, 48, 37, 0.25);
}

.permissions-group-dialog::backdrop {
  background: rgba(13, 28, 23, 0.52);
}

.permissions-group-dialog > form {
  max-height: calc(100dvh - 34px);
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.permissions-group-dialog header {
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
}

.permissions-group-dialog header small {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.permissions-group-dialog h3 {
  margin: 0;
  font-size: 14px;
}

.permissions-group-dialog > form > label {
  width: min(100%, 420px);
  margin: 0 0 10px;
  font-size: 8px;
}

.permissions-group-dialog > form > label input {
  width: 100%;
}

.permissions-group-dialog .permissions-grid.compact {
  max-height: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.permissions-group-dialog footer {
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.permissions-group-dialog footer button {
  width: auto;
  min-width: 105px;
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 9px;
}

.permissions-delete-dialog {
  width: min(460px, calc(100vw - 28px));
}

.permissions-confirm-dialog {
  width: min(460px, calc(100vw - 28px));
}

.permissions-delete-dialog > form {
  position: relative;
  overflow: hidden;
}

.permissions-password-field {
  position: relative;
  display: block;
}

.permissions-password-field input {
  padding-right: 42px !important;
}

.permissions-password-field input.error {
  border-color: #b83b4b;
  box-shadow: 0 0 0 3px rgba(184, 59, 75, 0.13);
}

.permissions-password-field button {
  position: absolute;
  top: 4px;
  right: 2px;
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  border: 0;
}

.permissions-password-field button:hover {
  color: var(--accent-dark);
  background: transparent;
}

.permissions-password-field svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.permissions-delete-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 10px;
  color: var(--accent-dark);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
}

.permissions-delete-loading strong {
  font-size: 10px;
}

.permissions-delete-warning {
  margin: 0 0 12px;
  padding: 10px;
  color: #754f05;
  background: #fff8df;
  border: 1px solid #ead18c;
  border-radius: 8px;
  font-size: 9px;
  line-height: 1.5;
}

.permissions-delete-warning strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .permissions-page {
    grid-template-columns: minmax(0, 1fr);
  }

  .permissions-mode-selector {
    grid-template-columns: 1fr;
  }

  .permissions-create-group {
    grid-template-columns: 1fr;
  }

  .permissions-custom-create {
    grid-template-columns: 1fr;
  }

  .permissions-create-group button {
    width: 100%;
  }

  .permissions-custom-create button {
    width: 100%;
  }

  .permissions-groups-list,
  .permissions-group-dialog .permissions-grid.compact {
    grid-template-columns: 1fr;
  }

  .permissions-user-dialog .permissions-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .permissions-user-dialog #permissoesUsuarioRodape {
    flex-wrap: wrap;
  }

  .permissions-user-dialog .permissions-delete-user-button {
    width: 100%;
    margin-right: 0;
  }

  .permissions-user-list > button {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .permissions-user-access {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }

  .permissions-pending-invite {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .permissions-invite-expiration {
    grid-column: 1;
    grid-row: 2;
    justify-items: start;
    text-align: left;
  }

  .permissions-pending-invite .permissions-resend-invite {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}
