/* ==========================================================================
   hsef-ui.css — HSEF design layer on top of Bootstrap 5.3 (no build step).
   Apps may link https://www.hsef.in/assets/css/hsef-ui.css for a shared look.
   Sections: 0 fonts · 1 tokens · 2 Bootstrap bridge · 3 dark mode · 4 base · 5 layout
             6 components · 7 utilities · 8 print · 9 public site
   ========================================================================== */

/* 0. Fonts (self-hosted IBM Plex, SIL OFL — see ../fonts/OFL-LICENSE.txt) */
@font-face { font-family: "IBM Plex Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Sans Condensed"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-sans-condensed-latin-700-normal.woff2") format("woff2"); }

/* 1. Tokens ---------------------------------------------------------------- */
:root {
    --hsef-primary: #0F4C5C;
    --hsef-primary-rgb: 15, 76, 92;
    --hsef-primary-600: #0b3a47;
    --hsef-primary-050: #e7f0f2;
    --hsef-accent: #E36414;
    --hsef-accent-rgb: 227, 100, 20;
    --hsef-ink: #1b2a33;
    --hsef-muted: #5b6b75;
    --hsef-surface: #ffffff;
    --hsef-surface-2: #f4f6f8;
    --hsef-border: #dfe5e9;
    --hsef-ok: #1a7f37;
    --hsef-warn: #9a6700;
    --hsef-bad: #c62828;
    --hsef-radius: 8px;
    --hsef-radius-lg: 12px;
    --hsef-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --hsef-font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
    --hsef-display: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, sans-serif;
    --hsef-paper: #F3F6F5;
    --hsef-line: #1E3A44;
    --hsef-grid: rgba(15, 76, 92, .07);
    --hsef-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    --hsef-space-1: 4px;
    --hsef-space-2: 8px;
    --hsef-space-3: 16px;
    --hsef-space-4: 24px;
    --hsef-space-5: 40px;
    --hsef-space-6: 64px;
}

/* 2. Bootstrap bridge ----------------------------------------------------- */
:root,
[data-bs-theme="light"] {
    --bs-primary: var(--hsef-primary);
    --bs-primary-rgb: var(--hsef-primary-rgb);
    --bs-link-color: var(--hsef-primary);
    --bs-link-color-rgb: var(--hsef-primary-rgb);
    --bs-link-hover-color: var(--hsef-primary-600);
    --bs-body-font-family: var(--hsef-font);
    --bs-body-color: var(--hsef-ink);
    --bs-body-bg: var(--hsef-surface-2);
    --bs-border-color: var(--hsef-border);
    --bs-border-radius: var(--hsef-radius);
    --bs-secondary-color: var(--hsef-muted);
    --bs-focus-ring-color: rgba(var(--hsef-primary-rgb), .25);
}
.btn-primary {
    --bs-btn-bg: var(--hsef-primary);
    --bs-btn-border-color: var(--hsef-primary);
    --bs-btn-hover-bg: var(--hsef-primary-600);
    --bs-btn-hover-border-color: var(--hsef-primary-600);
    --bs-btn-active-bg: var(--hsef-primary-600);
    --bs-btn-active-border-color: var(--hsef-primary-600);
    --bs-btn-disabled-bg: var(--hsef-primary);
    --bs-btn-disabled-border-color: var(--hsef-primary);
}
.btn-outline-primary {
    --bs-btn-color: var(--hsef-primary);
    --bs-btn-border-color: var(--hsef-primary);
    --bs-btn-hover-bg: var(--hsef-primary);
    --bs-btn-hover-border-color: var(--hsef-primary);
    --bs-btn-active-bg: var(--hsef-primary);
}
.btn-accent {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--hsef-accent);
    --bs-btn-border-color: var(--hsef-accent);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #c95510;
    --bs-btn-hover-border-color: #c95510;
}
.form-control:focus,
.form-check-input:focus { border-color: var(--hsef-primary); box-shadow: 0 0 0 .2rem rgba(var(--hsef-primary-rgb), .2); }
.form-check-input:checked { background-color: var(--hsef-primary); border-color: var(--hsef-primary); }
.progress-bar { background-color: var(--hsef-primary); }

/* 3. Dark mode ------------------------------------------------------------ */
[data-bs-theme="dark"] {
    --hsef-ink: #e6edf1;
    --hsef-muted: #9aabb5;
    --hsef-surface: #15222a;
    --hsef-surface-2: #0f1a20;
    --hsef-border: #2a3a44;
    --hsef-primary-050: #12323b;
    --bs-body-color: var(--hsef-ink);
    --bs-body-bg: var(--hsef-surface-2);
    --bs-link-color: #6cc3d8;
}

