/* =====================================================================
   Wardha Police HCMS — light, modern UI
   One family (Plus Jakarta Sans), soft indigo primary, calm institutional palette.
   ===================================================================== */

:root {
    --bg:        #f6f7fb;
    --surface:   #ffffff;
    --surface-2: #fbfcfe;
    --ink:       #1a1f36;
    --ink-soft:  #5a6178;
    --ink-faint: #9aa0b4;
    --line:      #e9ecf3;
    --line-soft: #f1f3f8;

    --primary:      #4f5bd5;
    --primary-600:  #4048b8;
    --primary-glow: rgba(79, 91, 213, .16);

    --teal:   #0ea5a4;
    --amber:  #e2960b;
    --rose:   #e5484d;
    --green:  #17a673;
    --violet: #7c5cff;

    --radius:    18px;
    --radius-sm: 12px;
    --radius-lg: 26px;
    --shadow-sm: 0 1px 2px rgba(26,31,54,.04), 0 1px 3px rgba(26,31,54,.06);
    --shadow-md: 0 4px 12px rgba(26,31,54,.06), 0 12px 28px rgba(26,31,54,.05);
    --shadow-lg: 0 12px 40px rgba(26,31,54,.10);

    --sidebar-w: 260px;
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

::selection { background: var(--primary-glow); }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w);
    position: fixed;
    inset: 0 auto 0 0;
    background: var(--surface);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    z-index: 40;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 22px 18px;
}
.brand .mark {
    width: 42px; height: 42px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--violet));
    color: #fff;
    display: grid; place-items: center;
    font-weight: 800; font-size: 15px;
    box-shadow: 0 6px 16px var(--primary-glow);
    flex-shrink: 0;
}
.brand .brand-text b { display: block; font-weight: 700; font-size: 15px; letter-spacing: -.01em; }
.brand .brand-text span { font-size: 12px; color: var(--ink-faint); }

.nav { flex: 1; overflow-y: auto; padding: 8px 12px 20px; }
.nav-group { margin-top: 18px; }
.nav-group-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-faint);
    padding: 0 12px 6px;
    letter-spacing: .04em;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 11px;
    color: var(--ink-soft);
    font-weight: 500;
    font-size: 14px;
    transition: background .15s, color .15s;
    margin-bottom: 2px;
}
.nav-link svg { width: 18px; height: 18px; stroke-width: 1.9; flex-shrink: 0; }
.nav-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-link.active {
    background: linear-gradient(100deg, var(--primary-glow), rgba(124,92,255,.08));
    color: var(--primary-600);
    font-weight: 600;
}
.nav-link.active svg { color: var(--primary); }

