/* ============================================================
   BMS Premium Design System — Emerald Green SaaS Edition
   Primary: #10b981 (Emerald)  |  Accent: Indigo  |  BG: #f8fafc
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ─── Design Tokens ─── */
:root {
    /* Brand */
    --primary:          #10b981;
    --primary-dark:     #059669;
    --primary-light:    #d1fae5;
    --primary-glow:     rgba(16, 185, 129, 0.18);

    /* Accent */
    --indigo:           #6366f1;
    --indigo-light:     #eef2ff;
    --indigo-glow:      rgba(99, 102, 241, 0.15);

    /* Semantic */
    --success:          #10b981;
    --warning:          #f59e0b;
    --danger:           #ef4444;
    --info:             #3b82f6;

    /* Backgrounds */
    --bg-body:          #f8fafc;
    --bg-sidebar:       #0d1117;
    --bg-card:          #ffffff;
    --bg-hover:         #f1f5f9;
    --bg-input:         #ffffff;

    /* Text */
    --text-primary:     #0f172a;
    --text-secondary:   #475569;
    --text-muted:       #94a3b8;
    --text-placeholder: #cbd5e1;

    /* Borders */
    --border:           #e2e8f0;
    --border-strong:    #cbd5e1;

    /* Shadows */
    --shadow-xs:        0 1px 2px rgba(15,23,42,0.04);
    --shadow-sm:        0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
    --shadow-md:        0 4px 6px -1px rgba(15,23,42,0.08), 0 2px 4px -2px rgba(15,23,42,0.04);
    --shadow-lg:        0 10px 15px -3px rgba(15,23,42,0.08), 0 4px 6px -4px rgba(15,23,42,0.04);
    --shadow-xl:        0 20px 25px -5px rgba(15,23,42,0.1), 0 8px 10px -6px rgba(15,23,42,0.06);
    --shadow-emerald:   0 8px 30px -8px rgba(16,185,129,0.35);
    --shadow-indigo:    0 8px 30px -8px rgba(99,102,241,0.35);

    /* Radii */
    --radius-xs:        6px;
    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        16px;
    --radius-xl:        20px;
    --radius-2xl:       24px;
    --radius-full:      9999px;

    /* Transitions */
    --ease:             0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --ease-bounce:      0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Layout */
    --sidebar-w:        260px;
    --sidebar-collapsed: 76px;
    --topbar-h:         64px;

    /* Aliases for legacy compat */
    --text-main:        var(--text-primary);
    --text-main-inv:    #ffffff;
    --panel-bg:         var(--bg-card);
    --border-color:     var(--border);
    --hover-bg:         var(--bg-hover);
    --input-bg:         var(--bg-input);
    --input-bg-focus:   var(--bg-hover);
    --select-option-bg: var(--bg-card);
    --shadow-card:      var(--shadow-md);
}

[data-theme="dark"] {
    --bg-body:          #060b14;
    --bg-sidebar:       #070c15;
    --bg-card:          #0d1420;
    --bg-hover:         #131d2e;
    --bg-input:         #0d1420;

    --text-primary:     #f1f5f9;
    --text-secondary:   #94a3b8;
    --text-muted:       #64748b;
    --text-placeholder: #334155;

    --border:           #1a2535;
    --border-strong:    #243145;

    --shadow-xs:        0 1px 2px rgba(0,0,0,0.3);
    --shadow-sm:        0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:        0 4px 6px -1px rgba(0,0,0,0.5), 0 2px 4px -2px rgba(0,0,0,0.3);
    --shadow-lg:        0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.3);
    --shadow-xl:        0 20px 25px -5px rgba(0,0,0,0.6), 0 8px 10px -6px rgba(0,0,0,0.4);

    --hover-bg:         #131d2e;
    --select-option-bg: #0d1420;
}

/* ─── Base Reset ─── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   APP SHELL
   ============================================================ */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
    width: 100%;
}

/* ============================================================
   SIDEBAR — Collapsible Icon Rail
   Default: collapsed (60px icon rail)
   Hover expand OR pinned: 260px full width
   html.sidebar-pinned = hover expand DISABLED (stays collapsed)
   ============================================================ */

