/* =============================================================================
   DASHBOARD page header (dbh-*) — title, segmented tabs and actions on one row,
   plus the company scope. Scope is neutral for "All companies" and switches to
   amber when a company is picked in the top bar, so a filtered view can never
   be mistaken for the whole estate. Two placements are under evaluation
   (Overview dock / ?scope=strip|title): a slim strip under the header, or part
   of the page title. The tabs reuse .dbx-tab-btn so routing in dashboard.js
   keeps working. Colours come from --theme-* tokens.
   ============================================================================= */

body[data-page="dashboard"] .page-content { padding-top: 14px; }
.dbx-container.dbx-container--tight { padding-top: 6px; }

.dbh {
    --scope: var(--theme-warning);
    --scope-ink: var(--theme-warning-light);
    color: var(--theme-text-primary);
    margin-bottom: 18px;
}
[data-theme="light"] .dbh { --scope-ink: var(--theme-warning-dark); }

.dbh-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px 20px; padding-top: 2px; }

/* title */
.dbh-title { display: flex; align-items: center; gap: 11px; min-width: 0; }
.dbh-icon { width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; background: var(--theme-bg-subtle); border: 1px solid var(--theme-border-subtle); }
.dbh-icon img { width: 18px; height: 18px; }
.dbh-title h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.2px; line-height: 1.2; color: var(--theme-text-primary); white-space: nowrap; }

/* tabs: neutral segmented control, the active tab is a raised card */
.dbh-tabs { justify-self: start; display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: var(--theme-bg-subtle); border: 1px solid var(--theme-border-subtle); }
.dbh .dbx-tab-btn { padding: 7px 13px; border-radius: 7px; font-size: 13px; box-shadow: none; }
.dbh .dbx-tab-btn i { color: var(--theme-text-muted); transition: color .15s ease; }
.dbh .dbx-tab-btn:hover { background: var(--theme-bg-subtle-hover); color: var(--theme-text-primary); }
.dbh .dbx-tab-btn.active,
.dbh .dbx-tab-btn.active:hover { background: var(--theme-bg-card-solid); color: var(--theme-text-primary); box-shadow: var(--theme-shadow-sm), inset 0 0 0 1px var(--theme-border-color); }
.dbh .dbx-tab-btn.active i { color: var(--theme-text-link); }

/* actions */
.dbh-actions { display: flex; align-items: center; gap: 10px; }
.dbh .db-download-report-btn { height: 34px; padding: 0 6px 0 12px; background: var(--theme-bg-subtle); border: 1px solid var(--theme-border-color); box-shadow: none; }
.dbh .db-download-report-btn:hover { background: var(--theme-bg-subtle-hover); border-color: var(--theme-border-strong); box-shadow: none; }
.dbh .db-download-period { padding: 3px 8px; }

/* ------------------------------------------------ scope: strip under the header */
.dbh-strip { display: flex; align-items: center; gap: 10px; margin-top: 14px; min-height: 40px; padding: 5px 6px 5px 14px; border-radius: 10px; border: 1px solid var(--theme-border-subtle); background: var(--theme-bg-subtle); font-size: 13px; color: var(--theme-text-secondary); }
.dbh-strip > .fa { width: 14px; text-align: center; color: var(--theme-text-muted); }
.dbh-strip strong { color: var(--theme-text-primary); font-weight: 700; }
.dbh-strip em { font-style: normal; font-size: 12.5px; color: var(--theme-text-muted); }
.dbh-strip em::before { content: '·'; margin-right: 10px; }
.dbh-strip-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--theme-border-color); background: var(--theme-bg-card-solid); color: var(--theme-text-primary); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dbh-strip-btn .fa { color: var(--theme-text-muted); }
.dbh-strip-btn:hover { border-color: var(--theme-border-strong); }
.dbh-strip.is-filtered { background: color-mix(in srgb, var(--scope) 12%, transparent); border-color: color-mix(in srgb, var(--scope) 45%, transparent); box-shadow: inset 4px 0 0 var(--scope); }
.dbh-strip.is-filtered > .fa, .dbh-strip.is-filtered strong { color: var(--scope-ink); }
.dbh-strip.is-filtered span { color: var(--theme-text-primary); }
.dbh-strip.is-filtered .dbh-strip-btn { border-color: color-mix(in srgb, var(--scope) 55%, transparent); color: var(--scope-ink); background: transparent; }
.dbh-strip.is-filtered .dbh-strip-btn .fa { color: var(--scope-ink); }
.dbh-strip.is-filtered .dbh-strip-btn:hover { background: color-mix(in srgb, var(--scope) 14%, transparent); }

/* ------------------------------------------------ scope: part of the page title */
.dbh-slash { font-size: 20px; font-weight: 300; color: var(--theme-text-disabled); margin: 0 -2px; }
.dbh-tscope { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 11px; border-radius: 8px; border: 1px dashed var(--theme-border-strong); background: transparent; color: var(--theme-text-secondary); font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.dbh-tscope .fa { color: var(--theme-text-muted); }
.dbh-tscope:hover { color: var(--theme-text-primary); border-color: var(--theme-text-muted); }
.dbh-tscope.is-filtered { cursor: default; padding-right: 4px; border: 1px solid color-mix(in srgb, var(--scope) 55%, transparent); background: color-mix(in srgb, var(--scope) 14%, transparent); color: var(--scope-ink); font-weight: 700; }
.dbh-tscope.is-filtered .fa-filter { color: var(--scope-ink); }
.dbh-tscope button { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--scope-ink); cursor: pointer; }
.dbh-tscope button:hover { background: color-mix(in srgb, var(--scope) 20%, transparent); }

/* ------------------------------------------------ responsive (desktop first) */
@media (max-width: 1450px) {
    .dbh-row { grid-template-columns: auto minmax(0, 1fr); }
    .dbh-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .dbh-strip em { display: none; }
}