/* 4. Base ----------------------------------------------------------------- */
body { font-family: var(--hsef-font); color: var(--hsef-ink); background: var(--hsef-surface-2); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { letter-spacing: -.01em; }
code { font-family: var(--hsef-mono); color: var(--hsef-primary-600); }
::selection { background: rgba(var(--hsef-accent-rgb), .25); }
:focus-visible { outline: 3px solid rgba(var(--hsef-accent-rgb), .6); outline-offset: 2px; }
.skip-link { position: absolute; left: 8px; top: 8px; z-index: 1000; background: #fff; padding: 8px 12px; border-radius: var(--hsef-radius); }

/* 5. Layout --------------------------------------------------------------- */
.hsef-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.15rem; color: var(--hsef-primary); text-decoration: none; }
.section { padding-top: var(--hsef-space-5); padding-bottom: var(--hsef-space-5); }
.section__title { font-size: 1.35rem; font-weight: 700; margin-bottom: var(--hsef-space-3); }

/* Admin shell: sidebar + content */
.hsef-admin-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.hsef-sidebar { background: var(--hsef-primary); color: #fff; padding: var(--hsef-space-4) var(--hsef-space-3); display: flex; flex-direction: column; gap: var(--hsef-space-4); }
.hsef-sidebar .hsef-brand { color: #fff; }
.hsef-sidebar__nav { display: flex; flex-direction: column; gap: 2px; }
.hsef-sidebar__nav a { color: rgba(255, 255, 255, .85); text-decoration: none; padding: 8px 12px; border-radius: var(--hsef-radius); }
.hsef-sidebar__nav a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.hsef-sidebar__nav a.active { background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--hsef-accent); }
.hsef-sidebar__label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .55); padding: 16px 12px 4px; }
.hsef-sidebar__foot { margin-top: auto; }
.hsef-admin-main { min-width: 0; }
.hsef-admin-content { padding: var(--hsef-space-4); max-width: 1200px; }
@media (max-width: 860px) {
    .hsef-admin-shell { grid-template-columns: 1fr; }
    .hsef-sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--hsef-space-2); padding: var(--hsef-space-2) var(--hsef-space-3); }
    .hsef-sidebar__nav { flex-direction: row; flex-wrap: wrap; }
    .hsef-sidebar__label { display: none; }
    .hsef-sidebar__foot { margin: 0 0 0 auto; }
    .hsef-admin-content { padding: var(--hsef-space-3); }
}

/* 6. Components ----------------------------------------------------------- */


