/* Sentinel: one neutral palette, one accent, and the health colours geoview
   uses on the map (ok, warning, error, offline/unknown), so list and map agree. */

:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --border: #e2e6eb;
  --border-strong: #cfd5dc;
  --text: #17202a;
  --muted: #677380;
  --accent: #0f766e;
  --accent-hover: #0b5f59;
  --accent-soft: #e3f3f1;
  --danger: #c2413b;
  --appbar: #111827;
  --appbar-text: #d6dce4;

  /* geoview's health ring colours, and darker variants for text */
  --ok: #33d17a;
  --warning: #f6c344;
  --error: #ff6b6b;
  --unknown: #9aa7ad;
  --ok-text: #157a44;
  --warning-text: #8a6200;
  --error-text: #b3302c;
  --unknown-text: #5e6a70;
  --ok-soft: #e4f8ec;
  --warning-soft: #fdf4dc;
  --error-soft: #fde8e8;
  --unknown-soft: #eef1f2;

  /* Chart series, in fixed order (validated categorical palette). */
  --series-0: #2a78d6;
  --series-1: #eb6834;
  --series-2: #1baf7a;
  --series-3: #eda100;
  --series-4: #e87ba4;
  --series-5: #008300;
  --series-6: #4a3aa7;
  --series-7: #e34948;

  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.04);
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1419;
    --surface: #161c23;
    --surface-2: #1b222a;
    --border: #262f39;
    --border-strong: #34404c;
    --text: #e3e8ee;
    --muted: #8d99a6;
    --accent: #2bb3a6;
    --accent-hover: #3cc9bb;
    --accent-soft: #10302d;
    --danger: #ff7b72;
    --appbar: #0a0e12;
    --ok-text: #5ee39a;
    --warning-text: #f6c344;
    --error-text: #ff8a85;
    --unknown-text: #a9b4ba;
    --ok-soft: #12301f;
    --warning-soft: #33290c;
    --error-soft: #3a1717;
    --unknown-soft: #20272d;
    --series-0: #3987e5;
    --series-1: #d95926;
    --series-2: #199e70;
    --series-3: #c98500;
    --series-4: #d55181;
    --series-5: #008300;
    --series-6: #9085e9;
    --series-7: #e66767;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 22px;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

/* ---------- app bar ---------- */

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 52px;
  padding: 0 20px;
  background: var(--appbar);
  color: var(--appbar-text);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.01em;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 3px solid var(--ok);
  box-shadow: 0 0 0 3px rgba(51, 209, 122, 0.18);
}

.project-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8f9ba8;
}

.project-picker select {
  min-width: 180px;
  height: 32px;
  border: 1px solid #2b3542;
  background: #1a2230;
  color: #fff;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 7px;
  color: var(--appbar-text);
  font-weight: 550;
}

.nav-link:hover {
  background: #1d2634;
  color: #fff;
}

.nav-link.active {
  background: #243041;
  color: #fff;
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.refresh-label {
  font-size: 12px;
  color: #8f9ba8;
  margin-right: 4px;
}

.account {
  font-size: 13px;
  color: var(--appbar-text);
  margin-left: 8px;
  max-width: 16em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--appbar-text);
  cursor: pointer;
}

.icon-button:hover,
.icon-button.active {
  background: #243041;
  color: #fff;
}

/* ---------- layout ---------- */

.main {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px;
}

.view,
#page,
#page-rest {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-content: start;
}

#page-rest:empty {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.subtitle {
  margin: 4px 0 0;
  color: var(--muted);
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.back-link {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 13px;
}

.dash-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: start;
}

