/* ==========================================================================
   FORENSIC UI -- CDR Analyzer global design system
   --------------------------------------------------------------------------
   Yeh file poore software ka wahid design system hai. Har safha AdminLTE aur
   Bootstrap ke wahi classes istemal karta hai jo pehle karta tha -- yahan sirf
   un ka roop badla gaya hai. Koi PHP, koi query, koi route, koi form field
   yahan se nahi badalta.

   Load hone ki tarteeb (includes/headerPaths.php):
       bootstrap-icons -> font-awesome -> adminlte -> datatables -> leaflet
       -> forensic-ui.css   <-- sab ke baad, taake tokens aakhri lafz hon

   Theme:
       koi attribute nahi          = DARK   (default, intelligence console)
       <html data-theme="light">   = LIGHT
       <html data-theme="dark">    = DARK  (sarahatan)
   appTheme localStorage key wahi hai jo headerPaths.php ka anti-flash script
   pehle se parhta hai -- is liye toggle us ke saath khud-ba-khud chalta hai.

   TARTEEB
     01  Tokens
     02  Base + typography
     03  App shell (sidebar / topbar / content / footer)
     04  Page head + case context
     05  Cards
     06  KPI + stat tiles
     07  Buttons
     08  Forms + filters
     09  Tables + DataTables
     10  Badges + chips
     11  Alerts + toasts
     12  Modals + SweetAlert2 + dropdowns + tabs
     13  Upload / dropzone
     14  Empty / loading / error states
     15  Charts + maps + sliders
     16  Utilities
     17  Responsive
     18  Print (reports)
   ========================================================================== */


/* ==========================================================================
   01  TOKENS
   ========================================================================== */

:root {
    /* ---- ground: deep desaturated navy, never pure black ---- */
    --fx-bg:            #0a0e15;
    --fx-bg-2:          #0e131d;
    --fx-surface:       #131a26;
    --fx-surface-2:     #18202e;
    --fx-surface-3:     #1e2837;
    --fx-elevated:      #212c3d;

    /* ---- lines ---- */
    --fx-border:        #253044;
    --fx-border-soft:   #1b2432;
    --fx-border-strong: #33415a;

    /* ---- text ---- */
    --fx-text:          #e8edf5;
    --fx-text-2:        #b6c2d4;
    --fx-text-muted:    #8b98ad;   /* 5.9:1 on --fx-surface */
    --fx-text-faint:    #8794a8;   /* >=4.5:1 --fx-ink-2 jaise gehre panel par bhi */
    --fx-text-invert:   #0a0e15;

    /* ---- brand ---- */
    --fx-primary:        #3d8bfd;
    --fx-primary-strong: #5c9dff;
    --fx-primary-deep:   #1f5fc4;
    --fx-primary-fg:     #ffffff;
    --fx-primary-soft:   rgba(61,139,253,.14);
    --fx-primary-line:   rgba(61,139,253,.35);
    --fx-primary-glow:   rgba(61,139,253,.30);

    /* ---- signal amber: intelligence, leads, "look here" ---- */
    --fx-signal:         #f0a92e;
    --fx-signal-strong:  #ffc25c;
    --fx-signal-fg:      #241a05;
    --fx-signal-soft:    rgba(240,169,46,.14);
    --fx-signal-line:    rgba(240,169,46,.34);

    /* ---- semantic ---- */
    --fx-danger:        #f2555a;  --fx-danger-strong: #ff787c;
    --fx-danger-soft:   rgba(242,85,90,.14);   --fx-danger-line: rgba(242,85,90,.34);
    --fx-warning:       #e8a33d;  --fx-warning-strong:#ffbe5e;
    --fx-warning-soft:  rgba(232,163,61,.14);  --fx-warning-line: rgba(232,163,61,.34);
    --fx-success:       #3fb950;  --fx-success-strong:#5fd46f;
    --fx-success-soft:  rgba(63,185,80,.14);   --fx-success-line: rgba(63,185,80,.34);
    --fx-info:          #39c5cf;  --fx-info-strong:   #5fe0e8;
    --fx-info-soft:     rgba(57,197,207,.14);  --fx-info-line:    rgba(57,197,207,.32);
    --fx-violet:        #a371f7;  --fx-violet-soft:   rgba(163,113,247,.14);
    --fx-violet-line:   rgba(163,113,247,.32);
    --fx-neutral-soft:  rgba(125,139,161,.14); --fx-neutral-line: rgba(125,139,161,.30);

    /* ---- bhare hue accent par matn ka rang ----
       Dark theme mein accent raushan hote hain: un par safed matn 2.5:1 par
       aa jata hai. Is liye gehra matn. Light theme mein iska ulta. ---- */
    --fx-on-primary: #051023;
    --fx-on-success: #04170a;
    --fx-on-danger:  #23060a;
    --fx-on-warning: #1a1200;
    --fx-on-info:    #04191b;
    --fx-on-violet:  #150829;
    --fx-on-signal:  #241a05;

    /* ---- fixed ink: stays dark in BOTH themes (avatars, brand chips) ---- */
    --fx-ink:           #0f172a;
    --fx-ink-2:         #1e293b;
    --fx-on-ink:        #f1f5f9;

    /* ---- risk ramp: one meaning, one colour, everywhere ---- */
    --fx-risk-critical: var(--fx-danger);
    --fx-risk-high:     #f0883e;
    --fx-risk-medium:   var(--fx-warning);
    --fx-risk-low:      var(--fx-success);
    --fx-risk-none:     var(--fx-text-muted);

    /* ---- data-visualisation series (dark-legible, distinct in order) ---- */
    --fx-viz-1: #3d8bfd;  --fx-viz-2: #f0a92e;  --fx-viz-3: #39c5cf;
    --fx-viz-4: #a371f7;  --fx-viz-5: #3fb950;  --fx-viz-6: #f2555a;
    --fx-viz-7: #64b5f6;  --fx-viz-8: #ff9e64;
    --fx-grid:  rgba(125,139,161,.16);

    /* ---- elevation ---- */
    --fx-shadow-1: 0 1px 2px rgba(0,0,0,.40);
    --fx-shadow-2: 0 2px 4px rgba(0,0,0,.35), 0 8px 20px -12px rgba(0,0,0,.70);
    --fx-shadow-3: 0 4px 10px rgba(0,0,0,.40), 0 20px 48px -24px rgba(0,0,0,.85);
    --fx-ring:     0 0 0 3px var(--fx-primary-soft);

    /* ---- geometry: three radii, no more ---- */
    --fx-r-sm: 6px;
    --fx-r:    10px;
    --fx-r-lg: 14px;
    --fx-r-pill: 999px;

    /* ---- spacing scale ---- */
    --fx-s1: 4px;  --fx-s2: 8px;  --fx-s3: 12px; --fx-s4: 16px;
    --fx-s5: 20px; --fx-s6: 24px; --fx-s7: 32px; --fx-s8: 44px;

    /* ---- type ---- */
    --fx-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --fx-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;

    --fx-t-hero:    1.65rem;
    --fx-t-title:   1.22rem;
    --fx-t-section: 1.02rem;
    --fx-t-card:    .94rem;
    --fx-t-body:    .875rem;
    --fx-t-sm:      .8rem;
    --fx-t-xs:      .74rem;
    --fx-t-micro:   .68rem;

    /* ---- motion ---- */
    --fx-fast: 120ms cubic-bezier(.4,0,.2,1);
    --fx-mid:  200ms cubic-bezier(.4,0,.2,1);

    /* ---- shell metrics ---- */
    --fx-sidebar-w: 254px;
    --fx-topbar-h:  58px;

    color-scheme: dark;
}

/* -------------------------------------------------------------------------
   LIGHT THEME -- sirf tokens badalte hain, ek bhi component rule nahi.
   ------------------------------------------------------------------------- */
:root[data-theme="light"] {
    --fx-bg:            #eef1f6;
    --fx-bg-2:          #f4f6fa;
    --fx-surface:       #ffffff;
    --fx-surface-2:     #f7f9fc;
    --fx-surface-3:     #eef2f7;
    --fx-elevated:      #ffffff;

    --fx-border:        #dde3ec;
    --fx-border-soft:   #e8edf3;
    --fx-border-strong: #c3ccda;

    --fx-text:          #101827;
    --fx-text-2:        #384457;
    --fx-text-muted:    #55637a;   /* 4.9:1 --fx-bg par */
    --fx-text-faint:    #5f6e84;   /* 4.6:1 -- light theme mein bhi parhne ke qabil */
    --fx-text-invert:   #ffffff;

    --fx-primary:        #1f6feb;
    --fx-primary-strong: #1259c7;
    --fx-primary-deep:   #0d47a1;
    --fx-primary-fg:     #ffffff;
    --fx-primary-soft:   rgba(31,111,235,.09);
    --fx-primary-line:   rgba(31,111,235,.28);
    --fx-primary-glow:   rgba(31,111,235,.22);

    --fx-signal:         #b46e07;
    --fx-signal-strong:  #8f5605;
    --fx-signal-fg:      #ffffff;
    --fx-signal-soft:    rgba(180,110,7,.10);
    --fx-signal-line:    rgba(180,110,7,.28);

    --fx-danger:  #d1242f;  --fx-danger-strong: #a40e19;
    --fx-danger-soft: rgba(209,36,47,.09);  --fx-danger-line: rgba(209,36,47,.26);
    --fx-warning: #b25e00;  --fx-warning-strong:#8c4a00;
    --fx-warning-soft: rgba(178,94,0,.10);  --fx-warning-line: rgba(178,94,0,.26);
    --fx-success: #1a7f37;  --fx-success-strong:#116329;
    --fx-success-soft: rgba(26,127,55,.09); --fx-success-line: rgba(26,127,55,.26);
    --fx-info:    #0e7c86;  --fx-info-strong:   #0a5d65;
    --fx-info-soft: rgba(14,124,134,.09);   --fx-info-line:   rgba(14,124,134,.26);
    --fx-violet:  #7c3aed;
    --fx-violet-soft: rgba(124,58,237,.09); --fx-violet-line: rgba(124,58,237,.26);
    --fx-neutral-soft: rgba(100,116,139,.10); --fx-neutral-line: rgba(100,116,139,.24);

    --fx-risk-high: #b04e08;   /* >=4.5:1 chhote matn ke liye bhi */

    --fx-viz-1: #1f6feb;  --fx-viz-2: #b46e07;  --fx-viz-3: #0e7c86;
    --fx-viz-4: #7c3aed;  --fx-viz-5: #1a7f37;  --fx-viz-6: #d1242f;
    --fx-viz-7: #2e7fd4;  --fx-viz-8: #c2570c;
    --fx-grid:  rgba(100,116,139,.16);

    --fx-on-primary: #ffffff; --fx-on-success: #ffffff; --fx-on-danger: #ffffff;
    --fx-on-warning: #ffffff; --fx-on-info: #ffffff; --fx-on-violet: #ffffff;
    --fx-on-signal:  #ffffff;

    --fx-shadow-1: 0 1px 2px rgba(16,24,39,.06);
    --fx-shadow-2: 0 1px 2px rgba(16,24,39,.06), 0 8px 20px -14px rgba(16,24,39,.35);
    --fx-shadow-3: 0 2px 6px rgba(16,24,39,.08), 0 22px 48px -26px rgba(16,24,39,.45);

    color-scheme: light;
}


/* ==========================================================================
   02  BASE + TYPOGRAPHY
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

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

body,
body.bg-body-tertiary,
body.layout-fixed {
    font-family: var(--fx-font);
    font-size: var(--fx-t-body);
    line-height: 1.5;
    color: var(--fx-text);
    background-color: var(--fx-bg) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02','cv03','cv04','ss01';
}

/* Bootstrap ke apne surface variables -- taake koi bhi bhoola hua
   bg-body / bg-white / text-dark bhi theme ke saath chale. */
body, .app-wrapper {
    --bs-body-bg:        var(--fx-bg);
    --bs-body-color:     var(--fx-text);
    --bs-secondary-bg:   var(--fx-surface-2);
    --bs-tertiary-bg:    var(--fx-surface-2);
    --bs-emphasis-color: var(--fx-text);
    --bs-border-color:   var(--fx-border);
    --bs-heading-color:  var(--fx-text);
    --bs-link-color:     var(--fx-primary);
    --bs-link-hover-color: var(--fx-primary-strong);
    --bs-primary:        var(--fx-primary);
    --bs-primary-rgb:    61,139,253;
    --bs-font-sans-serif: var(--fx-font);
}

h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6 {
    color: var(--fx-text);
    font-weight: 700;
    letter-spacing: -.011em;
    text-wrap: balance;
}
h1,.h1 { font-size: var(--fx-t-hero); }
h2,.h2 { font-size: var(--fx-t-title); }
h3,.h3 { font-size: var(--fx-t-title); }
h4,.h4 { font-size: var(--fx-t-section); }
h5,.h5 { font-size: var(--fx-t-card); }
h6,.h6 { font-size: var(--fx-t-sm); }

a { color: var(--fx-primary); text-decoration: none; transition: color var(--fx-fast); }
a:hover { color: var(--fx-primary-strong); }

hr, .dropdown-divider { border-color: var(--fx-border); opacity: 1; }

::selection { background: var(--fx-primary-soft); color: var(--fx-text); }

/* Forensic identifiers -- numbers, IMEI, cell IDs, CNIC. Ek investigator
   in ko hindse-ba-hindse parhta hai, is liye monospace: badla hua ya ulta
   hua digit nazar aa jata hai. */
.fx-id, .fx-mono, code, kbd, samp, pre,
.badge-number, .badge-target, .badge-bparty {
    font-family: var(--fx-mono);
    font-variant-ligatures: none;
    letter-spacing: -.01em;
}

/* Har jagah jahan hindse column mein aate hain */
td.text-end, .fx-num, .fx-tabular { font-variant-numeric: tabular-nums; }

/* Chhoti CAPS label -- section eyebrow, table sar, KPI label */
.fx-eyebrow {
    font-family: var(--fx-mono);
    font-size: var(--fx-t-micro);
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--fx-text-muted);
    font-weight: 500;
}

.text-muted, .small.text-muted { color: var(--fx-text-muted) !important; }
.text-dark  { color: var(--fx-text) !important; }
.text-body  { color: var(--fx-text-2) !important; }
.text-white { color: #ffffff !important; }

/* Scrollbars -- theme ke andar rehte hain */
* { scrollbar-width: thin; scrollbar-color: var(--fx-border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--fx-border-strong);
    border-radius: var(--fx-r-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--fx-text-faint); background-clip: content-box; }

/* Keyboard focus -- har jagah dikhna chahiye */
:where(a, button, input, select, textarea, [tabindex], .btn, .nav-link, .page-link):focus-visible {
    outline: 2px solid var(--fx-primary);
    outline-offset: 2px;
    border-radius: var(--fx-r-sm);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}


/* ==========================================================================
   03  APP SHELL
   ========================================================================== */

.app-wrapper { background: var(--fx-bg); min-height: 100vh; }

/* ---------- Sidebar ---------- */
.app-sidebar {
    background: var(--fx-bg-2) !important;
    border-right: 1px solid var(--fx-border);
    box-shadow: none !important;
    width: var(--fx-sidebar-w);
}
:root[data-theme="light"] .app-sidebar {
    background: #0d1420 !important;   /* sidebar dono theme mein dark rehta hai */
    border-right-color: #1b2432;
}

.app-sidebar .sidebar-brand {
    border-bottom: 1px solid rgba(255,255,255,.07);
    height: var(--fx-topbar-h);
    display: flex;
    align-items: center;
    padding: 0 var(--fx-s4);
}
.app-sidebar .brand-link {
    display: flex; align-items: center; gap: 10px;
    color: #f1f5f9; font-weight: 700; letter-spacing: -.01em;
    font-size: .95rem; padding: 0; white-space: nowrap;
}
.app-sidebar .brand-mark {
    width: 30px; height: 30px; flex: 0 0 30px;
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, var(--fx-primary) 0%, var(--fx-primary-deep) 100%);
    color: #fff; font-size: .82rem;
    box-shadow: 0 2px 10px -2px var(--fx-primary-glow);
}
.app-sidebar .brand-text small {
    display: block; font-size: .62rem; font-weight: 500;
    letter-spacing: .12em; text-transform: uppercase;
    color: rgba(241,245,249,.45); margin-top: 1px;
    font-family: var(--fx-mono);
}

.app-sidebar .sidebar-wrapper { padding-bottom: var(--fx-s4); }

