:root {
  --brand: #236B53;
  --brand-light: #4CAF50;
  --bg: #E8F5E9;
  --soft: #C8E6C9;
  --text: #123B2F;
  --muted: #4A6B5F;
  --border: #DDEFE2;
  --white: #FFFFFF;
  --danger: #BA1A1A;
  --shadow: 0 18px 45px rgba(35, 107, 83, 0.10);
}

* {
  box-sizing: border-box;
}

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

.app-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.brand-name {
  margin: 0;
  font-weight: 700;
  color: var(--brand);
}

.brand-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0;
}

.hero {
  text-align: center;
  max-width: 820px;
  margin: 0 auto 40px;
}

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

h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  color: var(--text);
}

.hero-text {
  margin: 18px auto 28px;
  max-width: 660px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.search-card {
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 10px;
  display: flex;
  gap: 10px;
}

.search-card input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 0 20px;
  font-size: 16px;
  color: var(--text);
}

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

.btn {
  border: none;
  border-radius: 22px;
  height: 48px;
  padding: 0 22px;
  cursor: pointer;
  font-weight: 700;
}

.btn-primary {
  background: var(--brand);
  color: var(--white);
}

.btn-secondary {
  background: var(--soft);
  color: var(--brand);
}

.results-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.results-header {
  padding: 22px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.results-header h2 {
  margin: 0;
  font-size: 22px;
}

.results-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--bg);
  color: var(--brand);
  white-space: nowrap;
}

.status-pill.loading {
  background: #fff7d6;
  color: #705600;
}

.status-pill.ready {
  background: var(--bg);
  color: var(--brand);
}

.status-pill.error {
  background: #ffdad6;
  color: var(--danger);
}

.message {
  margin: 18px 24px 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: #ffdad6;
  color: var(--danger);
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
}

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

th,
td {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

th {
  background: #F3FAF4;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  color: var(--text);
  font-size: 15px;
}

.align-right {
  text-align: right;
}

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

.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--white);
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.history-content {
  padding: 24px;
  color: var(--text);
}

.history-content.empty-state {
  padding: 48px 24px;
}

@media (max-width: 760px) {
  .app-header {
    padding: 16px;
  }

  .page {
    padding: 36px 0;
  }

  .search-card {
    border-radius: 22px;
    flex-direction: column;
    padding: 14px;
  }

  .search-card input {
    height: 48px;
    padding: 0 10px;
  }

  .search-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

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

  .results-header-actions {
    justify-content: flex-start;
  }

  th,
  td {
    padding: 14px 16px;
  }
}


.access-required-cell {
  padding: 32px 24px;
  background: #F7FFF8;
}

.access-required-card {
  max-width: 760px;
  margin: 0 auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: left;
}

.access-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg);
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.access-eyebrow-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand-light);
  box-shadow: 0 0 0 4px rgba(200, 230, 201, 0.8);
}

.access-required-card h3 {
  margin: 0 0 14px;
  color: var(--brand);
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
}

.access-required-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.access-info-box {
  margin-top: 22px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #F7FFF8;
}

.access-info-title {
  color: var(--brand) !important;
  font-size: 13px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.access-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.access-secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  color: var(--brand);
  border: 1px solid #b5dbc0;
  text-decoration: none;
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 700;
  font-size: 13px;
}

.access-small-note {
  margin-top: 16px !important;
  font-size: 13px !important;
}

@media (max-width: 760px) {
  .access-required-cell {
    padding: 20px 16px;
  }

  .access-required-card {
    padding: 22px;
  }

  .access-links {
    flex-direction: column;
  }

  .access-links a {
    width: 100%;
  }
}

.history-content {
  padding: 28px;
}

.history-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(520px, 1.6fr);
  gap: 28px;
  align-items: start;
}

.history-documents-panel,
.history-patient-panel {
  min-width: 0;
}

.history-documents-panel {
  background: #F7FFF8;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 24px;
}

.history-panel-header {
  margin-bottom: 20px;
}

.history-panel-header h3 {
  margin: 0;
  color: var(--brand);
  font-size: 22px;
}

.history-documents-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-document-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 14px;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
}

.history-document-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.history-document-item h4 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.3;
}

.history-document-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.history-patient-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.patient-main-card,
.patient-data-card,
.clinical-note-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 10px 28px rgba(35, 107, 83, 0.06);
}

.patient-main-card {
  padding: 32px;
}

.patient-main-card h1 {
  margin: 0;
  color: var(--brand);
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.insurance-badge {
  display: inline-flex;
  width: fit-content;
  margin: 22px 0 0;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--brand);
  font-size: 16px;
  font-weight: 800;
}

.patient-data-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.patient-data-card {
  padding: 20px;
}

.patient-data-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.patient-data-card strong {
  display: block;
  color: var(--text);
  font-size: 18px;
}

.clinical-notes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.clinical-note-card {
  padding: 24px;
}

.clinical-note-card h3 {
  margin: 0 0 10px;
  color: var(--brand);
  font-size: 18px;
}

.clinical-note-card p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

@media (max-width: 1000px) {
  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-documents-panel {
    order: 2;
  }

  .history-patient-panel {
    order: 1;
  }
}

@media (max-width: 760px) {
  .history-content {
    padding: 18px;
  }

  .patient-data-grid,
  .clinical-notes-grid {
    grid-template-columns: 1fr;
  }

  .patient-main-card {
    padding: 24px;
  }
}