.dash-side {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 72px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

@media (max-width: 1100px) {
  .dash-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .dash-side {
    position: static;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subsection {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.subsection h3 {
  margin-bottom: 8px;
}

/* ---------- stats and toolbar ---------- */

.stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 92px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
}

.stat.ok {
  border-left-color: var(--ok);
}

.stat.warning {
  border-left-color: var(--warning);
}

.stat.error {
  border-left-color: var(--error);
}

.stat.unknown {
  border-left-color: var(--unknown);
}

.stat-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.toolbar input[type="search"] {
  width: 260px;
}

select.is-set {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}

/* ---------- controls ---------- */

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 6px 10px;
  min-height: 34px;
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

textarea.code {
  width: 100%;
  font: 12.5px/1.5 var(--mono);
  resize: vertical;
  background: var(--surface-2);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button.secondary {
  background: var(--surface);
  color: var(--accent);
  border-color: var(--border-strong);
}

.button.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.button.danger {
  background: var(--surface);
  color: var(--danger);
  border-color: var(--border-strong);
}

.button.danger:hover {
  border-color: var(--danger);
}

.link-button {
  border: 0;
  background: none;
  padding: 2px 6px;
  color: var(--accent);
  font: inherit;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
}

.link-button:hover {
  text-decoration: underline;
}

.link-button.danger {
  color: var(--danger);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 2px 4px 2px 0;
  padding: 1px 8px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.chip:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(14px);
}

/* ---------- forms ---------- */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.form-stack {
  display: grid;
  gap: 10px;
}

.form-grid label,
.form-stack label,
label.block {
  display: grid;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

label.block {
  margin-top: 12px;
}

.form-stack label.checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-weight: 400;
  font-size: 13px;
}

.form-stack label.checkbox input {
  margin: 0;
}

.token-secret {
  width: 100%;
  margin-top: 8px;
}

a.account {
  text-decoration: none;
}

a.account:hover,
a.account.active {
  text-decoration: underline;
}

.form-grid .wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-form input {
  flex: 1 1 140px;
}

.inline-form .short {
  flex: 0 0 auto;
  width: 130px;
}

.card .inline-form {
  margin-top: 12px;
}

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.tab {
  padding: 9px 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- tables ---------- */

.table-wrap {
  overflow-x: auto;
  margin: 0 -16px;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table-wrap .table th:first-child,
.table-wrap .table td:first-child {
  padding-left: 16px;
}

.table-wrap .table th:last-child,
.table-wrap .table td:last-child {
  padding-right: 16px;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table.compact td {
  padding: 5px 0;
}

.table.compact td + td {
  padding-left: 16px;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

tr.clickable {
  cursor: pointer;
}

tr.clickable:hover td {
  background: var(--surface-2);
}

tr.selected td {
  background: var(--accent-soft);
}

tr.selected:hover td {
  background: var(--accent-soft);
}

.state-cell {
  width: 28px;
}

.row-actions {
  text-align: right;
  white-space: nowrap;
}

.highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.kv {
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kv span {
  color: var(--muted);
  margin-right: 4px;
}

.name {
  font-weight: 600;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.selectable {
  user-select: all;
}

.muted {
  color: var(--muted);
  font-weight: 400;
}

.small {
  font-size: 12px;
}

.strong {
  font-weight: 650;
}

/* ---------- status ---------- */

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unknown);
  flex: none;
}

.dot.ok {
  background: var(--ok);
}

.dot.warning {
  background: var(--warning);
}

.dot.error {
  background: var(--error);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 9px 1px 7px;
  border-radius: 999px;
  background: var(--unknown-soft);
  color: var(--unknown-text);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.status.ok {
  background: var(--ok-soft);
  color: var(--ok-text);
}

.status.warning {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.status.error {
  background: var(--error-soft);
  color: var(--error-text);
}

/* The ring geoview draws around a marker. */
.ring {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 3px solid var(--unknown);
  border-radius: 50%;
  background: #101214;
  vertical-align: middle;
}

.ring.ok {
  border-color: var(--ok);
}

.ring.warning {
  border-color: var(--warning);
}

.ring.error {
  border-color: var(--error);
}

.badge {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
}

.pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.reason {
  margin: 0 0 12px;
  color: var(--muted);
}

.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--unknown-soft);
}

.flash.error {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--error-text);
}

.flash.warning {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning-text);
}

.flash.notice,
.flash.ok {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok-text);
}

.card .flash {
  margin-bottom: 12px;
}

#flash:empty {
  display: none;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

/* ---------- facts ---------- */

.facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 7px 16px;
  margin: 0 0 12px;
}

.facts dt {
  color: var(--muted);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- map ---------- */

.map-card .card-head {
  align-items: center;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.legend > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.map-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  color: var(--text);
}

.map-toggle input {
  margin: 0;
}

/* geoview draws the map, its controls and hover cards inside this container. */
.map-view {
  position: relative;
  height: clamp(320px, 50vh, 560px);
  overflow: hidden;
  border-radius: 8px;
  background: #0d1114;
}

.caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- events and topics ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 420px;
  overflow-y: auto;
}

.event {
  display: grid;
  grid-template-columns: 10px 90px auto minmax(0, 1fr);
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.event:last-child {
  border-bottom: 0;
}

.event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-1px);
}

.event.warning .event-dot {
  background: var(--warning);
}

.event.error .event-dot {
  background: var(--error);
}

.event-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.event-message {
  overflow-wrap: anywhere;
}

.topic {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.topic:last-child {
  border-bottom: 0;
}

.topic-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.topic-head .mono {
  overflow-wrap: anywhere;
}

details.code {
  margin-top: 6px;
}

details.code summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

details.code pre {
  max-height: 360px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font: 12px/1.5 var(--mono);
}

/* ---------- expandable items (mappings) ---------- */

.items {
  display: grid;
  gap: 8px;
}

details.item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

details.item summary {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

details.item summary::-webkit-details-marker {
  display: none;
}

details.item summary::before {
  content: "▸";
  color: var(--muted);
}

details.item[open] summary::before {
  content: "▾";
}

details.item[open] summary {
  border-bottom: 1px solid var(--border);
}

.item-body {
  padding: 12px 14px;
}

/* History charts on the device page: a tab per period. */
.history-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
}

.history-tab {
  padding: 6px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.history-tab:hover {
  color: var(--text);
}

.history-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.history-head {
  flex-wrap: wrap;
  align-items: center;
}

.history-range {
  width: auto;
}

.history-pick {
  width: auto;
}

input[type="number"].history-pick {
  width: 6em;
}

.history-hint {
  margin-left: auto;
}

.history-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin-bottom: 12px;
}

.history-custom label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.history-custom input {
  width: auto;
}

.history-period {
  align-items: center;
}

.history-period-name {
  min-width: 9em;
  text-align: center;
  font-weight: 600;
}

.history-chart-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}

.history-chart-head .muted {
  margin-left: auto;
}

.timechart {
  display: block;
  width: 100%;
  height: auto;
  /* Horizontal drags select a range; vertical ones still scroll the page. */
  touch-action: pan-y;
  cursor: crosshair;
  user-select: none;
}

.chart-selection {
  fill: var(--accent);
  fill-opacity: 0.15;
  stroke: var(--accent);
  stroke-width: 1;
  pointer-events: none;
}

.chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-unit {
  font-size: 10px;
}

/* Series colours: each mark takes its series' colour through --c. */
.series-0 { --c: var(--series-0); }
.series-1 { --c: var(--series-1); }
.series-2 { --c: var(--series-2); }
.series-3 { --c: var(--series-3); }
.series-4 { --c: var(--series-4); }
.series-5 { --c: var(--series-5); }
.series-6 { --c: var(--series-6); }
.series-7 { --c: var(--series-7); }

.chart-band {
  fill: var(--c, var(--accent));
  fill-opacity: 0.16;
}

.chart-line {
  fill: none;
  stroke: var(--c, var(--accent));
  stroke-width: 2;
  stroke-linejoin: round;
}

.chart-line.dashed {
  stroke-dasharray: 6 3;
}

.chart-dot {
  fill: var(--c, var(--accent));
}

.chart-bar {
  fill: var(--c, var(--accent));
}

.chart-bar.dashed {
  fill-opacity: 0.55;
}

/* Box plots: whisker from minimum to maximum, box over the quartiles (dashed
   when estimated from the mean and standard deviation), median, mean. */
.chart-whisker {
  stroke: var(--c, var(--accent));
  stroke-width: 1;
}

.chart-box {
  fill: var(--c, var(--accent));
  fill-opacity: 0.18;
  stroke: var(--c, var(--accent));
  stroke-width: 1.2;
}

.chart-box.estimated {
  fill-opacity: 0.06;
  stroke-dasharray: 3 2;
}

.chart-median {
  stroke: var(--c, var(--accent));
  stroke-width: 2;
}

.chart-mean {
  fill: var(--surface);
  stroke: var(--c, var(--accent));
  stroke-width: 1.2;
}

.chart-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.chart-panel {
  grid-column: span 2;
  min-width: 0;
}

/* Half-width panels sit side by side on wide screens. */
@media (min-width: 900px) {
  .chart-panel.half {
    grid-column: span 1;
  }
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
}

.legend-entry {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--c, var(--accent));
}

.legend-swatch.dashed {
  background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px);
}

.chart-note {
  margin-top: 2px;
}

.chart-editor .card-head {
  padding: 0;
}

.chart-edit-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin: 10px 0;
  background: var(--surface-2);
}

.chart-edit-periods {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 8px;
}

.chart-edit-period {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-edit-period label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chart-edit-period input[type="checkbox"] {
  width: auto;
}

.chart-edit-period select {
  width: auto;
}

.chart-edit-preview-tab {
  width: auto;
}

.chart-edit-series {
  display: grid;
  gap: 6px;
  margin: 8px 0;
}

.chart-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}

.chart-edit-row label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}

.chart-edit-row select,
.chart-edit-row input {
  width: auto;
}

/* The colour picker shows its colour as a stripe and in its options. */
.chart-edit-row select.colour-pick {
  border-left: 8px solid var(--c);
}

/* A caption with a tooltip says so with the cursor. */
label[title],
.stat[title],
.legend span[title],
.help[title] {
  cursor: help;
}

label[title] :is(input, select, textarea) {
  cursor: auto;
}

.help[title] {
  text-decoration: underline dotted;
}

.chart-hover {
  fill: transparent;
}

.chart-hover:hover {
  fill: var(--text);
  fill-opacity: 0.06;
}

.class-option {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--muted);
}