.nav-foot { padding: 14px; border-top: 1px solid var(--line); }
.logout-btn {
    width: 100%;
    display: flex; align-items: center; gap: 10px;
    background: none; border: 0; cursor: pointer;
    color: var(--ink-soft); font: inherit; font-size: 14px;
    padding: 9px 12px; border-radius: 11px;
    transition: background .15s, color .15s;
}
.logout-btn:hover { background: #fef2f2; color: var(--rose); }
.logout-btn svg { width: 18px; height: 18px; }

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

.topbar {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky; top: 0;
    background: rgba(246,247,251,.82);
    backdrop-filter: saturate(180%) blur(12px);
    z-index: 30;
    border-bottom: 1px solid transparent;
}
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.topbar .sub { font-size: 13px; color: var(--ink-faint); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 18px; }

.bell {
    position: relative;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    transition: border-color .15s, color .15s;
}
.bell:hover { color: var(--primary); border-color: #d9deee; }
.bell svg { width: 19px; height: 19px; }
.bell .dot {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 9px;
    background: var(--rose); color: #fff;
    font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
    border: 2px solid var(--bg);
}

.who { display: flex; align-items: center; gap: 11px; }
.who .meta { text-align: right; line-height: 1.25; }
.who .meta b { font-size: 13.5px; font-weight: 600; display: block; }
.who .meta span { font-size: 12px; color: var(--ink-faint); }
.avatar {
    width: 40px; height: 40px; border-radius: 12px;
    background: linear-gradient(135deg, #eef0fb, #e7ecff);
    color: var(--primary-600);
    display: grid; place-items: center;
    font-weight: 700; font-size: 14px;
    border: 1px solid var(--line);
}

.content { padding: 26px 32px 48px; max-width: 1180px; width: 100%; }

/* ---------- Greeting hero (dashboard) ---------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-lg);
    padding: 30px 32px;
    margin-bottom: 26px;
    color: #fff;
    background:
        radial-gradient(120% 140% at 12% 10%, #6b74e6 0%, transparent 55%),
        radial-gradient(120% 160% at 92% 20%, #8a5cff 0%, transparent 50%),
        linear-gradient(120deg, #4f5bd5, #5b48c9);
    box-shadow: var(--shadow-md);
}
.hero::after {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1px);
    background-size: 18px 18px;
    opacity: .5; pointer-events: none;
}
.hero h2 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; position: relative; }
.hero p { opacity: .82; margin-top: 4px; position: relative; font-size: 14.5px; }
.hero .chips { display: flex; gap: 10px; margin-top: 18px; position: relative; flex-wrap: wrap; }
.hero .chip {
    background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.20);
    padding: 7px 14px; border-radius: 11px;
    font-size: 13px; font-weight: 500;
    display: flex; align-items: center; gap: 7px;
    backdrop-filter: blur(4px);
}

/* ---------- Stat tiles ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 26px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat .ico {
    width: 40px; height: 40px; border-radius: 12px;
    display: grid; place-items: center; margin-bottom: 14px;
}
.stat .ico svg { width: 20px; height: 20px; }
.stat .num { font-size: 27px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.stat .lbl { font-size: 13px; color: var(--ink-soft); margin-top: 5px; font-weight: 500; }
.stat.i-indigo .ico { background: #eef0fd; color: var(--primary); }
.stat.i-teal   .ico { background: #e2f6f5; color: var(--teal); }
.stat.i-amber  .ico { background: #fdf3e0; color: var(--amber); }
.stat.i-rose   .ico { background: #fdecec; color: var(--rose); }
.stat.i-violet .ico { background: #f1ecff; color: var(--violet); }
.stat.i-green  .ico { background: #e4f6ef; color: var(--green); }

/* ---------- Cards & grids ---------- */
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px 0;
}
.card-head h3 { font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; }
.card-head a { font-size: 13px; color: var(--primary); font-weight: 600; }
.card-body { padding: 16px 20px 20px; }

.section-intro { color: var(--ink-soft); font-size: 14px; margin-bottom: 18px; }

/* ---------- Page header row ---------- */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}

/* ---------- List rows ---------- */
.row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 0; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: 0; }
.row .r-title { font-weight: 600; font-size: 14px; }
.row .r-sub { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }

/* ---------- Empty state ---------- */
.empty {
    text-align: center; padding: 40px 20px; color: var(--ink-faint);
}
.empty svg { width: 40px; height: 40px; margin-bottom: 10px; opacity: .5; }
.empty p { font-size: 14px; }

