/* ========== Neo Dashboard UI ========== */

.neo-ui-widget {
    animation: neoUiFadeUp 0.45s ease-out;
    border-radius: 24px;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    padding: 1.5rem;
}

.neo-ui-widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.neo-ui-widget-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.neo-ui-widget-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0;
}

.neo-ui-widget-subtitle {
    color: #64748b;
    font-size: 0.92rem;
    margin-top: 0.4rem;
    margin-bottom: 0;
}

.neo-ui-widget-footer {
    margin-top: 1.25rem;
    padding-top: 1.1rem;
    border-top: 1px solid #e5e7eb;
    color: #64748b;
    font-size: 0.95rem;
}

/* Hero */
.neo-ui-hero-card {
    position: relative;
    overflow: hidden;
    padding: 1.5rem;
    border-radius: 24px;
    border: 1px solid #cfe0f5;
    background:
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.10), transparent 30%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.neo-ui-hero-card::before,
.neo-ui-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    inset-inline: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
}

.neo-ui-hero-card:hover,
.neo-ui-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.10);
}

.neo-ui-hero-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.neo-ui-hero-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.20);
}

.neo-ui-hero-icon svg,
.neo-ui-stat-icon svg {
    width: 22px;
    height: 22px;
}

.neo-ui-hero-chip,
.neo-ui-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #eff6ff;
    color: #2563eb;
    font-weight: 600;
    padding: 5px 14px;
    font-size: 12px;
    white-space: nowrap;
}

.neo-ui-hero-main { margin-top: 18px; }

.neo-ui-hero-value {
    font-size: 2.4rem;
    line-height: 1;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0;
}

.neo-ui-hero-meta {
    display: flex;
    gap: 1.5rem;
    margin-top: 18px;
    flex-wrap: wrap;
}

.neo-ui-hero-meta-item { min-width: 120px; }

.neo-ui-hero-meta-label {
    display: block;
    margin-bottom: 4px;
    font-size: 16px;
    color: #64748b;
}

.neo-ui-hero-meta-value {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
}

.neo-ui-hero-progress {
    height: 12px;
    margin-top: 20px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}

.neo-ui-hero-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.neo-ui-hero-progress-caption {
    margin-top: 8px;
    font-size: 16px;
    color: #64748b;
}

/* Stat Cards */
.neo-ui-stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 150px;
    padding: 1.15rem 1.15rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.neo-ui-stat-card-success { background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 100%); }
