/* ========================================
   PulseBIM Cloud — Design System
   Light mode · Be Vietnam Pro · Blue header
   ======================================== */

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Brand */
    --blue:         #0052FF;
    --blue-hover:   #003FCC;
    --blue-light:   #E8EEFF;
    --blue-subtle:  #F0F4FF;

    /* Surfaces */
    --bg-page:      #F5F6F8;
    --bg-card:      #FFFFFF;
    --bg-header:    #0052FF;
    --bg-tabs:      #FFFFFF;
    --bg-secondary: #F8F9FB;
    --bg-hover:     #F0F2F5;

    /* Text */
    --text:         #1A1D26;
    --text-secondary: #5F6577;
    --text-muted:   #9CA3B4;
    --text-on-blue: #FFFFFF;

    /* Borders */
    --border:       #E2E5EB;
    --border-light: #ECEEF2;

    /* Status */
    --green:        #10B981;
    --amber:        #F59E0B;
    --red:          #EF4444;
    --purple:       #8B5CF6;
    --cyan:         #06B6D4;

    /* Shadows */
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:    0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg:    0 4px 16px rgba(0,0,0,0.10);

    /* Radius */
    --radius:       10px;
    --radius-sm:    6px;
    --radius-lg:    14px;

    /* Layout */
    --header-h:     56px;
    --tab-h:        44px;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== LOGIN — SPLIT SCREEN ===== */
.view-login {
    min-height: 100vh;
    display: flex;
    flex-direction: row;
}

/* ── Left Panel (Form) ────────── */
.login-panel-form {
    width: 38%;
    min-height: 100vh;
    background: #060B18;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

.login-form-inner {
    width: 100%;
    max-width: 380px;
}

.login-brand { text-align: center; margin-bottom: 40px; }
.login-icon { margin-bottom: 14px; }

.login-title {
    font-family: 'Gabarito', sans-serif;
    font-size: 32px;
    font-weight: 400;
    color: #fff;
    letter-spacing: -0.3px;
}
.login-title span { font-weight: 700; color: var(--blue); }

.login-cloud {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 6px;
    color: rgba(255,255,255,0.35);
    margin-top: 4px;
}

/* Input wraps with icons */
.login-form-inner .form-group { margin-bottom: 20px; }

.login-form-inner label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 6px;
    text-transform: uppercase;
}

.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrap i {
    position: absolute;
    left: 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.25);
    pointer-events: none;
    transition: color 0.2s;
    z-index: 1;
}
.input-wrap:focus-within i { color: var(--blue); }
.input-wrap input:not(:placeholder-shown) ~ i,
.input-wrap:has(input:not(:placeholder-shown)) i { color: rgba(255,255,255,0.5); }
.input-wrap:focus-within i { color: var(--blue); }

.input-wrap input {
    width: 100%;
    padding: 13px 16px 13px 42px;
    font-family: inherit;
    font-size: 14px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.input-wrap input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,71,241,0.15);
    background: rgba(255,255,255,0.07);
}
.input-wrap input::placeholder { color: rgba(255,255,255,0.2); }

/* Prevent Chrome autofill from overriding styles */
.input-wrap input:-webkit-autofill,
.input-wrap input:-webkit-autofill:hover,
.input-wrap input:-webkit-autofill:focus {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #0d1526 inset;
    transition: background-color 5000s ease-in-out 0s;
    border-color: rgba(255,255,255,0.15);
}

/* Error */
.login-error {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.2);
    border-radius: 8px;
    color: #fca5a5;
    font-size: 13px;
    margin-bottom: 16px;
}
.login-error.show { display: flex; }

/* Login button */
.btn-login {
    width: 100%;
    padding: 14px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
}
.btn-login:hover {
    background: var(--blue-hover);
    box-shadow: 0 4px 20px rgba(0,71,241,0.3);
}
.btn-login:active { transform: scale(0.98); }
.btn-login.loading { opacity: 0.7; pointer-events: none; }
.btn-login i { font-size: 13px; transition: transform 0.2s; }
.btn-login:hover i { transform: translateX(3px); }

