/* ── Tabs and segmented control (revamp G8) ─────────────────────────────────
   Two components, nothing else:
   - .tabs > .tab   underline tabs for a page's sub-views (Costs: Waste /
                    Renewals / ...; Settings; Investigate lists; Stock regions).
   - .seg > .seg-btn  a segmented control for a 2-3 way toggle (Coverage /
                    All devices, General status / Per model, the theme).
   Selected state: .active (what app.js toggles), aria-selected="true" (role
   tab) or aria-pressed="true" (toggle buttons). Sentence case, sans, 13-14px. */

.tabs {
    display: flex;
    align-items: flex-end;
    gap: var(--sp-1);
    margin: 0 0 var(--sp-4);
    padding: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    position: relative;
    display: inline-flex; align-items: center; gap: var(--sp-2);
    height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font: inherit;
    font-family: var(--sans);
    font-size: var(--fs-14);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-2);
    white-space: nowrap;
    cursor: pointer;
    transition: color var(--dur-med) var(--ease-out);
}
.tab:hover { color: var(--text); background: transparent; }
.tab::after {
    content: '';
    position: absolute;
    left: 8px; right: 8px; bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform var(--dur-med) var(--ease-out);
}
.tab.active, .tab[aria-selected="true"] { color: var(--text); background: transparent; border-color: transparent; box-shadow: none; }
.tab.active::after, .tab[aria-selected="true"]::after { transform: scaleX(1); }
.tab .cnt {
    padding: 0 7px;
    border-radius: var(--radius-pill);
    font-size: var(--fs-12);
    line-height: 20px;
    color: var(--text-3);
    background: var(--sunken);
    font-variant-numeric: tabular-nums;
}
.tab.active .cnt, .tab[aria-selected="true"] .cnt { color: var(--accent-text); background: var(--accent-dim); }
.tab:focus-visible { outline-offset: -2px; border-radius: var(--radius-xs); }
/* display: inline-flex above beats the browser's [hidden] rule (the OS
   versions tvOS tab hides while no Apple TV is in the data). */
.tab[hidden] { display: none; }
.tabs-sm .tab { height: 34px; font-size: var(--fs-13); }

/* Segmented control. */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: var(--radius-sm);
    background: var(--sunken);
    box-shadow: inset 0 0 0 1px var(--border);
    flex: none;
    width: fit-content;
    align-self: flex-start;   /* never stretched by a flex-column parent */
}
.seg-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 28px;
    padding: 0 10px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    font: inherit;
    font-family: var(--sans);
    font-size: var(--fs-13);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-3);
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur-med) var(--ease-out), color var(--dur-med) var(--ease-out);
}
/* display: inline-flex above beats the browser's [hidden] rule: a hidden
   segment (the insight modal's "Open in Filters" on What changed) stayed
   on screen and took the dialog's first focus. */
.seg-btn[hidden] { display: none; }
.seg-btn:hover { color: var(--text); }
.seg-btn.active, .seg-btn[aria-pressed="true"], .seg-btn[aria-selected="true"] {
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-1), inset 0 0 0 1px var(--border);
}
.seg-sm .seg-btn { height: 24px; padding: 0 8px; font-size: var(--fs-12); }
/* Icon-only segments (the theme control in the top bar). */
.theme-seg.topbar-theme { border-radius: var(--radius-pill); }
.theme-seg.topbar-theme .seg-btn { width: 30px; height: 26px; padding: 0; border-radius: var(--radius-pill); }
.seg-btn:focus-visible { outline-offset: 0; }

/* A row that holds tabs on the left and actions on the right. */
.tabs-row { display: flex; align-items: flex-end; gap: var(--sp-3); border-bottom: 1px solid var(--border); margin-bottom: var(--sp-4); }
.tabs-row > .tabs { border-bottom: 0; margin-bottom: 0; flex: 1 1 auto; min-width: 0; }
.tabs-row > .tabs-actions { display: flex; align-items: center; gap: var(--sp-2); padding-bottom: 6px; flex-wrap: wrap; }

@media (pointer: coarse) {
    .tab { min-height: var(--touch-target); }
    .seg-btn { min-height: 36px; }
}
