/* =================================
   SCAC Asset Management System
   Design System — SCAC Connect Theme
   ================================= */

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

/* ========== CSS VARIABLES (SCAC Design System) ========== */
:root {
    /* SCAC Primary */
    --primary: #004aad;
    --primary-dark: #1e3a8a;
    --primary-light: #bfdbfe;
    --primary-soft: #f1f5f9;

    /* Accent / Status Colors */
    --accent: #10b981;
    --accent-dark: #059669;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Backgrounds */
    --bg-primary: #f1f5f9;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --surface: rgba(255, 255, 255, 0.95);
    --surface-hover: rgba(0, 74, 173, 0.04);

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;

    /* Borders */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-strong: rgba(0, 0, 0, 0.15);
    --border-focus: #004aad;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 40px 60px -15px rgba(0, 0, 0, 0.1);
    --focus-ring: 0 0 0 4px rgba(0, 74, 173, 0.12);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-pill: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Fira Code', 'Courier New', monospace;
}

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image: radial-gradient(circle at top right, rgba(15, 23, 42, 0.03) 0%, transparent 50%);
}

/* ========== LOGIN PAGE ========== */
.login-fullscreen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--bg-primary);
}

.login-background {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    filter: blur(8px);
    transform: scale(1.1);
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.login-card-simple {
    position: relative;
    z-index: 10;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.6);
    min-width: 340px;
    max-width: 400px;
    animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

.login-logo-img {
    max-width: 180px;
    height: auto;
    margin-bottom: 0.5rem;
}

.login-card-simple h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.25rem;
    letter-spacing: -0.3px;
}

.login-card-simple p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
    font-weight: 500;
}

.login-form-simple {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.login-form-simple input {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: var(--font-sans);
    background: white;
    color: var(--text-primary);
    transition: var(--transition);
}

.login-form-simple input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.login-form-simple input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.btn-login-simple {
    width: 100%;
    padding: 0.9rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: var(--transition);
    margin-top: 0.25rem;
    box-shadow: 0 6px 20px -4px rgba(0, 74, 173, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-login-simple:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 74, 173, 0.4);
}

#login-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--spacing-lg);
    z-index: 9999;
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: var(--spacing-2xl);
    border-radius: var(--radius-xl);
}

/* ========== MAIN LAYOUT ========== */
#main-dashboard {
    min-height: 100vh;
    padding-bottom: var(--spacing-2xl);
    background: var(--bg-primary);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    position: relative;
    z-index: 10;
}

/* ========== GLASS ========== */
.glass {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-md);
}

