/* Zdravstveni vodnik – mobile-first PWA */

:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #ccfbf1;
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --emergency: #dc2626;
  --emergency-bg: #fef2f2;
  --success: #059669;
  --success-bg: #ecfdf5;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --radius: 1rem;
  --radius-sm: 0.5rem;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px -15px rgba(0,0,0,0.15);
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
  min-height: 100vh;
}

.app {
  min-height: 100dvh;
  min-height: 100vh;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* Steps: only one visible */
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100dvh - 2rem);
  min-height: calc(100vh - 2rem);
  animation: stepIn 0.3s ease-out;
}

.step[hidden] {
  display: none !important;
}

@keyframes stepIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-inner {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
}

/* Back button */
.back {
  position: absolute;
  left: 1rem;
  top: 1rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s, background 0.2s;
}

.back:hover {
  color: var(--text);
  background: var(--border);
}

.back:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Welcome */
.step-welcome {
  text-align: center;
}

.logo {
  margin-bottom: 1.5rem;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 1.75rem;
  border-radius: var(--radius);
}

.logo img.logo-icon {
  display: block;
  margin-left: auto;
  margin-right: auto;
  background: none;
  border-radius: 20%;
  object-fit: contain;
}

.step-welcome h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.tagline {
  font-size: 1.05rem;
  color: var(--text-muted);
  margin: 0 0 1.5rem;
}

.disclaimer-inline {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.legal-consent {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
}

.legal-consent a {
  color: var(--primary-dark);
  text-decoration: underline; /* required: links must be distinguishable without colour alone (WCAG 1.4.1) */
}

.quick-baby-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 20rem;
  margin: 0 auto 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--primary-light);
  color: var(--primary-dark);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.quick-baby-link:hover {
  background: #99f6e4;
}

.quick-baby-icon {
  font-size: 1.25rem;
}

.quick-elder-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 20rem;
  margin: 0 auto 0.75rem;
  padding: 0.875rem 1.25rem;
  background: var(--warning-bg);
  color: #78350f; /* WCAG AA: 8.8:1 on #fffbeb */
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.quick-elder-link:hover {
  background: #fef3c7;
}

.quick-elder-icon {
  font-size: 1.25rem;
}

.when-to-call-link {
  display: block;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--primary-dark);
  text-decoration: none;
}

.when-to-call-link + .when-to-call-link {
  margin-top: 0.5rem;
}

.quick-pregnancy-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 20rem;
  margin: 0 auto 0.75rem;
  padding: 0.875rem 1.25rem;
  background: #ede9fe;
  color: #5b21b6;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.quick-pregnancy-link:hover {
  background: #ddd6fe;
}

.quick-pregnancy-icon {
  font-size: 1.25rem;
}

.quick-chronic-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 20rem;
  margin: 0 auto 0.75rem;
  padding: 0.875rem 1.25rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
}

.quick-chronic-link:hover {
  background: #bfdbfe;
}

.quick-chronic-icon {
  font-size: 1.25rem;
}

.when-to-call-link:hover {
  text-decoration: underline;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  padding: 0.875rem 1.5rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--primary-dark); /* #0f766e – WCAG AA: 5.5:1 on white */
  color: white;
}

.btn-primary:hover {
  background: #0a5c55;
}

/* Prevent nav/link color rules from overriding button text */
a.btn-primary,
a.btn-primary:hover,
a.btn-primary:visited {
  color: white;
}

.btn-large {
  width: 100%;
  max-width: 20rem;
  padding: 1rem 1.5rem;
  font-size: 1.05rem;
}

.btn-secondary {
  background: var(--primary-light);
  color: var(--primary-dark);
}

.btn-secondary:hover {
  background: #99f6e4;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* Headings in steps */
.step h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin: 0 0 1.5rem;
  color: var(--text);
}

.step-who .step-inner,
.step-symptom .step-inner,
.step-questions .step-inner,
.step-result .step-inner {
  position: relative;
  padding-top: 2.5rem;
}

/* Option cards */
.options-cards {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: var(--shadow);
}

.option-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

.option-card:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.option-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.options-symptoms .option-card {
  justify-content: center;
}

/* Pills */
.options-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.option-pill {
  padding: 0.625rem 1rem;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.option-pill:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.option-pill:focus-visible {
  outline: none;
  border-color: var(--primary);
}

.option-subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 0.75rem;
}