.neo-ui-stat-card-success::before { background: linear-gradient(90deg, #22c55e, #4ade80); }
.neo-ui-stat-card-warning { background: linear-gradient(180deg, #fffbeb 0%, #ffffff 100%); }
.neo-ui-stat-card-warning::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.neo-ui-stat-card-danger { background: linear-gradient(180deg, #fef2f2 0%, #ffffff 100%); }
.neo-ui-stat-card-danger::before { background: linear-gradient(90deg, #ef4444, #f87171); }

.neo-ui-stat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.neo-ui-stat-label {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    color: #1e3a8a;
}

.neo-ui-stat-value {
    margin: 14px 0 0;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.neo-ui-stat-footer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.9rem;
    border-top: 1px solid #e5e7eb;
    margin-top: 1rem;
}

.neo-ui-stat-footer-text { color: #64748b; font-size: 0.85rem; }

.neo-ui-stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 14px;
    background: rgba(99, 102, 241, 0.10);
    color: #6366f1;
}

.neo-ui-stat-grid,
.neo-ui-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.neo-ui-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.neo-ui-side-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.neo-ui-bottom-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

/* Badges */
.neo-ui-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}
.neo-ui-badge.neutral { background: #eef2ff; color: #4f46e5; }
.neo-ui-badge.info { background: #eff6ff; color: #2563eb; }
.neo-ui-badge.success { background: #dcfce7; color: #16a34a; }
.neo-ui-badge.warning { background: #fef3c7; color: #d97706; }
.neo-ui-badge.danger { background: #fee2e2; color: #dc2626; }

/* Table */
.neo-ui-table-wrap {
    overflow: hidden;
    border: 1px solid #e5e7eb;
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}
.neo-ui-table-scroll { overflow-x: auto; }
.neo-ui-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.neo-ui-table thead th {
    padding: 1rem 1.25rem;
    text-align: start;
    font-size: 0.875rem;
    font-weight: 700;
    color: #475569;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.95));
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.neo-ui-table tbody td { padding: 1rem 1.25rem; font-size: 0.95rem; color: #0f172a; vertical-align: middle; }
.neo-ui-table tbody tr:not(:last-child) td { border-bottom: 1px solid #eef2f7; }
.neo-ui-table tbody tr:hover td { background: rgba(59, 130, 246, 0.035); }
.neo-ui-table .text-right, .text-right { text-align: right; }
.neo-ui-table-empty td { text-align: center; color: #64748b; padding: 1.5rem 1.25rem; }

/* Chart */
.neo-ui-chart-canvas {
    min-height: 320px;
    padding: 0.75rem;
    border-radius: 1.25rem;
    border: 1px solid rgba(203, 213, 225, 0.9);
    background:
        radial-gradient(circle at top left, rgba(59, 130, 246, 0.08), transparent 35%),
        linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 8px 24px rgba(15, 23, 42, 0.05);
}
.neo-ui-chart-placeholder, .neo-ui-empty-state { display: flex; min-height: 240px; align-items: center; justify-content: center; color: #64748b; }

/* Value colors */
.neo-ui-value-success { color: #16a34a !important; }
.neo-ui-value-warning { color: #d97706 !important; }
.neo-ui-value-danger { color: #dc2626 !important; }
.neo-ui-value-primary { color: #2563eb !important; }

/* Dark mode */
html.dark .neo-ui-widget, .dark .neo-ui-widget {
    background: linear-gradient(180deg, #0f1117 0%, #11141c 100%);
    border: 1px solid rgba(148, 163, 184, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
html.dark .neo-ui-widget-title, .dark .neo-ui-widget-title,
html.dark .neo-ui-hero-value, .dark .neo-ui-hero-value,
html.dark .neo-ui-stat-value, .dark .neo-ui-stat-value { color: #f8fafc; }
html.dark .neo-ui-widget-subtitle, .dark .neo-ui-widget-subtitle,
html.dark .neo-ui-widget-footer, .dark .neo-ui-widget-footer,
html.dark .neo-ui-hero-meta-label, .dark .neo-ui-hero-meta-label,
html.dark .neo-ui-hero-progress-caption, .dark .neo-ui-hero-progress-caption { color: #94a3b8; }
html.dark .neo-ui-widget-footer, .dark .neo-ui-widget-footer,
html.dark .neo-ui-stat-footer, .dark .neo-ui-stat-footer { border-top-color: rgba(148, 163, 184, 0.14); }
html.dark .neo-ui-hero-card, .dark .neo-ui-hero-card {
    background: radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 30%), linear-gradient(135deg, #161a22 0%, #111827 100%);
    border: 1px solid rgba(96, 165, 250, 0.20);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
html.dark .neo-ui-hero-chip, .dark .neo-ui-hero-chip,
html.dark .neo-ui-chip, .dark .neo-ui-chip { background: rgba(59, 130, 246, 0.14); color: #93c5fd; }
html.dark .neo-ui-hero-meta-value, .dark .neo-ui-hero-meta-value { color: #e2e8f0; }
html.dark .neo-ui-hero-progress, .dark .neo-ui-hero-progress { background: #273244; }
html.dark .neo-ui-stat-card, .dark .neo-ui-stat-card {
    background: linear-gradient(180deg, #161a22 0%, #111827 100%);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.24);
}
html.dark .neo-ui-stat-label, .dark .neo-ui-stat-label { color: #dbeafe; }
html.dark .neo-ui-stat-icon, .dark .neo-ui-stat-icon { background: rgba(99, 102, 241, 0.16); color: #818cf8; }
html.dark .neo-ui-stat-card-success, .dark .neo-ui-stat-card-success { background: linear-gradient(180deg, rgba(20,83,45,.28) 0%, #111827 100%); border-color: rgba(34,197,94,.22); }
html.dark .neo-ui-stat-card-warning, .dark .neo-ui-stat-card-warning { background: linear-gradient(180deg, rgba(120,53,15,.26) 0%, #111827 100%); border-color: rgba(245,158,11,.22); }
html.dark .neo-ui-stat-card-danger, .dark .neo-ui-stat-card-danger { background: linear-gradient(180deg, rgba(127,29,29,.28) 0%, #111827 100%); border-color: rgba(239,68,68,.22); }
html.dark .neo-ui-badge.neutral, .dark .neo-ui-badge.neutral { background: rgba(99,102,241,.16); color: #a5b4fc; }
html.dark .neo-ui-badge.info, .dark .neo-ui-badge.info { background: rgba(59,130,246,.16); color: #93c5fd; }
html.dark .neo-ui-badge.success, .dark .neo-ui-badge.success { background: rgba(34,197,94,.16); color: #86efac; }
html.dark .neo-ui-badge.warning, .dark .neo-ui-badge.warning { background: rgba(245,158,11,.16); color: #fcd34d; }
html.dark .neo-ui-badge.danger, .dark .neo-ui-badge.danger { background: rgba(239,68,68,.16); color: #fca5a5; }
html.dark .neo-ui-table-wrap, .dark .neo-ui-table-wrap { border-color: rgba(255,255,255,.08); background: rgba(15,23,42,.72); box-shadow: 0 12px 28px rgba(0,0,0,.28); }
html.dark .neo-ui-table thead th, .dark .neo-ui-table thead th { color: #cbd5e1; background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03)); border-bottom-color: rgba(255,255,255,.08); }
html.dark .neo-ui-table tbody td, .dark .neo-ui-table tbody td { color: #f8fafc; }
html.dark .neo-ui-table tbody tr:not(:last-child) td, .dark .neo-ui-table tbody tr:not(:last-child) td { border-bottom-color: rgba(255,255,255,.06); }
html.dark .neo-ui-table tbody tr:hover td, .dark .neo-ui-table tbody tr:hover td { background: rgba(255,255,255,.025); }
html.dark .neo-ui-chart-canvas, .dark .neo-ui-chart-canvas { border-color: rgba(148,163,184,.12); background: radial-gradient(circle at top left, rgba(37,99,235,.10), transparent 35%), linear-gradient(180deg, rgba(15,23,42,.35), rgba(2,6,23,.22)); box-shadow: inset 0 1px 0 rgba(255,255,255,.03); }
html.dark .neo-ui-value-success, .dark .neo-ui-value-success { color: #4ade80 !important; }
html.dark .neo-ui-value-warning, .dark .neo-ui-value-warning { color: #fbbf24 !important; }
html.dark .neo-ui-value-danger, .dark .neo-ui-value-danger { color: #f87171 !important; }
html.dark .neo-ui-value-primary, .dark .neo-ui-value-primary { color: #60a5fa !important; }

/* Responsive */
@media (max-width: 1280px) { .neo-ui-breakdown-grid, .neo-ui-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1024px) { .neo-ui-layout { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .neo-ui-breakdown-grid, .neo-ui-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) { .neo-ui-bottom-grid { grid-template-columns: 1fr; } .neo-ui-table { min-width: 640px; } .neo-ui-table thead th, .neo-ui-table tbody td { padding: .875rem 1rem; } }
@media (max-width: 640px) {
    .neo-ui-breakdown-grid, .neo-ui-stat-grid, .neo-ui-side-grid { grid-template-columns: 1fr; }
    .neo-ui-hero-top { flex-direction: column; align-items: flex-start; }
    .neo-ui-hero-value { font-size: 2rem; }
    .neo-ui-stat-value { font-size: 2.35rem; }
    .neo-ui-widget, .neo-ui-hero-card { padding: 1rem; }
}

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