:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #2b925d;
  --brand-dark: #23744a;
  --brand-soft: #d3efdf;
  --ham: #dc2626;
  --ham-bg: #fef2f2;
  --haz: #ea580c;
  --haz-bg: #fff7ed;
  /* Restricted is its own state, not a milder hazard, so it is yellow and
     stays clear of the hazardous orange. Yellow is too light to carry white
     text, so anything tinted with it is written in --res-ink instead. */
  --res: #a16207;
  --res-yellow: #eab308;
  --res-bg: #fefce8;
  --res-ink: #422006;
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04);
  --shadow-lg: 0 14px 40px rgba(15,23,42,.16);
  --radius: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

/* page-wide tint per drug safety class */
body.page-ham  { background: linear-gradient(180deg, #fee2e2 0, var(--bg) 360px); }
body.page-haz  { background: linear-gradient(180deg, #ffedd5 0, var(--bg) 360px); }
body.page-res  { background: linear-gradient(180deg, #fef9c3 0, var(--bg) 360px); }
body.page-both { background: linear-gradient(180deg, #fee2e2 0, #ffedd5 180px, var(--bg) 400px); }

/* faint grey hospital-emblem watermark behind all content */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url('dsah-logo.png') no-repeat center 86% / min(560px, 84vw);
  filter: grayscale(1);
  opacity: .05;
  pointer-events: none;
  z-index: 0;
}
.hero, .container, .site-footer { position: relative; z-index: 1; }

.muted { color: var(--muted); }
a { color: var(--brand-dark); }

/* ---------- header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: #1a5c39;
  border-bottom: 1px solid rgba(255,255,255,.10);
  padding-top: max(10px, env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; min-width: 0; }
.brand-logo { flex: none; width: 42px; height: 42px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; line-height: 1.15; color: #fff; }
.brand-text small { font-size: 11.5px; color: rgba(255,255,255,.78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-link {
  flex: none; color: #fff; text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 7px 15px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px; background: transparent;
}
.admin-link:active { background: rgba(255,255,255,.15); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

/* ---------- header nav (Guidelines & Policies) ---------- */
.site-nav { position: relative; }
.nav-toggle {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  color: #fff; font-weight: 600; font-size: 14px; font-family: inherit;
  padding: 8px 14px; border: 1px solid rgba(255,255,255,.45); border-radius: 999px;
  background: transparent;
}
.nav-toggle:hover { background: rgba(255,255,255,.12); }
.nav-toggle[aria-expanded="true"] { background: rgba(255,255,255,.18); }
.nav-caret { transition: transform .15s ease; }
.nav-toggle[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }
.nav-panel {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 50;
  width: 320px; max-height: 72vh; overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 8px; display: grid; gap: 2px;
}
.nav-panel[hidden] { display: none; }
.nav-panel .nav-link {
  display: block; padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: 14px;
}
.nav-panel .nav-link:hover { background: var(--brand-soft); color: var(--brand-dark); }

@media (max-width: 560px) {
  .nav-toggle span { display: none; }
  .nav-toggle { padding: 8px; }
  .nav-panel { position: fixed; top: 60px; left: 8px; right: 8px; width: auto; }
  .brand-text small { display: none; }
}

/* ---------- hero ---------- */
.hero {
  position: relative; color: #fff; text-align: center;
  padding: 40px 18px 64px;
  /* A hospital photo can be layered in here (assets/img/hospital-banner.jpg,
     above the gradient) if the hospital supplies one. Until then the file is
     not referenced, so no page asks for something that is not there. */
  background: linear-gradient(105deg, #0f766e 0%, #115e59 48%, #0d9488 100%);
}
.hero-inner { max-width: 720px; margin: 0 auto; }
.hero-logo { width: 84px; height: 84px; object-fit: contain; margin-bottom: 12px;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); background: rgba(255,255,255,.92);
  border-radius: 50%; padding: 8px; }
.hero h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: .2px; }
.hero-ar { font-size: 20px; margin: 0 0 10px; font-weight: 700; }
.hero-sub { margin: 0; opacity: .9; font-size: 14px; }

/* ---------- home hero (landing) ---------- */
.home-hero {
  position: relative; z-index: 2; color: #fff;
  padding: 40px 20px 92px;
  background:
    radial-gradient(135% 130% at 88% 0%, rgba(0,0,0,.25), transparent 55%),
    linear-gradient(118deg, #124d37 0%, #2a6a4d 52%, #3c805f 100%);
}
/* compact variant — used on results & policy pages */
.home-hero.compact { padding: 32px 20px 74px; }
.hero-search-block { max-width: 760px; margin: 0 auto; text-align: center; }
.hero-search-title { color: #fff; font-size: clamp(20px, 3vw, 28px); font-weight: 800; margin: 0 0 16px; }
.home-hero.compact .home-search { max-width: 640px; margin: 0 auto; }

/* download formulary bar */
.download-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.download-label { font-weight: 600; }
.download-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.results-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.results-bar .download-bar { margin: 0; }
.results-bar .results-count { margin: 0; }
.home-hero-grid {
  max-width: 1080px; margin: 0 auto;
  display: grid; gap: 24px; align-items: center; grid-template-columns: 1fr;
}
.home-hero-main h1 { font-size: clamp(26px, 5vw, 40px); line-height: 1.18; margin: 0; font-weight: 800; }
.title-underline { display: block; width: 92px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.92); margin: 14px 0 18px; }
.home-hero-desc { font-size: 16px; line-height: 1.9; color: rgba(255,255,255,.92); max-width: 46ch; margin: 0 0 24px; }

.home-search { position: relative; max-width: 560px; }
.home-search .search-wrap { box-shadow: 0 18px 40px rgba(0,0,0,.30); }
.home-search .search-wrap button { background: #1c6446; }
.home-search .search-wrap button:active { background: #1a5c39; }

.home-hero-card {
  position: relative; border-radius: 18px; overflow: hidden; min-height: 232px;
  box-shadow: 0 22px 48px rgba(0,0,0,.32);
  display: flex; align-items: flex-end; justify-content: flex-start; padding: 22px;
  background: linear-gradient(140deg, #2a6a4d, #124d37);
}
.card-badge {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  background: #dceee4; color: #185c40; font-weight: 700; font-size: 13px;
  padding: 6px 14px; border-radius: 99px;
}
.card-welcome { text-align: left; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.card-welcome span { display: block; font-size: 15px; font-weight: 600; opacity: .95; }
.card-welcome strong { display: block; font-size: 23px; letter-spacing: 5px; margin-top: 6px; }

.hero-slant {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 88px;
  background: var(--bg); clip-path: polygon(0 100%, 100% 0, 100% 100%);
}

@media (min-width: 860px) {
  .home-hero { padding: 56px 28px 112px; }
  .home-hero-grid { grid-template-columns: 1.05fr .95fr; gap: 38px; }
  .home-hero-card { min-height: 262px; }
}

/* ---------- home lower section (stats + recent) ---------- */
.home-content { max-width: 1080px; margin: 0 auto; padding: 4px 20px 44px; position: relative; z-index: 1; }

.home-stats { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.hstat {
  background: linear-gradient(160deg, #2c6b4e, #1b5740);
  color: #fff; border-radius: 14px; padding: 20px 16px; text-align: center;
  box-shadow: 0 8px 22px rgba(18,77,55,.18);
}
.hstat .num { display: block; font-size: 30px; font-weight: 800; line-height: 1; }
.hstat .lbl { display: block; margin-top: 8px; font-size: 13.5px; color: rgba(255,255,255,.86); }

.recent { margin-top: 26px; }
.recent-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.recent-head h2 { font-size: 18px; margin: 0; }
.recent-all { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--brand-dark); }
.recent-list { display: grid; gap: 10px; }
.recent-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 15px; text-decoration: none; color: inherit; box-shadow: var(--shadow);
  transition: transform .12s, border-color .12s;
}
.recent-item:hover { border-color: var(--brand); transform: translateY(-1px); }
.ri-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ri-name { font-weight: 700; }
.ri-generic { color: var(--muted); font-size: 13px; }
.ri-dots { margin-left: auto; display: flex; gap: 5px; }

@media (min-width: 760px) {
  .home-stats { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- layout ---------- */
.container { max-width: 820px; margin: 0 auto; padding: 18px 16px 40px; }
.container.pull-up { margin-top: -34px; position: relative; z-index: 10; }

/* ---------- search ---------- */
.search-block { position: relative; }
.search-form { position: relative; }
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow-lg);
}
.search-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), var(--shadow-lg); }
.search-icon { color: var(--muted); flex: none; }
.search-wrap input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  font-size: 16px; padding: 10px 4px; color: var(--ink);
}
.search-wrap button {
  flex: none; border: 0; cursor: pointer;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 15px;
  padding: 11px 20px; border-radius: 999px;
}
.search-wrap button:active { background: var(--brand-dark); }

.suggestions {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  list-style: none; margin: 0; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  z-index: 20; max-height: 60vh; overflow: auto; color: var(--ink);
}
.suggestions li { display: flex; align-items: center; gap: 8px; padding: 11px 12px; border-radius: 9px; cursor: pointer; }
.suggestions li.active, .suggestions li:hover { background: var(--brand-soft); }
.s-name { font-weight: 700; color: var(--brand-dark); }
.s-generic { color: var(--muted); font-size: 13px; }
.s-badges { margin-left: auto; display: flex; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot-ham { background: var(--ham); }
.dot-haz { background: var(--haz); }
.dot-res { background: var(--res-yellow); }

/* ---------- landing ---------- */
.landing { text-align: center; padding: 28px 8px; }
.landing-lead { color: var(--muted); max-width: 54ch; margin: 0 auto 22px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px 22px; justify-content: center; color: var(--muted); font-size: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.badge svg { flex: none; }
.badge-ham { color: var(--ham); background: var(--ham-bg); border: 1px solid #fecaca; }
.badge-hazard { color: var(--haz); background: var(--haz-bg); border: 1px solid #fed7aa; }

/* ---------- results ---------- */
.results-count { color: var(--muted); font-size: 14px; margin: 18px 2px 10px; }
.result-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); transition: transform .12s, border-color .12s;
}
.result-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.result-name { font-weight: 700; font-size: 17px; }
.result-generic { color: var(--muted); font-size: 13.5px; }
.result-cat { color: var(--muted); font-size: 12.5px; }
.result-badges { margin-left: auto; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- detail ---------- */
.detail { margin-top: 18px; }
.detail-hero {
  border-radius: var(--radius); padding: 22px 22px 18px; color: #fff; margin-bottom: 14px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: var(--shadow-lg);
}
.detail.theme-ham  .detail-hero { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.detail.theme-haz  .detail-hero { background: linear-gradient(135deg, #fb923c, #ea580c); }
/* The yellow hero is the one that cannot take white text — it and everything
   floating on it are written in the dark yellow ink instead. */
.detail.theme-res  .detail-hero { background: linear-gradient(135deg, #fde047, var(--res-yellow)); color: var(--res-ink); }
.detail.theme-res  .hero-chip,
.detail.theme-res  .hero-fact { background: rgba(255,255,255,.42); border-color: rgba(66,32,6,.28); color: var(--res-ink); }
.detail.theme-both .detail-hero { background: linear-gradient(115deg, #dc2626 0%, #ef4444 40%, #fb923c 60%, #ea580c 100%); }

.detail-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-name { font-size: 26px; margin: 0; line-height: 1.15; }
.detail-generic { margin: 3px 0 0; opacity: .9; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.45);
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.hero-facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hero-fact {
  display: flex; flex-direction: column; gap: 1px;
  background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25);
  border-radius: 11px; padding: 8px 12px; font-weight: 600; font-size: 14px;
}
.hero-fact em { font-style: normal; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; opacity: .85; font-weight: 600; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.card h2 {
  font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--brand-dark); margin: 0 0 8px; padding-bottom: 8px;
  border-bottom: 2px solid var(--brand-soft);
}
.detail.theme-ham  .card h2 { color: #b91c1c; border-bottom-color: #fecaca; }
.detail.theme-haz  .card h2 { color: #c2410c; border-bottom-color: #fed7aa; }
.detail.theme-res  .card h2 { color: var(--res); border-bottom-color: #fef08a; }
.detail.theme-both .card h2 { color: #c2410c; border-bottom-color: #fed7aa; }
.card-body p { margin: 0 0 8px; }
.card-body p:last-child { margin-bottom: 0; }
.card-body ul { margin: 4px 0; padding-left: 20px; }
.card-body li { margin-bottom: 4px; }

.lexicomp-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--brand); color: #fff; text-decoration: none; font-weight: 600;
  padding: 12px 20px; border-radius: 999px; margin-top: 4px;
}
.detail.theme-ham  .lexicomp-btn { background: var(--ham); }
.detail.theme-haz  .lexicomp-btn { background: var(--haz); }
.detail.theme-res  .lexicomp-btn { background: var(--res); }
.detail.theme-both .lexicomp-btn { background: linear-gradient(120deg, #dc2626, #ea580c); }
.lexicomp-btn:active { opacity: .9; }

/* ---------- footer ---------- */
.site-footer { text-align: center; padding: 28px 16px 40px; color: var(--muted); font-size: 13px; }
.footer-logo { width: 46px; height: 46px; object-fit: contain; opacity: .85; margin-bottom: 6px; }
.site-footer p { margin: 2px 0; }

/* ---------- admin stats ---------- */
.stats {
  display: grid; gap: 12px; margin-bottom: 20px;
  grid-template-columns: repeat(2, 1fr);
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 13px;
}
.stat-ico {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; color: #fff;
}
.stat-ico.teal { background: var(--brand); }
.stat-ico.red  { background: var(--ham); }
.stat-ico.orange { background: var(--haz); }
.stat-ico.slate { background: #475569; }
.stat-num { font-size: 24px; font-weight: 800; line-height: 1; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* ---------- admin ---------- */
.admin-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.admin-bar h1 { font-size: 22px; margin: 0; }
.btn {
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 10px; text-decoration: none;
}
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:active { background: var(--brand-dark); }
.btn-danger { color: var(--ham); border-color: #fecaca; background: var(--ham-bg); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

.admin-table { display: flex; flex-direction: column; gap: 10px; }
.admin-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; box-shadow: var(--shadow);
}
.admin-row .name { font-weight: 700; }
.admin-row .meta { color: var(--muted); font-size: 13px; }
.admin-row .grow { flex: 1; min-width: 0; }
.admin-row .badges { display: flex; gap: 5px; margin-right: 4px; }

/* forms */
.form-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); max-width: 720px; margin: 0 auto; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.field input[type=text], .field input[type=url], .field input[type=password], .field textarea, .field select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; font-family: inherit; color: var(--ink); background: #fff;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.checks { display: flex; flex-wrap: wrap; gap: 18px; }
.check { display: flex; align-items: center; gap: 9px; font-weight: 600; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: 1fr; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: var(--ham-bg); color: #991b1b; border: 1px solid #fecaca; }
.alert-ok { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #99f6e4; }

/* login */
.login-wrap { max-width: 380px; margin: 8vh auto 0; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-lg); }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 18px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; }

/* ---------- section / policy pages ---------- */
.section-page { padding-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.section-head h1 { font-size: 24px; margin: 0; }
.print-btn {
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  background: #1c6446; color: #fff; border: 0; border-radius: 999px;
  padding: 12px 24px; font-weight: 700; font-size: 14.5px; font-family: inherit;
  box-shadow: 0 10px 22px rgba(18,77,55,.30);
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.print-btn:hover { background: #15543c; transform: translateY(-1px); box-shadow: 0 14px 28px rgba(18,77,55,.36); }
.print-btn:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(18,77,55,.30); }

.section-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-excel {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  background: #fff; color: #15803d; border: 1.5px solid #bbf7d0; border-radius: 999px;
  padding: 11px 20px; font-weight: 700; font-size: 14.5px; font-family: inherit;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn-excel:hover { background: #f0fdf4; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(21,128,61,.18); }
.btn-excel:active { transform: translateY(0); }

.table-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.table-search {
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 220px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 14px;
}
.table-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.table-search svg { color: var(--muted); flex: none; }
.table-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 8px 4px; color: var(--ink); }
.row-count { color: var(--muted); font-size: 13px; white-space: nowrap; }

.section-table th.sortable { cursor: pointer; user-select: none; }
.section-table th.sortable::after { content: " ⇅"; opacity: .45; font-size: 11px; }
.section-table th.sort-asc::after { content: " ↑"; opacity: 1; }
.section-table th.sort-desc::after { content: " ↓"; opacity: 1; }

.section-intro { margin-bottom: 16px; }
.section-intro p { margin: 0 0 10px; }
.section-intro p:last-child { margin-bottom: 0; }
.section-intro ul { margin: 6px 0; padding-left: 20px; }
.section-intro li { margin-bottom: 4px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.section-table thead th {
  text-align: left; background: #1a5c39; color: #fff;
  padding: 12px 14px; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.section-table tbody td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.section-table tbody tr:nth-child(even) { background: #f8fafc; }
.section-table tbody td:first-child { font-weight: 600; }
.section-foot { margin-top: 14px; }

.print-only { display: none; }

/* ---------- responsive ---------- */
@media (min-width: 620px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .hero h1 { font-size: 28px; }
  .hero-ar { font-size: 23px; }
}

/* ---------- print (Save as PDF) ---------- */
@media print {
  .no-print, .site-header, .site-footer, .print-btn { display: none !important; }
  .print-only { display: block !important; }
  body { background: #fff !important; }
  body::before { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .card, .table-wrap { box-shadow: none; border: 1px solid #cbd5e1; }
  .print-head { margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid #124d37; }
  .print-head strong { display: block; font-size: 16px; color: #124d37; }
  .print-head span { font-size: 12px; color: #333; }
  .print-title { font-size: 19px; margin: 12px 0; }
  .section-table thead th { background: #e5e7eb !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .section-table, .section-table td, .section-intro, .section-intro * { color: #000 !important; }
  .section-table tbody tr { page-break-inside: avoid; }
}

/* ══════════════════════════════════════════════════════════════════
   The admin side — search filters, tables, forms — in the same
   language as the public pages above: white cards on the page tint,
   the brand green for anything actionable, hairline rules.
   ══════════════════════════════════════════════════════════════════ */

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 16px 60px; position: relative; z-index: 1; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start;
    gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; margin: 4px 0 2px; }
.back { font-size: 13px; font-weight: 600; text-decoration: none; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.small { font-size: 13px; }

/* Buttons — the pill shape the public pages use. */
.btn { display: inline-block; padding: 9px 18px; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--brand-dark); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit; text-decoration: none; }
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-light:hover { background: var(--brand-soft); }
.btn-danger { color: var(--ham); border-color: #f3c9c9; }
.btn-danger:hover { background: var(--ham); border-color: var(--ham); color: #fff; }
.btn-sm { padding: 5px 13px; font-size: 12.5px; }

/* Cards reuse the public .card, but admin pages give them a heading row. */
.card > h3 { font-size: 15px; margin: 0 0 12px; color: var(--brand-dark); }
.card > h3 + .muted.small { margin-top: -8px; }

/* Filters and forms */
.filters { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(11rem,100%),1fr)); align-items: end; }
.filters label, .grid-form label { display: block; font-size: 12.5px; font-weight: 700; color: var(--brand-dark); }
.filters input, .filters select,
.grid-form input, .grid-form select, .grid-form textarea {
    width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line);
    border-radius: 10px; font-family: inherit; font-size: 14px; background: #fff; color: var(--ink); }
.grid-form input:focus, .grid-form select:focus, .grid-form textarea:focus,
.filters input:focus, .filters select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.grid-form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(16rem,100%),1fr)); }
.grid-form textarea { min-height: 90px; resize: vertical; }
.grid-form .wide { grid-column: 1 / -1; }
.req { color: var(--ham); }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 13.5px; color: var(--ink); }
.check input { width: auto; margin: 0; }

/* Quick filter chips, under the search card. */
.quick-periods { display: flex; flex-wrap: wrap; gap: 7px; align-items: center;
    margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.chip { display: inline-block; padding: 5px 14px; border-radius: 999px; border: 1px solid var(--line);
    font-size: 13px; font-weight: 600; color: var(--brand-dark); background: var(--surface); text-decoration: none; }
.chip:hover { border-color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }

/* Tables */
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow); font-size: 13.5px; }
.data-table th { background: var(--brand-dark); color: #fff; text-align: left; padding: 10px 12px;
    font-size: 11px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table .num { text-align: right; }
.data-table tfoot th { background: var(--brand-soft); color: var(--brand-dark);
    text-transform: none; font-size: 13px; letter-spacing: 0; }

/* Badges — the safety palette the drug pages already use. */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge-warn { background: var(--haz-bg); color: var(--haz); }
.badge-restricted { background: var(--res-bg); color: var(--res); }
.badge-danger { background: var(--ham-bg); color: var(--ham); }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-unknown { background: #eef2f6; color: var(--muted); }
/* A plain list value — a route, say. Deliberately colourless: colour on a
   badge in this system means "this changes how the drug is handled". */
.badge-plain { background: #eef2f6; color: var(--ink); border: 1px solid var(--line); }

/* Stat tiles — the green blocks from the home page, reused. */
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(13rem,100%),1fr)); margin-bottom: 20px; }
.stat-card { background: linear-gradient(160deg, var(--brand) 0, var(--brand-dark) 100%);
    color: #fff; border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat-card .stat-num { font-size: 30px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: #fff; }
.stat-card .stat-label { font-size: 13px; margin-top: 6px; opacity: .92; color: #fff; }
.stat-card .stat-sub { font-size: 11.5px; margin-top: 4px; opacity: .8; color: #fff; }
.stat-card.warn { background: linear-gradient(160deg, #f59e0b 0, var(--haz) 100%); }
.stat-card.restricted { background: linear-gradient(160deg, #fde047 0, var(--res-yellow) 100%); }
.stat-card.restricted .stat-num,
.stat-card.restricted .stat-label,
.stat-card.restricted .stat-sub { color: var(--res-ink); }
.stat-card.danger { background: linear-gradient(160deg, #ef4444 0, var(--ham) 100%); }

/* Record view */
.record-grid { display: grid; gap: 14px 24px; grid-template-columns: repeat(auto-fit, minmax(min(15rem,100%),1fr)); }
.record-grid .item .k { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted); font-weight: 700; }
.record-grid .item .v { margin-top: 3px; }
.record-grid .wide { grid-column: 1 / -1; }

.flash { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.flash.success { background: var(--brand-soft); color: var(--brand-dark); }
.flash.error { background: var(--ham-bg); color: var(--ham); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13.5px; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item i { width: 11px; height: 11px; border-radius: 3px; flex: none; }

.login-wrap { max-width: 26rem; margin: 8vh auto; text-align: center; padding: 0 16px; position: relative; z-index: 1; }
.login-wrap .logo { height: 62px; margin-bottom: 14px; }
.login-wrap h1 { font-size: 24px; margin-bottom: 4px; }

/* Landing extras the sample's markup does not cover. */
.hero-card-body { padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.hero-card-body strong { font-size: 19px; }
.hero-card-body span { font-size: 14px; opacity: .85; }
.section-title { font-size: 17px; margin: 26px 0 12px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-start: 5px; }
.dot-ham { background: var(--ham); }
.dot-haz { background: var(--haz); }