.app-sidebar .nav-header {
    color: rgba(241,245,249,.38);
    font-family: var(--fx-mono);
    font-size: var(--fx-t-micro);
    letter-spacing: .13em;
    text-transform: uppercase;
    font-weight: 500;
    padding: var(--fx-s5) var(--fx-s4) var(--fx-s2);
    margin: 0;
}

.app-sidebar .nav-link {
    position: relative;
    display: flex; align-items: center; gap: 10px;
    margin: 1px var(--fx-s2);
    padding: 8px 10px;
    border-radius: var(--fx-r-sm);
    color: rgba(241,245,249,.72);
    font-size: var(--fx-t-body);
    font-weight: 500;
    transition: background var(--fx-fast), color var(--fx-fast);
}
.app-sidebar .nav-link p { margin: 0; }
.app-sidebar .nav-link .nav-icon {
    width: 20px; flex: 0 0 20px; text-align: center;
    font-size: .95rem; opacity: .85;
}
.app-sidebar .nav-link:hover {
    background: rgba(255,255,255,.06);
    color: #ffffff;
}
.app-sidebar .nav-link.active {
    background: var(--fx-primary-soft);
    color: #ffffff;
    font-weight: 600;
}
.app-sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px;
    width: 3px; border-radius: 0 3px 3px 0;
    background: var(--fx-primary);
}
.app-sidebar .nav-link.active .nav-icon { opacity: 1; color: var(--fx-primary-strong); }
.app-sidebar .nav-link.text-danger { color: rgba(242,85,90,.85) !important; }
.app-sidebar .nav-link.text-danger:hover {
    background: rgba(242,85,90,.12); color: #ff9b9e !important;
}

/* Sidebar ke andar chhota status khana */
.fx-sidebar-foot {
    margin: var(--fx-s3) var(--fx-s3) 0;
    padding: 10px 12px;
    border-radius: var(--fx-r-sm);
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.06);
    font-size: var(--fx-t-micro);
    color: rgba(241,245,249,.5);
    font-family: var(--fx-mono);
    display: flex; align-items: center; gap: 8px;
}
.fx-sidebar-foot .fx-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--fx-success); flex: 0 0 6px;
    box-shadow: 0 0 0 3px rgba(63,185,80,.15);
}

/* Collapsed rail: sirf icon, aur hover par label ka tooltip */
.sidebar-collapse .app-sidebar:not(:hover) .brand-text,
.sidebar-collapse .app-sidebar:not(:hover) .nav-link p,
.sidebar-collapse .app-sidebar:not(:hover) .nav-header,
.sidebar-collapse .app-sidebar:not(:hover) .fx-sidebar-foot { opacity: 0; }

/* ---------- Topbar ---------- */
.app-header,
.app-header.navbar {
    background: var(--fx-surface) !important;
    border-bottom: 1px solid var(--fx-border) !important;
    box-shadow: none !important;
    min-height: var(--fx-topbar-h);
    backdrop-filter: saturate(140%) blur(8px);
}
.app-header .nav-link { color: var(--fx-text-2); }
.app-header .nav-link:hover { color: var(--fx-text); }

.fx-topbar-toggle {
    width: 34px; height: 34px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    color: var(--fx-text-2); border: 1px solid transparent; background: transparent;
    transition: background var(--fx-fast), color var(--fx-fast);
}
.fx-topbar-toggle:hover { background: var(--fx-surface-3); color: var(--fx-text); }

/* Breadcrumb -- "Cases / Case #2026-001 / CDR Intelligence Finder" */
.fx-crumbs {
    display: flex; align-items: center; gap: 6px;
    font-size: var(--fx-t-sm); color: var(--fx-text-muted);
    min-width: 0; overflow: hidden;
}
.fx-crumbs a { color: var(--fx-text-muted); white-space: nowrap; }
.fx-crumbs a:hover { color: var(--fx-primary); }
.fx-crumbs .fx-crumb-sep { color: var(--fx-text-faint); font-size: .7rem; }
.fx-crumbs .fx-crumb-now {
    color: var(--fx-text); font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Topbar user chip */
.fx-user-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 4px 10px 4px 4px; border-radius: var(--fx-r-pill);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-2);
    color: var(--fx-text); font-size: var(--fx-t-sm); font-weight: 600;
    transition: border-color var(--fx-fast), background var(--fx-fast);
}
.fx-user-chip:hover { border-color: var(--fx-border-strong); background: var(--fx-surface-3); color: var(--fx-text); }
.fx-avatar {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, var(--fx-primary) 0%, var(--fx-primary-deep) 100%);
    color: #fff; font-size: .7rem; font-weight: 700;
}

/* ---------- Content ---------- */
.app-main { background: var(--fx-bg); }
.app-content { padding-top: 0; padding-bottom: var(--fx-s5); }
.app-content-header { padding: var(--fx-s5) 0 var(--fx-s3); }
.app-content > .container-fluid,
.app-content-header > .container-fluid { padding-inline: var(--fx-s5); max-width: 1760px; }

/* ---------- Footer ---------- */
.app-footer {
    background: var(--fx-surface) !important;
    border-top: 1px solid var(--fx-border) !important;
    color: var(--fx-text-muted) !important;
    font-size: var(--fx-t-xs);
    padding: 12px var(--fx-s5);
}
.app-footer a { color: var(--fx-text-muted); }


/* ==========================================================================
   04  PAGE HEAD + CASE CONTEXT
   ========================================================================== */

.fx-page-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--fx-s4); flex-wrap: wrap;
    padding-bottom: var(--fx-s4);
    margin-bottom: var(--fx-s5);
    border-bottom: 1px solid var(--fx-border);
}
.fx-page-head .fx-page-title {
    display: flex; align-items: center; gap: 12px;
    margin: 0; font-size: var(--fx-t-hero); font-weight: 700;
    letter-spacing: -.018em; color: var(--fx-text);
}
.fx-page-head .fx-page-title i { color: var(--fx-primary); font-size: .82em; }
.fx-page-head .fx-page-sub {
    margin: 5px 0 0; color: var(--fx-text-muted);
    font-size: var(--fx-t-body); max-width: 78ch;
}
.fx-page-actions { display: flex; align-items: center; gap: var(--fx-s2); flex-wrap: wrap; }

/* -------------------------------------------------------------------------
   MOJOODA app-content-header
   Har safhe ka apna dhaancha thora alag hai (kahin .row/.col, kahin seedha
   h3+p). Markup ko chherne ke bajaye yahan usi dhaanche ko wahi shakal di
   jati hai jo .fx-page-head ki hai -- is tarah 44 safhe ek jaise dikhte hain
   aur kisi safhe ka HTML nahi badalta.
   ------------------------------------------------------------------------- */
.app-content-header > .container-fluid {
    padding-bottom: var(--fx-s4);
    border-bottom: 1px solid var(--fx-border);
}
.app-content-header > .container-fluid > .row { align-items: center; }
.app-content-header :is(h1, h2, h3, h4):not(.ci-hero-title):not(.fx-on-dark) {
    font-size: var(--fx-t-hero);
    font-weight: 700;
    letter-spacing: -.018em;
    color: var(--fx-text) !important;
    margin: 0;
    display: flex; align-items: center; gap: 11px;
    line-height: 1.15;
}
.app-content-header :is(h1, h2, h3, h4):not(.ci-hero-title) > i {
    color: var(--fx-primary); font-size: .8em; margin: 0 !important;
}
/* Hamesha gehre rehne wale band (CI hero) ke andar ka matn theme ke saath
   nahi palat-ta -- warna light theme mein gehra matn gehre band par gum ho
   jata hai. Yahi ghalti pehle graph ke labels ke saath hui thi. */
.ci-hero, .ci-hero * { color: inherit; }
.ci-hero .ci-hero-title { color: #ffffff !important; }
.ci-hero p, .ci-hero .ci-hero-sub { color: rgba(233, 240, 252, .82) !important; }
.app-content-header p, .app-content-header .small {
    margin: 6px 0 0 !important;
    color: var(--fx-text-muted) !important;
    font-size: var(--fx-t-body) !important;
    max-width: 86ch;
}
.app-content-header .text-end, .app-content-header .text-sm-end {
    display: flex; gap: var(--fx-s2); justify-content: flex-end;
    align-items: center; flex-wrap: wrap;
}
@media (max-width: 768px) {
    .app-content-header .text-end, .app-content-header .text-sm-end {
        justify-content: flex-start; margin-top: var(--fx-s3);
    }
}

/* ---------- Case context band ----------
   Har case safhe par ek jaisa. Batata hai ke user kis tehqeeqat ke andar hai. */
.fx-case-bar {
    display: flex; align-items: center; gap: var(--fx-s5); flex-wrap: wrap;
    padding: var(--fx-s3) var(--fx-s4);
    margin-bottom: var(--fx-s5);
    border: 1px solid var(--fx-border);
    border-left: 3px solid var(--fx-signal);
    border-radius: var(--fx-r);
    background:
        linear-gradient(90deg, var(--fx-signal-soft) 0%, transparent 42%),
        var(--fx-surface);
}
.fx-case-bar .fx-case-id {
    font-family: var(--fx-mono); font-size: var(--fx-t-xs);
    letter-spacing: .06em; color: var(--fx-signal); font-weight: 500;
}
.fx-case-bar .fx-case-title {
    font-size: var(--fx-t-section); font-weight: 700; color: var(--fx-text);
    margin: 2px 0 0; line-height: 1.25;
}
.fx-case-facts { display: flex; align-items: center; gap: var(--fx-s5); flex-wrap: wrap; margin-left: auto; }
.fx-case-fact { display: flex; flex-direction: column; gap: 2px; min-width: 74px; }
.fx-case-fact .fx-k {
    font-family: var(--fx-mono); font-size: var(--fx-t-micro);
    letter-spacing: .1em; text-transform: uppercase; color: var(--fx-text-muted);
}
.fx-case-fact .fx-v {
    font-size: var(--fx-t-body); font-weight: 600; color: var(--fx-text);
    font-variant-numeric: tabular-nums;
}


/* ==========================================================================
   05  CARDS
   --------------------------------------------------------------------------
   Border, fill aur shadow -- teenon ka apna kaam hai. Har cheez card nahi
   hoti: default card halka hai, aur sirf .fx-card-lift wala uthta hai.
   ========================================================================== */

.card {
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r-lg);
    box-shadow: var(--fx-shadow-1);
    color: var(--fx-text);
    margin-bottom: var(--fx-s5);
}
.card.shadow, .card.shadow-sm { box-shadow: var(--fx-shadow-1) !important; }
.card.border-0 { border: 1px solid var(--fx-border) !important; }

.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--fx-border);
    padding: var(--fx-s3) var(--fx-s4);
    color: var(--fx-text);
    border-radius: var(--fx-r-lg) var(--fx-r-lg) 0 0 !important;
}
/* NOTE: .card-header JAAN BOOJH KAR flex container NAHI hai -- bilkul waise
   hi jaise .alert. Bohat se headers ke andar poore block hote hain (alerts,
   filter rows, wazahat). Unhen flex items bana dene par woh sikurte nahi
   aur chhoti screen par card se bahar nikal jate hain.
   Jahan header ko flex chahiye, wahan markup pehle se apna andar ka
   .d-flex.justify-content-between rakhta hai. Naye code ke liye
   .card-header.fx-flex maujood hai. */
.card-header > * { min-width: 0; max-width: 100%; }
.card-header.fx-flex {
    display: flex; align-items: center; gap: var(--fx-s3);
    flex-wrap: wrap; min-height: 50px;
}
.card-header.fx-flex .fx-header-tools { margin-left: auto; }
.card-header.bg-white, .card-header.bg-light, .card-header.bg-body { background: transparent !important; }

.card-title, .card-header h5, .card-header h4, .card-header h3, .card-header h6 {
    margin: 0;
    font-size: var(--fx-t-card);
    font-weight: 700;
    color: var(--fx-text);
    letter-spacing: -.008em;
    display: flex; align-items: center; gap: 8px;
}
.card-header .card-title i, .card-header h5 i { color: var(--fx-primary); font-size: .95em; }
.card-subtitle, .card-header .fx-sub {
    font-size: var(--fx-t-xs); color: var(--fx-text-muted); font-weight: 400;
}
.card-header .fx-header-tools { margin-left: auto; display: flex; align-items: center; gap: var(--fx-s2); }

.card-body { padding: var(--fx-s4); color: var(--fx-text-2); }
.card-body > :last-child { margin-bottom: 0; }
.card-footer {
    background: var(--fx-surface-2);
    border-top: 1px solid var(--fx-border);
    padding: var(--fx-s3) var(--fx-s4);
    border-radius: 0 0 var(--fx-r-lg) var(--fx-r-lg);
    color: var(--fx-text-muted);
    font-size: var(--fx-t-sm);
}

/* -------------------------------------------------------------------------
   HOVER PAR PANEL KA JAWAB
   Pehle yahan hover par ooper rangeen lakeer barhti thi. User ki hidayat
   par woh lakeer HATA DI GAYI hai -- har panel par. Ab hover ka jawab sirf
   halka sa uthna, gehri parchhai aur kinare ka rang hai; ginti/matn ke
   ooper koi rangeen patti nahi aati.
   ------------------------------------------------------------------------- */
.card, .fx-panel { position: relative; }
/* Halka sa uthna -- magar us card par nahi jis ke andar table ho: qatarein
   parhte waqt poora panel hilna pareshan karta hai. */
.card:hover:not(:has(table)) {
    transform: translateY(-2px);
    box-shadow: var(--fx-shadow-2);
}
.card { transition: transform .25s cubic-bezier(.22,1,.36,1), box-shadow .25s ease, border-color var(--fx-fast); }
.card-header .card-title i, .card-header h5 i { transition: transform .3s cubic-bezier(.34,1.56,.64,1); }
.card:hover .card-header .card-title i, .card:hover .card-header h5 i { transform: scale(1.15) rotate(-8deg); }
@media (prefers-reduced-motion: reduce) {
    .card:hover { transform: none; }
}

/* -------------------------------------------------------------------------
   WAHI HOVER ASAR -- POORE SOFTWARE KE HAR PANEL PAR
   Bootstrap ki .card ke ilawa har safhe ne apne naam ke panel bana rakhe
   hain (.ff-card, .zone-card, .rep-tile, .glass-card ...). Un sab ko wahi
   jawab milta hai jo .card ko: halka sa uthna aur kinare ka rang.
   Rangeen top lakeer user ki hidayat par kahin nahi hai.
   ------------------------------------------------------------------------- */
.fx-panel, .ci-card, .cd-card, .filter-card, .ff-card, .zone-card,
.coord-card, .pattern-card, .coloc-card, .alert-card, .acct-card,
.link-card, .intel-card, .rep-tile, .aud-card, .timeline-box, .lt-map-card,
.glass-card, .anomaly-card, .threat-card, .detail-box, .det-box, .cnt-box,
.res-box, .filter-box, .paste-box, .exec-brief-box, .info-box,
.target-card-item, .sidebar-panel, .network-details-panel,
.timeline-bottom-panel, .tsel-panel {
    position: relative;
    transition: transform .25s cubic-bezier(.22,1,.36,1),
                box-shadow .25s ease, border-color var(--fx-fast);
}

/* Halka sa uthna -- magar un panels par NAHI jo naqshe/graph ke ooper
   thehre hue hain (unhen hilana un ki jagah kharab kar deta hai), aur na
   us par jis ke andar table ho. */
.fx-panel:hover, .ci-card:hover, .cd-card:hover, .filter-card:hover,
.ff-card:hover, .zone-card:hover, .coord-card:hover, .pattern-card:hover,
.coloc-card:hover, .alert-card:hover, .acct-card:hover, .link-card:hover,
.intel-card:hover, .rep-tile:hover, .aud-card:hover, .glass-card:hover,
.anomaly-card:hover, .threat-card:hover, .detail-box:hover, .det-box:hover,
.cnt-box:hover, .res-box:hover, .filter-box:hover, .exec-brief-box:hover,
.info-box:hover, .target-card-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--fx-shadow-2);
}
.sidebar-panel:hover, .network-details-panel:hover,
.timeline-bottom-panel:hover, .tsel-panel:hover,
.lt-map-card:hover, .timeline-box:hover { transform: none; }

/* -------- ICONS: hover par zinda hon --------
   Panel ke sar ka icon halka sa bara aur tirchha; KPI tile ka icon chip
   apni jagah par ubharta hai. Dono chhote asar hain -- yeh tehqeeqati
   software hai, tamasha nahi. */
