/* ==========================================================================
   Yuva Blood Forum — Professional Design System (Light + Dark)
   Brand palette from torch logo: crimson · gold · flame yellow
   ========================================================================== */

:root,
[data-theme="light"] {
  --font-primary: 'DM Sans', 'Segoe UI', sans-serif;
  --font-heading: 'Sora', 'DM Sans', sans-serif;

  --primary: #d22027;
  --primary-hover: #b01a20;
  --primary-deep: #8f1218;
  --primary-light: #fff0f0;
  --primary-border: #f0b0b3;
  --primary-rgb: 210, 32, 39;

  --flame: #f5d000;
  --gold: #e89b12;
  --gold-soft: #fff6e0;

  --bg-main: #faf7f4;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f5ebe3;
  --bg-navbar: rgba(255, 253, 250, 0.82);

  --text-main: #1c1011;
  --text-muted: #6e5255;
  --text-light: #9a7e81;

  --border-color: #ead9ce;
  --border-strong: #dcc4b4;
  --border-focus: #d22027;

  --success: #15803d;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger: #d22027;
  --danger-bg: #fff0f0;
  --warning: #a16207;
  --warning-bg: #fefce8;
  --warning-border: #fde68a;

  --shadow-sm: 0 1px 2px rgba(28, 16, 17, 0.05);
  --shadow-md: 0 8px 24px -8px rgba(210, 32, 39, 0.14), 0 2px 8px rgba(28, 16, 17, 0.04);
  --shadow-lg: 0 20px 40px -12px rgba(210, 32, 39, 0.18), 0 8px 16px rgba(28, 16, 17, 0.06);
  --shadow-hover: 0 16px 32px -10px rgba(210, 32, 39, 0.22);

  --input-bg: #ffffff;
  --overlay: rgba(28, 16, 17, 0.55);
  --toast-bg: #1c1011;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --glow-a: radial-gradient(ellipse 70% 50% at 0% -10%, rgba(245, 208, 0, 0.28), transparent 55%);
  --glow-b: radial-gradient(ellipse 60% 45% at 100% 0%, rgba(210, 32, 39, 0.12), transparent 50%);
}

[data-theme="dark"] {
  /* Matte dark — muted, flat, no gloss */
  --primary: #c94a4f;
  --primary-hover: #d85a5f;
  --primary-deep: #e08a8d;
  --primary-light: #221416;
  --primary-border: #4a2e31;
  --primary-rgb: 201, 74, 79;

  --flame: #c9a84a;
  --gold: #c4a04a;
  --gold-soft: #241c12;

  --bg-main: #121010;
  --bg-elevated: #1c1919;
  --bg-card: #1c1919;
  --bg-subtle: #242020;
  --bg-navbar: #161414;

  --text-main: #ebe4e4;
  --text-muted: #a09092;
  --text-light: #6e6264;

  --border-color: #322a2b;
  --border-strong: #433839;
  --border-focus: #c94a4f;

  --success: #5a9e6e;
  --success-bg: #152018;
  --success-border: #2a4030;
  --danger: #c94a4f;
  --danger-bg: #221416;
  --warning: #c4a04a;
  --warning-bg: #241c12;
  --warning-border: #3d3420;

  /* Soft depth only — no colored glow */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-hover: none;

  --input-bg: #161414;
  --overlay: rgba(0, 0, 0, 0.72);
  --toast-bg: #242020;

  --glow-a: none;
  --glow-b: none;
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

[data-theme="dark"] {
  color-scheme: dark;
}

body {
  font-family: var(--font-primary);
  background-color: var(--bg-main);
  background-image: var(--glow-a), var(--glow-b);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: background-color var(--transition), color var(--transition);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.25rem;
  width: 100%;
}

.hidden {
  display: none !important;
}

.text-muted {
  color: var(--text-muted);
}

.brand-accent {
  color: var(--primary);
  font-weight: 700;
}

/* —— Theme Toggle —— */
.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.12);
  transform: translateY(-1px);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }

[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

/* —— Navbar —— */
.navbar {
  background: var(--bg-navbar);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.7rem 0;
}

.navbar::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
  opacity: 0.85;
}

