/* ============================================================
   BHCPIMS - Barangay Health Information Management System
   Single stylesheet: landing, auth, app shell, components
   ============================================================ */

:root {
  --teal-50:  #effcf7;
  --teal-100: #d3f6e8;
  --teal-500: #0d9488;
  --teal-600: #0b7f75;
  --teal-700: #0a655e;
  --teal-900: #10302f;

  --ink:      #0f172a;
  --ink-2:    #334155;
  --muted:    #64748b;
  --line:     #e2e8f0;
  --bg:       #f1f5f9;
  --card:     #ffffff;

  --green:    #15803d;  --green-bg: #dcfce7;
  --amber:    #b45309;  --amber-bg: #fef3c7;
  --red:      #b91c1c;  --red-bg:   #fee2e2;
  --blue:     #1d4ed8;  --blue-bg:  #dbeafe;

  --radius:   14px;
  --shadow:   0 1px 2px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.05);
  --sidebar-w: 262px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--teal-600); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

.ico { width: 19px; height: 19px; flex: none; }
.ico.sm { width: 16px; height: 16px; }
.ico.lg { width: 30px; height: 30px; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: "Consolas", "SF Mono", monospace; font-size: .86em; letter-spacing: .02em; }

/* ============================================================
   BRAND MARK
   ============================================================ */
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 12px;
  background: linear-gradient(140deg, var(--teal-500), var(--teal-700));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 800; font-size: 19px;
  flex: none;
  box-shadow: 0 4px 12px rgba(13,148,136,.35);
}

/* ============================================================
   LANDING PAGE (index.php)
   ============================================================ */
.land-nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 14px 34px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.land-nav .brand { display: flex; align-items: center; gap: 12px; }
.land-nav .brand strong { display: block; font-size: 16px; line-height: 1.2; }
.land-nav .brand span { display: block; font-size: 11.5px; color: var(--muted); }
.land-links { display: flex; align-items: center; gap: 24px; }
.land-links a { color: var(--ink-2); font-weight: 550; font-size: 14px; }
.land-links a:hover { color: var(--teal-600); text-decoration: none; }

.hero {
  background:
    radial-gradient(900px 420px at 88% -12%, var(--teal-100), transparent 62%),
    radial-gradient(700px 360px at 6% 8%, #e0f2fe, transparent 60%),
    #fff;
  padding: 84px 34px 78px;
}
.hero-inner {
  max-width: 1140px; margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 60px; align-items: center;
}
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--teal-50); color: var(--teal-700);
  border: 1px solid var(--teal-100);
  padding: 6px 14px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
}
.hero h1 {
  font-size: 43px; line-height: 1.13;
  margin: 20px 0 16px; letter-spacing: -.025em;
}
.hero h1 em { font-style: normal; color: var(--teal-600); }
.hero p.lead { font-size: 16.5px; color: var(--ink-2); max-width: 520px; margin: 0 0 28px; }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.hero-stats {
  display: flex; gap: 34px; margin-top: 44px;
  padding-top: 26px; border-top: 1px solid var(--line);
}
.hero-stats div strong { display: block; font-size: 25px; color: var(--teal-700); }
.hero-stats div span { font-size: 12.5px; color: var(--muted); }

.hero-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; padding: 22px;
  box-shadow: 0 24px 60px rgba(15,23,42,.10);
}
.hero-card h4 { font-size: 14px; margin-bottom: 4px; }
.hero-card .sub { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.mini-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line);
}
.mini-dot {
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; flex: none;
  background: var(--teal-50); color: var(--teal-600);
}
.mini-row .t { flex: 1; min-width: 0; }
.mini-row .t strong { display: block; font-size: 13.5px; font-weight: 600; }
.mini-row .t span { font-size: 12px; color: var(--muted); }

.section { padding: 76px 34px; }
.section.alt { background: #fff; border-block: 1px solid var(--line); }
.section-head { max-width: 700px; margin: 0 auto 46px; text-align: center; }
.section-head h2 { font-size: 30px; margin-bottom: 12px; letter-spacing: -.02em; }
.section-head p { color: var(--muted); font-size: 15.5px; margin: 0; }

.feature-grid {
  max-width: 1140px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px;
}
.feature {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 26px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--teal-100); }
.feature .fi {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--teal-50); color: var(--teal-600);
  display: grid; place-items: center; margin-bottom: 16px;
}
.feature h3 { font-size: 16px; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: 14px; margin: 0; }