.card .card-header i, .card-title i,
.ci-card .ci-card-title i, .fx-panel > :is(h4,h5,h6) i,
.fx-sec-head > i, .rep-tile i, .info-box .info-box-icon,
.zone-card > i, .ff-card i:first-child {
    transition: transform .3s cubic-bezier(.34,1.56,.64,1), color var(--fx-fast);
}
:is(.card, .fx-panel, .ci-card, .cd-card, .filter-card, .ff-card, .zone-card,
    .coord-card, .pattern-card, .coloc-card, .alert-card, .acct-card,
    .link-card, .intel-card, .rep-tile, .aud-card, .glass-card, .anomaly-card,
    .threat-card, .info-box, .target-card-item):hover
    :is(.card-header i, .card-title i, .ci-card-title i, .info-box-icon,
        h4 > i, h5 > i, h6 > i) {
    transform: scale(1.16) rotate(-8deg);
}
/* KPI / stat tile: poori tile nahi uthti (woh ginti parhne mein khalal
   dalta hai), sirf icon chip zinda hota hai aur kinara raushan. */
.fx-kpi .fx-kpi-icon, .stat-card .stat-icon, .stat-card .icon-box,
.small-box .small-box-icon, .small-box > .icon, .ci-kpi .ci-kpi-ico {
    transition: transform .3s cubic-bezier(.34,1.56,.64,1),
                background var(--fx-fast), border-color var(--fx-fast);
}
.fx-kpi:hover .fx-kpi-icon, .stat-card:hover .stat-icon,
.stat-card:hover .icon-box, .small-box:hover .small-box-icon,
.small-box:hover > .icon, .ci-kpi:hover .ci-kpi-ico {
    /* `!important` yahan zaroori hai: base rule mein AdminLTE ki apni
       positioning todne ke liye `transform: none !important` laga hua hai. */
    transform: scale(1.14) rotate(-6deg) !important;
}

@media (prefers-reduced-motion: reduce) {
    .fx-panel, .ci-card, .cd-card, .filter-card, .ff-card, .zone-card,
    .coord-card, .pattern-card, .coloc-card, .alert-card, .acct-card,
    .link-card, .intel-card, .rep-tile, .aud-card, .glass-card,
    .anomaly-card, .threat-card, .info-box, .target-card-item { transition: none; }
    .fx-panel:hover, .ci-card:hover, .cd-card:hover, .filter-card:hover,
    .ff-card:hover, .zone-card:hover, .rep-tile:hover, .glass-card:hover,
    .info-box:hover, .target-card-item:hover { transform: none; }
    [class]:hover i { transform: none !important; }
}

/* Sirf woh cards jo click hote hain */
.fx-card-lift { transition: transform var(--fx-mid), box-shadow var(--fx-mid), border-color var(--fx-mid); }
.fx-card-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--fx-shadow-2);
    border-color: var(--fx-border-strong);
}

/* Ahem card -- safhe ka asal jawab */
.fx-card-primary { border-color: var(--fx-primary-line); }
.fx-card-primary .card-header { border-bottom-color: var(--fx-primary-line); }
.fx-card-signal  { border-left: 3px solid var(--fx-signal); }
.fx-card-danger  { border-left: 3px solid var(--fx-danger); }
.fx-card-flat    { box-shadow: none; background: var(--fx-surface-2); }

/* Panel: card se halka, andar ke hisson ke liye */
.fx-panel {
    background: var(--fx-surface-2);
    border: 1px solid var(--fx-border-soft);
    border-radius: var(--fx-r);
    padding: var(--fx-s4);
}
.fx-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: var(--fx-s3);
    margin-bottom: var(--fx-s3);
}


/* ==========================================================================
   06  KPI + STAT TILES
   --------------------------------------------------------------------------
   Ginti ke saath us ka matlab bhi. Value monospace mein -- instrument readout.
   ========================================================================== */

.fx-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(196px, 1fr));
    gap: var(--fx-s3);
    margin-bottom: var(--fx-s5);
}

.fx-kpi {
    position: relative;
    background: var(--fx-surface);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r);
    padding: var(--fx-s4);
    display: flex; flex-direction: column; gap: 2px;
    overflow: hidden;
    transition: border-color var(--fx-fast), background var(--fx-fast);
}
.fx-kpi:hover { border-color: var(--fx-border-strong); }
.fx-kpi::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--fx-accent, var(--fx-primary)); opacity: .75;
}
.fx-kpi-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fx-kpi-icon {
    width: 28px; height: 28px; flex: 0 0 28px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .8rem;
    background: var(--fx-accent-soft, var(--fx-primary-soft));
    color: var(--fx-accent, var(--fx-primary));
    border: 1px solid var(--fx-accent-line, var(--fx-primary-line));
}
.fx-kpi-label {
    font-family: var(--fx-mono); font-size: var(--fx-t-micro);
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--fx-text-muted); font-weight: 500;
}
.fx-kpi-value {
    font-family: var(--fx-mono);
    font-size: 1.7rem; font-weight: 600; line-height: 1.05;
    color: var(--fx-text);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.02em;
}
.fx-kpi-value .fx-unit { font-size: .9rem; color: var(--fx-text-muted); margin-left: 3px; font-weight: 500; }
.fx-kpi-note {
    font-size: var(--fx-t-xs); color: var(--fx-text-muted);
    margin-top: 4px; line-height: 1.4;
}
.fx-kpi-note strong { color: var(--fx-text-2); font-weight: 600; }

/* KPI ke rang -- semantic, marzi ke nahi */
.fx-kpi.is-primary { --fx-accent: var(--fx-primary); --fx-accent-soft: var(--fx-primary-soft); --fx-accent-line: var(--fx-primary-line); }
.fx-kpi.is-signal  { --fx-accent: var(--fx-signal);  --fx-accent-soft: var(--fx-signal-soft);  --fx-accent-line: var(--fx-signal-line); }
.fx-kpi.is-success { --fx-accent: var(--fx-success); --fx-accent-soft: var(--fx-success-soft); --fx-accent-line: var(--fx-success-line); }
.fx-kpi.is-warning { --fx-accent: var(--fx-warning); --fx-accent-soft: var(--fx-warning-soft); --fx-accent-line: var(--fx-warning-line); }
.fx-kpi.is-danger  { --fx-accent: var(--fx-danger);  --fx-accent-soft: var(--fx-danger-soft);  --fx-accent-line: var(--fx-danger-line); }
.fx-kpi.is-info    { --fx-accent: var(--fx-info);    --fx-accent-soft: var(--fx-info-soft);    --fx-accent-line: var(--fx-info-line); }
.fx-kpi.is-violet  { --fx-accent: var(--fx-violet);  --fx-accent-soft: var(--fx-violet-soft);  --fx-accent-line: var(--fx-violet-line); }

/* -------------------------------------------------------------------------
   PURANI .stat-card TILES
   Kai safhe apni KPI tile khud banate hain: rangeen gradient block aur
   ooper safed matn. Do masle the -- (1) rang dono theme mein ek jaisa
   chamakta tha aur baaki software se mel nahi khata, (2) ginti se pehle
   nazar rang par jati thi, hindse par nahi.

   Yahan wahi markup (.stat-value / .stat-label / .stat-icon) bina chhue
   .fx-kpi jaisi shakal le leta hai. Har safhe ne apni tile ka rang ab
   --fx-accent ke zariye diya hua hai, is liye maani wahi rehte hain
   (CDR = green, geo = blue, alert = red) magar shakal ek hi hai.
   `!important` yahan zaroori hai: safhe ka apna <style> is file ke BAAD
   load hota hai.
   ------------------------------------------------------------------------- */
.stat-card {
    position: relative; overflow: hidden;
    background: var(--fx-surface) !important;
    border: 1px solid var(--fx-border) !important;
    border-radius: var(--fx-r) !important;
    box-shadow: none !important;
    color: var(--fx-text) !important;
    padding: var(--fx-s4) !important;
    display: flex; flex-direction: column; gap: 2px;
    transition: border-color var(--fx-fast);
}
.stat-card::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--fx-accent, var(--fx-primary)); opacity: .75;
}
.stat-card:hover { transform: none !important; border-color: var(--fx-border-strong) !important; box-shadow: none !important; }

.stat-card .stat-value, .stat-card .info p {
    font-family: var(--fx-mono) !important;
    font-size: 1.65rem !important; font-weight: 600 !important;
    line-height: 1.05; letter-spacing: -.02em;
    color: var(--fx-text) !important;
    font-variant-numeric: tabular-nums;
    order: 2;
}
.stat-card .stat-label, .stat-card .info h3 {
    font-family: var(--fx-mono) !important;
    font-size: var(--fx-t-micro) !important; font-weight: 500 !important;
    letter-spacing: .1em !important; text-transform: uppercase;
    color: var(--fx-text-muted) !important; opacity: 1 !important;
    order: 1; margin-bottom: 6px;
    padding-left: 36px;   /* icon chip ke liye jagah */
    min-height: 28px; display: flex; align-items: center;
}
/* Icon ab kone mein dhundla nahi -- label ke saath ek chip hai */
.stat-card .stat-icon, .stat-card .icon-box {
    position: absolute !important; left: var(--fx-s4) !important; top: var(--fx-s4) !important;
    right: auto !important; transform: none !important;
    width: 28px; height: 28px; border-radius: var(--fx-r-sm);
    display: inline-flex !important; align-items: center; justify-content: center;
    font-size: .8rem !important; opacity: 1 !important;
    background: var(--fx-accent-soft, var(--fx-primary-soft));
    color: var(--fx-accent, var(--fx-primary)) !important;
    border: 1px solid var(--fx-accent-line, var(--fx-primary-line));
}

/* -------------------------------------------------------------------------
   AdminLTE .small-box  (manage_users.php aur manage_districts.php)
   Yeh do safhe apni ginti AdminLTE ki .small-box mein dikhate the -- poora
   rangeen block. Baqi software .stat-card / .fx-kpi istemal karta hai, is
   liye yeh do safhe ajnabi lagte the.

   Ab .small-box ko bilkul wahi shakal di ja rahi hai. Markup, classes aur
   ginti ka rang (text-bg-primary = neela, -danger = laal) sab wahi rehta
   hai -- sirf rang ab poori tile ke bajaye ooper ki lakeer aur icon chip
   par bolta hai.
   ------------------------------------------------------------------------- */
.small-box {
    position: relative; overflow: hidden;
    background: var(--fx-surface) !important;
    border: 1px solid var(--fx-border) !important;
    border-radius: var(--fx-r) !important;
    box-shadow: none !important;
    color: var(--fx-text) !important;
    padding: var(--fx-s4) !important;
    min-height: 0;
    transition: border-color var(--fx-fast), background var(--fx-fast);
}
.small-box::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--fx-accent, var(--fx-primary)); opacity: .75;
}
.small-box:hover { border-color: var(--fx-border-strong) !important; background: var(--fx-surface-2) !important; }
.small-box > .inner {
    padding: 0; display: flex; flex-direction: column;
}
/* Tarteeb .stat-card / .fx-kpi jaisi: pehle label (icon ke saath), phir ginti */
.small-box > .inner p { order: 1; }
.small-box > .inner h3 { order: 2; }
.small-box > .inner h3 {
    font-family: var(--fx-mono) !important;
    font-size: 1.65rem !important; font-weight: 600 !important;
    line-height: 1.05; letter-spacing: -.02em;
    color: var(--fx-text) !important; margin: 0;
    font-variant-numeric: tabular-nums;
}
.small-box > .inner p {
    font-family: var(--fx-mono) !important;
    font-size: var(--fx-t-micro) !important; font-weight: 500 !important;
    letter-spacing: .1em; text-transform: uppercase;
    color: var(--fx-text-muted) !important;
    margin: 0 0 6px; padding-left: 36px;
    min-height: 28px; display: flex; align-items: center;
}
.small-box .small-box-icon, .small-box > .icon {
    position: absolute !important; left: var(--fx-s4) !important; top: var(--fx-s4) !important;
    right: auto !important; bottom: auto !important;
    width: 28px; height: 28px; border-radius: var(--fx-r-sm);
    display: inline-flex !important; align-items: center; justify-content: center;
    font-size: .8rem !important; opacity: 1 !important;
    background: var(--fx-accent-soft, var(--fx-primary-soft));
    color: var(--fx-accent, var(--fx-primary)) !important;
    border: 1px solid var(--fx-accent-line, var(--fx-primary-line));
    transform: none !important;
}
.small-box .small-box-footer { display: none; }
/* Accent us text-bg-* class se jo markup mein pehle se lagi hui hai */
.small-box.text-bg-primary { --fx-accent: var(--fx-primary); --fx-accent-soft: var(--fx-primary-soft); --fx-accent-line: var(--fx-primary-line); }
.small-box.text-bg-success { --fx-accent: var(--fx-success); --fx-accent-soft: var(--fx-success-soft); --fx-accent-line: var(--fx-success-line); }
.small-box.text-bg-danger  { --fx-accent: var(--fx-danger);  --fx-accent-soft: var(--fx-danger-soft);  --fx-accent-line: var(--fx-danger-line); }
.small-box.text-bg-warning { --fx-accent: var(--fx-warning); --fx-accent-soft: var(--fx-warning-soft); --fx-accent-line: var(--fx-warning-line); }
.small-box.text-bg-info    { --fx-accent: var(--fx-info);    --fx-accent-soft: var(--fx-info-soft);    --fx-accent-line: var(--fx-info-line); }
.small-box.text-bg-secondary { --fx-accent: var(--fx-text-muted); --fx-accent-soft: var(--fx-neutral-soft); --fx-accent-line: var(--fx-neutral-line); }
/* text-bg-* ka apna background/color yahan nahi chalna chahiye */
.small-box[class*="text-bg-"] { background: var(--fx-surface) !important; color: var(--fx-text) !important; }


/* ==========================================================================
   07  BUTTONS
   ========================================================================== */

.btn {
    --bs-btn-padding-y: .44rem;
    --bs-btn-padding-x: .85rem;
    --bs-btn-font-size: var(--fx-t-body);
    --bs-btn-border-radius: var(--fx-r-sm);
    font-weight: 600;
    letter-spacing: -.005em;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    transition: background var(--fx-fast), border-color var(--fx-fast), color var(--fx-fast), box-shadow var(--fx-fast);
    white-space: nowrap;
}
.btn:focus-visible { box-shadow: var(--fx-ring); }
.btn i { font-size: .95em; }

