/* ============================================================
   HANK shared chrome — the ONE canonical header/footer styling for
   every *.hank.ai service. Served by the console at /embed/chrome.css
   and linked by each service:
       <link rel="stylesheet" href="https://console.hank.ai/embed/chrome.css">
   Change the fleet's chrome look HERE, in one place — every service picks
   it up on its next page load (no per-service redeploy). See the
   onboard-hank-service skill (15/15a/15b) + /embed/header + /embed/footer.

   Only the chrome is defined here (header, brand, home link, pills, footer,
   and the cyan design tokens). A service keeps its own app.css for its body/app.
   All selectors are chrome-scoped so this never fights a service's own styles.
   ============================================================ */

:root {
  --hank-bg-header: #0f1419;
  --hank-bg-card: #1a222d;
  --hank-text-primary: #e6edf3;
  --hank-text-secondary: #8b949e;
  --hank-accent-cyan: #00d9ff;
  --hank-accent-cyan-dim: rgba(0, 217, 255, 0.15);
  --hank-accent-cyan-glow: rgba(0, 217, 255, 0.4);
  --hank-accent-success: #00f5a0;
  --hank-accent-warning: #ffd93d;
  --hank-accent-error: #ff6b6b;
  --hank-border: #30363d;
  --hank-border-subtle: #21262d;
  --hank-font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', ui-monospace, monospace;
  --hank-font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, sans-serif;
}