/* ── Sidebar shell ── */
.sidebar {
    width: var(--sidebar-collapsed);
    background: var(--bg-sidebar);
    border-right: 1px solid rgba(255,255,255,0.06);
    padding: 0 0 1rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: visible;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* Slight right-edge glow */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 1px;
    background: linear-gradient(to bottom,
        transparent,
        rgba(16,185,129,0.15) 40%,
        rgba(16,185,129,0.15) 60%,
        transparent
    );
    pointer-events: none;
}

/* .sidebar::-webkit-scrollbar { display: none; } */

/* ── Expanded on hover (unless pinned-off) ── */
.sidebar:hover,
.sidebar.is-expanded {
    width: var(--sidebar-w);
    box-shadow: 4px 0 30px rgba(0,0,0,0.25);
}

/* When hover-expand is DISABLED (pinned-off state) override */
.sidebar.hover-disabled:hover {
    width: var(--sidebar-collapsed);
    box-shadow: none;
}

/* ── Sidebar Header ── */
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    min-height: 58px;
}

/* Hamburger Toggle Button */
.sidebar-toggle-btn {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4.5px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--ease);
    flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
    background: rgba(16,185,129,0.12);
    border-color: rgba(16,185,129,0.25);
}

.hamburger-bar {
    display: block;
    width: 14px;
    height: 2px;
    background: rgba(255,255,255,0.55);
    border-radius: 2px;
    transition: all var(--ease);
}

.sidebar-toggle-btn:hover .hamburger-bar {
    background: var(--primary);
}

/* Slightly animated when hover-disabled */
.sidebar.hover-disabled .sidebar-toggle-btn {
    background: rgba(16,185,129,0.08);
    border-color: rgba(16,185,129,0.2);
}
.sidebar.hover-disabled .hamburger-bar {
    background: var(--primary);
}
.sidebar.hover-disabled .hamburger-bar:nth-child(2) {
    opacity: 0.4;
    width: 10px;
}

/* Brand icon link inside sidebar header */
.sidebar-brand-icon-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    overflow: hidden;
    opacity: 0;
    width: 0;
    transition: opacity 0.2s ease, width 0.25s ease;
}

.sidebar:hover .sidebar-brand-icon-link,
.sidebar.is-expanded .sidebar-brand-icon-link {
    opacity: 1;
    width: auto;
}

.sidebar.hover-disabled:hover .sidebar-brand-icon-link {
    opacity: 0;
    width: 0;
}

.sidebar-logo-img {
    max-height: 28px;
    max-width: 100px;
    object-fit: contain;
    white-space: nowrap;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
    flex-shrink: 0;
}

.brand-icon svg { color: #fff; }

/* ── Nav Section Labels ── */
.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    text-align: center;
    padding: 0.75rem 0 0.25rem;
    margin: 0;
    display: block;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-height: 40px;
    opacity: 1;
    transition: all 0.25s ease;
}

.sidebar:hover .nav-section-label,
.sidebar.is-expanded .nav-section-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    text-align: left;
    padding: 1.25rem 0.5rem 0.25rem;
    letter-spacing: 0.05em;
    max-height: 120px;
}

.sidebar.hover-disabled:hover .nav-section-label {
    font-size: 0.65rem;
    color: rgba(255,255,255,0.4);
    text-align: center;
    letter-spacing: 0.02em;
    padding: 0.75rem 0 0.25rem;
    max-height: 40px;
}

/* ── Nav Links ── */
.nav-links {
    list-style: none;
    padding: 0 0.5rem;
    flex-shrink: 0;
}

.nav-links li {
    margin-bottom: 2px;
    position: relative;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.5rem;
    border-radius: var(--radius-md);
    font-size: 0.855rem;
    font-weight: 500;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    transition: all var(--ease);
    position: relative;
    white-space: nowrap;
}

/* Nav Label — hidden in collapsed state */
.nav-label {
    opacity: 0;
    width: 0;
    transform: translateX(-6px);
    transition: opacity 0.18s ease, transform 0.2s ease, width 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    pointer-events: none;
}