.flow {
  max-width: 1000px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
.flow-step {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 24px 20px; position: relative;
}
.flow-step .n {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--teal-600); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; margin-bottom: 14px;
}
.flow-step h4 { font-size: 15px; margin-bottom: 6px; }
.flow-step p { font-size: 13.2px; color: var(--muted); margin: 0; }

.cta-band {
  max-width: 1000px; margin: 0 auto; text-align: center;
  background: linear-gradient(140deg, var(--teal-600), var(--teal-900));
  color: #fff; border-radius: 22px; padding: 54px 34px;
}
.cta-band h2 { font-size: 28px; margin-bottom: 12px; }
.cta-band p { opacity: .85; max-width: 520px; margin: 0 auto 26px; }

.land-foot {
  background: #fff; border-top: 1px solid var(--line);
  padding: 26px 34px; text-align: center;
  color: var(--muted); font-size: 13px;
}

/* ============================================================
   AUTH (login.php)
   ============================================================ */
.auth-body {
  min-height: 100vh;
  background:
    radial-gradient(760px 460px at 84% 10%, rgba(13,148,136,.16), transparent 62%),
    radial-gradient(640px 420px at 8% 88%, rgba(56,189,248,.14), transparent 60%),
    var(--teal-900);
  display: grid; place-items: center;
  padding: 34px 20px;
}
.auth-shell {
  width: 100%; max-width: 1080px;
  display: grid; grid-template-columns: 1.12fr 1fr;
  gap: 44px; align-items: center;
}
.auth-intro { color: #fff; }
.auth-intro .brand-mark { width: 52px; height: 52px; font-size: 24px; margin-bottom: 22px; }

/* Seal on the left, system name on the right, sharing one row. The seal is
   sized against the wrapped title so the two blocks finish at a similar
   height; changing one usually means nudging the other. */
.auth-head {
  display: flex; align-items: center; gap: 20px;
  margin-bottom: 24px;
}
.auth-head h2 {
  margin: 0;
  font-size: 31px; line-height: 1.2;
}

/* Official barangay seal. The PNG is already a circle with transparent
   corners, so it sits cleanly on the dark panel without a white box. */
.auth-seal {
  display: block;
  width: 152px; height: 152px;
  flex: none;
  border-radius: 50%;
  background: rgba(255,255,255,.96);
  padding: 5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.auth-seal-sm {
  width: 96px; height: 96px; flex: none;
  border-radius: 50%;
  background: #fff;
  padding: 3px;
  box-shadow: 0 4px 14px rgba(15,23,42,.16);
}
.auth-intro h2 { font-size: 32px; line-height: 1.2; margin-bottom: 14px; }
.auth-intro p { color: rgba(255,255,255,.72); font-size: 15px; max-width: 400px; }
.auth-intro ul { list-style: none; padding: 0; margin: 26px 0 0; }
.auth-intro li {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; color: rgba(255,255,255,.86); font-size: 14px;
}
.auth-intro li svg { color: #5eead4; }

.auth-card {
  background: var(--card);
  border-radius: 20px; padding: 32px;
  box-shadow: 0 30px 70px rgba(0,0,0,.32);
}
/* Card header: seal centred above the title, not beside it. */
.auth-brand {
  display: flex; flex-direction: column;
  align-items: center; text-align: center;
  gap: 12px; margin-bottom: 24px;
}
.auth-brand h1 { font-size: 21px; }
.auth-brand p { margin: 2px 0 0; font-size: 12.8px; color: var(--muted); }

.tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); padding: 4px; border-radius: 11px; margin-bottom: 22px;
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  padding: 9px; border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 13.5px; color: var(--muted);
  transition: all .15s ease;
}
.tab.is-active { background: var(--card); color: var(--teal-700); box-shadow: 0 1px 3px rgba(15,23,42,.1); }

.install-log { list-style: none; padding: 0; margin: 0 0 18px; }
.install-log li {
  padding: 9px 12px; border-radius: 9px; margin-bottom: 7px; font-size: 13.5px;
}
.install-log li.ok  { background: var(--green-bg); color: var(--green); }
.install-log li.bad { background: var(--red-bg);   color: var(--red); }

.hint-box {
  margin-top: 18px; padding: 12px 14px;
  background: var(--teal-50); border: 1px solid var(--teal-100);
  border-radius: 10px; font-size: 12.8px; color: var(--teal-700);
}

/* ============================================================
   APP SHELL
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex: none;
  background: var(--teal-900);
  display: flex; flex-direction: column;
  position: fixed; inset: 0 auto 0 0; z-index: 50;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand-text strong { display: block; color: #fff; font-size: 15.5px; }
.brand-text span { display: block; color: rgba(255,255,255,.5); font-size: 11px; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.nav-group {
  margin: 16px 10px 7px; font-size: 10.5px;
  text-transform: uppercase; letter-spacing: .09em;
  color: rgba(255,255,255,.38); font-weight: 700;
}
.nav-group:first-child { margin-top: 0; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.74); font-size: 14px; font-weight: 500;
  margin-bottom: 2px; transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.is-active {
  background: var(--teal-600); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px rgba(13,148,136,.35);
}
.nav-link.logout:hover { background: rgba(239,68,68,.18); color: #fecaca; }

/* Count pill on a sidebar item, e.g. registrations awaiting verification. */
.nav-count {
  margin-left: auto;
  min-width: 20px; padding: 1px 6px;
  border-radius: 999px;
  background: #f59e0b; color: #422006;
  font-size: 11px; font-weight: 800; text-align: center;
}

.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.09); }
.side-user { display: flex; align-items: center; gap: 11px; padding: 8px 12px 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  background: var(--teal-600); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.side-user-text { min-width: 0; }
.side-user-text strong {
  display: block; color: #fff; font-size: 13.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-user-text span { font-size: 11.5px; color: rgba(255,255,255,.5); }

.sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,.5); z-index: 45;
}
.sidebar-backdrop.show { display: block; }

