/* Simple admin chrome. No framework. */
:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2a3548;
  --text: #e7eef8;
  --muted: #8b9bb4;
  --accent: #3d8bfd;
  --ok: #3dd68c;
  --bad: #f07178;
  --warn: #e6c07b;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex: 0 0 auto;
  padding: 0.6rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar-brand { color: var(--text); display: flex; align-items: baseline; gap: 0.5rem; }
.topbar-brand:hover { text-decoration: none; }
.topbar-brand strong { font-size: 1.15rem; }
.topbar-account {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topbar-email { white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.layout { display: flex; flex: 1 1 auto; }
.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.sidebar nav a {
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
}
.sidebar nav a.active, .sidebar nav a:hover {
  background: #243044;
  text-decoration: none;
}
.sidebar nav .nav-module {
  margin: 0.9rem 0 0.15rem;
  padding: 0 0.75rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar nav a.nav-page { padding-left: 1.1rem; }
.lang-switch { margin: 0; display: flex; align-items: center; gap: 0.4rem; }
.lang-switch select {
  width: auto;
  background: #121a24;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.3rem 0.4rem;
  font: inherit;
}
.viewer-banner { margin-top: 0; }
.content { flex: 1; padding: 1.5rem 2rem; max-width: 1100px; }
h1 { margin-top: 0; font-size: 1.6rem; }
h2 { font-size: 1.1rem; margin-top: 1.75rem; }
.lead { color: var(--muted); max-width: 40rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.cards { display: flex; gap: 1rem; flex-wrap: wrap; margin: 1.25rem 0; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  min-width: 160px;
}
.card-label { color: var(--muted); font-size: 0.85rem; }
.card-value { font-size: 1.8rem; font-weight: 600; margin-top: 0.25rem; }
.card-value.small { font-size: 0.95rem; font-weight: 500; }
.map-section { margin-top: 1.5rem; }
/* Inline <svg>, not an <img>: needs an explicit height and block display so it
   does not sit on the text baseline. */
.hub-map {
  display: block;
  width: 100%;
  height: auto;
  max-width: 900px;
  background: #121a24;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.5rem;
}
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 500; }
.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: #243044;
  font-size: 0.8rem;
}
.outcome-pass { background: #1c3b2d; color: var(--ok); }
.outcome-fail, .outcome-error { background: #3b1c22; color: var(--bad); }
.lamp.on { color: var(--ok); }
.lamp.off { color: var(--muted); }
button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font: inherit;
}
button.danger { background: #8b3a42; }
button.icon { padding: 0.25rem 0.5rem; line-height: 1; }
.row-actions { display: flex; align-items: center; gap: 0.75rem; }
.row-actions form { margin: 0; }
label.check { display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer; white-space: nowrap; }
.flash {
  background: #243044;
  border: 1px solid var(--border);
  padding: 0.75rem 1rem;
  border-radius: 8px;
}
.flash.danger { border-color: var(--bad); color: var(--bad); }
.inline-form, .stack-form { margin: 1rem 0; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.stack-form { flex-direction: column; max-width: 360px; }
.stack-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; }
input {
  background: #121a24;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  font: inherit;
}
select, textarea {
  background: #121a24;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  font: inherit;
}
button:disabled { background: #2a3548; color: var(--muted); cursor: not-allowed; }

/* Gateway releases: one form, label column and field column. */
.release-form {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: 0.75rem 1rem;
  align-items: start;
  margin: 1rem 0 1.5rem;
  max-width: 56rem;
}
.release-form > label, .release-form .field-name { padding-top: 0.4rem; color: var(--muted); }
.release-form select, .release-form input.wide { width: 100%; }
.release-form input.narrow { width: 7rem; }
.choices { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; }
/* One row of fields or choices. */
.row-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; }
.new-release > summary { display: inline-block; list-style: none; margin: 0.5rem 0; }
.release-form .full { grid-column: 1 / -1; }
.release-form .label, .release-form details.advanced > label { padding-top: 0.4rem; color: var(--muted); }
.release-form details.advanced { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0.75rem 1rem; }
.release-form details.advanced > summary { grid-column: 1 / -1; cursor: pointer; color: var(--muted); }
details.withdraw > summary { cursor: pointer; list-style: none; }
/* Articles: a package and an ID mode, then the articles they are for. */
.article-form { margin: 1rem 0; display: flex; flex-direction: column; gap: 1rem; max-width: 64rem; }
.article-form .row-inline > label:not(.check) { display: flex; flex-direction: column; gap: 0.25rem; color: var(--muted); font-size: 0.9rem; }
.article-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 0.75rem; align-items: start; }
.article-groups fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.9rem 0.75rem; margin: 0;
  display: flex; flex-direction: column; gap: 0.35rem; }
.article-groups legend { color: var(--muted); padding: 0 0.35rem; font-size: 0.9rem; }
.article-groups label.check { white-space: normal; align-items: baseline; }
.article-form input.other-article { width: 18rem; }
.article-form select { max-width: 100%; }
.article-list { line-height: 1.6; }
details.history { margin: 1.5rem 0; }
details.history > summary { cursor: pointer; color: var(--muted); }
.preview {
  border: 1px solid var(--border);
  border-left: 4px solid var(--bad);
  border-radius: 8px;
  padding: 0.25rem 1.25rem 1.25rem;
  margin: 1rem 0 2rem;
  background: var(--panel);
}
.preview.clean { border-left-color: var(--ok); }
.preview h3 { font-size: 0.95rem; margin: 1.25rem 0 0.4rem; }
.manifest {
  background: #121a24;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  white-space: pre-wrap;
  word-break: break-all;
  font-size: 0.85rem;
}
.verdict { margin: 0.25rem 0; line-height: 1.45; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--bad); }
.verdict.warn { color: var(--warn); }
ul.verdict { padding-left: 1.2rem; }
.preview form { margin-top: 1.25rem; display: flex; align-items: center; gap: 1rem; }
button.publish { padding: 0.55rem 1.4rem; font-weight: 600; }
.kind-security { background: #3b1c22; color: var(--bad); }
.withdraw-form { display: flex; flex-direction: column; align-items: flex-start; gap: 0.4rem; margin: 0; }
.withdraw-form input { width: 13rem; }
.nowrap { white-space: nowrap; }
.served-now td { min-width: 14rem; }
.fleet-recent { margin-top: 0.75rem; }
.fleet-recent summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }

/* Firmware pages: Status, FW inbox (runs, builds, the make-package dialog), FW packages; each row with its next step. */
details.explain {
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.6rem 1rem; margin: 1rem 0; max-width: 52rem; line-height: 1.5;
}
details.explain > summary { cursor: pointer; font-weight: 600; }
details.explain ul { padding-left: 1.2rem; }
section.new-package { background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  padding: 0.25rem 1.1rem 1rem; margin: 1.25rem 0; }
.package-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 0.75rem 1rem; align-items: end; }
.package-form > label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.9rem; color: var(--muted); }
.package-form select, .package-form input { width: 100%; }
.package-form .line-choice, .package-form .line-hint { grid-column: 1 / -1; margin: 0; }
.line-choice { border: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; }
.line-choice legend { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.35rem; padding: 0; }
.list-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.9rem; font-size: 0.9rem; }
.list-filter a.active { color: var(--text); font-weight: 600; }
.list-filter .sep { color: var(--muted); }
.pager { display: flex; gap: 0.6rem; align-items: center; margin: 0.75rem 0; font-size: 0.9rem; }
tr.idle { opacity: 0.75; }
.pkg-name { font-size: 1.02rem; margin-right: 0.4rem; }
.pkg-details > summary { cursor: pointer; color: var(--muted); font-size: 0.85rem; margin-top: 0.3rem; }
.pkg-details .row-actions form { margin: 0; }
.pkg-files { list-style: none; padding: 0; margin: 0.5rem 0; font-size: 0.85rem; line-height: 1.55; }
.pkg-files code, table.files code { word-break: break-all; }
table.lines td > div + div, table.packages td > div + div { margin-top: 0.35rem; }
.line-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0 0.25rem; }
.line-tabs a { border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.7rem; font-size: 0.88rem; }
.line-tabs a.active { background: var(--panel); color: var(--text); font-weight: 600; border-color: var(--accent); }
.line-tabs .count { color: var(--muted); margin-left: 0.2rem; }
details.run { border: 1px solid var(--border); border-radius: 10px; margin: 0.6rem 0; }
details.run > summary { cursor: pointer; padding: 0.6rem 0.9rem; display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; align-items: baseline; }
details.run > summary::before { content: "▸"; color: var(--muted); }
details.run[open] > summary::before { content: "▾"; }
details.run[open] > summary { border-bottom: 1px solid var(--border); background: var(--panel); border-radius: 10px 10px 0 0; }
details.run table { margin: 0; }
.run-source { font-size: 0.85rem; }
details.run td.cont { border-bottom: 0; padding-bottom: 0.15rem; }
details.run td.actions form { margin: 0; }
details.run table { table-layout: fixed; width: 100%; }
details.run th:nth-child(1) { width: 24%; }
details.run th:nth-child(2) { width: 8%; }
details.run th:nth-child(3) { width: 34%; }
details.run th:nth-child(5) { width: 9rem; }
details.run code, details.run button { white-space: nowrap; word-break: normal; }
.step { display: inline-block; font-size: 0.9rem; }
.step form.inline { display: inline; margin: 0; }
.step-warn, .step-warn a { color: var(--bad); font-weight: 600; }
.step-action a { font-weight: 600; }
.step-info { color: var(--muted); }
.step-done { color: var(--ok); }
/* Articles and Auto-OTA: the groups are ticked whole. */
.article-group .group-lead { margin: 0 0 0.4rem; }
.article-group.off { opacity: 0.4; }
.article-group.off label { cursor: not-allowed; }
.line-note { margin: 0; color: var(--warn); }
.article-group label.select-all { margin-bottom: 0.35rem; }
fieldset.release-articles { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem 0.9rem 0.6rem; margin: 0; }
.btn { display: inline-block; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.small { padding: 0.25rem 0.55rem; font-size: 0.85rem; }
.status-on { background: #1c3b2d; color: var(--ok); }
.status-pre { background: #3b341c; color: var(--warn); }
.status-internal { background: #2f1c3b; color: #c9a3e6; }
.status-serving { background: #1c2c4b; color: var(--accent); }
/* The timeline: one line of time, a filter per target. */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0 0.25rem; }
.chip { border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.75rem; color: var(--text); font-size: 0.9rem; }
.chip.active, .chip:hover { background: #243044; text-decoration: none; }
.target-build { background: #243044; }
.target-package { background: #2b2444; }
.target-test_station { background: #1c3b2d; color: var(--ok); }
.target-auto_ota { background: #1c2c4b; color: var(--accent); }
.target-customer_portal { background: #3b341c; color: var(--warn); }
a.card-link { color: var(--text); }
a.card-link:hover { text-decoration: none; border-color: var(--accent); }

.page-foot {
  flex: 0 0 auto;
  text-align: center;
  padding: 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}
.login-box {
  margin: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  width: min(400px, 92vw);
}
.actions form { display: inline; }

/* Glossary under the Firmwarearkiv lead + (i) hover/focus tips on action buttons. */
.glossary {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 44rem;
  padding-left: 1.2rem;
  margin: 0.75rem 0 1.25rem;
  line-height: 1.45;
}
.glossary li { margin: 0.35rem 0; }
.glossary strong { color: var(--text); }
.tip {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.tip-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-size: 0.7rem;
  font-style: italic;
  font-weight: 600;
  cursor: help;
  line-height: 1;
}
.tip:hover .tip-mark,
.tip:focus .tip-mark,
.tip:focus-within .tip-mark {
  border-color: var(--accent);
  color: var(--accent);
}
.tip-body {
  display: none;
  position: absolute;
  z-index: 20;
  left: 0;
  top: calc(100% + 0.35rem);
  width: min(22rem, 70vw);
  padding: 0.65rem 0.75rem;
  background: #121a24;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.tip-inline .tip-body { left: auto; right: 0; }
.tip:hover .tip-body,
.tip:focus .tip-body,
.tip:focus-within .tip-body {
  display: block;
}

@media (max-width: 800px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .topbar-account { justify-content: flex-start; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
}
/* FW inbox: what a file is, putting it away, and the dialog that makes a package. */
button.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
button.secondary:hover { border-color: var(--accent); }
.status-file-approved { background: #1c3b2d; color: var(--ok); }
.status-file-released-ota { background: #3b341c; color: var(--warn); }
.status-file-archived { background: #243044; color: var(--muted); }
details.run .run-archive { margin: 0; padding: 0.6rem 0.9rem; border-top: 1px solid var(--border); }
details.run td.actions details.withdraw form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.35rem; }
dialog.make-package {
  background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 0.25rem 1.25rem 1.25rem; width: min(56rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem);
}
dialog.make-package::backdrop { background: rgba(5, 10, 20, 0.6); }
dialog.make-package .package-form { margin: 0; }
.dialog-actions { display: flex; gap: 1rem; align-items: center; grid-column: 1 / -1; }
details.withdraw > summary.danger { color: var(--bad); font-size: 0.85rem; margin-top: 0.3rem; }
/* Articles: where the Tag ID comes from, each choice explained. */
.tag-id-choice { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; max-width: 34rem; }
.tag-id-choice legend { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.35rem; padding: 0; }
/* FW packages: one row each, the headings sort, the rest folds out under More. */
table.packages.compact td { vertical-align: top; }
table.packages.compact .pkg-details p { margin: 0.25rem 0; font-size: 0.88rem; }
th a.sort { color: var(--muted); }
th a.sort.active { color: var(--text); font-weight: 600; }
/* Auto-OTA: what is served per track, what is ready to publish, and each release's steps. */
table.served td, table.ready td, table.release-steps td { vertical-align: top; }
.stepper { font-size: 0.9rem; min-width: 11rem; }
.stepper .stage { white-space: nowrap; }
table.release-steps td:nth-child(5) { min-width: 9rem; }
.btn.secondary { background: transparent; border: 1px solid var(--border); color: var(--text); }
.stepper .stage.todo { color: var(--muted); }
.stepper .stage.done { color: var(--ok); }
.stepper .stage.current { color: var(--text); font-weight: 600; }
details.promote-anyway > summary { cursor: pointer; color: var(--accent); }
details.promote-anyway form { display: flex; flex-direction: column; gap: 0.35rem; margin-top: 0.35rem; max-width: 18rem; }
table.release-steps details.withdraw form { display: flex; gap: 0.35rem; margin-top: 0.35rem; }