.sidebar:hover .nav-label,
.sidebar.is-expanded .nav-label {
    opacity: 1;
    width: 100%;
    transform: translateX(0);
    pointer-events: auto;
}

.sidebar.hover-disabled:hover .nav-label {
    opacity: 0;
    width: 0;
    transform: translateX(-6px);
    pointer-events: none;
}

/* Nav Icon */
.nav-links a .nav-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
    transition: all var(--ease);
}

.nav-links a:hover {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

.nav-links a:hover .nav-icon {
    background: rgba(16,185,129,0.12);
    color: var(--primary);
}

.nav-links a.active {
    background: transparent;
    color: #fff;
    border-radius: var(--radius-md);
}

.sidebar:hover .nav-links a.active,
.sidebar.is-expanded .nav-links a.active {
    background: rgba(16,185,129,0.12);
}

.sidebar.hover-disabled:hover .nav-links a.active {
    background: transparent;
}

.nav-links a.active .nav-icon {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(16,185,129,0.35);
}

/* ── Tooltip (shown on collapsed hover when hover-disabled) ── */
.nav-links a[data-tooltip]::after,
.btn-sidebar-action[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-collapsed) + 6px);
    top: 50%;
    transform: translateY(-50%);
    background: #1e293b;
    color: #f1f5f9;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    z-index: 999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.08);
}

/* Only show tooltip when sidebar is hover-disabled */
.sidebar.hover-disabled .nav-links a[data-tooltip]:hover::after,
.sidebar.hover-disabled .btn-sidebar-action[data-tooltip]:hover::after {
    opacity: 1;
}

/* Danger nav links */
.nav-link-danger {
    color: rgba(239,68,68,0.7) !important;
}
.nav-link-danger:hover {
    color: #ef4444 !important;
    background: rgba(239,68,68,0.08) !important;
}
.nav-link-danger .nav-icon {
    background: rgba(239,68,68,0.08) !important;
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 0.75rem 0.5rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.btn-sidebar-action {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.55rem 0.5rem;
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.5);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--ease);
    width: 100%;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.sidebar-action-icon {
    min-width: 32px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 8px;
    background: rgba(255,255,255,0.04);
}

.btn-sidebar-action:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.85);
}

.btn-sidebar-action.btn-logout {
    color: rgba(239,68,68,0.7);
    border-color: rgba(239,68,68,0.08);
}
.btn-sidebar-action.btn-logout:hover {
    background: rgba(239,68,68,0.08);
    color: #ef4444;
    border-color: rgba(239,68,68,0.18);
}

/* ============================================================
   MAIN CONTENT AREA
   Offset by the collapsed sidebar width (fixed positioned)
   ============================================================ */
.main-content {
    flex: 1;
    overflow-y: auto;
    /* sidebar is fixed, so push main content right = collapsed width */
    margin-left: var(--sidebar-collapsed);
    display: flex;
    flex-direction: column;
    background: var(--bg-body);
    min-width: 0;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Glassmorphism Top Navbar ─── */
.top-navbar {
    height: var(--topbar-h);
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border-bottom: 1px solid rgba(226,232,240,0.8);
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    box-shadow: 0 1px 0 rgba(15,23,42,0.04), var(--shadow-xs);
}

[data-theme="dark"] .top-navbar {
    background: rgba(13,20,32,0.88);
    border-bottom-color: rgba(26,37,53,0.9);
}

/* Topbar Brand (left) */
.topbar-brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-right: 0.25rem;
}

.topbar-brand-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
}

.topbar-brand-icon {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(16,185,129,0.35);
}

.topbar-brand-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.top-navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.top-navbar-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

/* Search Bar */
.topbar-search {
    position: relative;
    width: 300px;
}

.topbar-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 0.855rem;
    font-weight: 400;
    color: var(--text-primary);
    transition: all var(--ease);
    outline: none;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-search input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    width: 360px;
}

/* Icon Buttons */
.icon-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--ease);
    position: relative;
    text-decoration: none;
}

