/* ── Arabic font (WS-B: self-hosted Tajawal — no external font request) ──────
   Files in /public/fonts (see public/fonts/README.md). Removing the Google
   Fonts @import/​<link> eliminates the only cross-origin subresource (PDPL:
   no patient IP leaks to Google) and lets CSP lock font-src 'self'. */
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/tajawal-400-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/tajawal-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/tajawal-500-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/tajawal-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/tajawal-700-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/tajawal-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/tajawal-800-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('/fonts/tajawal-800-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/tajawal-900-arabic.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC, U+102E0-102FB, U+10E60-10E7E, U+10EC2-10EC4, U+10EFC-10EFF, U+1EE00-1EE03, U+1EE05-1EE1F, U+1EE21-1EE22, U+1EE24, U+1EE27, U+1EE29-1EE32, U+1EE34-1EE37, U+1EE39, U+1EE3B, U+1EE42, U+1EE47, U+1EE49, U+1EE4B, U+1EE4D-1EE4F, U+1EE51-1EE52, U+1EE54, U+1EE57, U+1EE59, U+1EE5B, U+1EE5D, U+1EE5F, U+1EE61-1EE62, U+1EE64, U+1EE67-1EE6A, U+1EE6C-1EE72, U+1EE74-1EE77, U+1EE79-1EE7C, U+1EE7E, U+1EE80-1EE89, U+1EE8B-1EE9B, U+1EEA1-1EEA3, U+1EEA5-1EEA9, U+1EEAB-1EEBB, U+1EEF0-1EEF1;
}
@font-face {
  font-family: 'Tajawal';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('/fonts/tajawal-900-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ── Design tokens ──────────────────────────────────────────── */
:root {
  --blue-900: #0b2a6f;
  --blue-700: #1557c0;
  --blue-600: #1e88e5;
  --glass:    rgba(255,255,255,0.9);
  --shadow:   0 25px 50px -12px rgba(0,0,0,0.15);
  --radius:   40px;
  --success:  #10b981;
  --danger:   #e11d48;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  font-family: 'Tajawal', sans-serif;
}

/* Replace global outline:none — keyboard users need focus rings */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

/* ── Base layout ────────────────────────────────────────────── */
html, body { height: 100%; margin: 0; }

body {
  display: flex;
  flex-direction: column;
  background: #eef2f7;
  color: #1e293b;
  direction: rtl;
}

/* ── Splash screen ──────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  /* Brand blue background so the logo is always visible */
  background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-700) 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.8s ease;
}

.loading-logo {
  width: clamp(100px, 15vw, 150px);
  animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-15px); }
}

/* ── Header / Hero ──────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(25deg, var(--blue-900) 0%, var(--blue-600) 100%);
  min-height: 400px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-bottom-left-radius:  80px;
  border-bottom-right-radius: 80px;
  flex-shrink: 0;
  position: relative;
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  width: 100%;
  max-width: 1100px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(15px);
  padding: 12px 25px;
  border-radius: 30px;
  border: 1px solid rgba(255,255,255,0.2);
  margin-top: 15px;
  position: relative;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: white;
  font-weight: 900;
  font-size: 24px;
  text-decoration: none;
  flex-shrink: 0;
}

.nav-brand img { width: 80px; }

/* Desktop nav-links container */
.nav-links {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ── Hamburger button (hidden on desktop) ───────────────────── */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: transform 0.25s, opacity 0.25s;
}

/* Animated X when open */
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Main content stretch ───────────────────────────────────── */
.app {
  flex: 1 0 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
}

/* ── Main card ──────────────────────────────────────────────── */
.main-card {
  background: var(--glass);
  backdrop-filter: blur(20px);
  width: 95%;
  max-width: 900px;
  margin: -160px auto 60px;
  padding: 45px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.5);
  box-shadow: var(--shadow);
  animation: fadeInUp 0.7s ease;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(40px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Form elements ──────────────────────────────────────────── */
label {
  display: block;
  font-weight: 700;
  color: var(--blue-900);
  margin: 15px 5px 8px;
}

input, textarea, select {
  width: 100%;
  padding: 14px 18px;
  border-radius: 15px;
  border: 1px solid #e2e8f0;
  font-size: 16px;
  background: #f8fafc;
  transition: border-color 0.25s, box-shadow 0.25s;
  /* Minimum 44px height for touch targets on mobile */
  min-height: 44px;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--blue-600);
  background-color: white;
  box-shadow: 0 0 0 4px rgba(30,136,229,0.1);
}

