/* DBPD Directory – blue theme */
:root {
  --primary: #2563eb; --primary-d: #1d4ed8; --accent: #0ea5e9; --accent-d: #0369a1;
  --grad: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #0ea5e9 100%);
  --lilac: #e8f0fe; --lilac-2: #dbe7fd; --bg: #f5f8ff; --card: #fff;
  --ink: #0f1e3d; --muted: #5f6b85; --line: #e3eaf6; --field: #cfdaee;
  --ok: #15803d; --ok-bg: #dcfce7; --bad: #dc2626; --bad-bg: #fef2f2; --warn: #b45309; --warn-bg: #fef3c7;
  --radius: 16px; --shadow: 0 1px 2px rgba(30, 58, 138, .05), 0 8px 24px -12px rgba(30, 58, 138, .18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Gujarati", sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.25; }
code { background: var(--lilac); padding: 1px 5px; border-radius: 5px; font-size: .9em; }

/* ================= Public form ================= */
.hero { background: var(--grad); color: #fff; text-align: center; padding: 34px 18px 56px; position: relative; overflow: hidden; }
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.hero::after { width: 160px; height: 160px; bottom: -80px; left: -40px; }
.hero .tag { display: inline-block; background: rgba(255,255,255,.18); padding: 4px 12px; border-radius: 30px; letter-spacing: .08em; font-size: 12px; text-transform: uppercase; font-weight: 700; }
.hero h1 { margin: 12px 0 6px; font-size: 26px; font-weight: 800; position: relative; }
.hero p { margin: 0; opacity: .9; font-size: 14px; position: relative; }
.wrap { max-width: 720px; margin: -32px auto 0; padding: 0 14px 40px; position: relative; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card h2 { font-size: 17px; margin: 0 0 14px; color: var(--ink); display: flex; align-items: center; gap: 10px; font-weight: 750; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: var(--grad); color: #fff; font-size: 13px; font-weight: 800; flex: none; }
.intro { border-left: 4px solid var(--accent); }
.intro p { margin: 0 0 6px; }
.center { text-align: center; }
label { display: block; font-size: 14px; font-weight: 650; margin: 14px 0 5px; color: #1e3358; }
.card h2 + label, .card .hint + label { margin-top: 0; }
input[type=text], input[type=tel], input[type=email], input[type=date], input[type=password], input[type=search], select, textarea {
  width: 100%; font: inherit; padding: 12px 14px; border: 1.5px solid var(--field); border-radius: 12px; background: #fff; color: var(--ink); min-height: 48px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; }
/* iPhone/Safari: date boxes must not stick out of the card */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
.grid2 > div { min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37, 99, 235, .14); }
.invalid { border-color: var(--bad) !important; background: var(--bad-bg) !important; }
.err { color: var(--bad); font-size: 13px; margin-top: 4px; }
.req { color: #dc2626; }
.hint { color: var(--muted); font-size: 14px; margin: -6px 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 560px) { .grid2 { grid-template-columns: 1fr 1fr; } .hero h1 { font-size: 32px; } }
.member { border: 1.5px solid var(--lilac-2); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: linear-gradient(180deg, #f8fbff, #fff); }
.member-head { display: flex; justify-content: space-between; align-items: center; }
.member-head strong { color: var(--primary-d); }
.member label { margin-top: 10px; }
.file-drop { display: block; border: 2px dashed #93c5fd; border-radius: 14px; padding: 26px; text-align: center; cursor: pointer; color: var(--primary-d); font-weight: 700; margin: 0; background: var(--lilac); transition: background .15s; }
.file-drop:hover { background: var(--lilac-2); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.thumb { position: relative; }
.thumb-x { position: absolute; top: -7px; right: -7px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: #dc2626; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.hp { position: absolute; left: -9999px; }
.submit-bar { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(245,248,255,0), var(--bg) 35%); z-index: 5; }
.foot { text-align: center; color: var(--muted); font-size: 14px; margin-top: 18px; }
.big-check { width: 72px; height: 72px; margin: 6px auto 12px; border-radius: 50%; background: var(--grad); color: #fff; font-size: 36px; display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(14, 165, 233, .5); }
.ref { font-size: 20px; color: var(--primary); letter-spacing: .03em; }

/* ================= Buttons & alerts ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 650; border: 1.5px solid transparent; border-radius: 12px; padding: 9px 16px; cursor: pointer; text-decoration: none; background: var(--lilac); color: var(--primary-d); transition: transform .05s, filter .15s, background .15s; }
.btn:hover { filter: brightness(.97); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .8); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: #fff; border-color: #93c5fd; color: var(--primary-d); width: 100%; }
.btn.danger { background: #fff; border-color: #fca5a5; color: var(--bad); }
.btn.whatsapp { background: #25d366; color: #fff; }
.btn.big { width: 100%; padding: 15px; font-size: 17px; border-radius: 14px; }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; padding: 0; text-decoration: none; }
.link:hover { text-decoration: underline; }
.alert { padding: 12px 14px; border-radius: 12px; margin: 10px 0; font-size: 15px; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }

/* ================= Admin shell: sidebar ================= */
body.admin { background: var(--bg); }
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex: none; background: #0b1b3f; color: #e3ebfa; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 14px; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.sidebar .logo { width: 38px; height: 38px; border-radius: 11px; background: var(--grad); display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px; }
.sidebar .brand b { display: block; font-size: 15px; color: #fff; }
.sidebar .brand small { color: #93a4c8; font-size: 12px; }
.sidebar nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: #c3d0ea; text-decoration: none; font-size: 15px; font-weight: 550; }
.sidebar nav a .ic { width: 20px; text-align: center; font-size: 16px; }
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar nav a.on { background: var(--grad); color: #fff; box-shadow: 0 8px 20px -10px rgba(14, 165, 233, .9); }
.sidebar .side-foot { border-top: 1px solid rgba(255,255,255,.08); padding-top: 12px; font-size: 13px; color: #93a4c8; }
.sidebar .side-foot a, .sidebar .side-foot button.link { color: #7dd3fc; text-decoration: none; font-weight: 600; }
.main { flex: 1; min-width: 0; }
.mobilebar { display: none; }
.page { max-width: 1240px; margin: 0 auto; padding: 22px 22px 50px; }
.page h1 { font-size: 24px; margin: 4px 0 16px; font-weight: 800; }
.scrim { display: none; }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 15, 40, .45); z-index: 40; }
  .mobilebar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 30; background: var(--grad); color: #fff; padding: 10px 14px; font-weight: 700; }
  .mobilebar button { background: rgba(255,255,255,.18); border: 0; color: #fff; width: 40px; height: 40px; border-radius: 11px; font-size: 20px; cursor: pointer; }
  .page { padding: 16px 12px 40px; }
}

/* ================= Admin components ================= */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.filters label { margin: 0 0 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.filters input, .filters select { min-height: 42px; padding: 8px 10px; font-size: 14px; border-radius: 10px; }
.filters .wide { grid-column: span 2; }
.filters .actions { display: flex; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 14px 0; }
.toolbar .count { margin-right: auto; color: var(--muted); font-weight: 600; }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 11px 12px; border-bottom: 1px solid #edf2fb; text-align: left; vertical-align: top; }
table.data th { background: #f4f7fd; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: #f7faff; }
table.data tr.hl td { background: #e0f2fe; }
.name-link { color: var(--ink); text-decoration: none; font-weight: 700; }
.name-link:hover { color: var(--primary); }
.ref-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 13px; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--lilac); color: var(--primary-d); white-space: nowrap; text-decoration: none; }
.badge.new { background: #fef3c7; color: #92400e; }
.badge.verified { background: var(--ok-bg); color: var(--ok); }
.badge.dup { background: #fee2e2; color: #b91c1c; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.pager a, .pager span { padding: 7px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); text-decoration: none; font-size: 14px; color: var(--ink); }
.pager span.cur { background: var(--grad); color: #fff; border-color: transparent; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; right: -24px; top: -24px; width: 80px; height: 80px; border-radius: 50%; background: var(--lilac); }
.stat .v { font-size: 30px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; position: relative; z-index: 1; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 600; position: relative; z-index: 1; }
.cols { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 1000px) { .cols { grid-template-columns: 1fr 1fr; } }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 44px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.bars .track { display: block; background: var(--lilac); border-radius: 8px; height: 12px; overflow: hidden; }
.bars .fill { display: block; background: var(--grad); height: 100%; border-radius: 8px; }
.bars .n { text-align: right; font-weight: 700; }
.bars a { color: inherit; text-decoration: none; }
.bars a:hover { color: var(--primary); }
.daychart { display: flex; align-items: flex-end; gap: 3px; height: 130px; }
.daychart div { flex: 1; background: var(--lilac); border-radius: 5px 5px 0 0; min-height: 3px; }
.daychart div.has { background: var(--grad); }
dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; font-size: 15px; }
dl.kv dt { color: var(--muted); font-weight: 600; }
dl.kv dd { margin: 0; white-space: pre-line; }
@media (max-width: 560px) { dl.kv { grid-template-columns: 1fr; gap: 2px; } dl.kv dd { margin-bottom: 8px; } .filters .wide { grid-column: auto; } }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 150px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); display: block; }
.gallery figcaption { font-size: 12px; display: flex; justify-content: space-between; align-items: center; gap: 4px; margin-top: 4px; }
body.login-page { min-height: 100vh; display: grid; place-items: center; background: var(--grad); padding: 16px; }
.login-box { width: 100%; max-width: 400px; margin: 0; }
.login-box .logo { width: 52px; height: 52px; border-radius: 15px; background: var(--grad); display: grid; place-items: center; color: #fff; font-weight: 800; margin-bottom: 10px; }
textarea.share { min-height: 230px; font-size: 14px; }
.inline { display: inline; }
.head-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.head-row h1 { margin: 0 auto 0 0; }

/* Tables become cards on phones */
@media (max-width: 760px) {
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { display: none; }
  .tbl-wrap:has(table.cards) { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  table.cards tr { background: #fff; border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; padding: 10px 14px; box-shadow: var(--shadow); }
  table.cards tr:hover td { background: transparent; }
  table.cards td { border: 0; padding: 4px 0; display: flex; gap: 10px; }
  table.cards td::before { content: attr(data-label); flex: 0 0 96px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; padding-top: 2px; }
  table.cards td.card-title { display: block; font-size: 16px; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid #edf2fb; }
  table.cards td.card-title::before { display: none; }
  table.cards td.empty::before { display: none; }
}

/* ================= Print ================= */
.print-head { text-align: center; margin-bottom: 18px; }
.print-entry { break-inside: avoid; border-bottom: 1px solid #ddd; padding: 10px 0; font-size: 13px; }
.print-entry h3 { margin: 0 0 4px; font-size: 15px; color: var(--primary-d); }
.print-entry table { border-collapse: collapse; margin-top: 6px; width: 100%; }
.print-entry td, .print-entry th { border: 1px solid #ddd; padding: 3px 6px; font-size: 12px; text-align: left; }
.print-group { break-before: page; color: var(--primary-d); border-bottom: 2px solid var(--accent); padding-bottom: 4px; }
.print-group:first-of-type { break-before: auto; }
@media print {
  .no-print, .sidebar, .mobilebar, .scrim { display: none !important; }
  body.admin { background: #fff; }
  .page { padding: 0; max-width: none; }
  .card, .tbl-wrap, .stat { box-shadow: none; }
}
