﻿:root {
  --bg: #eff6fb;
  --bg-soft: #f7fbff;
  --surface: #ffffff;
  --surface-alt: #f2f8fd;
  --text: #15324b;
  --muted: #5b7388;
  --primary: #0f7ac9;
  --primary-strong: #0a5a97;
  --accent: #17a087;
  --border: #d7e5f1;
  --error: #c63737;
  --shadow: 0 18px 45px rgba(12, 50, 85, 0.14);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d8ecff 0%, transparent 60%),
    radial-gradient(1000px 540px at 95% 8%, #dff7f3 0%, transparent 58%),
    linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
  font: 15px/1.5 "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

#app {
  min-height: 100vh;
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 24px;
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(15, 122, 201, 0.28);
}

.app-header h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.subtitle {
  margin: 3px 0 0;
  color: var(--muted);
}

.header-tools {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.lang-select,
.pool-select select {
  appearance: none;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 12px;
  font: inherit;
}

.screen {
  display: block;
  min-width: 0;
}
#report-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

#login-screen {
  display: grid;
  place-items: center;
}
.auth-shell {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
  align-items: stretch;
}
.auth-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(580px 280px at -10% 120%, rgba(23, 160, 135, 0.2), transparent 65%),
    radial-gradient(480px 240px at 110% -20%, rgba(15, 122, 201, 0.2), transparent 70%),
    linear-gradient(160deg, #ffffff 0%, #f2f8fd 100%);
}
.auth-hero h2 {
  margin: 4px 0 10px;
  font-size: clamp(24px, 2.6vw, 34px);
  line-height: 1.15;
  max-width: 16ch;
}
.hero-points {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-chip {
  border: 1px solid #c8ddef;
  background: #ffffff;
  color: #235170;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(247, 251, 255, 0.95) 100%);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  text-align: center;
  padding: 34px 30px;
  align-self: center;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.1px;
  color: var(--primary);
}

.card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover {
  border-color: #bad3e8;
  box-shadow: 0 6px 15px rgba(22, 72, 111, 0.11);
}

.btn:active { transform: translateY(1px); }
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-strong) 100%);
  color: #fff;
}

.actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.actions .logout-right {
  margin-left: auto;
}
.report-view-switch {
  margin-top: 12px;
  margin-bottom: 14px;
  padding: 8px;
  border: 2px solid #0f2f46;
  border-radius: 14px;
  background: linear-gradient(180deg, #ecf6fd 0%, #e5f1fb 100%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.report-view-tab {
  appearance: none;
  border: 2px solid #0f2f46;
  border-radius: 14px;
  background: #f3f7fb;
  color: #0f2434;
  font-size: 17px;
  font-weight: 800;
  line-height: 1;
  padding: 12px 10px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.12s ease;
}
.report-view-tab:hover {
  background: #e6f0f8;
}
.report-view-tab:active {
  transform: translateY(1px);
}
.report-view-tab.is-active {
  background: #d8e8f5;
  color: #061826;
}
.report-view-tab.report-view-tab--disabled,
.report-view-tab:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  background: #eef3f8;
  color: #355066;
  transform: none;
}
.report-view-tab.report-view-tab--disabled:hover,
.report-view-tab:disabled:hover {
  background: #eef3f8;
}
.modal-actions-centered {
  justify-content: center;
}

.profile-row {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, #0f7ac9, #17a087);
}

.user-name { font-size: 18px; font-weight: 700; }
.user-email, .env-info { font-size: 13px; }
.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.last-login-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c7dae9;
  background: #f3f8fc;
  color: #1b4f74;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
}

.pool-select {
  margin-top: 20px;
  display: grid;
  gap: 8px;
}