/* ── Native <select>: polished, RTL-aware caret ─────────────── */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 16px center;   /* RTL: caret on the left */
  background-size: 18px 18px;
  padding-left: 44px;                      /* room for the caret */
  cursor: pointer;
}
/* Mute the placeholder option until a real district is chosen */
select:required:invalid { color: #94a3b8; }
select option { color: #1e293b; }

/* ── Invalid-field highlight (touched-aware client validation) ── */
.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.12);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, var(--blue-600) 0%, var(--blue-700) 100%);
  color: white;
  border-radius: 18px;
  padding: 16px;
  font-weight: 800;
  font-size: 17px;
  border: none;
  cursor: pointer;
  width: 100%;
  margin-top: 20px;
  transition: transform 0.3s, box-shadow 0.3s;
  text-decoration: none;
  display: block;
  text-align: center;
  /* 48px min height — comfortable tap target on mobile */
  min-height: 48px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(30,136,229,0.3);
}

.btn-outline {
  background: white;
  color: var(--blue-900);
  border: 1px solid #e2e8f0;
  padding: 8px 18px;
  border-radius: 15px;
  text-decoration: none;
  font-weight: 700;
  transition: border-color 0.25s, color 0.25s;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.btn-outline:hover {
  border-color: var(--blue-600);
  color: var(--blue-600);
}

.btn-pharmacist-link {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.3);
  transition: background 0.25s, color 0.25s;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
}

.btn-pharmacist-link:hover {
  background: white;
  color: var(--blue-900);
}

/* Specific nav button styles */
.nav-dashboard {
  font-size: 13px;
  border-radius: 12px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.22);
  border: 1px solid rgba(255,255,255,0.45);
  font-weight: 800;
}

.nav-logout {
  background: #e11d48;
  border: none;
  padding: 8px 15px;
}

.nav-item {
  font-size: 13px;
  border-radius: 12px;
  padding: 8px 13px;
}

/* ── Tables ─────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th {
  color: #64748b;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 15px;
  text-align: right;
}

tr td {
  background: white;
  padding: 16px 15px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 14px;
}

tr:last-child td { border-bottom: none; }

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  flex-shrink: 0;
  background: var(--blue-900);
  color: white;
  padding: 40px 20px;
  text-align: center;
  border-top-left-radius:  60px;
  border-top-right-radius: 60px;
}

.email-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,255,255,0.1);
  padding: 12px 25px;
  border-radius: 15px;
  color: white;
  text-decoration: none;
  margin-top: 15px;
  transition: background 0.25s;
}

.email-box:hover { background: rgba(255,255,255,0.2); }

/* ── Inline SVG icons (partials/icon.ejs) ───────────────────────
   Sized to the surrounding font-size (1em) and colored via
   currentColor, so an icon drops in wherever an emoji used to be. */
.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  flex: none;
}

/* ── Home page: intro, action cards, how-it-works, trust ────── */
.home-intro { text-align: center; margin-bottom: 34px; }
.home-intro h1 {
  color: var(--blue-900);
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 900;
  margin: 0 0 12px;
}
.home-intro p {
  color: #475569;
  font-size: clamp(15px, 2.4vw, 18px);
  line-height: 1.7;
  max-width: 560px;
  margin: 0 auto;
}

/* Small uppercase-feel section label */
.section-label {
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.3px;
  margin: 0 0 18px;
}

/* ── Action cards ── */
.home-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 40px;
}
.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 9px;
  min-height: 200px;
  padding: 30px 22px;
  border-radius: 26px;
  background: white;
  border: 2px solid #e2e8f0;
  text-decoration: none;
  box-shadow: 0 10px 25px -18px rgba(11, 42, 111, 0.45);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.action-card:hover,
