/* wireframe/chrome.css — the page wrapper every Hiventiq page sits in: layout
   variables, the width contract (.page-frame), base reset, header (brand,
   theme and width toggles), signed-in user menu, nav (tabs, breadcrumb, "More"
   group, app status colours) and footer. Moved here from frontend/src/index.css
   on 2026-11-14; rules are unchanged. Host-only widgets (alerts bell, restart
   overlay, runtime-power button, CLI account chip, Settings, Services, Health)
   stay in the host's index.css. Colours come only from tokens.css. */

/* Layout vars — same pattern as q's style.css: tokens.css holds colors only,
   layout vars live in the app stylesheet. */
:root {
  --topbar-h: 7.5rem;  /* header + nav + gap (120px at 16px); rem so the reserve grows with text size (1.11) */
  --footer-h: 32px;
  --page-max-width: 1200px;
  /* Chrome spacing (rem, so a host's text-size setting scales it). Defaults equal the
     original fixed sizes at a 16px root. Hosts match their density by overriding
     these in their overlay, not by restyling the public classes. */
  --chrome-pad-x: 2.5rem;       /* side gutter of header, nav and footer (40px) */
  --chrome-header-h: 3.625rem;  /* header row height (58px) */
  --chrome-nav-h: 2.75rem;      /* nav row height (44px) */
  --chrome-tab-pad-x: 0.95rem;  /* side padding inside a nav tab (15px) */
  --chrome-icon-size: 1.15em;   /* size of the icon in an icon + label link */
  --chrome-pad-min: 2.5rem;     /* smallest side gutter when data-chrome-width="page" (40px) */
  /* Fonts. A host may override these (e.g. from a font picker) in its overlay or at runtime. */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Page width is one of four named steps, set as <html data-width="1200|1400|1600|2000">.
   Hosts choose among these; they do not set --page-max-width to other numbers. */
html[data-width="1200"] { --page-max-width: 1200px; }
html[data-width="1400"] { --page-max-width: 1400px; }
html[data-width="1600"] { --page-max-width: 1600px; }
html[data-width="2000"] { --page-max-width: 2000px; }

/* Text size is one of four named steps, <html data-size="s|m|l|xl"> (contract 1.10; none = M = 16px).
   Everything in rem scales with it. Set by the size popover in host-controls.js. */
html[data-size="s"] { font-size: 14px; }
html[data-size="l"] { font-size: 18px; }
html[data-size="xl"] { font-size: 20px; }

/* The width contract every app inherits — set by the header's width
   toggle. Apps mounted inside Hive should size their own content to this
   rather than picking their own page width. */
.page-frame {
  max-width: var(--page-max-width);
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
}

a {
  color: var(--accent);
}

/* --- Header (row 1): brand + theme toggle — lifted from q's static/style.css,
   stripped of q-specific widgets (decisions-chip, worker capacity, runtime
   restart, account chip) that don't belong in a generic shell. --- */
.top-bar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  background: var(--bg);
}

/* Scoped to the wrapper so a <nav>/<header> elsewhere on a page (e.g. a footer
   legal-links nav) is never styled as chrome. */
