body {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f3f4f6;
  color: #111827;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

.page-shell {
  width: min(1100px, 100%);
  margin: 4rem auto 3rem;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

.page-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 2.6vw, 2.35rem);
}

.page-header p {
  margin: 0;
  color: #4b5563;
}

.card {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.06);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-body {
  padding: 1.5rem 1.75rem;
}

.card-body h2,
.card-body h3 {
  margin-top: 0;
}

.card-body--summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
}

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

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

.table thead th,
thead th {
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid #e5e7eb;
  background: #f9fafb;
  color: #1f2937;
}

.table tbody td,
tbody td {
  padding: 0.7rem 0.85rem;
  border-top: 1px solid #e5e7eb;
  vertical-align: top;
}

.table thead th {
  text-align: left;
  font-weight: 600;
  padding: 0.75rem 0.85rem;
  border-bottom: 2px solid #e5e7eb;
  background: #f9fafb;
  color: #1f2937;
}

.table-striped tbody tr:nth-child(even) {
  background: #f9fafb;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.15rem;
  border-radius: 0.75rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease, color 0.2s ease;
  cursor: pointer;
  border: none;
}

.btn-block {
  width: 100%;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
}

.btn-primary {
  background: #2563eb;
  color: #ffffff;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-secondary {
  background: #1f2937;
  color: #ffffff;
}

.btn-secondary:hover {
  background: #111827;
}

.btn-neutral {
  background: #f3f4f6;
  color: #1f2937;
  box-shadow: inset 0 0 0 1px #d1d5db;
}

.btn-neutral:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: #dc2626;
  color: #ffffff;
}

.btn-danger:hover {
  background: #b91c1c;
}

.button-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.25rem 0 1.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge.bg-success {
  background: #dcfce7;
  color: #166534;
}

.badge.bg-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge.bg-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.section-note {
  margin: 0.5rem 0 1.25rem;
  font-size: 0.95rem;
  color: #4b5563;
  text-align: center;
}

.auth-shell {
  flex: 1 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 4rem;
}

.auth-card {
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.12);
  padding: 2.25rem 2rem;
  width: min(360px, 100%);
}

.auth-card h2 {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: 100%;
}

.auth-card input {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  font-size: 0.95rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.auth-card input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}


h2 {
  text-align: center;
  margin-top: 0;
}

input {
  width: 100%;
  padding: 0.75rem;
  margin: 0.5rem 0 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-sizing: border-box;
}

.error, .success {
  text-align: center;
  margin-bottom: 1rem;
  font-weight: bold;
}

.error {
  color: red;
}

.success {
  color: green;
}
form + p {
  text-align: center;
  margin-top: 1rem;
}
form + p a, div a {
  color: #007bff;
  text-decoration: none;
}
form + p a:hover, div a:hover {
  text-decoration: underline;
}
.status {
  font-weight: bold;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.15rem;
  background-color: #2563eb;
  color: #fff;
  border-radius: 0.75rem;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.2s ease;
}
.button:hover {
  background-color: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(37, 99, 235, 0.18);
}

.select-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  background: #ffffff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  max-width: 420px;
  box-sizing: border-box;
}

.select-control:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

.select-control:hover {
  background: #f9fafb;
}
.question-block {
  margin-bottom: 1.5rem;
}

.question-block label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.question-block select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}
.legend {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: #555;
}

.question-block {
    margin-bottom: 1.5rem;
}

.question-text {
    font-weight: bold;
    margin-bottom: 0.5rem;
}

/* Notifications */
#notification {
    display: none;
    position: fixed;
    top: 1rem;
    right: -400px;
    background-color: #28a745;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-weight: bold;
    font-size: 1rem;
    z-index: 1000;
    transition: right 0.5s ease;
    min-width: 280px;
    max-width: 400px;
    width: auto;
}

#notification.show {
    right: 1rem;
}

#notification.success {
    background-color: #28a745;
}

#notification.error {
    background-color: #dc3545;
}

.notification-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem 1.5rem;
    width: 100%;
}