.btn-primary {
    --bs-btn-bg: var(--fx-primary);        --bs-btn-border-color: var(--fx-primary);
    --bs-btn-hover-bg: var(--fx-primary-strong); --bs-btn-hover-border-color: var(--fx-primary-strong);
    --bs-btn-active-bg: var(--fx-primary-deep);  --bs-btn-active-border-color: var(--fx-primary-deep);
    --bs-btn-color: var(--fx-on-primary);   --bs-btn-hover-color: var(--fx-on-primary);
    --bs-btn-disabled-bg: var(--fx-primary); --bs-btn-disabled-border-color: var(--fx-primary);
    box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.btn-secondary {
    --bs-btn-bg: var(--fx-surface-3);       --bs-btn-border-color: var(--fx-border);
    --bs-btn-hover-bg: var(--fx-elevated);  --bs-btn-hover-border-color: var(--fx-border-strong);
    --bs-btn-color: var(--fx-text);         --bs-btn-hover-color: var(--fx-text);
    --bs-btn-active-bg: var(--fx-surface-3);
}
/* .btn-outline-light: default surat theme ke saath chalti hai (aam card
   ya header par), aur SIRF gehre band ke andar pakki safed ho jati hai --
   warna halke header par safed matn safed sat-h par ghayab ho jata tha. */
.btn-outline-light {
    --bs-btn-bg: transparent;               --bs-btn-border-color: var(--fx-border);
    --bs-btn-color: var(--fx-text-2);       --bs-btn-hover-color: var(--fx-text);
    --bs-btn-hover-bg: var(--fx-surface-3); --bs-btn-hover-border-color: var(--fx-border-strong);
    --bs-btn-active-bg: var(--fx-surface-3); --bs-btn-active-color: var(--fx-text);
    --bs-btn-active-border-color: var(--fx-border-strong);
}
:is(.fx-on-dark, .ci-hero, .cd-hero, .tower-hero, .dossier-head, .ps-head,
    .network-controls, .bg-dark:not(.card-header), .text-bg-dark:not(.card-header),
    .leaflet-container, .map-toolbar) .btn-outline-light {
    --bs-btn-bg: transparent;               --bs-btn-border-color: rgba(255,255,255,.35);
    --bs-btn-color: #ffffff;                --bs-btn-hover-color: #0f172a;
    --bs-btn-hover-bg: #ffffff;             --bs-btn-hover-border-color: #ffffff;
    --bs-btn-active-bg: #ffffff;            --bs-btn-active-color: #0f172a;
    --bs-btn-active-border-color: #ffffff;
}
.btn-light, .btn-outline-secondary, .btn-outline-dark {
    --bs-btn-bg: transparent;               --bs-btn-border-color: var(--fx-border);
    --bs-btn-hover-bg: var(--fx-surface-3); --bs-btn-hover-border-color: var(--fx-border-strong);
    --bs-btn-color: var(--fx-text-2);       --bs-btn-hover-color: var(--fx-text);
    --bs-btn-active-bg: var(--fx-surface-3); --bs-btn-active-color: var(--fx-text);
    --bs-btn-active-border-color: var(--fx-border-strong);
}
.btn-dark {
    --bs-btn-bg: var(--fx-ink);  --bs-btn-border-color: var(--fx-ink);
    --bs-btn-hover-bg: var(--fx-ink-2); --bs-btn-hover-border-color: var(--fx-ink-2);
    --bs-btn-color: var(--fx-on-ink); --bs-btn-hover-color: #fff;
}
.btn-danger {
    --bs-btn-bg: var(--fx-danger); --bs-btn-border-color: var(--fx-danger);
    --bs-btn-hover-bg: var(--fx-danger-strong); --bs-btn-hover-border-color: var(--fx-danger-strong);
    --bs-btn-color: var(--fx-on-danger); --bs-btn-hover-color: var(--fx-on-danger);
}
.btn-success {
    --bs-btn-bg: var(--fx-success); --bs-btn-border-color: var(--fx-success);
    --bs-btn-hover-bg: var(--fx-success-strong); --bs-btn-hover-border-color: var(--fx-success-strong);
    --bs-btn-color: var(--fx-on-success); --bs-btn-hover-color: var(--fx-on-success);
}
.btn-warning {
    --bs-btn-bg: var(--fx-warning); --bs-btn-border-color: var(--fx-warning);
    --bs-btn-hover-bg: var(--fx-warning-strong); --bs-btn-hover-border-color: var(--fx-warning-strong);
    --bs-btn-color: var(--fx-on-warning); --bs-btn-hover-color: var(--fx-on-warning);
}
.btn-info {
    --bs-btn-bg: var(--fx-info); --bs-btn-border-color: var(--fx-info);
    --bs-btn-hover-bg: var(--fx-info-strong); --bs-btn-hover-border-color: var(--fx-info-strong);
    --bs-btn-color: var(--fx-on-info); --bs-btn-hover-color: var(--fx-on-info);
}
.btn-outline-primary {
    --bs-btn-color: var(--fx-primary); --bs-btn-border-color: var(--fx-primary-line);
    --bs-btn-hover-bg: var(--fx-primary); --bs-btn-hover-border-color: var(--fx-primary);
    --bs-btn-hover-color: var(--fx-on-primary);
    --bs-btn-active-bg: var(--fx-primary-deep); --bs-btn-active-border-color: var(--fx-primary-deep);
}
.btn-outline-danger {
    --bs-btn-color: var(--fx-danger); --bs-btn-border-color: var(--fx-danger-line);
    --bs-btn-hover-bg: var(--fx-danger); --bs-btn-hover-border-color: var(--fx-danger);
    --bs-btn-hover-color: #fff;
}
.btn-outline-success {
    --bs-btn-color: var(--fx-success); --bs-btn-border-color: var(--fx-success-line);
    --bs-btn-hover-bg: var(--fx-success); --bs-btn-hover-border-color: var(--fx-success);
    --bs-btn-hover-color: #fff;
}
.btn-outline-warning {
    --bs-btn-color: var(--fx-warning); --bs-btn-border-color: var(--fx-warning-line);
    --bs-btn-hover-bg: var(--fx-warning); --bs-btn-hover-border-color: var(--fx-warning);
    --bs-btn-hover-color: #1a1200;
}
.btn-outline-info {
    --bs-btn-color: var(--fx-info); --bs-btn-border-color: var(--fx-info-line);
    --bs-btn-hover-bg: var(--fx-info); --bs-btn-hover-border-color: var(--fx-info);
    --bs-btn-hover-color: #04191b;
}
.btn-link { --bs-btn-color: var(--fx-primary); --bs-btn-hover-color: var(--fx-primary-strong); text-decoration: none; }

/* Ghost -- kam se kam wazan */
.btn-ghost {
    background: transparent; border: 1px solid transparent; color: var(--fx-text-muted);
}
.btn-ghost:hover { background: var(--fx-surface-3); color: var(--fx-text); }

.btn-sm { --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .6rem; --bs-btn-font-size: var(--fx-t-xs); }
.btn-lg { --bs-btn-padding-y: .62rem; --bs-btn-padding-x: 1.2rem; --bs-btn-font-size: var(--fx-t-section); }

/* Icon-only button -- hamesha tooltip/aria-label ke saath */
.fx-icon-btn, .btn-action {
    width: 32px; height: 32px; padding: 0; flex: 0 0 32px;
    border-radius: var(--fx-r-sm);
    border: 1px solid var(--fx-border);
    background: var(--fx-surface-2);
    color: var(--fx-text-2);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .82rem; text-decoration: none;
    transition: background var(--fx-fast), color var(--fx-fast), border-color var(--fx-fast);
}
.fx-icon-btn:hover, .btn-action:hover {
    background: var(--fx-primary); border-color: var(--fx-primary); color: var(--fx-primary-fg);
}
.fx-icon-btn.is-danger:hover { background: var(--fx-danger); border-color: var(--fx-danger); color: #fff; }
.action-btns { display: inline-flex; gap: 5px; }

/* Button ka loading roop -- JS sirf .is-loading lagata hai */
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
    content: ""; position: absolute; inset: 0; margin: auto;
    width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid currentColor; border-top-color: transparent;
    color: var(--bs-btn-color, #fff);
    animation: fx-spin .6s linear infinite;
    visibility: visible;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }

/* Purana .btn-submit / .btn-back bhi naye system mein */
.btn-submit {
    width: 100%; background: var(--fx-primary); color: var(--fx-primary-fg);
    border: none; padding: 11px 16px; border-radius: var(--fx-r-sm);
    font-weight: 600; font-size: var(--fx-t-body); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: none; transition: background var(--fx-fast);
}
.btn-submit:hover { background: var(--fx-primary-strong); transform: none; opacity: 1; }
.btn-back {
    background: var(--fx-surface-2); border: 1px solid var(--fx-border);
    color: var(--fx-text-2); padding: 7px 13px; border-radius: var(--fx-r-sm);
    font-size: var(--fx-t-sm); font-weight: 600;
    display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.btn-back:hover { border-color: var(--fx-border-strong); color: var(--fx-text); }


/* ==========================================================================
   08  FORMS + FILTERS
   ========================================================================== */

.form-label, label.form-label, .col-form-label {
    font-size: var(--fx-t-xs); font-weight: 600; color: var(--fx-text-2);
    margin-bottom: 5px; letter-spacing: .005em;
}
.form-text, .form-hint {
    font-size: var(--fx-t-xs); color: var(--fx-text-muted); margin-top: 4px;
}

.form-control, .form-select, .input-group-text, textarea.form-control {
    background-color: var(--fx-surface-2);
    border: 1px solid var(--fx-border);
    color: var(--fx-text);
    border-radius: var(--fx-r-sm);
    font-size: var(--fx-t-body);
    padding: .46rem .7rem;
    transition: border-color var(--fx-fast), box-shadow var(--fx-fast), background var(--fx-fast);
}
.form-control::placeholder, textarea::placeholder { color: var(--fx-text-faint); opacity: 1; }
.form-control:focus, .form-select:focus, textarea.form-control:focus {
    background-color: var(--fx-surface);
    border-color: var(--fx-primary);
    box-shadow: var(--fx-ring);
    color: var(--fx-text);
    outline: none;
}
.form-control:disabled, .form-control[readonly], .form-select:disabled {
    background-color: var(--fx-surface-3);
    color: var(--fx-text-muted);
    border-color: var(--fx-border-soft);
    cursor: not-allowed;
}
.form-control-sm, .form-select-sm { font-size: var(--fx-t-xs); padding: .3rem .55rem; }
.form-control-lg, .form-select-lg { font-size: var(--fx-t-section); padding: .6rem .9rem; }

.input-group-text { background-color: var(--fx-surface-3); color: var(--fx-text-muted); }

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%237d8ba1'%3E%3Cpath d='M8 11.5 3.5 7h9z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .6rem center; background-size: 14px;
    padding-right: 2rem;
}
.form-select option { background: var(--fx-surface); color: var(--fx-text); }

.form-check-input {
    background-color: var(--fx-surface-3);
    border: 1px solid var(--fx-border-strong);
}
.form-check-input:checked { background-color: var(--fx-primary); border-color: var(--fx-primary); }
.form-check-input:focus { box-shadow: var(--fx-ring); border-color: var(--fx-primary); }
.form-check-label { color: var(--fx-text-2); font-size: var(--fx-t-body); }

/* Validation */
.is-invalid, .form-control.is-invalid, .form-select.is-invalid { border-color: var(--fx-danger) !important; }
.is-valid,   .form-control.is-valid,   .form-select.is-valid   { border-color: var(--fx-success) !important; }
.invalid-feedback { color: var(--fx-danger); font-size: var(--fx-t-xs); }
.valid-feedback   { color: var(--fx-success); font-size: var(--fx-t-xs); }

/* Search field with icon */
.fx-search { position: relative; }
.fx-search > i {
    position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
    color: var(--fx-text-faint); font-size: .82rem; pointer-events: none;
}
.fx-search .form-control { padding-left: 32px; border-radius: var(--fx-r-pill); }

/* ---------- Filter bar ---------- */
.fx-filters {
    display: flex; align-items: flex-end; gap: var(--fx-s3); flex-wrap: wrap;
    padding: var(--fx-s3) var(--fx-s4);
    background: var(--fx-surface-2);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r);
    margin-bottom: var(--fx-s4);
}
.fx-filters .fx-field { display: flex; flex-direction: column; min-width: 148px; }
.fx-filters .fx-field.is-grow { flex: 1 1 200px; }
.fx-filters .fx-filter-actions { margin-left: auto; display: flex; gap: var(--fx-s2); align-items: center; }

/* Active filter summary -- kabhi na chhupao ke natija filtered hai */
.fx-active-filters {
    display: flex; align-items: center; gap: var(--fx-s2); flex-wrap: wrap;
    margin-bottom: var(--fx-s3); font-size: var(--fx-t-sm);
}
.fx-filter-count {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--fx-mono); font-size: var(--fx-t-xs); font-weight: 500;
    color: var(--fx-signal); background: var(--fx-signal-soft);
    border: 1px solid var(--fx-signal-line);
    padding: 3px 9px; border-radius: var(--fx-r-pill);
}
.fx-filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 4px 3px 10px; border-radius: var(--fx-r-pill);
    background: var(--fx-surface-3); border: 1px solid var(--fx-border);
    color: var(--fx-text-2); font-size: var(--fx-t-xs); white-space: nowrap;
}
.fx-filter-chip b { color: var(--fx-text); font-weight: 600; }
.fx-filter-chip .fx-chip-x {
    width: 17px; height: 17px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; color: var(--fx-text-muted);
    font-size: .62rem; cursor: pointer; line-height: 1;
}
.fx-filter-chip .fx-chip-x:hover { background: var(--fx-danger-soft); color: var(--fx-danger); }


/* ==========================================================================
   09  TABLES + DATATABLES
   --------------------------------------------------------------------------
   Yeh software data-heavy hai. Table hi asal interface hai: kasi hui qatarein,
   chipka hua sar, saaf hierarchy.
   ========================================================================== */

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--fx-text-2);
    --bs-table-border-color: var(--fx-border-soft);
    --bs-table-striped-bg: var(--fx-surface-2);
    --bs-table-striped-color: var(--fx-text-2);
    --bs-table-hover-bg: var(--fx-primary-soft);
    --bs-table-hover-color: var(--fx-text);
    color: var(--fx-text-2);
    font-size: var(--fx-t-body);
    margin-bottom: 0;
    border-color: var(--fx-border-soft);
}

.table > thead > tr > th, .table > thead th, table thead th {
    background: var(--fx-surface-2);
    color: var(--fx-text-muted);
    font-family: var(--fx-mono);
    font-size: var(--fx-t-micro);
    font-weight: 500;
    letter-spacing: .085em;
    text-transform: uppercase;
    padding: 10px 12px;
    border-bottom: 1px solid var(--fx-border);
    border-top: 0;
    white-space: nowrap;
    vertical-align: middle;
}
.table > tbody > tr > td, table tbody td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--fx-border-soft);
    border-top: 0;
    vertical-align: middle;
    color: var(--fx-text-2);
}
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tbody > tr { transition: background var(--fx-fast); }
.table > tbody > tr:hover > td, table tbody tr:hover td {
    background: var(--fx-primary-soft);
    color: var(--fx-text);
}
.table > tbody > tr.is-selected > td { background: var(--fx-primary-soft); box-shadow: inset 3px 0 0 var(--fx-primary); }
.table-sm > :not(caption) > * > * { padding: 6px 10px; }

/* Sticky header -- lambi tableon mein sar nazar rehta hai */
.fx-table-sticky thead th,
.table-responsive.fx-sticky thead th {
    position: sticky; top: 0; z-index: 3;
    background: var(--fx-surface-2);
    box-shadow: inset 0 -1px 0 var(--fx-border);
}

.table-responsive {
    overflow-x: auto;
    border-radius: var(--fx-r);
    -webkit-overflow-scrolling: touch;
}
.table-responsive.fx-max-h { max-height: 62vh; overflow-y: auto; }

/* Zebra -- sirf wahan jahan parhna asaan karti hai */
.table-striped > tbody > tr:nth-of-type(odd) > *,
.forensic-table tbody tr:nth-of-type(even) { background: var(--fx-surface-2); }
.forensic-table tbody tr:hover > td { background: var(--fx-primary-soft); }

.table-bordered, .table-bordered > :not(caption) > * > * { border-color: var(--fx-border-soft); }
.table-light, .table-light > th, thead.table-light th { background: var(--fx-surface-2) !important; color: var(--fx-text-muted) !important; }

/* Numeric columns line up */
.table td.fx-num, .table th.fx-num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--fx-mono); }

/* Truncation -- lamba address qatar nahi torta */
.fx-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
td.col-address { max-width: 260px; min-width: 170px; white-space: normal; word-break: break-word; line-height: 1.4; font-size: var(--fx-t-xs); }

/* ---------- DataTables ---------- */
.dataTables_wrapper { color: var(--fx-text-2); padding: 0; }
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate { color: var(--fx-text-muted) !important; font-size: var(--fx-t-sm); }
.dataTables_wrapper .dataTables_length select,
.dataTables_wrapper .dataTables_filter input {
    background: var(--fx-surface-2) !important;
    border: 1px solid var(--fx-border) !important;
    color: var(--fx-text) !important;
    border-radius: var(--fx-r-sm) !important;
    padding: 5px 10px !important;
    font-size: var(--fx-t-sm) !important;
    outline: none;
}
.dataTables_wrapper .dataTables_filter input:focus { border-color: var(--fx-primary) !important; box-shadow: var(--fx-ring) !important; }
.dataTables_wrapper .dataTables_info { padding-top: var(--fx-s3); }

