:root {
  --blue-950: #082d4e;
  --blue-900: #0b3b66;
  --blue-800: #0e528e;
  --blue-700: #1466b0;
  --blue-600: #1b78cf;
  --blue-500: #2e8be6;
  --blue-200: #c8dff5;
  --blue-100: #e6f0fb;
  --blue-50: #f5f9fd;
  --green: #1fa97a;
  --green-100: #e5f6ef;
  --red: #e24c4c;
  --red-100: #fceaea;
  --amber: #d89522;
  --amber-100: #fcf3e3;
  --ink: #12202e;
  --muted: #68798a;
  --line: #e1e8ef;
  --surface: #ffffff;
  --background: #edf2f7;
  --shadow: 0 20px 50px -26px rgba(15, 45, 75, 0.42);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html { background: var(--background); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 0%, rgba(46, 139, 230, 0.10), transparent 32rem),
    var(--background);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }

.hidden { display: none !important; }

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 20px;
  color: white;
  background:
    linear-gradient(180deg, rgba(7, 42, 74, 0.98), rgba(11, 59, 102, 0.98)),
    var(--blue-900);
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: white;
  color: var(--blue-700);
  font-weight: 900;
  font-size: 23px;
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.55);
}

.brand-copy strong { display: block; font-size: 15px; }
.brand-copy span { display: block; margin-top: 2px; font-size: 11px; opacity: 0.7; line-height: 1.35; }

.user-panel {
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 16px;
  background: rgba(255,255,255,0.07);
  margin-bottom: 22px;
}

.user-panel .role { font-size: 10px; letter-spacing: 0.13em; text-transform: uppercase; opacity: 0.62; }
.user-panel .name { margin-top: 4px; font-size: 14px; font-weight: 700; }
.user-panel .facility { margin-top: 4px; font-size: 11px; opacity: 0.7; line-height: 1.4; }

.nav-section-title {
  margin: 20px 10px 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.52;
}

.nav-list { display: grid; gap: 6px; }

.nav-button {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.78);
  background: transparent;
  text-align: left;
  transition: 160ms ease;
}

.nav-button:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-button.active { background: white; color: var(--blue-900); font-weight: 700; box-shadow: 0 14px 28px -18px rgba(0,0,0,0.55); }

.nav-icon {
  width: 25px;
  height: 25px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.09);
  font-size: 12px;
  font-weight: 900;
  flex: 0 0 25px;
}

.nav-button.active .nav-icon { background: var(--blue-100); color: var(--blue-700); }

.sidebar-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.logout-button {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 11px;
  color: white;
  background: transparent;
}

.main-shell { min-width: 0; }

.top-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 14px clamp(18px, 4vw, 52px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(210, 222, 234, 0.75);
  background: rgba(248, 251, 254, 0.88);
  backdrop-filter: blur(18px);
}

.header-left { min-width: 0; }
.header-left h1 { margin: 0; font-size: clamp(19px, 2vw, 25px); }
.header-left p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--blue-700);
  background: white;
  position: relative;
}

.notification-count {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--red);
  font-size: 9px;
  font-weight: 800;
}

.content-area {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 34px 0 80px;
}

.demo-banner {
  margin-bottom: 20px;
  padding: 12px 15px;
  border: 1px solid #f2d7a6;
  border-radius: 13px;
  color: #7f5612;
  background: #fff8e9;
  font-size: 12px;
  line-height: 1.5;
}

.hero-card {
  min-height: 250px;
  padding: clamp(24px, 5vw, 54px);
  border-radius: 26px;
  color: white;
  background:
    radial-gradient(circle at 80% 10%, rgba(75, 164, 248, 0.95), transparent 27rem),
    linear-gradient(135deg, var(--blue-950), var(--blue-700));
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
}

.hero-card h2 { margin: 0; max-width: 620px; font-size: clamp(27px, 4.5vw, 48px); line-height: 1.08; }
.hero-card p { max-width: 640px; margin: 15px 0 0; color: rgba(255,255,255,0.78); line-height: 1.65; }
.hero-badge { align-self: flex-start; padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,0.13); font-size: 11px; font-weight: 700; white-space: nowrap; }

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

