/*
 * HamX look on top of Tabler's dark theme (D-028, docs/versions/v0.1.1.md "Look").
 *
 * The colours and sizes follow NetBox's styles (netbox/project-static/styles/,
 * https://github.com/netbox-community/netbox), Copyright NetBox Labs, Apache License 2.0;
 * the values are translated from SCSS into plain CSS variables here.
 */

/* Colour tokens of the Look section. */
:root {
  --hamx-bg: #001423;
  --hamx-sidebar-bg:
    linear-gradient(180deg, rgba(77, 196, 232, 0) 0%, rgba(77, 196, 232, 0.1) 100%), #001423;
  --hamx-sidebar-active: #12323d;
  --hamx-card: #081b2a;
  --hamx-card-header: #1e2836;
  --hamx-input: #111827;
  --hamx-border: #1f2d3d;
  --hamx-text: #dbe2ea;
  --hamx-text-muted: #8a96a3;
  --hamx-accent: #4dc4e8;
  --hamx-info: #4f63e7;
  --hamx-purple: #ad3dc7;
  --hamx-warning: #f59e00;
  --hamx-danger: #d53838;
  --hamx-success: #2fb243;
  --hamx-blue: #4299e1;

  /* Spot status colours (D-093), used from v0.2. */
  --hamx-status-new: var(--hamx-danger);
  --hamx-status-worked: var(--hamx-warning);
  --hamx-status-confirmed: var(--hamx-success);
  --hamx-status-validated: var(--hamx-blue);
  --hamx-lookup-empty: #2a3a4a;

  /* Counts and bar charts: heat cells and bars, per user from v0.3 (status-colors.css). */
  --hamx-heat: var(--hamx-accent);

  /* Mode group colours: the QSO Charts pie and the QSO Map layers (v0.3). */
  --hamx-mode-phone: var(--hamx-danger);
  --hamx-mode-cw: var(--hamx-warning);
  --hamx-mode-digital: var(--hamx-accent);
  /* The edge of a QSO Map marker, so markers of one colour stay apart. */
  --hamx-marker-edge: rgb(0 0 0 / 55%);

  /* Text on a status colour (map markers); the per-user stylesheet makes it dark on a light colour. */
  --hamx-status-new-text: #fff;
  --hamx-status-worked-text: #fff;
  --hamx-status-confirmed-text: #fff;

  /* Table cells: the tint strength and the status letter; per user from v0.3 (D-146). */
  --hamx-status-tint: 45%;
  --hamx-status-new-letter: none;
  --hamx-status-worked-letter: none;
  --hamx-status-confirmed-letter: none;
  --hamx-status-validated-letter: none;

  /* Component sizes. */
  --hamx-font-size: 14px;
  --hamx-menu-font-size: 15px;
  --hamx-title-font-size: 20px;
  --hamx-label-font-size: 11px;
  --hamx-label-spacing: 0.04em;
  --hamx-sidebar-width: 15rem;
  --hamx-row-height: 32px;
}

/*
 * Tabler's own variables point at the tokens, so its components take the HamX colours
 * without extra classes. HamX is dark only, so plain values replace Tabler's light-dark().
 */
:root,
[data-bs-theme="dark"] {
  color-scheme: dark;
  --tblr-font-sans-serif: InterVariable, Inter, system-ui, sans-serif;
  --tblr-body-font-size: var(--hamx-font-size);
  --tblr-body-bg: var(--hamx-bg);
  --tblr-body-bg-rgb: 0, 20, 35;
  --tblr-body-color: var(--hamx-text);
  --tblr-body-color-rgb: 219, 226, 234;
  --tblr-bg-surface: var(--hamx-card);
  --tblr-bg-surface-secondary: var(--hamx-card-header);
  --tblr-bg-forms: var(--hamx-input);
  --tblr-border-color: var(--hamx-border);
  --tblr-secondary: var(--hamx-text-muted);
  --tblr-secondary-color: var(--hamx-text-muted);
  --tblr-secondary-color-rgb: 138, 150, 163;
  --tblr-link-color: var(--hamx-accent);
  --tblr-link-color-rgb: 77, 196, 232;
  --tblr-link-hover-color: var(--hamx-accent);
  --tblr-link-hover-color-rgb: 77, 196, 232;
  --tblr-primary: var(--hamx-accent);
  --tblr-primary-rgb: 77, 196, 232;
  --tblr-primary-fg: var(--hamx-bg);
  --tblr-info: var(--hamx-info);
  --tblr-info-rgb: 79, 99, 231;
  --tblr-purple: var(--hamx-purple);
  --tblr-purple-rgb: 173, 61, 199;
  --tblr-warning: var(--hamx-warning);
  --tblr-warning-rgb: 245, 158, 0;
  --tblr-danger: var(--hamx-danger);
  --tblr-danger-rgb: 213, 56, 56;
  --tblr-success: var(--hamx-success);
  --tblr-success-rgb: 47, 178, 67;
  --tblr-blue: var(--hamx-blue);
  --tblr-blue-rgb: 66, 153, 225;

  /* Tabulator's Bootstrap 5 theme reads Bootstrap's variable names, which Tabler renames. */
  --bs-body-bg: var(--hamx-card);
  --bs-body-color: var(--hamx-text);
  --bs-border-color: var(--hamx-border);
  --bs-emphasis-color: #fff;
  --bs-primary-border-subtle: var(--hamx-accent);
  --bs-secondary-bg: var(--hamx-card-header);
  --bs-secondary-color: var(--hamx-text-muted);
  --bs-tertiary-bg: var(--hamx-sidebar-active);
  --bs-tertiary-color: var(--hamx-text-muted);
}

/* Selected text in the accent colour, as NetBox. */
::selection {
  background-color: rgba(77, 196, 232, 0.48);
}

body {
  background: var(--hamx-bg);
  color: var(--hamx-text);
  font-family: var(--tblr-font-sans-serif);
  font-size: var(--hamx-font-size);
}

.hamx-accent {
  color: var(--hamx-accent);
}

/* Layout: the left menu, and the top bar, content and footer beside it. */
.hamx-layout {
  display: flex;
  min-height: 100vh;
}

.hamx-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.hamx-content {
  flex: 1 0 auto;
  padding: 1.25rem 1.5rem;
}

.hamx-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid var(--hamx-border);
  color: var(--hamx-text-muted);
  font-size: 12px;
  text-align: right;
}

/* Logo: the mark with the wordmark and byline, or the mark alone. */
.hamx-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.hamx-logo-mark {
  width: 2.5rem;
  height: 2.5rem;
}

.hamx-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.hamx-logo-wordmark {
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.hamx-logo-byline {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  font-weight: 300;
  letter-spacing: 0.08em;
}

.hamx-logo-author {
  font-style: italic;
}

/*
 * Left menu, after NetBox's transitional/_navigation.scss: accent gradient, accent headings,
 * an accent bar on the open item and a lighter background on the current subitem.
 */
.hamx-sidebar {
  position: sticky;
  top: 0;
  z-index: 1030;
  display: flex;
  flex: 0 0 var(--hamx-sidebar-width);
  flex-direction: column;
  width: var(--hamx-sidebar-width);
  height: 100vh;
  background: var(--hamx-sidebar-bg);
  border-right: 1px solid var(--hamx-border);
}

.hamx-sidebar-logo {
  display: flex;
  justify-content: center;
  padding: 1.25rem 1rem 1rem;
  text-decoration: none;
}

.hamx-sidebar-logo:hover {
  text-decoration: none;
}

.hamx-logo-small {
  display: none;
}

.hamx-menu {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.hamx-menu-item {
  border-left: 3px solid transparent;
}

.hamx-menu-item[open] {
  border-left-color: var(--hamx-accent);
}

/* An item without a submenu (Home) is a plain link, marked on its own page. */
.hamx-menu-plain.current {
  border-left-color: var(--hamx-accent);
}

.hamx-menu-plain .hamx-menu-link {
  text-decoration: none;
}

.hamx-menu-plain.current .hamx-menu-link {
  color: #fff;
}

.hamx-menu-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 0.6rem calc(1.25rem - 3px);
  color: var(--hamx-text);
  cursor: pointer;
  font-size: var(--hamx-menu-font-size);
  list-style: none;
  user-select: none;
}

.hamx-menu-link::-webkit-details-marker {
  display: none;
}

.hamx-menu-link:hover {
  color: #fff;
}

.hamx-menu-icon {
  flex: 0 0 auto;
  font-size: 1.25rem;
}

.hamx-menu-label {
  flex: 1 1 auto;
  white-space: nowrap;
}

.hamx-menu-chevron {
  color: var(--hamx-text-muted);
  font-size: 0.9rem;
  transition: transform 0.15s;
}

.hamx-menu-item[open] .hamx-menu-chevron {
  transform: rotate(90deg);
}

.hamx-submenu {
  padding-bottom: 0.5rem;
}

/* The item name at the top of a flyout panel; only the collapsed menu shows it. */
.hamx-submenu-title {
  display: none;
}

.hamx-menu-heading {
  padding: 0.75rem 1rem 0.25rem calc(3.25rem - 3px);
  color: var(--hamx-accent);
  font-size: var(--hamx-label-font-size);
  font-weight: 700;
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-menu-entry {
  display: flex;
  align-items: center;
  margin: 0 0.5rem 0 0;
  border-radius: 0 4px 4px 0;
}

.hamx-menu-entry-link {
  flex: 1 1 auto;
  padding: 0.35rem 0.5rem 0.35rem calc(3.25rem - 3px);
  color: var(--hamx-text);
  text-decoration: none;
}

.hamx-menu-entry-link:hover {
  color: #fff;
  text-decoration: none;
}

.hamx-menu-entry:hover,
.hamx-menu-entry.active {
  background-color: var(--hamx-sidebar-active);
}

.hamx-menu-entry-coming .hamx-menu-entry-link {
  color: var(--hamx-text-muted);
  font-style: italic;
}

.hamx-menu-entry-coming:hover {
  background-color: transparent;
}

.hamx-sidebar-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  text-align: left;
  color: var(--hamx-text-muted);
  background: none;
  border: none;
  border-top: 1px solid var(--hamx-border);
  font-size: var(--hamx-font-size);
}

.hamx-sidebar-toggle:hover {
  color: var(--hamx-text);
}

.hamx-sidebar-toggle .ti {
  font-size: 1.25rem;
}

.hamx-toggle-expand {
  display: none;
}

.hamx-sidebar-backdrop {
  display: none;
}

/* The collapsed menu (computer only): icons, and a flyout panel beside the open item. */
@media (min-width: 992px) {
  .sidebar-collapsed .hamx-sidebar {
    flex-basis: 4.5rem;
    width: 4.5rem;
  }

  .sidebar-collapsed .hamx-logo-full,
  .sidebar-collapsed .hamx-menu-label,
  .sidebar-collapsed .hamx-menu-chevron,
  .sidebar-collapsed .hamx-toggle-collapse {
    display: none;
  }

  .sidebar-collapsed .hamx-logo-small,
  .sidebar-collapsed .hamx-toggle-expand {
    display: inline;
  }

  .sidebar-collapsed .hamx-sidebar-logo {
    padding: 1.25rem 0.5rem 1rem;
  }

  .sidebar-collapsed .hamx-menu {
    overflow: visible;
  }

  .sidebar-collapsed .hamx-menu-item {
    position: relative;
  }

  .sidebar-collapsed .hamx-menu-item.current {
    border-left-color: var(--hamx-accent);
  }

  .sidebar-collapsed .hamx-menu-link {
    justify-content: center;
    padding: 0.7rem 0;
  }

  .sidebar-collapsed .hamx-submenu {
    position: absolute;
    top: 0;
    left: calc(4.5rem - 3px);
    min-width: 14rem;
    padding: 0.25rem 0 0.5rem;
    background: var(--hamx-card);
    border: 1px solid var(--hamx-border);
    border-left: 3px solid var(--hamx-accent);
    border-radius: 0 6px 6px 0;
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
  }

  .sidebar-collapsed .hamx-submenu-title {
    display: block;
    padding: 0.5rem 1rem;
    color: #fff;
    font-weight: 600;
    text-decoration: none;
  }

  .sidebar-collapsed .hamx-submenu-title:hover {
    color: var(--hamx-accent);
  }

  .sidebar-collapsed .hamx-menu-heading,
  .sidebar-collapsed .hamx-menu-entry-link {
    padding-left: 1rem;
  }

  .sidebar-collapsed .hamx-sidebar-toggle {
    justify-content: center;
    padding: 0.75rem 0;
  }
}

/* Phones and small tablets (D-005): the menu slides in over the page. */
@media (max-width: 991.98px) {
  .hamx-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    transition: transform 0.2s;
  }

  .sidebar-open .hamx-sidebar {
    transform: none;
  }

  .sidebar-open .hamx-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1029;
    display: block;
    background: rgba(0, 0, 0, 0.5);
  }

  .hamx-sidebar-toggle {
    display: none;
  }

  .hamx-content {
    padding: 1rem;
  }
}