.child-age {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

/* When to call (one-pager) */
.step-when-to-call .step-inner {
  padding-top: 2.5rem;
  text-align: left;
}

.step-when-to-call h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.when-to-call-intro {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.when-to-call-list {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.when-to-call-list li {
  margin-bottom: 0.5rem;
}

#btn-close-when-to-call {
  width: 100%;
}

/* Baby symptom block */
.symptom-baby-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.symptom-baby-block .option-subtitle {
  margin-bottom: 0.5rem;
}

.options-baby {
  margin-bottom: 0.75rem;
}

.option-card-baby {
  background: var(--primary-light);
  border-color: rgba(13, 148, 136, 0.3);
}

/* Elder symptom block */
.symptom-elder-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.symptom-elder-block .option-subtitle {
  margin-bottom: 0.5rem;
}

.options-elder {
  margin-bottom: 0.75rem;
}

.option-card-elder {
  background: var(--warning-bg);
  border-color: rgba(217, 119, 6, 0.3);
}

/* Pregnancy symptom block */
.symptom-pregnancy-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.symptom-pregnancy-block .option-subtitle {
  margin-bottom: 0.5rem;
}

.options-pregnancy {
  margin-bottom: 0.75rem;
}

.option-card-pregnancy {
  background: #ede9fe;
  border-color: rgba(91, 33, 182, 0.3);
}

/* Chronic condition symptom block */
.symptom-chronic-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.symptom-chronic-block .option-subtitle {
  margin-bottom: 0.5rem;
}

.options-chronic {
  margin-bottom: 0.75rem;
}

.option-card-chronic {
  background: #dbeafe;
  border-color: rgba(30, 64, 175, 0.3);
}

/* Progress dots */
.progress-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.progress-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, transform 0.2s;
}

.progress-dot.active {
  background: var(--primary);
  transform: scale(1.2);
}

/* Question options (generic list) */
#question-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#question-options .option-card {
  justify-content: flex-start;
}

/* Result */
.result-badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.result-badge.self-care {
  background: var(--success-bg);
  color: var(--success);
}

.result-badge.doctor {
  background: var(--warning-bg);
  color: var(--warning);
}

.result-badge.emergency {
  background: var(--emergency-bg);
  color: var(--emergency);
}

.step-result h2 {
  margin-bottom: 1rem;
}

.result-actions {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.result-actions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.result-actions li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.result-actions li:last-child {
  margin-bottom: 0;
}

.result-actions li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
}

.result-when {
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 4px solid var(--primary);
}

.result-when strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.result-when p {
  margin: 0;
  font-size: 0.95rem;
}

.result-dehydration {
  padding: 1rem 1.25rem;
  background: var(--warning-bg);
  border-radius: var(--radius);
  border-left: 4px solid var(--warning);
  margin-bottom: 1rem;
}