/* Footer links */
.login-footer-links {
    text-align: center;
    margin-top: 28px;
}
.login-footer-links p {
    font-size: 12px;
    color: rgba(255,255,255,0.3);
    margin-bottom: 4px;
}
.login-footer-links a {
    font-size: 13px;
    color: var(--blue);
    text-decoration: none;
    transition: color 0.15s;
}
.login-footer-links a:hover { color: #4D8AFF; text-decoration: underline; }

/* Legal footer */
.login-legal {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    padding: 20px;
}
.login-legal p {
    font-size: 11px;
    color: rgba(255,255,255,0.2);
    margin-bottom: 4px;
}
.legal-links {
    display: flex;
    justify-content: center;
    gap: 16px;
}
.legal-links a {
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    text-decoration: none;
    transition: color 0.15s;
}
.legal-links a:hover { color: rgba(255,255,255,0.5); }

.legal-brand-logo {
    margin-bottom: 10px;
    opacity: 0.3;
    transition: opacity 0.2s;
}
.legal-brand-logo:hover { opacity: 0.5; }
.legal-brand-logo img { display: block; margin: 0 auto; }

/* ── Right Panel (Brand) ────────── */
.login-panel-brand {
    width: 62%;
    min-height: 100vh;
    background: linear-gradient(160deg, #0047F1 0%, #002B99 40%, #001654 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Hexagonal grid overlay */
.hex-grid {
    position: absolute;
    inset: 0;
    opacity: 0.8;
}
.hex-grid svg { width: 100%; height: 100%; }

/* Animated glow orbs */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}
.glow-orb.orb-1 {
    width: 300px;
    height: 300px;
    background: rgba(0,71,241,0.4);
    top: 15%;
    right: -50px;
    animation: orbFloat 8s ease-in-out infinite;
}
.glow-orb.orb-2 {
    width: 200px;
    height: 200px;
    background: rgba(6,182,212,0.25);
    bottom: 20%;
    left: -30px;
    animation: orbFloat 10s ease-in-out infinite reverse;
}
@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(20px, -30px); }
}

/* Brand content */
.brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 40px;
    max-width: 400px;
}

.brand-hero-icon {
    margin-bottom: 28px;
    animation: heroFloat 6s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.brand-headline {
    font-family: 'Gabarito', sans-serif;
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    margin-bottom: 14px;
}
.brand-headline em {
    font-style: normal;
    font-weight: 400;
    color: rgba(255,255,255,0.7);
}

.brand-desc {
    font-size: 15px;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
    margin-bottom: 32px;
}

/* Module pills — 3x2 grid */
.brand-modules {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.brand-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    color: rgba(255,255,255,0.85);
    font-size: 12px;
    font-weight: 500;
    backdrop-filter: blur(10px);
    transition: background 0.2s, transform 0.15s, border-color 0.2s;
}
.brand-pill:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.2);
    transform: translateY(-3px);
}
.bp-hex {
    width: 32px;
    height: 32px;
    object-fit: contain;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 900px) {
    .view-login { flex-direction: column; }
    .login-panel-form { width: 100%; min-height: auto; padding: 40px 20px 80px; }
    .login-panel-brand { width: 100%; min-height: 40vh; }
    .login-legal { position: relative; margin-top: 20px; }
}

/* ===== APP LAYOUT ===== */
.view-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ===== HEADER AZUL ===== */
.app-header {
    height: var(--header-h);
    background: rgba(0, 82, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 20px rgba(0, 82, 255, 0.15),
                inset 0 1px 0 rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 20px; }

.header-logo {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-brand {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-on-blue);
    letter-spacing: -0.3px;
}

/* Context pills */
.header-context { display: flex; align-items: center; gap: 6px; }

.ctx-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    color: var(--text-on-blue);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.ctx-pill:hover { background: rgba(255,255,255,0.2); }
.ctx-pill i { font-size: 11px; opacity: 0.7; }

.ctx-sep {
    color: rgba(255,255,255,0.35);
    font-size: 18px;
    margin: 0 2px;
}

/* Header right */
.header-right { display: flex; align-items: center; gap: 10px; }

.header-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-right: 4px;
}
.header-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
}
.header-user-email {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    line-height: 1.2;
}

.header-icon-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    font-size: 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}
.header-icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.header-icon-btn.logout-btn:hover {
    background: rgba(239,68,68,0.2);
    color: #fca5a5;
}

.header-avatar {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s;
}
.header-avatar:hover { border-color: rgba(255,255,255,0.5); }

/* ===== TAB BAR ===== */
.tab-bar {
    display: flex;
    align-items: stretch;
    height: var(--tab-h);
    background: rgba(255, 255, 255, 0.70);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.4);
    padding: 0 24px;
    gap: 0;
    position: sticky;
    top: var(--header-h);
    z-index: 90;
}

.tab-bar.secondary {
    height: 38px;
    background: rgba(248, 249, 251, 0.70);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    top: calc(var(--header-h) + var(--tab-h));
    z-index: 89;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    margin-bottom: -1px;
}
.tab-item:hover { color: var(--text); }
.tab-item.active {
    color: var(--blue);
    border-bottom-color: var(--blue);
}
.tab-item i { font-size: 13px; }

.tab-bar.secondary .tab-item {
    font-size: 13px;
    padding: 0 14px;
    border-bottom-width: 2px;
}