.pool-select label { font-weight: 600; }
.pool-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pool-select-row #pool-select {
  flex: 0 1 520px;
  max-width: 520px;
}
.selected-pool-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 2px solid #9bc9eb;
  background: linear-gradient(180deg, #eaf7ff 0%, #d8eeff 100%);
  color: #15507a;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.pool-quick-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}
.pool-quick-actions #open-patients-btn {
  justify-self: start;
}
.pool-quick-actions #toggle-pool-members-btn {
  justify-self: center;
}
.pool-quick-actions #toggle-pool-admin-btn {
  justify-self: end;
}
.btn.warning {
  border-color: transparent;
  background: linear-gradient(135deg, #ef8b22 0%, #c45a0e 100%);
  color: #fff;
}

.pool-admin {
  margin-top: 20px;
  border: 1px solid #d6e6f4;
  border-radius: 12px;
  background: #f7fbff;
  padding: 14px;
}
.pool-admin h3 {
  margin: 0;
  font-size: 18px;
}
.pool-create-row,
.pool-user-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.pool-create-label {
  font-weight: 600;
}
.pool-create-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.pool-prefix {
  padding: 9px 10px;
  border-right: 1px solid var(--border);
  background: #f0f7fd;
  color: #2a4e69;
  font-weight: 700;
}
#pool-name-suffix,
#tenant-user-select {
  appearance: none;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  color: var(--text);
  font: inherit;
}
#pool-name-suffix {
  border: 0;
  border-radius: 0;
}
.pool-user-row {
  grid-template-columns: auto 1fr auto;
}
.pool-members-admin {
  margin-top: 14px;
}
.pool-members-top {
  margin-top: 12px;
}
.pool-members-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
}
.pool-members-top .table-wrap {
  margin-top: 0;
}
#pool-members-status {
  margin-top: 8px;
}
.pool-members-bottom {
  margin-top: 14px;
}
.pool-members-bottom .pool-members-subtitle {
  text-align: center;
  font-weight: 700;
}
.pool-user-row-stacked {
  grid-template-columns: 1fr;
  align-items: stretch;
}
.pool-member-actions {
  display: flex;
  gap: 10px;
}

.patients-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
}

.site-pill {
  align-self: center;
  background: #e8f3fd;
  color: var(--primary-strong);
  border: 1px solid #c5def3;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.table-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.table th,
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid #eaf1f8;
  text-align: left;
}

.table thead th {
  background: #f0f7fd;
  color: #2b4a63;
  font-weight: 700;
  text-align: left;
}
.table thead th.th-docs,
.table thead th.th-consent,
.table thead th.th-consent-history {
  text-align: center;
}
.table thead th.th-docs,
.table thead th.th-consent,
.table thead th.th-consent-history,
.table td.td-docs,
.table td.td-consent,
.table td.td-consent-history {
  width: 110px;
  text-align: center;
  padding-left: 8px;
  padding-right: 8px;
}

.table tbody tr:nth-child(odd) { background: #fff; }
.table tbody tr:nth-child(even) { background: #fbfdff; }

.th-select, .td-select {
  white-space: nowrap;
  width: 1%;
  padding-left: 8px;
  padding-right: 8px;
}
.new-patient-panel {
  margin-top: 12px;
  border: 1px solid #d6e6f4;
  border-radius: 12px;
  background: #f7fbff;
  padding: 12px;
}
.new-patient-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}
.new-patient-field {
  display: grid;
  gap: 6px;
}
.new-patient-grid label {
  font-weight: 600;
}
.new-patient-grid input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 9px 12px;
  color: var(--text);
  font: inherit;
}
.new-patient-hint {
  margin-top: 2px;
  color: #b4232f;
  font-size: 12px;
  font-weight: 600;
}

.cell-editable {
  min-width: 120px;
  display: inline-block;
  background: #f9fcff;
  border: 1px solid #d7e5f1;
  border-radius: 8px;
  padding: 6px 8px;
}

.cell-readonly {
  background: transparent;
  border: none;
  color: var(--muted);
}

.cell-id-inline {
  margin-left: 6px;
  color: #68839a;
  font-size: 12px;
}

.cell-cf,
.cell-id {
  font-family: Consolas, "Courier New", monospace;
}

.cell-error {
  border-color: var(--error) !important;
  background: #fff0f0;
}

