:root {
  --primary: #0f8f79;
  --primary-dark: #0a6a59;
  --bg-soft: #f7fcfa;
  --green-soft: #dff5ee;
  --text: #1e2a27;
  --card-size: 170px;
}

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

html {
  scroll-behavior: smooth;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}

.back-to-top-page {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 50;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 10px 24px rgba(15, 143, 121, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease, background 160ms ease;
}

.back-to-top-page:hover,
.back-to-top-page:focus {
  background: var(--primary-dark);
}

.back-to-top-page.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--card-size), var(--card-size)));
  gap: 16px;
}

.card-square {
  width: var(--card-size);
  height: var(--card-size);
  background: white;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-shell {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.auth-card {
  width: 100%;
  max-width: 520px;
  background: white;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.wide-card {
  max-width: 760px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group input,
.form-group select {
  padding: 12px;
  border: 1px solid #cfd8d3;
  border-radius: 10px;
  font-size: 16px;
}

.btn-primary,
.btn-secondary {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 16px;
  cursor: pointer;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #eef5f2;
  color: var(--text);
}

.alert-error {
  background: #fff1f1;
  color: #8b1e1e;
  border: 1px solid #f1c3c3;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.muted {
  color: #5f6f68;
}

.small-text {
  margin-top: 16px;
}

.notice-box {
  background: #f8fffc;
  border: 1px solid var(--green-soft);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  line-height: 1.7;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.6;
}

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

.card-link {
  text-decoration: none;
  color: var(--text);
  text-align: center;
  font-weight: bold;
  padding: 12px;
  box-sizing: border-box;
}

.card-link:hover {
  background: var(--green-soft);
}

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

.full-width {
  grid-column: 1 / -1;
}

.password-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-top: 8px;
}

.password-hint.valid {
  color: #0f8f79;
}

.password-hint.invalid {
  color: #b42318;
}

.password-mark {
  font-weight: 700;
}

.identity-summary {
  background: #ffffff;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.identity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.identity-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.identity-item strong {
  color: var(--text);
}

.identity-item span {
  color: #4f5f59;
}

@media (max-width: 768px) {
  .container {
    padding: 18px 16px 72px;
  }

  .back-to-top-page {
    right: 14px;
    bottom: 14px;
    width: 38px;
    height: 38px;
    font-size: 22px;
  }

  .form-grid,
  .identity-grid {
    grid-template-columns: 1fr;
  }

  .top-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

.password-note {
  font-size: 14px;
  margin-top: 8px;
  color: #5f6f68;
}

.profile-link-shell {
  display: flex;
  justify-content: center;
}

.profile-link-card {
  width: 100%;
  max-width: 760px;
  background: white;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

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

.link-row input {
  flex: 1;
  padding: 12px;
  border: 1px solid #cfd8d3;
  border-radius: 10px;
  font-size: 16px;
  background: #fff;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}

.qr-card {
  margin-top: 24px;
  padding: 24px;
  border: 1px dashed var(--green-soft);
  border-radius: 16px;
  text-align: center;
  background: #f8fffc;
}

.qr-card img {
  width: 100%;
  max-width: 320px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.public-link-text {
  word-break: break-all;
  margin-top: 12px;
  color: #4f5f59;
}

.print-note {
  margin: 0;
}

.dashboard-actions {
  margin-top: 20px;
}

.no-print {
  display: block;
}

@media (max-width: 768px) {
  .link-row,
  .action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-link {
    width: 100%;
  }
}

@media print {
  body {
    background: #fff;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .profile-link-card {
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .qr-card {
    border: 0;
    background: #fff;
    margin-top: 0;
    padding-top: 0;
  }
}

.alert-success {
  background: #eefaf5;
  color: #0a6a59;
  border: 1px solid #bfe7d7;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.documents-list {
  margin-top: 24px;
}

.documents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.document-card {
  background: #ffffff;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
}

.document-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-card__body h3 {
  margin: 0 0 6px;
}

.document-card__body p {
  margin: 0;
  line-height: 1.6;
}

.document-card form {
  margin-top: auto;
}

.document-card .action-row {
  margin-top: 8px;
}

input[type="file"] {
  padding: 10px;
  background: #fff;
}

.public-warning-banner {
  background: #fff8e8;
  color: #6b4e00;
  border: 1px solid #f0d58a;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  line-height: 1.8;
}

.public-hero,
.public-section {
  background: #ffffff;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.public-hero h1,
.public-section h2 {
  margin-top: 0;
}

.public-hero-grid,
.public-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 16px;
}

.public-hero-item,
.public-info-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
}

.public-hero-item strong,
.public-info-item strong {
  color: var(--text);
}

.public-hero-item strong::after,
.public-info-item strong::after {
  content: ":";
}

.public-hero-item span,
.public-info-item span {
  color: #4f5f59;
  line-height: 1.7;
}

.public-placeholder-list {
  margin: 0;
  padding-inline-start: 20px;
  line-height: 1.9;
}

@media (max-width: 768px) {
  .public-hero-grid,
  .public-info-grid {
    grid-template-columns: 1fr;
  }
}

.form-group textarea {
  padding: 12px;
  border: 1px solid #cfd8d3;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  resize: vertical;
  min-height: 100px;
}

.section-divider {
  border: 0;
  border-top: 1px solid #dfe9e4;
  margin: 8px 0 4px;
}

.subsection-heading h2 {
  margin-bottom: 6px;
}

.subsection-heading {
  margin-top: 8px;
}

.labs-sheet-card {
  background: #ffffff;
  border: 1px solid var(--green-soft);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.labs-top-actions {
  display: flex;
  justify-content: flex-start;
}

.labs-sheet-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #dfe9e4;
  border-radius: 12px;
  background: #fff;
}

.labs-sheet-table {
  direction: ltr;
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.labs-sheet-table th,
.labs-sheet-table td {
  border: 1px solid #dfe9e4;
  padding: 10px 8px;
  vertical-align: middle;
  background: #fff;
  font-size: 14px;
}

.labs-sheet-table thead th {
  background: #f3faf7;
  text-align: center;
  font-weight: 700;
}

.labs-col-bilan {
  width: 34%;
}

.labs-col-date {
  width: 12%;
}

.labs-col-unit {
  width: 14%;
}

.labs-col-ref {
  width: 16%;
}

.labs-sheet-table input[type="text"],
.labs-sheet-table input[type="date"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cfd8d3;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.labs-row-section td {
  background: #f7fcfa;
  font-weight: 700;
}

.labs-row-note td {
  background: #fcfdfd;
  color: #4f5f59;
}

.labs-row-custom td {
  background: #f8fffc;
}

.warning-text {
  color: #b42318;
  font-weight: 700;
}

.labs-row-spacer td {
  height: 12px;
  background: #fff;
}

.preline-cell {
  white-space: pre-line;
  line-height: 1.6;
}

.public-labs-sheet-wrap {
  margin-top: 12px;
}

.public-labs-sheet-table td,
.public-labs-sheet-table th {
  font-size: 13px;
}

.public-labs-sheet-table td:nth-child(2),
.public-labs-sheet-table td:nth-child(3),
.public-labs-sheet-table td:nth-child(4) {
  text-align: center;
}

.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;
}

.symptoms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.checkbox-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #dfe9e4;
  border-radius: 12px;
  background: #fff;
  line-height: 1.5;
  cursor: pointer;
}

.checkbox-tile input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
}

.checkbox-inline-group {
  display: flex;
  align-items: end;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  cursor: pointer;
}