/* ============================================================
   पाथरवट समाज पोर्टल — मुख्य थीम
   Bhagwa Saffron + Forest Green + White — professional, vibrant
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Devanagari:wght@400;500;600;700;800;900&display=swap');

/* ── Variables ───────────────────── */
:root {
    --saffron:      #E55100;
    --saffron-dk:   #BF360C;
    --saffron-lt:   #FF6D00;
    --saffron-bg:   #FFF3E0;
    --saffron-border: #FFCCBC;
    --green:        #1B5E20;
    --green-lt:     #2E7D32;
    --gold:         #F57F17;
    --gold-lt:      #F9A825;
    --navy:         #0D1B2A;
    --navy-lt:      #1A2E3F;
    --surface:      #FFFFFF;
    --bg:           #FFFFFF;
    --bg-gray:      #F5F5F5;
    --bg-warm:      #FFF8F4;
    --ink:          #1A1208;
    --muted:        #5D4037;
    --muted-lt:     #795548;
    --line:         #E0E0E0;
    --line-warm:    #FFCCBC;
    --success:      #1B5E20;
    --danger:       #B71C1C;
    --warning-bg:   #FFF9C4;
    --radius:       10px;
    --shadow:       0 2px 12px rgba(0,0,0,.08);
    --shadow-md:    0 4px 24px rgba(0,0,0,.12);
}

/* ── Base ────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Noto Sans Devanagari', 'Segoe UI', system-ui, sans-serif;
    font-size: 1rem;
    line-height: 1.65;
}
a { color: var(--saffron); }
a:hover { color: var(--saffron-dk); }
img { max-width: 100%; }

/* ── Navbar ──────────────────────── */
.site-navbar {
    background: var(--navy);
    border-bottom: 3px solid var(--saffron);
    padding: 0;
}
.site-navbar .container-fluid { padding: 0 24px; }
.nav-logo-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    text-decoration: none;
}
.nav-logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--saffron), var(--saffron-lt));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.1rem;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.2);
}
.nav-logo-text strong {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: .01em;
}
.nav-logo-text small {
    display: block;
    font-size: .62rem;
    color: rgba(255,255,255,.55);
    letter-spacing: .06em;
    text-transform: uppercase;
}
.site-navbar .navbar-nav .nav-link {
    color: rgba(255,255,255,.8);
    font-weight: 600;
    font-size: .9rem;
    padding: 16px 14px;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
    transition: color .15s, border-color .15s;
}
.site-navbar .navbar-nav .nav-link:hover,
.site-navbar .navbar-nav .nav-link.active {
    color: #fff;
    border-bottom-color: var(--saffron-lt);
}
.site-navbar .dropdown-menu {
    background: var(--navy-lt);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: var(--radius);
    padding: 8px 0;
    margin-top: 0;
}
.site-navbar .dropdown-menu .dropdown-item {
    color: rgba(255,255,255,.8);
    font-size: .88rem;
    padding: 8px 18px;
}
.site-navbar .dropdown-menu .dropdown-item:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.site-navbar .navbar-toggler {
    border-color: rgba(255,255,255,.3);
    color: #fff;
}