.icon-btn:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.icon-btn .notification-dot {
    position: absolute;
    top: 6px; right: 6px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-card);
}

/* User Profile Dropdown Trigger */
.user-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.375rem 0.75rem 0.375rem 0.375rem;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--ease);
    font-size: 0.855rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
}

.user-profile-trigger:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, #10b981, #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

/* Page Scroll Wrapper */
.page-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.25rem;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.035em;
    line-height: 1.2;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.25rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.title { /* Legacy compat */
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================================
   CARDS — rounded-[24px]
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--ease), transform var(--ease);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-pad {
    padding: 1.75rem 2rem;
}

/* Legacy glass-panel compat */
.glass-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
}

/* Page header card */
.page-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
    position: relative;
    overflow: hidden;
}

.page-header-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, #6366f1 100%);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

/* Panel Elite (compat) */
.panel-elite-light {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
}

/* ─── KPI / Stat Cards ─── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all var(--ease);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity var(--ease);
    background: radial-gradient(circle at 80% 20%, var(--primary-glow), transparent 70%);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.kpi-card:hover::after { opacity: 1; }

.kpi-card-emerald { --kc: var(--primary); --kc-bg: var(--primary-glow); }
.kpi-card-indigo  { --kc: #6366f1;        --kc-bg: var(--indigo-glow); }
.kpi-card-warning { --kc: var(--warning);  --kc-bg: rgba(245,158,11,0.12); }
.kpi-card-danger  { --kc: var(--danger);   --kc-bg: rgba(239,68,68,0.12); }

.kpi-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.kpi-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: var(--kc-bg, var(--primary-glow));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--kc, var(--primary));
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.kpi-trend {
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
}

.kpi-trend.up {
    background: rgba(16,185,129,0.1);
    color: var(--primary);
}

.kpi-trend.down {
    background: rgba(239,68,68,0.1);
    color: var(--danger);
}

.kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
    line-height: 1;
}

.kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* Legacy compat */
.kpi-card-light { /* = kpi-card */
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: all var(--ease);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
}

.kpi-card-light:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.kpi-card-light .kpi-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
}

.kpi-card-light .kpi-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

/* ─── Dashboard Widgets Panel ─── */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

/* ============================================================
   BUTTONS — rounded-xl SaaS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.575rem 1.125rem;
    border-radius: var(--radius-md);
    font-size: 0.855rem;
    font-weight: 600;
    line-height: 1.4;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all var(--ease);
    white-space: nowrap;
    outline: none;
}

.btn:focus-visible {
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
    box-shadow: 0 1px 3px rgba(16,185,129,0.25), 0 4px 12px rgba(16,185,129,0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(16,185,129,0.3), 0 8px 20px rgba(16,185,129,0.25);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary, .btn-outline {
    background: var(--bg-card);
    color: var(--text-primary);
    border-color: var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover, .btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-indigo {
    background: #6366f1;
    color: #fff;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px var(--indigo-glow);
}

.btn-indigo:hover {
    background: #4f46e5;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px var(--indigo-glow);
}

.btn-danger {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fecaca;
}
.btn-danger:hover {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    border-radius: var(--radius-lg);
}

.btn-block { width: 100%; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: var(--radius-sm);
}

/* Legacy compat */
.btn-elite-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.575rem 1.25rem;
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary-dark);
    border-radius: var(--radius-md);
    font-size: 0.855rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--ease);
    box-shadow: 0 4px 12px rgba(16,185,129,0.25);
}

.btn-elite-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(16,185,129,0.3);
}

.btn-elite-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-command-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.875rem;
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--ease);
}
.btn-command-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.btn-command {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.6);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--ease);
    width: 100%;
    justify-content: center;
}
.btn-command:hover {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.9);
    border-color: rgba(255,255,255,0.2);
}

