/* ============================================================================
   HSE Domain — base stylesheet (shared shell + shared components)
   ----------------------------------------------------------------------------
   Tokens only (--atlas-* / --atlas-hse-*). No hardcoded colors. Owned by F0 —
   F1 module agents add their own rules to css/pages/hse/<module>.css, NOT here.
   Class prefix: .hse-*
   ========================================================================= */

/* ── Page shell ─────────────────────────────────────────────────────────── */
.hse-page {
    background: var(--atlas-hse-bg);
    min-height: 100%;
    padding: var(--atlas-space-6);
    font-family: var(--atlas-font-sans);
    color: var(--atlas-text);
}
.hse-page .hse-row-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: var(--atlas-space-4); flex-wrap: wrap; margin-bottom: var(--atlas-space-5);
}
.hse-title {
    font-size: 1.35rem; font-weight: 700; color: var(--atlas-text); line-height: 1.2;
}
.hse-sub { font-size: .85rem; color: var(--atlas-hse-muted); margin-top: var(--atlas-space-1); }
.hse-head-actions { display: flex; align-items: center; gap: var(--atlas-space-2); flex-wrap: wrap; }

/* Banner (module launcher header), colored left border per module via --hse-accent */
.hse-banner {
    background: var(--atlas-surface); padding: var(--atlas-space-4) var(--atlas-space-6);
    border-radius: var(--atlas-radius-2xl); box-shadow: var(--atlas-shadow-1);
    display: flex; align-items: center; justify-content: space-between; gap: var(--atlas-space-4);
    flex-wrap: wrap; margin-bottom: var(--atlas-space-5);
    border-left: 5px solid var(--hse-accent, var(--atlas-hse-accent));
}
.hse-banner-title { font-size: 1.3rem; font-weight: 700; color: var(--atlas-text); }
.hse-banner-sub   { font-size: .85rem; color: var(--atlas-hse-muted); margin-top: var(--atlas-space-1); }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.hse-card {
    background: var(--atlas-surface); border: 1px solid var(--atlas-hse-line);
    border-radius: var(--atlas-radius-xl); box-shadow: var(--atlas-shadow-1);
    padding: var(--atlas-space-5);
}
.hse-card-title { font-weight: 700; color: var(--atlas-text); font-size: .98rem; }
.hse-card-head  { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--atlas-space-4); gap: var(--atlas-space-3); }

/* ── KPI card (HseKpiCard) ──────────────────────────────────────────────── */
.hse-kpi {
    background: var(--atlas-surface); border: 1px solid var(--atlas-hse-line);
    border-top: 3px solid var(--hse-kpi-accent, var(--atlas-hse-brand));
    border-radius: var(--atlas-radius-xl); box-shadow: var(--atlas-shadow-1);
    padding: var(--atlas-space-4) var(--atlas-space-5); height: 100%;
}
.hse-kpi.hse-kpi-bad { border: 1px solid var(--atlas-hse-no); border-top: 3px solid var(--atlas-hse-no); }
.hse-kpi-label { font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; color: var(--atlas-hse-muted); font-weight: 700; }
.hse-kpi-value { font-size: 1.9rem; font-weight: 700; line-height: 1.15; color: var(--hse-kpi-accent, var(--atlas-text)); margin-top: var(--atlas-space-1); }
.hse-kpi-sub   { font-size: .78rem; color: var(--atlas-hse-muted); margin-top: var(--atlas-space-1); }
.hse-kpi-accent-brand  { --hse-kpi-accent: var(--atlas-hse-brand); }
.hse-kpi-accent-accent { --hse-kpi-accent: var(--atlas-hse-accent); }
.hse-kpi-accent-ok     { --hse-kpi-accent: var(--atlas-hse-ok); }
.hse-kpi-accent-warn   { --hse-kpi-accent: var(--atlas-hse-warn); }
.hse-kpi-accent-no     { --hse-kpi-accent: var(--atlas-hse-no); }
.hse-kpi-accent-purple { --hse-kpi-accent: var(--atlas-hse-purple); }
.hse-kpi-accent-navy   { --hse-kpi-accent: var(--atlas-hse-navy); }
.hse-kpi-clickable { cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.hse-kpi-clickable:hover { box-shadow: var(--atlas-shadow-2); transform: translateY(-1px); }

/* ── Pill / badge (HsePill) ─────────────────────────────────────────────── */
.hse-pill {
    display: inline-flex; align-items: center; gap: .35em;
    font-size: .72rem; font-weight: 700; line-height: 1;
    padding: .32em .6em; border-radius: var(--atlas-radius-full); white-space: nowrap;
}
.hse-pill-ok    { background: var(--atlas-sev-ok-bg);      color: var(--atlas-sev-ok-text); }
.hse-pill-warn  { background: var(--atlas-sev-warn-bg);    color: var(--atlas-sev-warn-text); }
.hse-pill-no    { background: var(--atlas-sev-danger-bg);  color: var(--atlas-sev-danger-text); }
.hse-pill-muted { background: var(--atlas-surface-sunken); color: var(--atlas-text-secondary); }

/* ── Phase chip (HsePhaseChip) ──────────────────────────────────────────── */
.hse-phase-chip {
    display: inline-flex; align-items: center; font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em; padding: .28em .6em;
    border-radius: var(--atlas-radius-full);
    color: var(--hse-phase, var(--atlas-hse-accent));
    background: color-mix(in srgb, var(--hse-phase, var(--atlas-hse-accent)) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--hse-phase, var(--atlas-hse-accent)) 55%, transparent);
}
.hse-phase-field   { --hse-phase: var(--atlas-hse-ok); }
.hse-phase-restricted { --hse-phase: var(--atlas-hse-accent); }
.hse-phase-corporate { --hse-phase: var(--atlas-hse-warn); }
.hse-phase-smart   { --hse-phase: var(--atlas-hse-purple); }
.hse-phase-incident { --hse-phase: var(--atlas-hse-incident-red); }
.hse-phase-brand   { --hse-phase: var(--atlas-hse-brand); }

