/* =========================================================================
   Beheer › Omzet per vestiging (design 12-beheer-omzet) and Historische omzet. Tokens: app.css :root.
   ========================================================================= */

.tbm-revenue__swatch {
    display: inline-block;
    flex: none;
    width: 12px;
    height: 12px;
    margin-right: 8px;
    border-radius: 2px;
    vertical-align: -1px;
}

.tbm-revenue__step {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 44px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-input);
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.4rem;
    cursor: pointer;
}

.tbm-revenue__step:disabled {
    opacity: 0.35;
    cursor: default;
}

/* ---- Historische omzet ---------------------------------------------- */

.tbm-history,
.tbm-history-import {
    margin-bottom: 20px;
}

.tbm-history__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.tbm-history__year {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tbm-history__year .tbm-panel__title {
    margin: 0;
    min-width: 64px;
    text-align: center;
}

.tbm-history__first {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.tbm-history__subhead th {
    padding-top: 0;
    font-size: 0.8rem;
}

.tbm-history__table td {
    vertical-align: top;
}

.tbm-history__table .tbm-input {
    min-height: 38px;
    padding: 0 10px;
    font-size: 1.05rem;
}

.tbm-history__amount {
    min-width: 120px;
}

.tbm-history__credits {
    max-width: 80px;
}

.tbm-history__table .tbm-input:disabled {
    opacity: 0.35;
}

.tbm-history__warning {
    display: block;
    margin-top: 4px;
    color: var(--tbm-warning);
    font-size: 0.9rem;
}

.tbm-history__cell--overlap .tbm-input {
    border-color: rgba(252, 211, 77, 0.45);
    text-decoration: line-through;
}

.tbm-history-import__example {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: var(--tbm-radius);
    background: var(--tbm-input);
    color: var(--tbm-text-secondary);
    font-size: 0.95rem;
    white-space: pre;
    overflow-x: auto;
}

.tbm-history-import__input {
    display: grid;
    gap: 10px;
}

.tbm-history-import__text {
    min-height: 120px;
    padding: 10px 14px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 0.95rem;
}

.tbm-history-import__actions {
    display: flex;
    gap: 10px;
    margin: 12px 0;
}

.tbm-history-import__errors {
    color: var(--tbm-error);
}

.tbm-history-import__warnings {
    color: var(--tbm-warning);
}

/* ---- Omzet per vestiging: header and filters --------------------------- */

.tbm-revenue__period {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    color: var(--tbm-text-secondary);
    font-size: 1.1rem;
    line-height: 1.3;
}

.tbm-revenue__period small {
    font-size: 1.05rem;
}

.tbm-revenue__export {
    min-height: 52px;
    padding: 0 22px;
}

.tbm-revenue-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 16px 18px;
    margin-bottom: 16px;
    padding: 18px 24px;
}

.tbm-revenue-filters__field {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
}

.tbm-revenue-filters__label {
    font-size: 1.1rem;
    font-weight: 700;
}

.tbm-revenue-filters__dates {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.tbm-revenue-filters__dates .tbm-revenue__step {
    width: 28px;
}

.tbm-revenue-filters__date {
    display: flex;
    align-items: center;
    width: 142px;
    min-height: 44px;
    font-size: 1.15rem;
}

.tbm-revenue-filters__date--fixed {
    background: var(--tbm-bg);
}

.tbm-revenue-filters__error {
    flex-basis: 100%;
    margin: 0;
}

.tbm-revenue-seg {
    display: inline-flex;
    gap: 2px;
    padding: 4px;
    border-radius: var(--tbm-radius);
    background: var(--tbm-input);
}

.tbm-revenue-seg__item {
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.15rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.tbm-revenue-seg__item:hover:not(.tbm-revenue-seg__item--active) {
    background: rgba(var(--tbm-overlay), 0.05);
}

.tbm-revenue-seg__item--active {
    background: var(--tbm-text);
    color: var(--tbm-bg);
    font-weight: 700;
}

.tbm-revenue--loading {
    opacity: 0.55;
    transition: opacity 0.15s;
}

@media (max-width: 767.98px) {
    .tbm-revenue__period {
        align-items: flex-start;
    }

    .tbm-revenue-filters__dates {
        flex-wrap: wrap;
    }

    .tbm-revenue-filters__date {
        width: 150px;
    }

    .tbm-revenue-seg {
        flex-wrap: wrap;
    }
}

/* ---- KPI row ------------------------------------------------------------ */

.tbm-revenue-kpis {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) repeat(var(--tbm-kpi-locations, 3), minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.tbm-revenue-kpi {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 20px 24px;
    border: 1px solid var(--tbm-border);
    border-radius: var(--tbm-radius);
    background: var(--tbm-card);
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    text-align: left;
}

.tbm-revenue-kpi--location {
    border-top: 4px solid var(--tbm-location);
    padding-top: 17px;
    cursor: pointer;
    transition: opacity 0.15s, box-shadow 0.15s;
}

.tbm-revenue-kpi--location:hover,
.tbm-revenue-kpi--location:focus-visible {
    box-shadow: inset 0 0 0 1px var(--tbm-location);
    outline: none;
}

.tbm-revenue-kpi--selected {
    box-shadow: inset 0 0 0 2px var(--tbm-location);
}

.tbm-revenue-kpi--dimmed {
    opacity: 0.5;
}

.tbm-revenue-kpi__label {
    color: var(--tbm-text-secondary);
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.tbm-revenue-kpi__total {
    font-size: 3.6rem;
    font-weight: 700;
    line-height: 1;
}

.tbm-revenue-kpi__name {
    display: flex;
    align-items: center;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tbm-revenue-kpi__name .tbm-revenue__swatch {
    width: 16px;
    height: 16px;
    margin-right: 12px;
}

.tbm-revenue-kpi__value {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.05;
}

.tbm-revenue-kpi__meta {
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
    line-height: 1.6;
}

.tbm-revenue-change {
    font-size: 1.15rem;
}

.tbm-revenue-change__value {
    font-weight: 700;
}

.tbm-revenue-change--up .tbm-revenue-change__value {
    color: var(--tbm-success);
}

.tbm-revenue-change--down .tbm-revenue-change__value {
    color: var(--tbm-error);
}

.tbm-revenue-change__base,
.tbm-revenue-change--none {
    color: var(--tbm-text-secondary);
}

.tbm-revenue__history-link {
    color: var(--tbm-pink-accent);
    font-size: 1.1rem;
    font-weight: 600;
}

@media (max-width: 1023.98px) {
    .tbm-revenue-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 599.98px) {
    .tbm-revenue-kpis {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* ---- Chart ------------------------------------------------------------- */

.tbm-revenue-chart {
    margin-bottom: 18px;
    padding: 24px 24px 16px;
}

.tbm-revenue-chart__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 24px;
    margin-bottom: 12px;
}

.tbm-revenue-chart__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tbm-revenue-chart__title .tbm-panel__title {
    margin: 0;
    font-size: 1.75rem;
}

.tbm-revenue-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius-pill);
    background: var(--tbm-input);
    color: var(--tbm-text);
    font-family: var(--tbm-font);
    font-size: 1.05rem;
    font-weight: 600;
}

.tbm-revenue-chip--action {
    cursor: pointer;
}

.tbm-revenue-chip--action:hover {
    background: var(--tbm-text);
    color: var(--tbm-bg);
}

.tbm-revenue-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 22px;
    margin: 0;
    padding: 0;
    color: var(--tbm-text-secondary);
    font-size: 1.1rem;
    list-style: none;
}

.tbm-revenue-legend li {
    display: inline-flex;
    align-items: center;
}

.tbm-revenue-legend .tbm-revenue__swatch {
    width: 18px;
    height: 12px;
}

.tbm-revenue__swatch--light {
    border: 1.5px solid var(--tbm-text-secondary);
    background: rgba(163, 163, 180, 0.28);
}

.tbm-revenue-chart__plot {
    position: relative;
    width: 100%;
    aspect-ratio: 1000 / 340;
}

.tbm-revenue-chart__svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.tbm-revenue-chart__grid {
    stroke: rgba(var(--tbm-overlay), 0.07);
    stroke-width: 1;
}

.tbm-revenue-chart__axis {
    stroke: rgba(var(--tbm-overlay), 0.22);
    stroke-width: 1;
}

.tbm-revenue-chart__bar {
    cursor: default;
    outline: none;
}

.tbm-revenue-chart__bar--comparison {
    stroke-width: 1.5;
}

.tbm-revenue-chart__bar:hover,
.tbm-revenue-chart__bar:focus-visible {
    filter: brightness(1.2);
}

.tbm-revenue-chart__na {
    fill: var(--tbm-text-secondary);
    font-family: var(--tbm-font);
    font-size: 13px;
}

.tbm-revenue-chart__ylabels span,
.tbm-revenue-chart__xlabels span {
    position: absolute;
    color: var(--tbm-text-secondary);
    font-size: 1.05rem;
    line-height: 1;
    white-space: nowrap;
}

.tbm-revenue-chart__ylabels span {
    left: 0;
    transform: translateY(-50%);
}

.tbm-revenue-chart__xlabels span {
    bottom: 0;
    transform: translateX(-50%);
    font-size: 1.2rem;
}

.tbm-revenue-chart__note {
    margin: 8px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 1rem;
}

.tbm-revenue-tooltip {
    position: absolute;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 170px;
    padding: 10px 12px;
    border: 1px solid var(--tbm-border-strong);
    border-radius: var(--tbm-radius);
    background: var(--tbm-input-raised);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    font-size: 1.05rem;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 10px));
}

.tbm-revenue-tooltip strong {
    display: flex;
    align-items: center;
}

.tbm-revenue-tooltip__up {
    color: var(--tbm-success);
}

.tbm-revenue-tooltip__down {
    color: var(--tbm-error);
}

.tbm-revenue-chart__na-labels span {
    position: absolute;
    color: var(--tbm-text-secondary);
    font-size: 0.85rem;
    transform: translate(-50%, -130%) rotate(-90deg);
    transform-origin: center;
    white-space: nowrap;
}

/* ---- Table ------------------------------------------------------------- */

.tbm-revenue-table {
    margin-bottom: 18px;
    padding: 20px 24px 16px;
}

.tbm-revenue-table .tbm-table th[scope=col] {
    padding: 12px 12px 16px 0;
    font-size: 1.05rem;
}

.tbm-revenue-table .tbm-table th[scope=row],
.tbm-revenue-trainers .tbm-table th[scope=row] {
    color: var(--tbm-text);
    letter-spacing: normal;
    text-transform: none;
    white-space: normal;
}

.tbm-revenue-table .tbm-table th[scope=row] {
    display: flex;
    align-items: center;
    font-weight: 500;
    text-align: left;
}

.tbm-revenue-table .tbm-table td,
.tbm-revenue-table .tbm-table th[scope=row] {
    padding: 18px 12px 18px 0;
    font-size: 1.3rem;
}

.tbm-revenue-table__muted {
    color: var(--tbm-text-secondary);
}

.tbm-revenue-table__difference {
    font-weight: 700;
}

.tbm-revenue-table__difference--up {
    color: var(--tbm-success);
}

.tbm-revenue-table__difference--down {
    color: var(--tbm-error);
}

.tbm-revenue-table .tbm-revenue-table__total th[scope=row],
.tbm-revenue-table .tbm-revenue-table__total td {
    border-bottom: 0;
    font-weight: 700;
}

.tbm-revenue-table .tbm-revenue-table__total th[scope=row] {
    padding-left: 20px;
}

/* ---- Info lines and trainers ------------------------------------------- */

.tbm-revenue-info {
    display: grid;
    gap: 4px;
    margin: 14px 0 4px;
    padding: 14px 0 0;
    border-top: 1px solid var(--tbm-border);
    color: var(--tbm-text-secondary);
    font-size: 1.1rem;
    list-style: none;
}

.tbm-revenue-info__forecast {
    color: #7D7D8C;
    font-style: italic;
}

.tbm-revenue-info__warning {
    color: var(--tbm-warning);
}

.tbm-revenue-trainers {
    margin-bottom: 18px;
    padding: 18px 24px;
}

.tbm-revenue-trainers summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
}

.tbm-revenue-trainers summary::-webkit-details-marker {
    display: none;
}

.tbm-revenue-trainers summary::before {
    content: "›";
    display: inline-block;
    width: 14px;
    color: var(--tbm-text-secondary);
    font-size: 1.6rem;
    transition: transform 0.15s;
}

.tbm-revenue-trainers[open] summary::before {
    transform: rotate(90deg);
}

.tbm-revenue-trainers summary .tbm-panel__title {
    margin: 0;
}

.tbm-revenue-trainers[open] summary {
    margin-bottom: 12px;
}

.tbm-revenue-trainers .tbm-table th[scope=row] {
    padding: 12px 12px 12px 0;
    border-bottom: 1px solid var(--tbm-border);
    font-size: 1.15rem;
    font-weight: 600;
    text-align: left;
}

.tbm-revenue-trainers__note {
    margin: 10px 0 0;
    font-size: 1rem;
}

.tbm-revenue-table__footnote {
    margin: 8px 0 0;
    color: var(--tbm-text-secondary);
    font-size: 1rem;
}

.tbm-history-import code {
    font-size: 0.95rem;
}