/* ============================================================
   FORMS — rounded-xl with emerald focus glow
   ============================================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label, .form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 400;
    font-family: inherit;
    transition: all var(--ease);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.form-control::placeholder { color: var(--text-placeholder); }

.form-control:hover {
    border-color: var(--border-strong);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: var(--bg-input);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12);
}

.invalid-feedback {
    color: var(--danger);
    font-size: 0.8rem;
    margin-top: 0.3rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.form-control-light {
    background: var(--bg-body) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-md) !important;
    font-family: inherit !important;
    transition: all var(--ease) !important;
}

.form-control-light:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px var(--primary-glow) !important;
}

select.form-control { cursor: pointer; }
select.form-control option {
    background: var(--select-option-bg);
    color: var(--text-primary);
}

textarea.form-control { resize: vertical; min-height: 100px; }

/* ─── Input Group ─── */
.input-group {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.input-group .form-control { flex: 1; }

/* ─── Search Input ─── */
.search-input-wrapper {
    position: relative;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-input-wrapper input,
.search-input-wrapper select {
    padding-left: 2.5rem !important;
}

/* ─── Filter Panel ─── */
.filter-bar, .search-filter-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-xs);
}

.filter-bar .form-group,
.search-filter-panel .form-group {
    margin-bottom: 0;
    flex: 1;
    min-width: 180px;
}

/* ============================================================
   BADGES / STATUS PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    border: 1px solid transparent;
    line-height: 1.4;
}

/* Emerald — Active */
.badge-success, .badge-active {
    background: rgba(16,185,129,0.1);
    color: #059669;
    border-color: rgba(16,185,129,0.2);
}

/* Gray — Pending / Neutral */
.badge-secondary, .badge-pending {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-color: var(--border);
}

/* Red — Lost / Danger */
.badge-danger, .badge-lost {
    background: rgba(239,68,68,0.08);
    color: #dc2626;
    border-color: rgba(239,68,68,0.15);
}

/* Indigo / Primary */
.badge-primary {
    background: rgba(99,102,241,0.1);
    color: #4f46e5;
    border-color: rgba(99,102,241,0.18);
}

/* Warning / Amber */
.badge-warning {
    background: rgba(245,158,11,0.1);
    color: #d97706;
    border-color: rgba(245,158,11,0.2);
}

/* Info / Blue */
.badge-info {
    background: rgba(59,130,246,0.1);
    color: #2563eb;
    border-color: rgba(59,130,246,0.18);
}

/* Dot indicator */
.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.badge-dot-success  { background: var(--primary); }
.badge-dot-warning  { background: var(--warning); }
.badge-dot-danger   { background: var(--danger); }
.badge-dot-neutral  { background: var(--text-muted); }