/* ── Section title (HseSectionTitle) ────────────────────────────────────── */
.hse-section-title {
    font-size: .82rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em; color: var(--atlas-text);
    margin: var(--atlas-space-6) 0 var(--atlas-space-3);
    display: flex; align-items: center; gap: var(--atlas-space-2);
}

/* ── Tile grid / tile (HseTileGrid + HseTile) ───────────────────────────── */
.hse-tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--atlas-space-3); }
.hse-tile {
    display: flex; align-items: center; gap: var(--atlas-space-3);
    background: var(--atlas-surface); border: 1px solid var(--atlas-hse-line);
    border-radius: var(--atlas-radius-lg); padding: var(--atlas-space-3) var(--atlas-space-4);
    text-decoration: none; color: var(--atlas-text); transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.hse-tile:hover { box-shadow: var(--atlas-shadow-2); transform: translateY(-1px); border-color: var(--atlas-hse-accent); color: var(--atlas-text); }
.hse-tile-icon {
    width: 36px; height: 36px; flex-shrink: 0; border-radius: var(--atlas-radius-md);
    display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
    background: var(--atlas-color-primary-soft); color: var(--atlas-hse-brand);
}
.hse-tile-label { font-weight: 600; font-size: .86rem; }
.hse-tile-tag { margin-left: auto; font-family: var(--atlas-font-mono); font-size: .66rem; color: var(--atlas-hse-muted); background: var(--atlas-surface-sunken); padding: .15em .4em; border-radius: var(--atlas-radius-xs); }

/* ── Alert box + AI panel (HseAlertBox / HseAiPanel) ────────────────────── */
.hse-alert-box {
    border-radius: var(--atlas-radius-lg); padding: var(--atlas-space-4);
    background: var(--atlas-hse-purple-soft); border: 1px solid color-mix(in srgb, var(--atlas-hse-purple) 40%, transparent);
    color: var(--atlas-text); display: flex; gap: var(--atlas-space-3);
}
.hse-alert-box .hse-alert-icon { color: var(--atlas-hse-purple); font-size: 1.2rem; flex-shrink: 0; }
.hse-ai-panel {
    border-radius: var(--atlas-radius-lg); padding: var(--atlas-space-4);
    background: linear-gradient(135deg, var(--atlas-hse-ok-soft), var(--atlas-surface));
    border: 1px solid color-mix(in srgb, var(--atlas-hse-ok) 35%, transparent);
}
.hse-ai-tag {
    display: inline-flex; align-items: center; font-size: .64rem; font-weight: 700; letter-spacing: .06em;
    color: var(--atlas-text-on-primary); background: var(--atlas-hse-ok);
    padding: .2em .5em; border-radius: var(--atlas-radius-xs); text-transform: uppercase;
}

/* ── Mobile phone frame (HseMobFrame) ───────────────────────────────────── */
.hse-mobframe-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--atlas-space-2); }
.hse-mobframe {
    width: 390px; max-width: 100%; background: var(--atlas-surface);
    border: 10px solid var(--atlas-hse-navy); border-radius: 32px;
    box-shadow: var(--atlas-shadow-3); overflow: hidden;
}
.hse-mobframe-body { padding: var(--atlas-space-4); display: flex; flex-direction: column; gap: var(--atlas-space-3); }
.hse-mobframe-note { font-size: .72rem; color: var(--atlas-hse-muted); font-style: italic; }
.hse-mob-card {
    background: var(--atlas-surface); border: 1px solid var(--atlas-hse-line);
    border-radius: var(--atlas-radius-md); padding: var(--atlas-space-3);
    display: flex; align-items: center; justify-content: space-between; gap: var(--atlas-space-2);
}

