/* ─── Circuito CRM Design Tokens (Muted Pastels & Deep Jewel Tones) ─────── */
:root {
    /* Backgrounds: Slate & Rich Dark Charcoal (Avoiding pure #000000) */
    --bg-base:          #12151b;
    --bg-surface:       rgba(23, 28, 38, 0.75);
    --bg-surface-solid: #171c26;
    --bg-card:          rgba(29, 36, 49, 0.58);
    --bg-card-hover:    rgba(37, 46, 62, 0.85);
    --bg-input:         rgba(18, 23, 32, 0.92);
    
    /* Primary: Desaturated Jewel Teal / Cyan (High legibility, soft on eyes) */
    --primary:          #2bb3a1;
    --primary-hover:    #239c8c;
    --primary-ghost:    rgba(43, 179, 161, 0.14);
    --primary-border:   rgba(43, 179, 161, 0.32);
    --primary-rgb:      43, 179, 161;

    /* Muted Pastels & Deep Jewel Tones (Desaturated by 10-20%) */
    --accent-cyan:           #5ec7d4;
    --accent-cyan-ghost:     rgba(94, 199, 212, 0.15);
    --accent-lavender:       #a997df;
    --accent-lavender-ghost: rgba(169, 151, 223, 0.15);
    --accent-teal:           #1f8a7e;
    --accent-teal-ghost:     rgba(31, 138, 126, 0.15);
    --accent-ruby:           #c74a62;
    --accent-ruby-ghost:     rgba(199, 74, 98, 0.15);
    --accent-amber:          #cf953a;
    --accent-amber-ghost:    rgba(207, 149, 58, 0.15);

    /* Text: Soft Off-Whites & Slates (Eliminates harsh glare) */
    --text-main:        #e5ebf2;
    --text-muted:       #93a2b4;
    --text-dim:         #7e8fa3;
    
    /* Borders & Dividers */
    --border-subtle:    rgba(226, 232, 240, 0.08);
    --border-strong:    rgba(226, 232, 240, 0.16);
    
    /* Status Tokens (Harmonized Jewel Accents) */
    --success:          #3db88f;
    --success-ghost:    rgba(61, 184, 143, 0.15);
    --warning:          #cf953a;
    --warning-ghost:    rgba(207, 149, 58, 0.15);
    --danger:           #c74a62;
    --danger-ghost:     rgba(199, 74, 98, 0.15);
    --info:             #5ec7d4;
    --purple:           #a997df;

    --radius-sm:        4px;
    --radius-md:        8px;
    --radius-lg:        12px;
    --radius-full:      9999px;
    
    --shadow-sm:        0 1px 3px 0 rgba(7, 10, 15, 0.4);
    --shadow-md:        0 4px 16px -1px rgba(7, 10, 15, 0.5);
    --shadow-lg:        0 12px 32px -4px rgba(7, 10, 15, 0.65);

    --sidebar-w:        250px;
    --sidebar-w-col:    72px;
    --transition-speed: 0.22s ease;
}

/* ─── Light Mode Override (Complementary Deep Jewel Tones & Soft Pastels) ─── */
body.light-theme {
    --bg-base:          #f5f7f8;
    --bg-surface:       rgba(255, 255, 255, 0.94);
    --bg-surface-solid: #ffffff;
    --bg-card:          #ffffff;
    --bg-card-hover:    #f0f3f6;
    --bg-input:         #ffffff;

    --primary:          #0e746b;
    --primary-hover:    #095c55;
    --primary-ghost:    rgba(14, 116, 107, 0.09);
    --primary-border:   rgba(14, 116, 107, 0.28);
    --primary-rgb:      14, 116, 107;

    --accent-cyan:           #0284c7;
    --accent-cyan-ghost:     rgba(2, 132, 199, 0.10);
    --accent-lavender:       #6d54b5;
    --accent-lavender-ghost: rgba(109, 84, 181, 0.10);
    --accent-teal:           #0e746b;
    --accent-teal-ghost:     rgba(14, 116, 107, 0.10);
    --accent-ruby:           #ad2843;
    --accent-ruby-ghost:     rgba(173, 40, 67, 0.10);
    --accent-amber:          #b45309;
    --accent-amber-ghost:    rgba(180, 83, 9, 0.10);

    --text-main:        #16202c;
    --text-muted:       #526375;
    --text-dim:         #64738a;

    --border-subtle:    #e1e7ee;
    --border-strong:    #ccd5e0;

    --success:          #0d8a60;
    --success-ghost:    rgba(13, 138, 96, 0.10);
    --warning:          #b45309;
    --warning-ghost:    rgba(180, 83, 9, 0.10);
    --danger:           #ad2843;
    --danger-ghost:     rgba(173, 40, 67, 0.10);
    --info:             #0284c7;
    --purple:           #6d54b5;

    --shadow-sm:        0 1px 3px 0 rgba(22, 32, 44, 0.05);
    --shadow-md:        0 4px 14px -1px rgba(22, 32, 44, 0.08);
    --shadow-lg:        0 12px 28px -4px rgba(22, 32, 44, 0.12);
}