/* Legacy bad badge compat */
.badge-success-elite { background: rgba(16,185,129,0.1) !important; color: var(--primary) !important; border: 1px solid rgba(16,185,129,0.2) !important; border-radius: var(--radius-full) !important; }
.badge-danger-elite  { background: rgba(239,68,68,0.08) !important; color: #dc2626 !important;      border: 1px solid rgba(239,68,68,0.15) !important; border-radius: var(--radius-full) !important; }
.badge-pro-elite     { background: rgba(99,102,241,0.1) !important; color: #4f46e5 !important;      border: 1px solid rgba(99,102,241,0.18) !important; border-radius: var(--radius-full) !important; }
.badge-agency-elite  { background: rgba(245,158,11,0.1) !important; color: #d97706 !important;      border: 1px solid rgba(245,158,11,0.2) !important;  border-radius: var(--radius-full) !important; }
.badge-root-elite    { background: rgba(251,191,36,0.12) !important; color: #b45309 !important;     border: 1px solid rgba(251,191,36,0.2) !important;  border-radius: var(--radius-full) !important; }
.badge-elite-light   { background: var(--bg-hover) !important; color: var(--text-primary) !important; border: 1px solid var(--border) !important; border-radius: var(--radius-full) !important; }

/* Status badge (legacy) */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

/* ============================================================
   DATA TABLE — High-Performance
   ============================================================ */
.data-table-container, .table-elite-container {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    overflow: auto;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.75rem;
}

.data-table, .table-elite-light {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    min-width: 640px;
}

/* Table header */
.data-table thead tr,
.thead-elite-light tr {
    background: #0d1117;
    border-bottom: 2px solid rgba(16,185,129,0.35);
}

.data-table th, .th-elite-light {
    padding: 1rem 1.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.85);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: color var(--ease);
}

.data-table th:hover { color: var(--primary); }

/* Sort indicator */
.th-sortable::after {
    content: ' ⇅';
    font-size: 0.65rem;
    opacity: 0.5;
}

.th-sortable.sort-asc::after  { content: ' ↑'; opacity: 1; color: var(--primary); }
.th-sortable.sort-desc::after { content: ' ↓'; opacity: 1; color: var(--primary); }

/* Table body */
.data-table tbody tr, .tr-elite-light {
    border-bottom: 1px solid var(--border);
    transition: background var(--ease);
}

.data-table tbody tr:last-child, .tr-elite-light:last-child {
    border-bottom: none;
}

.data-table tbody tr:hover, .tr-elite-light:hover {
    background: rgba(16,185,129,0.03);
}

.data-table td, .td-elite-light {
    padding: 1rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-primary);
    vertical-align: middle;
}

/* URL cell */
.url-cell {
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.url-link:hover { text-decoration: underline; }

/* DA Score cell */
.da-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 0.78rem;
    font-weight: 800;
    border: 2px solid;
}

.da-score-high   { background: rgba(16,185,129,0.1);  color: var(--primary);  border-color: rgba(16,185,129,0.3); }
.da-score-medium { background: rgba(245,158,11,0.1);  color: var(--warning);  border-color: rgba(245,158,11,0.3); }
.da-score-low    { background: rgba(239,68,68,0.08);  color: var(--danger);   border-color: rgba(239,68,68,0.2); }

.date-cell-elite {
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* ─── Table Actions Bar ─── */
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.table-action-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ─── Pagination ─── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
    color: var(--text-muted);
}

.pagination-pages {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.page-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--ease);
    text-decoration: none;
}

.page-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.page-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary-dark);
    box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all var(--ease);
}

.modal-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.is-open .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    padding: 1.5rem 1.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--ease);
}

.modal-close:hover {
    background: #fee2e2;
    color: var(--danger);
    border-color: #fecaca;
}

.modal-body {
    padding: 1.5rem 1.75rem;
}

.modal-footer {
    padding: 1rem 1.75rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ============================================================
   ALERTS & NOTIFICATIONS
   ============================================================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid transparent;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.alert-success, .alert-elite-success {
    background: rgba(16,185,129,0.07) !important;
    border-color: rgba(16,185,129,0.15) !important;
    color: #065f46 !important;
    border-radius: var(--radius-xl) !important;
}

.alert-danger {
    background: rgba(239,68,68,0.06);
    border-color: rgba(239,68,68,0.15);
    color: #991b1b;
}

.alert-warning {
    background: rgba(245,158,11,0.08);
    border-color: rgba(245,158,11,0.2);
    color: #92400e;
}

.alert-info {
    background: rgba(59,130,246,0.07);
    border-color: rgba(59,130,246,0.18);
    color: #1e40af;
}

/* ============================================================
   MISC / UTILITIES
   ============================================================ */

/* Progress Bars */
.progress-container {
    width: 100%;
    height: 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-primary {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #059669);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}
.progress-bar-success  { @extend .progress-bar-primary; }
.progress-bar-danger   { height: 100%; background: var(--danger); border-radius: var(--radius-full); }
.progress-bar-warning  { height: 100%; background: var(--warning); border-radius: var(--radius-full); }

/* Avatar */
.avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }

.avatar-initials {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    border-radius: 50%;
}

/* Profile avatar legacy */
.profile-avatar-elite {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    font-size: 2rem;
    box-shadow: var(--shadow-emerald);
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border);
    margin: 1.5rem 0;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-hover) 25%, var(--border) 50%, var(--bg-hover) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    background: var(--primary-glow);
    border: 1px solid rgba(16,185,129,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: var(--primary);
}

.empty-state-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-muted);
    font-size: 0.875rem;
    max-width: 360px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Scroll chip */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--ease);
    white-space: nowrap;
}