/* Top bar: phone menu button on the left; clock and user menu on the right. */
.hamx-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.5rem 1.5rem;
  background: var(--hamx-bg);
  border-bottom: 1px solid var(--hamx-border);
}

.hamx-phone-menu-button {
  display: none;
  padding: 0.25rem 0.5rem;
  color: var(--hamx-text);
  background: none;
  border: none;
  font-size: 1.5rem;
}

@media (max-width: 991.98px) {
  .hamx-phone-menu-button {
    display: inline-block;
  }

  .hamx-topbar {
    padding: 0.5rem 1rem;
  }
}

/* Status badges of the live sources: the source's name on the colour of its state. */
.hamx-source-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.hamx-source-badge {
  padding: 0.2rem 0.6rem;
  color: #fff;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.hamx-source-badge:hover {
  color: #fff;
  text-decoration: none;
}

.hamx-source-badge.is-connected {
  background-color: var(--hamx-success);
}

.hamx-source-badge.is-disconnected {
  background-color: var(--hamx-danger);
}

.hamx-source-badge.is-stale {
  color: var(--hamx-bg);
  background-color: var(--hamx-warning);
}

.hamx-source-badge.is-disabled {
  color: var(--hamx-text-muted);
  background-color: var(--hamx-card-header);
}

.hamx-topbar-end {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-left: auto;
}

/* The bookmark star (v0.3.5, D-191), next to the clock. */
.hamx-bookmark-button {
  display: flex;
  align-items: center;
  padding: 0.25rem;
  color: var(--hamx-text);
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 1.25rem;
}

.hamx-bookmark-button:hover {
  background-color: var(--hamx-sidebar-active);
}

.hamx-bookmark-on {
  color: var(--hamx-warning);
}

/* A form in the link-menu look: room around the fields instead of the items' padding. */
.hamx-link-menu.hamx-bookmark-menu {
  width: 18rem;
  padding: 0.75rem;
}

.hamx-bookmark-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* The bookmarks menu (D-238): up to 50 bookmarks scroll inside the window. */
.hamx-bookmarks-list {
  max-width: 24rem;
  max-height: 70vh;
  overflow-y: auto;
}