.navbar-inner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "brand sponsor . actions"
    "sub   sponsor . actions";
  align-items: center;
  column-gap: 1.15rem;
  row-gap: 0.15rem;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.nav-sponsor {
  grid-area: sponsor;
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  align-self: center;
  flex-shrink: 0;
}

.nav-sponsor-divider {
  display: inline-block;
  width: 1px;
  height: 28px;
  background: var(--border-strong);
  opacity: 0.75;
}

.nav-sponsor-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-sponsor-link:hover {
  transform: scale(1.03);
  opacity: 0.95;
}

.nav-sponsor-logo {
  height: 30px;
  width: auto;
  max-width: 130px;
  object-fit: contain;
  display: block;
}

.logo-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  flex-shrink: 0;
  background: transparent;
  box-shadow: none;
  transition: transform var(--transition);
}

.brand:hover .logo-img {
  transform: scale(1.04);
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--gold), var(--primary));
  color: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.15;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-subtitle {
  grid-area: sub;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.3;
  padding-left: calc(52px + 0.8rem);
  margin: 0;
}

.brand-subtitle .org-page {
  display: block;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.brand-subtitle .org-page::after {
  content: none;
}

.brand-subtitle .org-line {
  display: block;
  white-space: nowrap;
}

.nav-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.admin-badge {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--gold-soft);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
  border: 1px solid var(--border-strong);
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  padding: 0.42rem 0.85rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

.btn-primary {
  background: linear-gradient(160deg, #e6353c 0%, var(--primary) 55%, #a8181e 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.35);
}

[data-theme="dark"] .btn-primary {
  background: linear-gradient(160deg, #ff5a60 0%, var(--primary) 60%, #c42a30 100%);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(var(--primary-rgb), 0.4);
  filter: brightness(1.05);
}

.btn-outline {
  background: var(--bg-elevated);
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: var(--text-main);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-primary);
}

.btn-text:hover {
  text-decoration: underline;
}

/* —— Hero —— */
.hero-banner {
  text-align: center;
  margin: 2.5rem 0 1.75rem;
  animation: riseIn 0.55s ease-out;
}

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

.hero-logo {
  width: 132px;
  height: 132px;
  object-fit: contain;
  object-position: center;
  border-radius: 0;
  margin-bottom: 1.1rem;
  background: transparent;
  box-shadow: none;
  animation: softPulse 3.2s ease-in-out infinite;
}

@keyframes softPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.025); }
}

.hero-eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.55rem;
  padding: 0.28rem 0.75rem;
  border-radius: var(--radius-full);
  background: var(--gold-soft);
  border: 1px solid var(--border-strong);
}

.hero-title {
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  margin-bottom: 0.45rem;
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary) 45%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .hero-title {
  background: linear-gradient(135deg, #fff 10%, var(--primary) 50%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-desc {
  font-size: 0.98rem;
  color: var(--text-muted);
  max-width: 540px;
  margin: 0 auto;
}

.org-name {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.org-name .org-line {
  display: block;
  white-space: nowrap;
}

.org-name .org-line:first-child {
  color: var(--primary);
  letter-spacing: 0.14em;
}

.org-name .org-line:last-child {
  font-size: 0.86em;
  letter-spacing: 0.1em;
}

.hero-sponsor-badge {
  display: inline-flex;
  margin-top: 1.35rem;
  animation: riseIn 0.65s ease-out;
}

.hero-sponsor-card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.hero-sponsor-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-border);
}

.hero-sponsor-pill {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
}

.hero-sponsor-logo {
  height: 52px;
  width: auto;
  max-width: 250px;
  object-fit: contain;
  display: block;
}

/* —— Cards —— */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.search-card {
  margin-bottom: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  animation: riseIn 0.55s ease-out 0.08s both;
}

.search-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
}

.search-bar-wrapper {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-input-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--primary);
  pointer-events: none;
  opacity: 0.85;
}

.search-input-box input {
  width: 100%;
  padding: 0.9rem 2.5rem 0.9rem 2.85rem;
  font-size: 1rem;
  font-family: var(--font-primary);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--input-bg);
  color: var(--text-main);
}

.search-input-box input::placeholder {
  color: var(--text-light);
}

.search-input-box input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.16);
}