.main {
  flex: 1; min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex; flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 20px; }
.topbar-title p { margin: 1px 0 0; font-size: 12.8px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.today {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--muted);
  background: var(--bg); padding: 7px 12px; border-radius: 9px;
}

.content { flex: 1; padding: 24px 28px 34px; }

.footer {
  display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 28px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; background: #fff;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 17px; border-radius: 10px;
  border: 1px solid transparent; cursor: pointer;
  font: inherit; font-size: 13.8px; font-weight: 600;
  transition: all .15s ease; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--teal-600); color: #fff; }
.btn-primary:hover { background: var(--teal-700); }
.btn-light { background: #fff; color: var(--ink-2); border-color: var(--line); }
.btn-light:hover { background: var(--bg); border-color: #cbd5e1; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-white { background: #fff; color: var(--teal-700); }
.btn-white:hover { background: #f0fdfa; }
.btn-outline-white { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-outline-white:hover { background: rgba(255,255,255,.12); }
.btn-sm { padding: 6px 12px; font-size: 12.8px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff;
  display: grid; place-items: center; cursor: pointer; color: var(--ink-2);
}
.icon-btn:hover { background: var(--bg); }

.act {
  display: inline-grid; place-items: center;
  width: 31px; height: 31px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  cursor: pointer;
}
.act:hover { background: var(--bg); color: var(--teal-600); text-decoration: none; }
.act.danger:hover { background: var(--red-bg); color: var(--red); border-color: #fecaca; }
.act-group { display: flex; gap: 6px; }

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 20px; overflow: hidden;
  /* Without this, a card sitting in a grid (like .grid-main) refuses to
     shrink below its widest child's natural width - a wide, non-wrapping
     table inside it then forces the whole grid, and the page, to scroll
     sideways instead of just the table scrolling within its own card. */
  min-width: 0;
}
.card-head {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 15.5px; flex: 1; min-width: 140px; }
.card-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-main { grid-template-columns: 2fr 1fr; }
/* The dashboard's two columns are plain <div>s, not .card itself - they
   are the actual grid items, so THEY are what needs min-width:0 to let a
   wide table scroll inside its own card instead of forcing the whole
   column (and the page) wider than the viewport. */
.grid-main > * { min-width: 0; }

/* ============================================================
   RBI HOUSEHOLD SHEET
   Laid out to read like the paper form it replaces.
   ============================================================ */
.rbi-title {
  text-align: center; font-size: 15px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 20px;
}
.rbi-head {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 12px 22px; font-size: 13.4px;
}
.rbi-head span { color: var(--ink-2); font-weight: 700; }
.rbi-head b { font-weight: 500; color: var(--ink); }

/* Two header rows on the members table, so group the spans clearly. */
table.rbi-members th { vertical-align: middle; text-align: center; }
table.rbi-members td { font-size: 13px; }

.rbi-sign {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px;
  padding: 14px 0 4px; text-align: center;
}
.rbi-sign .cap { font-size: 12.5px; color: var(--muted); }
.rbi-sign .line {
  border-top: 1px solid var(--ink-2);
  margin-top: 34px; padding-top: 7px; font-size: 14px;
}
.rbi-sign .role { font-size: 12px; color: var(--muted); }

@media (max-width: 860px) {
  .rbi-head { grid-template-columns: repeat(2, 1fr); }
  .rbi-sign { grid-template-columns: 1fr; gap: 26px; }
}

/* ============================================================
   NOTIFICATIONS - bell, dropdown panel and the full list
   ============================================================ */
.bell-wrap { position: relative; }
.bell-btn { position: relative; }
.bell-count {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--red); color: #fff;
  font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center;
  border: 2px solid #fff;
}
.bell-count.is-zero { display: none; }

.bell-panel {
  position: absolute; z-index: 60; top: calc(100% + 8px); right: 0;
  width: 370px; max-width: calc(100vw - 32px);
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  box-shadow: 0 16px 40px rgba(15,23,42,.18);
  overflow: hidden;
}
.bell-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 14px;
}
.bell-list { max-height: 380px; overflow-y: auto; }
.bell-empty { padding: 26px 18px; margin: 0; text-align: center; font-size: 13px; color: var(--muted); }

.bell-item {
  display: flex; gap: 11px; padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9; color: inherit;
}
.bell-item:last-child { border-bottom: 0; }
.bell-item:hover { background: #fafcfe; text-decoration: none; }
.bell-item.is-unread { background: var(--teal-50); }
.bell-item.is-unread:hover { background: #dcf5f0; }

.bell-ico, .notif-ico {
  width: 32px; height: 32px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
}
.bell-t { min-width: 0; }
.bell-t strong { display: block; font-size: 13.2px; font-weight: 600; line-height: 1.35; }
.bell-t span   { display: block; font-size: 12px; color: var(--ink-2);
                 overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bell-t small  { font-size: 11.2px; color: var(--muted); }

.bell-foot {
  display: block; padding: 11px; text-align: center;
  background: #f8fafc; border-top: 1px solid var(--line);
  font-size: 13px; font-weight: 600;
}

/* Full list page */
.notif-day {
  margin: 18px 20px 8px; font-size: 11.4px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted);
}
.notif {
  position: relative;
  display: flex; align-items: center; gap: 13px;
  padding: 13px 20px; border-bottom: 1px solid #f1f5f9;
}
.notif:last-child { border-bottom: 0; }
.notif.is-unread { background: var(--teal-50); }
.notif.is-clickable { cursor: pointer; }
.notif.is-clickable:hover { background: #fafcfe; }
.notif.is-unread.is-clickable:hover { background: #dcf5f0; }
/* Makes the whole row open the linked record, not just the title text -
   sits above everything so any part of the row is clickable, while the
   "Mark read" button (given its own stacking context below) still works. */
.notif-hit { position: absolute; inset: 0; z-index: 1; }
.notif-ico { width: 38px; height: 38px; border-radius: 11px; }
.notif-t { flex: 1; min-width: 0; }
.notif-t strong { display: block; font-size: 14px; font-weight: 600; }
.notif-t span  { display: block; font-size: 12.8px; color: var(--ink-2); }
.notif-t small { font-size: 11.6px; color: var(--muted); }
.notif-mark { position: relative; z-index: 2; }
.notif-go { color: var(--muted); display: flex; }
.notif-chev { transform: rotate(180deg); }
.notif.is-clickable:hover .notif-go { color: var(--teal-600); }

@media (max-width: 560px) {
  .bell-panel { width: calc(100vw - 32px); right: -8px; }
}

/* ============================================================
   FAMILY & RELATIONSHIPS
   ============================================================ */
.family-groups {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px;
}
.family-group-title {
  margin: 0 0 8px; font-size: 11.6px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em; color: var(--teal-700);
  padding-bottom: 6px; border-bottom: 1px solid var(--teal-100);
}
.family-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid #f1f5f9;
}
.family-row:last-child { border-bottom: 0; }
.family-av {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--teal-50); color: var(--teal-700);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700;
}
.family-t { flex: 1; min-width: 0; }
.family-t strong { display: block; font-size: 13.5px; font-weight: 600; }
.family-t span { font-size: 11.6px; color: var(--muted); }
.family-t a { color: inherit; }
.family-t a:hover strong { color: var(--teal-600); }

/* ============================================================
   QUICK ACTIONS BAR
   The jobs staff do all day, sitting at the top of the dashboard
   where they are found without hunting.
   ============================================================ */
.quick-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.quick-action {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.quick-action:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: var(--teal-100);
  box-shadow: 0 8px 20px rgba(15,23,42,.10);
}
.quick-action .qa-ico {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--teal-50); color: var(--teal-600);
}
.quick-action .qa-text { min-width: 0; }
.quick-action .qa-text strong {
  display: block; font-size: 14px; font-weight: 650; line-height: 1.3;
}
.quick-action .qa-text span { font-size: 11.8px; color: var(--muted); }

@media (max-width: 480px) {
  .quick-bar { grid-template-columns: 1fr; }
}

/* ============================================================
   STAT TILES
   ============================================================ */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 15px;
}
.stat-ico {
  width: 46px; height: 46px; border-radius: 13px; flex: none;
  display: grid; place-items: center;
  background: var(--teal-50); color: var(--teal-600);
}
.stat-ico.g { background: var(--green-bg); color: var(--green); }
.stat-ico.a { background: var(--amber-bg); color: var(--amber); }
.stat-ico.b { background: var(--blue-bg);  color: var(--blue); }
.stat-val { font-size: 25px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.stat-lab { font-size: 12.5px; color: var(--muted); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.7px; }
table.tbl th {
  text-align: left; padding: 11px 16px;
  background: #f8fafc; border-bottom: 1px solid var(--line);
  font-size: 11.3px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; white-space: nowrap;
}
table.tbl td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: #fafcfe; }
table.tbl td.name strong { display: block; font-weight: 600; }
table.tbl td.name span { font-size: 12px; color: var(--muted); }

.empty { padding: 54px 20px; text-align: center; }
.empty-icon {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--bg); color: var(--muted); display: grid; place-items: center;
}
.empty p { margin: 0 0 4px; font-weight: 600; color: var(--ink-2); }
.empty span { font-size: 13px; color: var(--muted); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 11.6px; font-weight: 650; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-teal  { background: var(--teal-50);  color: var(--teal-700); }
.badge-gray  { background: #f1f5f9;         color: var(--muted); }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four  { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.6px; font-weight: 650; color: var(--ink-2); }
.field label .req { color: var(--red); }
.field small { font-size: 11.8px; color: var(--muted); }

.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: #fff; transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: 0; border-color: var(--teal-500);
  box-shadow: 0 0 0 3px rgba(13,148,136,.14);
}
.input:disabled, .select:disabled, .textarea:disabled,
.input[readonly] { background: var(--bg); color: var(--muted); }
.textarea { resize: vertical; min-height: 84px; }
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px;
}

.check { display: flex; align-items: center; gap: 9px; font-size: 13.6px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--teal-600); cursor: pointer; }

.fieldset-title {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 10px;
  margin: 8px 0 0; padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  font-size: 12.4px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; color: var(--teal-700);
}

.form-actions {
  display: flex; justify-content: flex-end; gap: 10px;
  padding-top: 18px; margin-top: 20px; border-top: 1px solid var(--line);
}

/* toolbar above tables */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line); background: #fcfdfe;
}
.toolbar .search-box { position: relative; flex: 1; min-width: 210px; max-width: 380px; }
.toolbar .search-box svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.toolbar .search-box .input { padding-left: 35px; }
.toolbar .select { width: auto; min-width: 140px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 11px;
  margin-bottom: 18px; font-size: 13.8px; font-weight: 500;
  border: 1px solid transparent;
}
.alert span { flex: 1; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: #bbf7d0; }
.alert-error   { background: var(--red-bg);   color: var(--red);   border-color: #fecaca; }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: #fde68a; }
.alert-info    { background: var(--blue-bg);  color: var(--blue);  border-color: #bfdbfe; }
.alert-x {
  border: 0; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: inherit; opacity: .6; padding: 0 2px;
}
.alert-x:hover { opacity: 1; }

/* ============================================================
   MODAL
   ============================================================ */
.modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15,23,42,.55);
  display: none; padding: 24px; overflow-y: auto;
}
.modal.show { display: block; }
.modal-box {
  background: #fff; border-radius: 16px;
  max-width: 880px; margin: 28px auto;
  box-shadow: 0 30px 70px rgba(0,0,0,.3);
  animation: pop .18s ease;
}
.modal-box.sm { max-width: 480px; }
.modal-box.lg { max-width: 1180px; }

/* Grouped section inside a long form, like the boxes on the RBI form. */
.form-section { margin-bottom: 24px; }
.form-section > .form-grid { margin-top: 16px; }
.section-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; font-weight: 700; color: var(--teal-700);
  padding-bottom: 9px; border-bottom: 2px solid var(--teal-100);
}
.section-label .n {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--teal-600); color: #fff; font-size: 11.5px; flex: none;
}
.prefilled { background: #f8fafc; }
.modal-ico { color: var(--teal-600); }

/* Confirmation banner after picking someone from the RBI dropdown. */
.imported-chip {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 11px;
  background: var(--teal-50); border: 1px solid var(--teal-100);
  font-size: 13.5px; color: var(--teal-700);
}
.imported-chip .grow { flex: 1; min-width: 0; }
.imported-chip b { display: block; }
.imported-chip small { color: var(--muted); }
.form-note {
  display: flex; align-items: flex-start; gap: 8px;
  margin-top: 14px; font-size: 12.5px; color: var(--muted);
}
@keyframes pop { from { opacity: 0; transform: translateY(-12px); } }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { flex: 1; font-size: 16.5px; }
.modal-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); font-weight: 400; }
.modal-body { padding: 22px; }
.modal-x {
  border: 0; background: transparent; cursor: pointer;
  font-size: 26px; line-height: 1; color: var(--muted); padding: 0 4px;
}
.modal-x:hover { color: var(--ink); }