/* ── Chart card scaffolding ─────────────────────────────────────────────── */
.hse-chart { width: 100%; }
.hse-chart-ring { height: 150px; }
.hse-chart-donut { height: 240px; }
.hse-chart-bar { height: 240px; }
.hse-chart-heat { height: 240px; }
.hse-chart-pyramid { height: 260px; }
.hse-chart-legend { display: flex; flex-direction: column; gap: var(--atlas-space-2); margin-top: var(--atlas-space-3); }
.hse-legend-item { display: flex; align-items: center; gap: var(--atlas-space-2); font-size: .8rem; }
.hse-legend-dot { width: 10px; height: 10px; border-radius: var(--atlas-radius-full); flex-shrink: 0; background: var(--atlas-hse-accent); }
.hse-dot-brand  { background: var(--atlas-hse-brand); }
.hse-dot-accent { background: var(--atlas-hse-accent); }
.hse-dot-ok     { background: var(--atlas-hse-ok); }
.hse-dot-warn   { background: var(--atlas-hse-warn); }
.hse-dot-no     { background: var(--atlas-hse-no); }
.hse-dot-purple { background: var(--atlas-hse-purple); }
.hse-dot-muted  { background: var(--atlas-hse-muted); }
.hse-dot-navy   { background: var(--atlas-hse-navy); }
.hse-legend-val { margin-left: auto; font-weight: 700; color: var(--atlas-hse-navy); font-variant-numeric: tabular-nums; }

/* ── Snapshot 2x2 grid ──────────────────────────────────────────────────── */
.hse-snapshot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--atlas-space-3); }
.hse-snapshot-cell { background: var(--atlas-surface-muted); border-radius: var(--atlas-radius-md); padding: var(--atlas-space-3); }
.hse-snapshot-val { font-size: 1.35rem; font-weight: 700; color: var(--hse-snap-accent, var(--atlas-text)); }
.hse-snapshot-cell.acc-ok    { --hse-snap-accent: var(--atlas-hse-ok); }
.hse-snapshot-cell.acc-warn  { --hse-snap-accent: var(--atlas-hse-warn); }
.hse-snapshot-cell.acc-no    { --hse-snap-accent: var(--atlas-hse-no); }
.hse-snapshot-cell.acc-brand { --hse-snap-accent: var(--atlas-hse-brand); }
.hse-snapshot-label { font-size: .74rem; color: var(--atlas-hse-muted); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.hse-snapshot-sub { font-size: .74rem; color: var(--atlas-hse-muted); margin-top: var(--atlas-space-1); }

/* ── Rollout milestone bars ─────────────────────────────────────────────── */
.hse-rollout-item { margin-bottom: var(--atlas-space-4); }
.hse-rollout-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--atlas-space-1); font-size: .82rem; }
.hse-rollout-name { font-weight: 600; color: var(--atlas-text); }
.hse-rollout-bar { height: 8px; border-radius: var(--atlas-radius-full); background: var(--atlas-surface-sunken); overflow: hidden; }
.hse-rollout-fill { height: 100%; border-radius: var(--atlas-radius-full); background: var(--hse-roll-accent, var(--atlas-hse-brand)); }
.hse-rollout-item.acc-ok     { --hse-roll-accent: var(--atlas-hse-ok); }
.hse-rollout-item.acc-brand  { --hse-roll-accent: var(--atlas-hse-brand); }
.hse-rollout-item.acc-warn   { --hse-roll-accent: var(--atlas-hse-warn); }
.hse-rollout-item.acc-purple { --hse-roll-accent: var(--atlas-hse-purple); }

