/* ========================================================================
   ACME Foundation Impact Platform — Admin Design System v2.0
   Premium Glassmorphic · High-Contrast · Audit-Ready
   ======================================================================== */

:root {
    /* ── Premium Glassmorphic Palette ───────────────────── */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.65);
    --bg-card-hover: rgba(255, 255, 255, 0.85);
    --bg-sidebar: rgba(255, 255, 255, 0.70);
    --bg-topbar: rgba(255, 255, 255, 0.60);
    --bg-input: #ffffff;
    --border-color: rgba(15, 23, 42, 0.12);
    --border-strong: rgba(15, 23, 42, 0.20);
    --border-active: #4f46e5;

    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --accent-primary: #4f46e5;
    --accent-primary-hover: #4338ca;
    --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    --accent-glow: 0 10px 25px -5px rgba(79, 70, 229, 0.4);

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

    /* ── Typography ───────────────────── */
    --font-sans: Verdana, Geneva, Tahoma, sans-serif;

    /* ── Layout & Shadows ───────────────────── */
    --sidebar-width: 270px;
    --sidebar-collapsed: 80px;
    --topbar-height: 70px;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-soft: 0 8px 32px rgba(31, 38, 135, 0.05);
    --shadow-hover: 0 14px 45px rgba(31, 38, 135, 0.08);

    /* ── Transitions ───────────────────── */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset & Base ──────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: var(--font-sans); 
    background-color: var(--bg-primary); 
    color: var(--text-primary); 
    font-size: 13.5px;
    line-height: 1.55;
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(236, 72, 153, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
}
a { color: inherit; text-decoration: none; }