/* ============================================================
   DETAIL / PROFILE VIEWS
   ============================================================ */
.profile-head {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 22px; background: linear-gradient(130deg, var(--teal-600), var(--teal-900));
  color: #fff;
}
.profile-head .avatar-lg {
  width: 66px; height: 66px; border-radius: 18px; flex: none;
  background: rgba(255,255,255,.18); color: #fff;
  display: grid; place-items: center; font-size: 26px; font-weight: 700;
}
.profile-head h2 { font-size: 22px; }
.profile-head .meta {
  display: flex; gap: 16px; flex-wrap: wrap;
  margin-top: 6px; font-size: 13px; color: rgba(255,255,255,.8);
}
.profile-head .grow { flex: 1; min-width: 180px; }

.dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 22px; }
.dl.two { grid-template-columns: repeat(2, 1fr); }
.dl > div { min-width: 0; }
.dl dt {
  font-size: 11.2px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; margin-bottom: 3px;
}
.dl dd { margin: 0; font-size: 14px; color: var(--ink); word-wrap: break-word; }

.vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.vital {
  background: var(--bg); border-radius: 11px; padding: 12px 14px; text-align: center;
}
.vital strong { display: block; font-size: 17px; color: var(--teal-700); }
.vital span { font-size: 11.4px; color: var(--muted); }