/* ---------- Badges / pills ---------- */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 8px;
    text-transform: capitalize;
}
.pill.gray   { background: #eef0f4; color: #5a6178; }
.pill.green  { background: #e4f6ef; color: #0f7a53; }
.pill.amber  { background: #fdf3e0; color: #a86a07; }
.pill.rose   { background: #fdecec; color: #c0353a; }
.pill.blue   { background: #eaf0fe; color: #3a56c4; }
.pill.teal   { background: #e2f6f5; color: #0b7d7c; }
.pill.violet { background: #f1ecff; color: #6642cc; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
    text-align: left; font-weight: 600; font-size: 12.5px;
    color: var(--ink-faint); padding: 12px 14px;
    border-bottom: 1px solid var(--line); background: var(--surface-2);
}
table.data thead th:first-child { border-top-left-radius: 12px; }
table.data thead th:last-child  { border-top-right-radius: 12px; }
table.data tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data .r-title { font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    font: inherit; font-size: 14px; font-weight: 600;
    padding: 10px 18px; border-radius: 11px;
    border: 1px solid transparent; cursor: pointer;
    transition: transform .06s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary), #5a51cf);
    color: #fff; box-shadow: 0 6px 16px var(--primary-glow);
}
.btn-primary:hover { box-shadow: 0 8px 22px var(--primary-glow); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #d9deee; }
.btn-green { background: var(--green); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-danger-text { background: none; border: 0; color: var(--rose); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.btn-danger-text:hover { text-decoration: underline; }
.btn-link { background: none; border: 0; color: var(--primary); cursor: pointer; font: inherit; font-size: 13px; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

/* ---------- Filter tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
    padding: 8px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
    background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
}
.tab:hover { border-color: #d9deee; color: var(--ink); }
.tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.tab.active.rose { background: var(--rose); border-color: var(--rose); }

/* ---------- Forms ---------- */
.form-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 22px; margin-bottom: 22px;
}
.field { margin-bottom: 4px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
    width: 100%; font: inherit; font-size: 14px;
    padding: 10px 13px; border-radius: 11px;
    border: 1px solid var(--line); background: var(--surface-2);
    color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary);
    background: #fff; box-shadow: 0 0 0 4px var(--primary-glow);
}
.field textarea { resize: vertical; min-height: 70px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { margin-top: 18px; }
.checkbox-line { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); }
.checkbox-line input { width: auto; }

/* ---------- Flash / alerts ---------- */
.flash {
    padding: 13px 16px; border-radius: 12px; margin-bottom: 16px;
    font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px;
    border: 1px solid;
}
.flash svg { width: 18px; height: 18px; flex-shrink: 0; }
.flash.success { background: #e9f8f1; border-color: #bde9d4; color: #0f7a53; }
.flash.error   { background: #fdecec; border-color: #f7c9cb; color: #c0353a; }
.flash.info    { background: #eaf0fe; border-color: #ccdafb; color: #3a56c4; }

/* ---------- Notification list ---------- */
.note {
    display: flex; gap: 14px; padding: 15px 18px;
    border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: var(--surface); margin-bottom: 10px;
    border-left: 4px solid var(--ink-faint);
}
.note.info     { border-left-color: var(--primary); }
.note.warning  { border-left-color: var(--amber); }
.note.critical { border-left-color: var(--rose); }
.note.read { opacity: .58; }
.note .n-body { flex: 1; }
.note .n-title { font-weight: 650; font-size: 14px; }
.note .n-msg { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }
.note .n-time { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

/* ---------- Cards for people / documents ---------- */
.tile {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 18px;
}
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tile .person-av {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center; font-weight: 700; font-size: 15px;
    background: linear-gradient(135deg, #f1ecff, #e7ecff); color: var(--violet);
}
.tile .doc-ic {
    width: 46px; height: 46px; border-radius: 13px;
    display: grid; place-items: center;
    background: #eef0fd; color: var(--primary);
}
.tile .doc-ic svg { width: 22px; height: 22px; }

/* ---------- Metric mini ---------- */
.metric-strip { display: flex; gap: 26px; padding: 4px 2px 18px; }
.metric-strip .m b { font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.metric-strip .m span { font-size: 12.5px; color: var(--ink-faint); display: block; }

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 36px; height: 36px; padding: 0 10px;
    display: grid; place-items: center; border-radius: 10px;
    font-size: 13.5px; font-weight: 600;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
}
.pager a:hover { border-color: #d9deee; color: var(--ink); }
.pager .cur { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Inline form (compliance complete) ---------- */
.inline-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.inline-form .field { margin: 0; }

/* ---------- Utility ---------- */
.mt-0 { margin-top: 0; }
.muted { color: var(--ink-faint); }
.hidden { display: none; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.gap-actions { display: flex; gap: 12px; align-items: center; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .stats { grid-template-columns: 1fr 1fr; }
    .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
    .form-grid, .form-grid.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    /* Sidebar becomes an off-screen slide-in drawer (keep a real width!) */
    .sidebar {
        width: 270px;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.2,.8,.2,1);
        box-shadow: 0 0 40px rgba(0,0,0,.18);
        z-index: 90;
    }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: grid !important; }
    .content { padding: 20px 18px 40px; }
    .topbar { padding: 0 18px; }
    .stats { grid-template-columns: 1fr 1fr; }

    /* Dark backdrop shown behind the open drawer */
    .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 80;
        background: rgba(15,18,30,.5);
        backdrop-filter: blur(2px);
        opacity: 0; pointer-events: none; transition: opacity .28s;
    }
    .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
}

.menu-toggle {
    display: none;
    width: 40px; height: 40px; border-radius: 11px;
    background: var(--surface); border: 1px solid var(--line);
    place-items: center; cursor: pointer; color: var(--ink); margin-right: 4px;
}
.menu-toggle svg { width: 20px; height: 20px; }

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* =====================================================================
   ANDROID / MATERIAL REFRESH  (added layer — enhances, doesn't replace)
   ===================================================================== */

/* Smooth momentum scroll + no chin on mobile */
html { scroll-behavior: smooth; }
body { overscroll-behavior-y: none; }

/* ---------- Clickable gradient KPI cards ---------- */
.kpis {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.kpi {
    position: relative;
    border: 0;
    border-radius: 22px;
    padding: 20px;
    color: #fff;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 10px 24px -8px rgba(26,31,54,.35);
    transition: transform .16s cubic-bezier(.2,.8,.2,1), box-shadow .16s;
    -webkit-tap-highlight-color: transparent;
}
.kpi:hover { transform: translateY(-3px); box-shadow: 0 16px 30px -8px rgba(26,31,54,.42); }
.kpi:active { transform: translateY(-1px) scale(.985); }
.kpi::after { /* soft sheen */
    content:""; position:absolute; inset:0; z-index:-1;
    background: radial-gradient(120% 120% at 85% 15%, rgba(255,255,255,.28), transparent 55%);
}
.kpi .kpi-ic {
    width: 42px; height: 42px; border-radius: 13px;
    background: rgba(255,255,255,.22);
    display: grid; place-items: center; margin-bottom: 14px;
    backdrop-filter: blur(3px);
}
.kpi .kpi-ic svg { width: 21px; height: 21px; stroke-width: 2; }
.kpi .kpi-num { font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi .kpi-lbl { font-size: 13px; font-weight: 500; opacity: .95; margin-top: 5px; }
.kpi .kpi-more {
    position: absolute; top: 18px; right: 16px;
    font-size: 11px; font-weight: 600; opacity: .8;
    display: flex; align-items: center; gap: 3px;
}
.kpi .kpi-more svg { width: 13px; height: 13px; }

/* Gradient themes */
.g-indigo { background: linear-gradient(135deg,#5b6cf5,#7c4dff); }
.g-teal   { background: linear-gradient(135deg,#0ea5a4,#12c2b4); }
.g-amber  { background: linear-gradient(135deg,#f5a623,#f7752b); }
.g-rose   { background: linear-gradient(135deg,#f5576c,#f0355b); }
.g-violet { background: linear-gradient(135deg,#8b5cf6,#c04df0); }
.g-green  { background: linear-gradient(135deg,#17a673,#0fb488); }
.g-blue   { background: linear-gradient(135deg,#3b82f6,#4f6ef7); }
.g-slate  { background: linear-gradient(135deg,#5a6178,#3f465e); }

/* Ripple */
.ripple { position: absolute; border-radius: 50%; transform: scale(0);
    background: rgba(255,255,255,.45); animation: rip .55s ease-out; pointer-events: none; z-index: 0; }
@keyframes rip { to { transform: scale(3.2); opacity: 0; } }

/* ---------- Modal (KPI drill-down) ---------- */
.modal-scrim {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(20,24,40,.48);
    backdrop-filter: blur(3px);
    display: flex; align-items: flex-end; justify-content: center;
    opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-scrim.open { opacity: 1; pointer-events: auto; }
.modal {
    background: var(--surface);
    width: 100%; max-width: 640px;
    max-height: 86vh;
    border-radius: 26px 26px 0 0;
    display: flex; flex-direction: column;
    transform: translateY(24px); transition: transform .26s cubic-bezier(.2,.85,.25,1);
    box-shadow: 0 -10px 50px rgba(0,0,0,.25);
}
.modal-scrim.open .modal { transform: translateY(0); }
@media (min-width: 700px) {
    .modal-scrim { align-items: center; }
    .modal { border-radius: 24px; transform: translateY(12px) scale(.98); }
}
.modal-grab { width: 40px; height: 4px; border-radius: 3px; background: var(--line);
    margin: 10px auto 0; flex-shrink: 0; }
.modal-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft); flex-shrink: 0;
}
.modal-head .mh-ic { width: 40px; height: 40px; border-radius: 12px; display:grid; place-items:center; color:#fff; flex-shrink:0; }
.modal-head h3 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.modal-head .mh-sub { font-size: 12.5px; color: var(--ink-faint); }
.modal-close {
    margin-left: auto; width: 34px; height: 34px; border-radius: 10px; border: 0;
    background: var(--surface-2); color: var(--ink-soft); cursor: pointer;
    display: grid; place-items: center; font-size: 18px;
}
.modal-close:hover { background: #eceef4; color: var(--ink); }
.modal-body { padding: 8px 12px 20px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.modal-loading { padding: 40px; text-align: center; color: var(--ink-faint); font-size: 14px; }
.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--primary);
    border-radius: 50%; animation: spin .7s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* List rows inside modal */
.mlist { display: flex; flex-direction: column; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 13px 12px; border-radius: 14px; }
.mrow:hover { background: var(--surface-2); }
.mrow + .mrow { border-top: 1px solid var(--line-soft); border-radius: 0; }
.mrow .mav { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: 14px;
    background: linear-gradient(135deg,#eef0fb,#e7ecff); color: var(--primary-600); }
.mrow .mmain { flex: 1; min-width: 0; }
.mrow .mtitle { font-weight: 650; font-size: 14px; }
.mrow .msub { font-size: 12.5px; color: var(--ink-faint); margin-top: 1px; }
.mrow .mend { text-align: right; flex-shrink: 0; }

/* ---------- Mobile bottom navigation ---------- */
.bottom-nav { display: none; }
.bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: linear-gradient(135deg, #4f5bd5, #6a4df0);
    border-top: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    grid-template-columns: repeat(5, 1fr); gap: 4px;
    box-shadow: 0 -6px 24px -6px rgba(26,31,54,.35);
}
.bn-item {
    position: relative;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 4px; border-radius: 14px;
    color: rgba(255,255,255,.72);
    font-size: 10.5px; font-weight: 600;
    -webkit-tap-highlight-color: transparent;
    transition: color .15s, background .15s, transform .12s;
}
.bn-item svg { width: 22px; height: 22px; stroke-width: 2; transition: transform .15s; }
.bn-item:active { transform: scale(.92); }
.bn-item.active {
    color: #fff;
    background: rgba(255,255,255,.20);
    backdrop-filter: blur(4px);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.bn-item.active svg { color: #fff; transform: translateY(-1px); }

/* FAB (mobile quick action) */
.fab {
    display: none;
    position: fixed; right: 18px; bottom: 78px; z-index: 55;
    width: 56px; height: 56px; border-radius: 18px; border: 0; cursor: pointer;
    background: linear-gradient(135deg,var(--primary),#7c4dff); color: #fff;
    box-shadow: 0 10px 24px -6px rgba(79,91,213,.6);
    place-items: center;
}
.fab svg { width: 26px; height: 26px; }

/* ---------- Card entrance animation ---------- */
.rise { animation: rise .4s cubic-bezier(.2,.8,.2,1) both; }
.rise-2 { animation-delay: .06s; }
.rise-3 { animation-delay: .12s; }
.rise-4 { animation-delay: .18s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Extra mobile polish ---------- */
@media (max-width: 720px) {
    .kpis { grid-template-columns: 1fr 1fr; gap: 12px; }
    .kpi { padding: 16px; border-radius: 18px; }
    .kpi .kpi-num { font-size: 25px; }
    .bottom-nav { display: grid; }
    .fab { display: grid; }
    .content { padding-bottom: 96px !important; }  /* clear bottom-nav */
    .hero { padding: 22px 20px; border-radius: 22px; }
    .hero h2 { font-size: 20px; }
    .card { border-radius: 18px; }
    .topbar h1 { font-size: 17px; }
    .who .meta { display: none; }  /* keep just avatar on small screens */
    table.data { font-size: 13px; }
    table.data thead th, table.data tbody td { padding: 10px 10px; }
}
@media (max-width: 400px) {
    .kpis { grid-template-columns: 1fr 1fr; }
}

/* Larger tap targets on touch devices */
@media (hover: none) {
    .btn, .nav-link, .tab, .bn-item { min-height: 42px; }
}

/* ---------- Timeline (person profile) ---------- */
.tl { position: relative; padding-left: 8px; margin-bottom: 10px; }
.tl-item { position: relative; display: flex; gap: 14px; padding: 6px 0 14px; }
.tl-item::before { /* vertical line */
    content: ""; position: absolute; left: 19px; top: 40px; bottom: -6px;
    width: 2px; background: var(--line);
}
.tl-item:last-child::before { display: none; }
.tl-dot {
    width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
    display: grid; place-items: center; color: #fff; z-index: 1;
    box-shadow: 0 4px 10px -3px rgba(26,31,54,.4);
}
.tl-dot svg { width: 19px; height: 19px; stroke-width: 2; }
.tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.tl-title { font-weight: 650; font-size: 14.5px; letter-spacing: -.01em; }
.tl-desc { font-size: 13.5px; color: var(--ink-soft); margin-top: 2px; }
.tl-date { font-size: 12px; color: var(--ink-faint); margin-top: 4px; }

/* clickable names inside modal rows */
.mrow.clickable { cursor: pointer; }
.mrow.clickable:hover { background: var(--surface-2); }
.mrow .mgo { color: var(--ink-faint); flex-shrink: 0; }
.mrow .mgo svg { width: 18px; height: 18px; }

/* ---------- Gallery ---------- */
.gal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.gal-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); transition: transform .16s, box-shadow .16s; }
.gal-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.gal-thumb { position: relative; aspect-ratio: 16/9; background: #0a0a12; overflow: hidden; }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-thumb .play {
    position: absolute; inset: 0; display: grid; place-items: center;
    background: rgba(0,0,0,.28); color: #fff; transition: background .15s;
}
.gal-thumb .play:hover { background: rgba(0,0,0,.12); }
.gal-thumb .play svg { width: 54px; height: 54px; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.gal-meta { padding: 13px 15px; }
.gal-meta .gt { font-weight: 650; font-size: 14px; }
.gal-meta .gd { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; }
.gal-cat { display:inline-block; margin-top:8px; }
@media (max-width: 900px) { .gal-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .gal-grid { grid-template-columns: 1fr; } }

/* Video lightbox */
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.82); display: none; align-items: center; justify-content: center; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox .lb-inner { width: 100%; max-width: 900px; }
.lightbox .lb-frame { position: relative; aspect-ratio: 16/9; background: #000; border-radius: 16px; overflow: hidden; }
.lightbox iframe, .lightbox img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; }
.lightbox .lb-close { position: absolute; top: -44px; right: 0; background: rgba(255,255,255,.15); color: #fff; border: 0; width: 38px; height: 38px; border-radius: 11px; cursor: pointer; font-size: 20px; }

/* ---------- Broadcast popup on dashboard ---------- */
.bc-card { display: flex; gap: 14px; align-items: flex-start; padding: 4px 2px; }
.bc-ic { width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0; display: grid; place-items: center; color: #fff; }
.bc-ic svg { width: 22px; height: 22px; }
.bc-count { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.lang-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 3px; }
.lang-toggle button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 8px; cursor: pointer; color: var(--ink-soft); }
.lang-toggle button.active { background: var(--primary); color: #fff; }

/* ---------- Topbar search ---------- */
.topbar-search { position: relative; display: flex; align-items: center; }
.topbar-search svg { position: absolute; left: 12px; width: 17px; height: 17px; color: var(--ink-faint); pointer-events: none; }
.topbar-search input {
    width: 230px; font: inherit; font-size: 14px;
    padding: 9px 14px 9px 36px; border-radius: 12px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
    transition: width .2s, border-color .15s, box-shadow .15s, background .15s;
}
.topbar-search input:focus { outline: none; width: 280px; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--primary-glow); }
@media (max-width: 900px) { .topbar-search { display: none; } }

/* ---------- Charts (inline SVG) ---------- */
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 14px; }
.chart-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-soft); }
.chart-legend .sw { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.bar-row .bl { width: 120px; font-size: 13px; color: var(--ink-soft); flex-shrink: 0; text-align: right; }
.bar-track { flex: 1; height: 26px; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; }
.bar-fill { height: 100%; border-radius: 8px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; color: #fff; font-size: 12px; font-weight: 700; min-width: 26px; transition: width .5s cubic-bezier(.2,.8,.2,1); }