/* ========== HEADER ========== */
.modern-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.625rem 2rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 16px -4px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    margin-bottom: var(--spacing-xl);
    gap: 1rem;
    animation: slideInDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.header-left {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.brand-logo-container {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    cursor: pointer;
    transition: transform 0.2s ease;
    text-decoration: none;
}

.brand-logo-container:active { transform: scale(0.98); }

.logo-icon img {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.brand-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.brand-text h1 {
    font-size: 1.075rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    color: var(--primary);
    letter-spacing: -0.4px;
}

.brand-text span {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 2px;
}

/* Nav pill */
.header-center {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    background: var(--bg-primary);
    padding: 0.25rem;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.nav-link {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    padding: 0.45rem 0.9rem !important;
    border-radius: var(--radius-pill) !important;
    color: var(--text-secondary) !important;
    font-weight: 600 !important;
    font-size: 0.8125rem !important;
    cursor: pointer !important;
    text-decoration: none !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.nav-link:hover {
    background: white !important;
    color: var(--primary) !important;
    box-shadow: var(--shadow-sm) !important;
}

.nav-link.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(0, 74, 173, 0.25) !important;
}

.nav-link i,
.nav-link svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Dropdown */
.nav-dropdown-container { position: relative; }

.modern-dropdown-menu {
    display: none;
    position: absolute;
    top: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: 250px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.375rem;
    z-index: 1001;
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modern-dropdown-menu.show {
    display: block;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.dropdown-item-modern {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
}

.dropdown-item-modern:hover { background: var(--primary-soft); }

.dropdown-item-modern .icon-box {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(0, 74, 173, 0.08);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.dropdown-item-modern:hover .icon-box {
    background: var(--primary);
    color: white;
}

.item-title {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.item-desc { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* Header Right */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-shrink: 0;
}

.profile-dropdown-container { position: relative; cursor: pointer; }

.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.3rem 0.3rem 0.3rem 0.875rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--transition-base);
}

.user-profile-pill:hover { box-shadow: var(--shadow-md); }

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.user-name { font-size: 0.8rem; font-weight: 700; color: var(--text-primary); }
.user-role  { font-size: 0.68rem; color: var(--text-muted); font-weight: 500; }

.avatar-circle {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.775rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 74, 173, 0.3);
}

.avatar-circle-lg {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    flex-shrink: 0;
}

.profile-menu {
    position: absolute;
    top: 130%;
    right: 0;
    width: 210px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 0.375rem;
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-menu-header {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.profile-name  { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); }
.profile-email { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

.profile-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.25rem 0;
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.profile-menu-item:hover {
    background: rgba(239, 68, 68, 0.06);
    color: var(--danger);
}

.profile-menu-item i,
.profile-menu-item svg { width: 15px; height: 15px; }

/* Search in header */
#global-search, #fy-filter {
    background: var(--bg-primary) !important;
    border: 1.5px solid var(--border-color) !important;
    border-radius: var(--radius-md) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-sans) !important;
    transition: var(--transition-base) !important;
}

#global-search:focus, #fy-filter:focus {
    outline: none !important;
    border-color: var(--primary) !important;
    box-shadow: var(--focus-ring) !important;
    background: white !important;
}

/* ========= KPI CARDS ========== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.kpi-card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    animation: fadeInUp 0.5s ease-out backwards;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.kpi-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: 0 20px 40px -12px rgba(0, 74, 173, 0.15);
}

.kpi-card:hover::before { opacity: 1; }
.kpi-card:hover .kpi-icon { transform: rotate(8deg) scale(1.1); }

.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }
.kpi-card:nth-child(5) { animation-delay: 0.25s; }
.kpi-card:nth-child(6) { animation-delay: 0.30s; }
.kpi-card:nth-child(7) { animation-delay: 0.35s; }
.kpi-card:nth-child(8) { animation-delay: 0.40s; }

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

.kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.25rem;
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.kpi-value {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.05em;
    line-height: 1;
    margin-bottom: 0.375rem;
    animation: countUp 0.6s ease-out backwards;
}

.kpi-trend {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.kpi-trend.positive { color: var(--accent); }
.kpi-trend.negative { color: var(--danger); }
.kpi-trend.neutral  { color: var(--text-muted); }

/* Hero KPI */
.kpi-card-pro {
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    min-height: 135px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.kpi-card-pro:hover {
    transform: translateY(-5px) scale(1.015);
    box-shadow: 0 24px 40px -10px rgba(0, 0, 0, 0.2);
}

.kpi-value-large {
    font-size: 2.875rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: var(--spacing-sm);
    color: white;
    letter-spacing: -0.04em;
}

.kpi-label-large {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.85);
    margin-bottom: var(--spacing-md);
    text-transform: uppercase;
}

.kpi-view-all {
    font-size: 0.72rem;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
}

.kpi-view-all:hover { color: white; }

/* Color variants */
.kpi-blue   { background: linear-gradient(135deg, #004aad 0%, #1e3a8a 100%); }
.kpi-cyan   { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); }
.kpi-pink   { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.kpi-orange { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.kpi-purple { background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%); }
.kpi-yellow { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

/* KPI type card color variants (used on .kpi-card elements) */
.kpi-card.kpi-green  { background: linear-gradient(135deg, #10b981 0%, #059669 100%); border: none; box-shadow: 0 8px 24px -8px rgba(16, 185, 129, 0.45); }
.kpi-card.kpi-blue   { background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%); border: none; box-shadow: 0 8px 24px -8px rgba(59, 130, 246, 0.45); }
.kpi-card.kpi-purple { background: linear-gradient(135deg, #a855f7 0%, #7c3aed 100%); border: none; box-shadow: 0 8px 24px -8px rgba(168, 85, 247, 0.45); }
.kpi-card.kpi-pink   { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); border: none; box-shadow: 0 8px 24px -8px rgba(236, 72, 153, 0.45); }
.kpi-card.kpi-amber  { background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%); border: none; box-shadow: 0 8px 24px -8px rgba(245, 158, 11, 0.45); }
.kpi-card.kpi-sky    { background: linear-gradient(135deg, #0ea5e9 0%, #0284c7 100%); border: none; box-shadow: 0 8px 24px -8px rgba(14, 165, 233, 0.45); }
.kpi-card.kpi-indigo { background: linear-gradient(135deg, #6366f1 0%, #4338ca 100%); border: none; box-shadow: 0 8px 24px -8px rgba(99, 102, 241, 0.45); }
.kpi-card.kpi-red    { background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%); border: none; box-shadow: 0 8px 24px -8px rgba(239, 68, 68, 0.45); }

/* White text on colored KPI cards */
.kpi-card:is(.kpi-green, .kpi-blue, .kpi-purple, .kpi-pink, .kpi-amber, .kpi-sky, .kpi-indigo, .kpi-red) .kpi-label { color: rgba(255, 255, 255, 0.85); }
.kpi-card:is(.kpi-green, .kpi-blue, .kpi-purple, .kpi-pink, .kpi-amber, .kpi-sky, .kpi-indigo, .kpi-red) .kpi-value { color: white; }
.kpi-card:is(.kpi-green, .kpi-blue, .kpi-purple, .kpi-pink, .kpi-amber, .kpi-sky, .kpi-indigo, .kpi-red) .kpi-trend { color: rgba(255, 255, 255, 0.75); }
/* Disable the top-stripe ::before on colored cards */
.kpi-card:is(.kpi-green, .kpi-blue, .kpi-purple, .kpi-pink, .kpi-amber, .kpi-sky, .kpi-indigo, .kpi-red)::before { display: none; }
/* Slightly deeper shadow on hover for colored cards */
.kpi-card:is(.kpi-green, .kpi-blue, .kpi-purple, .kpi-pink, .kpi-amber, .kpi-sky, .kpi-indigo, .kpi-red):hover { box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3); }

/* ========== CHARTS ========== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-2xl);
}

.chart-card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    animation: fadeInUp 0.6s ease-out backwards;
    animation-delay: 0.3s;
    transition: box-shadow 0.3s ease;
}

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

.chart-header { margin-bottom: var(--spacing-lg); }

.chart-title {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.chart-container { position: relative; height: 270px; }

/* ========== BUTTONS ========== */
button, .btn {
    padding: 0.5rem 1.125rem;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: var(--primary);
    color: white;
}

button:hover, .btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

button:active, .btn:active { transform: translateY(0); }

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px -4px rgba(0, 74, 173, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
    filter: brightness(1);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: var(--accent-dark);
    box-shadow: 0 6px 16px -4px rgba(16, 185, 129, 0.3);
}

.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }
.btn-lg { padding: 0.875rem var(--spacing-xl); font-size: 0.9375rem; }

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    font-size: 0.8rem;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

.btn-icon-only {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--danger);
}

.action-buttons { display: flex; gap: var(--spacing-xs); }

.btn-action {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-base);
    color: white;
    font-size: 0.75rem;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-action:active { transform: translateY(0); }
.btn-action-info    { background: #0ea5e9; }
.btn-action-warning { background: #f97316; }
.btn-action-danger  { background: #ef4444; }
.btn-action-success { background: #10b981; }

/* ========== FORMS ========== */
.input-group { margin-bottom: var(--spacing-lg); }

.input-group label {
    display: block;
    margin-bottom: 0.375rem;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.7rem var(--spacing-md);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    transition: all var(--transition-base);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--primary);
}

/* ========== TABLES ========== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-xl);
    background: white;
}

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }

thead {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

th {
    padding: 0.8rem var(--spacing-lg);
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

tbody tr:hover { background: rgba(0, 74, 173, 0.03); }
tbody tr:last-child { border-bottom: none; }

td {
    padding: 0.7rem var(--spacing-lg);
    color: var(--text-primary);
    vertical-align: middle;
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.175rem 0.6rem;
    border-radius: var(--radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-success { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: #b45309; }
.badge-danger  { background: rgba(239, 68, 68, 0.12);  color: #dc2626; }
.badge-info    { background: rgba(59, 130, 246, 0.12);  color: #2563eb; }
.badge-neutral { background: var(--bg-tertiary); color: var(--text-muted); }

/* ========== REPORTS ========== */
.report-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--spacing-lg);
    align-items: end;
}

.filter-group { display: flex; flex-direction: column; gap: 0.375rem; }

.filter-group label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 0.7rem var(--spacing-md);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: all var(--transition-base);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.summary-card {
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.summary-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.summary-content { flex: 1; }

.summary-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

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

/* ========== MODALS ========== */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-lg);
    animation: fadeIn var(--transition-base);
}

.modal-content {
    width: 95%;
    max-width: 1200px;
    max-height: 95vh;
    overflow-y: auto;
    border-radius: var(--radius-xl);
    animation: slideUp var(--transition-slow);
    padding: var(--spacing-xl);
    margin: auto;
    background: white;
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(255,255,255,0.6);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.175rem;
    font-weight: 800;
    color: var(--text-primary);
}

.close-modal {
    font-size: 1.375rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    line-height: 1;
    transition: all var(--transition-fast);
}

.close-modal:hover {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.06);
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: var(--spacing-lg);
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border-color);
}

/* ========== ASSET FORM ========== */
#asset-form.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.form-section { margin-bottom: 0; padding: 0; border: none; }

.form-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
    border-bottom: 1.5px solid rgba(0, 74, 173, 0.1);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-row-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.875rem;
}

.form-row-group .input-group { margin-bottom: 0; }

.form-row-group label {
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-weight: 700;
}

.form-row-group input,
.form-row-group select {
    padding: 0.65rem var(--spacing-md);
    font-size: 0.875rem;
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

.form-row-group input:focus,
.form-row-group select:focus {
    background: white;
    border-color: var(--primary);
}

.form-row-group.three-col {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.full-width { grid-column: span 1; }

.form-footer {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.25rem;
    padding-top: 0.625rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 1000px) {
    #asset-form.form-grid { grid-template-columns: 1fr; }
}

/* ========== PRINT ========== */
.print-preview-container {
    background: white;
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.print-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-lg) var(--spacing-xl);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.print-preview-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; }
.print-actions { display: flex; gap: var(--spacing-md); }

.print-preview-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-xl);
    background: #f0f4f8;
}

.print-page {
    background: white;
    padding: 40px;
    margin: 0 auto;
    max-width: 900px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: var(--radius-md);
}

.print-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--primary);
}

.print-header h1 {
    font-size: 1.375rem;
    margin: 0 0 6px;
    color: var(--primary);
    font-weight: 800;
}

.print-header p { margin: 0; color: var(--text-muted); font-size: 0.875rem; }

.print-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.print-table { width: 100%; border-collapse: collapse; font-size: 0.8rem; }

.print-table th,
.print-table td {
    border: 1px solid #e2e8f0;
    padding: 8px 10px;
    text-align: left;
}

.print-table th {
    background: var(--bg-secondary);
    font-weight: 700;
    color: var(--text-secondary);
}

.print-table tbody tr:nth-child(even) { background: var(--bg-primary); }

.print-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media print {
    body * { visibility: hidden; }
    .print-content, .print-content * { visibility: visible; }
    .print-content {
        position: absolute;
        left: 0; top: 0;
        width: 100%;
        background: white !important;
        padding: 20px !important;
    }
    .no-print { display: none !important; }
}

/* Asset Detail */
.asset-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.detail-row {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.detail-row strong {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 600px) { .asset-detail-grid { grid-template-columns: 1fr; } }

/* ========== MASTER DATA ========== */
.master-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.master-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.375rem;
    margin-bottom: 0.375rem;
}

.master-select {
    padding: 0.6rem var(--spacing-md);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    background: white;
    color: var(--text-primary);
    width: 100%;
    transition: all var(--transition-base);
}

.master-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.master-actions { display: flex; gap: var(--spacing-sm); margin-top: 0.5rem; }

/* ========== NAV TABS ========== */
.nav-tabs {
    display: flex;
    gap: var(--spacing-sm);
    padding: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.nav-tab {
    padding: 0.45rem var(--spacing-lg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 600;
    color: var(--text-secondary);
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    background: transparent;
}

.nav-tab:hover { background: white; color: var(--text-primary); }

.nav-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 74, 173, 0.25);
}

/* Dropdown menu (legacy) */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    min-width: 200px;
    z-index: 1001;
    overflow: hidden;
}