.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.status-badge--live { background: #e6f4ea; color: var(--hsef-ok); border-color: #b7dfc2; }
.status-badge--beta { background: #fff4e5; color: var(--hsef-warn); border-color: #f3d6a6; }
.status-badge--maintenance { background: #fdecea; color: var(--hsef-bad); border-color: #f5c2bd; }
.status-badge--retired { background: #eef1f3; color: var(--hsef-muted); border-color: var(--hsef-border); }

.stat-tile { display: flex; flex-direction: column; padding: var(--hsef-space-3); background: var(--hsef-surface); border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius-lg); height: 100%; }
.stat-tile__label { font-size: .8rem; color: var(--hsef-muted); text-transform: uppercase; letter-spacing: .05em; }
.stat-tile__value { font-size: 1.8rem; font-weight: 700; color: var(--hsef-primary); line-height: 1.2; }
.stat-tile__hint { font-size: .8rem; color: var(--hsef-muted); }

.panel { background: var(--hsef-surface); border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius-lg); padding: var(--hsef-space-4); height: 100%; }
.panel__title { font-size: 1rem; font-weight: 700; margin-bottom: var(--hsef-space-3); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { font-weight: 500; color: var(--hsef-muted); }
.kv dd { margin: 0; }

.announce-bar { background: var(--hsef-accent); color: #fff; text-align: center; padding: 8px 16px; font-weight: 500; }
.install-banner { background: var(--hsef-bad); color: #fff; padding: 10px var(--hsef-space-4); font-size: .9rem; }
.install-banner code { color: #fff; background: rgba(0, 0, 0, .2); padding: 1px 6px; border-radius: 4px; }
.empty-state { color: var(--hsef-muted); padding: var(--hsef-space-4); text-align: center; }

.auth-card { max-width: 420px; margin: 0 auto; background: var(--hsef-surface); border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius-lg); padding: var(--hsef-space-5) var(--hsef-space-4); box-shadow: var(--hsef-shadow); }

.error-page { text-align: center; max-width: 640px; }
.error-page__code { font-size: 4rem; font-weight: 800; color: var(--hsef-primary); margin: 0; }
.error-page__trace { text-align: left; background: #1b2a33; color: #e6edf1; padding: 16px; border-radius: var(--hsef-radius); font-size: .8rem; overflow: auto; }

.install-main { max-width: 880px; }
.update-steps { padding-left: 1.2rem; margin: var(--hsef-space-3) 0 0; }

/* Installer wizard */
.step-wizard { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0 0 var(--hsef-space-4); counter-reset: step; }
.step-wizard li { counter-increment: step; font-size: .8rem; padding: 4px 10px 4px 6px; border-radius: 999px; background: var(--hsef-surface); border: 1px solid var(--hsef-border); color: var(--hsef-muted); }
.step-wizard li::before { content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--hsef-border); color: var(--hsef-ink); font-weight: 700; font-size: .72rem; }
.step-wizard li.is-done::before { background: var(--hsef-ok); color: #fff; content: "✓"; }
.step-wizard li.is-current { border-color: var(--hsef-primary); color: var(--hsef-primary); font-weight: 600; }
.step-wizard li.is-current::before { background: var(--hsef-primary); color: #fff; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hsef-border); }
.check-list .pass { color: var(--hsef-ok); font-weight: 700; }
.check-list .fail { color: var(--hsef-bad); font-weight: 700; }
.check-list .warn { color: var(--hsef-warn); font-weight: 700; }
.secret-box { font-family: var(--hsef-mono); font-size: .82rem; background: var(--hsef-surface-2); border: 1px dashed var(--hsef-border); border-radius: var(--hsef-radius); padding: 10px 12px; word-break: break-all; }

/* 7. Utilities ------------------------------------------------------------ */
.text-muted-2 { color: var(--hsef-muted) !important; }
.max-w-prose { max-width: 65ch; }
.text-accent { color: var(--hsef-accent) !important; }

/* 8. Print ---------------------------------------------------------------- */
@media print {
    .hsef-header, .hsef-footer, .hsef-sidebar, .install-banner, .btn { display: none !important; }
    .hsef-admin-shell { display: block; }
    a { color: inherit; text-decoration: none; }
    body { background: #fff; }
}


/* 9. Public site ------------------------------------------------------------
   Concept: a process schematic. HSEF is the vessel; every app is a tagged
   instrument piped into it. The schematic is the one bold element; the rest
   of the page stays quiet and aligned to the same 12-column container.     */
.hsef-public { background: var(--hsef-surface); }
.hsef-header { background: var(--hsef-surface); border-bottom: 1px solid var(--hsef-border); position: relative; z-index: 2; }
.hsef-header__inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; }
.hsef-brand { font-family: var(--hsef-display); font-size: 1.3rem; letter-spacing: .02em; }
.hsef-nav { display: flex; gap: var(--hsef-space-4); }
.hsef-nav a { color: var(--hsef-line); text-decoration: none; font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent; }
.hsef-nav a:hover { color: var(--hsef-primary); border-bottom-color: var(--hsef-accent); }

/* Hero on drafting paper: minor grid every 24px, major every 120px */
.plant { background-color: var(--hsef-paper);
    background-image:
        linear-gradient(var(--hsef-grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--hsef-grid) 1px, transparent 1px),
        linear-gradient(rgba(15, 76, 92, .09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 76, 92, .09) 1px, transparent 1px);
    background-size: 24px 24px, 24px 24px, 120px 120px, 120px 120px;
    border-bottom: 1px solid var(--hsef-border); }
.plant__inner { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--hsef-space-5); align-items: center; padding-top: 72px; padding-bottom: 72px; }
.plant__title { font-family: var(--hsef-display); font-weight: 700; font-size: clamp(2.3rem, 5.2vw, 3.9rem); line-height: 1.02; letter-spacing: -.01em; color: var(--hsef-line); margin: 0 0 20px; }
.plant__lead { font-size: 1.125rem; line-height: 1.6; color: #3b5560; max-width: 42ch; margin: 0 0 28px; }
.plant__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.plant__actions .btn { padding: 10px 20px; font-weight: 600; border-radius: 6px; }
.btn-line { color: var(--hsef-line); border: 1.5px solid var(--hsef-line); background: transparent; }
.btn-line:hover { background: var(--hsef-line); color: #fff; }
.plant__note { margin: 20px 0 0; font-size: .875rem; color: var(--hsef-muted); }

/* The schematic (inline SVG generated from the apps table) */
.schematic { width: 100%; height: auto; display: block; overflow: visible; }
.schematic a { text-decoration: none; }
.schematic .pipe { fill: none; stroke: var(--hsef-line); stroke-width: 2; }
.schematic .flow { fill: none; stroke: var(--hsef-accent); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 14 86; stroke-dashoffset: 100; opacity: 0; animation: hsef-flow 1.8s ease-out .3s 1 forwards; }
@keyframes hsef-flow { 0% { stroke-dashoffset: 100; opacity: 1; } 85% { opacity: 1; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.schematic .vessel { fill: var(--hsef-primary); }
.schematic .vessel-band { fill: none; stroke: rgba(255, 255, 255, .35); stroke-width: 1.5; }
.schematic .vessel-text { fill: #fff; font-family: var(--hsef-display); font-weight: 700; font-size: 26px; letter-spacing: .04em; }
.schematic .vessel-sub { fill: rgba(255, 255, 255, .78); font-size: 11px; font-weight: 500; }
.schematic .nozzle { fill: var(--hsef-line); }
.schematic .instrument circle { fill: #fff; stroke: var(--hsef-line); stroke-width: 2; transition: stroke .15s, fill .15s; }
.schematic .instrument line { stroke: var(--hsef-line); stroke-width: 1.5; }
.schematic .instrument .tag { font-family: var(--hsef-display); font-weight: 700; font-size: 15px; fill: var(--hsef-line); letter-spacing: .03em; }
.schematic .instrument .state { font-size: 10.5px; font-weight: 500; fill: var(--hsef-muted); }
.schematic .instrument .lamp { stroke: none; }
.schematic .lamp--live { fill: #2E7D4F; }
.schematic .lamp--beta { fill: #B7791F; }
.schematic .lamp--maintenance { fill: var(--hsef-bad); }
.schematic a:hover circle, .schematic a:focus circle { stroke: var(--hsef-accent); fill: #fff7f1; }
.schematic a:focus { outline: none; }
.schematic a:focus-visible circle { stroke-width: 3.5; }
.schematic .callout { font-size: 11px; fill: var(--hsef-muted); }

/* Apps register: an equipment list, not a card grid */
.register { padding-top: 72px; padding-bottom: 56px; }
.register__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--hsef-line); padding-bottom: 12px; }
.register__title, .roadmap__title { font-family: var(--hsef-display); font-weight: 700; font-size: 1.9rem; color: var(--hsef-line); margin: 0; }
.register__count { color: var(--hsef-muted); font-size: .95rem; }
.register__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--hsef-space-5); }
.register__item { border-bottom: 1px solid var(--hsef-border); }
.register__link { display: grid; grid-template-columns: 58px minmax(0, 1fr) auto; align-items: center; gap: 18px; padding: 18px 4px; color: inherit; text-decoration: none; }
.register__link:hover .register__name { color: var(--hsef-accent); }
.register__link:hover .tag-bubble { border-color: var(--hsef-accent); }
.tag-bubble { width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--hsef-line); display: grid; grid-template-rows: 1fr 1fr; place-items: center; font-family: var(--hsef-display); font-weight: 700; font-size: .74rem; letter-spacing: .02em; color: var(--hsef-line); background: var(--hsef-surface); position: relative; overflow: hidden; }
.tag-bubble::after { content: ""; position: absolute; left: 4px; right: 4px; top: 50%; border-top: 1.5px solid var(--hsef-line); }
.tag-bubble span { grid-row: 1; align-self: end; padding-bottom: 4px; }
.register__name { display: block; font-weight: 600; font-size: 1.1rem; color: var(--hsef-line); transition: color .15s; }
.register__meta { display: block; font-size: .9rem; color: var(--hsef-muted); }
.register__state { font-size: .85rem; font-weight: 500; color: var(--hsef-muted); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.register__state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--hsef-muted); }
.register__state--live::before { background: #2E7D4F; }
.register__state--beta::before { background: #B7791F; }
.register__state--maintenance::before { background: var(--hsef-bad); }

/* Roadmap: a real sequence, so it is numbered and joined by one line */
.roadmap { background: var(--hsef-paper); border-top: 1px solid var(--hsef-border); padding-top: 64px; padding-bottom: 72px; }
.roadmap__intro { color: #3b5560; max-width: 56ch; margin: 8px 0 40px; }
.roadmap__steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--hsef-space-4); counter-reset: rm; position: relative; }
.roadmap__step { counter-increment: rm; position: relative; }
.roadmap__step::after { content: ""; position: absolute; top: 22px; left: 56px; right: calc(-1 * var(--hsef-space-4) + 12px); border-top: 2px dashed rgba(30, 58, 68, .35); }
.roadmap__step:last-child::after { display: none; }
.roadmap__step::before { content: counter(rm); display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--hsef-paper); border: 2px solid var(--hsef-line); font-family: var(--hsef-display); font-weight: 700; color: var(--hsef-line); margin-bottom: 18px; position: relative; }
.roadmap__step.is-next::before { background: var(--hsef-accent); border-color: var(--hsef-accent); color: #fff; }
.roadmap__step h3 { font-size: 1.05rem; font-weight: 600; color: var(--hsef-line); margin: 0 0 6px; }
.roadmap__step p { font-size: .95rem; color: #3b5560; margin: 0; max-width: 30ch; }
.roadmap__when { display: block; font-size: .8rem; font-weight: 600; color: var(--hsef-accent); margin-top: 10px; }
.roadmap__step:not(.is-next) .roadmap__when { color: var(--hsef-muted); }
.roadmap__step.is-live::before { content: "\2713"; background: var(--hsef-ok); border-color: var(--hsef-ok); color: #fff; }
.roadmap__step.is-live .roadmap__when { color: var(--hsef-ok); }

/* Footer */
.hsef-footer { background: var(--hsef-line); color: rgba(255, 255, 255, .78); font-size: .9rem; }
.hsef-footer__inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; min-height: 72px; }
.hsef-footer a { color: #fff; text-decoration: none; }
.hsef-footer a:hover { text-decoration: underline; }
.hsef-footer__links { display: flex; gap: var(--hsef-space-4); }

/* Inner pages (login, errors) keep the paper background */
.hsef-page { background: var(--hsef-paper); min-height: calc(100vh - 68px - 72px); }
.hsef-page--home { background: var(--hsef-surface); min-height: 0; }

@media (max-width: 991.98px) {
    .plant__inner { grid-template-columns: 1fr; padding-top: 48px; padding-bottom: 40px; gap: var(--hsef-space-4); }
    .register__list { grid-template-columns: 1fr; }
    .roadmap__steps { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; }
    .roadmap__step::after { display: none; }
}
@media (max-width: 575.98px) {
    .roadmap__steps { grid-template-columns: 1fr; }
    .register__link { grid-template-columns: 48px minmax(0, 1fr); }
    .register__state { grid-column: 2; }
    .tag-bubble { width: 48px; height: 48px; font-size: .62rem; }
    .hsef-nav { gap: var(--hsef-space-3); }
}
@media (prefers-reduced-motion: reduce) {
    .schematic .flow { animation: none; opacity: 0; }
    .register__name, .schematic .instrument circle { transition: none; }
}

/* 10. Public pages (Phase 1) ------------------------------------------------ */
.hsef-nav a[aria-current="page"] { color: var(--hsef-primary); border-bottom-color: var(--hsef-accent); }
.text-link { color: var(--hsef-primary); font-weight: 600; text-decoration: none; border-bottom: 1.5px solid rgba(227, 100, 20, .55); }
.text-link:hover { color: var(--hsef-accent); }
.linklike { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.placeholder-value { background: #fff4e5; color: #8a4b00; border: 1px dashed #e0a458; border-radius: 4px; padding: 0 6px; font-size: .9em; white-space: nowrap; }
.optional { color: var(--hsef-muted); font-weight: 400; }

/* Page head: a short strip of drafting paper with the page title */
.page-head { background-color: var(--hsef-paper);
    background-image: linear-gradient(var(--hsef-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hsef-grid) 1px, transparent 1px);
    background-size: 24px 24px; border-bottom: 1px solid var(--hsef-border); padding: 40px 0 44px; }
.page-head__title { font-family: var(--hsef-display); font-weight: 700; font-size: clamp(2rem, 4vw, 2.9rem); color: var(--hsef-line); margin: 10px 0 10px; line-height: 1.05; }
.page-head__lead { font-size: 1.1rem; color: #3b5560; max-width: 60ch; margin: 0; }
.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: .875rem; color: var(--hsef-muted); }
.crumbs a { color: var(--hsef-muted); text-decoration: none; }
.crumbs a:hover { color: var(--hsef-primary); text-decoration: underline; }

/* Tag bubble sizes */
.tag-bubble--lg { width: 72px; height: 72px; font-size: .86rem; }
.tag-bubble--xl { width: 112px; height: 112px; font-size: 1.25rem; border-width: 3px; }
.tag-bubble--xl::after { border-top-width: 2px; left: 6px; right: 6px; }

/* Apps directory */
.app-list { padding-top: 24px; padding-bottom: 64px; }
.app-row { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; gap: 24px; align-items: center; padding: 28px 0; border-bottom: 1px solid var(--hsef-border); }
.app-row__name { font-family: var(--hsef-display); font-weight: 700; font-size: 1.6rem; margin: 0 0 4px; }
.app-row__name a { color: var(--hsef-line); text-decoration: none; }
.app-row__name a:hover { color: var(--hsef-accent); }
.app-row__tagline { margin: 0 0 4px; font-size: 1.05rem; }
.app-row__audience { margin: 0; color: var(--hsef-muted); font-size: .95rem; max-width: 70ch; }
.app-row__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }

/* App page */
.app-hero { background: var(--hsef-paper);
    background-image: linear-gradient(var(--hsef-grid) 1px, transparent 1px), linear-gradient(90deg, var(--hsef-grid) 1px, transparent 1px);
    background-size: 24px 24px; border-bottom: 1px solid var(--hsef-border); padding: 32px 0 48px; }
.app-hero__grid { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 32px; align-items: center; margin-top: 24px; }
.app-hero__name { font-family: var(--hsef-display); font-weight: 700; font-size: clamp(2.4rem, 5vw, 3.6rem); color: var(--hsef-line); margin: 0; line-height: 1; }
.app-hero__tagline { font-size: 1.2rem; color: #3b5560; margin: 10px 0 24px; max-width: 52ch; }
.app-body { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 56px; padding-top: 56px; padding-bottom: 40px; }
.app-body__lead { font-size: 1.15rem; line-height: 1.65; max-width: 62ch; margin-bottom: 36px; }
.app-body__h { font-family: var(--hsef-display); font-weight: 700; font-size: 1.45rem; color: var(--hsef-line); margin: 0 0 16px; }
.sr-only-heading { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.feature-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--hsef-border); }
.feature-list li { position: relative; padding: 12px 0 12px 30px; border-bottom: 1px solid var(--hsef-border); line-height: 1.5; }
.feature-list li::before { content: ""; position: absolute; left: 4px; top: 19px; width: 12px; height: 12px; border: 2px solid var(--hsef-primary); border-radius: 50%; }
.app-facts { align-self: start; border-top: 3px solid var(--hsef-line); padding-top: 8px; }
.app-facts dl { margin: 0; }
.app-facts dt { font-size: .82rem; font-weight: 600; color: var(--hsef-muted); margin-top: 16px; }
.app-facts dd { margin: 2px 0 0; }
.shots { background: var(--hsef-paper); border-top: 1px solid var(--hsef-border); border-bottom: 1px solid var(--hsef-border); padding: 56px 0; }
.shots__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.shot { margin: 0; }
.shot--main { grid-column: 1 / -1; }
.shot img { width: 100%; height: auto; display: block; border: 1px solid var(--hsef-border); border-radius: 6px; background: #fff; box-shadow: 0 1px 2px rgba(16, 24, 40, .05); }
.shot a:focus-visible img { outline: 3px solid var(--hsef-accent); outline-offset: 2px; }
.shot figcaption { font-size: .9rem; color: var(--hsef-muted); margin-top: 8px; }

/* About */
.prose-page { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 56px; padding-top: 48px; padding-bottom: 64px; }
.prose { max-width: 68ch; font-size: 1.05rem; line-height: 1.7; }
.prose h2 { font-family: var(--hsef-display); font-weight: 700; font-size: 1.45rem; color: var(--hsef-line); margin: 36px 0 10px; }
.prose h2:first-child { margin-top: 0; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 6px; }
.disciplines { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; }
.disciplines dt { font-family: var(--hsef-display); font-weight: 700; color: var(--hsef-primary); }
.disciplines dd { margin: 0; }
.register__list--single { grid-template-columns: 1fr; }
.about-strip { padding-top: 8px; padding-bottom: 64px; }
.about-strip__grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; border-top: 1px solid var(--hsef-border); padding-top: 40px; }
.about-strip__title { font-family: var(--hsef-display); font-weight: 700; font-size: 1.9rem; color: var(--hsef-line); margin: 0; line-height: 1.1; }
.about-strip p { font-size: 1.05rem; line-height: 1.65; max-width: 60ch; }

/* Blog */
.blog-strip { padding-bottom: 64px; }
.posts { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.post { padding-top: 20px; }
.post__date { font-size: .85rem; color: var(--hsef-muted); }
.post__title { font-size: 1.15rem; font-weight: 600; margin: 6px 0 8px; line-height: 1.35; }
.post__title a { color: var(--hsef-line); text-decoration: none; }
.post__title a:hover { color: var(--hsef-accent); }
.post__excerpt { color: #3b5560; font-size: .95rem; margin: 0; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 56px; padding-top: 48px; padding-bottom: 64px; }
.contact__details dl { margin: 0; }
.contact__details dt { font-size: .82rem; font-weight: 600; color: var(--hsef-muted); margin-top: 16px; }
.contact__details dd { margin: 2px 0 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sent { border-left: 4px solid var(--hsef-ok); background: #eef7f1; padding: 24px 28px; border-radius: 4px; }
.sent h2 { font-family: var(--hsef-display); font-weight: 700; color: var(--hsef-line); }

/* Legal */
.legal { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 56px; padding-top: 48px; padding-bottom: 72px; }
.legal__nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; align-self: start; }
.legal__nav a { color: var(--hsef-line); text-decoration: none; padding: 8px 12px; border-left: 3px solid transparent; }
.legal__nav a:hover { border-left-color: var(--hsef-border); }
.legal__nav a[aria-current="page"] { border-left-color: var(--hsef-accent); font-weight: 600; background: var(--hsef-paper); }
.legal-table td, .legal-table th { font-size: .95rem; }

/* Footer (expanded) */
.hsef-footer__grid { display: grid; grid-template-columns: minmax(0, 4fr) repeat(3, minmax(0, 2fr)); gap: 32px; padding-top: 48px; padding-bottom: 32px; }
.hsef-footer__brand { font-family: var(--hsef-display); font-weight: 700; font-size: 1.4rem; color: #fff; }
.hsef-footer__about p { margin: 8px 0 0; max-width: 34ch; }
.hsef-footer__head { font-size: .9rem; font-weight: 600; color: #fff; margin: 0 0 10px; }
.hsef-footer ul { list-style: none; margin: 0; padding: 0; }
.hsef-footer li { margin-bottom: 6px; }
.hsef-footer .linklike { color: #fff; text-decoration: none; }
.hsef-footer .linklike:hover { text-decoration: underline; }
.hsef-footer__base { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid rgba(255, 255, 255, .15); padding-top: 16px; padding-bottom: 24px; font-size: .85rem; }

/* Cookie banner */
.consent { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1050; background: #fff; border-top: 3px solid var(--hsef-line); box-shadow: 0 -4px 16px rgba(16, 24, 40, .08); }
.consent[hidden] { display: none; }
.consent__inner { display: flex; align-items: center; gap: 24px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.consent__text { margin: 0; flex: 1 1 420px; font-size: .95rem; }
.consent__actions { display: flex; gap: 8px; }

/* Admin additions */
.nav-count { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--hsef-accent); color: #fff; font-size: .75rem; text-align: center; margin-left: 6px; }
.shot-admin img { width: 100%; height: 160px; object-fit: cover; object-position: top; border: 1px solid var(--hsef-border); border-radius: 6px; }
.message-body { background: var(--hsef-surface-2); border-left: 3px solid var(--hsef-accent); padding: 16px 20px; border-radius: 4px; line-height: 1.6; }

@media (max-width: 991.98px) {
    .app-body, .prose-page, .contact, .legal, .about-strip__grid { grid-template-columns: 1fr; gap: 32px; }
    .legal__nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .legal__nav a { border-left: 0; border-bottom: 3px solid transparent; }
    .legal__nav a[aria-current="page"] { border-bottom-color: var(--hsef-accent); }
    .posts { grid-template-columns: 1fr; gap: 8px; }
    .hsef-footer__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hsef-footer__about { grid-column: 1 / -1; }
}
@media (max-width: 575.98px) {
    .app-row { grid-template-columns: 56px minmax(0, 1fr); }
    .app-row .tag-bubble--lg { width: 56px; height: 56px; font-size: .7rem; }
    .app-row__actions { grid-column: 1 / -1; justify-content: flex-start; }
    .app-hero__grid { grid-template-columns: 72px minmax(0, 1fr); gap: 16px; }
    .tag-bubble--xl { width: 72px; height: 72px; font-size: .86rem; }
    .shots__grid { grid-template-columns: 1fr; }
}

/* ---- Support portal (1.2.0) ------------------------------------------- */
.help-search { display: flex; gap: var(--hsef-space-2); max-width: 720px; }
.help-search .form-control { border-color: var(--hsef-line); }
.article-list { list-style: none; padding: 0; margin: 0; }
.article-list li { padding: 10px 0; border-bottom: 1px dashed var(--hsef-border); }
.article-list li:last-child { border-bottom: 0; }
.article-list a { font-weight: 500; text-decoration: none; }
.article-list a:hover { text-decoration: underline; }
.article-list--rich li { padding: 14px 0; }
.article-list--rich a { font-size: 1.05rem; }
.article-list--rich p { margin: 4px 0 0; color: var(--hsef-muted); font-size: .92rem; }
.article-list__app { display: inline-block; font-family: var(--hsef-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--hsef-primary); border: 1px solid var(--hsef-primary); border-radius: 3px; padding: 0 5px; margin-right: 8px; vertical-align: 2px; }
.kb-body img { max-width: 100%; height: auto; border: 1px solid var(--hsef-border); border-radius: 6px; margin: 8px 0; }
.kb-body table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: .92rem; }
.kb-body th, .kb-body td { border: 1px solid var(--hsef-border); padding: 6px 10px; text-align: left; vertical-align: top; }
.kb-body th { background: var(--hsef-surface-2); }
.kb-body ol li, .kb-body ul li { margin-bottom: 4px; }
.kb-body code { background: var(--hsef-surface-2); padding: 1px 4px; border-radius: 3px; }
.kb-feedback { margin-top: var(--hsef-space-5); padding: var(--hsef-space-3); border-top: 2px solid var(--hsef-line); background: var(--hsef-paper); }
.sla-table th { font-family: var(--hsef-display); font-weight: 600; }
.sla-table td:first-child { font-weight: 600; }

.ticket-page { padding-top: var(--hsef-space-4); padding-bottom: var(--hsef-space-6); max-width: 880px; }
.thread { list-style: none; padding: 0; margin: 0 0 var(--hsef-space-4); position: relative; }
.thread::before { content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; border-left: 2px solid var(--hsef-border); }
.thread__msg { position: relative; margin: 0 0 var(--hsef-space-3) 32px; padding: var(--hsef-space-3); background: var(--hsef-surface); border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius); }
.thread__msg::before { content: ""; position: absolute; left: -27px; top: 18px; width: 12px; height: 12px; border-radius: 50%; background: var(--hsef-surface); border: 2px solid var(--hsef-primary); }
.thread__msg--agent { border-left: 3px solid var(--hsef-primary); }
.thread__msg--agent::before { background: var(--hsef-primary); }
.thread__msg--customer::before { border-color: var(--hsef-accent); }
.thread__msg--system { background: var(--hsef-surface-2); font-size: .9rem; }
.thread__msg--internal { background: #fff8e6; border: 1px dashed var(--hsef-warn); }
.thread__msg--internal::before { border-color: var(--hsef-warn); background: #fff8e6; }
.thread__meta { display: flex; gap: var(--hsef-space-2); align-items: baseline; flex-wrap: wrap; margin-bottom: var(--hsef-space-2); font-size: .9rem; }
.thread__meta time { margin-left: auto; color: var(--hsef-muted); font-size: .82rem; font-family: var(--hsef-mono); }
.thread__body { overflow-wrap: anywhere; }
.thread__body > :last-child { margin-bottom: 0; }
.thread__files { list-style: none; padding: 8px 0 0; margin: 8px 0 0; border-top: 1px dashed var(--hsef-border); font-size: .88rem; }
.thread__files span { color: var(--hsef-muted); }
.internal-tag { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--hsef-warn); border: 1px solid var(--hsef-warn); border-radius: 3px; padding: 0 5px; }

.ticket-state { display: inline-block; font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 3px; border: 1px solid currentColor; }
.ticket-state--new { color: var(--hsef-accent); }
.ticket-state--open { color: var(--hsef-primary); }
.ticket-state--waiting { color: var(--hsef-warn); }
.ticket-state--resolved { color: var(--hsef-ok); }
.ticket-state--closed { color: var(--hsef-muted); }
.page-head .ticket-state { background: #fff; margin-right: 6px; }
.prio { font-size: .8rem; font-weight: 600; }
.prio--urgent { color: var(--hsef-bad); }
.prio--high { color: var(--hsef-accent); }
.prio--normal { color: var(--hsef-ink); }
.prio--low { color: var(--hsef-muted); }
.overdue-badge { display: inline-block; font-size: .72rem; font-weight: 600; color: #fff; background: var(--hsef-bad); border-radius: 3px; padding: 1px 6px; }
.ticket-table td { vertical-align: top; }

.rate__scale { display: flex; gap: var(--hsef-space-2); flex-wrap: wrap; margin: var(--hsef-space-2) 0; }
.rate__scale label { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius); cursor: pointer; }
.rate__scale label:has(input:checked) { border-color: var(--hsef-primary); background: var(--hsef-primary-050); }
.reply textarea { min-height: 140px; }

.stat-link { text-decoration: none; color: inherit; }
.stat-link:hover { border-color: var(--hsef-primary); }
.stat-tile--alert { border-color: var(--hsef-bad); }
.stat-tile--alert .stat-tile__value { color: var(--hsef-bad); }
.nav-count--alert { background: var(--hsef-bad); }
.md-toolbar { display: flex; gap: 4px; flex-wrap: wrap; }
.panel.h-auto { height: auto; }
@media (max-width: 575.98px) {
    .help-search { flex-direction: column; }
    .thread__msg { margin-left: 24px; }
    .thread::before { left: 7px; }
    .thread__msg::before { left: -23px; }
}

/* ---- Analytics (1.3.0) ------------------------------------------------- */
.kpi { gap: 2px; }
.kpi .stat-tile__value { font-size: 1.6rem; }
.kpi__delta { font-size: .75rem; color: var(--hsef-muted); }
.kpi__delta--up { color: var(--hsef-ok); }
.kpi__delta--down { color: var(--hsef-bad); }
.kpi__approx { font-size: 1rem; color: var(--hsef-muted); margin-left: 3px; }
.chart-box { position: relative; height: 260px; }
.chart-box--tall { height: 320px; }
.chart-box--short { height: 200px; margin-bottom: var(--hsef-space-3); }
.live-num { font-family: var(--hsef-display); font-size: 2rem; font-weight: 700; color: var(--hsef-primary); line-height: 1; }
.live-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; font-size: .85rem; }
.live-list li { display: grid; grid-template-columns: 44px 1fr; gap: 0 8px; padding: 6px 0; border-bottom: 1px dashed var(--hsef-border); }
.live-list__time { font-family: var(--hsef-mono); color: var(--hsef-muted); grid-row: span 2; }
.live-list__path { overflow-wrap: anywhere; }
.live-list__where { font-size: .78rem; color: var(--hsef-muted); }
.map-box { background: #ffffff; border: 1px solid var(--hsef-border); border-radius: var(--hsef-radius); padding: var(--hsef-space-2); min-height: 260px; }
.geo-map { width: 100%; height: auto; display: block; max-height: 560px; }
.geo-shape:hover { stroke: var(--hsef-ink); stroke-width: 1.2; }
.geo-dot:hover { fill-opacity: 1; }
.map-legend { display: flex; align-items: center; gap: 6px; color: var(--hsef-muted); padding: 6px 4px 0; }
.map-legend__ramp { display: inline-block; width: 80px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, rgb(220,238,241), rgb(15,76,92)); }
.map-legend__dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #E36414; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #E36414; }
.geo-tables { max-height: 520px; overflow: auto; padding-top: var(--hsef-space-2); }
.table-scroll { max-height: 460px; overflow: auto; }
.page-path { font-family: var(--hsef-mono); font-size: .82rem; }
.snippet { background: var(--hsef-surface-2); border: 1px solid var(--hsef-border); border-radius: 6px; padding: 10px 12px; margin-bottom: 6px; white-space: pre-wrap; }

/* ---- Home hero: the apps as windows (1.3.1) ---------------------------- */
.showcase { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 22px; align-items: start; padding-bottom: 36px; }
.win { display: block; background: #fff; border: 1px solid #c9d4d8; border-radius: 10px; overflow: hidden; text-decoration: none; color: inherit;
    box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 10px 28px -12px rgba(15, 76, 92, .35); transition: transform .18s ease, box-shadow .18s ease; }
.win--low { transform: translateY(36px); }
.win:hover, .win:focus-visible { transform: translateY(-4px); box-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 18px 36px -14px rgba(15, 76, 92, .45); }
.win--low:hover, .win--low:focus-visible { transform: translateY(32px); }
.win:focus-visible { outline: 3px solid var(--hsef-accent); outline-offset: 3px; }
.win__bar { display: flex; align-items: center; gap: 10px; height: 26px; padding: 0 10px; background: #eef2f3; border-bottom: 1px solid #dde4e7; }
.win__dots { display: inline-flex; gap: 5px; }
.win__dots i { width: 8px; height: 8px; border-radius: 50%; background: #c6d0d4; }
.win__host { font-family: var(--hsef-mono); font-size: .7rem; color: var(--hsef-muted); background: #fff; border-radius: 4px; padding: 1px 8px; flex: 1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.win__shot { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; border-bottom: 1px solid #e3e9ec; }
.win__foot { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px 10px; }
.win__name { font-family: var(--hsef-display); font-weight: 700; font-size: 1rem; color: var(--hsef-line); }
.win__what { font-size: .8rem; color: var(--hsef-muted); line-height: 1.35; }
.showcase__more { grid-column: 1 / -1; margin: 40px 0 0; font-size: .875rem; color: var(--hsef-muted); }
.showcase__more a { color: var(--hsef-line); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .win { transition: none; } }
@media (max-width: 575.98px) {
    .showcase { gap: 12px; padding-bottom: 0; }
    .win--low, .win--low:hover, .win--low:focus-visible { transform: none; }
    .win__bar { height: 20px; }
    .win__host { display: none; }
    .win__what { display: none; }
    .showcase__more { margin-top: 4px; }
}