/* ── App launcher cards (Home) ──────────────────────────────────────────── */
.hse-app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--atlas-space-4); }
.hse-app-card {
    background: var(--atlas-surface); border: 1px solid var(--atlas-hse-line);
    border-radius: var(--atlas-radius-xl); overflow: hidden; box-shadow: var(--atlas-shadow-1);
    display: flex; flex-direction: column; transition: box-shadow .15s ease, transform .15s ease;
}
.hse-app-card:hover { box-shadow: var(--atlas-shadow-2); transform: translateY(-2px); }
.hse-app-topbar { height: 5px; background: var(--hse-app-accent, var(--atlas-hse-brand)); }
.hse-app-body { padding: var(--atlas-space-4); display: flex; flex-direction: column; gap: var(--atlas-space-2); flex: 1; }
.hse-app-icon { width: 40px; height: 40px; border-radius: var(--atlas-radius-md); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: color-mix(in srgb, var(--hse-app-accent, var(--atlas-hse-brand)) 12%, transparent); color: var(--hse-app-accent, var(--atlas-hse-brand)); }
.hse-app-name { font-weight: 700; color: var(--atlas-text); }
.hse-app-stat { font-size: 1.6rem; font-weight: 700; color: var(--hse-app-accent, var(--atlas-text)); }
.hse-app-statlabel { font-size: .78rem; color: var(--atlas-hse-muted); }
.hse-app-sub { font-size: .76rem; color: var(--atlas-hse-muted); }
.hse-app-open { margin-top: auto; font-size: .82rem; font-weight: 600; color: var(--atlas-hse-brand); text-decoration: none; }
.hse-app-accent-brand  { --hse-app-accent: var(--atlas-hse-brand); }
.hse-app-accent-accent { --hse-app-accent: var(--atlas-hse-accent); }
.hse-app-accent-ok     { --hse-app-accent: var(--atlas-hse-ok); }
.hse-app-accent-warn   { --hse-app-accent: var(--atlas-hse-warn); }
.hse-app-accent-purple { --hse-app-accent: var(--atlas-hse-purple); }

/* ── Simple data table (plain HTML tables, non-AtlasTable) ──────────────── */
.hse-dtable { width: 100%; border-collapse: collapse; font-size: .84rem; }
.hse-dtable thead th {
    text-align: left; text-transform: uppercase; font-size: .68rem; letter-spacing: .04em;
    color: var(--atlas-hse-muted); font-weight: 700; padding: var(--atlas-space-2) var(--atlas-space-3);
    border-bottom: 1px solid var(--atlas-hse-line);
}
.hse-dtable tbody td { padding: var(--atlas-space-3); border-bottom: 1px solid var(--atlas-hse-line); vertical-align: top; }
.hse-dtable tbody tr:hover { background: var(--atlas-surface-muted); }
.hse-cell-strong { font-weight: 600; color: var(--atlas-text); }
.hse-cell-sub { font-size: .74rem; color: var(--atlas-hse-muted); margin-top: 2px; }
.hse-mono { font-family: var(--atlas-font-mono); font-size: .82em; }

/* ── Module accent (sets --hse-accent for banner left border / phase) ───── */
.hse-accent-hub        { --hse-accent: var(--atlas-hse-brand); }
.hse-accent-training   { --hse-accent: var(--atlas-hse-ok); }
.hse-accent-monitoring { --hse-accent: var(--atlas-hse-accent); }
.hse-accent-incident   { --hse-accent: var(--atlas-hse-incident-red); }
.hse-accent-actions    { --hse-accent: var(--atlas-hse-purple); }

/* ── Coming-soon stub body ──────────────────────────────────────────────── */
.hse-soon { text-align: center; padding: var(--atlas-space-10) var(--atlas-space-5); }
.hse-soon-icon { font-size: 3.5rem; color: var(--atlas-text-faint); }
.hse-soon-title { font-weight: 700; color: var(--atlas-text-secondary); margin-top: var(--atlas-space-3); }
.hse-soon-text { color: var(--atlas-hse-muted); max-width: 520px; margin: var(--atlas-space-2) auto 0; font-size: .88rem; }
.hse-soon-badges { display: flex; gap: var(--atlas-space-2); justify-content: center; flex-wrap: wrap; margin-top: var(--atlas-space-4); }

/* ── Utility grid rows ──────────────────────────────────────────────────── */
.hse-grid { display: grid; gap: var(--atlas-space-4); }
.hse-grid-4 { grid-template-columns: repeat(4, 1fr); }
.hse-grid-3 { grid-template-columns: repeat(3, 1fr); }
.hse-grid-2 { grid-template-columns: 1fr 1fr; }
.hse-grid-13 { grid-template-columns: 1.3fr 1fr; }
.hse-grid-14 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 992px) {
    .hse-grid-4, .hse-grid-3, .hse-grid-2, .hse-grid-13, .hse-grid-14 { grid-template-columns: 1fr; }
    .hse-mobframe { border-width: 8px; }
}

/* ── Modal backdrop (shared by every HSE modal) ─────────────────────────────
   2026-07-22: HSE detail/create screens became modals (plan 2026-07-22 A2/A3).
   House pattern is Bootstrap `modal fade show d-block`, which has no backdrop
   element, so the dim comes from this class instead of an inline style
   (WARNINGS section 38 — no inline CSS). */
.hse-modal-backdrop { background: rgba(0, 0, 0, .5); }