.td-docs {
  text-align: center;
}
.folder-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  font-size: 22px;
  text-decoration: none;
  border: 1px solid #c8ddef;
  border-radius: 10px;
  background: #ffffff;
}
.td-consent {
  text-align: center;
}
.td-consent-history {
  text-align: center;
}
.consent-toggle {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #c7d6e4;
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.consent-toggle:disabled {
  cursor: default;
  opacity: 0.8;
}
.consent-yes {
  color: #147d4d;
  background: #e7f7ef;
  border-color: #b9e7d0;
}
.consent-no {
  color: #b4232f;
  background: #feecee;
  border-color: #f5c8cd;
}
.consent-history-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  text-decoration: none;
  cursor: pointer;
}
.consent-history-svg {
  width: 40px;
  height: 40px;
  display: block;
}
.folder-label {
  font-size: 12px;
  color: var(--muted);
}
.report-meta {
  margin-top: 12px;
  border: 1px solid #d3e4f2;
  background: linear-gradient(180deg, #f9fcff 0%, #f0f7fd 100%);
  border-radius: 12px;
  padding: 12px 14px;
}
.report-meta-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.4fr;
  gap: 10px;
}
.report-meta-item {
  color: #294b66;
  border: 1px solid #d8e8f7;
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.report-meta-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #5f7b92;
  font-weight: 700;
}
.report-meta-value {
  font-size: 16px;
  font-weight: 700;
  color: #133a58;
}
.support-material {
  margin-top: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid #d6e6f4;
  border-radius: 12px;
  background: #f7fbff;
}
.support-material-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 14px;
}
.support-material-copy {
  min-width: 0;
  text-align: left;
}
.support-material-head h3 {
  margin: 0;
  font-size: 18px;
  color: #133a58;
}
.support-material-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: #5f7b92;
}
.support-folder-wrap {
  display: flex;
  justify-content: center;
}
.support-upload-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
}
.support-folder-btn {
  width: 76px;
  height: 76px;
  border-radius: 8px;
  border: 1px solid #b9d7f0;
  background: #eaf4fd;
  color: #14527a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  cursor: pointer;
}
.support-folder-btn svg {
  width: 50px;
  height: 50px;
  display: block;
}
.support-folder-btn:hover {
  background: #dff0ff;
}
.support-folder-btn.is-empty,
.support-folder-btn:disabled {
  border-color: #d5dbe2;
  background: #edf1f5;
  color: #8b98a6;
  cursor: not-allowed;
}
.support-folder-btn.is-empty svg,
.support-folder-btn:disabled svg {
  opacity: 0.65;
  filter: grayscale(0.35);
}
.support-upload-modal-card {
  width: min(520px, calc(100vw - 24px));
}
.support-upload-progress-wrap {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #d7e5f1;
}
.support-upload-progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #2c7db8 0%, #17a087 100%);
  transition: width 0.2s ease;
}
.support-upload-progress-text {
  margin: 0;
  font-size: 12px;
}
.source-search-progress-details {
  margin-top: 2px;
}
.source-search-actions {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.source-search-result-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: 0.3px;
  border: 2px solid transparent;
}
.source-search-result-badge.success {
  background: #e8fff1;
  border-color: #2a9f5b;
  color: #0f6a37;
}
.source-search-result-badge.error {
  background: #fff0f0;
  border-color: #d74a4a;
  color: #a82323;
}
.report-section-block {
  margin-top: 14px;
}
.report-timeline-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  padding: 18px 20px 22px;
  border: 1px solid #d6e0ea;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, rgba(73, 179, 223, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(230, 77, 99, 0.12), transparent 28%),
    linear-gradient(180deg, #fcfeff 0%, #f4f8fc 100%);
  box-shadow: 0 18px 44px rgba(18, 52, 77, 0.08);
}
.report-timeline-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.report-timeline-head .report-section-title {
  text-align: left;
  margin-bottom: 0;
}
.report-timeline-scroll {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 14px;
  cursor: pointer;
  transition: box-shadow 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}