/* ── Utilities ──────────────────────── */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.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; }
.gap-8 { gap: 2rem; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.w-fit { width: fit-content; }
.w-full { width: 100%; }
.flex-1 { flex: 1 1 0%; }
.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; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mr-2 { margin-right: 0.5rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.pt-0 { padding-top: 0; }
.pb-0 { padding-bottom: 0; }
.ps-8 { padding-inline-start: 2rem; }
.pe-8 { padding-inline-end: 2rem; }
.rounded { border-radius: 4px; }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-2xl { border-radius: 20px; }
.rounded-full { border-radius: 50px; }
.h-screen { height: 100vh; }
.overflow-hidden { overflow: hidden; }
.overflow-visible { overflow: visible; }
.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.font-sans { font-family: var(--font-sans); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-black { font-weight: 900; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-muted { color: var(--text-muted); }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-end { text-align: end; }
.text-red-400 { color: var(--danger); }
.uppercase { text-transform: uppercase; }
.italic { font-style: italic; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.tracking-tight { letter-spacing: -0.025em; }
.leading-none { line-height: 1; }
.leading-relaxed { line-height: 1.625; }
.m-0 { margin: 0; }
.w-4 { width: 16px; }
.h-4 { height: 16px; }
.w-5 { width: 20px; }
.h-5 { height: 20px; }
.w-6 { width: 24px; }
.h-6 { height: 24px; }
.w-8 { width: 32px; }
.h-8 { height: 32px; }
.w-9 { width: 36px; }
.h-9 { height: 36px; }
.w-12 { width: 48px; }
.h-12 { height: 48px; }
.w-14 { width: 56px; }
.h-14 { height: 56px; }
.w-16 { width: 64px; }
.h-16 { height: 64px; }
.opacity-50 { opacity: 0.5; }
.opacity-60 { opacity: 0.6; }
.hidden { display: none; }
.border-none { border: none !important; }
.shadow-sm { box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.relative { position: relative; }
.sticky { position: sticky; }
.transition-all { transition: all var(--transition-base); }
.cursor-pointer { cursor: pointer; }

@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .md\:col-span-1 { grid-column: span 1; }
    .md\:col-span-3 { grid-column: span 3; }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .lg\:grid-cols-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .lg\:col-span-4 { grid-column: span 4; }
    .lg\:col-span-5 { grid-column: span 5; }
    .lg\:col-span-6 { grid-column: span 6; }
    .lg\:col-span-7 { grid-column: span 7; }
    .lg\:col-span-8 { grid-column: span 8; }
}

/* ── Scrollbar ──────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, 0.15); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, 0.25); }

/* ========================================================================
   SIDEBAR
   ======================================================================== */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: width var(--transition-base);
    position: relative;
    z-index: 50;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 8px;
    min-height: 60px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 36px;
    height: 36px;
    color: var(--accent-primary);
    flex-shrink: 0;
}
.brand-icon svg { width: 100%; height: 100%; }

.brand-text {
    display: flex;
    flex-direction: column;
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}

.brand-name {
    font-size: 18px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.brand-sub {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: -2px;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}
.sidebar-toggle:hover { color: var(--text-primary); background: rgba(15,23,42,0.05); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px 20px;
}

.nav-section {
    margin-top: 20px;
    margin-bottom: 4px;
    padding: 0 12px;
}

.nav-section-title {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-base);
    margin: 4px 0;
    white-space: nowrap;
    position: relative;
    font-weight: 500;
}

.nav-item:hover {
    color: var(--accent-primary);
    background: rgba(79, 70, 229, 0.04);
    transform: translateX(4px);
}

.nav-item.active {
    color: var(--accent-primary);
    background: rgba(79, 70, 229, 0.08);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 24px;
    background: var(--accent-gradient);
    border-radius: 4px;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-label {
    font-size: 13.5px;
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

/* ========================================================================
   MAIN WRAPPER
   ======================================================================== */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* ========================================================================
   TOP BAR
   ======================================================================== */
.topbar {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-topbar);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    z-index: 40;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
}

.breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb .separator { margin: 0 6px; opacity: 0.4; }

.topbar-search {
    position: relative;
    width: 280px;
}
.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}
.search-input {
    width: 100%;
    padding: 8px 12px 8px 36px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-fast);
}
.search-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.25);
}
.search-input::placeholder { color: var(--text-muted); }

.topbar-icon-btn {
    position: relative;
    padding: 8px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
}
.topbar-icon-btn:hover { color: var(--text-primary); background: rgba(15,23,42,0.05); }

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    color: white;
    background: var(--danger);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Profile Dropdown */
.profile-dropdown { position: relative; }
.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: none;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition-fast);
}
.profile-trigger:hover { background: rgba(15,23,42,0.04); border-color: var(--border-color); }

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.profile-info { display: flex; flex-direction: column; text-align: left; }
.profile-name { font-size: 13px; font-weight: 600; }
.profile-role { font-size: 11px; color: var(--text-muted); }

.profile-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    z-index: 100;
}
.profile-menu.show { display: block; animation: fadeSlideDown 200ms ease; }

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
    text-align: left;
}
.profile-menu-item:hover { background: rgba(15,23,42,0.05); color: var(--text-primary); }
.profile-menu-divider { border: none; border-top: 1px solid var(--border-color); margin: 4px 0; }

/* ========================================================================
   MAIN CONTENT
   ======================================================================== */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ========================================================================
   ALERTS
   ======================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 13.5px;
    animation: fadeSlideDown 300ms ease;
}
.alert-success { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.25); color: #047857; }
.alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.25); color: #b91c1c; }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.25); color: #92400e; }
.alert-info { background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.25); color: #1d4ed8; }
.alert-close {
    margin-left: auto;
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
}
.alert-close:hover { opacity: 1; }