.top-bar > header {
  height: var(--chrome-header-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 10px var(--chrome-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left, .header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand-word {
  color: var(--text-head);
  font-size: 1.125rem;
  font-weight: 700;
}

.brand-subtitle {
  color: var(--text-dim);
  font-size: 0.75rem;
  padding-left: 4px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  color: var(--text-head);
  border-color: var(--border-strong);
}

.theme-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.width-toggle {
  width: auto;
  min-width: 68px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
}

.width-toggle:hover {
  border-color: var(--border-strong);
}

/* --- Size popover (contract 1.10): Text size and Content width, opened from the width button by
   WireframeControls.bind({ popover: true }). Fixed so a scrolling header row cannot clip it. --- */
.wf-pop {
  position: fixed;
  z-index: 1000;
  min-width: 15rem;
  max-width: calc(100vw - 16px);
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.wf-pop[hidden] { display: none; }
.wf-pop-group + .wf-pop-group { margin-top: 0.75rem; }
.wf-pop-title {
  margin-bottom: 0.375rem;
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wf-pop-row { display: flex; gap: 0.375rem; }
.wf-pop-btn {
  flex: 1 1 0;
  min-height: 2rem;
  padding: 0 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.wf-pop-btn:hover { border-color: var(--border-strong); }
.wf-pop-btn[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--accent-bg);
  color: var(--text-head);
}

/* --- Signed-in user menu: trigger + dropdown --- */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-menu-trigger:hover {
  border-color: var(--border-strong);
}

.user-menu-caret {
  font-size: 0.625rem;
  color: var(--text-dim);
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 220px;
  max-width: min(20rem, calc(100vw - 1.5rem));  /* never wider than the screen, however long the rows */
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  padding: 10px 0;
  z-index: 200;
}

.user-menu-email {
  padding: 4px 14px 10px;
  color: var(--text-dim);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--border-dim);
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  padding: 9px 14px;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.8125rem;
  cursor: pointer;
  text-decoration: none;
}

.user-menu-item:hover {
  background: var(--bg-hover);
}

/* Menu row layout: icon, name, then an optional trailing note pushed to the right. */
.user-menu-item .ico { flex: none; }
.user-menu-note {
  margin-left: auto;
  padding-left: 0.75rem;
  color: var(--text-dim);
  font-size: 0.75rem;
  white-space: nowrap;
}

.user-menu-item.danger {
  color: var(--danger);
}

/* --- Nav (row 2): app switcher, driven entirely by the App registry --- */
/* Scoped; see .top-bar > header. */
.top-bar > nav {
  height: var(--chrome-nav-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--chrome-pad-x);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.bc-root {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
}

.bc-root:hover {
  color: var(--text-head);
}

.bc-sep {
  color: var(--text-dim);
}

.bc-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-head);
  font-weight: 700;
}

.nav-tabs {
  display: flex;
  align-items: stretch;  /* tabs fill the nav height so the active underline sits flush at the bottom */
  height: 100%;
}

.nav-icon-btn {
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
}

.nav-icon-btn:hover:not(.active) {
  color: var(--text-head);
  background: var(--bg-hover);
}

.nav-icon-btn.active {
  color: var(--accent);
}

/* Settings gear spin — matches bzz's own .cog-btn hover behavior
   (desktop/dashboard/style.css). */
.nav-icon-btn svg {
  transition: transform 0.3s ease;
}

.nav-icon-btn:hover svg {
  transform: rotate(45deg);
}

.nav-tabs button:not(.nav-icon-btn), .nav-tabs a:not(.nav-icon-btn) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 var(--chrome-tab-pad-x);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-top: 2px solid transparent;     /* matches the underline so labels stay centred */
  border-bottom: 2px solid transparent;  /* the active underline: 2px, flush with the nav bottom */
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
}

.nav-tabs button.active:not(.nav-icon-btn), .nav-tabs a.active:not(.nav-icon-btn) {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-tabs button:hover:not(.active):not(.nav-icon-btn), .nav-tabs a:hover:not(.active):not(.nav-icon-btn) {
  color: var(--text-head);
}

/* --- "More ▾" nav group: apps with nav_placement='more' — same trigger
   shape as the plain nav-tabs buttons, dropdown panel reuses
   .user-menu-dropdown's visual language. --- */
.nav-more {
  position: relative;
  height: 100%;
  display: inline-flex;
  align-items: center;
}

.nav-more-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 var(--chrome-tab-pad-x);
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-top: 2px solid transparent;     /* matches the underline so labels stay centred */
  border-bottom: 2px solid transparent;  /* the active underline: 2px, flush with the nav bottom */
  font: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.nav-more-trigger.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-more-trigger:hover:not(.active) {
  color: var(--text-head);
}

.nav-more-dropdown .user-menu-item.active {
  color: var(--accent);
}

/* --- App status coloring for the taskbar (tabs and the "More ▾" dropdown)
   — same up/down/partial classes as the Apps tab's power button above (see
   appStatus.js). Placed after .active/:hover so a colored app's name stays
   colored even while it's the selected tab. --- */
.nav-tabs button.app-status-up:not(.nav-icon-btn), .nav-tabs a.app-status-up:not(.nav-icon-btn) { color: var(--success); }
.nav-tabs button.app-status-down:not(.nav-icon-btn), .nav-tabs a.app-status-down:not(.nav-icon-btn) { color: var(--danger); }
.nav-tabs button.app-status-partial:not(.nav-icon-btn), .nav-tabs a.app-status-partial:not(.nav-icon-btn) { color: var(--warning); }

.nav-tabs button.app-status-up:hover:not(.nav-icon-btn), .nav-tabs a.app-status-up:hover:not(.nav-icon-btn) { color: var(--success); }
.nav-tabs button.app-status-down:hover:not(.nav-icon-btn), .nav-tabs a.app-status-down:hover:not(.nav-icon-btn) { color: var(--danger); }
.nav-tabs button.app-status-partial:hover:not(.nav-icon-btn), .nav-tabs a.app-status-partial:hover:not(.nav-icon-btn) { color: var(--warning); }

.nav-more-dropdown .user-menu-item.app-status-up { color: var(--success); }
.nav-more-dropdown .user-menu-item.app-status-down { color: var(--danger); }
.nav-more-dropdown .user-menu-item.app-status-partial { color: var(--warning); }

/* --- Footer --- */
.copyright {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: var(--footer-h);
  flex-wrap: wrap;
  gap: 0.125rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--chrome-pad-x);
  font-size: 0.75rem;
  z-index: 90;
}

.copyright a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  margin-left: 16px;
}

.copyright a:hover {
  color: var(--text);
}

/* --- Main content area below the fixed header --- */
.shell-main {
  height: 100vh;
  padding-top: var(--topbar-h);
  padding-bottom: var(--footer-h);
  overflow-y: auto;
}

/* --- Slots: host-supplied parts. A [data-slot] wrapper adds no box of its own. --- */
[data-slot] {
  display: contents;
}

/* --- Icon + label links (nav tabs and footer links) ---
   Markup: <a><span class="ico"><svg/></span><span class="lbl">Home</span></a>.
   <html data-nav="icons"> hides every .lbl in the wrapper visually but keeps it for
   screen readers; the default (data-nav="both", or absent) shows icon and label.
   The host owns the setting and saves it. --- */
.ico {
  display: inline-flex;
  align-items: center;
}

.ico svg {
  width: var(--chrome-icon-size);
  height: var(--chrome-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html[data-nav="icons"] .top-bar .lbl,
html[data-nav="icons"] .nav-tabs .lbl,
html[data-nav="icons"] .copyright .lbl {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Status colours also apply to footer links, and in icons-only mode the icon glows
   (the label is gone, so the icon carries the status). */
.copyright a.app-status-up { color: var(--success); }
.copyright a.app-status-down { color: var(--danger); }
.copyright a.app-status-partial { color: var(--warning); }

html[data-nav="icons"] .top-bar [class*="app-status-"] .ico,
html[data-nav="icons"] .copyright [class*="app-status-"] .ico {
  filter: drop-shadow(0 0 4px currentColor);
}

/* --- Variants (attributes on <html>; all optional, defaults = original look) ---
   data-chrome-width="page"       header, nav and footer content align to --page-max-width
                                  instead of spanning the viewport.
   data-chrome-position="sticky"  header and footer are sticky instead of fixed, so no
                                  --topbar-h reserve is needed.
   data-chrome-layout="one-row"   brand, breadcrumb, tabs and tools share one row that
                                  wraps to a second row on narrow screens. */
html[data-chrome-width="page"] {
  --chrome-pad-x: max(var(--chrome-pad-min), calc((100vw - var(--page-max-width)) / 2));
}

html[data-chrome-position="sticky"],
html[data-chrome-position="sticky"] body {
  height: auto;
}

html[data-chrome-position="sticky"] body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

html[data-chrome-position="sticky"] .top-bar {
  position: sticky;
  top: 0;
}

html[data-chrome-position="sticky"] .copyright {
  position: sticky;
}

html[data-chrome-position="sticky"] .shell-main {
  flex: 1 0 auto;
  height: auto;
  padding-top: 0;
  padding-bottom: 0;
  overflow: visible;
}

html[data-chrome-layout="one-row"] .top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding: 0 var(--chrome-pad-x);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

html[data-chrome-layout="one-row"] .top-bar > header,
html[data-chrome-layout="one-row"] .top-bar > nav {
  display: contents;
}

html[data-chrome-layout="one-row"] .header-left { order: 0; }
html[data-chrome-layout="one-row"] .nav-breadcrumb { order: 1; margin-left: 1rem; }
html[data-chrome-layout="one-row"] .nav-tabs { order: 2; margin-left: auto; height: var(--chrome-nav-h); }
html[data-chrome-layout="one-row"] .header-right { order: 3; margin-left: 1rem; }

/* --- Restart control (required in every app): header button + progress overlay ---
   Moved from comb's index.css. The button is <button class="runtime-power">; the overlay is
   shown while the app restarts (markup in test.html). See README, "Restart control". --- */
.runtime-power {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.runtime-power:hover {
  color: var(--text-head);
  border-color: var(--border-strong);
}

.runtime-power.restarting {
  color: var(--accent);
  border-color: var(--accent);
}

.runtime-power.restarting svg {
  animation: runtime-power-spin 0.9s linear infinite;
}

@keyframes runtime-power-spin {
  to { transform: rotate(360deg); }
}

/* --- Restart overlay: mirrors q's own runtime-restart dialog (progress,
   success, or a persistent failure) so restarting reads the same way
   across services. --- */
.restart-overlay[hidden] { display: none; }

.restart-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(2px);
}

.restart-card {
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  width: min(480px, calc(100vw - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .48);
}

.restart-caption {
  padding: 9px 16px;
  background: var(--warning, #ba7f04);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

.restart-content {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 20px 16px;
}

.restart-logo {
  width: 2.75rem;
  height: 2.75rem;
  object-fit: contain;
  border-radius: 50%;
}
.restart-icon svg {
  width: 40px;
  height: 40px;
  stroke: var(--warning, #ba7f04);
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: restart-spin 1.2s linear infinite;
}

@keyframes restart-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.restart-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
}

.restart-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-head);
}

.restart-body {
  font-size: 0.7812rem;
  color: var(--text-muted);
  min-height: 1.4em;
}

.restart-progress {
  margin: 0 20px 18px;
  width: calc(100% - 40px);
  height: 6px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.restart-bar {
  height: 100%;
  background: var(--warning, #ba7f04);
  border-radius: 2px;
  animation: restart-marquee 1.4s ease-in-out infinite;
  transform-origin: left;
}

@keyframes restart-marquee {
  0%   { margin-left: 0;    width: 30%; }
  50%  { margin-left: 70%;  width: 30%; }
  100% { margin-left: 0;    width: 30%; }
}

.restart-close {
  align-self: flex-end;
  margin: -4px 20px 18px;
  padding: 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.restart-card[data-state="success"] .restart-title { color: var(--success); }
.restart-card[data-state="failure"] .restart-title { color: var(--danger); }
.restart-card[data-state="success"] .restart-icon svg,
.restart-card[data-state="failure"] .restart-icon svg { animation: none; }

/* Per-target restart checklist (REQ-HIVE-OPS-002) — one row per app the
   fan-out restart dispatched to, shown between the title/body pair above
   and the marquee progress bar below. */
.restart-checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 20px 14px;
  padding: 0;
  list-style: none;
  max-height: 180px;
  overflow-y: auto;
}

.restart-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  font-size: 0.7812rem;
}

.restart-checklist-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--warning, #ba7f04);
}

.restart-checklist-restarting .restart-checklist-dot {
  animation: restart-marquee-dot 1s ease-in-out infinite;
}

@keyframes restart-marquee-dot {
  0%, 100% { opacity: .35; }
  50%      { opacity: 1; }
}

.restart-checklist-up .restart-checklist-dot { background: var(--success); }
.restart-checklist-failed .restart-checklist-dot { background: var(--danger); }

.restart-checklist-label {
  flex: 1;
  color: var(--text);
}

.restart-checklist-status {
  color: var(--text-muted);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.restart-checklist-up .restart-checklist-status { color: var(--success); }
.restart-checklist-failed .restart-checklist-status { color: var(--danger); }

/* Narrow screens (up to 760px), either layout: the header may wrap, with the tools right-aligned
   on a second line, instead of falling off the right edge; the tab row scrolls sideways instead
   of overflowing. --topbar-h gets a taller default because the header can now be two lines;
   a host that sets its own --topbar-h should set a narrow value too. A scrolling tab row clips
   an absolutely positioned dropdown, so on narrow screens a host opens its menus with
   position: fixed (or the popover attribute). */
@media (max-width: 760px) {
  :root { --topbar-h: 9.75rem; }

  .top-bar > header {
    height: auto;
    min-height: var(--chrome-header-h);
    flex-wrap: wrap;
    row-gap: 0.5rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    row-gap: 0.5rem;
  }

  .top-bar > nav { gap: 0.75rem; }
  .nav-breadcrumb { flex: none; }

  .nav-tabs {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
}

@media (max-width: 520px) {
  :root { --topbar-h: 11.5rem; }  /* header can wrap to three lines */
}

/* Narrow screens, one-row layout: brand + breadcrumb and the tools share the first row (tools
   right-aligned); the tabs take their own full-width row and scroll sideways instead of
   overflowing the page. A scrolling row clips an absolutely positioned dropdown, so on
   narrow screens a host opens its menus with position: fixed (or the popover attribute). */
@media (max-width: 760px) {
  html[data-chrome-layout="one-row"] .nav-breadcrumb { order: 1; }
  html[data-chrome-layout="one-row"] .header-right { order: 2; margin-left: auto; }
  html[data-chrome-layout="one-row"] .nav-tabs {
    order: 3;
    flex: 1 0 100%;
    margin-left: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }
}

/* --- Pill (status chip) and nav divider ---
   <span class="pill pill-up"><span class="pill-dot"></span>live</span>; states pill-up,
   pill-down, pill-partial colour the dot and text. A pill can also hold a host widget. --- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
}

.pill-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}

.pill-up { color: var(--success); }
.pill-down { color: var(--danger); }
.pill-partial { color: var(--warning); }

.nav-divider {
  align-self: stretch;
  width: 0;
  margin: 0.5rem 0.5rem;
  border-left: 1px solid var(--border);
}


/* --- Admin cog (contract 1.4): the one standard settings/admin gear. Any host may render it
   (the host decides who sees it). A button or link <a|button class="admin-cog"> with the cog svg,
   in the header-right area (header-tools slot is fine). Same hover rotation as every gear.
   One-row layout: sits immediately left of the restart (power) button. Two-row layout: far right. --- */
.admin-cog {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  order: 5;
}
.admin-cog:hover { color: var(--text-head); background: var(--bg-hover); }
.admin-cog svg { transition: transform 0.3s ease; }
.admin-cog:hover svg { transform: rotate(45deg); }
.header-right .runtime-power { order: 6; }
html:not([data-chrome-layout="one-row"]) .header-right .admin-cog { order: 7; }