/* Tab context info (company badge on left of tabs) */
.tab-context {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 20px;
    margin-right: 8px;
    border-right: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.tab-context i { font-size: 12px; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.app-content {
    flex: 1;
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}
.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}
.page-header .subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* ===== KPI CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: rgba(255, 255, 255, 0.60);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.06),
                inset 0 1px 0 rgba(255,255,255,0.4);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.kpi-card:hover {
    background: rgba(255, 255, 255, 0.70);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12),
                inset 0 1px 0 rgba(255,255,255,0.5);
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}
.kpi-value .kpi-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 4px;
}

.kpi-change {
    font-size: 12px;
    font-weight: 500;
    margin-top: 6px;
}
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }
.kpi-change.neutral { color: var(--text-muted); }

.kpi-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 16px;
    float: right;
}
.kpi-icon.blue { background: var(--blue-light); color: var(--blue); }
.kpi-icon.green { background: #D1FAE5; color: var(--green); }
.kpi-icon.amber { background: #FEF3C7; color: var(--amber); }
.kpi-icon.purple { background: #EDE9FE; color: var(--purple); }
.kpi-icon.cyan { background: #CFFAFE; color: var(--cyan); }

/* ===== DATA TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table thead th {
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    vertical-align: middle;
}
.data-table tbody tr:hover {
    background: var(--bg-hover);
}
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}
.badge.green { background: #D1FAE5; color: #065F46; }
.badge.amber { background: #FEF3C7; color: #92400E; }
.badge.red { background: #FEE2E2; color: #991B1B; }
.badge.blue { background: var(--blue-light); color: #1E3A8A; }
.badge.purple { background: #EDE9FE; color: #5B21B6; }
.badge.gray { background: #F3F4F6; color: #4B5563; }

/* ===== MODULE DOTS ===== */
.module-dots {
    display: flex;
    gap: 5px;
}
.module-dot {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    color: #fff;
    font-weight: 700;
}
.module-dot.track { background: var(--green); }
.module-dot.guard { background: #F97316; }
.module-dot.quant { background: var(--cyan); }

/* ===== BUTTONS ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    background: none;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.btn-ghost:hover { background: var(--bg-hover); border-color: var(--text-muted); }

/* ===== AVATAR ===== */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--blue-light);
    color: var(--blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    animation: slideIn 0.25s ease;
    max-width: 400px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ===== VIEW TRANSITIONS ===== */
.app-content {
    animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Staggered card entrance */
.kpi-card { animation: cardIn 0.35s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0.02s; }
.kpi-card:nth-child(2) { animation-delay: 0.06s; }
.kpi-card:nth-child(3) { animation-delay: 0.10s; }
.kpi-card:nth-child(4) { animation-delay: 0.14s; }

@keyframes cardIn {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Table rows stagger */
.data-table tbody tr { animation: rowIn 0.25s ease both; }
.data-table tbody tr:nth-child(1) { animation-delay: 0.04s; }
.data-table tbody tr:nth-child(2) { animation-delay: 0.08s; }
.data-table tbody tr:nth-child(3) { animation-delay: 0.12s; }
.data-table tbody tr:nth-child(4) { animation-delay: 0.16s; }
.data-table tbody tr:nth-child(5) { animation-delay: 0.20s; }
.data-table tbody tr:nth-child(6) { animation-delay: 0.24s; }

@keyframes rowIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ===== ENHANCED TABLE HOVER ===== */
.data-table tbody tr {
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    position: relative;
}
.data-table tbody tr:hover {
    background: var(--blue-subtle);
    box-shadow: inset 3px 0 0 0 var(--blue);
}
.data-table tbody tr:active {
    background: var(--blue-light);
}

/* ===== SKELETON LOADER ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-100 { width: 100%; }
.skeleton-text.lg { height: 28px; }
.skeleton-card {
    height: 110px;
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-row {
    display: flex;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}
.skeleton-circle { width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0; }
.skeleton-block { flex: 1; }

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ===== SPARKLINE BARS ===== */
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 28px;
    margin-top: 8px;
}
.sparkline .bar {
    flex: 1;
    background: var(--blue);
    border-radius: 2px 2px 0 0;
    opacity: 0.5;
    transition: opacity 0.15s, height 0.3s ease;
    min-width: 3px;
}
.sparkline .bar:last-child { opacity: 1; }
.sparkline .bar.green { background: var(--green); }
.sparkline .bar.amber { background: var(--amber); }
.sparkline .bar.cyan { background: var(--cyan); }
.sparkline:hover .bar { opacity: 0.8; }
.sparkline:hover .bar:last-child { opacity: 1; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-hover);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}
.progress-bar .fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}
.progress-bar .fill.blue { background: var(--blue); }
.progress-bar .fill.green { background: var(--green); }
.progress-bar .fill.amber { background: var(--amber); }
.progress-bar .fill.red { background: var(--red); }

/* ===== PULSE DOT ===== */
.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    display: inline-block;
    position: relative;
}
.pulse-dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--green);
    opacity: 0.3;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.6); opacity: 0; }
}