.timeline { position: relative; padding-left: 26px; }
.timeline::before {
  content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--line);
}
.tl-item { position: relative; padding-bottom: 20px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: ""; position: absolute; left: -23px; top: 5px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--teal-500); border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--teal-100);
}
.tl-date { font-size: 11.6px; color: var(--muted); font-weight: 600; }
.tl-item h4 { font-size: 14.2px; margin: 2px 0 4px; }
.tl-item p { margin: 0; font-size: 13.2px; color: var(--ink-2); }

.note {
  background: var(--bg); border-left: 3px solid var(--teal-500);
  border-radius: 0 10px 10px 0; padding: 12px 16px;
  font-size: 13.6px; color: var(--ink-2); white-space: pre-wrap;
}

.check-row { display: flex; flex-wrap: wrap; gap: 10px 22px; }

/* ============================================================
   TARGET CLIENT LIST (National Immunization Program)
   A ruled grid that matches the DOH paper form, so a printout can
   sit next to the handwritten one column for column.
   ============================================================ */
.tcl-title { text-align: center; padding: 18px 16px 4px; }
.tcl-title h2 {
  font-size: 16px; letter-spacing: .08em; text-transform: uppercase;
}
.tcl-title p { margin: 5px 0 0; font-size: 12.4px; color: var(--muted); }
/* The method sub-heading on the Family Planning sheet, as on the paper form. */
.tcl-title p.fp-method {
  margin: 4px 0 2px; font-size: 13.5px; font-weight: 700;
  letter-spacing: .32em; color: var(--teal-700);
}