.stats-grid { margin-top: 18px; }

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 16px 34px -30px rgba(23, 55, 89, 0.8);
}

.card-body { padding: 20px; }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.card-header h2, .card-header h3 { margin: 0; font-size: 16px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.stat-card { padding: 18px; }
.stat-label { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.stat-value { margin-top: 10px; font-size: 25px; font-weight: 800; }
.stat-caption { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.4; }

.section { margin-top: 22px; }
.section-heading { margin-bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 0; font-size: 18px; }
.section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.action-card {
  min-height: 145px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
  text-align: left;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.action-card:hover { transform: translateY(-2px); border-color: var(--blue-200); box-shadow: var(--shadow); }
.action-card .action-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: var(--blue-700); background: var(--blue-100); font-weight: 900; }
.action-card strong { display: block; margin-top: 15px; }
.action-card span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.form-group { display: grid; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { color: #536475; font-size: 11px; font-weight: 700; }

.input, .select, .textarea {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: white;
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.input, .select { height: 47px; padding: 0 13px; }
.textarea { min-height: 115px; padding: 12px 13px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue-500); box-shadow: 0 0 0 4px rgba(46, 139, 230, 0.11); }

.form-actions { margin-top: 18px; display: flex; flex-wrap: wrap; gap: 10px; }

.button {
  min-height: 45px;
  padding: 0 17px;
  border: 0;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
}
.button-primary { color: white; background: var(--blue-700); box-shadow: 0 12px 22px -13px rgba(20, 102, 176, 0.85); }
.button-primary:hover { background: var(--blue-800); }
.button-secondary { color: var(--blue-700); background: var(--blue-100); }
.button-danger { color: white; background: var(--red); }
.button-outline { color: var(--blue-700); border: 1.5px solid var(--blue-700); background: white; }
.button-ghost { color: var(--muted); border: 1px solid var(--line); background: white; }
.button-block { width: 100%; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}
.badge-blue { color: var(--blue-700); background: var(--blue-100); }
.badge-green { color: #127b57; background: var(--green-100); }
.badge-red { color: #b83232; background: var(--red-100); }
.badge-amber { color: #9d6813; background: var(--amber-100); }
.badge-gray { color: #5f6f7f; background: #edf1f5; }

.list { display: grid; }
.list-item { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--blue-50); }
.list-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 42px; color: var(--blue-700); background: var(--blue-100); font-size: 12px; font-weight: 800; }
.list-title { font-size: 13px; font-weight: 750; }
.list-meta { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.list-actions { display: flex; align-items: center; gap: 8px; }

.search-row { display: flex; gap: 9px; }
.search-row .input { flex: 1; }

.profile-hero { padding: 24px; display: flex; align-items: center; gap: 17px; }
.profile-avatar { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center; color: var(--blue-700); background: var(--blue-100); font-size: 21px; font-weight: 900; }
.profile-hero h2 { margin: 0; font-size: 21px; }
.profile-hero p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }

.clinical-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.clinical-card { padding: 17px; }
.clinical-card h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; }
.clinical-card ul { margin: 0; padding-left: 17px; line-height: 1.8; font-size: 13px; }

.emergency-shell { border: 2px solid rgba(226, 76, 76, 0.34); }
.emergency-header { padding: 18px 20px; color: #8f2b2b; background: var(--red-100); border-bottom: 1px solid rgba(226, 76, 76, 0.22); }
.emergency-header h2 { margin: 0; font-size: 16px; }
.emergency-header p { margin: 5px 0 0; font-size: 11px; line-height: 1.5; }

.summary-table { width: 100%; border-collapse: collapse; }
.summary-table th, .summary-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 12px; vertical-align: top; }
.summary-table th { width: 190px; color: var(--muted); font-weight: 700; background: #fbfcfd; }
.summary-table tr:last-child th, .summary-table tr:last-child td { border-bottom: 0; }

.chart-list { display: grid; gap: 13px; }
.chart-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 35px; align-items: center; gap: 10px; font-size: 12px; }
.chart-track { height: 10px; border-radius: 999px; background: #eaf0f6; overflow: hidden; }
.chart-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--blue-700), var(--blue-500)); }

.empty-state { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty-icon { width: 58px; height: 58px; margin: 0 auto 14px; border-radius: 19px; display: grid; place-items: center; color: var(--blue-700); background: var(--blue-100); font-size: 20px; font-weight: 900; }
.empty-state strong { display: block; color: var(--ink); }
.empty-state p { max-width: 400px; margin: 7px auto 0; font-size: 12px; line-height: 1.55; }

.auth-page {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 24px;
}

.auth-visual {
  min-height: calc(100vh - 48px);
  padding: clamp(30px, 6vw, 72px);
  border-radius: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    radial-gradient(circle at 75% 18%, rgba(82, 171, 255, 0.95), transparent 23rem),
    linear-gradient(145deg, var(--blue-950), var(--blue-700));
  box-shadow: var(--shadow);
}

.auth-visual h1 { margin: 0; max-width: 680px; font-size: clamp(38px, 7vw, 82px); line-height: 0.98; letter-spacing: -0.04em; }
.auth-visual p { max-width: 630px; color: rgba(255,255,255,0.75); line-height: 1.7; }
.auth-note { padding: 13px 15px; border: 1px solid rgba(255,255,255,0.16); border-radius: 13px; background: rgba(255,255,255,0.08); font-size: 11px; line-height: 1.55; }

.auth-panel { align-self: center; padding: clamp(22px, 4vw, 46px); }
.auth-panel .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 36px; }
.auth-panel h2 { margin: 0; font-size: 27px; }
.auth-panel > p { margin: 8px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.role-option { min-height: 155px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: white; text-align: left; }
.role-option:hover { border-color: var(--blue-500); box-shadow: var(--shadow); }
.role-option .role-symbol { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: var(--blue-700); background: var(--blue-100); font-size: 18px; font-weight: 900; }
.role-option strong { display: block; margin-top: 16px; }
.role-option span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.auth-back { margin-top: 18px; }
.demo-credentials { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--blue-50); color: var(--muted); font-size: 11px; line-height: 1.6; }
.demo-credentials code { color: var(--blue-900); font-weight: 700; }


.mobile-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  border: 0;
  background: rgba(6, 28, 48, 0.46);
  backdrop-filter: blur(3px);
}

.mobile-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 60;
  width: min(320px, 86vw);
  padding: 22px 16px;
  color: white;
  background: linear-gradient(180deg, var(--blue-950), var(--blue-900));
  box-shadow: 24px 0 50px -28px rgba(0,0,0,0.8);
  overflow-y: auto;
}

.mobile-drawer .nav-button { color: rgba(255,255,255,0.82); }
.mobile-drawer .nav-button.active { color: var(--blue-900); }
.mobile-drawer-header { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:20px; }
.mobile-drawer-close { width:38px; height:38px; border:1px solid rgba(255,255,255,.18); border-radius:11px; color:white; background:transparent; }

.mobile-menu { display: none; }
.mobile-bottom-nav { display: none; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 100;
  max-width: min(380px, calc(100% - 44px));
  padding: 13px 15px;
  border-radius: 13px;
  color: white;
  background: var(--blue-900);
  box-shadow: 0 18px 42px -16px rgba(0,0,0,0.55);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: 180ms ease;
  font-size: 12px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a53131; }

.install-button {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  min-height: 42px;
  padding: 0 15px;
  border: 0;
  border-radius: 12px;
  color: white;
  background: var(--green);
  box-shadow: 0 16px 30px -14px rgba(31,169,122,0.8);
  font-weight: 800;
}

@media (max-width: 980px) {
  .app-frame { grid-template-columns: 82px minmax(0, 1fr); }
  .sidebar { padding: 22px 13px; }
  .brand { justify-content: center; }
  .brand-copy, .user-panel, .nav-section-title, .nav-button > span:not(.nav-icon), .sidebar-footer { display: none; }
  .nav-button { justify-content: center; padding: 9px; }
  .nav-icon { width: 36px; height: 36px; flex-basis: 36px; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .clinical-grid { grid-template-columns: 1fr; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-visual { min-height: 440px; }
}

@media (max-width: 720px) {
  body { background: #f7f9fc; }
  .app-frame { display: block; }
  .sidebar { display: none; }
  .top-header { min-height: 64px; padding: 10px 14px; }
  .mobile-menu { display: grid; }
  .header-left p { display: none; }
  .content-area { width: calc(100% - 24px); padding: 18px 0 92px; }
  .hero-card { min-height: 225px; padding: 24px; flex-direction: column; align-items: flex-start; }
  .grid-2, .grid-3, .grid-4, .action-grid, .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .chart-row { grid-template-columns: 105px minmax(0,1fr) 28px; }
  .summary-table th { width: 125px; }
  .list-item { padding: 14px; align-items: flex-start; }
  .list-actions { flex-direction: column; align-items: flex-end; }
  .search-row { flex-direction: column; }
  .auth-page { min-height: 100vh; padding: 0; display: block; }
  .auth-visual { min-height: 320px; border-radius: 0 0 28px 28px; padding: 30px 24px; }
  .auth-visual h1 { font-size: 42px; }
  .auth-panel { padding: 28px 20px 46px; }
  .role-options { grid-template-columns: 1fr; }
  .role-option { min-height: 125px; }
  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    height: 70px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,0.96);
    backdrop-filter: blur(16px);
  }
  .mobile-nav-button { border: 0; background: transparent; color: #97a4b0; display: grid; place-items: center; gap: 2px; font-size: 9px; }
  .mobile-nav-button strong { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; }
  .mobile-nav-button.active { color: var(--blue-700); }
  .mobile-nav-button.active strong { background: var(--blue-100); }
  .install-button { right: 14px; bottom: 82px; }
}

@media (max-width: 430px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header-actions .button { display: none; }
  .profile-hero { align-items: flex-start; }
}

/* Health passport, downloadable documents and account/logout */
.document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--blue-50), #fff);
}
.document-toolbar > div:first-child { display: grid; gap: 4px; }
.document-toolbar > div:first-child strong { color: var(--blue-900); }
.document-toolbar > div:first-child span { color: var(--muted); font-size: 12px; }
.document-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.passport-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: 22px;
  align-items: start;
}
.passport-card {
  min-height: 420px;
  overflow: hidden;
  border-radius: 24px;
  color: white;
  background:
    radial-gradient(circle at 92% 7%, rgba(255,255,255,.18), transparent 32%),
    linear-gradient(145deg, #0b3b66, #1466b0 58%, #2e8be6);
  box-shadow: 0 28px 60px -34px rgba(11,59,102,.75);
}
.passport-card.requested { background: radial-gradient(circle at 92% 7%, rgba(255,255,255,.18), transparent 32%), linear-gradient(145deg, #68470f, #b67b1d 58%, #e2a63c); }
.passport-card.draft { background: radial-gradient(circle at 92% 7%, rgba(255,255,255,.18), transparent 32%), linear-gradient(145deg, #354555, #5f7182 58%, #7f91a2); }
.passport-card.not-generated { filter: saturate(.6); opacity: .9; }
.passport-top, .passport-person, .passport-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.passport-top { padding: 24px 26px 18px; border-bottom: 1px solid rgba(255,255,255,.15); }
.passport-top span { display: block; font-size: 10px; font-weight: 900; letter-spacing: 1.4px; opacity: .78; }
.passport-top h2 { margin: 4px 0 0; font-size: clamp(24px, 4vw, 34px); }
.passport-status { max-width: 180px; padding: 8px 11px; border: 1px solid rgba(255,255,255,.32); border-radius: 999px; font-size: 10px; font-weight: 900; text-align: center; letter-spacing: .7px; }
.passport-person { padding: 22px 26px; }
.passport-avatar { width: 66px; height: 66px; border-radius: 19px; display: grid; place-items: center; flex: 0 0 66px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.18); font-size: 20px; font-weight: 900; }
.passport-person > div:nth-child(2) { flex: 1; }
.passport-person h3 { margin: 0 0 5px; font-size: 21px; }
.passport-person p { margin: 0; color: rgba(255,255,255,.75); font-size: 12px; }
.blood-chip { min-width: 78px; padding: 10px 13px; border-radius: 15px; text-align: center; background: rgba(255,255,255,.96); color: var(--red); }
.blood-chip span { display: block; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .7px; }
.blood-chip strong { font-size: 22px; }
.passport-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 1px; margin: 0 26px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.12); border-radius: 16px; overflow: hidden; }
.passport-grid > div { min-height: 84px; padding: 14px; background: rgba(4,31,56,.28); }
.passport-grid span, .passport-footer span { display: block; margin-bottom: 6px; color: rgba(255,255,255,.65); font-size: 9px; text-transform: uppercase; letter-spacing: .7px; }
.passport-grid strong, .passport-footer strong { display: block; font-size: 12px; line-height: 1.45; }
.passport-footer { margin-top: 22px; padding: 17px 26px 22px; border-top: 1px solid rgba(255,255,255,.15); }
.passport-footer > div:last-child { text-align: right; }
.passport-controls { overflow: hidden; }
.passport-timeline { display: grid; gap: 10px; margin-bottom: 18px; }
.passport-timeline > div { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.passport-timeline strong { font-size: 12px; }
.passport-timeline span { color: var(--muted); font-size: 11px; text-align: right; }
.stack-actions { display: grid; gap: 9px; }
.info-callout { padding: 12px 14px; border-radius: 12px; color: var(--blue-900); background: var(--blue-100); font-size: 12px; line-height: 1.55; }
.danger-zone { border-color: rgba(226,76,76,.32); }
.danger-zone .card-header { background: var(--red-100); }

@media (max-width: 980px) {
  .passport-layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .document-toolbar { align-items: flex-start; flex-direction: column; }
  .document-actions { width: 100%; justify-content: stretch; }
  .document-actions .button { flex: 1 1 100%; }
  .passport-card { min-height: 0; border-radius: 18px; }
  .passport-top, .passport-person, .passport-footer { padding-left: 18px; padding-right: 18px; }
  .passport-top { align-items: flex-start; }
  .passport-status { max-width: 130px; }
  .passport-person { flex-wrap: wrap; }
  .blood-chip { margin-left: auto; }
  .passport-grid { grid-template-columns: 1fr; margin-left: 18px; margin-right: 18px; }
  .passport-footer { align-items: flex-start; flex-direction: column; }
  .passport-footer > div:last-child { text-align: left; }
}

/* v4 clinical data entry and pharmacy workflows */
.role-options-four{grid-template-columns:repeat(2,minmax(0,1fr));}
.section-stack{display:grid;gap:20px;}
.button-large{min-height:54px;font-size:15px;}
.clinical-action-card{border-color:#B9D8F5;background:linear-gradient(180deg,#fff,#F7FBFF);}
.workflow-steps{display:grid;gap:14px;}
.workflow-steps>div{display:flex;align-items:flex-start;gap:12px;padding:12px;border:1px solid var(--line);border-radius:12px;background:var(--blue-50);}
.workflow-steps strong{width:26px;height:26px;display:grid;place-items:center;border-radius:50%;background:var(--blue-700);color:#fff;flex:0 0 26px;font-size:12px;}
.workflow-steps span{font-size:13px;line-height:1.5;color:var(--ink);}
.medicine-order{margin:18px 0;padding:16px;border:1px solid var(--line);border-radius:14px;background:#FAFCFE;}
.medicine-order-title{display:flex;justify-content:space-between;align-items:center;margin-bottom:14px;color:var(--blue-900);}
.medicine-order-title span{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px;}
.doctor-entry-layout{align-items:start;}
.pharmacy-hero{background:linear-gradient(135deg,#0B3B66,#1466B0 62%,#1FA97A);}
.pharmacy-workspace{display:grid;gap:20px;}
.minimum-identity{border-left:5px solid var(--blue-700);}
.prescription-work-card{overflow:hidden;}
.prescription-row{align-items:flex-start;}
.pharmacy-clinical-minimum{display:flex;flex-direction:column;gap:5px;padding:12px 14px;background:var(--blue-50);border-radius:12px;margin-bottom:16px;}
.pharmacy-clinical-minimum strong{font-size:11px;text-transform:uppercase;letter-spacing:.5px;color:var(--blue-700);}
.pharmacy-clinical-minimum span{font-size:13px;line-height:1.5;}
.table-scroll{overflow-x:auto;}
.inventory-table{width:100%;border-collapse:collapse;min-width:650px;}
.inventory-table th,.inventory-table td{padding:12px 14px;text-align:left;border-bottom:1px solid var(--line);font-size:12px;vertical-align:top;}
.inventory-table th{font-size:10.5px;text-transform:uppercase;letter-spacing:.5px;color:var(--muted);background:var(--blue-50);}
.inventory-table tbody tr:hover{background:#FAFCFE;}
.pharmacy-totals{margin:18px 0 4px auto;max-width:380px;display:grid;gap:8px;}
.pharmacy-totals>div{display:flex;justify-content:space-between;gap:20px;padding:7px 0;font-size:13px;}
.pharmacy-totals .grand-total{border-top:2px solid var(--blue-900);padding-top:12px;font-size:16px;color:var(--blue-900);}
.alert{padding:12px 14px;border-radius:12px;margin:14px 0;font-size:12.5px;line-height:1.5;}
.alert-warning{background:var(--amber-100);color:#875A13;border:1px solid #F1D59F;}
.inventory-layout{align-items:start;}
.inventory-card{grid-column:span 1;}
.receipt-shell{max-width:900px;margin:0 auto;padding:28px;}
.receipt-heading{display:flex;justify-content:space-between;gap:20px;padding-bottom:20px;border-bottom:2px solid var(--blue-900);}
.receipt-heading span,.receipt-number span,.receipt-meta span{font-size:10.5px;text-transform:uppercase;letter-spacing:.7px;color:var(--muted);}
.receipt-heading h2{margin:4px 0 2px;color:var(--blue-900);}
.receipt-heading p{margin:0;color:var(--muted);font-size:12px;}
.receipt-number{text-align:right;}
.receipt-number strong{display:block;font-size:18px;color:var(--blue-900);margin-top:4px;}
.receipt-meta{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;padding:20px 0;}
.receipt-meta>div{display:flex;flex-direction:column;gap:4px;}
.receipt-meta strong{font-size:12.5px;}
.receipt-total{max-width:380px;margin:22px 0 22px auto;display:grid;gap:8px;}
.receipt-total>div{display:flex;justify-content:space-between;padding:6px 0;font-size:13px;}
.receipt-total>div:last-child{font-size:17px;border-top:2px solid var(--blue-900);padding-top:12px;color:var(--blue-900);}
.receipt-footer{padding:16px;border-radius:12px;background:var(--green-100);font-size:12.5px;line-height:1.5;}
.receipt-footer p{margin:0 0 5px;}
.button:disabled{opacity:.5;cursor:not-allowed;box-shadow:none;}

@media (max-width:900px){
  .role-options-four{grid-template-columns:1fr;}
  .receipt-meta{grid-template-columns:repeat(2,minmax(0,1fr));}
  .receipt-shell{padding:18px;}
}
@media (max-width:600px){
  .receipt-heading{flex-direction:column;}
  .receipt-number{text-align:left;}
  .receipt-meta{grid-template-columns:1fr;}
  .pharmacy-totals,.receipt-total{max-width:none;}
  .prescription-row{display:block;}
  .prescription-row .list-actions{margin-top:12px;align-items:stretch;}
}

/* v5 API integration */
.api-status{display:flex;align-items:center;gap:7px;font-size:11px;color:var(--muted)}
.api-dot{width:9px;height:9px;border-radius:50%;background:var(--amber)}
.api-status.online .api-dot{background:var(--green)}
.api-status.offline .api-dot{background:var(--red)}
.loading-shell{min-height:280px;display:grid;place-items:center;text-align:center;color:var(--muted)}
.spinner{width:40px;height:40px;border-radius:50%;border:4px solid var(--blue-100);border-top-color:var(--blue-700);animation:spin .8s linear infinite;margin:0 auto 14px}
@keyframes spin{to{transform:rotate(360deg)}}
.error-card{padding:18px;border:1px solid rgba(226,76,76,.35);border-radius:14px;background:var(--red-100);color:#8f2b2b}
.inline-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.muted{color:var(--muted)}
.small{font-size:11px}
.medicine-line{display:grid;grid-template-columns:minmax(180px,1.8fr) repeat(4,minmax(110px,1fr)) 90px;gap:10px;align-items:end;padding:14px;border:1px solid var(--line);border-radius:14px;background:#fbfdff;margin-top:10px}
.prescription-items{display:grid;gap:8px;margin-top:12px}
.prescription-item{padding:11px 12px;border-radius:11px;background:var(--blue-50);font-size:12px;line-height:1.55}
.status-note{margin-top:10px;padding:10px 12px;border-radius:10px;background:var(--amber-100);font-size:12px;color:#805816}
.login-helper{margin-top:16px;padding:12px;border-radius:12px;background:var(--blue-50);font-size:11px;line-height:1.6;color:var(--muted)}
.login-helper code{color:var(--blue-900);font-weight:800}
.config-panel{max-width:560px;margin:16px auto 0;text-align:left}
.config-panel summary{cursor:pointer;color:var(--blue-700);font-size:12px;font-weight:700}
.config-panel .form-group{margin-top:10px}
.role-note{font-size:12px;line-height:1.6;color:var(--muted)}
.patient-search-results{margin-top:14px}
.receipt-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
@media(max-width:1100px){.medicine-line{grid-template-columns:repeat(2,minmax(0,1fr))}.medicine-line .full-mobile{grid-column:1/-1}}
@media(max-width:640px){.medicine-line{grid-template-columns:1fr}.medicine-line .full-mobile{grid-column:auto}.inline-actions .button{flex:1 1 100%}}

/* Phase 3 connected visit workflow */
.visit-summary-card { padding: 24px; }
.visit-title-row { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:22px; }
.visit-title-row h2 { margin:5px 0 4px; }
.field-label { display:block; color:var(--muted); font-size:12px; margin-bottom:5px; }
.visit-progress { display:grid; grid-template-columns:repeat(6,1fr); gap:8px; margin:20px 0 26px; }
.visit-step { position:relative; text-align:center; color:var(--muted); }
.visit-step::before { content:""; position:absolute; top:15px; left:-50%; width:100%; height:3px; background:var(--line); z-index:0; }
.visit-step:first-child::before { display:none; }
.visit-step span { position:relative; z-index:1; width:31px; height:31px; display:inline-flex; align-items:center; justify-content:center; border-radius:50%; background:var(--line); color:var(--muted); font-weight:700; }
.visit-step small { display:block; margin-top:8px; font-size:10px; }
.visit-step.done::before, .visit-step.done span { background:var(--blue-700); color:white; }
.visit-step.current span { box-shadow:0 0 0 5px var(--blue-100); }
.test-order-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(270px,1fr)); gap:14px; }
.test-order-card { padding:18px; }
.test-order-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; }
.test-order-head span:first-child { color:var(--blue-700); font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.5px; }
.test-order-head h3 { margin:4px 0 0; font-size:16px; }
.test-meta { color:var(--muted); font-size:11px; margin-top:12px; }
.test-result { margin-top:14px; padding:13px; background:var(--blue-50); border-radius:var(--radius-sm); }
.test-result p { margin:6px 0 9px; }
.test-result small { display:block; color:var(--muted); margin-top:6px; }
.structured-data { display:flex; gap:7px; flex-wrap:wrap; margin-top:8px; }
.structured-data span { background:var(--blue-50); border:1px solid var(--blue-100); border-radius:8px; padding:5px 8px; font-size:11px; }
.order-entry-grid { display:grid; grid-template-columns:1fr 2fr; gap:14px; padding-top:8px; }
.dispense-lines { display:grid; gap:12px; margin-bottom:20px; }
.dispense-line { display:grid; grid-template-columns:minmax(220px,1fr) 150px minmax(220px,auto); gap:14px; align-items:center; padding:14px; border:1px solid var(--line); border-radius:var(--radius-md); }
.dispense-line small { display:block; color:var(--muted); margin-top:5px; line-height:1.5; }
.check-line { display:flex; align-items:center; gap:8px; font-size:12px; color:var(--muted); }
.check-line input { width:18px; height:18px; }

@media (max-width: 850px) {
  .visit-progress { grid-template-columns:repeat(3,1fr); row-gap:18px; }
  .visit-step:nth-child(4)::before { display:none; }
  .dispense-line { grid-template-columns:1fr; }
  .order-entry-grid { grid-template-columns:1fr; }
}

/* Phase 3.1 workflow simplification */
.nurse-start-card{display:flex;align-items:center;justify-content:space-between;gap:22px;padding:24px;border-left:5px solid var(--blue-700)}
.nurse-start-card h2{margin:4px 0 7px}.nurse-start-card p{margin:0;color:var(--muted);line-height:1.55}
.nurse-workflow{display:grid;gap:16px}.vitals-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-bottom:14px}
.textarea.compact{min-height:76px}.nurse-task-list{display:grid;gap:14px}.nurse-task{border:1px solid var(--line);border-radius:14px;padding:14px;margin:0;background:#fbfdff}
.nurse-task legend{display:flex;align-items:center;gap:10px;padding:0 7px;color:var(--ink)}.nurse-task legend span:last-child{display:flex;flex-direction:column;gap:3px}
.nurse-task legend small{font-weight:400;color:var(--muted);font-size:11px}.task-number{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:var(--blue-100);color:var(--blue-700);font-weight:800}
.single-action-bar{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:17px 18px;border-radius:14px;background:var(--blue-900);color:white;position:sticky;bottom:12px;z-index:3;box-shadow:0 14px 30px rgba(11,59,102,.22)}
.single-action-bar>div{display:flex;flex-direction:column;gap:3px}.single-action-bar span{font-size:11px;line-height:1.45;opacity:.8}.single-action-bar .button{width:auto;min-width:180px;background:white;color:var(--blue-900);box-shadow:none}
.compact-details{overflow:hidden}.compact-details>summary{cursor:pointer;padding:15px 17px;font-weight:700;color:var(--blue-900);list-style:none}.compact-details>summary::-webkit-details-marker{display:none}.compact-details>summary::after{content:"+";float:right}.compact-details[open]>summary::after{content:"−"}
.compact-result-list{display:grid;gap:8px;padding:0 16px 16px}.compact-result-list>div{display:flex;justify-content:space-between;gap:16px;padding:10px 12px;background:var(--green-100);border-radius:10px;font-size:12px}.compact-result-list span{display:flex;gap:8px;align-items:center;color:var(--muted)}
.warning-callout,.success-callout{display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:11px;font-size:12px;line-height:1.5}.warning-callout{background:var(--amber-100);color:#805816}.success-callout{background:var(--green-100);color:#176f53}
.form-help{margin:0 0 14px;color:var(--muted);font-size:12px;line-height:1.5}.pharmacy-queue-list .queue-row{align-items:center}.queue-number{width:28px;height:28px;border-radius:9px;background:var(--blue-900);color:white;display:grid;place-items:center;font-weight:800;font-size:12px;flex:0 0 auto}.queue-row .list-main{flex:1}.queue-row .list-actions{min-width:180px}
@media(max-width:850px){.vitals-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.single-action-bar{position:static;flex-direction:column;align-items:stretch}.single-action-bar .button{width:100%}.nurse-start-card{align-items:flex-start;flex-direction:column}.queue-row{align-items:flex-start!important}.queue-row .list-actions{min-width:0;width:100%;margin-top:10px}}
@media(max-width:520px){.vitals-grid{grid-template-columns:1fr}.compact-result-list>div{flex-direction:column}.nurse-task{padding:11px}.queue-number{display:none}}