.chip:hover, .chip.active {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* Meta grid  (legacy compat) */
.meta-grid       { display: grid; grid-template-columns: 120px 1fr; gap: 0.75rem; align-items: center; }
.meta-label      { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; }
.meta-value      { font-weight: 600; color: var(--text-primary); font-size: 0.875rem; }
.meta-value-warning { font-weight: 700; color: var(--warning); font-size: 0.875rem; }

/* Panel border accent */
.panel-border-primary { border-top: 3px solid var(--primary) !important; }
.panel-border-success { border-top: 3px solid var(--success) !important; }
.panel-border-warning { border-top: 3px solid var(--warning) !important; }

/* Tag (legacy) */
.tag-elite {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Dot-icon for nav-icon (compatibility) */
.dork-icon-wrapper {
    width: 44px;
    height: 44px;
    background: var(--primary-glow);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    border: 1px solid rgba(16,185,129,0.2);
}

/* Dork results panel */
.results-panel-container {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    background: var(--bg-input);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.dork-query-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dork-query-code {
    font-family: 'JetBrains Mono', 'SF Mono', monospace;
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.step-number-elite {
    background: var(--primary);
    color: #fff;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* Project / Domain icon */
.project-icon {
    width: 36px; height: 36px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    border: 1px solid rgba(16,185,129,0.2);
}

/* ─── Login / Auth ─── */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    min-height: 100vh;
}

.login-panel {
    width: 100%;
    max-width: 420px;
    margin: auto;
}

/* ─── Animations ─── */
.slide-up {
    animation: slideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.35s ease both;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Pulse dot */
.pulse-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
}

/* ─── Utility Flex/Spacing Helpers ─── */
.flex           { display: flex; }
.flex-col       { display: flex; flex-direction: column; }
.items-center   { align-items: center; }
.items-start    { align-items: flex-start; }
.justify-between{ justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1          { gap: 0.25rem; }
.gap-2          { gap: 0.5rem; }
.gap-3          { gap: 0.75rem; }
.gap-4          { gap: 1rem; }
.gap-5          { gap: 1.25rem; }
.gap-6          { gap: 1.5rem; }
.flex-wrap      { flex-wrap: wrap; }
.flex-1         { flex: 1; }
.w-full         { width: 100%; }
.mt-1           { margin-top: 0.25rem; }
.mt-2           { margin-top: 0.5rem; }
.mt-3           { margin-top: 0.75rem; }
.mt-4           { margin-top: 1rem; }
.mt-6           { margin-top: 1.5rem; }
.mt-8           { margin-top: 2rem; }
.mb-1           { margin-bottom: 0.25rem; }
.mb-2           { margin-bottom: 0.5rem; }
.mb-4           { margin-bottom: 1rem; }
.mb-6           { margin-bottom: 1.5rem; }
.mb-8           { margin-bottom: 2rem; }
.p-0            { padding: 0; }
.text-sm        { font-size: 0.82rem; }
.text-xs        { font-size: 0.72rem; }
.text-muted     { color: var(--text-muted); }
.text-success   { color: var(--primary); }
.text-danger    { color: var(--danger); }
.text-warning   { color: var(--warning); }
.text-primary   { color: var(--primary); }
.text-bold      { font-weight: 700; }
.text-mono      { font-family: 'JetBrains Mono', monospace; }
.truncate       { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Scrollbar styling ─── */
::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    .topbar-search { width: 200px; }
    .topbar-search input:focus { width: 240px; }
    .page-scroll { padding: 1.5rem; }
}

@media (max-width: 768px) {
    /* On mobile: sidebar is always off-screen, hamburger opens it */
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
    }
    .sidebar:hover {
        transform: translateX(0);
        width: var(--sidebar-w) !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100%;
    }
    .page-scroll { padding: 1rem; }
    .top-navbar { padding: 0 1rem; }
    .topbar-search { display: none; }
    .kpi-grid, .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
    .kpi-grid, .stats-grid { grid-template-columns: 1fr; }
}