/* ========================================================================
   CARDS
   ======================================================================== */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    transition: all var(--transition-base);
}
.card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(79, 70, 229, 0.2);
    box-shadow: 0 20px 50px rgba(79, 70, 229, 0.08);
    transform: translateY(-4px);
}
/* Disable card hover lift for forms & static content cards */
.card:has(.card-body form),
.card:has(.form-group),
.card:has(.data-table),
.card:has(.detail-table) {
    transform: none !important;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body { padding: 20px; }
.card-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* Stat card */
.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: -150%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.6) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-25deg);
    transition: all 0.7s ease;
}
.stat-card:hover { 
    background: var(--bg-card-hover);
    transform: translateY(-5px); 
    box-shadow: var(--shadow-hover); 
    border-color: rgba(255,255,255,1); 
}
.stat-card:hover::before {
    left: 200%;
}
.stat-label { font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.stat-value { font-size: 32px; font-weight: 800; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.stat-change { font-size: 13px; font-weight: 500; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.positive { color: var(--success); }
.stat-change.negative { color: var(--danger); }

/* ========================================================================
   TABLES
   ======================================================================== */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}
.data-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 16px 20px;
    border-bottom: 2px solid var(--border-color);
    background: rgba(248, 250, 252, 0.5);
}
.data-table td {
    padding: 16px 20px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tbody tr { transition: all var(--transition-fast); }
.data-table tbody tr:hover { background: rgba(79, 70, 229, 0.03); }

/* Generic table styling (for views using <table> without .data-table) */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { vertical-align: middle; }
.table-hover tbody tr:hover { background: rgba(79, 70, 229, 0.02); }
.table-responsive { overflow-x: auto; }
.divide-y > * + * { border-top: 1px solid var(--border-color); }

/* ========================================================================
   DETAIL TABLES (View Pages)
   ======================================================================== */
.detail-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--radius-md);
    border-style: hidden;
    box-shadow: 0 0 0 1px var(--border-color);
    overflow: hidden;
}
.detail-table tr {
    transition: all var(--transition-fast);
}
.detail-table tr:not(:last-child) td {
    border-bottom: 1px solid var(--border-color);
}
.detail-table tr:hover td:last-child {
    background: rgba(79, 70, 229, 0.015) !important;
}
.detail-table td {
    padding: 16px 24px !important;
    font-size: 14px !important;
    vertical-align: top;
    line-height: 1.6;
}
.detail-table td:first-child {
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    width: 240px !important;
    background: rgba(240, 244, 248, 0.6) !important;
    border-right: 1px solid var(--border-color);
    letter-spacing: 0.2px;
}
.detail-table td:last-child {
    color: var(--text-primary) !important;
    background: #ffffff !important;
}

/* ========================================================================
   BADGES
   ======================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.badge-green { background: rgba(34,197,94,0.12); color: #047857; font-weight: 700; }
.badge-blue { background: rgba(59,130,246,0.12); color: #1d4ed8; font-weight: 700; }
.badge-yellow { background: rgba(245,158,11,0.12); color: #92400e; font-weight: 700; }
.badge-red { background: rgba(239,68,68,0.12); color: #b91c1c; font-weight: 700; }
.badge-purple { background: rgba(139,92,246,0.12); color: #6d28d9; font-weight: 700; }
.badge-gray { background: rgba(100,116,139,0.12); color: #475569; font-weight: 700; }
.badge-orange { background: rgba(251,146,60,0.12); color: #c2410c; font-weight: 700; }
.badge-emerald { background: rgba(16,185,129,0.12); color: #065f46; font-weight: 700; }
.badge-indigo { background: rgba(99,102,241,0.12); color: #4338ca; font-weight: 700; }

/* ========================================================================
   BUTTONS
   ======================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--accent-gradient);
    background-size: 200% auto;
    color: white;
    border: none;
    box-shadow: var(--accent-glow);
    transition: all var(--transition-base);
}
.btn-primary:hover {
    background-position: right center;
    box-shadow: 0 15px 35px -5px rgba(79, 70, 229, 0.5);
    transform: translateY(-2px) scale(1.02);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover { background: rgba(15,23,42,0.02); color: var(--text-primary); }

.btn-danger {
    background: rgba(239,68,68,0.10);
    color: #b91c1c;
    border: 1px solid rgba(239,68,68,0.25);
    font-weight: 700;
}
.btn-danger:hover { background: rgba(239,68,68,0.18); color: #991b1b; }

.btn-success {
    background: rgba(34,197,94,0.10);
    color: #047857;
    border: 1px solid rgba(34,197,94,0.25);
    font-weight: 700;
}
.btn-success:hover { background: rgba(34,197,94,0.18); color: #065f46; }

.btn-ghost {
    background: none;
    color: var(--text-secondary);
    border: none;
    padding: 6px 10px;
}
.btn-ghost:hover { color: var(--text-primary); background: rgba(15,23,42,0.04); }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; }
.btn-icon { padding: 8px; }

/* ========================================================================
   FORMS — HIGH CONTRAST, FULL VISIBILITY
   ======================================================================== */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ── Core Form Controls ─────────────── */