.dropdown-menu.show {
    display: block;
    animation: fadeInUp 0.2s ease-out;
}

.dropdown-item {
    padding: 0.6rem var(--spacing-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    font-weight: 500;
    background: transparent;
    border: none;
}

.dropdown-item:hover { background: var(--bg-primary); color: var(--text-primary); }

/* ========== CHAT ========== */
.chat-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 74, 173, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 1001;
    animation: pulse-chat 2.5s ease-in-out infinite;
}

.chat-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 12px 32px rgba(0, 74, 173, 0.45);
}

.chat-fab i, .chat-fab svg { width: 22px; height: 22px; }

@keyframes pulse-chat {
    0%, 100% { box-shadow: 0 8px 24px rgba(0, 74, 173, 0.35); }
    50%       { box-shadow: 0 8px 32px rgba(0, 74, 173, 0.55); }
}

.chat-modal {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 370px;
    height: 570px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    animation: slideInUp 0.3s ease-out;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: white;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
}

.chat-header {
    padding: 0.875rem 1rem;
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.chat-header h3 { margin: 0; font-size: 0.9375rem; font-weight: 700; }
.chat-header small { color: rgba(255,255,255,0.8); font-size: 0.7rem; }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.875rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: var(--bg-primary);
}

.chat-message { display: flex; flex-direction: column; max-width: 82%; }
.chat-message.user { align-self: flex-end; }
.chat-message.assistant { align-self: flex-start; }