.hamx-bookmarks-list .dropdown-item {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* User Config → Bookmarks: a long address wraps instead of widening the table. */
.hamx-bookmark-address {
  word-break: break-all;
}

.hamx-clock {
  color: var(--hamx-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hamx-user-button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.25rem 0.5rem;
  color: var(--hamx-text);
  background: none;
  border: none;
  border-radius: 6px;
  text-align: left;
}

.hamx-user-button:hover {
  background-color: var(--hamx-sidebar-active);
}

.hamx-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  color: var(--hamx-bg);
  background-color: var(--hamx-accent);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.hamx-user-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.hamx-user-callsign {
  font-weight: 600;
}

.hamx-user-role {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

.hamx-user-menu form {
  margin: 0;
}

.hamx-user-menu button.dropdown-item {
  width: 100%;
}

/* Page header: the "Item · Heading" line or a back link, the title, and the buttons. */
.hamx-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
}

.hamx-page-heading {
  flex: 1 1 20rem;
  min-width: 0;
}

.hamx-page-pretitle {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-page-back {
  font-size: 13px;
}

.hamx-page-title {
  margin: 0.15rem 0 0;
  color: #fff;
  font-size: var(--hamx-title-font-size);
  font-weight: 600;
}

.hamx-page-subtitle {
  color: var(--hamx-text-muted);
}

.hamx-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-left: auto;
}

/* The filter buttons show only their icon; the text is in the tooltip (D-169). */
.btn.hamx-icon-only .icon {
  margin: 0;
}

/*
 * The grey buttons, pointed at, pressed (Show filters while the lists show) or with their
 * menu open, take the dark grey of a table row pointed at, not Tabler's light grey.
 */
.btn-outline-secondary.hamx-icon-only:hover,
.btn-outline-secondary.hamx-icon-only:focus-visible,
.btn-outline-secondary.hamx-icon-only.active,
.btn-outline-secondary.hamx-icon-only.show {
  color: var(--hamx-text);
  background-color: var(--hamx-sidebar-active);
  border-color: var(--tblr-btn-border-color);
}

.hamx-page-actions form {
  margin: 0;
}

.btn-primary {
  color: var(--hamx-bg);
}

.btn-warning {
  color: var(--hamx-bg);
}

/* Tabs: the active tab is a raised box joined to the content below. */
.hamx-tabs {
  margin: -0.5rem 0 1.25rem;
  border-bottom: 1px solid var(--hamx-border);
}

.hamx-tabs .nav-link {
  color: var(--hamx-text-muted);
}

.hamx-tabs .nav-link.active {
  color: #fff;
  background-color: var(--hamx-card);
  border-color: var(--hamx-border) var(--hamx-border) var(--hamx-card);
}

.hamx-tab-count {
  margin-left: 0.4rem;
  color: var(--hamx-text);
  background-color: var(--hamx-card-header);
}

/* Cards: a lighter header strip with a small bold title, so each card reads as a box. */
.card {
  background-color: var(--hamx-card);
  border-color: var(--hamx-border);
}

.card-header {
  min-height: 0;
  padding: 0.6rem 1rem;
  background-color: var(--hamx-card-header);
  border-bottom-color: var(--hamx-border);
}

.card-title {
  font-size: 13px;
  font-weight: 700;
}

/* Badges: small rounded pills in the colour tokens. */
.badge {
  border-radius: 999px;
}

.hamx-badge-coming {
  color: var(--hamx-text-muted);
  background-color: var(--hamx-card);
  border: 1px solid var(--hamx-border);
}

/*
 * Horizontal forms (Settings, User Config): the label right-aligned on the left, the field
 * with its help text on the right, and on Settings pages the sys_setting key below.
 */
.hamx-form-page {
  max-width: 60rem;
}

.hamx-form-row {
  margin-bottom: 1rem;
}

.hamx-form-row:last-child {
  margin-bottom: 0;
}

.hamx-form-row .col-form-label {
  color: var(--hamx-text);
  font-weight: 500;
}

/* No float: the help text and setting key go below the box, not beside it. */
.hamx-form-check {
  display: flex;
  min-height: 0;
  padding-top: calc(0.4375rem + 1px);
  padding-left: 0;
}

.hamx-form-check .form-check-input {
  float: none;
  margin: 0;
}

/* A list of tick boxes: each box with its label, in aligned columns. */
.hamx-check-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.35rem 1rem;
  padding-top: calc(0.4375rem + 1px);
}

.hamx-check-list-item {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  min-height: 0;
  margin: 0;
  padding-left: 0;
  white-space: nowrap;
}

.hamx-check-list-item .form-check-input {
  float: none;
  margin: 0;
}

.hamx-form-help {
  margin-top: 0.25rem;
  color: var(--hamx-text-muted);
  font-size: 12px;
}

.hamx-setting-key {
  margin-top: 0.15rem;
  color: var(--hamx-text-muted);
  font-family: var(--tblr-font-monospace);
  font-size: 10px;
  opacity: 0.8;
}

/* Save and Cancel stay at the bottom of the window while a long form scrolls. */
.hamx-save-bar {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background-color: var(--hamx-card-header);
  border: 1px solid var(--hamx-border);
  border-radius: var(--tblr-border-radius);
}

/*
 * Plain HTML tables in a card, in the same style as the Tabulator tables: header strip in
 * the page colour with small grey capitals, compact rows on the card, no line under the
 * last row.
 */
.hamx-table {
  --tblr-table-bg: var(--hamx-card);
  --tblr-table-hover-bg: var(--hamx-sidebar-active);
  margin-bottom: 0;
}

.hamx-table > thead > tr > th {
  padding: 0.5rem 0.75rem;
  color: var(--hamx-text-muted);
  background-color: var(--hamx-bg);
  border-bottom: 1px solid var(--hamx-border);
  font-size: var(--hamx-label-font-size);
  font-weight: 600;
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-table > tbody > tr > td {
  height: var(--hamx-row-height);
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid var(--hamx-border);
}

.hamx-table > tbody > tr:last-child > td {
  border-bottom: none;
}

/* Key/value cards: the label on the left, the value on the right, hairlines between. */
.hamx-key-values {
  --tblr-table-bg: var(--hamx-card);
  margin-bottom: 0;
}

.hamx-key-values th,
.hamx-key-values td {
  padding: 0.5rem 1rem;
  border-bottom: 1px dashed var(--hamx-border);
}

.hamx-key-values th {
  width: 40%;
  color: var(--hamx-text);
  font-weight: 500;
}

.hamx-key-values tr:last-child > th,
.hamx-key-values tr:last-child > td {
  border-bottom: none;
}

/* A filter row above a table in the same card. */
.hamx-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.hamx-filter-bar .form-label {
  margin-bottom: 0.25rem;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

/* Text at the right end of a filter row, e.g. the active bandplan. */
.hamx-filter-note {
  align-self: center;
  margin-left: auto;
  color: var(--hamx-text-muted);
}

/* Edit and delete icons at the end of a server-drawn table row. */
.hamx-row-icons {
  display: inline-flex;
  gap: 0.25rem;
}

.hamx-row-icons form {
  margin: 0;
}

.hamx-row-icons .btn-icon {
  width: 1.5rem;
  height: 1.5rem;
  min-height: 0;
  padding: 0;
  font-size: 0.85rem;
}

/* Rows of the compared bandplan are muted, so the shown bandplan stands out. */
.hamx-compared-row > td {
  color: var(--hamx-text-muted);
}

.hamx-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Messages under the page header. */
.alert {
  background-color: var(--hamx-card);
}

/* Info notes: a lighter indigo, so the text reads well on the dark card. */
.alert-info {
  --tblr-alert-color: #8f9cf2;
}

/* The note above a read-only table that a data source fills. */
.hamx-source-note {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.hamx-source-note .alert-icon {
  margin: 0.1rem 0 0;
}

/*
 * Tables (Tabulator): compact rows, uppercase grey header, hairlines and no stripes.
 * The colours come from the --bs-* variables above; the header text needs the same
 * selector weight as Tabulator's dark rule to be muted.
 */
.tabulator {
  border: none;
  font-size: var(--hamx-font-size);
}

[data-bs-theme="dark"] .tabulator:not(.thead-light) .tabulator-header,
[data-bs-theme="dark"] .tabulator:not(.thead-light) .tabulator-header .tabulator-col {
  color: var(--hamx-text-muted);
}

.tabulator .tabulator-header {
  border-top: none;
  border-bottom: 1px solid var(--hamx-border);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.tabulator-row {
  min-height: var(--hamx-row-height);
  border-bottom: 1px solid var(--hamx-border);
}

.tabulator-row .tabulator-cell {
  padding: 0.4rem 0.5rem;
  border-right: none;
}

/*
 * Manage Tables: the table sits in a card, its header strip in the page colour (NetBox's
 * .table thead th is $rich-black), a quick search above it and Delete Selected below it.
 */
.hamx-table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
}

.hamx-quick-search {
  flex: 0 1 20rem;
}

.hamx-table-card .tabulator,
.hamx-table-card .tabulator .tabulator-tableholder,
.hamx-table-card .tabulator .tabulator-row {
  background-color: var(--hamx-card);
}

.hamx-table-card .tabulator .tabulator-header,
.hamx-table-card .tabulator .tabulator-header .tabulator-col {
  background-color: var(--hamx-bg);
}

.hamx-table-card .tabulator .tabulator-row.tabulator-selected {
  background-color: var(--hamx-sidebar-active);
}

.hamx-table-card .tabulator .tabulator-row:last-child {
  border-bottom: none;
}

.hamx-table-card .tabulator .tabulator-footer {
  color: var(--hamx-text-muted);
  background-color: var(--hamx-card);
  border-top: 1px solid var(--hamx-border);
}

.hamx-table-card .tabulator .tabulator-row .tabulator-cell.hamx-row-actions {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.hamx-row-actions .btn-icon {
  width: 1.5rem;
  height: 1.5rem;
  min-height: 0;
  margin-left: 0.25rem;
  padding: 0;
  font-size: 0.85rem;
}

.hamx-bulk-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Data Sources: long download addresses wrap; file samples keep their columns. */
.source-url {
  overflow-wrap: anywhere;
}

.file-sample {
  font-size: 0.8rem;
  white-space: pre;
  overflow-x: auto;
}

/* Bandplan page: one strip per band, coloured by mode group (docs/bandplan.md). */
/* 80 % of the page is wide enough on a computer; a phone uses the whole width. */
@media (min-width: 992px) {
  .band-strips {
    max-width: 80%;
  }
}

.band-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  margin-bottom: 0.5rem;
}

.band-strip-label {
  width: 11rem;
}

.band-strip-bars {
  flex: 1 1 20rem;
}

.band-strip-svg {
  display: block;
  width: 100%;
  height: 1.25rem;
}

.legend-box {
  display: inline-block;
  width: 1rem;
  height: 0.75rem;
  vertical-align: middle;
}

.segment-cw {
  fill: var(--hamx-warning);
  background-color: var(--hamx-warning);
}

.segment-phone {
  fill: var(--hamx-danger);
  background-color: var(--hamx-danger);
}

.segment-digital {
  fill: var(--hamx-blue);
  background-color: var(--hamx-blue);
}

.segment-all {
  fill: var(--hamx-text-muted);
  background-color: var(--hamx-text-muted);
}

.strip-gap {
  fill: var(--hamx-bg);
  background-color: var(--hamx-bg);
  outline: 1px solid var(--hamx-border);
}

.special-mark {
  fill: #dee2e6;
  background-color: #dee2e6;
}

/* System Logs: long messages and tracebacks wrap and keep their line breaks. */
.log-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/*
 * Pages with one centred card (narrow.html): login, password pages, web setup, 403, 404.
 * Outside the menu layout the page has the menu's accent gradient and the logo on top.
 */
.hamx-public {
  min-height: 100vh;
  background: var(--hamx-sidebar-bg);
}

.hamx-narrow {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.hamx-narrow-inside {
  min-height: 60vh;
}

.hamx-narrow-box {
  width: 100%;
  max-width: 26rem;
}

.hamx-narrow-wide {
  max-width: 46rem;
}

.hamx-narrow-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.hamx-narrow-logo .hamx-logo-mark {
  width: 3.5rem;
  height: 3.5rem;
}

.hamx-narrow-logo .hamx-logo-wordmark {
  font-size: 2.25rem;
}

.hamx-narrow-logo .hamx-logo-byline {
  font-size: 12px;
}

.hamx-narrow-body {
  padding: 1.75rem;
}

.hamx-narrow-title {
  margin-bottom: 1rem;
  color: #fff;
  font-size: var(--hamx-title-font-size);
  font-weight: 600;
}

/* The setup step indicator (Tabler steps) in the accent colour. */
.hamx-setup-steps {
  --tblr-steps-color: var(--hamx-accent);
  margin: 0 0 1.75rem;
}

/* On a phone only the current step keeps its name; the others show their number. */
@media (max-width: 575.98px) {
  .hamx-setup-steps .step-item:not(.active) .hamx-step-label {
    display: none;
  }
}

/* --- Dashboards (v0.2 step 8) ------------------------------------------------------- */

/* GridStack's margin is the gap; the card fills its cell. */
.hamx-dashboard {
  margin: 0 -6px;
}

.hamx-widget {
  height: 100%;
  margin: 0;
}

.hamx-widget-header {
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.35rem 0.75rem;
}

.hamx-widget-title {
  overflow: hidden;
  font-size: 0.95rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The filter icon of a widget's own filters (the Logbook Table's QSL filters, D-181); its
   tooltip lists them. */
.hamx-widget-note {
  flex: none;
  color: var(--hamx-accent);
  font-size: 0.85rem;
  cursor: help;
}

/* Widgets scroll inside their card; tables scroll sideways on a phone. */
.hamx-widget-body {
  overflow: auto;
  padding: 0.5rem 0.75rem;
}

/* A Separator (D-151) is its frame only: an optional title and a line across, centred in
   its height; the whole frame is the drag handle in edit mode. */
.hamx-separator {
  display: flex;
  align-items: center;
}

/* A one-row Separator is 28 px high: no header height or padding of its own. */
.hamx-separator-header {
  display: flex;
  flex: 1;
  align-items: center;
  min-height: 0;
  padding: 0 0.5rem;
}

.hamx-separator-title {
  margin: 0;
  color: var(--hamx-text-muted);
  font-size: 1rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hamx-separator-title:empty {
  display: none;
}

.hamx-separator-line {
  flex: 1;
  border-top: 1px solid var(--hamx-border);
}

/* The title on the left, centred or on the right: the line on its other side, or both. */
.hamx-separator[data-align="left"] .hamx-separator-line.is-before,
.hamx-separator[data-align="right"] .hamx-separator-line.is-after {
  display: none;
}

/* Without a title one line goes across, whatever the alignment. */
.hamx-separator:has(.hamx-separator-title:empty) .hamx-separator-line.is-before {
  display: none;
}

.hamx-separator:has(.hamx-separator-title:empty) .hamx-separator-line.is-after {
  display: block;
}

/* The refresh indicator turns while the widget loads. */
.hamx-widget-indicator {
  color: var(--hamx-text-muted);
  font-size: 0.85rem;
  visibility: hidden;
}

.hamx-widget.is-loading .hamx-widget-indicator {
  visibility: visible;
  animation: hamx-spin 1s linear infinite;
}

@keyframes hamx-spin {
  to {
    transform: rotate(360deg);
  }
}

/* In edit mode the header is the drag handle and the grid shows its cells. */
.hamx-editing .hamx-widget-header {
  cursor: move;
}

.hamx-editing .hamx-widget {
  outline: 1px dashed var(--hamx-accent);
}

/* The resize handles lie above a map: Leaflet's panes (z-index 400) and controls (1000)
   would otherwise cover them, and the QSO Map's canvas takes every click on its area. */
.hamx-editing .grid-stack-item > .ui-resizable-handle {
  z-index: 1001;
}

.hamx-widget-placeholder {
  font-size: 0.9rem;
}


/* A form inside a scrolling dialog passes the height limit on, so its body scrolls. */
.hamx-modal-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}

/* Groups of a long form, each under a small heading. */
.hamx-form-section + .hamx-form-section {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--hamx-border);
}

.hamx-form-section-title {
  margin-bottom: 0.75rem;
  color: var(--hamx-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* A section's explanation, above its fields (the QSL filters, D-181). */
.hamx-form-section-intro {
  margin-top: -0.25rem;
  margin-bottom: 0.75rem;
}

/* Layout editing is for a computer (D-005). */
@media (max-width: 991.98px) {
  .hamx-dashboard-edit {
    display: none;
  }
}

/* --- Filter bar (v0.2 step 9) ------------------------------------------------------- */

/* The time range sits next to the dashboard title. */
.hamx-dashboard-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
}

.hamx-time-range {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

/* The quick search next to the time range (D-121). */
.hamx-dashboard-search {
  width: 14rem;
  max-width: 100%;
}

.hamx-time-range > .form-select {
  width: auto;
  min-width: 9rem;
}

.hamx-time-range-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.hamx-time-range-custom .form-control {
  width: auto;
}

/* On a computer the panel is a row of filters; on a phone it is an off-canvas panel. */
.hamx-filter-panel {
  margin-bottom: 0.5rem;
}

@media (min-width: 992px) {
  .hamx-filter-panel .offcanvas-body {
    padding: 0;
  }

  /* Hidden with the Filters button; the time range and the chips stay. */
  .hamx-filters-hidden .hamx-filter-panel {
    display: none;
  }
}

.hamx-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: flex-end;
}

.hamx-filter {
  width: 11rem;
}

.hamx-filter-label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--hamx-text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

@media (max-width: 991.98px) {
  .hamx-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .hamx-filter {
    width: 100%;
  }
}

/* Chips: one per filter value set, with an x that removes it. */
.hamx-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  margin-bottom: 0.5rem;
}

.hamx-chip {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  padding: 0.1rem 0.55rem;
  border: 1px solid var(--hamx-border);
  border-radius: 1rem;
  background: var(--hamx-card-header);
  color: var(--hamx-text);
  font-size: 0.8rem;
  text-decoration: none;
}

.hamx-chip:hover {
  border-color: var(--hamx-accent);
  color: var(--hamx-text);
}

.hamx-chip-label {
  color: var(--hamx-text-muted);
}

.hamx-chip-clear {
  margin-left: 0.35rem;
  font-size: 0.8rem;
}

/* Filters off (D-150): the chips are kept but not applied. */
.hamx-filters-off .hamx-chip {
  opacity: 0.55;
  text-decoration: line-through;
}

.hamx-filters-off-note {
  color: var(--bs-warning);
  font-size: 0.8rem;
  font-weight: 600;
}

/* Choose filters: the grip a filter is dragged by. */
.hamx-drag-handle {
  color: var(--hamx-text-muted);
  cursor: grab;
}

/* Tom Select on the HamX tokens; its Bootstrap theme reads --bs-* names Tabler does not set. */
.ts-wrapper .ts-control,
.ts-wrapper.single.input-active .ts-control {
  border-color: var(--hamx-border);
  background: var(--hamx-input);
  color: var(--hamx-text);
}

.ts-wrapper.focus .ts-control {
  border-color: var(--hamx-accent);
  box-shadow: none;
}

.ts-wrapper .ts-control input {
  color: var(--hamx-text);
}

.ts-wrapper.multi .ts-control > .item {
  border: 0;
  background: var(--hamx-card-header);
  color: var(--hamx-text);
}

/* The x of an item without the line Tom Select draws before it; its own rule has :not(.rtl),
   so this one names it too to win. */
.ts-wrapper.plugin-remove_button:not(.rtl) .item .remove,
.ts-wrapper.plugin-remove_button:not(.rtl).disabled .item .remove {
  margin-left: 0.15rem;
  padding: 0 0.3rem;
  border-left: 0;
}

.ts-dropdown {
  z-index: 1060;
  border-color: var(--hamx-border);
  background: var(--hamx-card);
  color: var(--hamx-text);
}

.ts-dropdown .option,
.ts-dropdown .create,
.ts-dropdown .no-results {
  color: var(--hamx-text);
}

.ts-dropdown .active {
  background: var(--hamx-sidebar-active);
  color: #fff;
}

/* The spot counts above the filter chips: label and value pairs in one line. */
.hamx-spot-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  align-items: baseline;
  min-height: 1.5rem;
  margin-bottom: 0.5rem;
}

.hamx-spot-count {
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  white-space: nowrap;
}

.hamx-spot-count-label {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-spot-count-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* A widget whose body is a table fills its card; the table scrolls inside itself. */
.hamx-widget > .hamx-widget-body {
  position: relative;
  min-height: 0;
}

.hamx-widget-body:has(> .hamx-widget-table) {
  padding: 0;
}

/* Room below the last row, so the table does not run into the card edge and the next widget. */
.hamx-widget-table {
  position: absolute;
  inset: 0 0 0.75rem;
}

/* Award Band Status: the DXCC entity picker in the table's place (D-171). */
.hamx-entity-picker {
  max-width: 24rem;
}

.hamx-widget-table-grid {
  height: 100%;
}

.hamx-widget .tabulator,
.hamx-widget .tabulator .tabulator-tableholder,
.hamx-widget .tabulator .tabulator-row,
.hamx-widget .tabulator .tabulator-header,
.hamx-widget .tabulator .tabulator-header .tabulator-col {
  background-color: var(--hamx-card);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell {
  padding: 0.25rem 0.5rem;
  background-color: transparent;
}

.hamx-widget .tabulator-row {
  min-height: 0;
}

/*
 * Header sorting in a widget table: no room is kept for the arrow on every column, so the
 * table stays narrow. Only the sorted column shows a small arrow after its title.
 */
.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title {
  padding-right: 0;
}

.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="none"] .tabulator-col-content .tabulator-col-sorter {
  display: none;
}

.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable:not([aria-sort="none"]) .tabulator-col-title {
  padding-right: 0.75rem;
}

.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable:not([aria-sort="none"]) .tabulator-col-content .tabulator-col-sorter {
  right: 0;
}

.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="ascending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
  border-width: 0 4px 5px;
  border-bottom-color: var(--hamx-accent);
}

.hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort="descending"] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow {
  border-width: 5px 4px 0;
  border-top-color: var(--hamx-accent);
}

@media (hover: hover) and (pointer: fine) {
  .hamx-widget .tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover {
    background-color: var(--hamx-sidebar-active);
  }
}

/*
 * Status colours of cells (D-110): a tint of the status colour, the text stays readable.
 * The selector outweighs the transparent cell background above.
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-status-new {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-status-worked {
  background-color: color-mix(in srgb, var(--hamx-status-worked) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-status-confirmed {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-status-validated {
  background-color: color-mix(in srgb, var(--hamx-status-validated) var(--hamx-status-tint), transparent);
}

/*
 * QSL and upload status cells (D-175) in the Logbook Table: the user's status colours at
 * their strength; the value is the letter, so none is added. The Logbook Browser stays
 * plain (D-179).
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-qsl-confirmed {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-qsl-new {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-qsl-worked {
  background-color: color-mix(in srgb, var(--hamx-status-worked) var(--hamx-status-tint), transparent);
}

/* The status letter after the value of a coloured cell; none when the user switched it off. */
.hamx-widget .tabulator-cell.hamx-status-new::after,
.hamx-status-preview-cell.hamx-status-new::after {
  content: var(--hamx-status-new-letter);
}

.hamx-widget .tabulator-cell.hamx-status-worked::after,
.hamx-status-preview-cell.hamx-status-worked::after {
  content: var(--hamx-status-worked-letter);
}

.hamx-widget .tabulator-cell.hamx-status-confirmed::after,
.hamx-status-preview-cell.hamx-status-confirmed::after {
  content: var(--hamx-status-confirmed-letter);
}

.hamx-widget .tabulator-cell.hamx-status-validated::after {
  content: var(--hamx-status-validated-letter);
}

.hamx-widget .tabulator-cell[class*="hamx-status-"]::after,
.hamx-status-preview-cell::after {
  margin-left: 0.35em;
  font-size: 0.8em;
  font-weight: 700;
  opacity: 0.85;
}

/*
 * Award Band Status band cells: the cell's value is the letter (C, W), on the usual tint, so
 * the letter is not added after it again.
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-status-letter-cell::after {
  content: none;
}

.tabulator-cell.hamx-home-country {
  color: var(--hamx-accent);
  font-weight: 600;
}

/* A cell that sets a filter or opens the country menu, and the callsign that opens its menu. */
.tabulator-cell.hamx-cell-link,
.tabulator-cell[tabulator-field="callsign"] {
  cursor: pointer;
}

.tabulator-cell[tabulator-field="callsign"] {
  color: var(--hamx-accent);
  font-weight: 600;
}

/*
 * Spots new since the last refresh: a soft accent background on every cell that fades out.
 * On the cells, not the row, as the cells cover the row; a status colour comes back after.
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-spot-new {
  animation: hamx-spot-new 4s ease-out;
}

@keyframes hamx-spot-new {
  from {
    background-color: color-mix(in srgb, var(--hamx-accent) 30%, transparent);
  }

  to {
    background-color: transparent;
  }
}

/*
 * The link menu (hamx-link-menu): the look of every dropdown menu in HamX (D-217, D-239):
 * the callsign menu (call-menu.js and the call_menu tag, D-233), the widget, dashboard,
 * template, saved filter, rule and user menus, the bookmark star's form, the bookmarks
 * menu and the column chooser. It is a Tabler dropdown with the card-header background, a
 * border, rounded corners and a shadow. Dialogs, Tom Select lists, map popups and tooltips
 * keep their own look.
 *
 * In a Tabulator table the menu element is itself the popup: Tabulator adds its own
 * tabulator-popup-container class to it, and its dark theme gives that class the page
 * background and its own border (html[data-bs-theme=dark] .tabulator-popup-container). The
 * second selector outranks that rule, so the menu looks the same everywhere.
 */
.hamx-link-menu,
html[data-bs-theme] .hamx-link-menu.tabulator-popup-container {
  min-width: 14rem;
  margin: 0;
  padding: 0.4rem 0;
  color: var(--hamx-text);
  font-size: var(--hamx-font-size);
  background-color: var(--hamx-card-header);
  border: 1px solid var(--hamx-border);
  border-radius: 6px;
  box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 50%);
}

.hamx-link-menu .dropdown-item {
  padding: 0.45rem 1rem;
  color: var(--hamx-text);
}

.hamx-link-menu .dropdown-item:hover,
.hamx-link-menu .dropdown-item:focus {
  color: var(--hamx-text);
  background-color: var(--hamx-sidebar-active);
}

/* The menu floating at a point (call-menu.js openAt): over the maps and the dialogs' backdrop. */
.hamx-call-menu-floating {
  position: fixed;
  z-index: 1070;
}

/* Block also as a span: the call_menu tag's menu is a span, where a div may not stand. */
.hamx-link-menu .dropdown-divider {
  display: block;
  margin: 0.3rem 0;
  border-top: 1px solid var(--hamx-border);
}

/*
 * Band × Continent matrix: compact counts, shaded in five steps of the accent colour. The
 * shades name the td, to outweigh Bootstrap's .table cell background.
 */
.hamx-matrix {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.hamx-matrix th,
.hamx-matrix td {
  padding: 0.2rem 0.4rem;
  text-align: center;
}

.hamx-matrix th[scope="row"] {
  text-align: left;
}

.hamx-matrix a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.hamx-matrix td a:hover,
.hamx-matrix th a:hover {
  text-decoration: underline;
}

.hamx-matrix td.hamx-heat-1 {
  background-color: color-mix(in srgb, var(--hamx-heat) 12%, transparent);
}

.hamx-matrix td.hamx-heat-2 {
  background-color: color-mix(in srgb, var(--hamx-heat) 24%, transparent);
}

.hamx-matrix td.hamx-heat-3 {
  background-color: color-mix(in srgb, var(--hamx-heat) 36%, transparent);
}

.hamx-matrix td.hamx-heat-4 {
  background-color: color-mix(in srgb, var(--hamx-heat) 50%, transparent);
}

.hamx-matrix td.hamx-heat-5 {
  background-color: color-mix(in srgb, var(--hamx-heat) 66%, transparent);
}

/* Watcher Summary matrix: band headers keep the band's own case (17m, not 17M). */
.tabulator .tabulator-header .tabulator-col.hamx-band-column {
  text-transform: none;
}

/* Map widget: Leaflet fills the card; the sea is the page colour, land the outline's. */
.hamx-widget-body:has(> .hamx-map) {
  padding: 0;
}

.hamx-map {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 0 0 6px 6px;
}

.hamx-map-canvas {
  height: 100%;
  background-color: var(--hamx-bg);
}

/* A spot marker: a dot in its status colour, with the number of callsigns when several. */
.hamx-map-spot {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 2px solid rgb(255 255 255 / 80%);
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
}

.hamx-map-cluster {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: 3px solid rgb(255 255 255 / 60%);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
}

.hamx-map-spot.is-new,
.hamx-map-cluster.is-new {
  color: var(--hamx-status-new-text);
  background-color: var(--hamx-status-new);
}

.hamx-map-spot.is-worked,
.hamx-map-cluster.is-worked {
  color: var(--hamx-status-worked-text);
  background-color: var(--hamx-status-worked);
}

.hamx-map-spot.is-confirmed,
.hamx-map-cluster.is-confirmed {
  color: var(--hamx-status-confirmed-text);
  background-color: var(--hamx-status-confirmed);
}

/* The DXCC entities layer: the prefix as a label at the centre of the entity. */
.hamx-map-label {
  position: absolute;
  padding: 0 0.25rem;
  color: #fff;
  background-color: rgb(0 20 35 / 70%);
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  transform: translate(-50%, 0.5rem);
}

/* Popups in the HamX colours. */
.hamx-map .leaflet-popup-content-wrapper,
.hamx-map .leaflet-popup-tip {
  color: var(--hamx-text);
  background-color: var(--hamx-card-header);
}

.hamx-map .leaflet-popup-content {
  margin: 0.6rem 0.8rem;
  font-size: 0.8rem;
}

.hamx-map-popup-title {
  margin-bottom: 0.35rem;
  font-weight: 700;
}

/* The line under a popup that counts the callsigns it does not list. */
.hamx-map-more {
  margin-top: 0.5rem;
  color: var(--hamx-text-muted);
}

.hamx-map-call + .hamx-map-call {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--hamx-border);
}

/* The callsign opens the callsign menu (D-233), as in the Spot Table. */
.hamx-map .leaflet-popup-content a.hamx-map-call-link {
  font-weight: 600;
  text-decoration: none;
}

.hamx-map .leaflet-popup-content a.hamx-map-call-link:hover {
  text-decoration: underline;
}

.hamx-map-details {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 0.6rem;
  margin: 0.2rem 0;
}

.hamx-map-details dt {
  color: var(--hamx-text-muted);
  font-weight: 400;
}

.hamx-map-details dd {
  margin: 0;
}

.hamx-map .leaflet-popup-content a {
  color: var(--hamx-accent);
}

.hamx-map .leaflet-control-layers,
.hamx-map .leaflet-control-attribution,
.hamx-map .leaflet-control-scale-line {
  color: var(--hamx-text);
  background-color: rgb(8 27 42 / 85%);
}

.hamx-map .leaflet-control-attribution a {
  color: var(--hamx-accent);
}

/* Home (v0.2, D-112): facts as label and value pairs, the lookup answer below its form. */
.hamx-home-source {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.hamx-home-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.15rem 1rem;
  margin: 0;
}

.hamx-home-facts dt {
  color: var(--hamx-text-muted);
  font-weight: 400;
}

.hamx-home-facts dd {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.hamx-home-result {
  margin-top: 1rem;
}

.hamx-home-entity {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.hamx-home-flag {
  font-size: 1.25rem;
}

.hamx-home-subheading {
  margin: 1.25rem 0 0.5rem;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-home-spots {
  margin-bottom: 0.5rem;
}

/*
 * Home's HamX lookup (v0.3.5, D-189, D-193): the status matrix of 18 px squares, filled by the
 * DXCC or IOTA status in the user's colours, grey when not worked; the callsign's own status
 * is a dot in the same colours (D-202), its dark ring keeping it apart from a square of the
 * same colour. 14 columns fit on a phone.
 */
.hamx-lookup-matrix-wrap {
  --hamx-lookup-column: 21px;
  margin-top: 1rem;
  overflow-x: auto;
}

.hamx-lookup-matrix {
  border-collapse: separate;
  border-spacing: 3px;
}

.hamx-lookup-matrix th {
  padding: 0;
  color: var(--hamx-text-muted);
  font-size: 0.7rem;
  font-weight: 400;
  white-space: nowrap;
}

/*
 * Every band column has the same width, so the squares are evenly apart: the header text is
 * centred over its column without widening it (70cm is wider than a square).
 */
.hamx-lookup-matrix th[scope="col"] {
  position: relative;
  height: 1.1rem;
}

.hamx-lookup-band {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.hamx-lookup-matrix th[scope="row"] {
  padding-right: 0.5rem;
  text-align: left;
}

.hamx-lookup-matrix td {
  width: var(--hamx-lookup-column);
  padding: 0;
}

.hamx-lookup-matrix .hamx-lookup-square {
  margin: 0 auto;
}

.hamx-lookup-row-short {
  display: none;
}

.hamx-lookup-square,
.hamx-lookup-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  background-color: var(--hamx-lookup-empty);
}

/* Marks drawn inside the square, so they never reach into the gap. */
a.hamx-lookup-square:hover {
  box-shadow: inset 0 0 0 1px var(--hamx-text);
}

.hamx-lookup-confirmed {
  background-color: var(--hamx-status-confirmed);
}

.hamx-lookup-worked {
  background-color: var(--hamx-status-worked);
}

/* A square spotted in the last hour (D-192). */
.hamx-lookup-square.hamx-lookup-onair,
.hamx-lookup-swatch.hamx-lookup-onair {
  box-shadow: inset 0 0 0 2px var(--hamx-accent);
}

a.hamx-lookup-square.hamx-lookup-onair:hover {
  box-shadow: inset 0 0 0 2px var(--hamx-text);
}

.hamx-lookup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.hamx-lookup-dot-worked {
  background-color: var(--hamx-status-worked);
}

.hamx-lookup-dot-confirmed {
  background-color: var(--hamx-status-confirmed);
}

/* On a square of its own colour the dot needs a wider ring to stand out (Stefan, D-202). */
.hamx-lookup-worked .hamx-lookup-dot-worked,
.hamx-lookup-confirmed .hamx-lookup-dot-confirmed {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.5);
}

.hamx-lookup-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.5rem;
  color: var(--hamx-text-muted);
  font-size: 0.8rem;
}

.hamx-lookup-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.hamx-lookup-legend .hamx-lookup-swatch {
  width: 12px;
  height: 12px;
}

.hamx-lookup-status-confirmed {
  color: var(--hamx-status-confirmed);
}

.hamx-lookup-status-worked {
  color: var(--hamx-status-worked);
}

.hamx-lookup-status-new {
  color: var(--hamx-status-new);
}

/* The log's entity of a call is not the one CTY gives today (D-193). */
.hamx-lookup-note {
  margin-bottom: 0.5rem;
  color: var(--hamx-warning);
  font-size: 0.85rem;
}

.hamx-lookup-links {
  margin-top: 0.75rem;
}

@media (max-width: 575.98px) {
  .hamx-lookup-matrix-wrap {
    --hamx-lookup-column: 20px;
  }

  .hamx-lookup-row-long {
    display: none;
  }

  .hamx-lookup-row-short {
    display: inline;
  }
}

/*
 * The status matrix in the Cluster dashboard header (v0.3.6, D-195): between the heading and
 * the buttons, aligned to the top, on its own line under the title row when the window is
 * narrow, full width on a phone. Squares of 14 px and small band headers, no legend.
 */
.hamx-page-header:has(> .hamx-header-matrix) {
  display: grid;
  grid-template-areas:
    "heading actions"
    "matrix matrix";
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.hamx-page-header:has(> .hamx-header-matrix) .hamx-page-heading {
  grid-area: heading;
}

.hamx-page-header:has(> .hamx-header-matrix) .hamx-page-actions {
  grid-area: actions;
  justify-content: flex-end;
}

.hamx-header-matrix {
  grid-area: matrix;
  min-width: 0;
}

/*
 * On one line, the heading and the buttons line up with the bottom of the squares, and the
 * matrix reaches up towards the top bar, so the header grows as little as possible.
 */
@media (min-width: 1400px) {
  .hamx-page-header:has(> .hamx-header-matrix) {
    grid-template-areas: "heading matrix actions";
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: end;
  }

  .hamx-header-matrix {
    margin-top: -1rem;
  }
}

@media (max-width: 575.98px) {
  .hamx-page-header:has(> .hamx-header-matrix) {
    grid-template-areas:
      "heading"
      "matrix"
      "actions";
    grid-template-columns: minmax(0, 1fr);
  }

  .hamx-page-header:has(> .hamx-header-matrix) .hamx-page-actions {
    justify-content: flex-start;
  }
}

.hamx-lookup-matrix-wrap.hamx-lookup-compact {
  --hamx-lookup-column: 17px;
  margin-top: 0;
}

.hamx-lookup-compact .hamx-lookup-matrix {
  border-spacing: 2px;
}

.hamx-lookup-compact .hamx-lookup-matrix th {
  font-size: 0.65rem;
}

/* 70cm is wider than a compact column: it starts at its column and runs into the padding. */
.hamx-lookup-matrix-wrap.hamx-lookup-compact {
  padding-right: 0.75rem;
}

.hamx-lookup-compact th[scope="col"]:last-child .hamx-lookup-band {
  left: 0;
  transform: none;
}

.hamx-lookup-compact .hamx-lookup-square {
  width: 14px;
  height: 14px;
}

.hamx-lookup-compact .hamx-lookup-dot {
  width: 6px;
  height: 6px;
}

/*
 * The subject in the corner cell, linking to the HamX lookup (D-203): in the link colour, a
 * worked or confirmed callsign in its status colour; hover only underlines it.
 */
.hamx-lookup-corner {
  text-align: left;
  vertical-align: bottom;
}

.hamx-lookup-corner a,
.hamx-lookup-corner a:hover {
  color: var(--hamx-accent);
}

.hamx-lookup-corner a:hover {
  text-decoration: underline;
}

.hamx-lookup-corner a.hamx-call-worked {
  color: var(--hamx-status-worked);
}

.hamx-lookup-corner a.hamx-call-confirmed {
  color: var(--hamx-status-confirmed);
}

/* widget-table.js measures column titles and cells in this hidden copy of a table. */
.hamx-measure {
  position: absolute;
  top: 0;
  left: 0;
  visibility: hidden;
  pointer-events: none;
}

.hamx-measure .tabulator-header,
.hamx-measure .tabulator-row {
  display: block;
  width: max-content;
}

.hamx-measure .tabulator-col,
.hamx-measure .tabulator-cell {
  display: inline-block;
  width: auto;
  white-space: nowrap;
}

/* Settings → External → Links: long addresses wrap instead of widening the table. */
.hamx-link-url {
  overflow-wrap: anywhere;
}

/*
 * Tables → Logbook (v0.3): the user drop-down for admins, the column chooser, and the
 * Confirmed cell in the user's status colours.
 */
.hamx-log-owner {
  flex: 0 1 18rem;
}

/* Log Check: the callsign filter next to the search. */
.hamx-check-callsign {
  flex: 0 1 10rem;
  text-transform: uppercase;
}

.hamx-column-chooser {
  max-height: 24rem;
  overflow-y: auto;
}

.hamx-column-chooser .form-check {
  padding-left: 2.25rem;
  margin: 0;
}

.hamx-call-cell,
.hamx-country-cell {
  cursor: pointer;
}

/* User Config → Display: the preview of the status colours (D-137). */
.hamx-status-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.5rem;
}

.hamx-status-preview-cells {
  display: flex;
  border: 1px solid var(--hamx-border);
  border-radius: 4px;
  overflow: hidden;
}

.hamx-status-preview-cell {
  padding: 0.375rem 0.75rem;
}

.hamx-status-preview-cell.hamx-status-new {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-status-preview-cell.hamx-status-worked {
  background-color: color-mix(in srgb, var(--hamx-status-worked) var(--hamx-status-tint), transparent);
}

.hamx-status-preview-cell.hamx-status-confirmed {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

.hamx-status-preview-markers {
  display: flex;
  gap: 0.5rem;
}

.hamx-status-preview-marker {
  width: 24px;
  height: 24px;
}

/* A gauge as in the award widgets: Confirmed, then Worked, then New around the ring. */
.hamx-status-preview-gauge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: conic-gradient(
    var(--hamx-status-confirmed) 0 75%,
    var(--hamx-status-worked) 75% 90%,
    var(--hamx-status-new) 90% 100%
  );
  border-radius: 50%;
}

.hamx-status-preview-gauge-value {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  font-size: 13px;
  font-weight: 700;
  background-color: var(--hamx-card);
  border-radius: 50%;
}

/* The Cell colour strength slider and its value beside it (D-146). */
.form-range.hamx-status-tint {
  width: calc(100% - 4rem);
  vertical-align: middle;
}

.hamx-status-tint-value {
  display: inline-block;
  width: 3.5rem;
  margin-left: 0.5rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/*
 * Callsign marking (D-138, D-167): the call worked or confirmed on any band and mode is
 * drawn in the full status colour as text, in its usual font and weight, with no
 * background; a call never worked keeps the normal text colour. The map popups' own link
 * colour is overruled by the longer selectors.
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-call-worked,
.hamx-map .leaflet-popup-content a.hamx-map-call-link.hamx-call-worked,
.hamx-status-preview .hamx-call-worked {
  color: var(--hamx-status-worked);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-call-confirmed,
.hamx-map .leaflet-popup-content a.hamx-map-call-link.hamx-call-confirmed,
.hamx-status-preview .hamx-call-confirmed {
  color: var(--hamx-status-confirmed);
}

/* The callsign examples in the User Config → Display preview, on a table row's colour. */
.hamx-status-preview-calls {
  display: flex;
  gap: 0.75rem;
  padding: 0.375rem 0.75rem;
  background-color: var(--hamx-card);
  border-radius: 3px;
}

/* A callsign's bands and modes in the Map popup, in the entity's status colours. */
.hamx-map-bands {
  margin: 0.25rem 0;
  border-collapse: separate;
  border-spacing: 0 2px;
}

.hamx-map-bands th {
  padding: 0 0.35rem;
  color: var(--hamx-text-muted);
  font-weight: 400;
  text-align: center;
}

.hamx-map-bands td {
  padding: 0 0.35rem;
  text-align: center;
}

.hamx-map-bands td.hamx-map-freq {
  font-variant-numeric: tabular-nums;
}

.hamx-map-status.is-new {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-map-status.is-worked {
  background-color: color-mix(in srgb, var(--hamx-status-worked) var(--hamx-status-tint), transparent);
}

.hamx-map-status.is-confirmed {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

.hamx-map-status.is-validated {
  background-color: color-mix(in srgb, var(--hamx-status-validated) var(--hamx-status-tint), transparent);
}

/* Logbook widgets (v0.3): the empty-log message, QSO Totals tiles and the charts. */
.hamx-widget-empty {
  margin: 0;
  color: var(--hamx-text-muted);
}

.hamx-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  height: 100%;
}

/* A tile is as wide as its label or number, so smaller numbers need a narrower widget. */
.hamx-tile {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.hamx-tile-label {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  letter-spacing: var(--hamx-label-spacing);
  text-transform: uppercase;
}

.hamx-tile-value {
  color: var(--hamx-text);
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

a.hamx-tile-value:hover {
  color: var(--hamx-accent);
}

/* QSO Totals per mode group: each number in its group's colour, as the pie (D-168). */
.hamx-tile-value.hamx-mode-phone {
  color: var(--hamx-mode-phone);
}

.hamx-tile-value.hamx-mode-cw {
  color: var(--hamx-mode-cw);
}

.hamx-tile-value.hamx-mode-digital {
  color: var(--hamx-mode-digital);
}

.hamx-tile-value.hamx-mode-count {
  color: var(--hamx-heat);
}

/* QSO Totals: Number size (D-173); Normal is the size above. */
.hamx-tiles-size-extra_small .hamx-tile-value {
  font-size: 1.125rem;
}

.hamx-tiles-size-small .hamx-tile-value {
  font-size: 1.5rem;
}

.hamx-tiles-size-large .hamx-tile-value {
  font-size: 3rem;
}

.hamx-tiles-size-extra_large .hamx-tile-value {
  font-size: 4rem;
}

.hamx-tiles-size-huge .hamx-tile-value {
  font-size: 5.5rem;
}

.hamx-chart {
  width: 100%;
  height: 100%;
  min-height: 8rem;
}

/* QSO Count Table: band cells shaded by their count in five steps, as the Band × Continent
 * matrix (widget-table.js). */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-heat-1 {
  background-color: color-mix(in srgb, var(--hamx-heat) 12%, transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-heat-2 {
  background-color: color-mix(in srgb, var(--hamx-heat) 24%, transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-heat-3 {
  background-color: color-mix(in srgb, var(--hamx-heat) 36%, transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-heat-4 {
  background-color: color-mix(in srgb, var(--hamx-heat) 50%, transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-heat-5 {
  background-color: color-mix(in srgb, var(--hamx-heat) 66%, transparent);
}

/*
 * Logbook Table: the Confirmed cell by how the QSO was confirmed (No, QSL, LoTW or both),
 * at the user's cell colour strength. No and both take the user's New and Confirmed
 * colours, as the QSL columns (D-178); QSL and LoTW keep their own, so they stay apart.
 */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-confirmed-no {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-confirmed-qsl {
  background-color: color-mix(in srgb, var(--hamx-purple) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-confirmed-lotw {
  background-color: color-mix(in srgb, var(--hamx-blue) var(--hamx-status-tint), transparent);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-confirmed-both {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

/* Widget settings: the alignment select beside each column switch. */
.hamx-column-list .hamx-column-align {
  width: auto;
  flex: 0 0 auto;
}

/* User Config → Display: the count colour in five shades, as the count tables show it. */
.hamx-status-preview-heat {
  display: flex;
  gap: 0.25rem;
}

.hamx-status-preview-heat span {
  min-width: 2.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-align: center;
}

.hamx-status-preview-heat .hamx-heat-1 {
  background-color: color-mix(in srgb, var(--hamx-heat) 12%, transparent);
}

.hamx-status-preview-heat .hamx-heat-2 {
  background-color: color-mix(in srgb, var(--hamx-heat) 24%, transparent);
}

.hamx-status-preview-heat .hamx-heat-3 {
  background-color: color-mix(in srgb, var(--hamx-heat) 36%, transparent);
}

.hamx-status-preview-heat .hamx-heat-4 {
  background-color: color-mix(in srgb, var(--hamx-heat) 50%, transparent);
}

.hamx-status-preview-heat .hamx-heat-5 {
  background-color: color-mix(in srgb, var(--hamx-heat) 66%, transparent);
}

/* Cards stacked in a start page column, with the same gap as between the columns. */
.hamx-card-column {
  display: flex;
  flex-direction: column;
  gap: var(--tblr-gutter-y, 1rem);
}

/* The buttons of a held import (v0.3.7, D-199): in the notice, History and the details. */
.hamx-held-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/*
 * Watchers (v0.4). A callsign in a list is drawn as in the Cluster widgets (D-213): accent
 * blue and semi-bold, in the Worked or Confirmed colour once worked; a click opens its menu.
 */
.hamx-call-link,
.hamx-call-link:hover {
  color: var(--hamx-accent);
  font-weight: 600;
  cursor: pointer;
}

.hamx-call-link.hamx-call-worked {
  color: var(--hamx-status-worked);
}

.hamx-call-link.hamx-call-confirmed {
  color: var(--hamx-status-confirmed);
}

/* A sortable column header of a Watchers table. */
.hamx-sort-link,
.hamx-sort-link:hover {
  color: inherit;
  white-space: nowrap;
}

/* The days-remaining bar of a callsign list row (D-082): its colour follows the days left. */
.hamx-days {
  --hamx-days-color: var(--hamx-success);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--hamx-days-color);
  font-weight: 600;
}

.hamx-days-warn {
  --hamx-days-color: var(--hamx-warning);
}

.hamx-days-danger {
  --hamx-days-color: var(--hamx-danger);
}

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

.hamx-days-bar {
  flex: 0 0 8rem;
  width: 8rem;
  height: 0.5rem;
  appearance: none;
  border: 0;
  border-radius: 0.25rem;
  background-color: var(--hamx-border);
  overflow: hidden;
}

/* The bar in the Callsign watcher's Days left column (D-219): shorter, to fit a cell. */
.hamx-widget .hamx-days-bar {
  flex-basis: 3rem;
  width: 3rem;
}

.hamx-days-bar::-webkit-progress-bar {
  background-color: var(--hamx-border);
}

.hamx-days-bar::-webkit-progress-value {
  background-color: var(--hamx-days-color);
}

.hamx-days-bar::-moz-progress-bar {
  background-color: var(--hamx-days-color);
}

/*
 * Column widths of a callsign list: callsign, source, month and the dates narrow, the
 * comment takes what is left, the days-remaining bar a fixed width. The add and edit
 * rows' inputs follow them.
 */
.hamx-watch-table .hamx-col-value,
.hamx-watch-table .hamx-col-source {
  width: 8rem;
}

.hamx-watch-table .hamx-col-month,
.hamx-watch-table .hamx-col-start_date,
.hamx-watch-table .hamx-col-end_date {
  width: 9.5rem;
}

.hamx-watch-table .hamx-col-days {
  width: 15rem;
}

.hamx-watch-table .form-control-sm {
  min-width: 6rem;
}

.hamx-watch-table .hamx-col-comment .form-control-sm {
  min-width: 14rem;
}

/*
 * A country outside the dashboards' tables (D-221, D-257): in the callsign's font weight
 * and in its DXCC status colour as text, as a call; a country never worked keeps the normal
 * text colour.
 */
.hamx-country {
  font-weight: 600;
}

/* A country with an entity opens the country menu (D-241); New keeps the text colour. */
.hamx-country-link {
  color: inherit;
  cursor: pointer;
}

.hamx-country-worked {
  color: var(--hamx-status-worked);
}

.hamx-country-confirmed {
  color: var(--hamx-status-confirmed);
}

.hamx-country-validated {
  color: var(--hamx-status-validated);
}

/* DX-World Timeline (D-240): the days-remaining bar as wide as on a callsign list. */
.hamx-dxworld-table .hamx-col-days {
  width: 15rem;
}

/*
 * The DX-World Timeline widget (D-240, D-242), drawn as a table: rows as high as the widget
 * tables' (the same font and padding), the callsign column first, and the bars tinted in the
 * entity's DXCC status as the tables' status cells (D-110). The header stays on top while
 * the rows scroll. dxworld-timeline.js places the labels, grid lines, bars and now line.
 */
.hamx-widget-body:has(> .hamx-timeline) {
  padding: 0;
}

.hamx-timeline {
  display: grid;
  grid-template-columns: max-content 1fr;
  font-size: var(--hamx-font-size);
}

.hamx-timeline-head,
.hamx-timeline-row {
  display: contents;
}

.hamx-timeline-call,
.hamx-timeline-track {
  border-bottom: 1px solid var(--hamx-border);
}

.hamx-timeline-call {
  padding: 0.25rem 1rem 0.25rem 0.5rem;
  white-space: nowrap;
}

.hamx-timeline-flag {
  margin-right: 0.35rem;
}

.hamx-timeline-track {
  position: relative;
  min-width: 12rem;
  margin-right: 0.5rem;
}

.hamx-timeline-head > div {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  font-weight: 600;
  background-color: var(--hamx-card);
}

.hamx-timeline-head .hamx-timeline-call {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

/* A date label starts at its day; the month's first has the month's name. */
.hamx-timeline-tick {
  position: absolute;
  top: 50%;
  padding-left: 0.2rem;
  white-space: nowrap;
  transform: translateY(-50%);
}

.hamx-timeline-month {
  color: var(--hamx-text);
}

.hamx-timeline-grid {
  position: absolute;
  top: 0;
  bottom: 0;
  border-left: 1px solid color-mix(in srgb, var(--hamx-border) 60%, transparent);
}

.hamx-timeline-now {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  border-left: 1px solid var(--hamx-accent);
}

/*
 * In the header, now is a small accent tag inside the row, centred as the date labels, its
 * left edge on the rows' now line; it lies over a date label under it (D-244).
 */
.hamx-timeline-now-tag {
  position: absolute;
  top: 50%;
  z-index: 1;
  padding: 0 0.3rem;
  color: var(--hamx-card);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  background-color: var(--hamx-accent);
  border-radius: 0 3px 3px 0;
  transform: translateY(-50%);
}

.hamx-timeline-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  z-index: 1;
  display: flex;
  align-items: center;
  min-width: 4px;
  padding: 0 0.4rem;
  overflow: hidden;
  color: var(--hamx-text);
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 3px;
}

.hamx-timeline-bar.hamx-status-new {
  background-color: color-mix(in srgb, var(--hamx-status-new) var(--hamx-status-tint), transparent);
}

.hamx-timeline-bar.hamx-status-worked {
  background-color: color-mix(in srgb, var(--hamx-status-worked) var(--hamx-status-tint), transparent);
}

.hamx-timeline-bar.hamx-status-confirmed {
  background-color: color-mix(in srgb, var(--hamx-status-confirmed) var(--hamx-status-tint), transparent);
}

.hamx-timeline-bar.hamx-status-validated {
  background-color: color-mix(in srgb, var(--hamx-status-validated) var(--hamx-status-tint), transparent);
}

.hamx-timeline-bar.hamx-status-none {
  background-color: color-mix(in srgb, var(--hamx-text-muted) var(--hamx-status-tint), transparent);
}

/* A side the page's month or the window cut off fades out, as the page's "…". */
.hamx-timeline-bar.hamx-timeline-open-start {
  padding-left: 1rem;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  mask-image: linear-gradient(to right, transparent, #000 1.25rem);
}

.hamx-timeline-bar.hamx-timeline-open-end {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  mask-image: linear-gradient(to left, transparent, #000 1.25rem);
}

.hamx-timeline-bar.hamx-timeline-open-start.hamx-timeline-open-end {
  mask-image: linear-gradient(
    to right, transparent, #000 1.25rem, #000 calc(100% - 1.25rem), transparent
  );
}

/* Spotted in the last 15 minutes: the outline of the HamX lookup's squares (D-192). */
.hamx-timeline-bar.hamx-timeline-on-air {
  box-shadow: inset 0 0 0 2px var(--hamx-accent);
}

.hamx-timeline-bar:hover {
  filter: brightness(1.25);
}

/* The tooltip of a bar: the link menu's box (D-239), following the pointer. */
.hamx-link-menu.hamx-timeline-tip {
  position: fixed;
  z-index: 1070;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  pointer-events: none;
}

.hamx-timeline-tip-call {
  font-weight: 600;
}

/* The rule builder (v0.4, D-080): groups of conditions, OR between the groups. */
.hamx-rule-group {
  padding: 0.75rem;
  border: 1px solid var(--hamx-border);
  border-radius: 0.375rem;
}

.hamx-rule-group-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.hamx-rule-group-actions,
.hamx-rule-condition-actions {
  display: inline-flex;
  gap: 0.25rem;
  margin-left: auto;
}

.hamx-rule-or {
  margin: 0.5rem 0;
  color: var(--hamx-accent);
  font-weight: 600;
  text-align: center;
}

.hamx-rule-condition {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.hamx-rule-condition .hamx-rule-field {
  width: 15rem;
}

.hamx-rule-condition .hamx-rule-operator {
  width: 10rem;
}

.hamx-rule-condition .hamx-rule-list {
  width: 13rem;
}

.hamx-rule-values {
  flex: 1 1 14rem;
  min-width: 14rem;
}

.hamx-rule-error {
  flex-basis: 100%;
}

.hamx-pushover-options {
  margin: 0.5rem 0 0 1.5rem;
}

@media (max-width: 575.98px) {
  .hamx-rule-condition .hamx-rule-field,
  .hamx-rule-condition .hamx-rule-operator,
  .hamx-rule-condition .hamx-rule-list {
    width: 100%;
  }
}

/* User Config → Notifications: Send test and Refresh with the notifier's answer beside them. */
.hamx-notify-test {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.hamx-notify-sound {
  width: auto;
  max-width: 14rem;
}

/* The notification bell in the top bar (D-208): the unread count as a badge on the bell. */
.hamx-bell {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hamx-bell-button {
  position: relative;
  display: flex;
  align-items: center;
  padding: 0.25rem 0.4rem;
  color: var(--hamx-text);
  font-size: 1.35rem;
  line-height: 1;
  background: none;
  border: none;
  border-radius: 6px;
}

.hamx-bell-button:hover {
  background-color: var(--hamx-sidebar-active);
}

/* With unread notifications the outline bell gives way to a filled one in the New colour. */
.hamx-bell-alert {
  display: none;
  width: 1em;
  height: 1em;
  fill: var(--hamx-status-new);
}

.hamx-bell-button:has(.hamx-bell-badge:not(.d-none)) .hamx-bell-idle {
  display: none;
}

.hamx-bell-button:has(.hamx-bell-badge:not(.d-none)) .hamx-bell-alert {
  display: block;
}

/* The unread count, on the bell and on Home's card: white on the tinted New colour, as the
   New cells of DXCC Watcher; mixed with the page background so the bell does not show through. */
.hamx-unread-badge {
  color: #fff;
  font-weight: 700;
  background-color: color-mix(
    in srgb,
    var(--hamx-status-new) var(--hamx-status-tint),
    var(--hamx-bg)
  );
}

.hamx-bell-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.6rem;
  font-size: 0.75rem;
  box-shadow: 0 0 0 2px var(--hamx-bg);
}

/* The My Preferences quick menu in the top bar (D-230): the icon in the link colour while
   the base filter is on, white while it is off; a switch per set and buttons per band. */
.hamx-preferences-button {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.4rem;
  font-size: 1.35rem;
  line-height: 1;
  background: none;
  border: none;
  border-radius: 6px;
}

.hamx-preferences-button:hover {
  background-color: var(--hamx-sidebar-active);
}

.hamx-preferences-icon {
  display: flex;
  color: var(--hamx-text);
}

.hamx-preferences-icon.is-on {
  color: var(--tblr-link-color);
}

.hamx-preferences-menu {
  width: 19rem;
  padding: 0.5rem 0;
}

.hamx-preferences-head,
.hamx-preferences-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.hamx-preferences-head,
.hamx-preferences-switch {
  padding: 0.25rem 0.75rem;
}

.hamx-preferences-title {
  font-weight: 600;
}

.hamx-preferences-switch + .hamx-preferences-switch {
  margin-top: 0.35rem;
}

.hamx-preferences-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
}

.hamx-preferences-toggle {
  min-width: 2.6rem;
  padding: 0.15rem 0.35rem;
  color: var(--hamx-text-muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  background-color: var(--hamx-input);
  border: 1px solid var(--hamx-border);
  border-radius: 4px;
}

.hamx-preferences-toggle.is-on {
  color: var(--hamx-bg);
  font-weight: 600;
  background-color: var(--tblr-link-color);
  border-color: var(--tblr-link-color);
}

.hamx-preferences-toggle.is-last {
  cursor: not-allowed;
}

.hamx-preferences-switch.is-off .hamx-preferences-buttons,
.hamx-preferences-switch.is-off .hamx-preferences-note {
  opacity: 0.45;
}

.hamx-preferences-toggle:disabled {
  cursor: default;
}

.hamx-preferences-note {
  margin-top: 0.25rem;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

/* Sound off until a click: in the New colour so it is not missed. */
.hamx-bell-sound {
  padding: 0.1rem 0.5rem;
  color: var(--hamx-status-new);
  font-size: var(--hamx-label-font-size);
  font-weight: 600;
  background: none;
  border: 1px dashed var(--hamx-status-new);
  border-radius: 6px;
}

.hamx-bell-menu {
  width: 24rem;
  max-width: calc(100vw - 2rem);
}

.hamx-bell-row {
  display: grid;
  grid-template-columns: 0.5rem auto 1fr;
  grid-template-areas:
    "dot call call"
    ". time meta";
  column-gap: 0.5rem;
  white-space: normal;
}

/* The unread mark in the bell's list and on Home's card: a clear dot in the New colour. */
.hamx-bell-dot {
  grid-area: dot;
  align-self: center;
  width: 0.55rem;
  height: 0.55rem;
  background-color: var(--hamx-status-new);
  border-radius: 50%;
}

.hamx-bell-call {
  grid-area: call;
  color: var(--hamx-accent);
  font-weight: 600;
}

.hamx-bell-call.hamx-call-worked {
  color: var(--hamx-status-worked);
}

.hamx-bell-call.hamx-call-confirmed {
  color: var(--hamx-status-confirmed);
}

.hamx-bell-time {
  grid-area: time;
  color: var(--hamx-text);
  font-size: var(--hamx-label-font-size);
}

.hamx-bell-meta {
  grid-area: meta;
  color: var(--hamx-text);
  font-size: var(--hamx-label-font-size);
}

/* The pop-up of a new notification, in the top bar left of the bookmark star (D-208). */
.hamx-toasts {
  display: flex;
  min-width: 0;
}

.hamx-toasts:empty {
  display: none;
}

.hamx-toast {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  min-width: 0;
  max-width: 30rem;
  padding: 0.3rem 0.8rem;
  overflow: hidden;
  color: var(--hamx-text);
  white-space: nowrap;
  background-color: var(--hamx-card-header);
  border: 1px solid var(--hamx-border);
  border-left: 3px solid var(--hamx-status-new);
  border-radius: 6px;
  animation: hamx-toast-in 0.2s ease-out;
}

@keyframes hamx-toast-in {
  from {
    opacity: 0;
  }
}

.hamx-toast:hover {
  color: var(--hamx-text);
  text-decoration: none;
}

.hamx-toast-rule {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

.hamx-toast-body {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
}

.hamx-toast-more {
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

@media (max-width: 767.98px) {
  .hamx-toast-rule {
    display: none;
  }
}

/* Watchers → Notifications: the filters in a row; held-back rows greyed. */
.hamx-notify-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.hamx-notify-filters .form-select {
  width: auto;
}

.hamx-notify-held td {
  color: var(--hamx-text-muted);
}

/* Watchers → Notifications: rows new since the last refresh fade as the Spot Table's. */
.hamx-notify-new td {
  animation: hamx-spot-new 4s ease-out;
}

/* Home's Notifications card (D-214): compact rows, the unread dot first, the age last. */
.hamx-notify-today {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

.hamx-notify-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.hamx-notify-what {
  color: var(--hamx-text);
}

.hamx-notify-rule {
  font-weight: 400;
}

.hamx-notify-age {
  margin-left: auto;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
}

.hamx-notify-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* The Notifications widget: held-back rows greyed, a failed channel in red (v0.4 §9). */
.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-cell-held {
  color: var(--hamx-text-muted);
}

.hamx-widget .tabulator .tabulator-row .tabulator-cell.hamx-cell-failed {
  color: var(--hamx-danger);
}

/* Home's right column: the Notifications card above Bookmarks, with the cards' gap. */
.hamx-home-side {
  display: flex;
  flex-direction: column;
  gap: var(--tblr-gutter-y, 1rem);
}

/*
 * New user's Dashboards card (D-247): a heading per dashboard type, and the name of a
 * switched-off template greyed (new-user-dashboards.js).
 */
.hamx-new-dashboards-type {
  margin: 0.5rem 0;
  color: var(--hamx-text-muted);
  font-size: var(--hamx-label-font-size);
  font-weight: 600;
  text-transform: uppercase;
}

.hamx-new-dashboard-off .form-control {
  opacity: 0.45;
}
