/* Dashboard KPI-Strip (#182) — additive, Twig+CSS.
 * Container Queries + CSS-Grid-Fallback. View Transitions nur hinter @supports.
 * Keine neuen Aggregationen — nur Layout für vorhandene Zahlen. */

.kpi-strip {
    --kpi-gap: 0.75rem;
    --kpi-radius: 24px;
    --kpi-pad: 0.875rem 1rem;
    --kpi-label: 0.6875rem;
    --kpi-value: 1.75rem;
    --kpi-hint: 0.6875rem;
    --kpi-min-touch: 2.75rem; /* 44px */
    container-type: inline-size;
    container-name: kpi-strip;
    margin-bottom: 1.5rem;
}

.kpi-strip__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--kpi-gap);
}

.kpi-strip__tile {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: var(--kpi-min-touch);
    min-width: 0;
    padding: var(--kpi-pad);
    border-radius: var(--kpi-radius);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.65));
    background: var(--glass, rgba(255, 255, 255, 0.55));
    backdrop-filter: blur(16px) saturate(1.35);
    box-shadow: var(--shadow, 0 20px 60px rgba(19, 78, 74, 0.12));
    text-decoration: none;
    color: inherit;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.kpi-strip__tile:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 24px -6px rgb(15 118 110 / 0.18), 0 2px 8px -2px rgb(0 0 0 / 0.05);
}

.kpi-strip__tile:focus-visible {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

.kpi-strip__tile--accent {
    border-color: transparent;
    background: linear-gradient(145deg, #0d9488 0%, #115e59 100%);
    color: #fff;
    box-shadow: 0 4px 24px -6px rgb(15 118 110 / 0.28);
}

.kpi-strip__tile--accent:hover {
    box-shadow: 0 6px 28px -6px rgb(15 118 110 / 0.36);
}

.kpi-strip__tile--wide {
    display: none;
}

.kpi-strip__label {
    display: block;
    font-size: var(--kpi-label);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--zinc-500, #71717a);
    line-height: 1.25;
}

.kpi-strip__tile--accent .kpi-strip__label {
    color: rgb(204 251 241 / 0.92); /* primary-100 */
}

.kpi-strip__value {
    margin-top: 0.35rem;
    font-family: "Fraunces", Georgia, serif;
    font-size: var(--kpi-value);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    color: var(--teal-ink, #134e4a);
}

.kpi-strip__tile--accent .kpi-strip__value {
    color: #fff;
}

.kpi-strip__hint {
    margin-top: 0.2rem;
    font-size: var(--kpi-hint);
    color: #a1a1aa; /* zinc-400 */
    line-height: 1.3;
}

.kpi-strip__tile--accent .kpi-strip__hint {
    color: rgb(204 251 241 / 0.75);
}

.kpi-strip__meta {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    min-width: 0;
}

.kpi-strip__denom {
    font-size: 0.8125rem;
    color: #a1a1aa;
    font-variant-numeric: tabular-nums;
}

.kpi-strip__tile--accent .kpi-strip__denom {
    color: rgb(204 251 241 / 0.7);
}

/* Desktop: bis 6 Tiles. Container Query zuerst, Media als Fallback. */
@container kpi-strip (min-width: 36rem) {
    .kpi-strip__grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .kpi-strip__value {
        font-size: 1.875rem;
    }
}

@container kpi-strip (min-width: 42rem) {
    .kpi-strip__grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .kpi-strip__tile--wide {
        display: flex;
    }
}

@supports not (container-type: inline-size) {
    @media (min-width: 640px) {
        .kpi-strip__grid {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .kpi-strip__value {
            font-size: 1.875rem;
        }
    }

    @media (min-width: 1024px) {
        .kpi-strip__grid {
            grid-template-columns: repeat(6, minmax(0, 1fr));
        }

        .kpi-strip__tile--wide {
            display: flex;
        }
    }
}

@supports (view-transition-name: none) {
    .kpi-strip {
        view-transition-name: dashboard-kpi-strip;
    }
}

@media (prefers-reduced-motion: reduce) {
    .kpi-strip__tile {
        transition: none;
    }

    .kpi-strip__tile:hover {
        transform: none;
    }
}

[data-theme="dark"] .kpi-strip__tile {
    border-color: #27272a; /* zinc-800 */
    background: #18181b; /* zinc-900 */
}

[data-theme="dark"] .kpi-strip__label {
    color: #a1a1aa;
}

[data-theme="dark"] .kpi-strip__value {
    color: #fafafa;
}

[data-theme="dark"] .kpi-strip__hint,
[data-theme="dark"] .kpi-strip__denom {
    color: #71717a;
}

[data-theme="dark"] .kpi-strip__tile--accent {
    border-color: transparent;
    background: linear-gradient(145deg, #0f766e 0%, #042f2e 100%);
    color: #fff;
}

[data-theme="dark"] .kpi-strip__tile--accent .kpi-strip__label,
[data-theme="dark"] .kpi-strip__tile--accent .kpi-strip__hint,
[data-theme="dark"] .kpi-strip__tile--accent .kpi-strip__denom {
    color: rgb(204 251 241 / 0.8);
}

[data-theme="dark"] .kpi-strip__tile--accent .kpi-strip__value {
    color: #fff;
}