/* ── Buttons ─────────────────────── */
.btn-saffron {
    background: var(--saffron);
    border: none;
    color: #fff !important;
    font-weight: 700;
}
.btn-saffron:hover { background: var(--saffron-dk); color: #fff; }
.btn-primary   { background: var(--saffron); border-color: var(--saffron); font-weight: 700; }
.btn-primary:hover,
.btn-primary:focus { background: var(--saffron-dk); border-color: var(--saffron-dk); }
.btn-outline-primary { color: var(--saffron); border-color: var(--saffron); font-weight: 700; }
.btn-outline-primary:hover { background: var(--saffron); border-color: var(--saffron); }
.btn-success   { background: var(--green-lt); border-color: var(--green-lt); }
.btn-success:hover { background: var(--green); border-color: var(--green); }

/* ── Flash / Alerts ──────────────── */
.flash-wrap { padding: 10px 24px 0; }
.alert { border-radius: var(--radius); font-weight: 600; }
.alert-success { background: #E8F5E9; border-color: #A5D6A7; color: var(--green); }
.alert-danger  { background: #FFEBEE; border-color: #EF9A9A; color: #B71C1C; }
.alert-warning { background: var(--warning-bg); border-color: #FFF176; color: #795548; }
.alert-info    { background: #E3F2FD; border-color: #90CAF9; color: #0D47A1; }

/* ── Hero ────────────────────────── */
.site-hero {
    background: linear-gradient(135deg, var(--navy) 0%, #1A2E3F 40%, var(--saffron-dk) 100%);
    color: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    position: relative;
    min-height: 400px;
    display: flex;
    align-items: center;
    padding: 48px 40px;
}
.site-hero::after {
    content: '';
    position: absolute;
    right: -40px; top: -40px;
    width: 480px; height: 480px;
    background: radial-gradient(circle, rgba(229,81,0,.25) 0%, transparent 65%);
    pointer-events: none;
}
.site-hero-inner { position: relative; z-index: 1; max-width: 660px; }
.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.25);
    color: #FFD180;
    border-radius: 30px;
    padding: 5px 16px;
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 18px;
}
.hero-tag::before {
    content: '';
    width: 8px; height: 8px;
    background: #FFD180;
    border-radius: 50%;
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }
.site-hero h1 {
    font-size: clamp(1.8rem, 3.5vw, 3rem);
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 16px;
}
.site-hero .lead {
    font-size: 1.05rem;
    color: rgba(255,255,255,.85);
    margin-bottom: 30px;
    line-height: 1.65;
}
.hero-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid rgba(255,255,255,.18);
}
.hero-stat strong { display: block; font-size: 1.6rem; font-weight: 900; color: #FFD180; line-height: 1.1; }
.hero-stat span   { font-size: .76rem; color: rgba(255,255,255,.65); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

/* ── Community panel ─────────────── */
.community-panel {
    background: linear-gradient(160deg, var(--navy-lt) 0%, var(--navy) 100%);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius);
    color: #fff;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 28px;
    height: 100%;
}
.community-panel-title {
    font-size: .7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .12em;
    color: rgba(255,255,255,.45);
    margin-bottom: 2px;
}
.community-panel h2 { font-weight: 800; font-size: 1.05rem; color: #fff; margin: 0; }
.community-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    flex: 1;
}
.community-grid .cg-item {
    background: rgba(255,255,255,.07);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 8px;
    padding: 12px 14px;
}
.community-grid strong { display: block; font-size: 1.5rem; font-weight: 900; color: #FFD180; line-height: 1.1; }
.community-grid span   { font-size: .75rem; color: rgba(255,255,255,.65); font-weight: 600; }

/* ── Info strip ──────────────────── */
.info-strip {
    background: var(--saffron-bg);
    border-top: 2px solid var(--saffron-border);
    border-bottom: 2px solid var(--saffron-border);
    padding: 20px 0;
    overflow-x: auto;
}
.info-strip-inner {
    display: flex;
    gap: 0;
    min-width: max-content;
}
.info-strip-item {
    padding: 0 28px;
    border-right: 1px solid var(--saffron-border);
    text-align: center;
}
.info-strip-item:last-child { border-right: none; }
.info-strip-item strong { display: block; font-size: 1.6rem; font-weight: 900; color: var(--saffron); line-height: 1; }
.info-strip-item span   { font-size: .78rem; font-weight: 700; color: var(--muted-lt); text-transform: uppercase; letter-spacing: .04em; }

/* ── Section labels ──────────────── */
.section-label {
    display: inline-block;
    background: var(--saffron-bg);
    color: var(--saffron);
    border: 1px solid var(--saffron-border);
    border-radius: 20px;
    padding: 3px 14px;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.section-title {
    font-size: clamp(1.2rem, 2.2vw, 1.75rem);
    font-weight: 900;
    color: var(--ink);
    margin-bottom: 8px;
    line-height: 1.25;
}
.section-sub {
    color: var(--muted-lt);
    font-size: .92rem;
}

/* ── Cards / Boxes ───────────────── */
.box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}
.box-warm {
    background: var(--bg-warm);
    border-color: var(--saffron-border);
}
.content-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

/* ── Stat boxes ──────────────────── */
.stat-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-top: 4px solid var(--saffron);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    min-height: 110px;
}
.stat-box strong { display: block; font-size: 2rem; font-weight: 900; color: var(--saffron); line-height: 1.1; margin-bottom: 4px; }
.stat-box span   { color: var(--muted-lt); font-weight: 700; font-size: .84rem; text-transform: uppercase; letter-spacing: .04em; }
.tone-green  { border-top-color: var(--green-lt); }
.tone-green strong { color: var(--green-lt); }
.tone-amber  { border-top-color: var(--gold); }
.tone-amber strong { color: var(--gold); }
.tone-rose   { border-top-color: #C62828; }
.tone-rose strong { color: #C62828; }
.tone-teal   { border-top-color: #00838F; }
.tone-teal strong { color: #00838F; }

/* ── Feature icons ───────────────── */
.feature-icon {
    width: 60px; height: 60px;
    background: var(--saffron-bg);
    border: 2px solid var(--saffron-border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 16px;
    flex-shrink: 0;
}
.feature-icon.green-bg {
    background: #E8F5E9;
    border-color: #A5D6A7;
}
.feature-icon.gold-bg {
    background: #FFF9C4;
    border-color: #FFF176;
}

/* ── Service cards ───────────────── */
.service-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s, transform .18s;
}
.service-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.service-card .fee-badge {
    display: inline-block;
    background: var(--saffron-bg);
    color: var(--saffron);
    border: 1px solid var(--saffron-border);
    border-radius: 20px;
    padding: 3px 12px;
    font-size: .8rem;
    font-weight: 800;
    margin-bottom: 14px;
    align-self: flex-start;
}
.service-card h2 { font-weight: 800; font-size: 1.05rem; color: var(--ink); margin-bottom: 8px; }
.service-card p  { color: var(--muted-lt); font-size: .9rem; flex: 1; }

/* ── Service pills ───────────────── */
.services-one-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.service-pill {
    align-items: center;
    background: var(--bg-warm);
    border: 1px solid var(--saffron-border);
    border-radius: var(--radius);
    color: var(--ink);
    display: flex;
    flex: 0 0 210px;
    gap: 10px;
    min-height: 72px;
    padding: 12px;
    text-decoration: none;
    transition: background .15s, box-shadow .15s;
}
.service-pill:hover { background: #FFE0B2; box-shadow: 0 4px 16px rgba(229,81,0,.15); color: var(--ink); }
.service-pill i      { color: var(--saffron); font-size: 1.25rem; flex-shrink: 0; }
.service-pill span   { flex: 1; font-weight: 700; font-size: .86rem; }
.service-pill strong { color: var(--gold); font-weight: 800; }

/* ── News tiles ──────────────────── */
.news-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--ink);
    display: block;
    height: 230px;
    overflow: hidden;
    text-decoration: none;
    transition: box-shadow .18s;
}
.news-tile:hover { box-shadow: var(--shadow-md); color: var(--ink); }
.news-tile img    { height: 150px; width: 100%; object-fit: cover; display: block; }
.news-tile span {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-weight: 700;
    font-size: .86rem;
    padding: 10px 12px;
    line-height: 1.35;
}
.news-tile.muted { opacity: .6; }

/* ── News article cards ──────────── */
.news-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s;
    text-decoration: none;
    color: var(--ink);
}
.news-card:hover { box-shadow: var(--shadow-md); }
.news-card img   { height: 190px; width: 100%; object-fit: cover; display: block; }
.news-card-body  { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.news-card-meta  { font-size: .76rem; color: var(--muted-lt); font-weight: 600; margin-bottom: 8px; }
.news-card-title { font-weight: 800; font-size: 1rem; color: var(--ink); line-height: 1.35; flex: 1; }
.news-card-excerpt { font-size: .86rem; color: var(--muted-lt); margin-top: 8px; }

/* ── Latest activity ─────────────── */
.latest-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    height: 100%;
}
.latest-box h2 { font-size: 1rem; font-weight: 800; margin-bottom: 14px; color: var(--ink); border-bottom: 2px solid var(--saffron-bg); padding-bottom: 10px; }
.latest-item { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); transition: color .12s; }
.latest-item:last-child { border-bottom: none; }
.latest-item:hover { color: var(--saffron); }
.latest-item small { color: var(--saffron); display: block; font-weight: 700; font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; }
.latest-item span  { font-weight: 600; font-size: .9rem; }

/* ── Announce sliders ────────────── */
.announce-wrap {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    min-height: 300px;
    background: var(--navy);
}
.announce-wrap .carousel-item { height: 300px; }
.announce-wrap img { height: 100%; width: 100%; object-fit: cover; display: block; }
.announce-label {
    position: absolute; top: 0; left: 0; z-index: 3;
    background: rgba(229,81,0,.9);
    color: #fff;
    font-size: .7rem; font-weight: 800;
    padding: 7px 14px;
    border-radius: 0 0 8px 0;
    text-transform: uppercase; letter-spacing: .08em;
}
.announce-caption {
    background: linear-gradient(0deg, rgba(13,27,42,.92) 0%, transparent 100%);
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 50px 22px 22px; color: #fff; z-index: 2;
}
.announce-caption small { color: #FFD180; font-weight: 700; display: block; font-size: .76rem; }
.announce-caption h3    { font-size: 1.15rem; font-weight: 800; margin: 4px 0 0; }

/* ── SDG ─────────────────────────── */
.sdg-menu { max-height: 70vh; overflow-y: auto; width: min(440px, 92vw); }
.sdg-nav-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 20px 0;
}
.sdg-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: .82rem;
    font-weight: 800;
    text-decoration: none;
    color: #fff;
    border: 2px solid transparent;
    transition: opacity .15s, transform .12s;
}
.sdg-chip:hover { opacity: .9; transform: translateY(-1px); color: #fff; }
.sdg-chip.active { box-shadow: 0 0 0 3px rgba(0,0,0,.25); }
.sdg-chip-num {
    background: rgba(0,0,0,.22);
    border-radius: 5px;
    width: 22px; height: 22px;
    display: flex; align-items: center; justify-content: center;
    font-size: .75rem; font-weight: 900; flex-shrink: 0;
}
.sdg-full-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}
.sdg-full-header {
    color: #fff;
    padding: 28px 32px 24px;
    position: relative;
}
.sdg-full-header::before {
    content: '';
    position: absolute; inset: 0;
    background: rgba(0,0,0,.18);
}
.sdg-full-header .sdg-num-big {
    position: relative;
    font-size: 3.5rem; font-weight: 900; line-height: 1;
    opacity: .22; margin-bottom: 8px;
}
.sdg-full-header h2 {
    position: relative;
    font-size: 1.6rem; font-weight: 900; margin: 0;
}
.sdg-full-header p {
    position: relative;
    font-size: .95rem; opacity: .88; margin: 8px 0 0;
}
.sdg-full-body {
    background: var(--surface);
    padding: 28px 32px;
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}
.sdg-metric-box {
    border-radius: 8px;
    color: #fff;
    padding: 18px 22px;
    margin-bottom: 22px;
}
.sdg-metric-box strong { display: block; font-size: 2.2rem; font-weight: 900; line-height: 1; }
.sdg-metric-box span   { font-size: .78rem; font-weight: 700; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.sdg-metric-box small  { display: block; font-size: .8rem; opacity: .75; margin-top: 4px; }
.sdg-info-row { display: grid; gap: 14px; grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
.sdg-info-item {
    background: var(--bg-gray);
    border-radius: 8px;
    padding: 14px 16px;
}
.sdg-info-item dt { font-size: .72rem; font-weight: 800; color: var(--muted-lt); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.sdg-info-item dd { font-size: .9rem; font-weight: 600; color: var(--ink); margin: 0; line-height: 1.5; }

/* ── SDG compact card (all goals view) ── */
.sdg-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: box-shadow .18s, transform .18s;
}
.sdg-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sdg-card-head {
    color: #fff;
    padding: 20px 22px 18px;
    position: relative;
}
.sdg-card-head .sdg-n {
    font-size: 2.2rem; font-weight: 900; opacity: .2; line-height: 1; margin-bottom: 6px;
}
.sdg-card-head h3 { font-size: 1rem; font-weight: 800; margin: 0; line-height: 1.3; position: relative; }
.sdg-card-body {
    background: var(--surface);
    padding: 16px 22px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}
.sdg-card-body p { font-size: .86rem; color: var(--muted-lt); flex: 1; line-height: 1.55; }
.sdg-card-metric {
    margin-top: 14px;
    padding: 10px 14px;
    background: var(--bg-gray);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.sdg-card-metric strong { font-size: 1.4rem; font-weight: 900; }
.sdg-card-metric span   { font-size: .76rem; font-weight: 700; color: var(--muted-lt); }

/* ── Community page ──────────────── */
.village-table th { background: var(--saffron-bg); color: var(--saffron); font-weight: 800; font-size: .8rem; text-transform: uppercase; }

/* ── Admin / Moderator nav ───────── */
.list-group-item-action { color: var(--ink); font-weight: 600; }
.list-group-item-action.active { background: var(--saffron) !important; border-color: var(--saffron) !important; color: #fff !important; }
.list-group-item-action:hover:not(.active) { background: var(--saffron-bg); color: var(--saffron); }

/* ── Footer ──────────────────────── */
.site-footer {
    background: var(--navy);
    color: rgba(255,255,255,.65);
    border-top: 4px solid var(--saffron);
}
.site-footer a { color: rgba(255,255,255,.7); text-decoration: none; font-size: .88rem; }
.site-footer a:hover { color: #FFD180; }
.footer-logo strong { color: #fff; font-weight: 900; font-size: 1.1rem; }
.footer-logo small  { color: rgba(255,255,255,.45); font-size: .72rem; letter-spacing: .06em; }
.footer-heading {
    color: rgba(255,255,255,.35);
    font-size: .68rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: .12em;
    margin-bottom: 14px;
}
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.1);
    padding: 14px 0 0;
    font-size: .8rem;
    color: rgba(255,255,255,.35);
}

/* ── SDG page header ─────────────── */
.page-header {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lt) 60%, #2C3E50 100%);
    color: #fff;
    padding: 48px 0 40px;
    margin-bottom: 0;
}
.page-header .section-label { background: rgba(255,255,255,.15); border-color: rgba(255,255,255,.25); color: #FFD180; }
.page-header h1 { font-size: clamp(1.5rem, 3vw, 2.5rem); font-weight: 900; margin-bottom: 10px; }
.page-header p  { color: rgba(255,255,255,.75); font-size: .95rem; margin: 0; }

/* ── Misc ────────────────────────── */
.page-title { padding: 36px 0 20px; }
.badge-fee  { background: var(--saffron-bg); color: var(--saffron); border: 1px solid var(--saffron-border); font-weight: 800; }
.section-kicker { color: var(--saffron); display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }

/* ════════════════════════════════════════════════════════════
   POST-LOGIN APP SHELL (family tree / moderator)
   ════════════════════════════════════════════════════════════ */
.app-body { background: var(--bg-gray); }
.app-wrap { display: flex; min-height: 100vh; }

/* Sidebar */
.app-sidebar {
    width: 256px;
    flex-shrink: 0;
    background: var(--navy);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: 3px solid var(--saffron);
}
.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.app-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin-bottom: 4px;
    border-radius: 9px;
    color: rgba(255,255,255,.78);
    text-decoration: none;
    font-weight: 600;
    font-size: .92rem;
    transition: background .14s, color .14s;
}
.app-nav-link i { font-size: 1.1rem; width: 22px; text-align: center; flex-shrink: 0; }
.app-nav-link span { flex: 1; }
.app-nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.app-nav-link.active { background: linear-gradient(135deg, var(--saffron), var(--saffron-lt)); color: #fff; box-shadow: 0 4px 14px rgba(229,81,0,.4); }
.app-nav-badge {
    background: #fff; color: var(--saffron);
    font-size: .72rem; font-weight: 900;
    border-radius: 20px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.app-nav-link.active .app-nav-badge { background: rgba(255,255,255,.9); }
.app-sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }

/* Main column */
.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 22px;
    position: sticky; top: 0; z-index: 20;
}
.app-toggle { display: none; background: none; border: none; font-size: 1.5rem; color: var(--navy); padding: 0; }
.app-topbar-title { font-weight: 800; font-size: 1.05rem; color: var(--ink); flex: 1; }
.app-user-chip { display: flex; align-items: center; gap: 10px; }
.app-user-avatar {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--saffron), var(--saffron-lt));
    color: #fff; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 1.1rem; flex-shrink: 0;
}
.app-user-meta strong { display: block; font-size: .88rem; font-weight: 800; line-height: 1.2; color: var(--ink); }
.app-user-meta small  { display: block; font-size: .72rem; color: var(--muted-lt); }
.app-content { flex: 1; padding: 26px 22px; max-width: 1400px; width: 100%; }
.app-foot { padding: 16px 22px; text-align: center; font-size: .8rem; color: var(--muted-lt); border-top: 1px solid var(--line); }

/* Page head */
.app-page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.app-page-head h1 { font-size: 1.5rem; font-weight: 900; color: var(--ink); margin: 0; }
.app-page-head p  { color: var(--muted-lt); margin: 4px 0 0; font-size: .92rem; }
.app-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* App cards */
.app-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
    overflow: hidden;
}
.app-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--bg-warm);
    font-weight: 800; color: var(--ink); font-size: .96rem;
}
.app-card-body { padding: 20px; }
.app-card-body.p-0 { padding: 0; }

/* App stat */
.app-stat {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 4px solid var(--saffron);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
    display: flex; align-items: center; gap: 14px;
    height: 100%;
}
.app-stat-icon {
    width: 46px; height: 46px; border-radius: 11px;
    background: var(--saffron-bg); color: var(--saffron);
    display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0;
}
.app-stat strong { display: block; font-size: 1.7rem; font-weight: 900; line-height: 1.1; color: var(--ink); }
.app-stat span   { font-size: .8rem; color: var(--muted-lt); font-weight: 700; }
.app-stat.tone-green  { border-left-color: var(--green-lt); }
.app-stat.tone-green  .app-stat-icon { background: #E8F5E9; color: var(--green-lt); }
.app-stat.tone-rose   { border-left-color: #C62828; }
.app-stat.tone-rose   .app-stat-icon { background: #FFEBEE; color: #C62828; }
.app-stat.tone-amber  { border-left-color: var(--gold); }
.app-stat.tone-amber  .app-stat-icon { background: #FFF9C4; color: var(--gold); }
.app-stat.tone-teal   { border-left-color: #00838F; }
.app-stat.tone-teal   .app-stat-icon { background: #E0F7FA; color: #00838F; }

/* Quick action tiles */
.quick-tile {
    display: flex; align-items: center; gap: 14px;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; text-decoration: none; color: var(--ink); height: 100%;
    box-shadow: var(--shadow); transition: box-shadow .16s, transform .16s;
}
.quick-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--ink); }
.quick-tile-icon {
    width: 50px; height: 50px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--saffron), var(--saffron-lt)); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.quick-tile strong { display: block; font-size: 1rem; font-weight: 800; }
.quick-tile span   { font-size: .82rem; color: var(--muted-lt); }

/* App tables */
.app-table { margin: 0; }
.app-table thead th { background: var(--bg-warm); color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line); }
.app-table td { vertical-align: middle; }

/* Digital identity */
.identity-mini-card,
.identity-card-print,
.identity-verify-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.identity-mini-head,
.identity-card-top {
    align-items: center;
    background: linear-gradient(135deg, var(--navy), var(--green));
    color: #fff;
    display: flex;
    justify-content: space-between;
    padding: 18px 20px;
}
.identity-mini-head span,
.identity-card-top span,
.identity-verify-kicker {
    color: #FFD180;
    display: block;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.identity-mini-head strong {
    font-size: .9rem;
    font-weight: 900;
}
.identity-mini-body {
    padding: 24px;
    text-align: center;
}
.identity-avatar,
.identity-card-avatar,
.identity-verify-icon {
    align-items: center;
    background: var(--saffron-bg);
    border: 2px solid var(--saffron-border);
    border-radius: 50%;
    color: var(--saffron);
    display: inline-flex;
    font-weight: 900;
    justify-content: center;
}
.identity-avatar {
    font-size: 2rem;
    height: 86px;
    margin-bottom: 14px;
    width: 86px;
}
.identity-mini-body h2 {
    color: var(--ink);
    font-size: 1.15rem;
    font-weight: 900;
    margin: 0 0 4px;
}
.identity-mini-body p {
    color: var(--muted-lt);
    margin-bottom: 16px;
}
.identity-status-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}
.id-status {
    align-items: center;
    border-radius: 999px;
    display: inline-flex;
    font-size: .82rem;
    font-weight: 800;
    gap: 7px;
    justify-content: center;
    padding: 7px 12px;
}
.id-status.ok { background: #E8F5E9; color: var(--green); }
.id-status.wait { background: #FFF8E1; color: #8A5A00; }
.identity-table td:first-child {
    color: var(--saffron);
    font-size: .82rem;
    white-space: nowrap;
}
.identity-card-wrap {
    display: flex;
    justify-content: center;
}
.identity-card-print {
    max-width: 760px;
    width: 100%;
}
.identity-card-top h2 {
    font-size: 1.05rem;
    font-weight: 900;
    margin: 2px 0 0;
}
.identity-card-top i {
    color: #FFD180;
    font-size: 2rem;
}
.identity-card-main {
    align-items: center;
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr 210px;
    padding: 26px;
}
.identity-card-profile {
    align-items: center;
    display: flex;
    gap: 18px;
}
.identity-card-avatar {
    flex: 0 0 92px;
    font-size: 2.2rem;
    height: 92px;
    width: 92px;
}
.identity-card-profile h1 {
    color: var(--ink);
    font-size: 1.45rem;
    font-weight: 900;
    line-height: 1.25;
    margin: 0 0 4px;
}
.identity-card-profile p {
    color: var(--muted-lt);
    font-weight: 700;
    margin: 0 0 8px;
}
.identity-card-profile strong {
    color: var(--saffron);
    display: block;
    font-size: .9rem;
    font-weight: 900;
}
.identity-qr-box {
    align-items: center;
    background: var(--bg-warm);
    border: 1px solid var(--saffron-border);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
}
.identity-qr-box canvas {
    background: #fff;
    border-radius: 6px;
    height: 180px;
    width: 180px;
}
.identity-qr-box a {
    font-size: .78rem;
    font-weight: 800;
    text-decoration: none;
}
.identity-detail-grid {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 1px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    background: var(--line);
}
.identity-detail-grid div {
    background: #fff;
    padding: 14px 18px;
}
.identity-detail-grid span,
.identity-verify-list dt {
    color: var(--muted-lt);
    display: block;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.identity-detail-grid strong,
.identity-verify-list dd {
    color: var(--ink);
    display: block;
    font-size: .92rem;
    font-weight: 800;
    line-height: 1.4;
    margin: 2px 0 0;
    overflow-wrap: anywhere;
}
.identity-card-foot {
    align-items: center;
    background: var(--bg-warm);
    color: var(--muted-lt);
    display: flex;
    font-size: .78rem;
    font-weight: 700;
    justify-content: space-between;
    padding: 12px 18px;
}
.identity-verify-page {
    background: linear-gradient(135deg, var(--navy), var(--saffron-dk));
    min-height: 100vh;
}
.identity-verify-shell {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
.identity-verify-card {
    max-width: 560px;
    padding: 34px;
    text-align: center;
    width: 100%;
}
.identity-verify-icon {
    font-size: 2.4rem;
    height: 88px;
    margin-bottom: 14px;
    width: 88px;
}
.identity-verify-card.is-valid .identity-verify-icon {
    background: #E8F5E9;
    border-color: #A5D6A7;
    color: var(--green);
}
.identity-verify-card.is-invalid .identity-verify-icon {
    background: #FFEBEE;
    border-color: #EF9A9A;
    color: var(--danger);
}
.identity-verify-card h1 {
    color: var(--ink);
    font-size: 1.55rem;
    font-weight: 900;
    margin-bottom: 10px;
}
.identity-verify-card h2 {
    font-size: 1.18rem;
    font-weight: 900;
    margin: 12px 0 18px;
}
.identity-verify-code {
    background: var(--saffron-bg);
    border: 1px solid var(--saffron-border);
    border-radius: 999px;
    color: var(--saffron);
    display: inline-flex;
    font-weight: 900;
    padding: 5px 14px;
}
.identity-verify-list {
    display: grid;
    gap: 1px;
    grid-template-columns: 1fr;
    margin: 0;
    overflow: hidden;
    text-align: left;
}
.identity-verify-list div {
    background: var(--bg-warm);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
}
.identity-verify-note {
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
    border-radius: 8px;
    color: var(--green);
    font-size: .86rem;
    font-weight: 800;
    margin: 16px 0 0;
    padding: 10px 12px;
}

/* PVC community I-card: 86mm x 54mm */
.icard-stage {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-x: auto;
    padding: 8px 0 20px;
}
.samaj-id-card {
    background:
        linear-gradient(135deg, rgba(255,243,224,.92), rgba(255,255,255,.96) 48%, rgba(232,245,233,.92)),
        repeating-linear-gradient(45deg, rgba(229,81,0,.035) 0 2px, transparent 2px 8px);
    border: .35mm solid #C87516;
    border-radius: 3.2mm;
    box-shadow: 0 12px 34px rgba(13,27,42,.18);
    color: #111;
    font-family: 'Noto Sans Devanagari', 'Segoe UI', Arial, sans-serif;
    height: 54mm;
    overflow: hidden;
    padding: 2mm;
    position: relative;
    width: 86mm;
}
.samaj-card-watermark {
    color: rgba(13,27,42,.055);
    font-size: 7.6mm;
    font-weight: 900;
    left: 23mm;
    letter-spacing: .5mm;
    pointer-events: none;
    position: absolute;
    top: 20mm;
    transform: rotate(-18deg);
    white-space: nowrap;
    z-index: 0;
}
.samaj-card-head,
.samaj-card-body,
.samaj-card-foot {
    position: relative;
    z-index: 1;
}
.samaj-card-head {
    align-items: center;
    background: linear-gradient(90deg, #0D1B2A, #1B5E20);
    border-radius: 2mm;
    color: #fff;
    display: grid;
    gap: 1.6mm;
    grid-template-columns: 9mm 1fr 12mm;
    height: 9.4mm;
    padding: .9mm 1.4mm;
}
.samaj-card-logo {
    background: #fff;
    border: .25mm solid rgba(255,255,255,.78);
    border-radius: 50%;
    height: 8mm;
    object-fit: cover;
    width: 8mm;
}
.samaj-card-title strong {
    display: block;
    font-size: 3mm;
    font-weight: 900;
    line-height: 1.05;
}
.samaj-card-title span {
    color: #FFD180;
    display: block;
    font-size: 1.65mm;
    font-weight: 800;
    line-height: 1.05;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.samaj-region-code {
    background: #FFD180;
    border-radius: 1.5mm;
    color: #111;
    font-size: 2.75mm;
    font-weight: 900;
    line-height: 1;
    padding: 1.6mm .7mm;
    text-align: center;
}
.samaj-card-body {
    display: grid;
    gap: 1.7mm;
    grid-template-columns: 18mm 1fr;
    height: 33.1mm;
    padding-top: 1.2mm;
}
.samaj-card-qr {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: .8mm;
}
.samaj-card-qr canvas,
.samaj-qr-img {
    background: #fff;
    border: .25mm solid #222;
    display: block;
    height: 17.2mm;
    object-fit: contain;
    padding: .7mm;
    width: 17.2mm;
}
.samaj-card-qr span {
    background: #111;
    border-radius: 99px;
    color: #fff;
    font-size: 1.55mm;
    font-weight: 900;
    line-height: 1;
    padding: .8mm 1.4mm;
    text-transform: uppercase;
}
.samaj-card-info {
    min-width: 0;
}
.samaj-card-no {
    align-items: center;
    display: flex;
    gap: 1.2mm;
    margin-bottom: .7mm;
}
.samaj-card-no span,
.samaj-card-fields dt,
.samaj-card-foot span {
    color: #6B2D08;
    font-size: 1.45mm;
    font-weight: 900;
    letter-spacing: .02em;
    line-height: 1;
    text-transform: uppercase;
}
.samaj-card-no strong {
    color: #0D1B2A;
    font-size: 2.15mm;
    font-weight: 900;
    line-height: 1;
}
.samaj-card-fields {
    display: flex;
    flex-direction: column;
    gap: .35mm;
    margin: 0;
}
.samaj-card-fields div {
    align-items: baseline;
    display: grid;
    gap: .8mm;
    grid-template-columns: 10.5mm 1fr;
    min-width: 0;
}
.samaj-card-fields div.two {
    grid-template-columns: 7mm 13mm 10mm 1fr;
}
.samaj-card-fields div.three {
    grid-template-columns: 6mm 1fr 9mm 1fr 7mm 1fr;
}
.samaj-card-fields dd {
    color: #111;
    font-size: 1.72mm;
    font-weight: 850;
    line-height: 1.05;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.samaj-card-fields div:first-child dd {
    color: #000;
    font-size: 2.05mm;
    font-weight: 900;
}
.samaj-card-fields div:last-child dd {
    font-size: 1.55mm;
}
.samaj-card-foot {
    align-items: center;
    border-top: .25mm dashed rgba(13,27,42,.25);
    display: grid;
    gap: .8mm;
    grid-template-columns: 16mm 18mm 1fr;
    height: 5.2mm;
    left: 2mm;
    margin-top: 0;
    padding-top: .55mm;
    position: absolute;
    right: 2mm;
    bottom: 1.6mm;
}
.samaj-card-foot div {
    min-width: 0;
}
.samaj-card-foot strong {
    color: #111;
    display: block;
    font-size: 1.75mm;
    font-weight: 900;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.samaj-security {
    background: rgba(255,209,128,.68);
    border: .2mm solid rgba(191,54,12,.35);
    border-radius: 1.4mm;
    padding: .6mm 1mm;
}
.samaj-security strong {
    color: #8A2D00;
    letter-spacing: .12mm;
}
.icard-note {
    color: var(--muted-lt);
    font-size: .84rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
}

/* Mini metric */
.app-mini {
    background: var(--bg-warm); border: 1px solid var(--line); border-radius: 9px; padding: 14px 16px; height: 100%;
}
.app-mini span  { display: block; font-size: .76rem; font-weight: 700; color: var(--muted-lt); }
.app-mini strong { display: block; font-size: 1.45rem; font-weight: 900; color: var(--ink); line-height: 1.2; margin: 3px 0; }
.app-mini small { display: block; font-size: .76rem; color: var(--muted-lt); }

/* Tree board */
.tree-search { width: min(320px, 100%); }
.tree-insight-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tree-insight {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    gap: 14px;
    min-height: 92px;
    padding: 16px 18px;
}
.tree-insight i {
    align-items: center;
    background: var(--saffron-bg);
    border-radius: 11px;
    color: var(--saffron);
    display: flex;
    flex: 0 0 44px;
    font-size: 1.25rem;
    height: 44px;
    justify-content: center;
}
.tree-insight strong { display: block; font-size: .95rem; font-weight: 900; line-height: 1.35; }
.tree-insight span { color: var(--muted-lt); display: block; font-size: .8rem; line-height: 1.45; margin-top: 2px; }
.tree-board { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; overflow-x: auto; }
.pro-tree-board { background: linear-gradient(180deg, #fff 0%, var(--bg-warm) 100%); }
.tree-gen { border-bottom: 1px dashed var(--line); margin-bottom: 22px; padding-bottom: 22px; }
.tree-gen:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.tree-gen-label {
    align-items: center;
    color: var(--saffron);
    display: inline-flex;
    font-size: .78rem;
    font-weight: 900;
    gap: 8px;
    letter-spacing: .06em;
    margin-bottom: 14px;
    text-transform: uppercase;
}
.tree-gen-label::before {
    background: var(--saffron);
    border-radius: 99px;
    content: '';
    height: 8px;
    width: 28px;
}
.tree-row,
.tree-family-row { display: flex; flex-wrap: wrap; gap: 14px; }
.tree-family-card {
    background: rgba(255,255,255,.86);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 8px 30px rgba(13,27,42,.07);
    flex: 0 0 auto;
    min-width: 280px;
    padding: 14px;
}
.tree-person {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid #00838F;
    border-radius: 10px;
    color: var(--ink);
    display: block;
    flex: 0 0 auto;
    min-width: 210px;
    padding: 12px 14px;
    position: relative;
    text-decoration: none;
    transition: box-shadow .16s, opacity .16s, transform .16s;
}
.tree-person:hover { box-shadow: var(--shadow-md); color: var(--ink); transform: translateY(-1px); }
.tree-person.dead { border-left-color: #9E9E9E; background: #fafafa; opacity: .88; }
.tree-person.female { border-left-color: #C2185B; }
.tree-person.connected {
    background: #F7FBFF;
    border-color: #B3E5FC;
    border-left-color: #1565C0;
}
.tree-person.compact {
    min-width: 168px;
    padding: 10px 12px;
}
.tree-person .tp-id {
    color: var(--muted-lt);
    display: block;
    font-size: .68rem;
    font-weight: 900;
    line-height: 1;
    margin-bottom: 5px;
}
.tree-person .tp-name { color: var(--ink); display: block; font-size: .96rem; font-weight: 900; line-height: 1.35; }
.tree-person .tp-meta { color: var(--muted-lt); display: block; font-size: .78rem; margin-top: 3px; }
.tp-statuses {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}
.tree-status {
    border-radius: 999px;
    display: inline-flex;
    font-size: .68rem;
    font-weight: 900;
    line-height: 1;
    padding: 5px 8px;
}
.tree-status.ok { background: #E8F5E9; color: var(--green); }
.tree-status.wait { background: #FFF8E1; color: #8A5A00; }
.tree-status.bad { background: #FFEBEE; color: var(--danger); }
.tree-couple { align-items: stretch; display: flex; gap: 10px; }
.tree-marriage-link {
    align-items: center;
    align-self: center;
    background: #FFEBEE;
    border: 1px solid #FFCDD2;
    border-radius: 99px;
    color: #C2185B;
    display: inline-flex;
    flex: 0 0 34px;
    height: 34px;
    justify-content: center;
}
.tree-child-line {
    background: linear-gradient(90deg, transparent, var(--saffron-border), transparent);
    height: 1px;
    margin: 14px 10% 10px;
}
.tree-children-title {
    color: var(--muted-lt);
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    margin-bottom: 8px;
    text-transform: uppercase;
}
.tree-children-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tree-legend {
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--muted-lt);
    display: flex;
    flex-wrap: wrap;
    font-size: .84rem;
    gap: 14px;
    padding: 14px 18px;
}
.tree-legend span { align-items: center; display: inline-flex; gap: 7px; }
.legend-box {
    border-radius: 4px;
    display: inline-block;
    height: 14px;
    width: 14px;
}
.legend-box.male { background: #00838F; }
.legend-box.female { background: #C2185B; }
.legend-box.dead { background: #9E9E9E; }
.legend-box.connected { background: #1565C0; }
.tree-empty {
    align-items: center;
    color: var(--muted-lt);
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 48px 16px;
    text-align: center;
}
.tree-empty i { color: var(--saffron); font-size: 2.5rem; opacity: .65; }
.tree-empty strong { color: var(--ink); font-size: 1.05rem; }
.tree-dim { opacity: .24 !important; }
.tree-hit { box-shadow: 0 0 0 3px rgba(229,81,0,.22), var(--shadow-md); }

/* Branch based family tree */
.family-tree-board {
    background: #fff;
    min-width: 980px;
}
.tree-root-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.family-branch {
    position: relative;
}
.tree-branch-top {
    align-items: flex-start;
    display: flex;
    gap: 10px;
}
.tree-toggle,
.tree-toggle-spacer {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    margin-top: 20px;
    width: 30px;
}
.tree-toggle {
    background: var(--navy);
    border: 0;
    color: #fff;
    font-size: 1.05rem;
    font-weight: 900;
    line-height: 1;
}
.tree-toggle:hover { background: var(--saffron); }
.tree-external-toggle {
    align-items: center;
    align-self: center;
    background: #fff;
    border: 2px solid var(--saffron);
    border-radius: 50%;
    color: var(--saffron);
    display: inline-flex;
    flex: 0 0 30px;
    font-size: 1.05rem;
    font-weight: 900;
    height: 30px;
    justify-content: center;
    line-height: 1;
    width: 30px;
}
.tree-external-toggle:hover {
    background: var(--saffron);
    color: #fff;
}
.tree-couple-grid {
    align-items: stretch;
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    gap: 10px;
}
.tree-person-card {
    background: #fff;
    border: 1px solid var(--line);
    border-left: 5px solid #00838F;
    border-radius: 8px;
    color: var(--ink);
    display: flex;
    flex: 0 0 calc(25% - 10px);
    flex-direction: column;
    min-height: 154px;
    min-width: 238px;
    padding: 12px 13px;
    position: relative;
    text-decoration: none;
    transition: box-shadow .16s, opacity .16s, transform .16s;
}
.tree-person-card:hover { box-shadow: var(--shadow-md); color: var(--ink); transform: translateY(-1px); }
.tree-person-card.female { border-left-color: #C2185B; }
.tree-person-card.dead { background: #fafafa; border-left-color: #9E9E9E; }
.tree-person-card.connected {
    background: #F7FBFF;
    border-color: #B3E5FC;
    border-left-color: #1565C0;
}
.tree-card-id {
    position: absolute;
    right: 10px;
    top: 8px;
    color: var(--muted-lt);
    font-size: .68rem;
    font-weight: 900;
    line-height: 1;
}
.tree-card-name {
    color: var(--ink);
    display: block;
    font-size: .98rem;
    font-weight: 900;
    line-height: 1.3;
    margin-bottom: 5px;
    padding-right: 42px;
}
.tree-card-line {
    color: var(--muted-lt);
    display: block;
    font-size: .78rem;
    line-height: 1.45;
}
.tree-card-line.muted { opacity: .82; }
.tree-rel-row {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.rel-symbol {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    font-size: .72rem;
    height: 22px;
    justify-content: center;
    width: 22px;
}
.rel-symbol.ok { background: #E8F5E9; color: #1B5E20; }
.rel-symbol.bad { background: #FFEBEE; color: #B71C1C; }
.rel-symbol.wait { background: #FFF8E1; color: #8A5A00; }
.rel-symbol.empty { background: #F1F3F5; color: #9AA0A6; }
.tree-marriage-row {
    background: var(--bg-warm);
    border: 1px solid var(--saffron-border);
    border-radius: 6px;
    color: var(--muted);
    display: block;
    font-size: .78rem;
    line-height: 1.4;
    margin-top: 8px;
    padding: 6px 8px;
}
.tree-link-heart {
    align-items: center;
    align-self: center;
    background: #FFEBEE;
    border: 1px solid #FFCDD2;
    border-radius: 50%;
    color: #C2185B;
    display: inline-flex;
    flex: 0 0 30px;
    height: 30px;
    justify-content: center;
    width: 30px;
}
.tree-children-branches {
    border-left: 2px solid var(--saffron-border);
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-left: 45px;
    margin-top: 14px;
    padding-left: 18px;
}
.tree-children-branches.is-collapsed { display: none; }
.tree-children-branches > .family-branch::before {
    background: var(--saffron-border);
    content: '';
    height: 2px;
    left: -18px;
    position: absolute;
    top: 35px;
    width: 18px;
}
.external-family-panel {
    background: #F7FBFF;
    border: 1px solid #B3E5FC;
    border-left: 4px solid #1565C0;
    border-radius: 8px;
    margin: 12px 0 0 45px;
    padding: 14px;
}
.external-family-panel.is-collapsed { display: none; }
.external-family-head {
    align-items: baseline;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}
.external-family-head span {
    color: #1565C0;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
}
.external-family-head strong {
    color: var(--ink);
    font-size: .9rem;
}
.external-spouse-row {
    border-bottom: 1px dashed #B3E5FC;
    margin-bottom: 12px;
    padding-bottom: 12px;
}
.external-family-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tree-debug-table th,
.tree-debug-table td {
    white-space: nowrap;
}
.tree-debug-table td:nth-child(2),
.tree-debug-table td:nth-child(5),
.tree-debug-table td:nth-child(6),
.tree-debug-table td:nth-child(7) {
    min-width: 180px;
}

/* Proper visual tree: direct family first */
.proper-family-tree {
    align-items: center;
    gap: 34px;
    min-width: max-content;
}
.proper-family-tree .family-branch {
    align-items: center;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    position: relative;
}
.proper-family-tree .tree-branch-top {
    align-items: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 2;
}
.proper-family-tree .tree-toggle,
.proper-family-tree .tree-toggle-spacer {
    margin: 0 0 2px;
}
.proper-family-tree .tree-couple-grid {
    align-items: center;
    background: rgba(255,255,255,.72);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: flex;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 10px;
    justify-content: center;
    padding: 10px;
}
.proper-family-tree .tree-person-card {
    flex: 0 0 250px;
    min-width: 250px;
}
.proper-family-tree .tree-children-branches {
    align-items: flex-start;
    border-left: 0;
    display: flex;
    flex-direction: row;
    gap: 22px;
    justify-content: center;
    margin: 28px 0 0;
    padding: 24px 0 0;
    position: relative;
}
.proper-family-tree .tree-children-branches.is-collapsed { display: none; }
.proper-family-tree .tree-children-branches::before {
    background: var(--saffron-border);
    content: '';
    height: 2px;
    left: 8%;
    position: absolute;
    right: 8%;
    top: 0;
}
.proper-family-tree .tree-children-branches::after {
    background: var(--saffron-border);
    content: '';
    height: 24px;
    left: 50%;
    position: absolute;
    top: -24px;
    width: 2px;
}
.proper-family-tree .tree-children-branches > .family-branch::before {
    background: var(--saffron-border);
    content: '';
    height: 24px;
    left: 50%;
    position: absolute;
    top: -24px;
    width: 2px;
}
.proper-family-tree .direct-tree-children {
    align-items: flex-start;
    display: flex;
    flex-direction: row;
    gap: 22px;
    justify-content: center;
    margin: 28px 0 0;
    padding: 24px 0 0;
    position: relative;
}
.proper-family-tree .direct-tree-children.is-collapsed { display: none; }
.proper-family-tree .direct-tree-children::before {
    background: var(--saffron-border);
    content: '';
    height: 2px;
    left: 8%;
    position: absolute;
    right: 8%;
    top: 0;
}
.proper-family-tree .direct-tree-children::after {
    background: var(--saffron-border);
    content: '';
    height: 24px;
    left: 50%;
    position: absolute;
    top: -24px;
    width: 2px;
}
.proper-family-tree .direct-tree-children > .family-branch::before {
    background: var(--saffron-border);
    content: '';
    height: 24px;
    left: 50%;
    position: absolute;
    top: -24px;
    width: 2px;
}
.proper-family-tree .external-family-panel {
    align-self: stretch;
    margin: 14px 0 0;
    min-width: 560px;
}

/* Auth page (login) */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lt) 55%, var(--saffron-dk) 100%); }
.auth-card { background: #fff; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.3); max-width: 460px; width: 100%; padding: 32px; }

/* ── Responsive ──────────────────── */
@media (max-width: 991.98px) {
    .app-sidebar { position: fixed; top: 0; left: 0; z-index: 1050; transform: translateX(-100%); transition: transform .22s; }
    .app-sidebar.open { transform: translateX(0); }
    .app-toggle { display: block; }
    .app-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1040; display: none; }
    .app-backdrop.show { display: block; }
    .site-hero { min-height: 280px; padding: 30px 24px; }
    .sdg-info-row { grid-template-columns: 1fr; }
    .site-navbar .navbar-nav .nav-link { padding: 10px 14px; border-bottom: none; border-left: 3px solid transparent; }
    .site-navbar .navbar-nav .nav-link.active { border-left-color: var(--saffron-lt); }
    .tree-insight-grid { grid-template-columns: 1fr; }
    .tree-couple { flex-wrap: wrap; }
    .tree-marriage-link { transform: rotate(90deg); }
}
@media (max-width: 575.98px) {
    .site-hero h1 { font-size: 1.6rem; }
    .hero-stats { gap: 16px; }
    .sdg-full-header { padding: 22px 20px 18px; }
    .sdg-full-body { padding: 20px; }
    .tree-board { padding: 14px; }
    .tree-family-card,
    .tree-person { min-width: 100%; }
    .tree-person.compact { min-width: 100%; }
    .proper-family-tree .tree-couple-grid {
        flex-wrap: wrap;
        max-width: calc(100vw - 48px);
    }
    .proper-family-tree .tree-person-card {
        flex-basis: 100%;
        min-width: 220px;
    }
    .proper-family-tree .direct-tree-children,
    .proper-family-tree .tree-children-branches {
        flex-direction: column;
        gap: 18px;
    }
    .proper-family-tree .external-family-panel {
        min-width: 0;
        width: 100%;
    }
    .identity-card-main {
        grid-template-columns: 1fr;
    }
    .identity-card-profile {
        align-items: flex-start;
    }
    .identity-detail-grid {
        grid-template-columns: 1fr;
    }
    .identity-card-foot {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }
    .tree-search { width: 100%; }
}

@media print {
    @page {
        size: 86mm 54mm;
        margin: 0;
    }
    .tree-search,
    .tree-insight-grid,
    .tree-legend,
    .app-page-actions,
    .app-sidebar,
    .app-topbar,
    .app-foot,
    .app-backdrop { display: none !important; }
    .app-main,
    .app-content { padding: 0 !important; max-width: none !important; }
    .tree-board {
        border: 0;
        box-shadow: none;
        overflow: visible;
        padding: 0;
    }
    .tree-family-card {
        box-shadow: none;
        page-break-inside: avoid;
    }
    .identity-card-wrap {
        display: block;
    }
    .identity-card-print {
        border: 1px solid #ddd;
        box-shadow: none;
        max-width: 100%;
        page-break-inside: avoid;
    }
    .identity-card-main {
        grid-template-columns: 1fr 200px;
    }
    .identity-qr-box canvas {
        height: 170px;
        width: 170px;
    }
    .icard-stage {
        align-items: flex-start;
        display: block;
        overflow: visible;
        padding: 0;
    }
    .samaj-id-card {
        border-radius: 3.2mm;
        box-shadow: none;
        height: 54mm;
        margin: 0;
        page-break-after: avoid;
        page-break-inside: avoid;
        width: 86mm;
    }
    .icard-note {
        display: none;
    }
}

/* Life events timeline */
.life-timeline {
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}
.life-event {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    align-items: start;
}
.life-event-icon {
    align-items: center;
    border-radius: 50%;
    display: flex;
    font-size: 1.05rem;
    height: 42px;
    justify-content: center;
    width: 42px;
}
.life-event-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
}
.life-event-card strong {
    color: var(--ink);
    font-size: 1rem;
}
@media (max-width: 575.98px) {
    .life-event {
        grid-template-columns: 34px 1fr;
        gap: 10px;
    }
    .life-event-icon {
        height: 34px;
        width: 34px;
    }
}