.result-dehydration strong {
  display: block;
  font-size: 0.875rem;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.result-dehydration p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.result-night-message {
  padding: 1rem 1.25rem;
  background: var(--primary-light);
  border-radius: var(--radius);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1rem;
}

.result-save-as {
  margin-bottom: 1rem;
}

.result-save-as-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.result-save-as-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.result-save-as-input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.result-share {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.result-share .btn {
  width: 100%;
}

.disclaimer-block {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 1.5rem 0 0;
  line-height: 1.5;
}

.legal-links {
  margin-top: 1.25rem;
  font-size: 0.8rem;
}

.legal-links a {
  color: var(--primary);
  text-decoration: none;
}

.legal-links a:hover {
  text-decoration: underline;
}

.legal-links-result {
  margin-top: 1rem;
}

.install-banner {
  position: fixed;
  left: 0.75rem;
  right: 0.75rem;
  bottom: calc(0.75rem + 2.5rem + env(safe-area-inset-bottom));
  z-index: 80;
  max-width: 26rem;
  margin: 0 auto;
  padding: 0.75rem 0.9rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  line-height: 1.5;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.install-banner-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: center;
}

.install-banner-text {
  margin: 0;
  color: var(--text);
}

.install-banner-actions {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.install-banner--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (min-width: 768px) {
  .install-banner {
    display: none;
  }
}

.legal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

.legal-footer a {
  color: var(--primary);
  text-decoration: none;
}

.legal-footer a:hover {
  text-decoration: underline;
}

/* Cookie consent banner – above footer when visible */
.cookie-banner {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 1rem max(1rem, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  font-size: 0.875rem;
  line-height: 1.5;
}

.cookie-banner.is-visible {
  display: block;
}

body.has-cookie-banner .app {
  padding-bottom: 10rem;
}

.cookie-banner p {
  margin: 0 0 0.75rem;
  color: var(--text);
}

.cookie-banner a {
  color: var(--primary);
  text-decoration: none;
}

.cookie-banner a:hover {
  text-decoration: underline;
}

.cookie-banner-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.cookie-banner-buttons .btn {
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
}

/* Baby log */
.step-baby-log .step-inner {
  width: 100%;
  max-width: 22rem;
  text-align: left;
}

.baby-log-intro {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.baby-log-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.baby-log-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.baby-log-label {
  flex: 1 1 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.baby-log-value {
  flex: 1 1 auto;
  font-size: 0.95rem;
  color: var(--text);
}

.baby-log-actions,
.baby-log-row .btn {
  flex-shrink: 0;
}

.baby-log-reminder-row {
  margin-top: -0.25rem;
  padding-top: 0.5rem;
  border-top: none;
}

.baby-log-reminder-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.baby-log-reminder-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  background: var(--warning-bg);
  border: 1px solid var(--warning);
  border-radius: var(--radius-sm);
}

.baby-log-reminder-banner .baby-log-reminder-text {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text);
}

.baby-log-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.baby-log-history {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 0 1rem 0.25rem;
  min-height: 1.25rem;
}

.baby-log-temp-form {
  padding: 0.5rem 1rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-top: 0.25rem;
  border: 1px solid var(--border);
}

.baby-log-temp-form label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.baby-log-temp-input {
  width: 100%;
  max-width: 6rem;
  padding: 0.5rem 0.75rem;
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.5rem;
}

.baby-log-temp-form-actions {
  display: flex;
  gap: 0.5rem;
}

.baby-log-next-dose {
  font-size: 0.8rem;
  color: var(--primary-dark);
  padding: 0 1rem 0.25rem;
  min-height: 1.25rem;
}

.baby-log-footer-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.btn-cancel-reminder {
  margin-left: auto;
}

.btn-handover {
  width: 100%;
  margin-bottom: 0.75rem;
}

/* Baby log heading row + sync badge */
.baby-log-heading-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.baby-log-heading-row h2 {
  margin-bottom: 0;
}
.sync-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.76rem;
  font-weight: 500;
  color: #6b7280;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 2rem;
  padding: 0.2rem 0.65rem 0.2rem 0.45rem;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
  user-select: none;
}
.sync-badge.sync-saved {
  color: #065f46;
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.sync-badge.sync-error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fca5a5;
}
.sync-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: block;
}
/* Checkmark draws itself in when badge gets sync-saved */
.sync-check-path {
  stroke-dasharray: 10;
  stroke-dashoffset: 10;
  transition: stroke-dashoffset 0.35s ease 0.05s;
}
.sync-badge.sync-saved .sync-check-path {
  stroke-dashoffset: 0;
}
@keyframes syncPop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.14); }
  65%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}
.sync-badge.sync-pulse {
  animation: syncPop 0.4s ease;
}

/* Shared baby log view */
.shared-view-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #ecfdf5;
  border: 1px solid #6ee7b7;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: #065f46;
}
.shared-view-icon {
  font-size: 1.4rem;
  line-height: 1;
}
.shared-view-time {
  font-weight: 400;
  opacity: 0.75;
}
.shared-stale-notice {
  font-size: 0.82rem;
  color: #b45309;
  margin-top: 0.5rem;
  min-height: 1em;
}

/* ── Baby Log: Doctor Handover modal ───────────────────── */
.baby-handover-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: #fff;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.baby-handover-report {
  max-width: 52rem;
  margin: 0 auto;
  padding: 2rem 1.5rem 0.5rem;
  font-family: Georgia, 'Times New Roman', serif;
  color: #0f172a;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.baby-handover-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  border-top: 1px solid #e2e8f0;
  padding: 0.75rem 1.5rem env(safe-area-inset-bottom);
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* Report layout */
.rpt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 3px solid #0f172a;
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
}