.message-content {
    padding: 0.6rem 0.8rem;
    border-radius: 12px;
    font-size: 0.875rem;
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-content {
    background: white;
    color: var(--text-primary);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.chat-typing {
    padding: 0.5rem 0.875rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
}

.typing-indicator { display: flex; gap: 4px; }

.typing-indicator span {
    width: 5px;
    height: 5px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30%            { opacity: 1;   transform: translateY(-5px); }
}

.chat-input-container {
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
    background: white;
    flex-shrink: 0;
}

.file-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.375rem 0.65rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.chat-input-row { display: flex; gap: 0.5rem; align-items: center; }

.chat-input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-pill);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    transition: var(--transition-base);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
    background: white;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.375rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.icon-btn:hover { background: var(--bg-primary); color: var(--primary); }
.icon-btn i, .icon-btn svg { width: 17px; height: 17px; }

.chat-messages::-webkit-scrollbar { width: 5px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

@media (max-width: 480px) {
    .chat-modal {
        width: calc(100vw - 1.5rem);
        height: calc(100vh - 3rem);
        right: 0.75rem;
        bottom: 0.75rem;
    }
}

/* ========== SKELETON ========== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-tertiary) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ========== UTILITIES ========== */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.font-mono   { font-family: var(--font-mono); }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }
.mb-sm  { margin-bottom: var(--spacing-sm); }
.mb-md  { margin-bottom: var(--spacing-md); }
.mb-lg  { margin-bottom: var(--spacing-lg); }
.mb-xl  { margin-bottom: var(--spacing-xl); }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn      { from { opacity: 0; }                           to { opacity: 1; } }
@keyframes fadeInUp    { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp   { from { opacity: 0; transform: translateY(20px); }  to { opacity: 1; transform: translateY(0); } }
@keyframes countUp     { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse       { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.015); } }
@keyframes float       { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes shimmer     { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes slideUp     { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

.btn-accent, .btn-primary { position: relative; overflow: hidden; }

.btn-accent::after, .btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
}

.btn-accent:hover::after, .btn-primary:hover::after { animation: shimmer 0.6s; }

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    html { font-size: 14px; }
    .modern-header { padding: 0.5rem 1rem; flex-wrap: wrap; }
    .header-center { order: 3; width: 100%; border-radius: var(--radius-lg); }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .charts-grid { grid-template-columns: 1fr; }
    th, td { padding: 0.5rem 0.75rem; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .modal-content { padding: var(--spacing-md); }
}

/* ═══════════════════════════════════════════════════════════════════════
   INDUSTRY UPGRADE: View Modal Tabs
   ═══════════════════════════════════════════════════════════════════════ */

.view-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1rem;
}

.view-tab {
    padding: .6rem 1.2rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
    font-size: .875rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .2s, border-color .2s;
}

.view-tab:hover {
    color: var(--text-primary);
}

.view-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.view-tab-content {
    max-height: 55vh;
    overflow-y: auto;
}

/* ── Audit Timeline ── */

.audit-timeline {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.audit-entry {
    padding: .75rem 1rem;
    border-radius: var(--radius-md, 8px);
    background: var(--surface-2, rgba(255,255,255,.03));
    border-left: 3px solid var(--accent, #6366f1);
}

.audit-header {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    font-size: .85rem;
}

.audit-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 12px;
    color: #fff;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .5px;
}

.audit-user {
    font-weight: 600;
    color: var(--text-primary);
}

.audit-date {
    color: var(--text-secondary);
    font-size: .8rem;
    margin-left: auto;
}

.audit-changes {
    margin-top: .5rem;
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

.audit-field {
    font-size: .8rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--surface-3, rgba(255,255,255,.06));
    color: var(--text-secondary);
}

.audit-field del {
    opacity: .5;
    text-decoration: line-through;
}

/* ── Assignments Table ── */

.assign-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
}

.assign-table th,
.assign-table td {
    text-align: left;
    padding: .5rem .75rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,.08));
}

