/* Executive multi-case analytics dashboard — RTL */

.case-dash {
    --cd-navy: #0f2744;
    --cd-navy-soft: #1a3a5c;
    --cd-navy-muted: #3d5a7a;
    --cd-bg: #f3f5f8;
    --cd-surface: #ffffff;
    --cd-border: #d5dee8;
    --cd-text: #1c2430;
    --cd-muted: #5c6b7a;
    --cd-critical: #b42318;
    --cd-warning: #b54708;
    --cd-success: #027a48;
    --cd-info: #175cd3;
    --cd-attention: #6941c6;
    --cd-bar: #1a3a5c;
    --cd-bar-alt: #3d6b9a;
    --cd-radius: 12px;
    --cd-shadow: 0 1px 2px rgba(15, 39, 68, 0.05), 0 8px 20px rgba(15, 39, 68, 0.05);
    direction: rtl;
    color: var(--cd-text);
    background: linear-gradient(180deg, #e8eef5 0%, var(--cd-bg) 180px);
    padding: 16px 16px 24px;
    border-radius: 14px;
    min-height: 100%;
    box-sizing: border-box;
}

.case-dash *,
.case-dash *::before,
.case-dash *::after {
    box-sizing: border-box;
}

.case-dash--present .case-dash-filters,
.case-dash--present .case-dash-limitations,
.case-dash--present .case-dash-rules {
    display: none;
}

.case-dash-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    align-items: flex-start;
}

.case-dash-header__eyebrow {
    font-size: 0.78rem;
    color: var(--cd-navy-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.case-dash-header__title {
    margin: 0;
    font-size: 1.45rem;
    color: var(--cd-navy);
    font-weight: 700;
}

.case-dash-header__meta {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--cd-muted);
}

.case-dash-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.case-dash-btn {
    appearance: none;
    border: 1px solid var(--cd-border);
    background: var(--cd-surface);
    color: var(--cd-navy);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.case-dash-btn:hover {
    border-color: var(--cd-navy-muted);
}

.case-dash-btn--primary {
    background: var(--cd-navy);
    border-color: var(--cd-navy);
    color: #fff;
}

.case-dash-btn--ghost.is-active {
    background: #e8eef6;
    border-color: #b7c7db;
}

.case-dash-filters {
    background: var(--cd-surface);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    box-shadow: var(--cd-shadow);
}

.case-dash-filters__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px 14px;
}

.case-dash-field label {
    display: block;
    font-size: 0.78rem;
    color: var(--cd-muted);
    margin-bottom: 4px;
    font-weight: 600;
}

.case-dash-filters__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.case-dash-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.case-dash-kpi {
    background: var(--cd-surface);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 12px 14px;
    box-shadow: var(--cd-shadow);
    border-top: 3px solid var(--cd-navy-muted);
    min-height: 108px;
}

.case-dash-kpi--success { border-top-color: var(--cd-success); }
.case-dash-kpi--warning { border-top-color: var(--cd-warning); }
.case-dash-kpi--critical { border-top-color: var(--cd-critical); }
.case-dash-kpi--info { border-top-color: var(--cd-info); }
.case-dash-kpi--attention { border-top-color: var(--cd-attention); }

.case-dash-kpi__label {
    display: block;
    font-size: 0.78rem;
    color: var(--cd-muted);
    font-weight: 600;
    margin-bottom: 6px;
}

.case-dash-kpi__value {
    display: block;
    font-size: 1.2rem;
    color: var(--cd-navy);
    font-weight: 700;
    line-height: 1.3;
}

.case-dash-kpi__hint,
.case-dash-kpi__change {
    display: block;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--cd-muted);
    line-height: 1.4;
}

.case-dash-kpi__change {
    color: var(--cd-navy-muted);
    font-weight: 600;
}

.case-dash-section {
    background: var(--cd-surface);
    border: 1px solid var(--cd-border);
    border-radius: var(--cd-radius);
    padding: 14px 16px;
    margin-bottom: 14px;
    box-shadow: var(--cd-shadow);
}