/* ─── Global Reset & Typography ─────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    color: var(--text-main);
    background-color: var(--bg-base);
    background-image: 
        radial-gradient(circle at 12% 15%, rgba(43, 179, 161, 0.05) 0px, transparent 40%),
        radial-gradient(circle at 88% 85%, rgba(169, 151, 223, 0.04) 0px, transparent 40%),
        radial-gradient(circle at 50% 10%, rgba(199, 74, 98, 0.02) 0px, transparent 50%);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

body.light-theme {
    background-image: 
        radial-gradient(circle at 10% 10%, rgba(14, 116, 107, 0.035) 0px, transparent 40%),
        radial-gradient(circle at 90% 90%, rgba(109, 84, 181, 0.03) 0px, transparent 40%);
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    letter-spacing: -0.015em;
    margin-top: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover {
    color: var(--primary-hover);
}

/* ─── Sidebar Navigation ────────────────────────────────────────────── */
.app-sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: width var(--transition-speed);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.brand-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--primary), var(--accent-lavender));
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 10px rgba(var(--primary-rgb), 0.35);
}

.brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.brand-subtitle {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-section-title {
    padding: 0.9rem 1rem 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.nav-item-link:hover {
    background: var(--bg-card);
    color: var(--text-main);
}

.nav-item-link.active {
    background: var(--primary-ghost);
    color: var(--primary);
    font-weight: 600;
    border: 1px solid var(--primary-border);
}

.nav-item-link .icon-box {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 0.85rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ─── Main Content Container ────────────────────────────────────────── */
.app-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - var(--sidebar-w));
}

.app-topbar {
    height: 64px;
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.app-content {
    flex: 1;
    padding: 1.75rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ─── App Global Footer ────────────────────────────────────────────── */
.app-footer {
    padding: 1.1rem 2rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

.footer-left {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
}

.footer-right {
    font-size: 0.76rem;
    color: var(--text-dim);
}

@media (max-width: 640px) {
    .app-footer {
        flex-direction: column;
        text-align: center;
        justify-content: center;
        padding: 1rem;
    }
}

/* ─── Responsive Mobile Sidebar (Off-Canvas Drawer) ────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 15, 0.6);
    z-index: 95;
}

.btn.sidebar-toggle-btn {
    display: none;
}

@media (max-width: 768px) {
    .app-sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .app-main {
        margin-left: 0;
        width: 100%;
    }

    .btn.sidebar-toggle-btn {
        display: inline-flex;
    }

    .app-topbar {
        padding: 0 1rem;
        gap: 0.75rem;
    }

    .global-search-container {
        min-width: 0;
    }
}

/* ─── Shared Responsive Grid Columns ───────────────────────────────── */
.grid-cols-2,
.grid-cols-2-wide,
.grid-cols-detail,
.grid-cols-sidebar {
    display: grid;
}
.grid-cols-2       { grid-template-columns: 1fr 1fr; }
.grid-cols-2-wide  { grid-template-columns: 1.3fr 1fr; }
.grid-cols-detail  { grid-template-columns: 1fr 1.2fr; }
.grid-cols-sidebar { grid-template-columns: 1.2fr 1fr; }
.grid-cols-map     { display: grid; grid-template-columns: 1fr 320px; }

@media (max-width: 768px) {
    .grid-cols-2,
    .grid-cols-2-wide,
    .grid-cols-detail,
    .grid-cols-sidebar,
    .grid-cols-map {
        grid-template-columns: 1fr;
    }
    .grid-cols-map {
        height: auto !important;
    }
}

/* ─── Touch Target Sizing ──────────────────────────────────────────── */
@media (pointer: coarse) {
    .btn-xs, .btn-sm {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ─── Search Bar ────────────────────────────────────────────────────── */
.global-search-container {
    position: relative;
    max-width: 440px;
    width: 100%;
}

.global-search-input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    color: var(--text-main);
    font-size: 0.85rem;
    transition: all 0.18s;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ghost);
}

.search-icon-left {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.search-autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 380px;
    overflow-y: auto;
    display: none;
}

.search-autocomplete-dropdown.show {
    display: block;
}

/* ─── Cards & Grid System ───────────────────────────────────────────── */
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.metric-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.4rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: var(--primary-border);
    box-shadow: var(--shadow-md);
}

.metric-card-interactive {
    cursor: pointer;
    position: relative;
    user-select: none;
}

.metric-card-interactive:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.22);
}

.metric-card-interactive:active {
    transform: translateY(-1px);
}

.metric-card-interactive .metric-link-icon {
    transition: transform 0.18s ease, color 0.18s ease;
}

.metric-card-interactive:hover .metric-link-icon {
    transform: translate(2px, -2px);
    color: var(--primary) !important;
}

.metric-icon-box {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─── Hero Metric (one standout stat, breaks up repetitive card grids) ── */
.metric-hero-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.metric-hero-icon-box {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-hero-value {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 1.6rem + 1.5vw, 2.75rem);
    font-weight: 700;
    line-height: 1;
}

.metric-hero-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.metric-hero-subtext {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 0.15rem;
}

.metric-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-main);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.metric-subtext {
    font-size: 0.72rem;
    color: var(--text-dim);
    margin-top: 2px;
}

.data-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.data-card-header {
    padding: 1.1rem 1.4rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.data-card-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.data-card-body {
    padding: 1.4rem;
}

/* ─── Citizen 4-Card Cohesive Attribute Layout ───────────────────────── */
.citizen-profile-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 992px) {
    .citizen-profile-grid {
        grid-template-columns: 1fr;
    }
}

.attribute-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.4rem;
    height: 100%;
}

