/* FamilyCard Styles */
:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --teal-900: #134e4a;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --white: #ffffff;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.1);
  --shadow: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --max-width: 1200px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--teal-600); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }

.skip-link {
  position: absolute; top: -100%; left: 0;
  background: var(--teal-700); color: var(--white);
  padding: 8px 16px; z-index: 100; font-weight: 600;
}
.skip-link:focus { top: 0; }

/* Header */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky; top: 0; z-index: 50;
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--gray-900);
}
.logo:hover { text-decoration: none; }
.logo-text { font-size: 1.25rem; font-weight: 600; }
.logo-text strong { color: var(--teal-600); }

.site-nav { display: flex; gap: 24px; }
.site-nav a {
  font-size: .9rem; font-weight: 500; color: var(--gray-600);
  padding: 4px 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover {
  color: var(--teal-700); border-bottom-color: var(--teal-500);
  text-decoration: none;
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--teal-700) 0%, var(--teal-600) 50%, var(--teal-500) 100%);
  color: var(--white);
  padding: 80px 0 70px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 16px;
}
.hero-sub {
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 32px;
  opacity: .9;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 22px; border-radius: var(--radius-sm);
  font-size: .95rem; font-weight: 600; cursor: pointer;
  border: 2px solid transparent; transition: all .15s;
  text-decoration: none; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--amber-500); color: var(--gray-900); border-color: var(--amber-500); }
.btn-primary:hover { background: var(--amber-400); border-color: var(--amber-400); }
.btn-secondary { background: var(--teal-600); color: var(--white); border-color: var(--teal-600); }
.btn-secondary:hover { background: var(--teal-700); border-color: var(--teal-700); }
.btn-ghost { background: transparent; color: var(--teal-700); border-color: var(--teal-200); }
.btn-ghost:hover { background: var(--teal-50); border-color: var(--teal-500); }
.btn-small { padding: 6px 14px; font-size: .85rem; }
.btn-icon {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--gray-300); background: var(--white);
  color: var(--gray-500); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.btn-icon:hover { background: var(--red-500); color: var(--white); border-color: var(--red-500); }

/* Sections */
.section-header { margin-bottom: 32px; }
.section-header h2 { font-size: 1.6rem; font-weight: 700; color: var(--gray-900); }
.section-header p { color: var(--gray-500); margin-top: 4px; }

/* Builder */
.builder-section { padding: 60px 0; }
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 40px;
  align-items: start;
}

/* Form */
.form-panel { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.form-group { border: none; margin-bottom: 28px; }
.form-group legend {
  font-size: 1rem; font-weight: 700; color: var(--teal-700);
  margin-bottom: 16px; padding-bottom: 8px;
  border-bottom: 2px solid var(--teal-100);
  width: 100%;
}
.field-row { margin-bottom: 14px; }
.field-row label {
  display: block; font-size: .85rem; font-weight: 600;
  color: var(--gray-700); margin-bottom: 4px;
}
.req { color: var(--red-500); }
.hint { font-weight: 400; color: var(--gray-400); font-size: .8rem; }

input[type="text"], input[type="date"], input[type="tel"], select, textarea {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-300); border-radius: var(--radius-sm);
  font-size: .9rem; font-family: var(--font);
  color: var(--gray-800); background: var(--white);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, .15);
}
textarea { resize: vertical; }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.med-list, .contact-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.med-fields, .contact-fields {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; align-items: center;
}
.med-fields input:first-child, .contact-fields input:first-child { grid-column: 1 / -1; }
.remove-med, .remove-contact { justify-self: end; }

.form-actions {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding-top: 20px; border-top: 1px solid var(--gray-200);
}

/* Preview */
.preview-panel { position: sticky; top: 80px; }
.preview-panel h3 { font-size: 1rem; font-weight: 700; margin-bottom: 12px; color: var(--gray-700); }