.report-timeline-section:hover .report-timeline-scroll {
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 2px rgba(37, 108, 153, 0.22);
}
.report-timeline-scroll.is-zoom-armed {
  background: rgba(255, 255, 255, 0.36);
  box-shadow:
    inset 0 0 0 2px rgba(37, 108, 153, 0.35),
    0 0 0 3px rgba(37, 108, 153, 0.10);
}
.report-timeline {
  width: 100%;
  min-width: 100%;
  position: relative;
  min-height: 0;
}
.report-timeline-scene {
  position: relative;
  transform-origin: top left;
  will-change: transform;
}
.report-timeline-axis {
  position: absolute;
  left: 72px;
  right: 72px;
  height: 2px;
  background: linear-gradient(90deg, #49b3df 0%, #2b6b95 55%, #e74a5f 100%);
  box-shadow: 0 0 0 1px rgba(19, 58, 88, 0.03);
}
.report-timeline-axis::after {
  content: "";
  position: absolute;
  right: -2px;
  top: 50%;
  width: 16px;
  height: 16px;
  border-top: 3px solid #e74a5f;
  border-right: 3px solid #e74a5f;
  transform: translateY(-50%) rotate(45deg);
  border-radius: 1px;
}
.report-timeline-boundary {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 124px;
  color: #12344d;
}
.report-timeline-boundary--end {
  align-items: flex-end;
  text-align: right;
}
.report-timeline-boundary-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #6c8499;
}
.report-timeline-boundary-date {
  font-size: 14px;
  font-weight: 700;
}
.report-timeline-node {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 0;
  box-shadow: none;
  background: #111111;
}
.report-timeline-node--alt {
  background: #111111;
}
.report-timeline-node--consent-yes {
  background: #111111;
}
.report-timeline-node--consent-no {
  background: #111111;
}
.report-timeline-connector {
  position: absolute;
  width: 2px;
  background: linear-gradient(180deg, rgba(19, 58, 88, 0.75), rgba(19, 58, 88, 0.22));
  transform: translateX(-50%);
}
.report-timeline-event {
  position: absolute;
  width: 82px;
  height: 82px;
  transform: translateX(-50%);
  border: 0;
  border-radius: 50%;
  padding: 10px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-align: center;
  color: #12344d;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbff 100%);
  box-shadow: 0 14px 24px rgba(19, 58, 88, 0.14);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.report-timeline-event::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px solid rgba(73, 179, 223, 0.32);
}
.report-timeline-event--alt::before {
  border-color: rgba(231, 74, 95, 0.34);
}
.report-timeline-event--report {
  background: linear-gradient(180deg, #effcf4 0%, #ddf7e8 100%);
}
.report-timeline-event--report::before {
  border-color: rgba(55, 164, 101, 0.42);
}
.report-timeline-event--meeting {
  background: linear-gradient(180deg, #eef9ff 0%, #dff3ff 100%);
}
.report-timeline-event--meeting::before {
  border-color: rgba(73, 179, 223, 0.45);
}
.report-timeline-event--support {
  background: linear-gradient(180deg, #fff7ea 0%, #ffefd8 100%);
}
.report-timeline-event--support::before {
  border-color: rgba(227, 139, 41, 0.45);
}
.report-timeline-event--consent-yes {
  background: linear-gradient(180deg, #effcf4 0%, #ddf7e8 100%);
}
.report-timeline-event--consent-yes::before {
  border-color: rgba(55, 164, 101, 0.42);
}
.report-timeline-event--consent-no {
  background: linear-gradient(180deg, #fff4f5 0%, #ffe4e8 100%);
}
.report-timeline-event--consent-no::before {
  border-color: rgba(207, 52, 79, 0.4);
}
.report-timeline-event:hover,
.report-timeline-event:focus-visible {
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 18px 30px rgba(19, 58, 88, 0.2);
  outline: none;
}
.report-timeline-event-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #49b3df;
  color: #ffffff;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.report-timeline-event--alt .report-timeline-event-badge {
  background: #e74a5f;
}
.report-timeline-event--consent-yes .report-timeline-event-badge {
  background: #2f9a61;
}
.report-timeline-event--consent-no .report-timeline-event-badge {
  background: #cf344f;
}
.report-timeline-event--report .report-timeline-event-badge {
  background: #2f9a61;
}
.report-timeline-event--meeting .report-timeline-event-badge {
  background: #49b3df;
}
.report-timeline-event--support .report-timeline-event-badge {
  background: #e38b29;
}
.report-timeline-event-date-top {
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.report-timeline-event-year {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: #5d7388;
}
.report-timeline-event-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  transform: translateX(-50%) translateY(6px);
  min-width: 160px;
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(18, 52, 77, 0.96);
  color: #ffffff;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 600;
  box-shadow: 0 12px 24px rgba(10, 25, 40, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
  z-index: 3;
}
.report-timeline-event-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  background: rgba(18, 52, 77, 0.96);
  transform: translate(-50%, -50%) rotate(45deg);
}
.report-timeline-event:hover .report-timeline-event-tooltip,
.report-timeline-event:focus-visible .report-timeline-event-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.report-section-title {
  margin: 0 0 10px;
  text-align: center;
  font-size: 18px;
  color: #133a58;
}
.report-older-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 0 0 10px;
}
.report-older-info {
  margin: 0;
}
@media (max-width: 900px) {
  .support-material-head {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .support-material-copy {
    width: 100%;
    text-align: left;
  }
  .report-older-head {
    flex-direction: column;
    align-items: center;
  }
  .report-view-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .report-view-tab {
    font-size: 16px;
    padding: 10px 8px;
  }
  .report-timeline-section {
    padding-left: 16px;
    padding-right: 16px;
  }
  .report-timeline {
    min-height: 0;
  }
  .pool-select-row {
    flex-direction: column;
    align-items: stretch;
  }
  .pool-select-row #pool-select {
    max-width: none;
    width: 100%;
    flex: 1 1 auto;
  }
  .selected-pool-role {
    justify-content: flex-start;
  }
}
.report-doc-name {
  color: #2f4f67;
  font-size: 13px;
}
.report-doc-link {
  color: #1c5f8e;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.report-doc-link:hover {
  color: #0f4a73;
}
.new-doc-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #ffce87;
  background: #fff5e8;
  color: #b65a00;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.doc-delete-btn {
  margin-left: 8px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid #f1c0c5;
  background: #fff1f2;
  color: #a1202a;
  cursor: pointer;
  font-size: 18px;
}
.doc-delete-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}
.doc-delete-btn:hover {
  background: #ffe7ea;
}
.doc-delete-btn.doc-delete-locked {
  position: relative;
  opacity: 0.75;
  cursor: not-allowed;
}
.doc-delete-btn.doc-delete-locked::after {
  content: "✕";
  position: absolute;
  right: 2px;
  top: 0;
  font-size: 12px;
  color: #8f1f2a;
  font-weight: 700;
}
.doc-download-btn {
  margin-left: 6px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid #b9d7f0;
  background: #eaf4fd;
  color: #14527a;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
}
.doc-download-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  margin: 0 auto;
  fill: currentColor;
}
.doc-download-btn:hover {
  background: #dff0ff;
}
.doc-source-btn {
  margin-left: 6px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid #c8d6e5;
  background: #eef4f9;
  color: #2a5d85;
  cursor: pointer;
}
.doc-source-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: currentColor;
}
.doc-source-btn:hover {
  background: #e4eef7;
}
.doc-source-btn.doc-source-locked,
.doc-source-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(18, 37, 53, 0.42);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
}
.modal-overlay[hidden] {
  display: none !important;
}
.modal-card {
  width: min(620px, calc(100vw - 24px));
  background: #ffffff;
  border: 1px solid #d7e5f1;
  border-radius: 14px;
  box-shadow: 0 20px 45px rgba(10, 42, 67, 0.22);
  padding: 18px 18px 14px;
}
.modal-card h3 {
  margin: 0 0 8px;
  color: #8f1f2a;
  text-align: center;
}
.modal-card p {
  margin: 0;
  color: #2e4b63;
  text-align: center;
}
.pool-create-modal-card {
  width: min(480px, calc(100vw - 24px));
}
.pool-create-modal-body {
  margin-top: 10px;
  display: grid;
  justify-items: center;
  gap: 10px;
}
.progress-spinner {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 4px solid #d7e5f1;
  border-top-color: var(--primary);
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.modal-card .actions {
  justify-content: space-between;
}
.btn.danger {
  border-color: transparent;
  background: linear-gradient(135deg, #c73747 0%, #8f1f2a 100%);
  color: #fff;
}

.doc-entry {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.doc-date,
.doc-uploader {
  color: #5f7b92;
  font-size: 12px;
}

.doc-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.doc-badge-link { text-decoration: none; }
.doc-badge--docx { background: #dff0ff; color: #1b6398; }
.doc-badge--pdf { background: #ffe7e7; color: #9a2e2e; }
.doc-badge--img { background: #e7f8ef; color: #1f7d4f; }
.doc-badge--mono { background: #ffffff; color: #111111; border: 1px solid #111111; }
.doc-badge--voice { background: #fff6d9; color: #8a5a00; border: 1px solid #efc66a; }

.consent-preview-card {
  width: min(900px, calc(100vw - 24px));
}
.consent-preview-body {
  margin-top: 10px;
  border: 1px solid #d7e5f1;
  border-radius: 10px;
  background: #f7fbff;
  min-height: 62vh;
  max-height: 72vh;
  overflow: auto;
}
.consent-preview-frame {
  width: 100%;
  min-height: 62vh;
  border: 0;
}
.consent-preview-image {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 0 auto;
}
.consent-preview-frame[hidden],
.consent-preview-image[hidden] {
  display: none !important;
}

.muted { color: var(--muted); }
.error { margin-top: 12px; color: var(--error); }

.footer {
  text-align: center;
  padding: 6px 0 8px;
}

@media (max-width: 900px) {
  #app { padding: 20px 14px 14px; }
  .app-header {
    grid-template-columns: 1fr;
    gap: 10px;
    justify-items: start;
  }
  .header-tools { padding: 5px 8px; }
  .patients-head { flex-direction: column; }
  .card h2 { font-size: 24px; }
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .auth-card { width: 100%; }
  .report-meta-row {
    grid-template-columns: 1fr;
  }
  .pool-create-row,
  .pool-user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .pool-quick-actions {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
  .pool-quick-actions #open-patients-btn,
  .pool-quick-actions #toggle-pool-members-btn,
  .pool-quick-actions #toggle-pool-admin-btn {
    justify-self: stretch;
  }
  .pool-member-actions {
    flex-direction: column;
  }
}