/* ---------- header ---------- */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: var(--hank-bg-header);
  border-bottom: 1px solid var(--hank-border);
}
.app-header .brand-left { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* The Hank home link — the ONE canonical Hank face (served by the console), far
   left of every service, linking back to the main console. NOT the service's own
   mascot/favicon (each service ships its own; only this shared face means "Hank"). */
.app-header .hank-home {
  display: flex; align-items: center; flex: none;
  border-radius: 8px; text-decoration: none;
  transition: box-shadow 0.15s ease;
}
.app-header .hank-home:hover { box-shadow: 0 0 0 2px var(--hank-accent-cyan-dim), 0 0 14px var(--hank-accent-cyan-glow); }
.app-header .hank-home:focus-visible { outline: 2px solid var(--hank-accent-cyan); outline-offset: 2px; }
.app-header .hank-home img { display: block; width: 30px; height: 30px; border-radius: 7px; }

.app-header .brand {
  display: flex; align-items: center; min-width: 0;
  font-family: var(--hank-font-mono); font-weight: 700; font-size: 18px; letter-spacing: 0.04em;
}
.app-header .brand .logo { color: var(--hank-text-primary); }
.app-header .brand .logo-mark { color: var(--hank-accent-cyan); }
.app-header .brand .logo-2 { color: var(--hank-text-primary); }
.app-header .brand .brand-sub {
  margin-left: 12px; padding: 2px 8px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  background: var(--hank-accent-cyan-dim); color: var(--hank-accent-cyan);
  border: 1px solid var(--hank-accent-cyan); border-radius: 2px;
}
/* Floating beta superscript (onboard skill 15c) — hugs the wordmark, never reflows. */
.app-header .brand .release-badge {
  margin-left: 0.16em; font-size: 0.5em; font-style: italic; font-weight: 600;
  text-transform: lowercase; letter-spacing: 0.02em; text-decoration: none;
  color: var(--hank-accent-cyan); text-shadow: 0 0 9px var(--hank-accent-cyan-glow);
  position: relative; top: -0.9em;
}

/* ---------- meta pills (right cluster) ---------- */
.app-header .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
/* Service-extension containers (chrome.js fills them) participate in the flex/
   gap layout directly — display:contents so the wrapper never breaks the row.
   :not([hidden]) keeps the UA's [hidden]{display:none} in force while empty. */
.app-header .meta .service-links:not([hidden]) { display: contents; }
.app-footer .footer-build [data-hank-slot="build-extras"]:not([hidden]) { display: contents; }
.app-footer .footer-legal .footer-links:not([hidden]) { display: contents; }
.app-header .pill {
  font-family: var(--hank-font-mono); font-size: 11px; padding: 4px 10px;
  background: var(--hank-bg-card); border: 1px solid var(--hank-border);
  color: var(--hank-text-secondary); text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: 3px; white-space: nowrap; text-decoration: none;
}
.app-header .pill.backend { color: var(--hank-accent-success); border-color: var(--hank-accent-success); }
.app-header .pill.link { color: var(--hank-accent-cyan); border-color: var(--hank-accent-cyan); cursor: pointer; }
.app-header .pill.link:hover { background: var(--hank-accent-cyan-dim); }
.app-header .pill.identity { color: var(--hank-text-primary); }
.app-header .pill.login { color: var(--hank-accent-cyan); border-color: var(--hank-accent-cyan); cursor: pointer; }
.app-header .pill.logout { color: var(--hank-accent-error); border-color: var(--hank-accent-error); cursor: pointer; }
.app-header .pill[hidden] { display: none; }

/* Usage chip — label + bar + percent. The customer-facing metric is USAGE %, not
   "credits" (onboard skill 18b). */
.app-header .pill.usage { display: inline-flex; align-items: center; gap: 7px; color: var(--hank-text-secondary); }
.app-header .pill.usage .hank-usage-bar { width: 56px; height: 5px; border-radius: 3px; background: var(--hank-border); overflow: hidden; }
.app-header .pill.usage .hank-usage-bar > i { display: block; height: 100%; background: var(--hank-accent-cyan); }
.app-header .pill.usage.over > i { background: var(--hank-accent-error); }
/* chrome.js hides an empty/unauthenticated usage chip via the [hidden] attribute.
   The .pill.usage display rule above ties the generic .pill[hidden] on specificity
   and wins on source order, leaving a stray empty chip. Restore hiding with a
   more-specific selector (no !important needed). */
.app-header .pill.usage[hidden] { display: none; }

/* ---------- responsive (fleet-wide) ---------- */
@media (max-width: 900px) {
  .app-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .app-footer { padding: 12px 16px; }
  .app-footer .footer-row { gap: 6px; }
}

/* ---------- footer ---------- */
.app-footer {
  flex-shrink: 0;   /* body is often a flex column; never crush the footer */
  margin-top: auto;
  padding: 14px 24px; display: flex; flex-direction: column; gap: 8px;
  background: var(--hank-bg-header); border-top: 1px solid var(--hank-border);
  font-family: var(--hank-font-mono); font-size: 11px; color: var(--hank-text-secondary);
}
.app-footer .footer-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.app-footer .footer-build .pill {
  font-family: var(--hank-font-mono); font-size: 11px; padding: 3px 9px;
  background: var(--hank-bg-card); border: 1px solid var(--hank-border);
  color: var(--hank-text-secondary); text-transform: uppercase; letter-spacing: 0.06em; border-radius: 3px;
}
.app-footer .footer-build .pill[hidden] { display: none; }
.app-footer .footer-legal { color: var(--hank-text-secondary); }
.app-footer .footer-legal a { color: var(--hank-accent-cyan); text-decoration: none; }
.app-footer .footer-legal a:hover { text-shadow: 0 0 10px var(--hank-accent-cyan-glow); }

/* ---------- accounts dropdown (feature-detected multi-account switcher) ----------
   The trigger is a <details class="pill accounts hank-acctmenu"> so it inherits the
   pill chrome; the panel floats below it. Palette is the file's own cyan/card tokens,
   not a forked one. The chrome region is always dark, so no light-mode variant. */
.app-header .hank-acctmenu { position: relative; cursor: pointer; }
.app-header .hank-acctmenu > summary {
  list-style: none; cursor: pointer; color: var(--hank-text-primary); outline: none;
  /* Defensive reset: a service's page-level element styles (e.g. a bare
     `details summary { padding: ... }` for its own accordions) must never
     inflate the account-menu trigger - the PILL owns the box, the summary is
     text-only. Found live on claim-cleaner 2026-07-05. */
  padding: 0; margin: 0; border: 0; background: transparent;
}
.app-header details.hank-acctmenu { margin: 0; }
.app-header .hank-acctmenu > summary::-webkit-details-marker { display: none; }
.app-header .hank-acctmenu > summary:focus-visible { outline: 2px solid var(--hank-accent-cyan); outline-offset: 2px; }
.app-header .hank-acctmenu-panel {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 260px; max-width: min(360px, calc(100vw - 32px)); z-index: 1000;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  border-radius: 8px; border: 1px solid var(--hank-border);
  background: var(--hank-bg-card); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  /* The pill cascades uppercase + tracking; the panel is prose (emails, orgs). */
  text-transform: none; letter-spacing: normal; white-space: normal;
  color: var(--hank-text-primary);
}
.app-header .hank-acct,
.app-header .hank-acct-action {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 6px 8px; border: 0; border-radius: 6px;
  background: transparent; color: inherit; font: inherit; text-align: left;
}
.app-header button.hank-acct:hover,
.app-header .hank-acct-action:hover { background: var(--hank-accent-cyan-dim); cursor: pointer; }
.app-header .hank-acct-active { background: var(--hank-accent-cyan-dim); }
.app-header .hank-acct-expired { opacity: 0.6; cursor: pointer; }
.app-header .hank-acct-avatar {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--hank-accent-cyan); color: var(--hank-bg-header);
  font-size: 12px; font-weight: 700;
}
.app-header .hank-acct-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.app-header .hank-acct-email {
  font-weight: 600; font-size: 12px; color: var(--hank-text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-header .hank-acct-org {
  font-size: 11px; color: var(--hank-text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-header .hank-acct-role {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 9999px; flex-shrink: 0;
}
.app-header .hank-acct-role-operator { background: var(--hank-accent-cyan-dim); color: var(--hank-accent-cyan); }
.app-header .hank-acct-role-user { background: var(--hank-border); color: #c9d1d9; }  /* brighter than text-secondary: AA on the border-gray tint at 9px */
/* A non-active/expired row pairs the switch (or re-signin) row with a per-account
   remove "x" so any listed account signs out individually. */
.app-header .hank-acct-row { display: flex; align-items: stretch; gap: 2px; }
.app-header .hank-acct-row > .hank-acct { flex: 1; min-width: 0; }
.app-header .hank-acct-x {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; padding: 0 6px; border: 0; border-radius: 6px; cursor: pointer;
  background: transparent; color: var(--hank-text-secondary); font: inherit; font-size: 15px; line-height: 1;
}
.app-header .hank-acct-x:hover { background: var(--hank-accent-cyan-dim); color: var(--hank-accent-error); }
.app-header .hank-acct-x:focus-visible { outline: 2px solid var(--hank-accent-cyan); outline-offset: 2px; }

/* Section label inside the account panel (e.g. "Accounts", "Organizations").
   Additive: server-rendered consumers (the console's own chrome) group the
   panel with these labels; chrome.js never emits one, so no live sister render
   changes. */
.app-header .hank-acctmenu-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--hank-text-secondary); padding: 6px 8px 2px;
}
/* Group divider inside the account panel (additive; chrome.js never emits it). */
.app-header .hank-acctmenu-sep {
  height: 1px; margin: 4px 2px; background: var(--hank-border-subtle); flex: none;
}
/* Never lead the panel with a divider (e.g. a bootstrap-admin panel that is
   just [Sign out]): a first-child sep has nothing above it to separate. */
.app-header .hank-acctmenu-panel > .hank-acctmenu-sep:first-child { display: none; }
/* Sign-out action row: error-red text; hover tints toward the error color
   (a red action highlighted cyan read wrong, and #ff6b6b over the cyan-dim
   blend fell just under AA at 12px). */
.app-header .hank-acct-danger { color: var(--hank-accent-error); }
.app-header .hank-acct-danger:hover { background: rgba(255, 107, 107, 0.12); }
/* Long emails must not force an unshrinkable pill (German-hospital-domain
   problem): bound the account-menu trigger and ellipsize. Additive: benefits
   every consumer of the component, JS-built or server-rendered. */
.app-header .hank-acctmenu > summary {
  display: inline-block; max-width: min(40ch, 60vw);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Keyboard affordance parity: pills are interactive chrome (links, login,
   logout) but had only the UA default ring while hank-home/acctmenu/acct-x
   carry the branded one. Additive improvement for every service. */
.app-header .pill:focus-visible { outline: 2px solid var(--hank-accent-cyan); outline-offset: 2px; }