.action-card:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 22px 40px -20px rgba(11, 42, 111, 0.5);
}
.action-card .ac-icon {
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
  margin-bottom: 4px;
}
.action-card .ac-icon svg { width: 30px; height: 30px; }
.action-card .ac-title { font-size: 21px; font-weight: 900; color: var(--blue-900); }
.action-card .ac-desc  { font-size: 15px; font-weight: 500; color: #64748b; line-height: 1.6; }
.action-card .ac-cta   { margin-top: 6px; font-size: 14px; font-weight: 800; }

/* Per-action accent colors */
.action-create { border-color: #bfdbfe; }
.action-create .ac-icon { background: var(--blue-700); color: #fff; }
.action-create:hover, .action-create:focus-visible { border-color: var(--blue-600); }
.action-create .ac-cta { color: var(--blue-700); }

.action-track { border-color: #bbf7d0; }
.action-track .ac-icon { background: #059669; color: #fff; }
.action-track:hover, .action-track:focus-visible { border-color: #10b981; }
.action-track .ac-cta { color: #059669; }

.action-cancel { border-color: #fecaca; }
.action-cancel .ac-icon { background: #e11d48; color: #fff; }
.action-cancel:hover, .action-cancel:focus-visible { border-color: #f43f5e; }
.action-cancel .ac-cta { color: #e11d48; }

/* ── How it works ── */
.how-it-works {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 26px;
  padding: 28px 24px;
  margin-bottom: 34px;
}
.how-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
}
.how-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}
.how-step .step-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-600), var(--blue-700));
  color: #fff;
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.how-step .step-icon { color: var(--blue-700); line-height: 0; }
.how-step .step-icon svg { width: 28px; height: 28px; }
.how-step h4 { margin: 2px 0 0; color: var(--blue-900); font-size: 16px; font-weight: 800; }
.how-step p  { margin: 0; color: #64748b; font-size: 13.5px; line-height: 1.6; }

/* ── Trust badges ── */
.trust-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  color: #075985;
  padding: 10px 18px;
  border-radius: 50px;
  font-size: 13.5px;
  font-weight: 700;
}
.trust-badge svg { width: 17px; height: 17px; flex: none; }

/* ════════════════════════════════════════════════════════
   MOBILE  (≤ 768px) — patient-first responsive layout
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Hero expands naturally — no fixed height fighting the open menu */
  .hero-section {
    min-height: 0;
    padding-bottom: 24px;
    border-bottom-left-radius:  50px;
    border-bottom-right-radius: 50px;
  }

  /* ── Navbar row management ───────────────────────────────────────
     HTML order: [nav-brand] [nav-links] [hamburger]
     We use CSS `order` to rearrange visually:
       Row 1: nav-brand (order 1) + hamburger (order 2)
       Row 2: nav-links (order 3, flex-basis 100% → forces new row)
     flex-wrap:wrap on the navbar makes Row 2 possible.
  ─────────────────────────────────────────────────────────────── */
  .navbar {
    padding: 10px 14px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
    border-radius: 20px;
  }

  .nav-brand {
    order: 1;
    flex: 1;           /* expands to fill Row 1, pushing hamburger right */
  }

  .nav-brand img { width: 60px; }

  /* ── Hamburger: same row as logo, at the opposite end ── */
  .hamburger {
    display: flex;
    order: 2;
    flex-shrink: 0;
    margin-right: auto; /* in RTL this pushes it to the left end of Row 1 */
  }

  /* ── Nav-links: always a full-width Row 2, collapsed by default ── */
  .nav-links {
    order: 3;
    flex-basis: 100%;      /* forces wrap to new row */
    width: 100%;
    /* Collapsed state */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    gap: 8px;
    padding: 0 2px;
    transition: max-height 0.32s ease, opacity 0.22s ease, padding 0.22s ease;
  }

  /* Expanded state */
  .nav-links.nav-open {
    max-height: 700px;
    opacity: 1;
    pointer-events: auto;
    padding: 10px 2px 2px;
  }

  /* Each link inside the dropdown: full-width, large tap target */
  .nav-links .btn-outline,
  .nav-links .btn-pharmacist-link {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 13px 16px;
    font-size: 15px;
    border-radius: 13px;
    min-height: 50px;
    box-sizing: border-box;
  }

  /* Outline buttons need to be readable on the dark navy background */
  .nav-links .btn-outline {
    background: rgba(255,255,255,0.13);
    color: white;
    border-color: rgba(255,255,255,0.28);
  }

  .nav-links .btn-outline:hover,
  .nav-links .btn-outline:active {
    background: rgba(255,255,255,0.22);
    color: white;
    border-color: rgba(255,255,255,0.55);
  }

  /* ── Card sits below the hero with a comfortable gap ── */
  .main-card {
    padding: 22px 16px;
    margin-top: 20px;
    border-radius: 28px;
    width: 93%;
  }

  /* ── Typography ── */
  h2 { font-size: 20px; }
  h3 { font-size: 16px; }

  /* ── Buttons — bigger tap targets ── */
  .btn-primary {
    font-size: 16px;
    padding: 16px;
    border-radius: 16px;
  }

  /* ── Form inputs — comfortable on mobile ── */
  input, textarea {
    font-size: 16px; /* prevents iOS auto-zoom on focus */
    padding: 13px 15px;
    border-radius: 12px;
  }

  /* ── Table: hide less-critical columns, allow x-scroll ── */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  th, tr td { padding: 12px 10px; font-size: 13px; }

  /* ── Home page buttons — vertical stack, full width ── */
  .btn-group {
    flex-direction: column;
    gap: 12px;
  }

  /* ── Home action cards: tighter on small screens ── */
  .home-actions { gap: 14px; }
  .action-card { min-height: 0; padding: 26px 20px; }
  .action-card .ac-title { font-size: 20px; }
  .how-it-works { padding: 24px 18px; }

  /* ── Footer ── */
  .footer {
    border-top-left-radius:  40px;
    border-top-right-radius: 40px;
    padding: 30px 16px;
  }
}

/* ══════════════════════════════════════════════
   Very small screens (≤ 400px)
══════════════════════════════════════════════ */
@media (max-width: 400px) {
  .main-card { padding: 18px 12px; margin-top: 16px; }
  .hero-section { padding-bottom: 22px; }
}

/* ══════════════════════════════════════════════
   WS-G — moved from inline <style> blocks so CSP can lock
   style-src-elem 'self' (no injected <style> elements remain).
══════════════════════════════════════════════ */

/* Error/validation banner shake (create-request.ejs, request-details.ejs).
   Referenced by an inline `animation: shake 0.5s` style attribute. */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-5px); }
  75%       { transform: translateX(5px); }
}

/* Splash early-hide on repeat visits (header.ejs). The head script adds
   .splash-shown to <html> (which exists during head parse, unlike
   #loading-screen) so the splash never flashes on a repeat visit. */
html.splash-shown #loading-screen { display: none !important; }

/* PDPL consent box (create-request.ejs). */
.consent-box {
  background: #fffbeb;
  border: 1.5px solid #fcd34d;
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 22px;
  transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.consent-box:hover { border-color: #fbbf24; }
.consent-box:focus-within {
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.18);
  border-color: #f59e0b;
}
/* Positive confirmation when the patient has consented. */
.consent-box:has(.consent-checkbox:checked) {
  background: #ecfdf5;
  border-color: #6ee7b7;
}
.consent-box:has(.consent-checkbox:checked) .consent-text { color: #065f46; }
.consent-box:has(.consent-checkbox:checked) .consent-link { color: #047857; }

.consent-label {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 0;
  font-weight: 600;
  color: #78350f;
}

/* `min-height: 44px` from the global `input` rule was making the
   checkbox tall — override every size axis to lock it square. */
.consent-checkbox {
  appearance: none;
  -webkit-appearance: none;
  box-sizing: border-box;
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  max-width: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  flex: 0 0 24px;
  margin: 0 !important;
  padding: 0 !important;
  border: 2px solid #d97706;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.consent-checkbox:hover { background: #fef3c7; }
.consent-checkbox:active { transform: scale(0.92); }
.consent-checkbox:focus { outline: none; }
.consent-checkbox:checked {
  background: #059669;
  border-color: #059669;
}
.consent-checkbox:checked::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.consent-text {
  flex: 1;
  line-height: 1.75;
  font-size: 14.5px;
  transition: color 0.25s ease;
}
.consent-link {
  color: #b45309;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 700;
  transition: color 0.15s ease;
}
.consent-link:hover { color: #92400e; }

/* Cloudflare Turnstile panel (track-request.ejs). Centers and frames the
   widget; data-size="flexible" makes the widget grow to fill this width. */
.turnstile-panel {
  margin: 18px 0 22px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
}

.turnstile-panel .cf-turnstile {
  width: 100%;
}
:root .nav-logout-form { margin: 0; }
:root .nav-logout-form button { width: auto; margin: 0; border: 0; font: inherit; cursor: pointer; }
.registration-notice { padding: 1rem; margin: 1rem 0; border-radius: 1rem; background: #f0f9ff; color: #0c4a6e; }
.patient-registration { margin: 1rem 0 2rem; padding: 1rem; border: 1px solid #cbd5e1; border-radius: 1rem; }
.patient-registration summary { cursor: pointer; font-weight: 700; }
.patient-registration label { display: block; margin-top: .75rem; }

/* Public synthetic demo notice; retain the existing light theme. */
.demo-banner { background: #fff4cc; color: #392b00; border-bottom: 2px solid #d6a629; padding: 12px 20px; display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; text-align: center; }
.demo-banner a { color: #075985; font-weight: 700; }