.case-dash-section__title {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--cd-navy);
    font-weight: 700;
}

.case-dash-section__sub {
    margin: 0 0 12px;
    font-size: 0.78rem;
    color: var(--cd-muted);
}

.case-dash-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.case-dash-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-dash-bar-row {
    display: grid;
    grid-template-columns: minmax(100px, 28%) 1fr auto;
    gap: 8px;
    align-items: center;
    font-size: 0.78rem;
}

.case-dash-bar-row__name {
    color: var(--cd-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.case-dash-bar-row__track {
    height: 10px;
    background: #e8eef5;
    border-radius: 999px;
    overflow: hidden;
}

.case-dash-bar-row__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--cd-bar), var(--cd-bar-alt));
    border-radius: 999px;
    min-width: 2px;
}

.case-dash-bar-row__value {
    color: var(--cd-navy-muted);
    font-weight: 600;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.case-dash-insights {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.case-dash-insight {
    border: 1px solid var(--cd-border);
    border-radius: 10px;
    padding: 10px 12px;
    background: #f8fafc;
    border-right: 4px solid var(--cd-info);
}

.case-dash-insight--warning { border-right-color: var(--cd-warning); }
.case-dash-insight--critical { border-right-color: var(--cd-critical); }
.case-dash-insight--success { border-right-color: var(--cd-success); }
.case-dash-insight--attention { border-right-color: var(--cd-attention); }

.case-dash-insight strong {
    display: block;
    margin-bottom: 4px;
    color: var(--cd-navy);
    font-size: 0.86rem;
}

.case-dash-insight span {
    font-size: 0.8rem;
    color: var(--cd-muted);
    line-height: 1.5;
}

.case-dash-table-wrap {
    overflow-x: auto;
}

.case-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.case-dash-table th,
.case-dash-table td {
    border-bottom: 1px solid var(--cd-border);
    padding: 8px 10px;
    text-align: right;
    white-space: nowrap;
}

.case-dash-table th {
    color: var(--cd-navy-muted);
    font-weight: 700;
    background: #f5f8fb;
    position: sticky;
    top: 0;
}

.case-dash-table tr:hover td {
    background: #f8fafc;
}

.case-dash-empty,
.case-dash-loading,
.case-dash-error {
    padding: 28px 16px;
    text-align: center;
    color: var(--cd-muted);
    background: var(--cd-surface);
    border: 1px dashed var(--cd-border);
    border-radius: var(--cd-radius);
    margin-bottom: 14px;
}

.case-dash-error {
    color: var(--cd-critical);
    border-style: solid;
}

.case-dash-limitations ul,
.case-dash-rules {
    margin: 0;
    padding-right: 18px;
    font-size: 0.78rem;
    color: var(--cd-muted);
    line-height: 1.7;
}

.case-dash-trend {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    padding-top: 8px;
}

.case-dash-trend__col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
    height: 100%;
    justify-content: flex-end;
}

.case-dash-trend__bar {
    width: 70%;
    max-width: 28px;
    background: linear-gradient(180deg, var(--cd-bar-alt), var(--cd-bar));
    border-radius: 4px 4px 0 0;
    min-height: 2px;
}

.case-dash-trend__label {
    font-size: 0.65rem;
    color: var(--cd-muted);
    writing-mode: horizontal-tb;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    white-space: nowrap;
}

.case-dash-linkish {
    background: none;
    border: none;
    color: var(--cd-info);
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-size: inherit;
}

@media (max-width: 768px) {
    .case-dash {
        padding: 10px;
    }

    .case-dash-bar-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .case-dash-header__title {
        font-size: 1.2rem;
    }
}

@media print {
    .case-dash-filters,
    .case-dash-actions {
        display: none !important;
    }

    .case-dash {
        background: #fff;
        box-shadow: none;
    }

    .case-dash-section,
    .case-dash-kpi {
        box-shadow: none;
        break-inside: avoid;
    }
}