.attribute-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
}

.attribute-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

body.light-theme .attribute-row {
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.attribute-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.attribute-val {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
    text-align: right;
}

/* ─── EAV Checklist Tags System ─────────────────────────────────────── */
.eav-tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.eav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid transparent;
    transition: all 0.15s;
    user-select: none;
}

.eav-pill-active {
    background: var(--primary-ghost);
    color: var(--primary);
    border-color: var(--primary-border);
}

.eav-filter-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    border-radius: var(--radius-full);
    padding: 0.4rem 0.85rem;
    font-size: 0.78rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    transition: all 0.15s;
}

.eav-filter-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-main);
}

.eav-filter-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}

.eav-checklist-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    margin-bottom: 0.65rem;
    transition: border-color 0.15s, background 0.15s;
}

.eav-checklist-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary-border);
}

/* ─── Timeline / Follow-Up Log ──────────────────────────────────────── */
.timeline-stream {
    position: relative;
    padding-left: 2rem;
}

.timeline-stream::before {
    content: '';
    position: absolute;
    left: 14px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-subtle);
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--bg-surface-solid);
    border: 2px solid var(--primary);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.timeline-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    transition: border-color 0.15s;
}

.timeline-card:hover {
    border-color: var(--border-strong);
}

.timeline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.timeline-type {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timeline-date {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.timeline-body {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ─── Buttons & Inputs ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.18s;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(var(--primary-rgb), 0.42);
    color: #ffffff;
}

.btn-secondary {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-main);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}
.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-main);
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.form-control, .form-select {
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-main);
    font-size: 0.85rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-ghost);
}

.form-label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* ─── Badges ────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-success  { background: var(--success-ghost); color: var(--success); }
.badge-warning  { background: var(--warning-ghost); color: var(--warning); }
.badge-danger   { background: var(--danger-ghost);  color: var(--danger);  }
.badge-primary  { background: var(--primary-ghost); color: var(--primary); }
.badge-cyan     { background: var(--accent-cyan-ghost); color: var(--accent-cyan); }
.badge-lavender { background: var(--accent-lavender-ghost); color: var(--accent-lavender); }
.badge-teal     { background: var(--accent-teal-ghost); color: var(--accent-teal); }
.badge-ruby     { background: var(--accent-ruby-ghost); color: var(--accent-ruby); }

/* ─── Data Tables ───────────────────────────────────────────────────── */
.data-table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    background: var(--bg-card);
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

/* ─── Modal Dialogs ─────────────────────────────────────────────────── */
.modal-backdrop-custom {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(14, 18, 25, 0.82);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

body.light-theme .modal-backdrop-custom {
    background: rgba(22, 32, 44, 0.45);
}

.modal-dialog-custom {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header-custom {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-body-custom {
    padding: 1.5rem;
    flex: 1;
}

.modal-footer-custom {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ─── QR Code Scanner Visuals ───────────────────────────────────────── */
.qr-scanner-box {
    position: relative;
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-base);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-dropzone {
    border: 2px dashed var(--primary-border);
    border-radius: var(--radius-lg);
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 0.2s;
}

.qr-dropzone:hover, .qr-dropzone.dragover {
    background: var(--primary-ghost);
    border-color: var(--primary);
}

/* ─── Toast Notifications ───────────────────────────────────────────── */
#toastContainer {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    max-width: 360px;
}

.toast-msg {
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.85rem 1.1rem;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: toastSlideIn 0.22s ease-out;
}

.toast-msg::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background: var(--primary);
    flex-shrink: 0;
}

.toast-success::before { background: var(--success); }
.toast-warning::before { background: var(--warning); }
.toast-error::before   { background: var(--danger); }

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}
