:root {
  --background: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --separator: #e5e5ea;
  --blue: #007aff;
  --red: #ff3b30;
  --green: #34c759;
  --amber: #ff9f0a;
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 15px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(0, 122, 255, 0.10), transparent 27rem),
    radial-gradient(circle at 90% 5%, rgba(255, 59, 48, 0.08), transparent 25rem),
    var(--background);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }
.shell { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }

.nav {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #ff716a, var(--red));
  box-shadow: 0 9px 22px rgba(255, 59, 48, 0.28);
}
.nav-actions, .button-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #fff;
  background: var(--blue);
  text-decoration: none;
  font-weight: 750;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease;
}
.button:hover { transform: translateY(-1px); filter: brightness(.98); }
.button.secondary { color: var(--blue); background: var(--surface-solid); border: 1px solid var(--separator); }
.button.danger { color: #c81d13; background: #fff0ef; }
.button.call { background: var(--green); }

.card, .hero-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, .7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.hero {
  padding: 78px 0 58px;
  display: grid;
  grid-template-columns: 1.08fr .92fr;
  gap: 56px;
  align-items: center;
}
.eyebrow { color: var(--red); font-weight: 800; }
.hero h1, .page-title h1 {
  letter-spacing: -0.055em;
  line-height: .98;
  margin: 12px 0 22px;
}
.hero h1 { font-size: clamp(46px, 7vw, 82px); }
.hero p { color: var(--secondary); font-size: 20px; max-width: 650px; }
.hero-card { padding: 25px; transform: rotate(1deg); }
.mini-profile, .patient-card .top { display: flex; gap: 14px; align-items: center; }
.avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 21px;
  display: grid;
  place-items: center;
  color: var(--blue);
  background: linear-gradient(145deg, #eef6ff, #dcecff);
  font-size: 22px;
  font-weight: 850;
}
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.tag { padding: 6px 10px; color: var(--secondary); background: #f0f0f5; border-radius: 999px; font-weight: 650; }
.alert-card {
  margin-top: 18px;
  padding: 16px;
  color: #61100b;
  background: #fff1f0;
  border-left: 5px solid var(--red);
  border-radius: 18px;
}
.alert-card b { color: var(--red); }
.features { padding: 30px 0 82px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.feature { padding: 26px; }
.feature-icon { font-size: 29px; }
.feature h3 { margin: 12px 0 7px; font-size: 19px; }
.feature p, .muted { color: var(--secondary); }
.feature p { margin: 0; }

.page-title { padding: 42px 0 22px; }
.page-title h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); }
.page-title p { color: var(--secondary); font-size: 18px; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 18px; padding-bottom: 54px; }
.form-card, .preview-card, .patient-card, .profile-section { padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.full { grid-column: 1 / -1; }
label { display: block; margin-bottom: 6px; color: var(--secondary); font-size: 13px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--separator);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  color: var(--text);
  background: var(--surface-solid);
  outline: none;
}
textarea { min-height: 104px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 122, 255, .12); }
.privacy { margin-bottom: 18px; padding: 14px; color: #674a00; background: #fff8e8; border: 1px solid #ffdf9a; border-radius: 16px; }
.sticky { position: sticky; top: 16px; height: max-content; }
.qr-wrap { width: max-content; max-width: 100%; margin: 16px auto; padding: 14px; background: #fff; border: 1px solid var(--separator); border-radius: 18px; }
.qr-wrap canvas { display: block; max-width: 100%; height: auto; }

.profile-page { width: min(720px, calc(100% - 28px)); margin: 24px auto 60px; }
.profile-header { padding: 30px; text-align: center; }
.profile-header .avatar { width: 90px; height: 90px; margin: auto; border-radius: 50%; font-size: 30px; }
.profile-header h1 { margin: 14px 0 5px; font-size: 36px; }
.profile-section { margin-top: 14px; }
.section-title { color: var(--secondary); font-size: 13px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.profile-section p { font-size: 17px; white-space: pre-wrap; }
.critical { background: #fff1f0; border: 1px solid #ffd4d0; }
.critical .section-title { color: var(--red); }
.dashboard { padding-bottom: 60px; }
.patient-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.patient-card .avatar { width: 52px; height: 52px; border-radius: 17px; }
.patient-card .buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.empty { padding: 42px; text-align: center; color: var(--secondary); }
.footer { padding: 30px 0 45px; color: var(--secondary); font-size: 13px; text-align: center; }
.toast { position: fixed; right: 20px; bottom: 20px; display: none; padding: 12px 16px; color: #fff; background: #1d1d1f; border-radius: 14px; box-shadow: var(--shadow); }
.toast.show { display: block; }

@media (max-width: 820px) {
  .hero, .form-layout { grid-template-columns: 1fr; }
  .hero { padding-top: 38px; }
  .features, .patient-grid { grid-template-columns: 1fr 1fr; }
  .sticky { position: static; }
  .hero-card { transform: none; }
  .nav-label { display: none; }
}
@media (max-width: 560px) {
  .features, .patient-grid, .form-grid { grid-template-columns: 1fr; }
  .full { grid-column: auto; }
  .hero h1 { font-size: 50px; }
  .nav { min-height: 64px; }
  .page-title { padding-top: 24px; }
  .form-card { padding: 18px; }
  .profile-header h1 { font-size: 30px; }
}
@media print {
  .nav, .footer, .no-print { display: none !important; }
  body { background: #fff; }
  .profile-page { width: 100%; margin: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