.card-preview {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}
.card-front, .card-back { padding: 20px; }
.card-front { background: var(--teal-700); color: var(--white); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-emergency-badge {
  background: var(--red-500); color: var(--white);
  font-size: .65rem; font-weight: 800; letter-spacing: 1px;
  padding: 3px 8px; border-radius: 4px;
}
.card-name { font-size: 1.15rem; font-weight: 700; }
.card-body { font-size: .8rem; }
.card-row { display: flex; gap: 6px; margin-bottom: 3px; }
.card-label { font-weight: 700; opacity: .85; min-width: 55px; }
.card-divider { height: 1px; background: var(--gray-200); margin: 12px 0; }
.card-section-title { font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .5px; color: var(--teal-700); margin-bottom: 4px; }
.card-section-content { font-size: .8rem; color: var(--gray-600); margin-bottom: 10px; white-space: pre-line; }
.card-back .card-section-content:last-child { margin-bottom: 0; }

.preview-note { font-size: .8rem; color: var(--gray-400); margin-top: 10px; text-align: center; }

/* Profiles */
.profiles-section { padding: 60px 0; background: var(--white); }
.profile-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.profile-empty { grid-column: 1 / -1; text-align: center; color: var(--gray-400); padding: 40px; background: var(--gray-50); border-radius: var(--radius); border: 2px dashed var(--gray-300); }
.profile-card {
  background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm); padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.profile-card h4 { font-size: 1rem; font-weight: 700; color: var(--gray-900); }
.profile-card p { font-size: .8rem; color: var(--gray-500); }
.profile-card .profile-meta { font-size: .75rem; color: var(--gray-400); }
.profile-card-actions { display: flex; gap: 8px; margin-top: auto; }

/* Guide */
.guide-section { padding: 60px 0; }
.guide-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px; margin-bottom: 48px;
}
.guide-card {
  background: var(--white); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}
.guide-card h3 { font-size: 1rem; font-weight: 700; color: var(--teal-700); margin-bottom: 8px; }
.guide-card p { font-size: .9rem; color: var(--gray-600); line-height: 1.7; }

.faq-block { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200); }
.faq-block h3 { font-size: 1.2rem; font-weight: 700; margin-bottom: 20px; color: var(--gray-900); }
.faq-block details { border-bottom: 1px solid var(--gray-200); padding: 14px 0; }
.faq-block details:last-child { border-bottom: none; }
.faq-block summary { font-weight: 600; color: var(--gray-700); cursor: pointer; font-size: .95rem; }
.faq-block summary:hover { color: var(--teal-700); }
.faq-block details p { margin-top: 8px; font-size: .9rem; color: var(--gray-600); line-height: 1.7; }

/* Footer */
.site-footer {
  background: var(--gray-900); color: var(--gray-400);
  padding: 48px 0 24px; margin-top: auto;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer-desc { font-size: .85rem; margin-top: 8px; line-height: 1.6; }
.site-footer h4 { color: var(--gray-200); font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 6px; }
.footer-links a { color: var(--gray-400); font-size: .85rem; }
.footer-links a:hover { color: var(--teal-200); }
.footer-bottom { border-top: 1px solid var(--gray-800); padding-top: 20px; text-align: center; font-size: .8rem; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--gray-900); color: var(--white);
  padding: 12px 20px; border-radius: var(--radius-sm);
  font-size: .9rem; font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(10px);
  transition: opacity .3s, transform .3s;
  pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Print */
@media print {
  body * { visibility: hidden; }
  .card-preview, .card-preview * { visibility: visible; }
  .card-preview {
    position: absolute; top: 0; left: 0;
    width: 3.5in; box-shadow: none; border: none;
  }
  .card-front, .card-back { padding: .2in; }
  .card-front { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Responsive */
@media (max-width: 900px) {
  .builder-layout { grid-template-columns: 1fr; }
  .preview-panel { position: static; order: -1; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .hero { padding: 48px 0 40px; }
  .hero h1 { font-size: 1.5rem; }
  .form-panel { padding: 20px; }
  .cols-2 { grid-template-columns: 1fr; }
  .med-fields { grid-template-columns: 1fr; }
  .contact-fields { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: .8rem; }
  .guide-grid { grid-template-columns: 1fr; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