#notification-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    margin-left: 0.5rem;
    padding: 0;
    width: 1.8rem;
    height: 1.8rem;
    line-height: 1.8rem;
    text-align: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

#notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

#notification-message {
    flex-grow: 1;
    text-align: center;
    display: block;
}

/* Optional: When close button is hidden, keep message centered */
#notification-close[style*="display: none"] + #notification-message {
    margin: 0 auto;
    text-align: center;
}


/* Legend Styling */
.legend {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-left: 6px solid #007bff;
    border-radius: 6px;
}

.legend h3 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
    color: #007bff;
}

.legend-list {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: block;
    font-size: 0.95rem;
}

.legend-list li {
    display: list-item; /* revert flex to normal list behavior for proper top alignment */
    list-style: none;
    padding-left: 0.25rem;
    margin: 0.25rem 0;
    line-height: 1.4;
}

.legend-list li strong {
    min-width: 1.2em;
    text-align: right;
    margin-right: 0.25rem;
}

.finish-btn {
    background-color: #4CAF50;
    color: white;
    padding: 12px 20px;
    margin-top: 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    max-width: 300px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.finish-btn:hover {
    background-color: #45a049;
}

.response-buttons {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;            /* tighter spacing */
  flex-wrap: nowrap;       /* prevent wrapping */
}

.response-btn {
  flex: 1 1 20%;            /* 5 buttons per row */
  padding: 0.5rem 0.25rem;  /* tighter fit */
  text-align: center;
  border: 1px solid #ccc;
  background-color: #f8f8f8;
  color: #333;
  border-radius: 6px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
  min-width: 0;             /* 🔒 prevents overflow */
}

.response-btn:hover {
  background-color: #e0e0e0;
  color: #000;
}

.response-btn.selected {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
}

.response-btn.readonly {
  background-color: #f0f0f0;
  cursor: default;
  color: #888;
  opacity: 0.6;
}

.response-btn.selected.readonly {
  background-color: #e8f0fe;
  border: 2px solid #4285f4;
  color: #000;
  font-weight: bold;
  position: relative;
  font-size: 0.95rem;
  padding: 0.5rem 0.25rem;
}

.response-btn.selected.readonly::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 1rem;
  color: #4285f4;
}

.response-buttons.missing {
  background-color: #ffe5e5;
  border-radius: 8px;
  padding: 0.5rem;
}

/* Ghyst EI v2 scale captions ("Always/Almost Always", "Occasionally") are
   longer than the old SD/A codes: wrap them between words only, and on
   narrow screens show the numbers alone (the instructions list the labels) */
.ghyst-scale .response-btn small {
  display: inline-block;
  line-height: 1.2;
  font-size: 0.75rem;
}

@media (max-width: 520px) {
  .ghyst-scale .response-btn small {
    display: none;
  }
}

/* 📱 Optional: tweak for narrow screens */
@media (max-width: 400px) {
  .response-btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.15rem;
  }

  .response-btn small {
    display: none; /* hide label under number if needed */
  }
}

.navbar {
    background-color: #333;
    color: white;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.navbar-list {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    padding: 0;
    margin: 0;
}

.navbar-list li a {
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: opacity 0.2s ease;
}

.navbar-list li a:hover {
    opacity: 0.7;
}

.chart-instruction {
  font-style: italic;
  color: #555;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
  text-align: left;
  padding-left: 4px;
}

/* Default to desktop view */
.mobile-instruction {
  display: none;
}

/* Show mobile message instead when screen is narrow */
@media (max-width: 768px) {
  .desktop-instruction {
    display: none;
  }
  .mobile-instruction {
    display: inline;
  }
}
/* =========================
   Chart Page Layout Styles
   (Moved from ghyst_test_results_graph.php)
   ========================= */
/*html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #fff;
}*/

.chart-container {
  width: 100%;
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
  box-sizing: border-box;
}

#chart {
  width: 100%;
  height: 800px;
}