.btn-clear {
  position: absolute;
  right: 0.85rem;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.filter-select {
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-primary);
  background-color: var(--input-bg);
  color: var(--text-main);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.14);
}

.filter-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.results-count {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.dataset-meta {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

.results-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sort-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.sort-control label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.sort-control select {
  padding: 0.38rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--input-bg);
  color: var(--text-main);
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.sort-control select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.records-per-page {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

.records-per-page select {
  padding: 0.38rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--input-bg);
  color: var(--text-main);
  cursor: pointer;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.donor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.donor-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}

.donor-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: var(--primary-border);
}

.donor-card:hover::before {
  transform: scaleX(1);
}

.donor-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 0.5rem;
}

.donor-name {
  font-family: var(--font-heading);
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

.donor-blood-badge {
  background: linear-gradient(135deg, var(--gold) 0%, var(--primary) 100%);
  color: #fff;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 800;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-full);
  box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.donor-fields {
  display: flex;
  flex-direction: column;
  gap: 0.42rem;
  margin-bottom: 1.15rem;
}

.field-row {
  display: flex;
  font-size: 0.875rem;
  line-height: 1.4;
}

.field-label {
  color: var(--text-muted);
  width: 40%;
  font-weight: 500;
  flex-shrink: 0;
}

.field-value {
  color: var(--text-main);
  font-weight: 600;
  width: 60%;
  word-break: break-word;
}

.field-available {
  color: var(--success);
  font-weight: 700;
}

.field-cooling {
  color: var(--warning);
  font-weight: 700;
}

.field-unavailable {
  color: var(--danger);
  font-weight: 700;
}

.donor-card-actions {
  display: flex;
  gap: 0.5rem;
  border-top: 1px solid var(--border-color);
  padding-top: 0.85rem;
  margin-top: auto;
}

.donor-card-actions .btn {
  flex: 1;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1.5rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-color);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.empty-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 1.25rem;
}

.pagination-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.5rem 0;
}

.page-indicator {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* —— Modals —— */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.25rem;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--primary);
}

.modal-large {
  max-width: 1080px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.15rem 1.4rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-subtle);
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-title h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 1.4rem;
  overflow-y: auto;
}

.modal-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

.choice-btn {
  flex: 1;
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.choice-btn:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.choice-btn.selected-yes {
  border-color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}

.choice-btn.selected-no {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}


/* —— Profile / Auth —— */
.profile-page .main-content {
  padding: 2.5rem 0;
}

.auth-card, .profile-card {
  max-width: 580px;
  margin: 1rem auto 3rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.auth-card::before,
.profile-card::before,
.admin-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
}

.profile-card {
  max-width: 720px;
}

.google-auth-box {
  text-align: center;
  padding: 1.5rem 0;
}

.google-btn-wrapper {
  display: flex;
  justify-content: center;
  margin: 1.5rem 0;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 1.5rem 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  border-bottom: 1px solid var(--border-color);
}

.divider span {
  padding: 0 0.75rem;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.profile-avatar-box img {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-full);
  object-fit: cover;
  border: 3px solid var(--primary-border);
  box-shadow: var(--shadow-sm);
}

.profile-user-info {
  flex: 1;
}

.profile-user-info h2 {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.profile-status-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  margin-top: 0.35rem;
}

.status-active {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-cooling {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.status-ineligible {
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.contact-missing {
  font-size: 0.8rem;
  display: block;
  text-align: center;
  width: 100%;
  padding: 0.5rem 0;
}

.donation-update-box {
  background: var(--primary-light);
  border: 1.5px solid var(--primary-border);
}

.donation-input-row {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  flex-wrap: wrap;
}

.cooling-info-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 0.875rem;
  color: var(--text-main);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

/* —— Admin —— */
.admin-page .main-content {
  padding: 2rem 0;
}

.admin-login-card {
  max-width: 440px;
  margin: 3rem auto;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.admin-dashboard {
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

.admin-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-search-input input {
  width: 260px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  background: var(--input-bg);
  color: var(--text-main);
}

.admin-search-input input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.14);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  max-height: 600px;
}

.admin-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}

.admin-data-table th,
.admin-data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.admin-data-table th {
  background: var(--bg-subtle);
  font-weight: 700;
  color: var(--text-main);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 0 var(--border-color);
}

.admin-data-table tbody tr:hover {
  background-color: var(--primary-light);
}

.row-checkbox, #selectAllCheckbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

.action-btns {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-elevated);
  color: var(--text-main);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  font-weight: 600;
}

.btn-icon:hover {
  background: var(--bg-subtle);
}

.btn-icon-donate {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.btn-icon-donate:hover {
  filter: brightness(1.05);
}

.btn-icon-danger:hover {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--primary-border);
}

.analytics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.analytics-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.15rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: 2.1rem;
  line-height: 1;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.1;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}

.analytics-sections-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.35rem;
}