.form-input,
.form-select,
.form-textarea,
input[type="text"].form-input,
input[type="email"].form-input,
input[type="number"].form-input,
input[type="password"].form-input,
input[type="date"].form-input,
input[type="url"].form-input,
input[type="tel"].form-input,
select.form-select,
textarea.form-textarea,
textarea.form-input {
    width: 100%;
    padding: 12px 16px;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: var(--radius-md);
    color: #0f172a !important;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    outline: none;
    transition: all var(--transition-base);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    min-height: 46px;
    -webkit-appearance: none;
    appearance: none;
}

/* Ensure text is always visible */
.form-input::placeholder,
.form-textarea::placeholder,
textarea.form-input::placeholder {
    color: #94a3b8 !important;
    font-weight: 400;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover,
textarea.form-input:hover {
    border-color: #94a3b8 !important;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
textarea.form-input:focus {
    border-color: #4f46e5 !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12), 0 1px 3px rgba(0,0,0,0.04) !important;
}

.form-textarea,
textarea.form-input { 
    resize: vertical; 
    min-height: 120px; 
    line-height: 1.6; 
}

.form-select,
select.form-select { 
    cursor: pointer; 
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%234f46e5' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e") !important;
    background-position: right 0.75rem center !important;
    background-repeat: no-repeat !important;
    background-size: 1.25em 1.25em !important;
    padding-right: 2.5rem !important;
    background-color: #ffffff !important;
}

/* Override any Tailwind or inline opacity/color overrides on form controls */
.form-input[readonly] {
    background: #f1f5f9 !important;
    color: #64748b !important;
    cursor: default;
}

.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 6px; font-weight: 500; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 6px; font-weight: 700; }

/* ── Date Input Fix ─────────────────── */
input[type="date"].form-input {
    color: #0f172a !important;
    background: #ffffff !important;
}
input[type="date"].form-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
}
input[type="date"].form-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

/* ── Number Input Fix ───────────────── */
input[type="number"].form-input::-webkit-inner-spin-button,
input[type="number"].form-input::-webkit-outer-spin-button {
    opacity: 1;
    height: auto;
}

/* Premium Card (Dashboard) */
.premium-card {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(15,23,42,0.08);
    border-radius: var(--radius-xl);
    box-shadow: 0 4px 24px rgba(0,0,0,0.04);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}
.premium-card:hover {
    border-color: rgba(79,70,229,0.15);
    box-shadow: 0 20px 50px rgba(79,70,229,0.08);
}

/* Custom Checkbox/Radio */
.custom-checkbox, .custom-radio {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-strong);
    background-color: #ffffff;
    border-radius: 6px;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    display: grid;
    place-content: center;
    flex-shrink: 0;
    margin: 0;
}
.custom-radio { border-radius: 50%; }

.custom-checkbox::before {
    content: "";
    width: 11px;
    height: 11px;
    transform: scale(0);
    transition: 150ms transform cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 1em 1em white;
    background-color: white;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.custom-checkbox:hover { border-color: var(--accent-primary); }
.custom-checkbox:checked {
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4);
}
.custom-checkbox:checked::before { transform: scale(1); }