table.tcl { font-size: 11.8px; }
table.tcl th, table.tcl td {
  border: 1px solid #94a3b8;
  padding: 5px 4px;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
table.tcl thead th {
  background: var(--bg); color: var(--ink);
  font-size: 9.6px; font-weight: 700;
  line-height: 1.25; letter-spacing: .02em;
  text-transform: uppercase;
  padding: 6px 3px;
}
table.tcl td { height: 34px; }
table.tcl .tcl-n { width: 26px; color: var(--muted); }
table.tcl .tcl-name {
  text-align: left; white-space: normal;
  min-width: 190px; font-weight: 600;
}
table.tcl .tcl-remarks {
  text-align: left; white-space: normal; min-width: 110px;
  font-size: 11px; color: var(--ink-2);
}
table.tcl .tcl-tick { color: var(--teal-600); font-size: 13px; }

/* The twelve AGE IN MONTHS boxes are narrow numbers, not dates. */
table.tcl .ch-age { width: 30px; font-variant-numeric: tabular-nums; }
table.tcl .ch-age:empty { background: repeating-linear-gradient(
    135deg, transparent, transparent 5px, var(--bg) 5px, var(--bg) 6px); }

/* The small "(Y or N)" / "INDIGENT" lines under a heading on the NCD sheet. */
table.tcl thead th .th-sub,
table.tcl thead th.th-sub { font-size: 8.4px; font-weight: 600; color: var(--muted); }

/* A trimester cell holds several visit dates, stacked like the paper form. */
table.tcl .mc-visits { white-space: normal; min-width: 76px; line-height: 1.45; }
table.tcl .mc-visits span { display: block; }

/* Setting a condition's classification, inline in its row. */
.inline-set { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.inline-set .select { min-width: 170px; padding-block: 6px; font-size: 13px; }

/* The older-persons sheet carries two free-text columns. */
table.tcl.eld { font-size: 12.6px; }
table.tcl.eld td { height: 36px; }
table.tcl.eld .tcl-name { min-width: 230px; }
table.tcl.eld .eld-text {
  text-align: left; white-space: normal; min-width: 170px; color: var(--ink-2);
}

/* The WRA masterlist has only five columns, so it can breathe. */
table.tcl.wra { font-size: 13px; }
table.tcl.wra thead th { font-size: 11px; }
table.tcl.wra td { height: 38px; }
table.tcl.wra .tcl-name { min-width: 260px; }
table.tcl.wra .wra-remarks {
  text-align: left; white-space: normal; min-width: 260px; color: var(--ink-2);
}
table.tcl tbody tr:hover td { background: var(--teal-50); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.only-mobile { display: none; }

@media (max-width: 1100px) {
  .hero-inner { grid-template-columns: 1fr; gap: 44px; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .flow { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-main { grid-template-columns: 1fr; }
  .dl { grid-template-columns: repeat(2, 1fr); }
}

/* Between the two-column and one-column layouts the intro panel is at its
   narrowest, so the seal comes down a size rather than squeezing the title. */
@media (max-width: 1100px) {
  .auth-head { gap: 16px; }
  .auth-head h2 { font-size: 26px; }
  .auth-seal { width: 122px; height: 122px; }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; max-width: 440px; }
  .auth-intro { display: none; }
  .land-links a.hide-sm { display: none; }
  .form-grid, .form-grid.three, .form-grid.four { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .vitals { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 780px) {
  .only-mobile { display: grid; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  /* The title (and its often-long subtitle) and the page's action button(s)
     used to share one row, so on a narrow phone the button's fixed width
     left almost nothing for the title, forcing it to wrap into a tall,
     cramped column that visually ran under the button. Wrapping the
     actions onto their own row fixes that without touching any page.
     A solid teal bar (instead of the desktop's white/blurred one) also
     matches the native app and the installed PWA's own colours, so the
     website doesn't look like a different, unrelated thing from inside
     the wrapped app. */
  .topbar {
    padding: 12px 16px; flex-wrap: wrap; row-gap: 10px;
    background: var(--teal-700); border-bottom: 0; backdrop-filter: none;
  }
  .topbar-title h1, .topbar-title p { color: #fff; }
  .topbar-title p { opacity: .82; }
  .topbar .icon-btn.only-mobile {
    background: rgba(255,255,255,.14); border: 0; color: #fff;
  }
  .topbar .icon-btn.only-mobile:hover { background: rgba(255,255,255,.22); }
  .topbar-actions { flex-basis: 100%; justify-content: flex-end; }
  .topbar-actions .btn-primary { background: #fff; color: var(--teal-700); }
  .topbar-actions .btn-primary:hover { background: #f0fdfa; }
  /* Alerts already has its own tab in the bottom bar, so the bell here
     would just be a second, redundant way to reach the same screen. */
  .bell-wrap { display: none; }
  .content { padding: 18px 16px 28px; }
  .today { display: none; }
  .hero { padding: 54px 20px; }
  .hero h1 { font-size: 32px; }
  .section { padding: 54px 20px; }
  .feature-grid, .flow, .grid-4 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .land-nav { padding: 12px 18px; }

  /* Every .tbl data table (Patients, Consultations, RBI, Medical Records,
     Users, etc.) becomes a stack of labelled cards instead of a cramped,
     horizontally-scrolling grid - app.js stamps each cell with its column's
     header text as data-label, which the ::before rule below prints. The
     wide clinical forms (table.tcl - Target Client Lists) are deliberately
     left alone; those are genuinely tabular and meant to scroll sideways. */
  .table-wrap { overflow-x: visible; }
  table.tbl thead { display: none; }
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl tr {
    margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow); background: var(--card);
  }
  table.tbl tr:last-child { margin-bottom: 0; }
  table.tbl td {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 14px; border-bottom: 1px solid #f1f5f9; white-space: normal; text-align: right;
  }
  table.tbl td:last-child { border-bottom: 0; }
  table.tbl td::before {
    content: attr(data-label); flex: none; text-align: left;
    font-size: 11.3px; font-weight: 700; text-transform: uppercase;
    letter-spacing: .05em; color: var(--muted);
  }
  /* The row's first cell (always the name/title column in these tables) reads
     as the card's own heading instead of another label:value line. */
  table.tbl td:first-child {
    display: block; text-align: left; background: #f8fafc;
    font-size: 14.5px; font-weight: 700;
  }
  table.tbl td:first-child::before { content: none; }
  table.tbl td.text-right { justify-content: flex-end; }

  /* ---------- Bottom tab bar ---------- */
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; background: #fff; border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(15,23,42,.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .bn-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 9px 4px 8px; border: 0; background: none; color: var(--muted);
    font-size: 10.8px; font-weight: 650;
  }
  .bn-item .ico { width: 21px; height: 21px; }
  .bn-item.is-active { color: var(--teal-600); }
  .bn-item:hover { text-decoration: none; color: var(--teal-600); }
  /* The fixed bar sits on top of the page's own content unless the page
     leaves room for it; the sidebar drawer and its backdrop must still
     cover it while open, so they keep a higher z-index than this. */
  .content { padding-bottom: 78px; }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .footer, .toolbar, .form-actions,
  .btn, .act, .act-group, .alert, .no-print { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; border-color: #cbd5e1; page-break-inside: avoid; }
  body { background: #fff; }

  /* The TCL is a wide form - print it landscape and let it fill the sheet. */
  .stats { display: none !important; }
  .table-wrap { overflow: visible !important; }
  table.tcl { font-size: 8.4px; width: 100%; }
  table.tcl th, table.tcl td { border-color: #000; padding: 3px 2px; }
  table.tcl thead th { background: #fff; font-size: 7.2px; }
  table.tcl td { height: 26px; }
  table.tcl tbody tr:hover td { background: #fff; }
  table.tcl .tcl-name { min-width: 0; }
}
/* NB: the landscape @page rule lives in pages/immunization.php, not here -
   @page cannot be scoped by selector and would rotate every other printout. */