.analytics-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.2rem;
}

.analytics-card.full-width {
  grid-column: 1 / -1;
}

.analytics-card h4 {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.5rem;
  color: var(--text-main);
}

.breakdown-list, .breakdown-list-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.breakdown-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
}

.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.breakdown-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
}

.progress-track {
  height: 8px;
  background: var(--bg-subtle);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
  border-radius: var(--radius-full);
}

.blood-group-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

.bg-stat-pill {
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bg-stat-type {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
}

.bg-stat-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main);
}

/* —— Forms —— */
.form-group {
  margin-bottom: 1.1rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-main);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  background: var(--input-bg);
  color: var(--text-main);
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.14);
}

.form-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.required {
  color: var(--primary);
}

.tab-buttons {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
  min-width: 130px;
  font-family: var(--font-primary);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-btn:hover:not(.active) {
  color: var(--gold);
}

.upload-zone {
  border: 2px dashed var(--gold);
  background: linear-gradient(145deg, var(--gold-soft), var(--primary-light));
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  margin-bottom: 1rem;
}

.upload-zone:hover {
  border-color: var(--primary);
}

.upload-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.upload-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
  margin-bottom: 0.2rem;
}

.upload-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.file-input {
  display: none;
}

.file-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-subtle);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.file-name {
  font-weight: 600;
  font-size: 0.875rem;
}

.progress-bar-container {
  margin: 1rem 0;
}

