/* ============================================
   MODUL RAPOARTE — Dashboard & Analiză
   ============================================ */

.rap { max-width: 1200px; margin: 0 auto; padding: 12px 24px; }

/* Header */
.rap-header { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; position: relative; margin-bottom: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); }
.rap-header-accent { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, #0d9488 0%, #14b8a6 40%, #99f6e4 100%); }
.rap-header-content { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.rap-brand { display: flex; align-items: center; gap: 16px; }
.rap-brand-icon { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #f0fdfa, #ccfbf1); border: 1.5px solid #99f6e4; display: flex; align-items: center; justify-content: center; color: #0d9488; flex-shrink: 0; box-shadow: 0 2px 8px rgba(13,148,136,0.12); }
.rap-title { font-size: 17px; font-weight: 800; color: #0f172a; margin: 0; letter-spacing: -0.02em; }
.rap-subtitle { font-size: 11px; font-weight: 500; color: #94a3b8; display: block; margin-top: 2px; }
.rap-print-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; font-size: 12px; font-weight: 600; border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; color: #64748b; cursor: pointer; transition: all 0.15s; font-family: inherit; }
.rap-print-btn:hover { background: #f8fafc; border-color: #cbd5e1; color: #0f172a; transform: translateY(-1px); }

/* Alerts */
.rap-alerts { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.rap-alert {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px;
    border-radius: 10px; background: #fff; border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03); position: relative;
    overflow: hidden; flex-wrap: wrap;
}
.rap-alert::before { content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 3px; }
.rap-alert--danger::before { background: #ef4444; }
.rap-alert--warning::before { background: #f59e0b; }
.rap-alert--info::before { background: #3b82f6; }
.rap-alert-icon {
    width: 28px; height: 28px; border-radius: 7px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rap-alert--danger .rap-alert-icon { background: #fef2f2; color: #dc2626; }
.rap-alert--warning .rap-alert-icon { background: #fffbeb; color: #d97706; }
.rap-alert--info .rap-alert-icon { background: #eff6ff; color: #2563eb; }
.rap-alert-body { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.rap-alert-title { font-size: 12px; font-weight: 700; color: #1e293b; white-space: nowrap; }
.rap-alert-sep { color: #cbd5e1; font-size: 12px; }
.rap-alert-detail { font-size: 11px; color: #64748b; font-weight: 500; white-space: nowrap; }
.rap-alert-item {
    font-size: 10px; padding: 2px 8px; border-radius: 6px;
    background: #f1f5f9; color: #475569; font-weight: 600; white-space: nowrap;
}

/* KPI Cards */
.rap-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.rap-kpi {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
    padding: 18px 18px 14px; display: flex; flex-direction: column; gap: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.03); transition: all 0.25s;
    position: relative; overflow: hidden;
}
.rap-kpi::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.rap-kpi::after {
    content: ''; position: absolute; top: 3px; left: 0; right: 0; bottom: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.015) 0%, transparent 50%);
    pointer-events: none;
}
.rap-kpi:hover { transform: translateY(-3px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }

.rap-kpi-top { display: flex; align-items: center; gap: 8px; }
.rap-kpi-icon {
    width: 34px; height: 34px; border-radius: 9px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rap-kpi-data { min-width: 0; }
.rap-kpi-val {
    font-size: 26px; font-weight: 800; color: #0f172a;
    display: block; line-height: 1.15; font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}
.rap-kpi-label {
    font-size: 11px; font-weight: 600; color: #94a3b8;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.rap-kpi-sub {
    font-size: 11px; font-weight: 500; color: #cbd5e1;
    margin-top: -2px;
}

.rap-kpi--teal::before { background: linear-gradient(90deg, #14b8a6, #99f6e4); }
.rap-kpi--teal .rap-kpi-icon { background: #f0fdfa; color: #0d9488; border: 1px solid #99f6e4; }
.rap-kpi--teal .rap-kpi-val { color: #0f766e; }
.rap-kpi--blue::before { background: linear-gradient(90deg, #3b82f6, #93c5fd); }
.rap-kpi--blue .rap-kpi-icon { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.rap-kpi--blue .rap-kpi-val { color: #1d4ed8; }
.rap-kpi--amber::before { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.rap-kpi--amber .rap-kpi-icon { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.rap-kpi--amber .rap-kpi-val { color: #b45309; }
.rap-kpi--red::before { background: linear-gradient(90deg, #ef4444, #fca5a5); }
.rap-kpi--red .rap-kpi-icon { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.rap-kpi--red .rap-kpi-val { color: #dc2626; }

/* Grid */
.rap-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin-bottom: 20px; }
.rap-grid--3 { grid-template-columns: repeat(3, 1fr); }

/* Cards */
.rap-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); transition: box-shadow 0.2s; }
.rap-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.rap-card--wide { grid-column: 1 / -1; }
.rap-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.rap-card-title { font-size: 14px; font-weight: 700; color: #1e293b; margin: 0; display: flex; align-items: center; gap: 8px; }
.rap-card-title svg { color: #0d9488; }
.rap-card-sub { font-size: 11px; color: #94a3b8; font-weight: 500; }

/* Trend arrow */
.rap-trend { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 8px; }
.rap-trend--up { background: #dcfce7; color: #16a34a; }
.rap-trend--down { background: #fee2e2; color: #dc2626; }
.rap-trend--neutral { background: #f1f5f9; color: #94a3b8; }

/* Compare bars */
.rap-compare { display: flex; flex-direction: column; gap: 6px; }
.rap-compare-row { display: flex; justify-content: space-between; align-items: center; }
.rap-compare-label { font-size: 12px; font-weight: 600; color: #334155; }
.rap-compare-val { font-size: 14px; font-weight: 800; color: #0f172a; font-variant-numeric: tabular-nums; }
.rap-compare-row--muted .rap-compare-label { color: #94a3b8; }
.rap-compare-row--muted .rap-compare-val { color: #94a3b8; }
.rap-compare-bar { height: 8px; background: #f1f5f9; border-radius: 8px; overflow: hidden; }
.rap-compare-bar--muted { opacity: 0.5; }
.rap-compare-fill { height: 100%; border-radius: 8px; transition: width 0.6s ease-out; }
.rap-compare-fill--current { background: linear-gradient(90deg, #14b8a6, #0d9488); }
.rap-compare-fill--prev { background: linear-gradient(90deg, #cbd5e1, #94a3b8); }

/* Pattern chart */
.rap-pattern { display: flex; gap: 6px; height: 130px; }
.rap-pattern-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.rap-pattern-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.rap-pattern-bar { width: 70%; min-height: 4px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #818cf8, #6366f1); transition: height 0.4s; }
.rap-pattern-col:hover .rap-pattern-bar { background: linear-gradient(180deg, #a5b4fc, #4f46e5); }
.rap-pattern-label { font-size: 10px; font-weight: 700; color: #64748b; margin-top: 4px; }
.rap-pattern-val { font-size: 8px; color: #94a3b8; font-weight: 600; white-space: nowrap; margin-top: 1px; }

/* Decontare gauge */
.rap-decontare { display: flex; align-items: center; gap: 20px; }
.rap-decontare-gauge { flex-shrink: 0; }
.rap-gauge-svg { width: 100px; height: 100px; }
.rap-gauge-text { font-size: 22px; font-weight: 800; fill: #0f172a; font-family: inherit; }
.rap-gauge-sub { font-size: 10px; font-weight: 600; fill: #94a3b8; font-family: inherit; text-transform: uppercase; letter-spacing: 0.04em; }
.rap-decontare-stats { display: flex; flex-direction: column; gap: 8px; }
.rap-decontare-stat { display: flex; align-items: baseline; gap: 6px; }
.rap-decontare-num { font-size: 20px; font-weight: 800; color: #0f172a; }
.rap-decontare-label { font-size: 11px; font-weight: 600; color: #94a3b8; }

/* Bar Chart */
.rap-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 0 4px; }
.rap-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; position: relative; animation: rapBarIn 0.4s ease-out both; }
.rap-bar { width: 100%; min-height: 4px; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #14b8a6, #0d9488); transition: height 0.3s; }
.rap-bar-col:hover .rap-bar { background: linear-gradient(180deg, #2dd4bf, #0f766e); }
.rap-bar-label { font-size: 9px; color: #94a3b8; font-weight: 600; margin-top: 4px; white-space: nowrap; }
.rap-bar-tooltip { position: absolute; top: -4px; font-size: 9px; font-weight: 700; color: #0f766e; opacity: 0; transition: opacity 0.15s; white-space: nowrap; }
.rap-bar-col:hover .rap-bar-tooltip { opacity: 1; }

/* List rows */
.rap-list { display: flex; flex-direction: column; gap: 8px; }
.rap-list-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 8px; transition: background 0.15s; animation: rapSlide 0.3s ease-out both; }
.rap-list-row:hover { background: #f8fafc; }
.rap-list-rank { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.rap-list-rank--gold { background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; }
.rap-list-rank--silver { background: linear-gradient(135deg, #f1f5f9, #e2e8f0); color: #475569; }
.rap-list-rank--bronze { background: linear-gradient(135deg, #ffedd5, #fed7aa); color: #9a3412; }
.rap-list-rank--default { background: #f1f5f9; color: #94a3b8; }
.rap-list-rank--loc { background: linear-gradient(135deg, #f0fdfa, #ccfbf1); color: #0d9488; font-size: 10px; text-transform: uppercase; }
.rap-list-rank--casier { background: linear-gradient(135deg, #0d9488, #0f766e); color: #fff; font-size: 10px; text-transform: uppercase; }
.rap-list-info { flex: 1; min-width: 0; }
.rap-list-main { font-size: 12px; font-weight: 600; color: #1e293b; }
.rap-list-main small { font-weight: 500; color: #94a3b8; margin-left: 4px; }
.rap-list-bar { height: 4px; background: #f1f5f9; border-radius: 4px; margin-top: 4px; overflow: hidden; }
.rap-list-bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #14b8a6, #0d9488); transition: width 0.5s ease-out; }
.rap-list-bar--red .rap-list-bar-fill { background: linear-gradient(90deg, #f87171, #dc2626); }
.rap-list-bar--blue .rap-list-bar-fill { background: linear-gradient(90deg, #60a5fa, #2563eb); }
.rap-list-val { font-size: 13px; font-weight: 800; color: #0f766e; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rap-list-val--red { color: #dc2626; }

/* Aging */
.rap-aging { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.rap-aging-item { text-align: center; padding: 10px 6px; border-radius: 10px; border: 1px solid; }
.rap-aging-num { font-size: 22px; font-weight: 800; display: block; line-height: 1.2; }
.rap-aging-label { font-size: 10px; font-weight: 600; display: block; margin-top: 2px; }
.rap-aging--green { background: #f0fdf4; border-color: #bbf7d0; } .rap-aging--green .rap-aging-num { color: #16a34a; } .rap-aging--green .rap-aging-label { color: #15803d; }
.rap-aging--amber { background: #fffbeb; border-color: #fde68a; } .rap-aging--amber .rap-aging-num { color: #d97706; } .rap-aging--amber .rap-aging-label { color: #b45309; }
.rap-aging--orange { background: #fff7ed; border-color: #fed7aa; } .rap-aging--orange .rap-aging-num { color: #ea580c; } .rap-aging--orange .rap-aging-label { color: #c2410c; }
.rap-aging--red { background: #fef2f2; border-color: #fecaca; } .rap-aging--red .rap-aging-num { color: #dc2626; } .rap-aging--red .rap-aging-label { color: #b91c1c; }
.rap-aging-bar { display: flex; height: 8px; border-radius: 8px; overflow: hidden; background: #f1f5f9; }
.rap-aging-seg { min-width: 2px; transition: width 0.5s; }
.rap-aging-seg--green { background: #22c55e; } .rap-aging-seg--amber { background: #f59e0b; } .rap-aging-seg--orange { background: #f97316; } .rap-aging-seg--red { background: #ef4444; }

.rap-aging-detail { margin-top: 14px; border-top: 1px solid #f1f5f9; padding-top: 10px; }
.rap-aging-detail-head { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.rap-aging-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid #f8fafc; }
.rap-aging-row:last-child { border-bottom: none; }
.rap-aging-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.rap-aging-dot--green { background: #22c55e; } .rap-aging-dot--amber { background: #f59e0b; } .rap-aging-dot--orange { background: #f97316; } .rap-aging-dot--red { background: #ef4444; }
.rap-aging-name { flex: 1; font-size: 12px; font-weight: 600; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rap-aging-days { font-size: 11px; font-weight: 700; color: #94a3b8; white-space: nowrap; }
.rap-aging-sum { font-size: 12px; font-weight: 800; color: #b45309; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Summary */
.rap-summary { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 16px 24px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.04); flex-wrap: wrap; }
.rap-summary-item { text-align: center; }
.rap-summary-label { font-size: 10px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.04em; display: block; }
.rap-summary-val { font-size: 15px; font-weight: 800; color: #0f172a; display: block; margin-top: 2px; }
.rap-summary-val--red { color: #dc2626; }
.rap-summary-sep { width: 1px; height: 32px; background: #e2e8f0; }

.rap-empty { padding: 24px; text-align: center; color: #94a3b8; font-size: 13px; }

/* Drill-down */
.rap-drill { margin-bottom: 16px; }
.rap-drill-controls { display: flex; gap: 8px; align-items: center; }
.rap-select {
    padding: 6px 28px 6px 10px; font-size: 12px; font-weight: 600; font-family: inherit;
    border: 1.5px solid #e2e8f0; border-radius: 8px; background: #fff; color: #1e293b;
    cursor: pointer; outline: none; transition: all 0.15s;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
}
.rap-select:hover { border-color: #cbd5e1; }
.rap-select:focus { border-color: #14b8a6; box-shadow: 0 0 0 3px rgba(20,184,166,0.12); }

.rap-drill-table { margin-top: 4px; }
.rap-drill-head-row {
    display: grid; grid-template-columns: 1fr 60px 120px 1fr;
    gap: 8px; padding: 8px 12px; border-bottom: 2px solid #e2e8f0;
}
.rap-drill-th { font-size: 10px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.05em; }
.rap-drill-th--r { text-align: right; }
.rap-drill-th--bar {}

.rap-drill-row {
    display: grid; grid-template-columns: 1fr 60px 120px 1fr;
    gap: 8px; padding: 8px 12px; border-bottom: 1px solid #f1f5f9;
    transition: background 0.15s; animation: rapSlide 0.25s ease-out both;
}
.rap-drill-row:hover { background: #f8fafc; }

.rap-drill-td { font-size: 13px; color: #475569; display: flex; align-items: center; }
.rap-drill-td--label { font-weight: 600; color: #1e293b; }
.rap-drill-td--r { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.rap-drill-td--val { font-weight: 800; color: #0f766e; font-size: 13px; }
.rap-drill-td--bold { font-weight: 800; }
.rap-drill-td--bar { padding: 0 4px; }

.rap-drill-bar { height: 6px; background: #f1f5f9; border-radius: 6px; overflow: hidden; width: 100%; }
.rap-drill-bar-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #14b8a6, #0d9488); transition: width 0.5s ease-out; }

.rap-drill-footer {
    display: grid; grid-template-columns: 1fr 60px 120px 1fr;
    gap: 8px; padding: 10px 12px; border-top: 2px solid #e2e8f0;
    background: #f8fafc; border-radius: 0 0 8px 8px;
}
.rap-drill-footer .rap-drill-td { font-size: 13px; }
.rap-drill-footer .rap-drill-td--val { color: #0f172a; font-size: 14px; }

/* Animations */
@keyframes rapBarIn { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes rapSlide { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }

/* Responsive */
@media (max-width: 900px) { .rap-grid--3 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .rap-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .rap-grid { grid-template-columns: 1fr; }
    .rap-summary { flex-direction: column; gap: 12px; }
    .rap-summary-sep { width: 60px; height: 1px; }
    .rap-aging { grid-template-columns: repeat(2, 1fr); }
    .rap-drill-controls { flex-wrap: wrap; }
    .rap-drill-head-row, .rap-drill-row, .rap-drill-footer { grid-template-columns: 1fr 50px 100px 80px; }
}
@media print { .rap-print-btn { display: none; } .rap-kpi:hover, .rap-card:hover { transform: none; box-shadow: none; } }