.assign-table th {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Input group for conditional hiding ── */

.form-group { transition: opacity .2s, max-height .2s; }
.input-group { transition: opacity .2s, max-height .2s; }

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD UPGRADE: Quick Actions Bar
   ═══════════════════════════════════════════════════════════════════════ */

.quick-actions-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: var(--spacing-2xl);
    flex-wrap: wrap;
}

.qa-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid transparent;
}

.qa-btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px -4px rgba(0, 74, 173, 0.35);
}

.qa-btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -6px rgba(0, 74, 173, 0.45);
}

.qa-btn-secondary {
    background: white;
    color: var(--text-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.qa-btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(0, 74, 173, 0.04);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════════════════
   DASHBOARD UPGRADE: Bottom Grid (Activity + Attention)
   ═══════════════════════════════════════════════════════════════════════ */

.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-lg);
    margin-top: var(--spacing-lg);
}

@media (max-width: 1024px) {
    .dashboard-bottom-grid { grid-template-columns: 1fr; }
}

/* Activity Feed Item */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    transition: background 0.15s ease;
    border-left: 3px solid transparent;
}

.activity-item:hover {
    background: rgba(0, 74, 173, 0.03);
}

.activity-item.op-CREATE { border-left-color: #22c55e; }
.activity-item.op-UPDATE { border-left-color: #eab308; }
.activity-item.op-DELETE { border-left-color: #ef4444; }

.activity-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.activity-icon.ic-create { background: linear-gradient(135deg, #22c55e, #16a34a); }
.activity-icon.ic-update { background: linear-gradient(135deg, #eab308, #ca8a04); }
.activity-icon.ic-delete { background: linear-gradient(135deg, #ef4444, #dc2626); }

.activity-text {
    flex: 1;
    min-width: 0;
}

.activity-text .activity-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.activity-text .activity-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.activity-text .activity-changes {
    margin-top: 0.375rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.activity-text .activity-field-tag {
    font-size: 0.7rem;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
    font-weight: 600;
}

/* Attention Card */
.attention-card {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
}

.attention-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateX(3px);
}

.attention-card .attn-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attention-card .attn-icon.warn { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.attention-card .attn-icon.danger { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.attention-card .attn-icon.info { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }

.attention-card .attn-text {
    flex: 1;
}

.attention-card .attn-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.attention-card .attn-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.attention-card .attn-count {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.04em;
}

/* ═══════════════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════════════ */

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 420px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast.toast-success::before { background: #22c55e; }
.toast.toast-error::before { background: #ef4444; }
.toast.toast-warning::before { background: #f59e0b; }
.toast.toast-info::before { background: #3b82f6; }

.toast .toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.toast.toast-success .toast-icon { color: #22c55e; }
.toast.toast-error .toast-icon { color: #ef4444; }
.toast.toast-warning .toast-icon { color: #f59e0b; }
.toast.toast-info .toast-icon { color: #3b82f6; }

.toast .toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: background 0.15s;
    display: flex;
}

.toast .toast-close:hover { background: var(--bg-tertiary); }

.toast.toast-exit {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ═══════════════════════════════════════════════════════════════════════
   ACTIVITY LOG VIEW
   ═══════════════════════════════════════════════════════════════════════ */

.activity-log-entry {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: white;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.activity-log-entry:hover {
    border-color: rgba(0, 74, 173, 0.2);
    box-shadow: var(--shadow-sm);
}

.activity-log-entry .log-op-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: white;
    flex-shrink: 0;
}

.log-op-badge.op-create { background: #22c55e; }
.log-op-badge.op-update { background: #eab308; }
.log-op-badge.op-delete { background: #ef4444; }

.activity-log-entry .log-details {
    flex: 1;
    min-width: 0;
}

.activity-log-entry .log-details .log-summary {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-log-entry .log-details .log-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.activity-log-entry .log-field-changes {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.log-field-chip {
    font-size: 0.78rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 500;
}

.log-field-chip del {
    opacity: 0.5;
    text-decoration: line-through;
}
