/* ============================================
   Dashboard Page – EnjazIMS v2.0
   ============================================ */

/* ── Welcome banner ─────────────────────────── */
.dash-welcome {
    background: linear-gradient(135deg, rgba(99,102,241,0.07) 0%, rgba(16,185,129,0.05) 100%);
    border: 1px solid rgba(99,102,241,0.15);
    border-radius: 16px;
    padding: 1rem 1.25rem;
}

[data-theme="dark"] .dash-welcome {
    background: linear-gradient(135deg, rgba(99,102,241,0.12), rgba(16,185,129,0.08));
    border-color: rgba(99,102,241,0.25);
}

.dash-welcome h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.dash-welcome p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}

.trend-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── KPI strip ──────────────────────────────── */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
}

@media (min-width: 768px) {
    .kpi-strip { grid-template-columns: repeat(4, 1fr); }
}

.dash-kpi {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: box-shadow 150ms ease, transform 150ms ease;
    position: relative;
    overflow: hidden;
}

/* Left accent bar */
.dash-kpi::before {
    content: '';
    position: absolute;
    right: 0;
    top: 15%;
    bottom: 15%;
    width: 3px;
    border-radius: 4px;
}

.dash-kpi.primary::before { background: var(--primary); }
.dash-kpi.success::before { background: var(--success); }
.dash-kpi.info::before    { background: var(--info); }
.dash-kpi.warning::before { background: var(--warning); }

.dash-kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
}

.dash-kpi .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.dash-kpi .stat-body { flex: 1; min-width: 0; }

.dash-kpi.primary .stat-icon { background: rgba(99,102,241,0.1);  color: var(--primary); }
.dash-kpi.success .stat-icon { background: rgba(16,185,129,0.1);  color: var(--success); }
.dash-kpi.info    .stat-icon { background: rgba(59,130,246,0.1);  color: var(--info); }
.dash-kpi.warning .stat-icon { background: rgba(245,158,11,0.1);  color: var(--warning); }

.dash-kpi .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.dash-kpi .stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: 0.1rem;
}

/* ── Insight card ────────────────────────────── */
.insight-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 1rem;
}

.insight-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.35rem;
}

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

/* ── Chart card ──────────────────────────────── */
.dash-chart {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
}

.dash-chart .card-header {
    border-bottom: 1px solid var(--border-light);
    padding: 0.7rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.dash-chart .card-header h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.dash-chart .card-body { padding: 1rem; }

.chart-meta {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-tertiary);
    background: var(--bg-secondary);
    border-radius: 20px;
    padding: 0.18rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Radial charts ───────────────────────────── */
.circle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    text-align: center;
}

.circle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.radial-chart {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: conic-gradient(
        var(--ring-color, var(--primary)) calc(var(--percent, 0) * 1%),
        rgba(148,163,184,0.12) 0
    );
}

.radial-chart::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--surface);
}

.radial-chart-82 { --percent: 82; }
.radial-chart-67 { --percent: 67; }
.radial-chart-91 { --percent: 91; }
.radial-chart-success { --ring-color: var(--success); }
.radial-chart-info    { --ring-color: var(--info); }
.radial-chart-warning { --ring-color: var(--warning); }

.radial-value {
    position: absolute;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--text-primary);
}

.circle-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Pipeline bars ───────────────────────────── */
.pipe-board {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: end;
    min-height: 150px;
    padding: 0.25rem 0;
}

.pipe-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
}

.pipe-track {
    width: 24px;
    height: 120px;
    border-radius: 20px;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.pipe-fill {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    border-radius: 20px;
    background: linear-gradient(180deg, #22c55e 0%, #06b6d4 50%, #6366f1 100%);
}

.pipe-fill-92 { height: 92%; }
.pipe-fill-76 { height: 76%; }
.pipe-fill-61 { height: 61%; }
.pipe-fill-44 { height: 44%; }
.pipe-fill-33 { height: 33%; }

.pipe-dot {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
}

.pipe-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

/* ── Category list ───────────────────────────── */
.category-list { display: flex; flex-direction: column; gap: 0.75rem; }

.category-row {
    display: grid;
    grid-template-columns: 1fr 2fr auto;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.82rem;
}

.category-row > span:first-child { color: var(--text-primary); font-weight: 500; }

.category-track {
    height: 6px;
    border-radius: 20px;
    background: var(--bg-secondary);
    position: relative;
    overflow: hidden;
}

.category-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.category-fill-82 { width: 82%; }
.category-fill-64 { width: 64%; }
.category-fill-47 { width: 47%; }
.category-fill-31 { width: 31%; }

.category-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.82rem;
    min-width: 38px;
    text-align: left;
}

/* ── Status list ─────────────────────────────── */
.status-list { display: flex; flex-direction: column; gap: 0; }

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.83rem;
}

.status-row:last-child { border-bottom: none; }
.status-row > span:first-child { color: var(--text-secondary); }
.status-row .value { font-weight: 700; color: var(--text-primary); }

/* ── Dash alerts ─────────────────────────────── */
.dash-alert {
    border-radius: 12px;
    padding: 0.75rem 0.9rem;
    margin-bottom: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: none;
}

.dash-alert.warning,
.dash-alert.alert-warning {
    background: rgba(245,158,11,0.08);
    border-right: 3px solid var(--warning);
}

.dash-alert.info,
.dash-alert.alert-info {
    background: rgba(59,130,246,0.08);
    border-right: 3px solid var(--info);
}

.dash-alert.alert-danger {
    background: rgba(239,68,68,0.08);
    border-right: 3px solid var(--danger);
}

.dash-alert h5 {
    margin-bottom: 0.15rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
}

.dash-alert p {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Quick Actions ───────────────────────────── */
.dash-quick {
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--surface);
}

.dash-quick .card-header {
    border-bottom: 1px solid var(--border-light);
    padding: 0.7rem 1rem;
    background: transparent;
}

.dash-quick .card-header h5 {
    font-size: 0.9rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
}

.dash-quick .card-body { padding: 0.875rem; }

.dash-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.875rem;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    background: var(--surface);
    color: var(--text-primary);
    text-decoration: none;
    transition: all 150ms ease;
}

.quick-action:hover {
    transform: translateY(-1px);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99,102,241,0.12);
    color: var(--text-primary);
}

.quick-action i {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.quick-action .qa-title { font-size: 0.82rem; font-weight: 600; line-height: 1.3; }
.quick-action .qa-sub   { font-size: 0.68rem; color: var(--text-secondary); }

.quick-action.primary i { background: rgba(99,102,241,0.1);  color: var(--primary); }
.quick-action.success i { background: rgba(16,185,129,0.1);  color: var(--success); }
.quick-action.info    i { background: rgba(59,130,246,0.1);  color: var(--info); }
.quick-action.warning i { background: rgba(245,158,11,0.1);  color: var(--warning); }

/* ── Fade-in ─────────────────────────────────── */
.fade-in { animation: fadeIn 0.2s ease both; }

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

/* ── Responsive ──────────────────────────────── */
@media (max-width: 992px) {
    .circle-grid { grid-template-columns: repeat(2, 1fr); }
    .pipe-board  { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .circle-grid { grid-template-columns: 1fr; }
    .pipe-board  { grid-template-columns: repeat(2, 1fr); }
    .dash-actions-grid { grid-template-columns: 1fr; }
    .category-row { grid-template-columns: 1fr; gap: 0.3rem; }
    .category-track { order: 2; }
    .category-value { order: 1; text-align: right; }
    .dash-kpi .stat-value { font-size: 1.3rem; }
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
}