.dataTables_wrapper .dataTables_paginate .paginate_button,
.page-link {
    background: transparent !important;
    border: 1px solid transparent !important;
    color: var(--fx-text-2) !important;
    border-radius: var(--fx-r-sm) !important;
    margin: 0 1px; padding: 4px 10px !important;
    font-size: var(--fx-t-sm) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover, .page-link:hover {
    background: var(--fx-surface-3) !important;
    border-color: var(--fx-border) !important;
    color: var(--fx-text) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover,
.page-item.active .page-link {
    background: var(--fx-primary) !important;
    border-color: var(--fx-primary) !important;
    color: var(--fx-primary-fg) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.page-item.disabled .page-link { color: var(--fx-text-faint) !important; background: transparent !important; }
.pagination { --bs-pagination-bg: transparent; }

.dt-buttons { display: inline-flex; gap: 6px; margin-bottom: var(--fx-s3); flex-wrap: wrap; }
.dt-button, button.dt-button {
    background: var(--fx-surface-2) !important;
    border: 1px solid var(--fx-border) !important;
    color: var(--fx-text-2) !important;
    padding: 6px 12px !important;
    border-radius: var(--fx-r-sm) !important;
    font-size: var(--fx-t-xs) !important;
    font-weight: 600 !important;
    box-shadow: none !important;
    transition: all var(--fx-fast);
}
.dt-button:hover, button.dt-button:hover {
    background: var(--fx-primary) !important;
    border-color: var(--fx-primary) !important;
    color: var(--fx-primary-fg) !important;
}

table.dataTable thead th.sorting,
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc { position: relative; cursor: pointer; }
table.dataTable thead .sorting:after, table.dataTable thead .sorting_asc:after, table.dataTable thead .sorting_desc:after {
    color: var(--fx-text-faint); opacity: .9;
}
table.dataTable.no-footer { border-bottom: 1px solid var(--fx-border); }
.dataTables_wrapper .dataTables_processing {
    background: var(--fx-surface) !important;
    border: 1px solid var(--fx-border) !important;
    border-radius: var(--fx-r) !important;
    color: var(--fx-text) !important;
    box-shadow: var(--fx-shadow-2) !important;
}

/* DataTables ka apna search box -- premium shakal */
.dt-search { position: relative; max-width: 360px; }
.dt-search input[type="search"] {
    width: 100% !important;
    padding: 7px 14px 7px 34px !important;
    border-radius: var(--fx-r-pill) !important;
    border: 1px solid var(--fx-border) !important;
    background: var(--fx-surface-2) !important;
    color: var(--fx-text) !important;
    font-size: var(--fx-t-sm) !important;
}
.dt-search input[type="search"]:focus { border-color: var(--fx-primary) !important; box-shadow: var(--fx-ring) !important; }


/* ==========================================================================
   10  BADGES + CHIPS
   --------------------------------------------------------------------------
   Ek matlab, ek rang. Aur rang akela kabhi kaafi nahi -- lafz ya icon saath.
   ========================================================================== */

.badge {
    font-weight: 600; font-size: var(--fx-t-micro);
    padding: .3em .6em; border-radius: var(--fx-r-sm);
    letter-spacing: .01em; line-height: 1.45;
    display: inline-flex; align-items: center; gap: 4px;
    /* Card/khane se bahar na nikle. `white-space: normal` yahan NAHI:
       us se table ke tang khane mein badge teen sattaron ka ho jata tha.
       Lipat-na sirf chhoti screen par (neeche @media 576px). */
    max-width: 100%;
    overflow-wrap: anywhere;
}
.badge.rounded-pill { border-radius: var(--fx-r-pill); padding: .32em .72em; }

.fx-tag {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: var(--fx-r-pill);
    font-size: var(--fx-t-micro); font-weight: 600; line-height: 1.6;
    border: 1px solid var(--fx-neutral-line);
    background: var(--fx-neutral-soft);
    color: var(--fx-text-2);
    white-space: nowrap;
}
.fx-tag i { font-size: .9em; }
.fx-tag.is-primary { background: var(--fx-primary-soft); border-color: var(--fx-primary-line); color: var(--fx-primary); }
.fx-tag.is-signal  { background: var(--fx-signal-soft);  border-color: var(--fx-signal-line);  color: var(--fx-signal); }
.fx-tag.is-success { background: var(--fx-success-soft); border-color: var(--fx-success-line); color: var(--fx-success); }
.fx-tag.is-warning { background: var(--fx-warning-soft); border-color: var(--fx-warning-line); color: var(--fx-warning); }
.fx-tag.is-danger  { background: var(--fx-danger-soft);  border-color: var(--fx-danger-line);  color: var(--fx-danger); }
.fx-tag.is-info    { background: var(--fx-info-soft);    border-color: var(--fx-info-line);    color: var(--fx-info); }
.fx-tag.is-violet  { background: var(--fx-violet-soft);  border-color: var(--fx-violet-line);  color: var(--fx-violet); }
.fx-tag.is-mono    { font-family: var(--fx-mono); font-weight: 500; }

/* Bootstrap ke apne badge rang -- tokens par */
.bg-primary   { background-color: var(--fx-primary) !important; color: var(--fx-on-primary) !important; }
.bg-secondary { background-color: var(--fx-surface-3) !important; color: var(--fx-text-2) !important; }
.bg-success   { background-color: var(--fx-success) !important; color: var(--fx-on-success) !important; }
.bg-danger    { background-color: var(--fx-danger) !important; color: var(--fx-on-danger) !important; }
.bg-warning   { background-color: var(--fx-warning) !important; color: var(--fx-on-warning) !important; }
.bg-info      { background-color: var(--fx-info) !important; color: var(--fx-on-info) !important; }
.bg-dark      { background-color: var(--fx-ink) !important; color: var(--fx-on-ink) !important; }
.bg-light     { background-color: var(--fx-surface-2) !important; color: var(--fx-text-2) !important; }
.bg-white, .bg-body, .bg-body-tertiary, .bg-body-secondary { background-color: var(--fx-surface) !important; }

.text-primary { color: var(--fx-primary) !important; }
.text-success { color: var(--fx-success) !important; }
.text-danger  { color: var(--fx-danger) !important; }
.text-warning { color: var(--fx-warning) !important; }
.text-info    { color: var(--fx-info) !important; }
.text-secondary { color: var(--fx-text-muted) !important; }
/* Bootstrap ki .text-light ka matlab "gehri sat-h par halka matn" hai. Woh
   safhe jo pehle hamesha gehre the, ab theme ke saath chalte hain -- wahan
   yeh utility din ki roshni mein safed-par-safed ho jati thi. Ab yeh theme
   ke saath chalti hai; asli gehre band ke andar apna asal matlab rakhti hai
   (woh band khud apne bachon ka rang fixed rakhta hai). */
.text-light { color: var(--fx-text-2) !important; }

.bg-primary-subtle { background-color: var(--fx-primary-soft) !important; color: var(--fx-primary) !important; }
.bg-success-subtle { background-color: var(--fx-success-soft) !important; color: var(--fx-success) !important; }
.bg-danger-subtle  { background-color: var(--fx-danger-soft) !important;  color: var(--fx-danger) !important; }
.bg-warning-subtle { background-color: var(--fx-warning-soft) !important; color: var(--fx-warning) !important; }
.bg-info-subtle    { background-color: var(--fx-info-soft) !important;    color: var(--fx-info) !important; }
.bg-secondary-subtle { background-color: var(--fx-neutral-soft) !important; color: var(--fx-text-2) !important; }
.text-primary-emphasis { color: var(--fx-primary) !important; }
.text-bg-primary { background-color: var(--fx-primary) !important; color: var(--fx-on-primary) !important; }
.text-bg-success { background-color: var(--fx-success) !important; color: var(--fx-on-success) !important; }
.text-bg-danger  { background-color: var(--fx-danger) !important;  color: var(--fx-on-danger) !important; }
.text-bg-warning { background-color: var(--fx-warning) !important; color: var(--fx-on-warning) !important; }
.text-bg-info    { background-color: var(--fx-info) !important;    color: var(--fx-on-info) !important; }
/* Bootstrap ke "-subtle" surfaces: dark theme mein yeh light values rehte
   hain, is liye tokens par lagana zaroori hai. */
.bg-dark-subtle  { background-color: var(--fx-surface-3) !important; color: var(--fx-text-2) !important; }
.bg-light-subtle { background-color: var(--fx-surface-2) !important; color: var(--fx-text-2) !important; }
.bg-body-secondary, .bg-secondary-subtle { color: var(--fx-text-2) !important; }
/* Bootstrap ka default <code> rang (magenta) dono theme mein kamzor hai */
code, code.small { color: var(--fx-info); background: var(--fx-info-soft); padding: .12em .38em; border-radius: 4px; }
pre code { background: none; padding: 0; }
.border-primary-subtle { border-color: var(--fx-primary-line) !important; }
.border, .border-top, .border-bottom, .border-start, .border-end { border-color: var(--fx-border) !important; }

/* Risk ramp -- ek hi zabaan poore software mein */
.fx-risk {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: var(--fx-t-micro); font-weight: 700;
    letter-spacing: .05em; text-transform: uppercase;
    padding: 2px 9px; border-radius: var(--fx-r-pill);
    border: 1px solid currentColor; white-space: nowrap;
}
.fx-risk::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.fx-risk.is-critical { color: var(--fx-risk-critical); background: var(--fx-danger-soft); }
.fx-risk.is-high     { color: var(--fx-risk-high);     background: rgba(240,136,62,.14); }
.fx-risk.is-medium   { color: var(--fx-risk-medium);   background: var(--fx-warning-soft); }
.fx-risk.is-low      { color: var(--fx-risk-low);      background: var(--fx-success-soft); }
.fx-risk.is-none     { color: var(--fx-risk-none);     background: var(--fx-neutral-soft); }

/* Score meter -- number ke saath shakal bhi */
.fx-meter { display: flex; align-items: center; gap: 8px; min-width: 116px; }
.fx-meter-track {
    flex: 1; height: 5px; border-radius: var(--fx-r-pill);
    background: var(--fx-surface-3); overflow: hidden;
}
.fx-meter-fill { height: 100%; border-radius: inherit; background: var(--fx-primary); transition: width var(--fx-mid); }
.fx-meter-fill.is-critical { background: var(--fx-risk-critical); }
.fx-meter-fill.is-high     { background: var(--fx-risk-high); }
.fx-meter-fill.is-medium   { background: var(--fx-risk-medium); }
.fx-meter-fill.is-low      { background: var(--fx-risk-low); }
.fx-meter-val { font-family: var(--fx-mono); font-size: var(--fx-t-sm); font-weight: 600; color: var(--fx-text); font-variant-numeric: tabular-nums; }

/* Purane badge classes */
.badge-number, .badge-target {
    background: var(--fx-primary-soft); color: var(--fx-primary);
    border: 1px solid var(--fx-primary-line);
    padding: 3px 8px; border-radius: var(--fx-r-sm); font-weight: 600; font-size: var(--fx-t-xs);
}
.badge-bparty {
    background: var(--fx-info-soft); color: var(--fx-info);
    border: 1px solid var(--fx-info-line);
    padding: 3px 8px; border-radius: var(--fx-r-sm); font-weight: 600; font-size: var(--fx-t-xs);
}
.num-inc   { color: var(--fx-success); font-weight: 700; }
.num-out   { color: var(--fx-warning); font-weight: 700; }
.num-total { color: var(--fx-text); font-weight: 700; background: var(--fx-neutral-soft); padding: 2px 7px; border-radius: var(--fx-r-sm); }
.target-name { color: var(--fx-text); font-weight: 600; }
.status-fetching { color: var(--fx-warning); font-size: var(--fx-t-xs); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.status-na { color: var(--fx-text-faint); font-size: var(--fx-t-xs); }


/* ==========================================================================
   11  ALERTS + TOASTS
   ========================================================================== */

.alert {
    border-radius: var(--fx-r);
    border: 1px solid var(--fx-border);
    border-left-width: 3px;
    background: var(--fx-surface-2);
    color: var(--fx-text-2);
    padding: var(--fx-s3) var(--fx-s4);
    font-size: var(--fx-t-body);
    margin-bottom: var(--fx-s4);
}
/* NOTE: .alert JAAN BOOJH KAR flex container NAHI hai. In alerts ke andar
   aksar inline content hota hai (pills, badges, links); flex banane par
   har tukra apna flex item ban jata hai aur wrap karna chhor deta hai --
   natija chhoti screen par safha chaura ho jata tha. */
.alert > i:first-child, .alert .fx-alert-icon { font-size: 1rem; margin-right: 7px; }
.alert .alert-heading, .alert strong:first-child { color: var(--fx-text); font-weight: 700; font-size: var(--fx-t-card); }
.alert .btn-close { margin-left: auto; }
.alert-link { color: inherit; text-decoration: underline; font-weight: 600; }

.alert-primary { border-left-color: var(--fx-primary); background: var(--fx-primary-soft); color: var(--fx-text-2); }
.alert-primary > i:first-child { color: var(--fx-primary); }
.alert-success { border-left-color: var(--fx-success); background: var(--fx-success-soft); }
.alert-success > i:first-child, .alert-success .alert-heading { color: var(--fx-success); }
.alert-danger  { border-left-color: var(--fx-danger);  background: var(--fx-danger-soft); }
.alert-danger > i:first-child, .alert-danger .alert-heading { color: var(--fx-danger); }
.alert-warning { border-left-color: var(--fx-warning); background: var(--fx-warning-soft); }
.alert-warning > i:first-child, .alert-warning .alert-heading { color: var(--fx-warning); }
.alert-info    { border-left-color: var(--fx-info);    background: var(--fx-info-soft); }
.alert-info > i:first-child, .alert-info .alert-heading { color: var(--fx-info); }
.alert-secondary, .alert-light, .alert-dark { border-left-color: var(--fx-border-strong); background: var(--fx-surface-2); }

.btn-close {
    filter: none;
    background: none;
    opacity: .6; width: 20px; height: 20px; padding: 0;
    border: 0; border-radius: var(--fx-r-sm);
    position: relative;
}
.btn-close::before {
    content: "\00d7"; position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; line-height: 1; color: var(--fx-text-2);
}
.btn-close:hover { opacity: 1; background: var(--fx-surface-3); }

/* ---------- Toast ---------- */
.fx-toast-host, #premiumToastContainer, .toast-container {
    position: fixed; top: calc(var(--fx-topbar-h) + 12px); right: 16px;
    z-index: 2050; display: flex; flex-direction: column; gap: 8px;
    max-width: min(370px, calc(100vw - 32px));
    pointer-events: none;
}
.fx-toast, .toast {
    pointer-events: auto;
    display: flex; align-items: flex-start; gap: 10px;
    background: var(--fx-elevated);
    border: 1px solid var(--fx-border);
    border-left: 3px solid var(--fx-primary);
    border-radius: var(--fx-r);
    box-shadow: var(--fx-shadow-3);
    padding: 11px 13px;
    color: var(--fx-text-2);
    font-size: var(--fx-t-sm);
    animation: fx-toast-in 220ms cubic-bezier(.2,.9,.3,1);
    opacity: 1;
}
.fx-toast.is-out { animation: fx-toast-out 180ms ease forwards; }
.fx-toast .fx-toast-ico { flex: 0 0 auto; font-size: .95rem; margin-top: 1px; color: var(--fx-primary); }
.fx-toast .fx-toast-body { flex: 1; min-width: 0; }
.fx-toast .fx-toast-title { font-weight: 700; color: var(--fx-text); font-size: var(--fx-t-body); margin-bottom: 1px; }
.fx-toast .fx-toast-msg { color: var(--fx-text-muted); line-height: 1.45; }
.fx-toast .fx-toast-x {
    flex: 0 0 auto; background: none; border: 0; color: var(--fx-text-faint);
    cursor: pointer; font-size: .95rem; line-height: 1; padding: 2px 4px; border-radius: var(--fx-r-sm);
}
.fx-toast .fx-toast-x:hover { color: var(--fx-text); background: var(--fx-surface-3); }
.fx-toast.is-success { border-left-color: var(--fx-success); } .fx-toast.is-success .fx-toast-ico { color: var(--fx-success); }
.fx-toast.is-danger  { border-left-color: var(--fx-danger);  } .fx-toast.is-danger  .fx-toast-ico { color: var(--fx-danger); }
.fx-toast.is-warning { border-left-color: var(--fx-warning); } .fx-toast.is-warning .fx-toast-ico { color: var(--fx-warning); }
.fx-toast.is-info    { border-left-color: var(--fx-info);    } .fx-toast.is-info    .fx-toast-ico { color: var(--fx-info); }

@keyframes fx-toast-in  { from { opacity: 0; transform: translateX(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fx-toast-out { to   { opacity: 0; transform: translateX(14px) scale(.98); } }


/* ==========================================================================
   12  MODALS + SWEETALERT + DROPDOWNS + TABS
   ========================================================================== */

.modal-content {
    background: var(--fx-elevated);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r-lg);
    box-shadow: var(--fx-shadow-3);
    color: var(--fx-text-2);
}
.modal-header {
    border-bottom: 1px solid var(--fx-border);
    padding: var(--fx-s4);
    align-items: center; gap: 10px;
}
.modal-title { font-size: var(--fx-t-section); font-weight: 700; color: var(--fx-text); display: flex; align-items: center; gap: 9px; }
.modal-title i { color: var(--fx-primary); }
.modal-body { padding: var(--fx-s4); }
.modal-footer { border-top: 1px solid var(--fx-border); padding: var(--fx-s3) var(--fx-s4); gap: var(--fx-s2); }
.modal-backdrop.show { background: #05080e; opacity: .68; }
.modal.fade .modal-dialog { transition: transform 200ms cubic-bezier(.2,.9,.3,1), opacity 200ms; transform: translateY(-12px) scale(.99); }
.modal.show .modal-dialog { transform: none; }

/* Destructive modal saaf nazar aaye */
.fx-modal-danger .modal-header { border-bottom-color: var(--fx-danger-line); }
.fx-modal-danger .modal-title i { color: var(--fx-danger); }

/* SweetAlert2 -- wahi tokens */
.swal2-popup {
    background: var(--fx-elevated) !important;
    border: 1px solid var(--fx-border) !important;
    border-radius: var(--fx-r-lg) !important;
    color: var(--fx-text-2) !important;
    box-shadow: var(--fx-shadow-3) !important;
    font-family: var(--fx-font) !important;
    font-size: var(--fx-t-body) !important;
}
.swal2-title { color: var(--fx-text) !important; font-size: var(--fx-t-title) !important; font-weight: 700 !important; }
.swal2-html-container, .swal2-content { color: var(--fx-text-muted) !important; font-size: var(--fx-t-body) !important; }
.swal2-actions .swal2-styled {
    border-radius: var(--fx-r-sm) !important;
    font-weight: 600 !important; font-size: var(--fx-t-body) !important;
    padding: .46rem .95rem !important; box-shadow: none !important;
}
.swal2-actions .swal2-confirm { background: var(--fx-primary) !important; color: var(--fx-on-primary) !important; }
.swal2-actions .swal2-deny    { background: var(--fx-danger) !important;  color: var(--fx-on-danger) !important; }
.swal2-actions .swal2-cancel  { background: var(--fx-surface-3) !important; color: var(--fx-text) !important; border: 1px solid var(--fx-border) !important; }
/* Backdrop sirf asli modal ke liye. Toast mode mein SweetAlert bhi
   swal2-backdrop-show lagata hai -- us se poora safha dhundla pad jata tha
   jabke toast to sirf ek kone ka paighaam hai. */
/* AHEM: SweetAlert2 v11 `swal2-toast-shown` class CONTAINER par nahi,
   <body> par lagata hai. Is liye selector body se shuru hota hai -- warna
   toast mode mein bhi backdrop lag jata hai aur poora safha dhundla ho
   jata hai (jabke toast sirf ek kone ka paighaam hai). */
.swal2-container.swal2-backdrop-show { background: rgba(5,8,14,.68) !important; }
body.swal2-toast-shown .swal2-container {
    background: transparent !important;
    pointer-events: none;          /* toast ke peeche ka safha chalta rahe */
}
body.swal2-toast-shown .swal2-container .swal2-toast { pointer-events: auto; }
.swal2-input, .swal2-textarea, .swal2-select {
    background: var(--fx-surface-2) !important; border: 1px solid var(--fx-border) !important;
    color: var(--fx-text) !important; border-radius: var(--fx-r-sm) !important;
}
.swal2-icon { border-color: currentColor !important; }
.swal2-icon.swal2-warning { color: var(--fx-warning) !important; }
.swal2-icon.swal2-error   { color: var(--fx-danger) !important; }
.swal2-icon.swal2-success { color: var(--fx-success) !important; }
.swal2-icon.swal2-info, .swal2-icon.swal2-question { color: var(--fx-info) !important; }
.swal2-toast {
    background: var(--fx-elevated) !important;
    border: 1px solid var(--fx-border) !important;
    box-shadow: var(--fx-shadow-3) !important;
    border-radius: var(--fx-r) !important;
    padding: 12px 14px !important;
}
.swal2-toast .swal2-title { font-size: var(--fx-t-card) !important; font-weight: 700 !important; margin: 0 !important; text-align: left; }
.swal2-toast .swal2-html-container { margin: 3px 0 0 !important; text-align: left; }
.swal2-toast .swal2-icon { width: 1.5em !important; height: 1.5em !important; margin: 0 .6em 0 0 !important; }
.swal2-toast .swal2-timer-progress-bar { background: var(--fx-primary) !important; }
/* Har natije ka apna kinara -- rang akela kaafi nahi, is liye icon bhi saath */
.fx-flash { border-left: 3px solid var(--fx-primary) !important; }
.fx-flash--success { border-left-color: var(--fx-success) !important; }
.fx-flash--success .swal2-timer-progress-bar { background: var(--fx-success) !important; }
.fx-flash--danger, .fx-flash--error { border-left-color: var(--fx-danger) !important; }
.fx-flash--danger .swal2-timer-progress-bar, .fx-flash--error .swal2-timer-progress-bar { background: var(--fx-danger) !important; }
.fx-flash--warning { border-left-color: var(--fx-warning) !important; }
.fx-flash--warning .swal2-timer-progress-bar { background: var(--fx-warning) !important; }
.fx-flash--info { border-left-color: var(--fx-info) !important; }
.fx-flash--info .swal2-timer-progress-bar { background: var(--fx-info) !important; }
/* Toast topbar ke neeche baithe, us ke ooper nahi */
.swal2-container.swal2-top-end { padding-top: calc(var(--fx-topbar-h) + 10px) !important; }

/* Dropdowns */
/* Khula hua menu har safhe ke apne "ooncha" hisse se ooper rahe.
   Criminal Intelligence ki nav-bar 1035 par hai (Leaflet ki wajah se), is
   liye Bootstrap ka default 1000 us ke neeche dab jata tha aur menu ke
   aakhri options click nahi hote the. 1040 modal (1050/1055) se neeche
   hai, is liye modal khule to menu us ke ooper nahi aata. */
.dropdown-menu.show { z-index: 1040; }
.dropdown-menu {
    background: var(--fx-elevated);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r);
    box-shadow: var(--fx-shadow-3);
    padding: 5px;
    font-size: var(--fx-t-body);
    color: var(--fx-text-2);
    min-width: 200px;
}
.dropdown-item {
    color: var(--fx-text-2); border-radius: var(--fx-r-sm);
    padding: 7px 10px; display: flex; align-items: center; gap: 9px;
    font-size: var(--fx-t-body);
}
.dropdown-item:hover, .dropdown-item:focus { background: var(--fx-surface-3); color: var(--fx-text); }
.dropdown-item.active, .dropdown-item:active { background: var(--fx-primary); color: var(--fx-primary-fg); }
.dropdown-item.text-danger:hover { background: var(--fx-danger-soft); color: var(--fx-danger) !important; }
.dropdown-item i { width: 15px; text-align: center; opacity: .85; }
.dropdown-header { color: var(--fx-text-muted); font-size: var(--fx-t-micro); text-transform: uppercase; letter-spacing: .09em; font-family: var(--fx-mono); padding: 8px 10px 4px; }

/* Tabs */
.nav-tabs {
    border-bottom: 1px solid var(--fx-border);
    gap: 2px;
    margin-bottom: var(--fx-s4);
}
.nav-tabs .nav-link {
    border: 0; border-bottom: 2px solid transparent;
    color: var(--fx-text-muted); font-weight: 600; font-size: var(--fx-t-body);
    padding: 9px 14px; border-radius: var(--fx-r-sm) var(--fx-r-sm) 0 0;
    display: inline-flex; align-items: center; gap: 7px;
    transition: color var(--fx-fast), background var(--fx-fast), border-color var(--fx-fast);
}
.nav-tabs .nav-link:hover { color: var(--fx-text); background: var(--fx-surface-2); border-bottom-color: var(--fx-border-strong); }
.nav-tabs .nav-link.active {
    background: transparent; color: var(--fx-primary);
    border-bottom-color: var(--fx-primary);
}
.nav-pills .nav-link { color: var(--fx-text-muted); border-radius: var(--fx-r-sm); font-weight: 600; font-size: var(--fx-t-body); }
.nav-pills .nav-link.active { background: var(--fx-primary); color: var(--fx-primary-fg); }

/* Accordion */
.accordion { --bs-accordion-bg: transparent; --bs-accordion-border-color: var(--fx-border); }
.accordion-item { background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-r); margin-bottom: 8px; overflow: hidden; }
.accordion-button {
    background: var(--fx-surface); color: var(--fx-text);
    font-weight: 600; font-size: var(--fx-t-body); padding: 12px var(--fx-s4);
    box-shadow: none;
}
.accordion-button:not(.collapsed) { background: var(--fx-surface-2); color: var(--fx-primary); box-shadow: none; }
.accordion-button:focus { box-shadow: var(--fx-ring); }
.accordion-button::after { filter: none; opacity: .6; }
.accordion-body { background: var(--fx-surface); color: var(--fx-text-2); padding: var(--fx-s4); }

/* Tooltips + popovers */
.tooltip { --bs-tooltip-bg: var(--fx-ink-2); --bs-tooltip-color: #f1f5f9; font-size: var(--fx-t-xs); font-family: var(--fx-font); }
.tooltip-inner {
    background: var(--fx-ink-2); color: #f1f5f9;
    border-radius: var(--fx-r-sm); padding: 5px 9px;
    max-width: 260px; box-shadow: var(--fx-shadow-2);
    font-weight: 500; text-align: left;
}
.tooltip .tooltip-arrow::before { border-top-color: var(--fx-ink-2); border-bottom-color: var(--fx-ink-2); }
.popover { background: var(--fx-elevated); border: 1px solid var(--fx-border); border-radius: var(--fx-r); box-shadow: var(--fx-shadow-3); }
.popover-header { background: var(--fx-surface-2); border-bottom-color: var(--fx-border); color: var(--fx-text); font-size: var(--fx-t-sm); }
.popover-body { color: var(--fx-text-2); font-size: var(--fx-t-sm); }

/* Offcanvas -- mobile drawer */
.offcanvas { background: var(--fx-surface); color: var(--fx-text-2); border-color: var(--fx-border); }
.offcanvas-header { border-bottom: 1px solid var(--fx-border); }
.offcanvas-title { color: var(--fx-text); font-size: var(--fx-t-section); font-weight: 700; }

/* List groups */
.list-group { --bs-list-group-bg: transparent; }
.list-group-item {
    background: var(--fx-surface); border-color: var(--fx-border);
    color: var(--fx-text-2); font-size: var(--fx-t-body); padding: 10px var(--fx-s4);
}
.list-group-item-action:hover { background: var(--fx-surface-2); color: var(--fx-text); }
.list-group-item.active { background: var(--fx-primary); border-color: var(--fx-primary); color: var(--fx-primary-fg); }

/* Progress */
.progress { background: var(--fx-surface-3); border-radius: var(--fx-r-pill); height: 8px; overflow: hidden; }
.progress-bar { background: var(--fx-primary); transition: width var(--fx-mid); }
.progress-bar.bg-success { background: var(--fx-success) !important; }
.progress-bar.bg-danger  { background: var(--fx-danger) !important; }
.progress-bar.bg-warning { background: var(--fx-warning) !important; }


/* ==========================================================================
   13  UPLOAD / DROPZONE
   --------------------------------------------------------------------------
   CDR, BTS, SubInfo, IMEI aur CI imports -- paanchon ka ek hi tajruba.
   ========================================================================== */

/* body ... se specificity ek darja barhti hai, taake safhe ka apna
   `border: 2px dashed <primary>` yahan se dabaya ja sake -- dropzone
   ka kinara sirf hover/drag par roshan hota hai, hamesha nahi. */
body .drop-zone, body .fx-dropzone {
    border: 1.5px dashed var(--fx-border-strong);
    background: var(--fx-surface-2);
}
body .drop-zone:hover, body .fx-dropzone:hover,
body .drop-zone.dragover, body .fx-dropzone.is-over {
    border-color: var(--fx-primary);
    background: var(--fx-primary-soft);
}
.drop-zone, .fx-dropzone {
    position: relative;
    border: 1.5px dashed var(--fx-border-strong);
    border-radius: var(--fx-r);
    background: var(--fx-surface-2);
    padding: var(--fx-s7) var(--fx-s5);
    text-align: center;
    cursor: pointer;
    transition: border-color var(--fx-fast), background var(--fx-fast);
}
.drop-zone:hover, .fx-dropzone:hover,
.drop-zone.dragover, .fx-dropzone.is-over {
    border-color: var(--fx-primary);
    background: var(--fx-primary-soft);
    transform: none;
    box-shadow: none;
}
.drop-zone input[type="file"], .fx-dropzone input[type="file"] {
    position: absolute; inset: 0; width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.fx-dropzone-icon, .drop-icon-wrapper {
    width: 46px; height: 46px; border-radius: var(--fx-r);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-primary-soft); color: var(--fx-primary);
    border: 1px solid var(--fx-primary-line);
    font-size: 1.15rem; margin-bottom: 10px;
}
.fx-dropzone-title, .drop-zone p {
    margin: 0; font-size: var(--fx-t-card); font-weight: 600; color: var(--fx-text);
}
.fx-dropzone-hint, .drop-zone span {
    display: block; margin-top: 5px;
    font-size: var(--fx-t-xs); color: var(--fx-text-muted);
}
.fx-dropzone-formats {
    display: inline-flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; justify-content: center;
}

/* Chuni hui files ki fehrist */
.fx-filelist, .file-list { margin-top: var(--fx-s3); display: flex; flex-direction: column; gap: 5px; text-align: left; }
.fx-file {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 11px; border-radius: var(--fx-r-sm);
    background: var(--fx-surface); border: 1px solid var(--fx-border);
    font-size: var(--fx-t-sm);
}
.fx-file .fx-file-ico {
    width: 26px; height: 26px; flex: 0 0 26px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-neutral-soft); color: var(--fx-text-muted); font-size: .78rem;
}
.fx-file .fx-file-name { flex: 1; min-width: 0; color: var(--fx-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fx-file .fx-file-size { font-family: var(--fx-mono); font-size: var(--fx-t-xs); color: var(--fx-text-muted); flex: 0 0 auto; }
.fx-file.is-over-limit { border-color: var(--fx-danger-line); background: var(--fx-danger-soft); }
.fx-file.is-over-limit .fx-file-size { color: var(--fx-danger); }
.fx-file.is-done .fx-file-ico { background: var(--fx-success-soft); color: var(--fx-success); }

/* Upload progress */
.fx-progress-wrap { margin-top: var(--fx-s3); }
.fx-progress-head {
    display: flex; align-items: center; justify-content: space-between;
    font-size: var(--fx-t-xs); color: var(--fx-text-muted); margin-bottom: 6px;
}
.fx-progress-head .fx-pct { font-family: var(--fx-mono); color: var(--fx-text); font-weight: 600; }
.fx-progress-track, #uploadProgressWrap .progress {
    height: 6px; border-radius: var(--fx-r-pill);
    background: var(--fx-surface-3); overflow: hidden;
}
.fx-progress-bar, #uploadProgressBar {
    height: 100%; border-radius: inherit; width: 0%;
    background: linear-gradient(90deg, var(--fx-primary), var(--fx-primary-strong));
    transition: width 180ms ease;
}
.fx-progress-bar.is-indeterminate {
    width: 35% !important;
    animation: fx-indet 1.15s ease-in-out infinite;
}
@keyframes fx-indet { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }


/* ==========================================================================
   14  EMPTY / LOADING / ERROR STATES
   ========================================================================== */

.fx-empty {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    padding: var(--fx-s8) var(--fx-s5);
    color: var(--fx-text-muted);
}
.fx-empty .fx-empty-ico {
    width: 52px; height: 52px; border-radius: var(--fx-r);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-surface-3); color: var(--fx-text-faint);
    border: 1px solid var(--fx-border);
    font-size: 1.3rem; margin-bottom: var(--fx-s3);
}
.fx-empty h4, .fx-empty .fx-empty-title {
    margin: 0 0 5px; font-size: var(--fx-t-section); font-weight: 700; color: var(--fx-text);
}
.fx-empty p { margin: 0; font-size: var(--fx-t-body); max-width: 46ch; line-height: 1.55; }
.fx-empty .fx-empty-actions { margin-top: var(--fx-s4); display: flex; gap: var(--fx-s2); flex-wrap: wrap; justify-content: center; }
.fx-empty.is-compact { padding: var(--fx-s6) var(--fx-s4); }
.fx-empty.is-compact .fx-empty-ico { width: 40px; height: 40px; font-size: 1rem; }

/* Error state -- galti samajh aani chahiye */
.fx-error .fx-empty-ico { background: var(--fx-danger-soft); color: var(--fx-danger); border-color: var(--fx-danger-line); }
.fx-error-detail {
    margin-top: var(--fx-s3); max-width: 100%; text-align: left;
    font-family: var(--fx-mono); font-size: var(--fx-t-xs);
    color: var(--fx-text-muted); background: var(--fx-surface-2);
    border: 1px solid var(--fx-border); border-radius: var(--fx-r-sm);
    padding: 9px 11px; overflow-x: auto;
}

/* Skeletons */
.fx-skel {
    background: linear-gradient(90deg, var(--fx-surface-2) 25%, var(--fx-surface-3) 37%, var(--fx-surface-2) 63%);
    background-size: 400% 100%;
    animation: fx-shimmer 1.3s ease-in-out infinite;
    border-radius: var(--fx-r-sm);
    display: block;
}
@keyframes fx-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.fx-skel-line   { height: 11px; margin-bottom: 8px; }
.fx-skel-line.w-40 { width: 40%; } .fx-skel-line.w-60 { width: 60%; } .fx-skel-line.w-80 { width: 80%; }
.fx-skel-title  { height: 17px; width: 34%; margin-bottom: 13px; }
.fx-skel-kpi    { height: 92px; border-radius: var(--fx-r); }
.fx-skel-chart  { height: 220px; border-radius: var(--fx-r); }
.fx-skel-row    { height: 38px; margin-bottom: 6px; border-radius: var(--fx-r-sm); }
.fx-skel-avatar { width: 34px; height: 34px; border-radius: 50%; }

/* Inline spinner */
.fx-spinner {
    width: 15px; height: 15px; display: inline-block; vertical-align: -2px;
    border: 2px solid var(--fx-border-strong); border-top-color: var(--fx-primary);
    border-radius: 50%; animation: fx-spin .65s linear infinite;
}
.fx-loading-row {
    display: flex; align-items: center; gap: 9px;
    color: var(--fx-text-muted); font-size: var(--fx-t-sm);
    padding: var(--fx-s5); justify-content: center;
}
.spinner-border, .spinner-grow { color: var(--fx-primary); }

/* Poore panel par parda -- process chalte waqt */
.fx-busy { position: relative; pointer-events: none; }
.fx-busy::after {
    content: ""; position: absolute; inset: 0; z-index: 5;
    background: color-mix(in srgb, var(--fx-surface) 62%, transparent);
    border-radius: inherit;
    backdrop-filter: blur(1px);
}


/* ==========================================================================
   15  CHARTS + MAPS + SLIDERS
   ========================================================================== */

/* ApexCharts */
.apexcharts-canvas { color: var(--fx-text-2); }
/* Axis aur title -- card ke background par baithte hain, is liye muted.
   NOTE: pie/donut ke labels yahan SHAMIL NAHI: woh rangeen slice ke OOPER
   baithte hain, us liye un ka rang neeche alag diya gaya hai. */
.apexcharts-text, .apexcharts-title-text,
.apexcharts-xaxis-label, .apexcharts-yaxis-label,
.apexcharts-xaxis-title-text, .apexcharts-yaxis-title-text {
    fill: var(--fx-text-muted) !important;
    color: var(--fx-text-muted) !important;
    font-family: var(--fx-font) !important;
    font-size: 11px !important;
}
/* Bar/line ke ooper likhi hui ginti -- card par baithti hai, halki nahi honi chahiye */
.apexcharts-data-labels .apexcharts-datalabel {
    fill: var(--fx-text) !important;
    font-weight: 600 !important;
    paint-order: stroke; stroke: var(--fx-surface); stroke-width: 3px; stroke-linejoin: round;
}
/* Slice ke ooper ka label: muqabla slice ke rang se hai, card se nahi.
   Safed + gehra outline har rang par parha jata hai. */
.apexcharts-pie-label,
.apexcharts-datalabels .apexcharts-text,
.apexcharts-datalabel-label, .apexcharts-datalabel-value {
    fill: #ffffff !important;
    font-weight: 600 !important;
    paint-order: stroke;
    stroke: rgba(0, 0, 0, .55);
    stroke-width: 3px;
    stroke-linejoin: round;
}
/* Radial gauge ka bara hindsa beech mein hota hai -- wahan slice nahi,
   card hota hai, is liye normal text rang. */
.apexcharts-radialbar .apexcharts-datalabel-label,
.apexcharts-radialbar .apexcharts-datalabel-value {
    fill: var(--fx-text) !important;
    stroke: none !important;
}
.apexcharts-legend-text { color: var(--fx-text-2) !important; }
.apexcharts-gridline, .apexcharts-grid line { stroke: var(--fx-grid) !important; }
.apexcharts-tooltip, .apexcharts-tooltip.apexcharts-theme-light,
.apexcharts-tooltip.apexcharts-theme-dark {
    background: var(--fx-elevated) !important;
    border: 1px solid var(--fx-border) !important;
    box-shadow: var(--fx-shadow-3) !important;
    color: var(--fx-text) !important;
    border-radius: var(--fx-r-sm) !important;
    font-family: var(--fx-font) !important;
}
.apexcharts-tooltip-title {
    background: var(--fx-surface-2) !important;
    border-bottom: 1px solid var(--fx-border) !important;
    color: var(--fx-text) !important;
    font-family: var(--fx-mono) !important;
    font-size: var(--fx-t-xs) !important;
}
.apexcharts-xaxistooltip, .apexcharts-yaxistooltip {
    background: var(--fx-elevated) !important; border-color: var(--fx-border) !important;
    color: var(--fx-text) !important;
}
.apexcharts-menu { background: var(--fx-elevated) !important; border-color: var(--fx-border) !important; }
.apexcharts-menu-item:hover { background: var(--fx-surface-3) !important; }

/* Chart container -- hamesha apni jagah rakhta hai, kabhi 0px collapse nahi */
.fx-chart { position: relative; min-height: 200px; }
.fx-chart-legend { display: flex; flex-wrap: wrap; gap: var(--fx-s3); margin-top: var(--fx-s3); }
.fx-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fx-t-xs); color: var(--fx-text-muted); }
.fx-legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: 0 0 9px; }

