/* Voter Search App — modern theme */
@font-face {
  font-family: "Noto Sans Gujarati";
  src: url("/static/fonts/NotoSansGujarati-Regular.ttf") format("truetype");
  font-display: swap;
}
:root {
  --bg: #f4f6f8; --card: #ffffff; --ink: #1a2332; --muted: #64748b;
  --brand: #0d9488; --brand-dark: #0f766e; --brand-soft: #ccfbf1;
  --ok: #16a34a; --pending: #f59e0b; --danger: #dc2626;
  --line: #e2e8f0; --radius: 14px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 6px 18px rgba(16, 24, 40, .06);
}
[data-theme="dark"] {
  --bg: #0f172a; --card: #1e293b; --ink: #e2e8f0; --muted: #94a3b8;
  --brand: #2dd4bf; --brand-dark: #14b8a6; --brand-soft: #134e4a;
  --line: #334155; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
}
* { box-sizing: border-box; }
html { font-size: 15.5px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans Gujarati", "Segoe UI", system-ui, sans-serif;
  min-height: 100vh;
}

/* topbar */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 22px; background: var(--card); box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 2rem; }
.brand h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }
.brand .sub { margin: 0; font-size: .78rem; color: var(--muted); }
.top-actions { display: flex; gap: 8px; }
.chip-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: .85rem;
  font-family: inherit; transition: .15s;
}
.chip-btn:hover { border-color: var(--brand); color: var(--brand); }

/* tabs */
.tabs {
  display: flex; gap: 6px; padding: 10px 22px 0; max-width: 1200px; margin: 0 auto;
}
.tab {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  padding: 10px 18px; border-radius: 12px 12px 0 0; font-size: 1rem;
  font-family: inherit; font-weight: 600; border-bottom: 3px solid transparent;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); background: var(--card); }

main { max-width: 1200px; margin: 0 auto; padding: 18px 22px 60px; }
.view { display: none; }
.view.active { display: block; }

/* search */
.search-wrap { display: grid; gap: 12px; }
.search-box { position: relative; }
#searchInput, #bSearch {
  width: 100%; padding: 15px 92px 15px 20px; font-size: 1.12rem;
  border: 2px solid var(--line); border-radius: 14px;
  background: var(--card); color: var(--ink); font-family: inherit;
  outline: none; transition: .15s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
#searchInput:focus, #bSearch:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.icon-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; cursor: pointer; font-size: 1.15rem;
  color: var(--muted); padding: 8px;
}
#kbBtn { right: 46px; } #clearBtn { right: 10px; }
.phonetic-bar {
  display: flex; align-items: center; gap: 10px; background: var(--brand-soft);
  padding: 8px 14px; border-radius: 10px; font-size: .95rem;
}
[data-theme="dark"] .phonetic-bar { color: #d1fae5; }
.ph-label { color: var(--muted); font-size: .8rem; }
.ph-preview { font-size: 1.15rem; font-weight: 600; }
.mini-btn {
  border: 1px solid var(--brand); color: var(--brand); background: transparent;
  padding: 6px 14px; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: .85rem; font-weight: 600;
}
.mini-btn:hover { background: var(--brand); color: #fff; }
.suggest-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.suggest-chip {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; cursor: pointer; font-family: inherit;
  font-size: .95rem;
}
.suggest-chip:hover { border-color: var(--brand); color: var(--brand); }

/* keyboard */
.kb-panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); display: grid; gap: 6px;
}
.kb-row { display: flex; flex-wrap: wrap; gap: 6px; }
.kb-key {
  min-width: 42px; padding: 9px 6px; font-size: 1.15rem; text-align: center;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  border-radius: 8px; cursor: pointer; font-family: inherit;
}
.kb-key:hover { background: var(--brand-soft); border-color: var(--brand); }
.kb-key.wide { min-width: 70px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters select, .age-range input {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--ink); font-family: inherit; font-size: .9rem;
}
.age-range { display: flex; align-items: center; gap: 6px; }
.age-range input { width: 70px; }