.timestamp {
  font-size: 12px;
  opacity: 0.6;
  text-align: center;
  margin-top: 30px;
}

 /* ─────────── Base Styles ─────────── */
  .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
  .badge { display:inline-block; padding:.2rem .5rem; border-radius:8px; font-size:.85rem; }
  .bg-success { background:#d1fae5; color:#065f46; }
  .bg-danger  { background:#fee2e2; color:#991b1b; }
  .card { border:1px solid #eee; border-radius:16px; box-shadow:0 1px 4px rgba(0,0,0,.05); padding:1rem 1.2rem; }
  .table { width:100%; border-collapse:collapse; }
  .table th, .table td { padding:.6rem .5rem; border-top:1px solid #eee; vertical-align:top; }
  .table thead th { border-bottom:2px solid #ddd; }

  /* Hover highlight for profile rows */
  #profilesTable tr.profile-row:hover { background-color: #f0f9ff; cursor: pointer; }

  /* Accordion behavior */
  .profile-row { cursor:pointer; }
  .profile-row:hover { background:#f8fafc; }
  .profile-row.active { background:#e0f2fe; }
  .guideline-row { display:none; background:#eff6ff; }
  .guideline-row.expanded { display: table-row; border-top: 1px solid #cbd5e1; background: #f9fafb; }
  .guideline-cell { padding:1rem; border-top:none; font-size:.95rem; }

  /* Guideline block */
  .guideline-title { margin:.5rem 0 .5rem; font-weight:700; font-size:1.1rem; }
.guideline-line { margin:.35rem 0; }
.guideline-content {
  margin: .75rem 0;
  line-height: 1.6;
}
  .guideline-text { white-space:pre-line; line-height:1.55; }
  .guideline-sections { margin-top:.5rem; }
  .guideline-section { margin:.5rem 0; }
  .guideline-section-title { font-weight:600; margin-bottom:.15rem; }
  .guideline-section-text { white-space:pre-line; line-height:1.55; }
  .guideline-image img { max-width:100%; height:auto; margin-top:.5rem; border-radius:8px; }

  /* Rate chips */
  .chip-row { margin:.25rem 0 .6rem; }
  .chip {
    display:inline-block; padding:.15rem .45rem; border-radius:999px;
    font-size:.8rem; line-height:1; border:1px solid rgba(0,0,0,.08);
  }
  .chip-high { background:#dcfce7; color:#065f46; }
  .chip-low  { background:#fee2e2; color:#7f1d1d; }

  /* Profile name & toggle arrow */
  #profilesTable td:nth-child(2) { font-size: 1.05rem; position: relative; user-select:none; }
  .toggle-arrow { display:inline-block; margin-left:6px; font-size:0.8rem; transition: transform 0.2s ease; }
  .profile-row.active .toggle-arrow { transform: rotate(180deg); }

  /* Print: show all guidelines */
  @media print { .guideline-row { display:table-row !important; } }

  .click-hint { color:#64748b; font-size:.85rem; margin-left:.5rem; }
  section { padding: 1.5rem 0; border-top: 1px solid #ddd; }
  section:first-of-type { border-top: none; }

  /* New guideline divider */
  .guideline-divider {
    border: none;
    border-top: 1px solid #ddd;
    margin: 0.6rem 0 0.8rem 0;
  }

/* ───────────────────────────────────────
   Results page PDFs (assets/page_pdf.js)
   Off-screen copy of the page that is drawn into the PDF.
   ─────────────────────────────────────── */
.pdf-report-holder {
  position: absolute;
  left: -10000px;
  top: 0;
  background: #fff;
}
.pdf-report {
  width: 100%;
  margin: 0;
  padding: 0;
  background: #fff;
}
/* Plain sections in the PDF: a card split across pages would show a broken border */
.pdf-report .card,
.pdf-report section {
  box-shadow: none;
  border: none;
  border-radius: 0;
  background: #fff;
  margin: 0 0 1.5rem;
}
.pdf-report .card-body {
  padding: 0;
}
.pdf-report .pdf-guideline + .pdf-guideline {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e5e7eb;
}