.rpt-brand {
  font-family: system-ui, sans-serif;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.rpt-title {
  font-size: 1.375rem;
  font-weight: 700;
  margin: 0 0 0.125rem;
  color: #0f172a;
  font-family: Georgia, serif;
}

.rpt-subtitle {
  font-size: 0.875rem;
  color: #475569;
  font-family: system-ui, sans-serif;
}

.rpt-header-right {
  text-align: right;
  flex-shrink: 0;
}

.rpt-meta-item {
  font-size: 0.8rem;
  font-family: system-ui, sans-serif;
  color: #475569;
  display: flex;
  gap: 0.4rem;
  justify-content: flex-end;
  align-items: baseline;
}

.rpt-meta-item + .rpt-meta-item { margin-top: 0.2rem; }

.rpt-meta-item strong { color: #0f172a; }

.rpt-disclaimer {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  border-left: 4px solid #dc2626;
  border-radius: 0.375rem;
  padding: 0.6rem 0.875rem;
  font-size: 0.875rem;
  color: #7f1d1d;
  font-family: system-ui, sans-serif;
  margin-bottom: 1.25rem;
  line-height: 1.45;
}

.rpt-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  overflow: hidden;
  margin-bottom: 1.75rem;
  font-family: system-ui, sans-serif;
}

.rpt-summary-item {
  padding: 0.6rem 0.875rem;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}

.rpt-summary-item:last-child { border-right: none; }

.rpt-summary-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  margin-bottom: 0.2rem;
}

.rpt-summary-value {
  font-size: 0.9375rem;
  font-weight: 700;
  color: #0f172a;
}

.rpt-section {
  margin-bottom: 1.75rem;
  break-inside: avoid;
}

.rpt-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f172a;
  background: #0f172a;
  color: #fff;
  padding: 0.375rem 0.75rem;
  margin: 0 0 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: system-ui, sans-serif;
}

.rpt-count {
  background: rgba(255,255,255,0.25);
  border-radius: 9999px;
  font-size: 0.7rem;
  padding: 0.1em 0.5em;
  font-weight: 700;
}

.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  font-family: system-ui, sans-serif;
  border: 1px solid #cbd5e1;
  border-top: none;
}