/* Leaflet -- controls theme ke andar */
.leaflet-container { background: var(--fx-surface-3); font-family: var(--fx-font); border-radius: var(--fx-r); }
.leaflet-control-container .leaflet-bar,
.leaflet-control-zoom {
    border: 1px solid var(--fx-border) !important;
    border-radius: var(--fx-r-sm) !important;
    box-shadow: var(--fx-shadow-2) !important;
    overflow: hidden;
}
.leaflet-bar a, .leaflet-control-zoom a {
    background: var(--fx-surface) !important;
    color: var(--fx-text-2) !important;
    border-bottom-color: var(--fx-border) !important;
}
.leaflet-bar a:hover { background: var(--fx-surface-3) !important; color: var(--fx-text) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
    background: var(--fx-elevated) !important;
    color: var(--fx-text-2) !important;
    border: 1px solid var(--fx-border);
    box-shadow: var(--fx-shadow-3) !important;
    border-radius: var(--fx-r) !important;
}
.leaflet-popup-content { margin: 11px 13px; font-size: var(--fx-t-sm); }
.leaflet-popup-content b, .leaflet-popup-content strong { color: var(--fx-text); }
.leaflet-control-attribution {
    background: color-mix(in srgb, var(--fx-surface) 82%, transparent) !important;
    color: var(--fx-text-faint) !important; font-size: 10px !important;
}
.leaflet-control-attribution a { color: var(--fx-text-muted) !important; }
/* Dark theme mein tile layer thora sanjeeda -- rangon ki chamak kam */
:root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.82) saturate(.86) contrast(1.04); }

