/* Sirona Matrix Table (breakdown / cross-tab table) */

.smt {
    background: var(--bg-secondary, #ffffff);
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 0.5rem;
    box-shadow: var(--shadow-sm);
    height: 100% !important;
    overflow: hidden;
}

.smt__scroll {
    overflow-x: auto;
    max-width: 100%;
}

.smt__table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ─── Header row / corner cell ────────────────────────────────────────────── */

.smt__corner,
.smt__col-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--blueteq-blue, #186FB5);
    color: #ffffff;
    font-weight: 700;
    padding: 0.5rem 0.75rem;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.smt__corner {
    left: 0;
    z-index: 3;
}

/* ─── Row label (sticky left) ─────────────────────────────────────────────── */

.smt__label {
    position: sticky;
    left: 0;
    z-index: 1;
    background: inherit;
    color: var(--text-primary, #1f2937);
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background-color: var(--bg-primary);
}

/* ─── Data cells ───────────────────────────────────────────────────────────── */

.smt__cell {
    padding: 0.4rem 0.75rem;
    text-align: right;
    color: var(--text-primary, #1f2937);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.smt__cell--highlight {
    background: #d9bd8c !important;
}

/* ─── Row types ────────────────────────────────────────────────────────────── */

.smt__row--header,
.smt__row--total {
    font-weight: 700;
    background: var(--bg-primary);
}

.smt__row--header .smt__label {
    font-weight: bolder;
}

.smt__row--header td {
    background: var(--bg-primary);
}

.smt__row--spacer td {
    border: none;
    padding: 0;
    height: 0.5rem;
    background: transparent;
}

/* ─── Dark mode ───────────────────────────────────────────────────────────── */

[data-theme="dark"] .smt {
    background: var(--bg-secondary, #1e293b);
    border-color: var(--border-color, rgba(255, 255, 255, 0.1));
}

[data-theme="dark"] .smt__corner,
[data-theme="dark"] .smt__col-header {
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .smt__label,
[data-theme="dark"] .smt__cell {
    color: var(--text-primary, #f1f5f9);
    border-color: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .smt__row--header,
[data-theme="dark"] .smt__row--total {
    background: #334155;
}

[data-theme="dark"] .smt__cell--highlight {
    background: #8a6a34 !important;
}

/* ─── High contrast ───────────────────────────────────────────────────────── */

[data-theme="high-contrast"] .smt {
    background: #000000;
    border: 2px solid #ffffff;
    border-radius: 0;
}

[data-theme="high-contrast"] .smt__corner,
[data-theme="high-contrast"] .smt__col-header {
    border: 2px solid #ffffff;
}

[data-theme="high-contrast"] .smt__label,
[data-theme="high-contrast"] .smt__cell {
    color: #ffffff;
    border: 1px solid #ffffff;
}

[data-theme="high-contrast"] .smt__row--header,
[data-theme="high-contrast"] .smt__row--total {
    background: #1a1a1a;
}

[data-theme="high-contrast"] .smt__cell--highlight {
    background: #0066ff !important;
    color: #ffffff;
}