.rpt-table th {
  background: #334155;
  color: #fff;
  text-align: left;
  padding: 0.45rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.rpt-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.rpt-table tbody tr:nth-child(even) td { background: #f8fafc; }

.rpt-fever > td { color: #7f1d1d; font-weight: 600; }
.rpt-fever > td:first-child { border-left: 4px solid #dc2626; }
.rpt-elevated > td { color: #78350f; }
.rpt-elevated > td:first-child { border-left: 4px solid #f59e0b; }

.rpt-chips {
  border: 1px solid #cbd5e1;
  border-top: none;
  padding: 0.625rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.rpt-chip {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 0.3rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
  font-family: system-ui, sans-serif;
  white-space: nowrap;
}

.rpt-empty {
  font-style: italic;
  color: #94a3b8;
  font-size: 0.875rem;
  font-family: system-ui, sans-serif;
}

.rpt-footer {
  margin-top: 2.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.725rem;
  color: #94a3b8;
  text-align: center;
  font-family: system-ui, sans-serif;
  padding-bottom: 1.5rem;
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
  @page { margin: 2cm 2cm 2.5cm; }

  body[data-handover-open] > * { display: none !important; }

  body[data-handover-open] #baby-handover-modal {
    display: block !important;
    position: static !important;
    overflow: visible !important;
    background: white !important;
  }

  .baby-handover-report {
    padding: 0 !important;
    max-width: none !important;
  }

  .baby-handover-actions,
  .no-print { display: none !important; }

  .rpt-table th,
  .rpt-section-title {
    background: #0f172a !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .rpt-table th {
    background: #334155 !important;
  }

  .rpt-table tbody tr:nth-child(even) td {
    background: #f8fafc !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .rpt-fever > td:first-child { border-left: 4px solid #dc2626 !important; }
  .rpt-elevated > td:first-child { border-left: 4px solid #f59e0b !important; }

  .rpt-disclaimer {
    background: #fef2f2 !important;
    border-left-color: #dc2626 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .rpt-section { break-inside: avoid; }

  thead { display: table-header-group; }
}

/* Emergency card form & view */
.step-emergency-card .step-inner,
.step-emergency-card-view .step-inner {
  width: 100%;
  max-width: 22rem;
  text-align: left;
}

.emergency-card-intro {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.emergency-card-fields {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.emergency-card-fields label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.emergency-card-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.emergency-card-form-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.emergency-card-display {
  padding: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.7;
}

.emergency-card-display .row {
  margin-bottom: 0.5rem;
}

.emergency-card-display .label {
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.5rem;
}

.emergency-card-display p {
  color: var(--text-muted);
  margin: 0;
}

.emergency-card-view-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-lockscreen-toggle {
  width: 100%;
  margin-top: 0.25rem;
}

/* ── Lock Screen Generator ──────────────────────────────── */
.lockscreen-section {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.lockscreen-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
}

.lockscreen-canvas-wrap {
  width: 100%;
  border-radius: 1.25rem;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06);
  background: #07091a;
  /* thin side rails simulate a phone frame */
  outline: 4px solid #1e2535;
  outline-offset: -1px;
}

.lockscreen-canvas {
  display: block;
  width: 100%;
  height: auto;
}

.app {
  padding-bottom: 2.5rem;
}

/* Last result card (welcome) */
.last-result-card {
  width: 100%;
  max-width: 20rem;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  text-align: left;
}

.last-result-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.last-result-icon {
  font-size: 1.25rem;
}

.last-result-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.last-result-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.last-result-summary .last-result-badge {
  margin: 0;
}

.last-result-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.last-result-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-small {
  padding: 0.5rem 0.875rem;
  font-size: 0.875rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg);
}

.btn-icon {
  margin-right: 0.25rem;
}

/* Red flags (result) */
.result-red-flags {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--emergency-bg);
  border-radius: var(--radius);
  border: 1px solid rgba(220, 38, 38, 0.2);
}

.result-red-flags[hidden] {
  display: none !important;
}

.result-red-flags summary {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--emergency);
  cursor: pointer;
  list-style: none;
  padding-left: 1.5rem;
  position: relative;
}

.result-red-flags summary::-webkit-details-marker {
  display: none;
}

.result-red-flags summary::before {
  content: '▼';
  position: absolute;
  left: 0;
  font-size: 0.65rem;
  top: 0.25rem;
  transition: transform 0.2s;
}

.result-red-flags[open] summary::before {
  transform: rotate(-90deg);
}

.result-red-flags ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.result-red-flags li {
  margin-bottom: 0.35rem;
}

.result-red-flags li:last-child {
  margin-bottom: 0;
}

/* Country / emergency number row */
.result-country-row {
  margin-top: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg);
  border-radius: var(--radius);
}

.result-country-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.country-detected-hint {
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--teal);
  opacity: 0.85;
}

.result-country-select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  margin-bottom: 0.5rem;
}

.result-emergency-number {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-dark);
}

/* Print */
@media print {
  @page {
    margin: 1.5cm 2cm 2cm;
  }

  /* ── Reset screen-only layout that causes top whitespace ── */
  body {
    background: white !important;
  }

  /* The app wrapper adds safe-area padding and min-height — strip both */
  .app {
    padding: 0 !important;
    min-height: 0 !important;
  }

  /* Steps are full-viewport flex containers centred vertically —
     that centres content halfway down the printed page.
     Reset to simple block flow from the top. */
  .step {
    display: block !important;
    min-height: 0 !important;
    animation: none !important;
  }

  /* step-inner variants carry padding-top for the back button —
     remove it so content starts at the top margin */
  .step-inner,
  .step-who .step-inner,
  .step-symptom .step-inner,
  .step-questions .step-inner,
  .step-result .step-inner,
  .step-when-to-call .step-inner,
  .step-baby-log .step-inner,
  .step-emergency-card .step-inner,
  .step-emergency-card-view .step-inner {
    padding-top: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* ── Hide interactive / navigational chrome ── */
  .no-print,
  .back,
  .result-share,
  .legal-footer,
  .install-banner,
  .sync-badge,
  .baby-log-footer-actions,
  .baby-log-reminder-banner,
  .baby-log-reminder-row,
  .baby-log-temp-form,
  .lockscreen-section,
  .btn-lockscreen-toggle,
  .btn-handover {
    display: none !important;
  }

  /* Hide buttons but keep them in flow if they are submit/action
     — use a class list rather than the blanket .btn rule so that
     styled content containers (e.g. result cards) aren't affected */
  button,
  [role="button"] {
    display: none !important;
  }

  /* ── Result page ── */
  .result-print-area {
    padding-top: 0 !important;
  }

  .result-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .result-red-flags {
    break-inside: avoid;
  }

  .result-red-flags summary::before {
    display: none;
  }

  .result-red-flags[open] details {
    display: block;
  }

  /* ── Emergency card view ── */
  .ec-view-card {
    border: 1px solid #cbd5e1 !important;
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Larger screens */
@media (min-width: 480px) {
  .options-cards.options-symptoms {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 640px) {
  .app {
    padding: 2rem;
  }

  .step-welcome h1 {
    font-size: 2rem;
  }

  .step h2 {
    font-size: 1.5rem;
  }

  .result-share {
    flex-direction: row;
    justify-content: center;
  }

  .result-share .btn {
    width: auto;
  }
}

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
  .step {
    animation: none;
  }

  .btn:active {
    transform: none;
  }
}