/* Map ke saath ka side panel */
.fx-map-shell { display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: var(--fx-s4); align-items: stretch; }
.fx-map-side {
    background: var(--fx-surface); border: 1px solid var(--fx-border);
    border-radius: var(--fx-r); padding: var(--fx-s4); overflow-y: auto; max-height: 72vh;
}
.fx-map-legend {
    position: absolute; bottom: 12px; left: 12px; z-index: 500;
    background: color-mix(in srgb, var(--fx-elevated) 92%, transparent);
    border: 1px solid var(--fx-border); border-radius: var(--fx-r-sm);
    padding: 9px 11px; font-size: var(--fx-t-xs); color: var(--fx-text-2);
    box-shadow: var(--fx-shadow-2); backdrop-filter: blur(6px);
}

/* noUiSlider */
.noUi-target {
    background: var(--fx-surface-3); border: 1px solid var(--fx-border);
    box-shadow: none; border-radius: var(--fx-r-pill); height: 5px;
}
.noUi-connect { background: var(--fx-primary); }
.noUi-handle {
    background: var(--fx-surface); border: 2px solid var(--fx-primary);
    border-radius: 50%; box-shadow: var(--fx-shadow-1);
    width: 15px !important; height: 15px !important; right: -8px !important; top: -6px !important;
    cursor: grab;
}
.noUi-handle::before, .noUi-handle::after { display: none; }
.noUi-handle:active { cursor: grabbing; }
.noUi-tooltip {
    background: var(--fx-ink-2); color: #f1f5f9; border: 0;
    border-radius: var(--fx-r-sm); font-size: var(--fx-t-xs);
    font-family: var(--fx-mono); padding: 2px 7px;
}
.noUi-marker { background: var(--fx-border); }
.noUi-value { color: var(--fx-text-muted); font-size: var(--fx-t-micro); }

/* Timeline -- movement, case history, audit */
.fx-timeline { position: relative; padding-left: 22px; }
.fx-timeline::before {
    content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px;
    width: 1px; background: var(--fx-border);
}
.fx-tl-item { position: relative; padding-bottom: var(--fx-s4); }
.fx-tl-item::before {
    content: ""; position: absolute; left: -19px; top: 5px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--fx-surface); border: 2px solid var(--fx-primary);
}
.fx-tl-item.is-alert::before { border-color: var(--fx-danger); }
.fx-tl-time { font-family: var(--fx-mono); font-size: var(--fx-t-micro); color: var(--fx-text-muted); letter-spacing: .04em; }
.fx-tl-title { font-size: var(--fx-t-body); font-weight: 600; color: var(--fx-text); margin: 2px 0; }
.fx-tl-body { font-size: var(--fx-t-sm); color: var(--fx-text-muted); }


/* ==========================================================================
   16  UTILITIES
   ========================================================================== */

.fx-stack   { display: flex; flex-direction: column; gap: var(--fx-s3); }
.fx-row     { display: flex; align-items: center; gap: var(--fx-s3); flex-wrap: wrap; }
.fx-row-tight { display: flex; align-items: center; gap: var(--fx-s2); flex-wrap: wrap; }
.fx-push    { margin-left: auto; }
.fx-grid-2  { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px,1fr)); gap: var(--fx-s4); }
.fx-grid-3  { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px,1fr)); gap: var(--fx-s4); }
.fx-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.fx-divider { height: 1px; background: var(--fx-border); border: 0; margin: var(--fx-s5) 0; }
.fx-divider-v { width: 1px; align-self: stretch; background: var(--fx-border); }

/* Key/value pairs -- profile, case facts, details panel */
.fx-kv { display: grid; grid-template-columns: minmax(110px, 34%) 1fr; gap: 7px var(--fx-s4); font-size: var(--fx-t-body); }
.fx-kv dt { color: var(--fx-text-muted); font-weight: 500; font-size: var(--fx-t-sm); }
.fx-kv dd { color: var(--fx-text); margin: 0; font-weight: 500; word-break: break-word; }
.fx-kv dd.is-empty { color: var(--fx-text-faint); font-style: italic; font-weight: 400; }

/* Section heading -- unwan aur us ki wazahat ek saath, action alag kinare.
   Note unwan ke NEECHE rehta hai: doosre kinare par bhej dena us ka rishta
   unwan se tor deta hai. */
.fx-sec-head {
    display: flex; align-items: flex-start; gap: 10px;
    margin: var(--fx-s6) 0 var(--fx-s3);
    padding-bottom: 9px; border-bottom: 1px solid var(--fx-border);
}
.fx-sec-head:first-child { margin-top: 0; }
.fx-sec-head > i:first-child { margin-top: 3px; font-size: .95rem; flex: 0 0 auto; }
.fx-sec-head h5, .fx-sec-head .fx-sec-title {
    margin: 0; font-size: var(--fx-t-section); font-weight: 700; color: var(--fx-text);
    letter-spacing: -.012em;
}
.fx-sec-head .fx-sec-note {
    display: block; font-size: var(--fx-t-xs); color: var(--fx-text-muted);
    margin-top: 2px; max-width: 72ch;
}
.fx-sec-head .fx-sec-body { flex: 1; min-width: 0; }
.fx-sec-head .fx-sec-action { margin-left: auto; flex: 0 0 auto; padding-top: 1px; }

/* Numbered section -- reports mein, jahan tarteeb khud maloomat hai */
.fx-numbered { counter-reset: fxsec; }
.fx-numbered > .fx-sec-head::before {
    counter-increment: fxsec; content: counter(fxsec);
    width: 22px; height: 22px; flex: 0 0 22px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-primary-soft); color: var(--fx-primary);
    font-family: var(--fx-mono); font-size: var(--fx-t-micro); font-weight: 600;
}

/* Lead ranking -- suspect finder / cdr finder */
.fx-lead {
    display: flex; align-items: center; gap: var(--fx-s4);
    padding: var(--fx-s3) var(--fx-s4);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r);
    background: var(--fx-surface);
    margin-bottom: 8px;
    transition: border-color var(--fx-fast), background var(--fx-fast);
}
.fx-lead:hover { border-color: var(--fx-border-strong); background: var(--fx-surface-2); }
.fx-lead.is-prime { border-left: 3px solid var(--fx-signal); background: linear-gradient(90deg, var(--fx-signal-soft), transparent 34%), var(--fx-surface); }
.fx-lead-rank {
    width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-surface-3); color: var(--fx-text-muted);
    font-family: var(--fx-mono); font-size: var(--fx-t-sm); font-weight: 600;
}
.fx-lead.is-prime .fx-lead-rank { background: var(--fx-signal-soft); color: var(--fx-signal); border: 1px solid var(--fx-signal-line); }
.fx-lead-main { flex: 1; min-width: 0; }
.fx-lead-id { font-family: var(--fx-mono); font-size: var(--fx-t-card); font-weight: 600; color: var(--fx-text); }
.fx-lead-why { font-size: var(--fx-t-xs); color: var(--fx-text-muted); margin-top: 2px; }
.fx-lead-side { display: flex; align-items: center; gap: var(--fx-s4); flex: 0 0 auto; }

/* Evidence / contributing factor */
.fx-factor {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 12px; border-radius: var(--fx-r-sm);
    background: var(--fx-surface-2); border: 1px solid var(--fx-border-soft);
    font-size: var(--fx-t-sm);
}
.fx-factor .fx-factor-ico {
    width: 24px; height: 24px; flex: 0 0 24px; border-radius: var(--fx-r-sm);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .72rem; background: var(--fx-primary-soft); color: var(--fx-primary);
}
.fx-factor-title { font-weight: 600; color: var(--fx-text); }
.fx-factor-note  { color: var(--fx-text-muted); margin-top: 1px; }
.fx-factor-score { margin-left: auto; font-family: var(--fx-mono); font-weight: 600; color: var(--fx-text); flex: 0 0 auto; }

/* Target header -- single_analyze, ci_profile */
.fx-subject {
    display: flex; align-items: center; gap: var(--fx-s4); flex-wrap: wrap;
    padding: var(--fx-s5);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-r-lg);
    background:
        radial-gradient(900px 200px at 0% 0%, var(--fx-primary-soft), transparent 62%),
        var(--fx-surface);
    margin-bottom: var(--fx-s5);
}
.fx-subject-avatar {
    width: 52px; height: 52px; flex: 0 0 52px; border-radius: var(--fx-r);
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--fx-ink); color: var(--fx-on-ink); font-size: 1.25rem;
    border: 1px solid var(--fx-border-strong);
}
.fx-subject-id {
    font-family: var(--fx-mono); font-size: 1.3rem; font-weight: 600;
    color: var(--fx-text); letter-spacing: -.01em; line-height: 1.15;
}
.fx-subject-meta { display: flex; align-items: center; gap: var(--fx-s3); flex-wrap: wrap; margin-top: 5px; font-size: var(--fx-t-sm); color: var(--fx-text-muted); }
.fx-subject-side { margin-left: auto; display: flex; align-items: center; gap: var(--fx-s5); flex-wrap: wrap; }