.progress-bar {
  height: 8px;
  background: linear-gradient(90deg, var(--flame), var(--gold), var(--primary));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: block;
  text-align: center;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background-color: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--primary-border);
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.dataset-management {
  margin-top: 1.25rem;
  padding: 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.dataset-management h4 {
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.dataset-stats {
  font-size: 0.825rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.dataset-btn-row {
  display: flex;
  justify-content: flex-end;
}

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 2000;
}

.toast {
  background: var(--toast-bg);
  color: #fff;
  padding: 0.75rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-left: 3px solid var(--gold);
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  background: var(--bg-elevated);
  padding: 2rem 0 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.footer-sponsor {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1.35rem;
}

.footer-sponsor-eyebrow {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.65rem;
}

.footer-sponsor-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.6rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

.footer-sponsor-link:hover {
  transform: translateY(-2px);
  border-color: var(--primary-border);
  box-shadow: var(--shadow-md);
}

.footer-sponsor-logo {
  height: 54px;
  width: auto;
  max-width: 270px;
  object-fit: contain;
  display: block;
}

.footer-sponsor-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.footer-divider {
  width: 100%;
  max-width: 360px;
  height: 1px;
  background: var(--border-color);
  margin: 1.25rem auto;
  opacity: 0.85;
}

.footer-credit {
  margin-top: 0.35rem;
  font-size: 0.825rem;
  font-weight: 600;
}

.credit-link {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition);
}

.credit-link:hover {
  opacity: 0.85;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-org {
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.4;
}

.footer-org .org-line {
  display: inline;
  white-space: nowrap;
}

.footer-org .org-line + .org-line::before {
  content: ' ';
}

/* —— Responsive / Phone-first polish —— */
@supports (padding: max(0px)) {
  .navbar {
    padding-top: max(0.65rem, env(safe-area-inset-top));
  }

  .container {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .footer {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .toast-container {
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
    left: max(1rem, env(safe-area-inset-left));
  }

  .modal-overlay {
    padding: max(0.75rem, env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) max(0.75rem, env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  }
}

@media (max-width: 900px) {
  .analytics-sections-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .navbar {
    padding-top: max(0.55rem, env(safe-area-inset-top, 0px));
    padding-bottom: 0.65rem;
  }

  .navbar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand   actions"
      "sub     actions"
      "sponsor sponsor";
    column-gap: 0.65rem;
    row-gap: 0.3rem;
  }

  .brand {
    grid-area: brand;
    gap: 0.55rem;
    min-width: 0;
  }

  .brand-title {
    font-size: clamp(0.92rem, 3.8vw, 1.08rem);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nav-sponsor {
    grid-area: sponsor;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 0.25rem;
    padding-top: 0.35rem;
    border-top: 1px dashed var(--border-color);
  }

  .nav-sponsor-divider {
    display: none;
  }

  .nav-sponsor-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.8rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    max-width: 100%;
    box-shadow: var(--shadow-sm);
  }

  .nav-sponsor-logo {
    height: 24px;
    width: auto;
    max-width: 125px;
  }

  .brand-subtitle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
    padding-left: calc(40px + 0.55rem);
    max-width: none;
    overflow: visible;
    white-space: normal;
    font-size: clamp(0.58rem, 2.85vw, 0.7rem);
    letter-spacing: 0.05em;
    gap: 0.06rem;
  }

  .brand-subtitle .org-page {
    display: none;
  }

  .brand-subtitle .org-page::after {
    content: none;
  }

  .brand-subtitle .org-line {
    display: block;
    white-space: nowrap;
  }

  .nav-actions {
    gap: 0.35rem;
  }

  .nav-actions .btn span {
    display: none;
  }

  .btn-nav-icon,
  .nav-actions .btn-sm:not(.btn-danger) {
    width: 42px;
    height: 42px;
    min-width: 42px;
    padding: 0;
    border-radius: var(--radius-full);
  }

  .theme-toggle {
    width: 42px;
    height: 42px;
  }

  .admin-badge {
    display: none;
  }

  .hero-banner {
    margin: 1.35rem 0 1.2rem;
  }

  .search-card,
  .card {
    padding: 1.1rem;
  }

  .results-grid {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .tab-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 0;
    margin-left: -0.25rem;
    margin-right: -0.25rem;
    padding-bottom: 0;
  }

  .tab-buttons::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex: 0 0 auto;
    min-width: max-content;
    padding: 0.7rem 0.85rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  .container {
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }

  .logo-img {
    width: 40px;
    height: 40px;
  }

  .brand-title {
    font-size: 0.98rem;
    letter-spacing: -0.01em;
  }

  .brand-subtitle {
    font-size: clamp(0.56rem, 2.8vw, 0.66rem);
    letter-spacing: 0.06em;
    padding-left: calc(40px + 0.55rem);
  }

  .hero-logo {
    width: 88px;
    height: 88px;
    margin-bottom: 0.7rem;
  }

  .hero-eyebrow {
    font-size: 0.62rem;
    letter-spacing: 0.12em;
    padding: 0.2rem 0.65rem;
    margin-bottom: 0.45rem;
  }

  .hero-title {
    font-size: 1.45rem;
    margin-bottom: 0.5rem;
  }

  .hero-desc {
    font-size: clamp(0.68rem, 3.4vw, 0.82rem);
    line-height: 1.3;
    padding: 0;
    max-width: 100%;
  }

  .org-name {
    gap: 0.22rem;
  }

  .org-name .org-line:first-child {
    font-size: clamp(0.72rem, 3.7vw, 0.88rem);
    letter-spacing: 0.16em;
  }

  .org-name .org-line:last-child {
    font-size: clamp(0.6rem, 3.05vw, 0.74rem);
    letter-spacing: 0.09em;
  }

  .nav-sponsor {
    margin-top: 0.2rem;
    padding-top: 0.3rem;
  }

  .nav-sponsor-link {
    padding: 0.2rem 0.7rem;
  }

  .nav-sponsor-logo {
    height: 22px;
    max-width: 110px;
  }

  .hero-sponsor-card {
    padding: 0.45rem 1rem;
  }

  .hero-sponsor-logo {
    height: 42px;
    max-width: 190px;
  }

  .footer-sponsor-link {
    padding: 0.55rem 1.2rem;
  }

  .footer-sponsor-logo {
    height: 44px;
    max-width: 210px;
  }

  .footer-org {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
    font-size: clamp(0.62rem, 3.1vw, 0.72rem);
    letter-spacing: 0.08em;
  }

  .footer-org .org-line {
    display: block;
  }

  .footer-org .org-line + .org-line::before {
    content: none;
  }

  .search-bar-wrapper {
    flex-direction: column;
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .search-input-box input,
  .filter-select,
  .form-group input,
  .form-group select,
  .records-per-page select,
  .admin-search-input input {
    font-size: 16px; /* prevents iOS zoom on focus */
    min-height: 48px;
  }

  .search-input-box input {
    padding: 0.85rem 2.6rem 0.85rem 2.75rem;
  }

  .search-bar-wrapper .btn-primary {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .filters-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .filter-actions {
    justify-content: center;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    margin-bottom: 1rem;
  }

  .results-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
  }

  .dataset-meta {
    margin-left: 0;
  }

  .records-per-page {
    justify-content: space-between;
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.55rem 0.75rem;
  }

  .records-per-page select {
    flex: 1;
    max-width: 160px;
  }

  .donor-card {
    padding: 1.1rem;
    border-radius: 14px;
  }

  .donor-card:hover {
    transform: none;
  }

  .donor-card:active {
    transform: scale(0.995);
  }

  .donor-name {
    font-size: 1.05rem;
  }

  .donor-blood-badge {
    font-size: 0.85rem;
    padding: 0.3rem 0.65rem;
  }

  .field-row {
    flex-direction: column;
    gap: 0.1rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border-color);
  }

  .field-row:last-child {
    border-bottom: none;
  }

  .field-label,
  .field-value {
    width: 100%;
  }

  .field-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .field-value {
    font-size: 0.95rem;
  }

  .donor-card-actions {
    flex-direction: column;
    gap: 0.55rem;
  }

  .donor-card-actions .btn {
    width: 100%;
    min-height: 46px;
    font-size: 0.95rem;
  }

  .pagination-wrapper {
    flex-wrap: wrap;
    gap: 0.65rem;
    margin: 1.25rem 0 1.75rem;
  }

  .pagination-wrapper .btn {
    min-height: 44px;
    flex: 1;
    min-width: 120px;
  }

  .page-indicator {
    width: 100%;
    text-align: center;
    order: -1;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .profile-page .main-content,
  .admin-page .main-content {
    padding: 1.25rem 0;
  }

  .auth-card,
  .profile-card,
  .admin-login-card {
    margin: 0.5rem auto 2rem;
    padding: 1.2rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 0.85rem;
  }

  .profile-header .logout-btn {
    width: 100%;
    min-height: 44px;
  }

  .donation-input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .donation-input-row .btn {
    width: 100%;
    min-height: 48px;
  }

  .admin-table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left,
  .toolbar-right {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .admin-search-input,
  .admin-search-input input {
    width: 100%;
  }

  .toolbar-left .btn,
  .toolbar-right .btn {
    width: 100%;
    min-height: 44px;
  }

  .table-responsive {
    max-height: min(65vh, 480px);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
  }

  .admin-data-table {
    font-size: 0.8rem;
  }

  .admin-data-table th,
  .admin-data-table td {
    padding: 0.65rem 0.7rem;
  }

  .action-btns {
    flex-wrap: wrap;
  }

  .btn-icon {
    min-height: 36px;
    padding: 0.35rem 0.55rem;
  }

  .blood-group-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .analytics-summary-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-num {
    font-size: 1.5rem;
  }

  .modal-card {
    max-height: calc(100dvh - 1.5rem);
    border-radius: 16px;
  }

  .modal-header,
  .modal-body {
    padding: 1rem;
  }

  .modal-footer {
    flex-direction: column-reverse;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 46px;
  }

  .btn,
  .btn-text {
    -webkit-tap-highlight-color: transparent;
  }

  .btn-primary:active,
  .btn-outline:active {
    transform: scale(0.98);
  }

  .toast-container {
    bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
    left: 0.85rem;
    right: 0.85rem;
    align-items: stretch;
  }

  .toast {
    width: 100%;
    justify-content: center;
    text-align: center;
    font-size: 0.9rem;
    padding: 0.85rem 1rem;
  }

  .footer {
    padding: 1.15rem 0;
    font-size: 0.78rem;
    line-height: 1.45;
  }

  .footer-credit {
    font-size: 0.75rem;
  }

  .empty-state {
    padding: 2.5rem 1.15rem;
  }

  .empty-icon {
    font-size: 2.4rem;
  }

  .file-info {
    flex-direction: column;
    align-items: stretch;
  }

  .file-info .btn {
    width: 100%;
  }
}

@media (max-width: 380px) {
  .brand-title {
    font-size: 0.88rem;
  }

  .logo-img {
    width: 36px;
    height: 36px;
  }

  .brand-subtitle {
    padding-left: calc(36px + 0.55rem);
  }

  .nav-sponsor-logo {
    height: 20px;
    max-width: 95px;
  }

  .nav-actions .btn-sm,
  .btn-nav-icon,
  .theme-toggle {
    width: 38px;
    height: 38px;
    min-width: 38px;
  }

  .hero-title {
    font-size: 1.28rem;
  }

  .hero-logo {
    width: 76px;
    height: 76px;
  }

  .brand-subtitle,
  .org-name .org-line:first-child,
  .org-name .org-line:last-child,
  .footer-org {
    letter-spacing: 0.05em;
  }

  .blood-group-stats-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Touch devices: keep hover lifts off cards */
@media (hover: none) {
  .donor-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  .donor-card:hover::before {
    transform: scaleX(1);
  }

  .btn-primary:hover,
  .btn-outline:hover {
    transform: none;
  }

  .stat-card:hover {
    box-shadow: none;
  }
}

/* —— Dark mode: matte / flat finish —— */
[data-theme="dark"] body {
  background-image: none;
  background-color: var(--bg-main);
}

[data-theme="dark"] .navbar {
  background: var(--bg-navbar);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom-color: var(--border-color);
}

[data-theme="dark"] .navbar::after {
  height: 2px;
  opacity: 0.55;
  background: linear-gradient(90deg, var(--border-strong), var(--gold), var(--primary), var(--border-strong));
}

[data-theme="dark"] .logo-img,
[data-theme="dark"] .brand:hover .logo-img {
  box-shadow: none;
  filter: none;
  background: transparent;
}

[data-theme="dark"] .theme-toggle {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  box-shadow: none;
}

[data-theme="dark"] .theme-toggle:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: none;
  transform: none;
}

[data-theme="dark"] .btn-primary {
  background: var(--primary);
  color: #f5f0f0;
  box-shadow: none;
  filter: none;
  text-shadow: none;
}

[data-theme="dark"] .btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: none;
  filter: none;
  transform: none;
}

[data-theme="dark"] .btn-outline {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  box-shadow: none;
}

[data-theme="dark"] .btn-outline:hover {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  box-shadow: none;
}

[data-theme="dark"] .btn-danger {
  background: var(--danger);
  box-shadow: none;
  filter: none;
}

[data-theme="dark"] .hero-logo {
  background: transparent;
  box-shadow: none;
  animation: none;
  filter: none;
}

[data-theme="dark"] .hero-eyebrow {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--gold);
}

[data-theme="dark"] .hero-title {
  background: none;
  -webkit-background-clip: unset;
  background-clip: unset;
  color: var(--text-main);
}

[data-theme="dark"] .card,
[data-theme="dark"] .search-card,
[data-theme="dark"] .donor-card,
[data-theme="dark"] .modal-card,
[data-theme="dark"] .auth-card,
[data-theme="dark"] .profile-card,
[data-theme="dark"] .admin-login-card,
[data-theme="dark"] .admin-dashboard,
[data-theme="dark"] .analytics-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .empty-state {
  background: var(--bg-card);
  box-shadow: none;
  border-color: var(--border-color);
}

[data-theme="dark"] .search-card::before,
[data-theme="dark"] .auth-card::before,
[data-theme="dark"] .profile-card::before,
[data-theme="dark"] .admin-login-card::before,
[data-theme="dark"] .donor-card::before {
  background: var(--border-strong);
  opacity: 0.9;
}

[data-theme="dark"] .donor-card:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--border-strong);
  background: var(--bg-subtle);
}

[data-theme="dark"] .donor-blood-badge {
  background: var(--primary);
  box-shadow: none;
  text-shadow: none;
}

[data-theme="dark"] .progress-fill,
[data-theme="dark"] .progress-bar {
  background: var(--primary);
  box-shadow: none;
}

[data-theme="dark"] .upload-zone {
  background: var(--bg-subtle);
  border-color: var(--border-strong);
  box-shadow: none;
}

[data-theme="dark"] .upload-zone:hover {
  background: var(--bg-elevated);
  border-color: var(--primary);
  box-shadow: none;
}

[data-theme="dark"] .stat-card:hover {
  box-shadow: none;
  border-color: var(--border-strong);
}

[data-theme="dark"] .stat-num,
[data-theme="dark"] .bg-stat-type {
  color: var(--gold);
}

[data-theme="dark"] .bg-stat-pill {
  background: var(--bg-subtle);
  border-color: var(--border-color);
}

[data-theme="dark"] .modal-overlay {
  backdrop-filter: none;
  background: var(--overlay);
}

[data-theme="dark"] .modal-header {
  background: var(--bg-subtle);
}

[data-theme="dark"] .toast {
  background: var(--toast-bg);
  box-shadow: none;
  border-left-color: var(--border-strong);
}

[data-theme="dark"] .footer {
  background: var(--bg-elevated);
  border-top-color: var(--border-color);
}

[data-theme="dark"] .admin-badge {
  background: var(--bg-subtle);
  border-color: var(--border-color);
  color: var(--text-muted);
}

[data-theme="dark"] .search-input-box input:focus,
[data-theme="dark"] .filter-select:focus,
[data-theme="dark"] .form-group input:focus,
[data-theme="dark"] .form-group select:focus,
[data-theme="dark"] .admin-search-input input:focus {
  box-shadow: none;
  border-color: var(--border-focus);
}

[data-theme="dark"] .btn-icon-donate {
  background: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-color);
}

[data-theme="dark"] .donation-update-box {
  background: var(--bg-subtle);
  border-color: var(--border-color);
}

[data-theme="dark"] .profile-avatar-box img {
  border-color: var(--border-strong);
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero-banner,
  .search-card,
  .hero-logo,
  .toast {
    animation: none;
  }
}

.donor-card-faded {
  opacity: 0.72;
  filter: grayscale(0.2);
  background: var(--bg-subtle);
  border-top-color: var(--text-muted) !important;
}

.status-ineligible {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
  border: 1px solid rgba(220, 38, 38, 0.25);
}

/* Availability Toggle Switch Slider */
.toggle-switch-container {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
  user-select: none;
}

.toggle-switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-switch-slider {
  position: relative;
  width: 52px;
  height: 28px;
  background-color: var(--text-muted);
  border-radius: 34px;
  transition: background-color 0.3s ease, border-color 0.3s ease;
  display: inline-block;
  flex-shrink: 0;
}

.toggle-switch-slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
}

.toggle-switch-input:checked + .toggle-switch-slider {
  background-color: #10b981; /* Vibrant green */
}

.toggle-switch-input:checked + .toggle-switch-slider::before {
  transform: translateX(24px);
}

.toggle-switch-input:not(:checked) + .toggle-switch-slider {
  background-color: #dc2626; /* Vibrant red */
}

/* ========================================================
   LAZY LOADING & INFINITE SCROLL ENHANCEMENTS
   ======================================================== */

.lazy-sentinel {
  height: 2px;
  width: 100%;
  pointer-events: none;
  opacity: 0;
  margin-top: 1rem;
}

.lazy-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1.25rem 1.75rem;
  margin: 1.5rem auto;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  animation: fadeIn 0.3s ease-out;
}

.lazy-spinner {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(220, 38, 38, 0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.lazy-text {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.load-more-container {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
  animation: fadeIn 0.3s ease-out;
}

.btn-load-more {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  border-radius: 30px;
  background: var(--bg-card);
  border: 1.5px solid var(--primary);
  color: var(--primary);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.08);
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn-load-more:hover {
  background: var(--primary);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.2);
}

.card-enter {
  animation: cardFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.pagination-size-control {
  display: inline-flex;
  align-items: center;
}
