:root {
  --gephyreus-primary: #155d75;
  --bs-primary-rgb: 21, 93, 117;
  --bs-link-color: #155d75;
  --bs-link-hover-color: #0d4052;
  --bs-body-color: #263b49;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app-shell { background: #f3f6f8; font-size: .9375rem; line-height: 1.6; }
.app-sidebar { width: 252px; background: #123e50 !important; color: #fff; padding: 28px 18px; }
.app-brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 650; line-height: 1.4; padding: 4px 6px 32px; }
.app-brand:hover { color: #fff; }
.brand-logo { display: block; flex-shrink: 0; width: 52px; height: 52px; object-fit: contain; }
.app-brand small { display: block; color: #b2cbd4; font-size: 11px; font-weight: 400; letter-spacing: .03em; }
.nav-section-label { margin: 24px 12px 10px; color: #aac5ce; text-transform: uppercase; font-size: 10px; font-weight: 650; letter-spacing: .14em; }
.sidebar-links a { display: block; padding: 11px 13px; margin: 4px 0; border-radius: 7px; color: #dce8ec; text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar-links a:hover { background: #214f60; color: #fff; }
.sidebar-links a[aria-current] { background: #285c6b; color: #fff; border-left-color: #8bd1c6; font-weight: 600; }
.sidebar-footer { margin-top: auto; padding: 20px 0 0; color: #dce8ec; font-size: 12px; flex-shrink: 0; }
.sidebar-footer .account-menu summary { border-color: #6795a3; background: #214f60; color: #fff; }
.sidebar-footer .account-panel { top: auto; bottom: calc(100% + 10px); left: 0; right: 0; width: 100%; color: #263b49; max-height: 60vh; overflow-y: auto; }
.app-sidebar .sidebar-links { overflow-y: auto; min-height: 0; }
.app-sidebar .app-brand { flex-shrink: 0; }
.app-topbar { min-height: 72px; background: #fff; border-bottom: 1px solid #dfe7ec; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 32px; }
.topbar-title { color: #244654; text-decoration: none; font-size: 14px; font-weight: 600; }
.topbar-title span { color: #71818d; font-weight: 400; margin-left: 8px; }
.app-content { max-width: 1520px; margin: 0 auto; padding: 32px; }
.account-menu { position: relative; font-size: 13px; }
.account-menu summary { cursor: pointer; padding: 8px 12px; border: 1px solid #dfe7ec; border-radius: 8px; }
.account-panel { position: absolute; right: 0; top: calc(100% + 10px); z-index: 1050; background: #fff; border: 1px solid #dfe7ec; box-shadow: 0 10px 30px #17384d18; border-radius: 10px; padding: 18px; width: 280px; display: grid; gap: 14px; overflow-wrap: anywhere; }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 2000; background: #fff; padding: 12px; }
.skip-link:focus { top: 12px; }
.app-content h1 { color: #193b4b; font-weight: 650; letter-spacing: -.035em; font-size: clamp(1.65rem, 2.3vw, 2.15rem); }
.app-content h2 { color: #254757; font-weight: 600; }
.app-content .h5 { font-size: 1.05rem; }
.app-content .card { border-radius: 12px; overflow: clip; box-shadow: 0 2px 8px #163b4c07 !important; outline: 1px solid #e1e8ed; }
.app-content .card-body { padding: 24px; }
.app-content .card-header { padding: 18px 24px; border-bottom: 1px solid #e6edf1; }
.app-content .card-footer { padding: 14px 24px; background: #f8fafb; border-color: #e6edf1; }
.app-content .table { font-size: .875rem; --bs-table-striped-bg: #f8fafb; --bs-table-border-color: #e6edf1; }
.app-content .table > :not(caption) > * > * { padding: 13px 18px; }
.app-content .table thead th { background: #f4f7f9; color: #526876; font-size: .76rem; font-weight: 650; white-space: nowrap; }
.app-content .table tbody tr:hover > * { background-color: #edf5f7; }
.app-content dt { font-weight: 600; }
.app-content dd { margin-bottom: 14px; }
.app-shell .btn { border-radius: 7px; font-weight: 600; padding: .6rem 1rem; font-size: .875rem; }
.app-shell .btn-sm { padding: .35rem .7rem; font-size: .78rem; }
.btn-outline-primary { --bs-btn-color: #155d75; --bs-btn-border-color: #a5c2cd; --bs-btn-hover-bg: #155d75; --bs-btn-hover-border-color: #155d75; --bs-btn-active-bg: #10495c; --bs-btn-active-border-color: #10495c; }
.app-shell .form-control, .app-shell .form-select { min-height: 44px; border-color: #cdd9e0; border-radius: 7px; font-size: .9375rem; }
.app-shell .form-control:focus, .app-shell .form-select:focus { border-color: #40849a; box-shadow: 0 0 0 3px #155d751a; }
.app-shell .form-label { font-size: .85rem; font-weight: 600; color: #385564; }
.app-shell .form-text { color: #647987; }
.app-shell .badge { padding: .45em .65em; font-weight: 600; white-space: normal; line-height: 1.4; }
.app-shell .progress { height: 7px; background: #e7eef2; }
.app-shell .progress-bar { background-color: #277b88; }
.page-hero { padding: 8px 0 4px; }
.page-eyebrow { color: #627c89; text-transform: uppercase; font-size: .7rem; letter-spacing: .13em; font-weight: 650; margin-bottom: 10px; }
.section-navigation {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  gap: 5px;
  overflow-x: auto;
  padding: 8px;
  margin: 0 0 24px;
  background: #e8eef2;
  border-radius: 9px;
  box-shadow: 0 2px 6px rgba(22, 59, 76, 0.08);
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  -webkit-overflow-scrolling: touch;
}
.section-navigation::-webkit-scrollbar {
  height: 4px;
}
.section-navigation::-webkit-scrollbar-track {
  background: transparent;
}
.section-navigation::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 4px;
}
@media (max-width: 780px) {
  .section-navigation {
    padding: 6px 8px;
    margin-bottom: 18px;
    border-radius: 8px;
  }
  .section-navigation a {
    padding: 6px 10px;
    font-size: 0.75rem;
  }
}
.section-navigation a {
  flex-shrink: 0;
  padding: 7px 12px;
  font-size: .8rem;
  font-weight: 600;
  color: #42606f;
  text-decoration: none;
  border-radius: 6px;
}
.section-navigation a:hover, .section-navigation a:focus-visible {
  background: #fff;
  color: #155d75;
}
section[id], details[id] {
  scroll-margin-top: 65px;
}
.completion-step { background: #fafcfd; border-color: #e0e8ed !important; }
:focus-visible { outline: 3px solid #43879f; outline-offset: 3px; }
@media (min-width: 992px) {
  .app-sidebar { position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; height: 100vh; }
  .has-sidebar { padding-left: 252px; }
}
@media (max-width: 991.98px) {
  .app-sidebar { --bs-offcanvas-width: 280px; }
  .app-topbar { padding: 12px 18px; }
  .app-content { padding: 24px 18px; }
  .sidebar-footer { margin-top: auto; }
}
@media (max-width: 575.98px) {
  .topbar-title { display: none; }
  .app-content { padding: 22px 12px; }
  .app-content .card-body, .app-content .card-header { padding: 18px; }
  .app-content .table > :not(caption) > * > * { padding: 11px 12px; }
}
@media print {
  .app-sidebar, .app-topbar, .mobile-navigation-toggle, .section-navigation, .skip-link { display: none !important; }
  .has-sidebar { padding-left: 0; }
  .app-content { max-width: none; padding: 0; }
}

.bg-primary {
  background-color: var(--gephyreus-primary) !important;
}

.text-primary {
  color: var(--gephyreus-primary) !important;
}

.btn-primary {
  --bs-btn-bg: var(--gephyreus-primary);
  --bs-btn-border-color: var(--gephyreus-primary);
  --bs-btn-hover-bg: #10495c;
  --bs-btn-hover-border-color: #10495c;
}

.auth-card {
  max-width: 32rem;
}

.activity-choices:not(input) { display: grid; gap: .5rem; padding: 14px; border: 1px solid #cdd9e0; border-radius: 7px; max-height: 22rem; overflow-y: auto; }
.activity-choices label { display: flex; align-items: baseline; gap: .6rem; cursor: pointer; }
.activity-choices input[type="checkbox"] { appearance: auto; accent-color: #155d75; width: 18px; height: 18px; margin: 0; padding: 0; flex-shrink: 0; cursor: pointer; }
.activity-field { min-width: 0; }
.app-content .card.related-form-card { overflow: visible; }
.related-form-card > .card-footer { border-radius: 0 0 12px 12px; }
.activity-dropdown { position: relative; }
.activity-dropdown-toggle { display: flex; width: 100%; color: inherit; font: inherit; text-align: left; align-items: center; justify-content: space-between; gap: .75rem; min-height: 38px; padding: .5rem .75rem; border: 1px solid #cdd9e0; border-radius: 7px; background: #fff; cursor: pointer; }
.activity-dropdown-toggle::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); flex-shrink: 0; }
.activity-dropdown-toggle[aria-expanded="true"]::after { transform: rotate(225deg); }
.activity-dropdown-toggle:focus-visible { outline: 2px solid #155d75; outline-offset: 2px; }
.activity-dropdown-panel[hidden] { display: none !important; }
.activity-dropdown[data-initialized] .activity-dropdown-panel { position: absolute; z-index: 1050; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border-radius: 7px; box-shadow: 0 8px 24px #153d4d26; }
.activity-dropdown .activity-choices:not(input) { max-height: min(22rem, 45vh); }

.auth-card input[type="email"],
.auth-card input[type="password"] {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
}

/* Form collapsible sections */
.form-section-details {
  border: 1px solid #cdd9e0;
  border-radius: 8px;
  background: #fff;
  transition: box-shadow 0.15s ease-in-out;
  overflow: visible;
}
.form-section-details:hover {
  box-shadow: 0 2px 8px rgba(21, 61, 77, 0.08);
}
.form-section-details > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.875rem 1.25rem;
  background: #f8fafc;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.form-section-details > summary::-webkit-details-marker {
  display: none;
}
.form-section-details[open] > summary {
  border-bottom: 1px solid #e2e8f0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.form-section-details summary h2 {
  margin: 0;
  display: inline-block;
  font-size: 1.15rem;
}
.form-section-details .section-indicator {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.85rem;
  color: #64748b;
}
.form-section-details:not([open]) .section-indicator {
  transform: rotate(-90deg);
}
.form-section-details[open] .section-toggle-text::before {
  content: "Recolher";
}
.form-section-details:not([open]) .section-toggle-text::before {
  content: "Expandir";
}
.form-section-body {
  padding: 1.25rem;
}

/* Activity dropdown improvements and invalid state */
.activity-dropdown-panel {
  min-width: 280px;
}
@media (min-width: 1200px) {
  .col-xl:last-child .activity-dropdown-panel,
  .col-xl:nth-last-child(2) .activity-dropdown-panel {
    left: auto;
    right: 0;
  }
}
.activity-dropdown-toggle.is-invalid {
  border-color: #dc3545;
  background-color: #fff8f8;
}
.activity-dropdown-toggle.is-invalid:focus-visible {
  outline-color: #dc3545;
  box-shadow: 0 0 0 0.25rem rgba(220, 53, 69, 0.25);
}

/* Progressive enhancement: sem JS ativo, exibe o painel estático e oculta o botão toggle */
.activity-dropdown:not([data-initialized]) .activity-dropdown-panel {
  position: static;
  display: block;
  box-shadow: none;
  border: 1px solid #cdd9e0;
  border-radius: 7px;
  margin-top: 0.5rem;
}
.activity-dropdown:not([data-initialized]) .activity-dropdown-toggle {
  display: none;
}

/* Error summary */
#form-error-summary {
  border-left: 5px solid #dc3545;
}
#form-error-summary:focus {
  outline: 3px solid #dc3545;
  outline-offset: 2px;
}

/* Contextual status badge (distinto do botão primário) */
.status-badge {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.8125rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  line-height: 1.2;
}
.status-badge[data-status="COMPLETED"] {
  background-color: #ecfdf5;
  color: #065f46;
  border-color: #a7f3d0;
}
.status-badge[data-status="AWAITING_COMPLETION"] {
  background-color: #fffbeb;
  color: #92400e;
  border-color: #fde68a;
}
.status-badge[data-status="ARCHIVED"] {
  background-color: #f8fafc;
  color: #64748b;
  border-color: #e2e8f0;
}

/* Detail collapsible sections */
.detail-section-details {
  border: 1px solid #e1e8ed;
  border-radius: 12px;
  background: #fff;
  overflow: clip;
}
.detail-section-details > summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
}
.detail-section-details > summary::-webkit-details-marker {
  display: none;
}
.detail-section-details[open] > summary {
  border-bottom: 1px solid #e6edf1;
}
.detail-section-details .section-indicator {
  display: inline-block;
  transition: transform 0.2s ease;
  font-size: 0.85rem;
  color: #64748b;
  flex-shrink: 0;
}
.detail-section-details:not([open]) .section-indicator {
  transform: rotate(-90deg);
}

/* Biopsy sample formset: cartões com rótulos; em telas largas, uma linha em grade */
.biopsy-sample-table thead {
  display: none;
}
.biopsy-sample-table,
.biopsy-sample-table tbody,
.biopsy-sample-table tr.biopsy-sample-row {
  display: block;
  width: 100%;
}
.biopsy-sample-table tr.biopsy-sample-row {
  background-color: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.biopsy-sample-table tr.biopsy-sample-row > td {
  display: block;
  width: 100% !important;
  padding: 0;
  border: none;
}
.biopsy-sample-table .biopsy-sample-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: start;
}
.biopsy-sample-table .biopsy-sample-cell {
  min-width: 0;
}
.biopsy-sample-table .biopsy-sample-cell-full {
  grid-column: 1 / -1;
}
.biopsy-sample-table .biopsy-sample-cell-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.25rem;
}
.biopsy-sample-table .biopsy-sample-delete-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-top: 0.5rem;
  border-top: 1px dashed #e2e8f0;
}

@media (min-width: 992px) {
  .biopsy-sample-table .biopsy-sample-row-grid {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }
  .biopsy-sample-table .biopsy-sample-cell-half {
    grid-column: span 2;
  }
  .biopsy-sample-table .biopsy-sample-cell-full {
    grid-column: span 3;
  }
  .biopsy-sample-table .biopsy-sample-delete-cell {
    grid-column: span 1;
    align-self: end;
    padding-top: 0;
    border-top: none;
  }
}
.auth-logo { display: block; width: 100%; height: auto; }
.individual-photo { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: #e9eef1; }
.form-select.header-select { height: 42.2px; padding-top: 0; padding-bottom: 0; font-size: 14px; }