/* ===== TAB TRANSITION ===== */
.tab-item {
    position: relative;
    transition: color 0.15s, border-color 0.2s;
}
.tab-item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--blue);
    border-radius: 3px 3px 0 0;
    transition: width 0.2s ease, left 0.2s ease;
}
.tab-item.active::after {
    width: 100%;
    left: 0;
}
.tab-item.active {
    border-bottom-color: transparent;
}

/* ===== COUNTER ANIMATION ===== */
.count-up {
    display: inline-block;
    animation: countPop 0.4s ease;
}
@keyframes countPop {
    0% { transform: scale(0.7); opacity: 0; }
    60% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== TOOLTIP ===== */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    animation: tooltipIn 0.15s ease;
    z-index: 999;
}
@keyframes tooltipIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== MODULE DOT HOVER ===== */
.module-dot {
    transition: transform 0.15s, box-shadow 0.15s;
}
.module-dot:hover {
    transform: scale(1.2);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .header-search { display: none; }
    .header-search kbd { display: none; }
    .app-content { padding: 20px 16px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .tab-bar { overflow-x: auto; padding: 0 16px; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .ctx-pill span { max-width: 80px; overflow: hidden; text-overflow: ellipsis; }
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn .2s ease;
}
.modal-content,
.modal-box {
    background: var(--bg-card); border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    width: 90%; max-height: 90vh; overflow-y: auto;
    animation: slideUp .25s ease;
}
.modal-header {
    padding: 20px 24px; border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: var(--bg-hover); cursor: pointer; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: all .15s;
}
.modal-close:hover { background: var(--border-light); color: var(--text); }
.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px; border-top: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: flex-end; gap: 10px;
}

/* ===== SECONDARY BUTTON ===== */
.btn-secondary {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 18px; font-family: inherit; font-size: 13px; font-weight: 600;
    background: var(--bg-secondary); color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-muted); }

/* ===== FORM GROUP / CONTROL ===== */
.form-group { display: flex; flex-direction: column; }
.form-group label {
    font-size: 12px; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-control {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid var(--border-light); background: var(--bg-page);
    font-size: 14px; font-family: inherit; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
    box-sizing: border-box;
}
.form-control:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,82,255,0.12);
}
select.form-control { cursor: pointer; }

/* ===== BADGE VARIANTS ===== */
.badge-primary { background: var(--blue-light); color: #1E3A8A; }
.badge-info    { background: #CFFAFE; color: #155E75; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warn    { background: #FEF3C7; color: #92400E; }

/* ===== FORM FIELDS ===== */
.field-label {
    font-size: 11px; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); display: block; margin-bottom: 6px; font-weight: 600;
}
.input-field {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid var(--border-light); background: var(--bg-page);
    font-size: 14px; font-family: inherit; color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.input-field:focus {
    outline: none; border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0,82,255,0.12);
}
select.input-field { cursor: pointer; }

/* ===== PERMISSION BADGES ===== */
.perm-badge {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px; padding: 3px 10px; border-radius: 20px;
    background: color-mix(in srgb, var(--perm-color, #ccc) 12%, white);
    color: var(--text-secondary); white-space: nowrap;
}

/* ===== PERMISSION OPTIONS (radio cards) ===== */
.perm-options {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
}
.perm-option {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px; border-radius: 10px;
    border: 1.5px solid var(--border-light); background: var(--bg-page);
    cursor: pointer; transition: all .15s; font-size: 13px;
}
.perm-option input { display: none; }
.perm-option:hover { border-color: var(--blue); background: var(--blue-subtle); }
.perm-option.selected {
    border-color: var(--blue); background: var(--blue-light);
    font-weight: 600;
}
.perm-option-icon { font-size: 16px; }

/* ===== PLUGIN GRID (assign seat) ===== */
.plugin-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.plugin-option {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: 10px;
    border: 1.5px solid var(--border-light); background: var(--bg-page);
    cursor: pointer; transition: all .15s; font-size: 13px;
}
.plugin-option input { display: none; }
.plugin-option:hover { border-color: var(--blue); }
.plugin-option.selected { border-color: var(--blue); background: var(--blue-light); font-weight: 600; }
.plugin-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

/* ===== TOAST ===== */
.toast-notification {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--text); color: white; padding: 12px 24px;
    border-radius: 12px; font-size: 14px; font-weight: 500;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    opacity: 0; transition: all .3s ease; z-index: 99999;
    pointer-events: none;
}
.toast-notification.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* ===== GUARD MODULE ===== */
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.btn-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-icon:hover {
    background: var(--bg-hover);
    border-color: var(--border);
}