.custom-radio:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}
.custom-radio:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

/* Custom File Upload */
.custom-file-upload {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.file-input-wrapper {
    position: relative;
    width: 100%;
}
.file-input-wrapper input[type="file"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}
.file-input-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    background: rgba(15, 23, 42, 0.02);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    transition: all var(--transition-base);
    text-align: center;
}
.file-input-wrapper:hover .file-input-label {
    background: rgba(79, 70, 229, 0.04);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.file-input-icon {
    width: 32px;
    height: 32px;
    opacity: 0.5;
    transition: all var(--transition-base);
}
.file-input-wrapper:hover .file-input-icon {
    opacity: 1;
    transform: translateY(-2px);
}
.file-input-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.file-name-preview {
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    color: var(--accent-primary);
}

/* ========================================================================
   CHECKBOX GROUPS
   ======================================================================== */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}
.checkbox-group:hover {
    background: rgba(79, 70, 229, 0.03);
    border-color: rgba(79, 70, 229, 0.1);
}
.checkbox-group:active { transform: scale(0.99); }

/* ========================================================================
   PAGE HEADER
   ======================================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}
.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.page-actions { display: flex; gap: 10px; align-items: center; }

/* ========================================================================
   GRID
   ======================================================================== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ========================================================================
   PROGRESS
   ======================================================================== */
.progress-bar {
    height: 6px;
    background: rgba(15,23,42,0.06);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}
.progress-fill.green { background: var(--success); }
.progress-fill.amber { background: var(--warning); }
.progress-fill.red { background: var(--danger); }
.progress-fill.indigo { background: var(--accent-primary); }

/* ========================================================================
   TAB SYSTEM
   ======================================================================== */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}
.tab {
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    font-family: var(--font-sans);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

/* ========================================================================
   PAGINATION
   ======================================================================== */
.custom-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 24px;
    padding: 0 10px;
}
.card-footer .custom-pagination {
    margin-top: 0;
    padding: 0;
}
.pagination-info {
    font-size: 13.5px;
    color: var(--text-muted);
}
.pagination-info .font-medium {
    font-weight: 600;
    color: var(--text-primary);
}
.pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
}
.page-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: 1px solid transparent;
}
.page-item:hover:not(.disabled):not(.active) {
    background: #ffffff;
    color: var(--accent-primary);
    border-color: var(--border-color);
    box-shadow: var(--shadow-soft);
    transform: translateY(-1px);
}
.page-item.active {
    background: var(--accent-gradient);
    color: #ffffff;
    box-shadow: var(--accent-glow);
    border-color: transparent;
}
.page-item.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.page-link.dots {
    letter-spacing: 2px;
}

/* ========================================================================
   EMPTY STATE
   ======================================================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    opacity: 0.3;
}
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state-text { font-size: 13px; max-width: 400px; margin: 0 auto; }

/* ========================================================================
   ANIMATIONS
   ======================================================================== */
@keyframes fadeSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ========================================================================
   MOBILE OVERLAY
   ======================================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 45;
}
.sidebar-overlay.visible { display: block; }

/* ========================================================================
   RESPONSIVE
   ======================================================================== */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
    .topbar-search { width: 200px; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -280px;
        transition: left var(--transition-base);
    }
    .sidebar.mobile-open { left: 0; }
    .mobile-toggle { display: block; }
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .main-content { padding: 16px; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .topbar-search { display: none; }
    .profile-info { display: none; }
}
/* Custom Arbitrary Text Sizes used across templates but missing in static CSS */
.text-\[8px\] { font-size: 8px; }
.text-\[9px\] { font-size: 9px; }
.text-\[10px\] { font-size: 10px; }
.text-\[11px\] { font-size: 11px; }
.text-\[12px\] { font-size: 12px; }
.text-\[13px\] { font-size: 13px; }

/* Custom Tracking constraints missing in static CSS */
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0em; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