/* results — compact cards */
.result-meta { color: var(--muted); font-size: .85rem; margin: 14px 0 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(282px, 1fr)); gap: 12px; }
.card {
  display: flex; gap: 12px; background: var(--card); border-radius: var(--radius);
  padding: 12px; box-shadow: var(--shadow); cursor: pointer; transition: .15s;
  border: 1px solid transparent; position: relative;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.c-left {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.card .c-photo {
  width: 56px; height: 66px; object-fit: cover; border-radius: 10px;
  background: var(--line); flex-shrink: 0;
}
.c-serial {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: #fff; border-radius: 10px; padding: 4px 12px; text-align: center;
  box-shadow: 0 2px 6px rgba(13, 148, 136, .35);
}
.c-serial small { display: block; font-size: .58rem; font-weight: 600; opacity: .85; letter-spacing: .3px; }
.c-serial b { display: block; font-size: 1.15rem; font-weight: 800; line-height: 1.1; }
.chip-pdf { color: var(--brand-dark); font-weight: 700; background: var(--brand-soft); border-radius: 6px; }
.card .c-body { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.c-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.card .c-name { font-weight: 700; font-size: .98rem; margin: 0; line-height: 1.3; }
.card .c-en { color: var(--muted); font-size: .72rem; margin: 0 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; margin-bottom: 5px; }
.card .c-epic { font-family: ui-monospace, monospace; color: var(--brand); font-weight: 700; font-size: .82rem; }
.card .c-epic mark { background: #fde047; color: #422006; border-radius: 3px; padding: 0 2px; }
.chip {
  background: var(--bg); border-radius: 6px; padding: 2px 7px;
  font-size: .72rem; color: var(--muted); white-space: nowrap;
}
.card .c-rel { font-size: .78rem; color: var(--muted); margin-bottom: 7px; line-height: 1.3; }
.c-foot { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-top: auto; }
.fam-link {
  border: 1px dashed var(--brand); color: var(--brand); background: transparent;
  border-radius: 6px; padding: 2px 8px; font-size: .72rem; cursor: pointer;
  font-family: inherit; font-weight: 600;
}
.fam-link:hover { background: var(--brand-soft); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem;
  background: var(--brand-soft); color: var(--brand-dark); font-weight: 600;
}
.badge.female { background: #fce7f3; color: #be185d; }
.badge.male { background: #dbeafe; color: #1d4ed8; }
.badge.voted-yes { background: #dcfce7; color: var(--ok); }
.badge.voted-no { background: #fef3c7; color: #b45309; }
[data-theme="dark"] .badge.female { background: #4c1d3d; color: #f9a8d4; }
[data-theme="dark"] .badge.male { background: #1e3a8a; color: #bfdbfe; }

/* pager */
.pager { display: flex; gap: 6px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.pager button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  min-width: 38px; padding: 8px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.pager button.cur { background: var(--brand); color: #fff; border-color: var(--brand); }

/* table */
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; letter-spacing: .4px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--brand-soft); }
td img { width: 34px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--line); }

/* dashboard */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--card); border-radius: var(--radius); padding: 18px;
  text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--brand);
}
.tile.ok { border-top-color: var(--ok); }
.tile.pending { border-top-color: var(--pending); }
.tile.hi { border-top-color: #8b5cf6; }
.tile-num { font-size: 2rem; font-weight: 800; }
.tile-lbl { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.chart-card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-card h3 { margin: 0 0 10px; font-size: .95rem; color: var(--muted); }

/* modal */
.modal {
  position: fixed; inset: 0; background: rgba(2, 8, 20, .55); display: flex;
  align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-card {
  background: var(--card); border-radius: 18px; max-width: 520px; width: 100%;
  max-height: 90vh; overflow-y: auto; padding: 24px; position: relative; box-shadow: var(--shadow);
}
.modal-x {
  position: absolute; top: 12px; right: 14px; border: none; background: var(--bg);
  color: var(--ink); width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 1rem;
}
.m-head { display: flex; gap: 16px; margin-bottom: 16px; }
.m-head img { width: 96px; height: 112px; object-fit: cover; border-radius: 12px; background: var(--line); }
.m-name { font-size: 1.3rem; font-weight: 800; margin: 0 0 2px; }
.m-en { color: var(--muted); font-size: .85rem; margin: 0 0 8px; }
.m-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.m-field { background: var(--bg); border-radius: 10px; padding: 9px 12px; }
.m-field .k { font-size: .72rem; color: var(--muted); }
.m-field .v { font-weight: 600; }
.voted-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--bg); border-radius: 12px; padding: 12px 16px; margin-top: 6px;
}
.switch { position: relative; width: 52px; height: 28px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; background: var(--line); border-radius: 999px;
  cursor: pointer; transition: .2s;
}
.slider:before {
  content: ""; position: absolute; height: 22px; width: 22px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: var(--ok); }
.switch input:checked + .slider:before { transform: translateX(24px); }

/* status tabs */
.status-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.status-tabs button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 16px; border-radius: 999px; cursor: pointer; font-family: inherit;
  font-size: .9rem; font-weight: 600; transition: .15s;
}
.status-tabs button.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* voted quick toggle (card + table) */
.voted-btn {
  margin-top: 8px; border: 1px solid var(--line); background: var(--bg);
  color: var(--muted); border-radius: 999px; padding: 5px 14px; cursor: pointer;
  font-family: inherit; font-size: .82rem; font-weight: 700; transition: .15s;
}
.voted-btn.short {
  width: 38px; height: 38px; border-radius: 50%; padding: 0; margin: 0;
  font-size: 1.1rem; flex-shrink: 0;
}
.voted-btn.yes { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.voted-btn.no { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.voted-btn:hover { transform: scale(1.08); }
[data-theme="dark"] .voted-btn.yes { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .voted-btn.no { background: #713f12; color: #fde68a; }
td .voted-btn { margin: 0; padding: 4px 12px; }

/* unified text inputs */
.txt {
  flex: 1 1 250px; min-width: 200px; padding: 12px 16px; font-size: .95rem;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); outline: none;
  font-family: inherit; transition: .15s;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
.txt::placeholder { color: var(--muted); opacity: .85; }
.txt:hover { border-color: #b6c2d2; }
.txt:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* family tree popup */
.tree-card { max-width: 780px; }
.tree-note {
  margin: 12px 0 4px; padding: 9px 14px; border-radius: 10px;
  background: var(--bg); color: var(--muted); font-size: .8rem;
  border: 1px dashed var(--line);
}
.tree-body { padding: 8px 0 4px; overflow-x: auto; }
.tree-level {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  padding: 2px 0;
}
.tree-connector {
  width: 2px; height: 22px; background: var(--line); margin: 0 auto;
}
.tree-unit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.p-card {
  display: flex; gap: 10px; align-items: center;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow); min-width: 190px;
}
.p-card.hl { border: 2px solid #8b5cf6; box-shadow: 0 0 0 4px #ede9fe; }
.p-card.ref { border-style: dashed; background: var(--bg); }
.p-img {
  width: 52px; height: 60px; object-fit: cover; border-radius: 8px;
  background: var(--line); flex-shrink: 0;
}
.p-ic {
  width: 46px; height: 52px; border-radius: 8px; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; color: var(--muted); border: 1px solid var(--line); flex-shrink: 0;
}
.p-info { min-width: 0; }
.p-epic { font-family: ui-monospace, monospace; color: var(--brand); font-size: .72rem; font-weight: 700; }
.p-nm { font-weight: 700; font-size: .92rem; line-height: 1.3; }
.p-en { color: var(--muted); font-size: .74rem; margin-bottom: 4px; }
.p-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.p-chips .badge, .p-chips .chip { font-size: .7rem; }
.p-tag { font-size: .68rem; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--muted); display: inline-block; margin-top: 3px; }
.ref-tag { border: 1px dashed var(--muted); }
.heart {
  width: 30px; height: 30px; border-radius: 50%; background: #fff1f2;
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: #e11d48; flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.tree-btn { margin-left: auto; }


/* booth multi-select dropdown */
.dd { position: relative; flex: 0 0 auto; }
.dd-btn {
  padding: 12px 16px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--ink); cursor: pointer; font-family: inherit;
  font-size: .92rem; font-weight: 600; transition: .15s; white-space: nowrap;
}
.dd-btn:hover { border-color: var(--brand); }
.dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 10px; min-width: 230px; max-height: 280px;
  overflow-y: auto; display: grid; gap: 2px;
}
.dd-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: 8px; cursor: pointer; font-size: .9rem;
}
.dd-item:hover { background: var(--brand-soft); }
.dd-item input { width: 16px; height: 16px; accent-color: var(--brand); }
.dd-item.dd-all { font-weight: 600; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.dd-foot { display: flex; justify-content: flex-end; padding-top: 6px; }


/* login screen */
body:not(.authed) .topbar,
body:not(.authed) .tabs,
body:not(.authed) main { display: none !important; }
.login-wrap {
  position: fixed; inset: 0; background: var(--bg); z-index: 150;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
body.authed .login-wrap { display: none; }
.login-card {
  background: var(--card); padding: 34px 30px; border-radius: 20px;
  box-shadow: var(--shadow); width: min(370px, 94vw); text-align: center;
  display: grid; gap: 12px;
}
.login-logo { font-size: 2.8rem; }
.login-card h1 { margin: 0; font-size: 1.4rem; }
.login-sub { color: var(--muted); font-size: .85rem; margin: -4px 0 8px; }
.login-card .txt { text-align: center; }
.login-btn {
  background: var(--brand); color: #fff; border: none; border-radius: 12px;
  padding: 13px; font-size: 1rem; font-weight: 700; cursor: pointer;
  font-family: inherit; transition: .15s;
}
.login-btn:hover { background: var(--brand-dark); }
.login-err { color: var(--danger); font-size: .85rem; margin: 0; }
.whoami { color: var(--muted); font-size: .74rem; margin-right: 2px; }

/* trusted numbers manager */
.trust-list { display: grid; gap: 6px; max-height: 230px; overflow-y: auto; margin-bottom: 12px; }
.trust-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: .95rem;
}
.trust-remove { border: none; background: none; cursor: pointer; font-size: 1rem; }
.trust-add { display: grid; gap: 8px; }


/* superadmin panel */
.superadmin-only.hidden { display: none !important; }
.adm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.adm-head h2 { margin: 0; font-size: 1.15rem; }
.live-dot {
  width: 10px; height: 10px; border-radius: 50%; background: #16a34a;
  animation: pulse 1.6s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.live-txt { color: var(--muted); font-size: .78rem; }
.adm-table td, .adm-table th { font-size: .8rem; }
.adm-table td code {
  background: var(--bg); padding: 1px 6px; border-radius: 5px; font-size: .74rem;
}
.kick-btn {
  border: 1px solid #fca5a5; background: #fef2f2; color: #b91c1c;
  border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: .74rem;
  font-family: inherit; font-weight: 700;
}
.kick-btn:hover { background: #fee2e2; }
/* survey gradient card backgrounds */
.card.sv-yes {
  background: linear-gradient(135deg, #dcfce7 0%, #f0fdf4 55%, var(--card) 100%);
  border-left: 4px solid #16a34a;
}
.card.sv-no {
  background: linear-gradient(135deg, #fee2e2 0%, #fff1f2 55%, var(--card) 100%);
  border-left: 4px solid #dc2626;
}
.card.sv-fifty {
  background: linear-gradient(135deg, #fef9c3 0%, #fefce8 55%, var(--card) 100%);
  border-left: 4px solid #ca8a04;
}
.card.sv-work {
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 55%, var(--card) 100%);
  border-left: 4px solid #2563eb;
}
[data-theme="dark"] .card.sv-yes { background: linear-gradient(135deg, #14532d 0%, #14352a 55%, var(--card) 100%); }
[data-theme="dark"] .card.sv-no { background: linear-gradient(135deg, #7f1d1d 0%, #3d1a1c 55%, var(--card) 100%); }
[data-theme="dark"] .card.sv-fifty { background: linear-gradient(135deg, #713f12 0%, #3d3312 55%, var(--card) 100%); }
[data-theme="dark"] .card.sv-work { background: linear-gradient(135deg, #1e3a8a 0%, #172554 55%, var(--card) 100%); }

/* survey classifier buttons on cards */
.sv-btns { display: flex; gap: 6px; margin-top: 8px; }
.sv-btn {
  flex: 1; padding: 6px 0; border: 1.5px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--muted); font-size: .95rem; cursor: pointer;
  font-family: inherit; font-weight: 700; transition: .12s;
}
.sv-btn:hover { transform: translateY(-1px); }
.sv-btn.b-yes.on, .sv-btn.b-yes:hover { background: #dcfce7; color: #15803d; border-color: #16a34a; }
.sv-btn.b-no.on, .sv-btn.b-no:hover { background: #fee2e2; color: #b91c1c; border-color: #dc2626; }
.sv-btn.b-fifty.on, .sv-btn.b-fifty:hover { background: #fef9c3; color: #a16207; border-color: #ca8a04; }
.sv-btn.b-work.on, .sv-btn.b-work:hover { background: #dbeafe; color: #1d4ed8; border-color: #2563eb; }
[data-theme="dark"] .sv-btn.b-yes.on { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .sv-btn.b-no.on { background: #7f1d1d; color: #fecaca; }
[data-theme="dark"] .sv-btn.b-fifty.on { background: #713f12; color: #fde68a; }
[data-theme="dark"] .sv-btn.b-work.on { background: #1e3a8a; color: #bfdbfe; }

/* survey tiles + share bar */
.sv-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.sv-tile {
  background: var(--card); border-radius: var(--radius); padding: 14px;
  text-align: center; box-shadow: var(--shadow); cursor: pointer; border: 2px solid transparent;
  font-family: inherit; transition: .15s;
}
.sv-tile:hover { transform: translateY(-2px); }
.sv-tile.active { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.sv-tile .tile-num { font-size: 1.7rem; font-weight: 800; }
.sv-tile .tile-lbl { color: var(--muted); font-size: .82rem; margin-top: 3px; }
.sv-tile.t-yes { border-top: 4px solid #16a34a; } .sv-tile.t-yes .sv-ico { color: #16a34a; }
.sv-tile.t-no { border-top: 4px solid #dc2626; } .sv-tile.t-no .sv-ico { color: #dc2626; }
.sv-tile.t-fifty { border-top: 4px solid #ca8a04; } .sv-tile.t-fifty .sv-ico { color: #ca8a04; }
.sv-tile.t-work { border-top: 4px solid #2563eb; } .sv-tile.t-work .sv-ico { color: #2563eb; }
.sv-tile.t-unset { border-top: 4px solid #94a3b8; } .sv-tile.t-unset .sv-ico { color: #94a3b8; }
.sv-ico { font-weight: 800; }
.sv-share { margin: 14px 0; }
.sv-share-bar {
  display: flex; height: 14px; border-radius: 999px; overflow: hidden;
  background: var(--line);
}
.seg { height: 100%; transition: width .4s; }
.seg.g { background: #16a34a; } .seg.r { background: #dc2626; }
.seg.y { background: #eab308; } .seg.b { background: #3b82f6; }
.seg.n { background: #cbd5e1; }
[data-theme="dark"] .seg.n { background: #475569; }
.sv-share-txt {
  display: flex; justify-content: space-between; margin-top: 6px;
  color: var(--muted); font-size: .82rem;
}
.sv-favour-pct { color: var(--ok); font-weight: 700; }

/* family tree */
.fam-list { display: grid; gap: 14px; }
.fam-card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; border-left: 4px solid var(--brand);
}
.fam-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.fam-house { font-weight: 800; font-size: 1.02rem; color: var(--brand-dark); }
.fam-prog {
  margin-left: auto; background: var(--brand-soft); color: var(--brand-dark);
  padding: 3px 12px; border-radius: 999px; font-size: .8rem; font-weight: 700;
}
.fam-prog.done { background: #dcfce7; color: var(--ok); }
.fam-count { color: var(--muted); font-size: .8rem; }
.fam-couple { display: flex; gap: 8px; flex-wrap: wrap; }
.fam-linkline { border-left: 2px dashed var(--line); height: 12px; margin-left: 30px; }
.fam-kids { display: flex; gap: 8px; flex-wrap: wrap; }
.m-chip {
  display: flex; gap: 8px; align-items: center; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  cursor: pointer; transition: .15s; min-width: 0;
}
.m-chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.m-chip.msv-yes { border-left: 3px solid #16a34a; }
.m-chip.msv-no { border-left: 3px solid #dc2626; }
.m-chip.msv-fifty { border-left: 3px solid #ca8a04; }
.m-chip.msv-work { border-left: 3px solid #2563eb; }
.m-chip img { width: 34px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--line); flex-shrink: 0; }
.m-info { min-width: 0; }
.m-name { font-size: .85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.m-sub { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.tag { font-size: .95rem; }
.house-chip {
  background: var(--brand-soft); color: var(--brand-dark); border-radius: 999px;
  padding: 7px 14px; font-size: .85rem; display: inline-flex; gap: 10px; align-items: center;
  font-weight: 600;
}
.house-chip button { border: none; background: none; cursor: pointer; color: inherit; font-size: .9rem; }

/* toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 22px; border-radius: 999px;
  font-size: .9rem; z-index: 200; box-shadow: var(--shadow);
}
.hidden { display: none !important; }

.empty { text-align: center; color: var(--muted); padding: 60px 20px; font-size: 1.05rem; }


/* mobile: bottom app-style navbar */
@media (max-width: 768px) {
  html { font-size: 14.5px; }
  .topbar { padding: 10px 14px; }
  main { padding: 14px 12px calc(76px + env(safe-area-inset-bottom)); }
  .tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    background: var(--card); box-shadow: 0 -2px 12px rgba(16, 24, 40, .12);
    display: flex; justify-content: space-around; gap: 0;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    max-width: none; margin: 0; border-radius: 0;
  }
  .tab {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: .66rem; padding: 6px 2px; border-radius: 10px;
    border-bottom: none; margin: 0 2px;
  }
  .tab.active { background: var(--brand-soft); }
  .cards { grid-template-columns: 1fr; }
  .m-fields { grid-template-columns: 1fr; }
}