/* -------------------------------------------------------------------------
   HAMESHA GEHRI SAT-H  (fixed-dark bands)
   Kuch bands DONO theme mein gehre rehte hain: CI hero, target header,
   tower hero, dossier head, network controls, case hero. Un ke andar ka
   matn theme ke saath NAHI palat-na chahiye -- warna light theme mein
   gehra matn gehre band par bilkul ghayab ho jata hai.

   Yeh wahi ghalti thi jo pehle network graph ke labels ke saath hui:
   sat-h fixed thi, matn ka token theme ke saath palat raha tha.

   Naye markup ke liye sirf class .fx-on-dark laga dena kaafi hai.
   ------------------------------------------------------------------------- */
.fx-on-dark, .ci-hero, .cd-hero,
.tower-hero, .dossier-head, .ps-head, .network-controls,
.bg-dark:not(.card-header), .text-bg-dark:not(.card-header) {
    color: #e9f0fc;
}
:is(.fx-on-dark, .ci-hero, .cd-hero,
    .tower-hero, .dossier-head, .ps-head, .network-controls,
    .bg-dark:not(.card-header), .text-bg-dark:not(.card-header))
    :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6) {
    color: #ffffff !important;
}
:is(.fx-on-dark, .ci-hero, .cd-hero,
    .tower-hero, .dossier-head, .ps-head, .network-controls,
    .bg-dark:not(.card-header), .text-bg-dark:not(.card-header))
    :is(.text-muted, .text-body, .text-dark, .text-secondary, .small.text-muted):not(.badge):not(.btn):not([class*="bg-"]) {
    /* .badge / .btn / bg-* apni sat-h khud rakhte hain -- un ka matn band
       se nahi, apne background se muqable mein hona chahiye. Warna gehre
       band mein rakha hua halka badge safed-par-safed ho jata hai. */
    color: rgba(233, 240, 252, .74) !important;
}
/* Band ke andar har aam element band ka rang le -- apna nahi.
   `.card-body` list mein JAAN BOOJH KAR hai: woh khud color set karta hai
   aur us ke saare bachche us se rang lete the, is liye band ka safed rang
   wahin ruk jata tha. `:is()` ki specificity (0,2,0) us se aage nikal jati
   hai. Semantic rang (.text-warning waghera) `!important` ke saath aate
   hain, is liye woh mehfooz rehte hain. */
:is(.fx-on-dark, .ci-hero, .cd-hero,
    .tower-hero, .dossier-head, .ps-head, .network-controls,
    .bg-dark:not(.card-header), .text-bg-dark:not(.card-header))
    :is(.card-body, .card-header, .card, div, span, p, li, td, th, dt, dd,
        b, strong, small, em, label, a:not(.btn)):not(.badge):not(.btn):not([class*="bg-"]) {
    color: inherit;
}
/* Bootstrap ke apne "on dark" utilities bhi fixed rahen */
:is(.fx-on-dark, .ci-hero, .cd-hero,
    .tower-hero, .dossier-head, .ps-head, .network-controls,
    .bg-dark:not(.card-header), .text-bg-dark:not(.card-header)) .text-white-50 {
    color: rgba(233, 240, 252, .58) !important;
}
/* .text-light aam safhe par theme ke saath chalti hai (ooper dekhen), magar
   asli gehre band ke andar apna asal matlab wapas le leti hai. */
:is(.fx-on-dark, .ci-hero, .cd-hero,
    .tower-hero, .dossier-head, .ps-head, .network-controls,
    .bg-dark:not(.card-header), .text-bg-dark:not(.card-header))
    :is(.text-light, .text-white):not(.badge):not(.btn):not([class*="bg-"]) {
    color: #f2f6fd !important;
}

/* -------------------------------------------------------------------------
   CARD HEADER HAMESHA THEME KE SAATH
   Kuch safhon ka markup header par Bootstrap ki .bg-dark / .text-bg-dark
   lagata hai. Us ka matlab "hamesha gehra" hai -- aur din ki roshni mein
   yeh safhe ke baaki sections se ajnabi lagta tha: sab headers halke, aur
   yeh kaale. User ki hidayat: har section ka header din mein halka ho aur
   raat mein gehra.

   Is liye card ke header par gehra band mansookh: woh aam .card-header ban
   jata hai. `.text-white` jo markup mein saath aati hai, us ka asar bhi
   yahin khatam kiya jata hai warna halki sat-h par safed matn ghayab hota.
   ------------------------------------------------------------------------- */
.card-header.bg-dark, .card-header.text-bg-dark, .card-header.threat-header {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: var(--fx-text) !important;
    border-bottom: 1px solid var(--fx-border);
}
:is(.card-header.bg-dark, .card-header.text-bg-dark, .card-header.threat-header)
    :is(h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6, .card-title) {
    color: var(--fx-text) !important;
}
:is(.card-header.bg-dark, .card-header.text-bg-dark, .card-header.threat-header)
    :is(.text-white, .text-light):not(.badge):not(.btn):not([class*="bg-"]) {
    color: var(--fx-text) !important;
}
:is(.card-header.bg-dark, .card-header.text-bg-dark, .card-header.threat-header)
    :is(.text-white-50, .text-muted):not(.badge):not(.btn):not([class*="bg-"]) {
    color: var(--fx-text-muted) !important;
}
/* Header ke andar rakha hua halka badge ab halke header par nazar aaye */
:is(.card-header.bg-dark, .card-header.text-bg-dark, .card-header.threat-header)
    :is(.badge.bg-light, .badge.bg-white) {
    background-color: var(--fx-surface-2) !important;
    color: var(--fx-text-2) !important;
    border: 1px solid var(--fx-border) !important;
}

/* Screen-reader only */
.fx-sr, .visually-hidden {
    position: absolute !important; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* Legacy .container / .header / .card-title se aane wale safhe */
.container { max-width: 1760px; margin-inline: auto; padding-inline: var(--fx-s5); }
.header {
    background: var(--fx-surface); border-bottom: 1px solid var(--fx-border);
    box-shadow: none; backdrop-filter: none;
    padding: var(--fx-s4) var(--fx-s5);
}
.header h1 { font-size: var(--fx-t-title); color: var(--fx-text); }
.header h1 i { color: var(--fx-primary); }
.header p { color: var(--fx-text-muted); font-size: var(--fx-t-sm); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: var(--fx-s3); margin-bottom: var(--fx-s5); }


/* ==========================================================================
   17  RESPONSIVE
   ========================================================================== */

/* Wide desktop -- jagah ka faida uthao, lekin sator lambi na ho */
@media (min-width: 1600px) {
    :root { --fx-sidebar-w: 262px; }
    .fx-kpi-row { grid-template-columns: repeat(auto-fit, minmax(212px, 1fr)); }
}

/* Laptop */
@media (max-width: 1400px) {
    .fx-map-shell { grid-template-columns: minmax(0,1fr) 288px; }
}

/* Tablet landscape */
@media (max-width: 1200px) {
    :root { --fx-t-hero: 1.5rem; }
    .fx-map-shell { grid-template-columns: 1fr; }
    .fx-map-side { max-height: none; }
    .fx-case-facts { width: 100%; margin-left: 0; }
}

/* Tablet */
@media (max-width: 992px) {
    .app-content > .container-fluid,
    .app-content-header > .container-fluid { padding-inline: var(--fx-s4); }
    .fx-page-head { flex-direction: column; align-items: stretch; gap: var(--fx-s3); }
    .fx-page-actions { justify-content: flex-start; }
    .fx-kpi-row { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: var(--fx-s2); }
    .fx-kpi-value { font-size: 1.45rem; }
    .fx-subject { padding: var(--fx-s4); }
    .fx-subject-side { margin-left: 0; width: 100%; }
    .fx-filters .fx-filter-actions { margin-left: 0; width: 100%; }
}

/* Mobile */
@media (max-width: 768px) {
    /* Koi bhi floating panel / dropdown viewport se bahar na nikle */
    .dropdown-menu, .ci-nav-panel, .popover { max-width: calc(100vw - 16px) !important; }
    /* Safhe ke sar mein action buttons ki qatar lipatni chahiye.
       Full-bleed safhe (map / graph) apna navbar khud banate hain, is liye
       woh bhi shamil hain -- warna un ke buttons kinare se bahar chale jate. */
    .app-content-header .d-flex, .fx-page-actions,
    .card-header .fx-header-tools,
    .navbar .container-fluid, .navbar .ms-auto.d-flex,
    .navbar-brand + .d-flex { flex-wrap: wrap; row-gap: 6px; }
    .navbar .ms-auto.d-flex { margin-left: 0 !important; }
    /* Har jagah: dayen kinare par dhakeli hui button-qatar chhoti screen par
       lipat jaye, warna woh safhe ko chaura kar deti hai. */
    .d-flex.ms-auto { flex-wrap: wrap; margin-left: 0 !important; }
    /* Aakhri hifazat: koi bhi cheez viewport se chaurhi na ho */
    .card, .card-body, .fx-panel, .alert, .app-content > .container-fluid { max-width: 100%; }
    :root {
        --fx-t-hero: 1.28rem;
        --fx-t-title: 1.08rem;
        --fx-topbar-h: 54px;
    }
    .app-content > .container-fluid,
    .app-content-header > .container-fluid { padding-inline: var(--fx-s3); }
    .app-content-header { padding-top: var(--fx-s4); }

    .card { border-radius: var(--fx-r); margin-bottom: var(--fx-s4); }
    .card-header { padding: var(--fx-s3); }
    .card-body { padding: var(--fx-s3); }

    .fx-kpi-row { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .fx-kpi { padding: var(--fx-s3); }
    .fx-kpi-value { font-size: 1.3rem; }

    .fx-case-bar { flex-direction: column; align-items: flex-start; gap: var(--fx-s3); }
    .fx-case-facts { gap: var(--fx-s4); }

    /* Touch targets */
    .btn { min-height: 38px; }
    .btn-sm { min-height: 32px; }
    .fx-icon-btn, .btn-action { width: 36px; height: 36px; flex-basis: 36px; }
    .nav-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .nav-tabs .nav-link { white-space: nowrap; }

    /* Tables: qaboo shuda horizontal scroll, kabhi safha nahi torta.
       (Pehle yahan negative margin tha taake table kinare tak jaye -- magar
       us se container viewport se chaura ho jata tha aur poora safha scroll
       karne lagta tha.) */
    .table-responsive { border-radius: 0; max-width: 100%; }
    .table > thead > tr > th, .table > tbody > tr > td { padding: 9px 10px; }

    /* Filters drawer ban jate hain -- layout nahi torte */
    .fx-filters { flex-direction: column; align-items: stretch; }
    .fx-filters .fx-field { min-width: 0; width: 100%; }

    .fx-toast-host, #premiumToastContainer, .toast-container {
        left: 12px; right: 12px; max-width: none; top: auto; bottom: 12px;
    }
    .fx-empty { padding: var(--fx-s6) var(--fx-s4); }
    .fx-kv { grid-template-columns: 1fr; gap: 2px var(--fx-s3); }
    .fx-kv dd { margin-bottom: 9px; }
    .modal-dialog { margin: var(--fx-s3); }

    /* Lead card mobile par sattarein mein */
    .fx-lead { flex-wrap: wrap; }
    .fx-lead-side { width: 100%; justify-content: space-between; }
}

/* Chhoti screen: gap wali flex qatarein lipat jayen.
   320-576px par side-by-side rakhna waise bhi mumkin nahi -- aur na lipatne
   par yeh qatarein poore safhe ko chaura kar deti hain. */
@media (max-width: 576px) {
    .d-flex.gap-1, .d-flex.gap-2, .d-flex.gap-3,
    .btn-group, .btn-toolbar { flex-wrap: wrap; }
    /* Lambe label wale buttons chhoti screen par lipat jayen. `nowrap`
       theek hai jab jagah ho -- 320px par woh safha tor deta hai. */
    .btn { white-space: normal; text-align: center; }
    /* Koi bhi chip / badge apne container se chaura na ho.
       `white-space: normal` sirf YAHAN (<=576px) hai -- bare screen par
       badge ek hi sattar ka rehta hai, warna table ke tang khane mein
       teen sattaron ka ho jata hai. */
    .badge, .fx-tag, .fx-risk, [class*="-badge"], [class*="-pill"] {
        max-width: 100%; flex-wrap: wrap; white-space: normal; text-align: left;
    }
    .btn-group > .btn { flex: 1 1 auto; }
    [class*="text-lg-end"], [class*="text-md-end"], [class*="text-sm-end"] { text-align: left !important; }
}

/* Chhota mobile */
@media (max-width: 400px) {
    .fx-kpi-row { grid-template-columns: 1fr; }
    .fx-page-head .fx-page-title { font-size: 1.18rem; }
}

/* Table -> cards. Sirf un tableon par jinhen `fx-cards-sm` lagaya gaya ho,
   aur jin ke td par data-label mojood ho. */
@media (max-width: 768px) {
    table.fx-cards-sm, table.fx-cards-sm tbody, table.fx-cards-sm tr, table.fx-cards-sm td { display: block; width: 100%; }
    table.fx-cards-sm thead { display: none; }
    table.fx-cards-sm tr {
        border: 1px solid var(--fx-border); border-radius: var(--fx-r);
        background: var(--fx-surface); margin-bottom: 8px; padding: 4px 0;
    }
    table.fx-cards-sm td {
        display: flex; align-items: flex-start; justify-content: space-between; gap: var(--fx-s4);
        border: 0; padding: 7px 12px; text-align: right;
    }
    table.fx-cards-sm td::before {
        content: attr(data-label);
        flex: 0 0 40%; text-align: left;
        font-family: var(--fx-mono); font-size: var(--fx-t-micro);
        letter-spacing: .08em; text-transform: uppercase; color: var(--fx-text-muted);
    }
    table.fx-cards-sm td:empty { display: none; }
}


/* ==========================================================================
   18  PRINT -- reports court/case file ke liye
   --------------------------------------------------------------------------
   Report safhe dashboard nahi hain. Chhapte waqt: safed kaghaz, kala matn,
   koi shadow nahi, koi gradient nahi, navigation gayab.
   ========================================================================== */

@media print {
    :root, :root[data-theme="dark"], :root[data-theme="light"] {
        --fx-bg: #ffffff; --fx-bg-2: #ffffff;
        --fx-surface: #ffffff; --fx-surface-2: #ffffff; --fx-surface-3: #f5f5f5;
        --fx-elevated: #ffffff;
        --fx-border: #c9c9c9; --fx-border-soft: #dcdcdc; --fx-border-strong: #9a9a9a;
        --fx-text: #000000; --fx-text-2: #1a1a1a; --fx-text-muted: #4a4a4a; --fx-text-faint: #6a6a6a;
        --fx-shadow-1: none; --fx-shadow-2: none; --fx-shadow-3: none;
        color-scheme: light;
    }
    body { background: #fff !important; color: #000 !important; font-size: 10.5pt; }
    .app-sidebar, .app-header, .app-footer,
    .fx-page-actions, .dt-buttons, .dataTables_filter, .dataTables_length,
    .dataTables_paginate, .fx-filters, .fx-toast-host, #premiumToastContainer,
    .no-print, .fx-no-print { display: none !important; }
    .app-main, .app-wrapper, .content-wrapper { margin: 0 !important; padding: 0 !important; }
    .card, .fx-panel { border: 1px solid #c9c9c9 !important; box-shadow: none !important; break-inside: avoid; page-break-inside: avoid; }
    .card-header { background: #f5f5f5 !important; }
    a { color: #000 !important; text-decoration: none; }
    .table > thead > tr > th { background: #f0f0f0 !important; color: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    tr, .fx-lead, .fx-sec-head { break-inside: avoid; page-break-inside: avoid; }
    .fx-sec-head { break-after: avoid; }
    .badge, .fx-tag, .fx-risk { border: 1px solid #9a9a9a !important; color: #000 !important; background: #fff !important; }
    @page { margin: 14mm; }
}
