/* Reusable pieces for the hatchery console. Tokens live in tokens.css, shell in app.css. */

/* ------------------------------------------------------------------ page header */

.hx-page-head {
  display: flex;
  align-items: flex-start;
  gap: var(--hx-s4);
  flex-wrap: wrap;
  margin-bottom: var(--hx-s6);
}

.hx-page-head h1 {
  font-size: var(--hx-fs-xl);
  font-weight: 800;
}

.hx-page-head p {
  margin: var(--hx-s2) 0 0;
  color: var(--hx-muted);
}

.hx-page-head-actions {
  margin-left: auto;
  display: flex;
  gap: var(--hx-s3);
  align-items: center;
  flex-wrap: wrap;
}

.hx-count-pill {
  display: inline-block;
  padding: 5px var(--hx-s3);
  border-radius: var(--hx-r-pill);
  background: var(--hx-primary-soft);
  color: var(--hx-primary-dark);
  font-size: var(--hx-fs-xs);
  font-weight: 700;
}

.hx-breadcrumb {
  display: flex;
  gap: var(--hx-s2);
  align-items: center;
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
  margin-bottom: var(--hx-s3);
}

.hx-breadcrumb a {
  color: var(--hx-muted);
  text-decoration: none;
}

.hx-breadcrumb a:hover {
  color: var(--hx-primary-dark);
  text-decoration: underline;
}

/* ------------------------------------------------------------------ buttons */

.hx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--hx-s2);
  padding: 9px var(--hx-s4);
  border: 1px solid transparent;
  border-radius: var(--hx-r-sm);
  font: inherit;
  font-weight: 700;
  font-size: var(--hx-fs-base);
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--hx-transition);
}

.hx-btn svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.hx-btn:disabled,
.hx-btn.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.hx-btn-primary {
  background: linear-gradient(135deg, var(--hx-primary), var(--hx-primary-dark));
  color: var(--hx-on-primary);
  box-shadow: 0 4px 12px rgba(232, 111, 46, 0.28);
}

.hx-btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 6px 16px rgba(232, 111, 46, 0.36);
}

.hx-btn-secondary {
  background: var(--hx-secondary);
  color: #fff;
}

.hx-btn-secondary:hover:not(:disabled) {
  filter: brightness(1.08);
}

.hx-btn-ghost {
  background: var(--hx-surface);
  border-color: var(--hx-border);
  color: var(--hx-text);
}

.hx-btn-ghost:hover:not(:disabled) {
  border-color: var(--hx-border-strong);
  background: var(--hx-sunken);
}

.hx-btn-danger {
  background: var(--hx-danger);
  color: #fff;
}

.hx-btn-danger:hover:not(:disabled) {
  filter: brightness(1.07);
}

.hx-btn-quiet {
  background: transparent;
  color: var(--hx-muted);
  padding: 6px var(--hx-s2);
}

.hx-btn-quiet:hover:not(:disabled) {
  color: var(--hx-text);
  background: var(--hx-sunken);
}

.hx-btn-sm {
  padding: 6px var(--hx-s3);
  font-size: var(--hx-fs-sm);
}

.hx-btn-block {
  width: 100%;
}

/* ------------------------------------------------------------------ cards */

.hx-card {
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
}

.hx-card-pad {
  padding: var(--hx-s5);
}

.hx-card-head {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s4) var(--hx-s5);
  border-bottom: 1px solid var(--hx-border);
}

.hx-card-head h2 {
  font-size: var(--hx-fs-md);
  font-weight: 800;
}

.hx-card-head .hx-card-head-actions {
  margin-left: auto;
  display: flex;
  gap: var(--hx-s2);
}

.hx-grid {
  display: grid;
  gap: var(--hx-s5);
}

.hx-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.hx-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.hx-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.hx-grid-sidebar {
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
}

@media (max-width: 1100px) {
  .hx-grid-sidebar {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ stat cards */

.hx-stat {
  padding: var(--hx-s5);
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
}

.hx-stat-label {
  display: flex;
  align-items: center;
  gap: var(--hx-s2);
  font-size: var(--hx-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
  color: var(--hx-muted);
}

.hx-stat-label svg {
  width: 15px;
  height: 15px;
}

.hx-stat-value {
  margin-top: var(--hx-s3);
  font-size: var(--hx-fs-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.hx-stat-sub {
  margin-top: var(--hx-s1);
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
}

.hx-stat-accent-primary {
  border-top: 3px solid var(--hx-primary);
}
.hx-stat-accent-secondary {
  border-top: 3px solid var(--hx-secondary);
}
.hx-stat-accent-warning {
  border-top: 3px solid var(--hx-warning);
}
.hx-stat-accent-info {
  border-top: 3px solid var(--hx-info);
}

/* ------------------------------------------------------------------ dashboard */

.hx-dashboard-overview {
  position: relative;
  isolation: isolate;
  margin-bottom: var(--hx-s6);
  overflow: hidden;
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-lg);
  background: var(--hx-surface);
  box-shadow: 0 16px 36px rgba(92, 52, 24, 0.1);
}

.hx-dashboard-overview::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--hx-primary), #f4a23e 52%, var(--hx-secondary));
}

.hx-dashboard-section-kicker {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hx-dashboard-section-kicker {
  color: var(--hx-primary-dark);
}

.hx-dashboard-overview-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--hx-s7);
  padding: clamp(24px, 3vw, 34px);
  background:
    radial-gradient(circle at 9% 0%, rgba(232, 111, 46, 0.09), transparent 28%),
    linear-gradient(135deg, #fffdf9, #fff8eb);
}

.hx-dashboard-overview-copy h1 {
  font-size: clamp(27px, 3vw, 36px);
  letter-spacing: -0.035em;
}

.hx-dashboard-overview-copy p {
  max-width: 660px;
  margin: var(--hx-s2) 0 0;
  color: var(--hx-muted);
  font-size: var(--hx-fs-md);
}

.hx-dashboard-overview-side {
  display: flex;
  align-items: stretch;
  gap: var(--hx-s4);
}

.hx-dashboard-overview-actions {
  display: grid;
  align-content: center;
  gap: var(--hx-s2);
}

.hx-dashboard-today {
  min-width: 224px;
  padding: var(--hx-s3) var(--hx-s4);
  border: 1px solid #ecd6b7;
  border-radius: var(--hx-r-md);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 7px 18px rgba(92, 52, 24, 0.07);
}

.hx-dashboard-today-label {
  display: block;
  margin-bottom: var(--hx-s2);
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.hx-dashboard-today-stats {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--hx-s4);
}

.hx-dashboard-today-stats a {
  display: grid;
  color: var(--hx-text);
  text-align: center;
  text-decoration: none;
}

.hx-dashboard-today-stats strong {
  font-size: 27px;
  line-height: 1;
}

.hx-dashboard-today-stats span:not(.hx-dashboard-today-divider) {
  margin-top: 5px;
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
}

.hx-dashboard-today-divider {
  width: 1px;
  height: 38px;
  background: var(--hx-border);
}

.hx-climate-section {
  padding: clamp(20px, 3vw, 30px);
  border-top: 1px solid var(--hx-border);
  background:
    radial-gradient(circle at 100% 0%, rgba(37, 115, 93, 0.09), transparent 23%),
    var(--hx-surface);
}

.hx-climate-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--hx-s4);
  margin-bottom: var(--hx-s4);
}

.hx-climate-section-head h2 {
  font-size: var(--hx-fs-lg);
  letter-spacing: -0.015em;
}

.hx-climate-section-meta {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  font-size: var(--hx-fs-xs);
  white-space: nowrap;
}

.hx-climate-scroll {
  display: flex;
  gap: var(--hx-s4);
  padding: 2px 2px var(--hx-s3);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: inline proximity;
  scrollbar-color: var(--hx-border-strong) transparent;
  scrollbar-width: thin;
}

.hx-climate-scroll::-webkit-scrollbar {
  height: 7px;
}

.hx-climate-scroll::-webkit-scrollbar-thumb {
  border-radius: var(--hx-r-pill);
  background: var(--hx-border-strong);
}

.hx-climate-card {
  position: relative;
  flex: 0 0 clamp(300px, 31vw, 390px);
  min-width: 0;
  padding: var(--hx-s5);
  overflow: hidden;
  scroll-snap-align: start;
  border: 1px solid #eadcc7;
  border-radius: var(--hx-r-md);
  background: linear-gradient(145deg, #fffdf9, #fff8eb);
  box-shadow: 0 6px 18px rgba(92, 52, 24, 0.07);
  transition: border-color var(--hx-transition), box-shadow var(--hx-transition);
}

.hx-climate-card::after {
  content: "";
  position: absolute;
  width: 92px;
  height: 92px;
  right: -48px;
  bottom: -52px;
  border: 16px solid rgba(232, 111, 46, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

.hx-climate-card:only-child {
  flex-basis: min(460px, 100%);
}

.hx-climate-card.is-warning {
  border-color: #efbcbc;
  background: linear-gradient(145deg, #fffafa, #fff1ef);
  box-shadow: 0 7px 20px rgba(209, 67, 67, 0.1);
}

.hx-climate-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hx-s3);
}

.hx-climate-card-head > div {
  min-width: 0;
}

.hx-climate-card h3 {
  overflow: hidden;
  color: var(--hx-text);
  font-size: var(--hx-fs-md);
  font-weight: 850;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hx-climate-card-head > div > span {
  display: block;
  margin-top: 4px;
  color: var(--hx-muted);
  font-size: 11px;
}

.hx-climate-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 5px 9px;
  color: var(--hx-success);
  border-radius: var(--hx-r-pill);
  background: var(--hx-success-soft);
  font-size: 11px;
  font-weight: 800;
}

.hx-climate-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(37, 115, 93, 0.11);
}

.hx-climate-card.is-warning .hx-climate-status {
  color: var(--hx-danger);
  background: var(--hx-danger-soft);
}

.hx-climate-card.is-warning .hx-climate-status-dot {
  box-shadow: 0 0 0 3px rgba(209, 67, 67, 0.12);
}

.hx-climate-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hx-s3);
  margin-top: var(--hx-s5);
}

.hx-climate-metric {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-width: 0;
  padding: var(--hx-s3);
  border: 1px solid rgba(232, 111, 46, 0.13);
  border-radius: var(--hx-r-sm);
  background: rgba(255, 255, 255, 0.72);
}

.hx-climate-metric.is-humidity {
  border-color: rgba(58, 110, 165, 0.15);
}

.hx-climate-metric-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  color: var(--hx-primary-dark);
  border-radius: 11px;
  background: var(--hx-primary-soft);
}

.hx-climate-metric.is-humidity .hx-climate-metric-icon {
  color: var(--hx-info);
  background: var(--hx-info-soft);
}

.hx-climate-metric-icon svg {
  width: 17px;
  height: 17px;
}

.hx-climate-metric-copy {
  display: grid;
  min-width: 0;
}

.hx-climate-metric-copy small {
  color: var(--hx-muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.035em;
}

.hx-climate-metric-copy strong {
  margin-top: 2px;
  color: var(--hx-text);
  font-size: clamp(20px, 2.1vw, 27px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
}

.hx-climate-card.is-warning .hx-climate-metric-copy strong {
  color: #a33d3d;
}

.hx-climate-empty {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-height: 112px;
  padding: var(--hx-s5);
  color: var(--hx-muted);
  border: 1px dashed var(--hx-border-strong);
  border-radius: var(--hx-r-md);
  background: #fffcf6;
}

.hx-climate-empty > div {
  display: grid;
}

.hx-climate-empty strong {
  color: var(--hx-text);
}

.hx-climate-empty span:not(.hx-climate-empty-icon) {
  font-size: var(--hx-fs-sm);
}

.hx-climate-empty-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  color: var(--hx-info);
  border-radius: 50%;
  background: var(--hx-info-soft);
}

.hx-climate-empty-icon svg {
  width: 20px;
  height: 20px;
}

.hx-incubator-summary {
  min-width: 0;
  overflow: hidden;
}

.hx-incubator-summary .hx-card-head {
  min-height: 70px;
}

.hx-incubator-summary .hx-dashboard-section-kicker {
  margin-bottom: 3px;
}

.hx-incubator-list {
  max-height: 430px;
  padding: var(--hx-s2) var(--hx-s4);
  overflow-y: auto;
  scrollbar-color: var(--hx-border-strong) transparent;
  scrollbar-width: thin;
}

.hx-incubator-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s4) 0;
  border-bottom: 1px solid var(--hx-border);
}

.hx-incubator-row:last-child {
  border-bottom: 0;
}

.hx-incubator-identity {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-width: 0;
}

.hx-incubator-identity > div {
  display: grid;
  justify-items: start;
  gap: 5px;
  min-width: 0;
}

.hx-incubator-identity strong {
  max-width: 100%;
  overflow: hidden;
  font-size: var(--hx-fs-sm);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hx-incubator-identity .hx-pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hx-incubator-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--hx-primary-dark);
  border-radius: var(--hx-r-sm);
  background: var(--hx-primary-soft);
}

.hx-incubator-icon svg {
  width: 19px;
  height: 19px;
}

.hx-incubator-load {
  display: grid;
  grid-template-columns: minmax(56px, 1fr) auto minmax(70px, 1fr);
  align-items: center;
  gap: var(--hx-s2);
  min-width: 150px;
  padding: 9px 10px;
  text-align: center;
  border-radius: var(--hx-r-sm);
  background: var(--hx-sunken);
}

.hx-incubator-load > div {
  display: grid;
}

.hx-incubator-load strong {
  color: var(--hx-text);
  font-size: var(--hx-fs-md);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  white-space: nowrap;
}

.hx-incubator-load span:not(.hx-incubator-load-divider) {
  margin-top: 3px;
  color: var(--hx-muted);
  font-size: 10px;
  white-space: nowrap;
}

.hx-incubator-load-divider {
  width: 1px;
  height: 31px;
  background: var(--hx-border);
}

@media (max-width: 390px) {
  .hx-incubator-icon {
    display: none;
  }

  .hx-incubator-load {
    min-width: 142px;
    padding-inline: var(--hx-s2);
  }
}

.hx-dashboard-commerce {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.8fr);
  gap: var(--hx-s5);
  margin-top: var(--hx-s6);
}

.hx-dashboard-panel {
  min-width: 0;
  overflow: hidden;
}

.hx-dashboard-panel-head {
  min-height: 74px;
}

.hx-dashboard-panel-head h2 {
  font-size: var(--hx-fs-lg);
}

.hx-dashboard-section-kicker {
  color: var(--hx-primary-dark);
}

.hx-dashboard-view-link {
  color: var(--hx-primary-dark);
  font-size: var(--hx-fs-sm);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.hx-dashboard-view-link:hover {
  text-decoration: underline;
}

.hx-dashboard-bookings,
.hx-dashboard-stock-list {
  padding: var(--hx-s2) var(--hx-s4);
}

.hx-dashboard-booking {
  display: grid;
  grid-template-columns: minmax(170px, 1.4fr) auto minmax(112px, 0.8fr) minmax(105px, 0.7fr) auto;
  align-items: center;
  gap: var(--hx-s4);
  padding: var(--hx-s3) 0;
  border-bottom: 1px solid var(--hx-border);
}

.hx-dashboard-booking:last-child,
.hx-dashboard-stock:last-child {
  border-bottom: 0;
}

.hx-dashboard-booking-main {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.hx-dashboard-booking-icon,
.hx-dashboard-empty-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: var(--hx-r-sm);
  background: var(--hx-primary-soft);
  color: var(--hx-primary-dark);
}

.hx-dashboard-booking-icon svg,
.hx-dashboard-empty-icon svg {
  width: 18px;
  height: 18px;
}

.hx-dashboard-booking-name,
.hx-dashboard-booking-date,
.hx-dashboard-booking-amount {
  display: grid;
  min-width: 0;
}

.hx-dashboard-booking-name strong,
.hx-dashboard-stock-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hx-dashboard-booking-name span,
.hx-dashboard-booking-date span,
.hx-dashboard-booking-amount span,
.hx-dashboard-stock-name span {
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
}

.hx-dashboard-booking-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.hx-dashboard-booking-date strong,
.hx-dashboard-booking-amount strong {
  font-size: var(--hx-fs-sm);
  white-space: nowrap;
}

.hx-dashboard-booking-amount {
  text-align: right;
}

.hx-dashboard-open {
  color: var(--hx-primary-dark);
  background: var(--hx-primary-soft);
}

.hx-dashboard-open svg {
  width: 17px;
  height: 17px;
}

.hx-dashboard-stock {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s3) 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--hx-border);
}

.hx-dashboard-stock:hover .hx-dashboard-stock-name strong {
  color: var(--hx-primary-dark);
}

.hx-dashboard-stock-image {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  background: var(--hx-sunken);
}

.hx-dashboard-stock-name,
.hx-dashboard-stock-qty {
  display: grid;
  min-width: 0;
}

.hx-dashboard-stock-qty {
  min-width: 76px;
  text-align: right;
}

.hx-dashboard-stock-qty strong {
  font-size: var(--hx-fs-lg);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.hx-dashboard-stock-qty small {
  color: var(--hx-success);
  font-size: 11px;
  font-weight: 700;
}

.hx-dashboard-stock-qty.is-low strong,
.hx-dashboard-stock-qty.is-low small {
  color: #9a6100;
}

.hx-dashboard-stock-qty.is-out strong,
.hx-dashboard-stock-qty.is-out small {
  color: var(--hx-danger);
}

.hx-dashboard-empty {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-height: 126px;
  padding: var(--hx-s5);
  color: var(--hx-muted);
}

.hx-dashboard-empty > div {
  display: grid;
}

.hx-dashboard-empty strong {
  color: var(--hx-text);
}

.hx-dashboard-empty span:not(.hx-dashboard-empty-icon) {
  font-size: var(--hx-fs-sm);
}

.hx-dashboard-empty-icon {
  color: var(--hx-success);
  background: var(--hx-success-soft);
  border-radius: 50%;
}

.hx-dashboard-empty-icon.is-warm {
  color: var(--hx-primary-dark);
  background: var(--hx-primary-soft);
}

@media (max-width: 1180px) {
  .hx-dashboard-commerce {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .hx-dashboard-overview-head {
    grid-template-columns: 1fr;
  }

  .hx-dashboard-overview-side {
    justify-content: space-between;
  }

  .hx-dashboard-today {
    margin-left: auto;
  }

  .hx-dashboard-booking {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hx-dashboard-booking-meta,
  .hx-dashboard-booking-date,
  .hx-dashboard-booking-amount {
    grid-column: auto;
  }

  .hx-dashboard-open {
    display: none;
  }
}

@media (max-width: 620px) {
  .hx-dashboard-overview {
    border-radius: var(--hx-r-md);
  }

  .hx-dashboard-overview-head,
  .hx-climate-section {
    padding: var(--hx-s5);
  }

  .hx-dashboard-overview-side {
    flex-direction: column;
  }

  .hx-dashboard-overview-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hx-dashboard-overview-actions .hx-btn {
    flex: 1;
    padding-inline: var(--hx-s3);
  }

  .hx-dashboard-today {
    width: 100%;
    margin-left: 0;
  }

  .hx-climate-section-head {
    align-items: flex-start;
  }

  .hx-climate-section-meta {
    align-items: flex-end;
    flex-direction: column-reverse;
    gap: 5px;
  }

  .hx-climate-card {
    flex-basis: min(84vw, 330px);
    padding: var(--hx-s4);
  }

  .hx-climate-metric {
    gap: var(--hx-s2);
    padding: 10px;
  }

  .hx-climate-metric-icon {
    width: 30px;
    height: 30px;
  }

  .hx-dashboard-panel-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hx-dashboard-panel-head .hx-card-head-actions {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .hx-dashboard-bookings {
    padding: var(--hx-s2) var(--hx-s4);
  }

  .hx-dashboard-booking {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--hx-s2) var(--hx-s3);
    padding: var(--hx-s4) 0;
  }

  .hx-dashboard-booking-meta {
    justify-content: flex-end;
  }

  .hx-dashboard-booking-date {
    padding-left: 50px;
  }

  .hx-dashboard-booking-amount {
    text-align: right;
  }
}

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

.hx-table-wrap {
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
  overflow-x: auto;
}

.hx-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--hx-fs-base);
}

.hx-table thead th {
  position: sticky;
  top: 0;
  background: var(--hx-sunken);
  text-align: left;
  padding: var(--hx-s3) var(--hx-s4);
  font-size: var(--hx-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--hx-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--hx-border);
}

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

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

.hx-table tbody tr:hover {
  background: var(--hx-sunken);
}

.hx-cell-strong {
  font-weight: 700;
}

.hx-cell-muted {
  color: var(--hx-muted);
}

.hx-cell-nowrap {
  white-space: nowrap;
}

.hx-cell-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* The base header rule is more specific than the utility class, so repeat the
   alignment at table-header specificity to keep labels over their values. */
.hx-table thead th.hx-cell-num {
  text-align: right;
}

.hx-cell-sub {
  display: block;
  font-size: var(--hx-fs-xs);
  color: var(--hx-muted);
  font-weight: 500;
  margin-top: 2px;
}

.hx-cell-actions {
  text-align: right;
  white-space: nowrap;
  width: 1%;
}

.hx-table thead th.hx-cell-actions {
  text-align: right;
}

.hx-batch-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: max-content;
}

.hx-batch-action {
  gap: 5px;
  padding: 6px 9px;
  font-size: 12px;
}

.hx-batch-action svg {
  width: 14px;
  height: 14px;
}

.hx-batch-action.is-complete {
  color: var(--hx-success);
  border-color: rgba(37, 115, 93, 0.3);
  background: var(--hx-success-soft);
}

.hx-batch-action.is-complete:hover:not(:disabled) {
  border-color: var(--hx-success);
  background: #d3eddf;
}

.hx-batch-action.is-delete {
  color: var(--hx-danger);
  border-color: rgba(209, 67, 67, 0.28);
  background: var(--hx-danger-soft);
}

.hx-batch-action.is-delete:hover:not(:disabled) {
  border-color: var(--hx-danger);
  background: #ffd8d8;
}

.hx-batch-action.is-details {
  color: var(--hx-on-primary);
  border-color: var(--hx-primary-dark);
  background: linear-gradient(135deg, var(--hx-primary), var(--hx-primary-dark));
  box-shadow: 0 3px 9px rgba(232, 111, 46, 0.22);
}

.hx-batch-action.is-details:hover:not(:disabled) {
  color: var(--hx-on-primary);
  filter: brightness(1.06);
  box-shadow: 0 5px 12px rgba(232, 111, 46, 0.32);
  transform: translateY(-1px);
}

.hx-completed-batches-table {
  min-width: 1040px;
  table-layout: fixed;
}

.hx-completed-batches-table .hx-col-batch { width: 18%; }
.hx-completed-batches-table .hx-col-date { width: 12%; }
.hx-completed-batches-table .hx-col-eggs { width: 8%; }
.hx-completed-batches-table .hx-col-infertile { width: 9%; }
.hx-completed-batches-table .hx-col-rate { width: 10%; }
.hx-completed-batches-table .hx-col-chicks { width: 8%; }
.hx-completed-batches-table .hx-col-actions { width: 13%; }

.hx-pager.hx-numbered-pager {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--hx-surface);
  box-shadow: none;
}

/* Let the count, page group and arrows participate in one clean toolbar even
   though templates keep them wrapped together for readability. */
.hx-numbered-pager-center {
  display: contents;
}

.hx-numbered-pager-summary {
  order: 1;
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  color: var(--hx-muted);
  font-size: 13px;
  font-weight: 650;
}

.hx-pagination-meta {
  display: flex;
  align-items: center;
  gap: var(--hx-s4);
}

.hx-pagination-range strong {
  color: var(--hx-text);
  font-weight: 800;
}

.hx-page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.hx-page-size-control select {
  height: 34px;
  min-width: 66px;
  padding: 0 27px 0 10px;
  color: var(--hx-text);
  border: 1px solid var(--hx-border-strong);
  border-radius: 8px;
  background-color: var(--hx-surface);
  font: inherit;
  font-weight: 750;
}

.hx-numbered-pager-summary::before {
  display: none;
}

.hx-numbered-pager > .hx-numbered-pager-nav:first-child,
.hx-numbered-pager > .hx-numbered-pager-placeholder:first-child {
  order: 2;
}

.hx-page-numbers {
  order: 3;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
}

.hx-numbered-pager > .hx-numbered-pager-nav:last-child,
.hx-numbered-pager > .hx-numbered-pager-placeholder:last-child {
  order: 4;
}

.hx-numbered-pager-nav,
.hx-numbered-pager-placeholder {
  width: auto;
  min-width: 34px;
  height: 34px;
}

.hx-numbered-pager-nav,
.hx-numbered-pager-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  color: var(--hx-muted);
  border: 1px solid var(--hx-border-strong);
  border-radius: 50%;
  background: var(--hx-surface);
  font-size: 0;
  font-weight: 800;
  box-shadow: none;
}

.hx-numbered-pager-placeholder {
  opacity: 0.42;
}

.hx-numbered-pager > :first-child::before,
.hx-numbered-pager > :last-child::after {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
}

.hx-numbered-pager > :first-child::before {
  transform: rotate(135deg);
}

.hx-numbered-pager > :first-child::after {
  display: none;
}

.hx-numbered-pager > :last-child::before {
  display: none;
}

.hx-numbered-pager > :last-child::after {
  transform: rotate(-45deg);
}

.hx-numbered-pager-nav:hover {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 44%, var(--hx-border));
  background: var(--hx-info-soft);
  box-shadow: none;
  transform: none;
}

.hx-page-number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--hx-muted);
  border: 1px solid var(--hx-border);
  border-radius: 50%;
  background: var(--hx-surface);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: color var(--hx-transition), border-color var(--hx-transition),
              background var(--hx-transition), box-shadow var(--hx-transition),
              transform var(--hx-transition);
}

.hx-page-number:hover {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 42%, var(--hx-border));
  background: var(--hx-info-soft);
  transform: none;
}

.hx-page-number.is-active {
  color: #fff;
  border-color: var(--hx-info);
  background: var(--hx-info);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--hx-info) 24%, transparent);
}

.hx-page-number:focus-visible,
.hx-numbered-pager-nav:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--hx-info) 25%, transparent);
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .hx-pager.hx-numbered-pager {
    flex-wrap: wrap;
    padding: 12px;
  }

  .hx-numbered-pager-summary {
    flex: 1 0 100%;
    justify-content: center;
    margin: 0 0 2px;
  }

  .hx-pagination-meta {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--hx-s2) var(--hx-s4);
  }

  .hx-page-numbers {
    order: 2;
    flex: 1 0 100%;
    justify-content: center;
  }

  .hx-numbered-pager > .hx-numbered-pager-nav:first-child,
  .hx-numbered-pager > .hx-numbered-pager-placeholder:first-child,
  .hx-numbered-pager > .hx-numbered-pager-nav:last-child,
  .hx-numbered-pager > .hx-numbered-pager-placeholder:last-child {
    order: 3;
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }

  .hx-numbered-pager-placeholder {
    display: inline-flex;
  }
}

@media (max-width: 420px) {
  .hx-page-number {
    width: 32px;
    height: 32px;
  }
}

/* A name cell with a leading thumbnail. */
.hx-media {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  min-width: 0;
}

.hx-thumb {
  width: 42px;
  height: 42px;
  border-radius: var(--hx-r-sm);
  object-fit: cover;
  background: var(--hx-sunken);
  border: 1px solid var(--hx-border);
  flex: 0 0 auto;
}

.hx-thumb-lg {
  width: 96px;
  height: 96px;
  border-radius: var(--hx-r-md);
}

/* ------------------------------------------------------------------ pills */

.hx-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--hx-r-pill);
  font-size: var(--hx-fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.hx-pill-neutral {
  background: var(--hx-sunken);
  color: var(--hx-muted);
}
.hx-pill-success,
.hx-pill-green {
  background: var(--hx-success-soft);
  color: var(--hx-success);
}
.hx-pill-warning,
.hx-pill-yellow {
  background: var(--hx-warning-soft);
  color: #8a5b00;
}
.hx-pill-danger,
.hx-pill-red {
  background: var(--hx-danger-soft);
  color: var(--hx-danger);
}
.hx-pill-info {
  background: var(--hx-info-soft);
  color: var(--hx-info);
}
.hx-pill-primary {
  background: var(--hx-primary-soft);
  color: var(--hx-primary-dark);
}
.hx-pill-normal {
  background: var(--hx-sunken);
  color: var(--hx-muted);
}

/* A batch whose action is overdue gets a pulsing dot, matching the mobile app. */
.hx-pill-red .hx-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: hx-pulse 1.4s ease-in-out infinite;
}

@keyframes hx-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.25;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hx-pill-red .hx-dot {
    animation: none;
  }
}

/* ------------------------------------------------------------------ progress */

.hx-progress {
  height: 6px;
  border-radius: var(--hx-r-pill);
  background: var(--hx-sunken);
  overflow: hidden;
}

.hx-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hx-primary), var(--hx-primary-dark));
}

.hx-progress-bar.is-over {
  background: linear-gradient(90deg, #e88b8b, var(--hx-danger));
}

.hx-progress-label {
  margin-top: 5px;
  font-size: var(--hx-fs-xs);
  color: var(--hx-muted);
  font-weight: 600;
}

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

.hx-form {
  display: grid;
  gap: var(--hx-s5);
}

.hx-field {
  display: grid;
  gap: 6px;
  /* Without this the input stretches to fill the row when a neighbouring field is made
     taller by its help text, leaving the two controls misaligned. */
  align-content: start;
}

.hx-field > label,
.hx-label {
  font-weight: 700;
  font-size: var(--hx-fs-sm);
}

.hx-required {
  color: var(--hx-danger);
}

.hx-input,
.hx-select,
.hx-textarea {
  width: 100%;
  padding: 10px var(--hx-s3);
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  font: inherit;
  font-size: var(--hx-fs-base);
  color: var(--hx-text);
  transition: border-color var(--hx-transition), box-shadow var(--hx-transition);
}

.hx-input:focus,
.hx-select:focus,
.hx-textarea:focus {
  outline: none;
  border-color: var(--hx-primary);
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

.hx-input[aria-invalid="true"],
.hx-select[aria-invalid="true"],
.hx-textarea[aria-invalid="true"] {
  border-color: var(--hx-danger);
}

.hx-textarea {
  min-height: 92px;
  resize: vertical;
}

.hx-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b6b5c' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 17px;
  padding-right: 36px;
}

.hx-help {
  font-size: var(--hx-fs-xs);
  color: var(--hx-muted);
}

.hx-error {
  font-size: var(--hx-fs-xs);
  color: var(--hx-danger);
  font-weight: 600;
}

.hx-field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--hx-s4);
}

.hx-input-affix {
  display: flex;
  align-items: stretch;
}

.hx-input-affix .hx-affix {
  display: grid;
  place-items: center;
  padding: 0 var(--hx-s3);
  border: 1px solid var(--hx-border-strong);
  border-right: 0;
  border-radius: var(--hx-r-sm) 0 0 var(--hx-r-sm);
  background: var(--hx-sunken);
  color: var(--hx-muted);
  font-weight: 700;
  white-space: nowrap;
}

.hx-input-affix .hx-input {
  border-radius: 0 var(--hx-r-sm) var(--hx-r-sm) 0;
}

.hx-form-actions {
  display: flex;
  gap: var(--hx-s3);
  justify-content: flex-end;
  padding-top: var(--hx-s2);
}

.hx-fieldset {
  border: 0;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--hx-s5);
}

.hx-fieldset > legend {
  font-weight: 800;
  font-size: var(--hx-fs-md);
  padding: 0 0 var(--hx-s2);
}

/* Integration editor: calibration is a distinct, explanatory control group. */
.hx-integration-form-card {
  width: min(760px, 100%);
}

.hx-calibration-panel {
  display: grid;
  gap: var(--hx-s4);
  padding: var(--hx-s4);
  border: 1px solid color-mix(in srgb, var(--hx-primary) 20%, var(--hx-border));
  border-radius: var(--hx-r-md);
  background: linear-gradient(145deg, var(--hx-surface-warm), var(--hx-surface));
}

.hx-calibration-head {
  display: flex;
  align-items: flex-start;
  gap: var(--hx-s3);
}

.hx-calibration-head h2 {
  margin: 0;
  font-size: var(--hx-fs-md);
}

.hx-calibration-head p {
  margin: 3px 0 0;
  color: var(--hx-muted);
  font-size: var(--hx-fs-sm);
  line-height: 1.45;
}

.hx-calibration-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--hx-primary-dark);
  border: 1px solid color-mix(in srgb, var(--hx-primary) 26%, transparent);
  border-radius: var(--hx-r-sm);
  background: var(--hx-primary-soft);
}

.hx-calibration-icon svg {
  width: 19px;
  height: 19px;
}

.hx-calibration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--hx-s4);
}

.hx-offset-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: stretch;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  transition: border-color var(--hx-transition), box-shadow var(--hx-transition);
}

.hx-offset-control:focus-within {
  border-color: var(--hx-primary);
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

.hx-offset-control .hx-input {
  min-width: 0;
  height: 100%;
  padding-inline: var(--hx-s3);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: var(--hx-fs-md);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hx-offset-control .hx-input:focus {
  box-shadow: none;
}

.hx-offset-metric,
.hx-offset-unit {
  display: grid;
  place-items: center;
  color: var(--hx-muted);
  background: var(--hx-sunken);
}

.hx-offset-metric {
  border-right: 1px solid var(--hx-border);
}

.hx-offset-metric svg {
  width: 18px;
  height: 18px;
}

.hx-offset-metric.is-temperature {
  color: var(--hx-primary-dark);
  background: var(--hx-primary-soft);
}

.hx-offset-metric.is-humidity {
  color: var(--hx-info);
  background: var(--hx-info-soft);
}

.hx-offset-unit {
  border-left: 1px solid var(--hx-border);
  font-size: var(--hx-fs-sm);
  font-weight: 800;
}

.hx-calibration-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  padding-top: var(--hx-s3);
  border-top: 1px solid var(--hx-border);
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
  line-height: 1.45;
}

.hx-calibration-note svg {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 auto;
}

@media (max-width: 620px) {
  .hx-calibration-grid {
    grid-template-columns: 1fr;
  }
}

/* Choice chips — the desktop stand-in for the mobile app's segmented selectors. */
.hx-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hx-s2);
}

.hx-chip {
  position: relative;
  display: inline-flex;
}

.hx-chip input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hx-chip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px var(--hx-s4);
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-pill);
  background: var(--hx-surface);
  font-weight: 600;
  font-size: var(--hx-fs-sm);
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-chip span svg {
  width: 15px;
  height: 15px;
}

.hx-chip input:checked + span,
.hx-chip.is-on span {
  background: var(--hx-primary-soft);
  border-color: var(--hx-primary);
  color: var(--hx-primary-dark);
}

.hx-chip input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

/* Toggle switch */
.hx-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--hx-s3);
  cursor: pointer;
}

.hx-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.hx-toggle-track {
  width: 42px;
  height: 24px;
  border-radius: var(--hx-r-pill);
  background: var(--hx-border-strong);
  position: relative;
  flex: 0 0 auto;
  transition: background var(--hx-transition);
}

.hx-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--hx-shadow-sm);
  transition: transform var(--hx-transition);
}

.hx-toggle input:checked ~ .hx-toggle-track,
.hx-toggle.is-on .hx-toggle-track {
  background: var(--hx-primary);
}

.hx-toggle input:checked ~ .hx-toggle-track::after,
.hx-toggle.is-on .hx-toggle-track::after {
  transform: translateX(18px);
}

.hx-toggle input:focus-visible ~ .hx-toggle-track {
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

/* Image picker with live preview */
.hx-imagepick {
  display: flex;
  align-items: center;
  gap: var(--hx-s4);
}

.hx-imagepick-preview {
  width: 88px;
  height: 88px;
  border-radius: var(--hx-r-md);
  object-fit: cover;
  border: 1px dashed var(--hx-border-strong);
  background: var(--hx-sunken);
  flex: 0 0 auto;
}

.hx-imagepick-controls {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hx-imagepick input[type="file"] {
  font-size: var(--hx-fs-sm);
  max-width: 100%;
}

/* ------------------------------------------------------------------ filter bar */

.hx-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--hx-s3);
  padding: var(--hx-s4);
  margin-bottom: var(--hx-s5);
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
}

.hx-filterbar .hx-field {
  min-width: 170px;
}

.hx-filterbar .hx-field-grow {
  flex: 1;
  min-width: 220px;
}

.hx-filterbar-actions {
  display: flex;
  gap: var(--hx-s2);
  margin-left: auto;
}

.hx-filterbar-actions-modern {
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--hx-sunken);
  border: 1px solid var(--hx-border);
  border-radius: calc(var(--hx-r-sm) + 4px);
}

.hx-filterbar-actions-modern .hx-btn {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: var(--hx-r-sm);
}

.hx-filter-clear {
  color: var(--hx-muted);
  background: transparent;
}

.hx-filter-clear:hover {
  color: var(--hx-text);
  background: var(--hx-surface);
  box-shadow: 0 1px 3px rgba(61, 42, 27, 0.1);
}

.hx-filter-apply {
  color: var(--hx-on-primary);
  background: linear-gradient(135deg, var(--hx-primary), var(--hx-primary-dark));
  box-shadow: 0 4px 12px rgba(232, 111, 46, 0.24);
}

.hx-filter-apply:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 6px 16px rgba(232, 111, 46, 0.32);
}

.hx-filter-apply:active:not(:disabled) {
  transform: translateY(0);
}

/* Alert history: condition belongs beside device; dates and actions complete
   the same scan-friendly row on wide screens. */
.hx-alert-report-filter {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(190px, 1.1fr)
                         minmax(145px, .8fr) minmax(145px, .8fr) auto;
  align-items: end;
  gap: var(--hx-s3);
}

.hx-alert-report-filter .hx-field {
  min-width: 0;
}

.hx-alert-report-filter .hx-select,
.hx-alert-report-filter .hx-input {
  width: 100%;
}

@media (max-width: 1120px) {
  .hx-alert-report-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hx-alert-report-filter .hx-filterbar-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 620px) {
  .hx-alert-report-filter {
    grid-template-columns: 1fr;
  }

  .hx-alert-report-filter .hx-filterbar-actions {
    grid-column: auto;
    justify-self: stretch;
  }

  .hx-alert-report-filter .hx-filterbar-actions .hx-btn {
    flex: 1;
  }
}

/* Customer search: a labeled query panel with a quick, scannable payment-status segment. */
.hx-customer-filter {
  display: block;
  overflow: hidden;
  padding: 0;
}

.hx-customer-filter-head {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s3) var(--hx-s4);
  border-bottom: 1px solid var(--hx-border);
  background: linear-gradient(135deg, var(--hx-primary-soft), var(--hx-surface) 72%);
}

.hx-customer-filter-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--hx-primary-dark);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  box-shadow: var(--hx-shadow-sm);
}

.hx-customer-filter-icon svg {
  width: 19px;
  height: 19px;
}

.hx-customer-filter-head > div {
  display: grid;
  gap: 1px;
}

.hx-customer-filter-head strong {
  font-size: var(--hx-fs-base);
}

.hx-customer-filter-head span:not(.hx-customer-filter-icon) {
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
}

.hx-customer-filter-body {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  gap: var(--hx-s4);
  padding: var(--hx-s4);
}

.hx-customer-filter-body .hx-search {
  width: 100%;
}

.hx-customer-status-filter {
  min-width: 0;
  padding: 0;
  border: 0;
}

.hx-customer-status-filter legend {
  margin-bottom: 6px;
  font-size: var(--hx-fs-sm);
  font-weight: 700;
}

.hx-customer-status-options {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--hx-border);
  border-radius: calc(var(--hx-r-sm) + 4px);
  background: var(--hx-sunken);
}

.hx-customer-status-option {
  position: relative;
}

.hx-customer-status-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.hx-customer-status-option span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 var(--hx-s4);
  color: var(--hx-muted);
  border: 1px solid transparent;
  border-radius: var(--hx-r-sm);
  font-size: var(--hx-fs-sm);
  font-weight: 750;
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-customer-status-option input:checked + span {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 32%, var(--hx-border));
  background: var(--hx-primary-soft);
  box-shadow: 0 2px 5px rgba(61, 42, 27, 0.09);
}

.hx-customer-status-option.is-due input:checked + span {
  color: #9a6308;
  border-color: color-mix(in srgb, var(--hx-warning) 38%, var(--hx-border));
  background: var(--hx-warning-soft);
}

.hx-customer-status-option.is-paid input:checked + span {
  color: var(--hx-success);
  border-color: color-mix(in srgb, var(--hx-success) 30%, var(--hx-border));
  background: var(--hx-success-soft);
}

.hx-customer-status-option input:focus-visible + span {
  outline: 2px solid var(--hx-primary);
  outline-offset: 2px;
}

@media (max-width: 980px) {
  .hx-customer-filter-body {
    grid-template-columns: minmax(240px, 1fr) auto;
  }

  .hx-customer-filter-body .hx-filterbar-actions {
    grid-column: 1 / -1;
    justify-self: end;
  }
}

@media (max-width: 650px) {
  .hx-customer-filter-body {
    grid-template-columns: 1fr;
  }

  .hx-customer-status-options,
  .hx-customer-filter-body .hx-filterbar-actions {
    width: 100%;
  }

  .hx-customer-status-option,
  .hx-customer-status-option span,
  .hx-customer-filter-body .hx-filterbar-actions .hx-btn {
    flex: 1;
  }

  .hx-customer-filter-body .hx-filterbar-actions {
    grid-column: auto;
  }
}

/* Sales and booking filters: related controls share two deliberate rows. */
.hx-commerce-filter {
  display: block;
  overflow: hidden;
  padding: 0;
}

.hx-commerce-filter-head {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s3) var(--hx-s4);
  border-bottom: 1px solid var(--hx-border);
  background: linear-gradient(135deg, var(--hx-info-soft), var(--hx-surface) 74%);
}

.hx-commerce-filter-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--hx-info);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  box-shadow: var(--hx-shadow-sm);
}

.hx-commerce-filter-icon svg { width: 19px; height: 19px; }
.hx-commerce-filter-head > div { display: grid; gap: 1px; }
.hx-commerce-filter-head strong { font-size: var(--hx-fs-base); }

.hx-commerce-filter-head span:not(.hx-commerce-filter-icon) {
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
}

.hx-commerce-filter-body {
  display: grid;
  gap: var(--hx-s4);
  padding: var(--hx-s4);
}

.hx-commerce-filter-row {
  display: grid;
  align-items: end;
  gap: var(--hx-s4);
}

.hx-commerce-filter-row.is-main {
  grid-template-columns: minmax(280px, 1fr) minmax(170px, .42fr) minmax(190px, .48fr);
}

.hx-commerce-filter-row.is-secondary {
  grid-template-columns: minmax(340px, .85fr) auto minmax(max-content, 1fr);
}

.hx-commerce-filter-row .hx-search { width: 100%; }

.hx-commerce-date-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: var(--hx-s3);
}

.hx-commerce-payment-filter {
  min-width: 0;
  padding: 0;
  border: 0;
}

.hx-commerce-payment-filter legend {
  margin-bottom: 6px;
  font-size: var(--hx-fs-sm);
  font-weight: 700;
}

.hx-commerce-payment-options {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--hx-border);
  border-radius: calc(var(--hx-r-sm) + 4px);
  background: var(--hx-sunken);
}

.hx-commerce-payment-option { position: relative; }

.hx-commerce-payment-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.hx-commerce-payment-option span {
  display: grid;
  place-items: center;
  min-width: 66px;
  min-height: 38px;
  padding: 0 var(--hx-s3);
  color: var(--hx-muted);
  border: 1px solid transparent;
  border-radius: var(--hx-r-sm);
  font-size: var(--hx-fs-sm);
  font-weight: 750;
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-commerce-payment-option input:checked + span {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 30%, var(--hx-border));
  background: var(--hx-info-soft);
  box-shadow: 0 2px 5px rgba(61, 42, 27, 0.09);
}

.hx-commerce-payment-option.is-paid input:checked + span {
  color: var(--hx-success);
  border-color: color-mix(in srgb, var(--hx-success) 30%, var(--hx-border));
  background: var(--hx-success-soft);
}

.hx-commerce-payment-option.is-due input:checked + span {
  color: #9a6308;
  border-color: color-mix(in srgb, var(--hx-warning) 38%, var(--hx-border));
  background: var(--hx-warning-soft);
}

.hx-commerce-payment-option input:focus-visible + span {
  outline: 2px solid var(--hx-primary);
  outline-offset: 2px;
}

.hx-commerce-filter-row.is-secondary > .hx-filterbar-actions { justify-self: end; }

@media (max-width: 1080px) {
  .hx-commerce-filter-row.is-secondary { grid-template-columns: minmax(340px, 1fr) auto; }
  .hx-commerce-filter-row.is-secondary > .hx-filterbar-actions { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .hx-commerce-filter-row.is-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hx-commerce-filter-row.is-main > .hx-field-grow,
  .hx-commerce-filter-row.is-secondary > .hx-filterbar-actions { grid-column: 1 / -1; }
  .hx-commerce-filter-row.is-secondary { grid-template-columns: 1fr; }
  .hx-commerce-payment-options { width: 100%; }
  .hx-commerce-payment-option,
  .hx-commerce-payment-option span { flex: 1; }
}

@media (max-width: 520px) {
  .hx-commerce-filter-row.is-main,
  .hx-commerce-date-group { grid-template-columns: 1fr; }
  .hx-commerce-filter-row.is-main > .hx-field-grow { grid-column: auto; }
}

/* Report search panel: a deliberate query surface rather than a loose row of controls. */
.hx-report-search {
  margin-bottom: var(--hx-s5);
  overflow: hidden;
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
}

.hx-report-search-head {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s4) var(--hx-s5);
  background: linear-gradient(100deg, var(--hx-surface-warm), #fffaf0 72%);
  border-bottom: 1px solid var(--hx-border);
}

.hx-report-search-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  color: var(--hx-primary-dark);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(169, 70, 29, 0.15);
  border-radius: var(--hx-r-sm);
}

.hx-report-search-icon svg {
  width: 19px;
  height: 19px;
}

.hx-report-search-head h2,
.hx-report-search-head p {
  margin: 0;
}

.hx-report-search-head h2 {
  font-size: var(--hx-fs-md);
  font-weight: 850;
}

.hx-report-search-head p {
  margin-top: 2px;
  color: var(--hx-muted);
  font-size: var(--hx-fs-sm);
}

.hx-report-search-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(210px, 1fr)) auto;
  align-items: end;
  gap: var(--hx-s3);
  padding: var(--hx-s5);
}

/* Temperature has a second row: its low/high limits stay together, followed by the submit action. */
.hx-report-search-fields-with-limits {
  grid-template-columns: minmax(220px, 1.25fr) repeat(2, minmax(210px, 1fr));
}

.hx-report-search-fields .hx-input-date {
  width: 100%;
}

.hx-report-search-submit {
  min-height: 42px;
  white-space: nowrap;
}

.hx-report-kpis {
  margin-top: var(--hx-s5);
}

.hx-report-kpis .hx-kpi-row:last-child {
  margin-bottom: 0;
}

@media (max-width: 1050px) {
  .hx-report-search-fields,
  .hx-report-search-fields-with-limits {
    grid-template-columns: repeat(2, minmax(210px, 1fr));
  }

  .hx-report-device-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .hx-report-search-fields,
  .hx-report-search-fields-with-limits {
    grid-template-columns: 1fr;
  }

  .hx-report-device-field {
    grid-column: auto;
  }

  .hx-report-search-submit {
    width: 100%;
  }
}

/* ------------------------------------------------------------------ alerts */

.hx-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--hx-s3);
  padding: var(--hx-s4);
  border-radius: var(--hx-r-sm);
  margin-bottom: var(--hx-s5);
  font-weight: 600;
  border: 1px solid transparent;
}

.hx-alert svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.hx-alert-success {
  background: var(--hx-success-soft);
  color: var(--hx-success);
  border-color: rgba(37, 115, 93, 0.25);
}

.hx-alert-error {
  background: var(--hx-danger-soft);
  color: var(--hx-danger);
  border-color: rgba(209, 67, 67, 0.25);
}

.hx-alert-info {
  background: var(--hx-info-soft);
  color: var(--hx-info);
  border-color: rgba(58, 110, 165, 0.25);
}

.hx-alert-warning {
  background: var(--hx-warning-soft);
  color: #8a5b00;
  border-color: rgba(245, 165, 36, 0.35);
}

/* ------------------------------------------------------------------ empty state */

.hx-empty {
  padding: var(--hx-s8) var(--hx-s5);
  text-align: center;
  color: var(--hx-muted);
}

.hx-empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--hx-s4);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--hx-sunken);
  color: var(--hx-faint);
}

.hx-empty-icon svg {
  width: 26px;
  height: 26px;
}

.hx-empty h3 {
  font-size: var(--hx-fs-md);
  color: var(--hx-text);
  margin-bottom: var(--hx-s2);
}

.hx-empty p {
  margin: 0 auto var(--hx-s5);
  max-width: 420px;
}

/* ------------------------------------------------------------------ pager */

.hx-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--hx-s3);
  margin-top: var(--hx-s5);
  padding: 10px 12px;
  border: 1px solid var(--hx-border);
  border-radius: 12px;
  background: var(--hx-surface);
  box-shadow: none;
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
}

.hx-pager:not(.hx-numbered-pager) .hx-btn {
  color: var(--hx-muted);
  border-color: var(--hx-border-strong);
  background: var(--hx-surface);
}

.hx-pager:not(.hx-numbered-pager) .hx-btn:hover {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 42%, var(--hx-border));
  background: var(--hx-info-soft);
}

.hx-pager-spacer {
  flex: 1;
}

/* ------------------------------------------------------------------ row actions */

.hx-menu {
  position: relative;
  display: inline-block;
}

.hx-menu-panel {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 184px;
  padding: 6px;
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  box-shadow: var(--hx-shadow-lg);
  z-index: var(--hx-z-topbar);
}

.hx-menu.is-open .hx-menu-panel {
  display: block;
}

.hx-menu-item {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  width: 100%;
  padding: 8px var(--hx-s3);
  border: 0;
  border-radius: var(--hx-r-xs);
  background: transparent;
  color: var(--hx-text);
  font: inherit;
  font-size: var(--hx-fs-sm);
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.hx-menu-item:hover {
  background: var(--hx-sunken);
}

.hx-menu-item svg {
  width: 16px;
  height: 16px;
  color: var(--hx-muted);
}

.hx-menu-item.is-danger {
  color: var(--hx-danger);
}

.hx-menu-item.is-danger svg {
  color: var(--hx-danger);
}

.hx-menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--hx-border);
}

.hx-menu-form {
  display: contents;
}

/* ------------------------------------------------------------------ modal */

.hx-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: var(--hx-z-modal);
  padding: var(--hx-s5);
  overflow-y: auto;
}

.hx-modal.is-open {
  display: grid;
  place-items: start center;
  align-content: center;
}

.hx-modal-scrim {
  position: fixed;
  inset: 0;
  background: rgba(43, 33, 24, 0.5);
}

.hx-modal-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  background: var(--hx-surface);
  border-radius: var(--hx-r-lg);
  box-shadow: var(--hx-shadow-xl);
  max-height: calc(100vh - 2 * var(--hx-s5));
  display: flex;
  flex-direction: column;
}

.hx-modal-card.is-wide {
  max-width: 720px;
}

.hx-modal-head {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  padding: var(--hx-s5) var(--hx-s5) var(--hx-s4);
  border-bottom: 1px solid var(--hx-border);
}

.hx-modal-head h2 {
  font-size: var(--hx-fs-md);
  font-weight: 800;
}

.hx-modal-head p {
  margin: 2px 0 0;
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
  font-weight: 500;
}

.hx-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--hx-r-sm);
  display: grid;
  place-items: center;
  background: var(--hx-primary-soft);
  color: var(--hx-primary-dark);
  flex: 0 0 auto;
}

.hx-modal-icon svg {
  width: 19px;
  height: 19px;
}

.hx-modal-icon.is-danger {
  background: var(--hx-danger-soft);
  color: var(--hx-danger);
}

.hx-modal-close {
  margin-left: auto;
}

.hx-modal-body {
  padding: var(--hx-s5);
  overflow-y: auto;
}

.hx-modal-foot {
  display: flex;
  gap: var(--hx-s3);
  justify-content: flex-end;
  padding: var(--hx-s4) var(--hx-s5) var(--hx-s5);
  border-top: 1px solid var(--hx-border);
}

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

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

.hx-tab {
  padding: var(--hx-s3) var(--hx-s4);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: inherit;
  font-weight: 700;
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

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

.hx-tab.is-active {
  color: var(--hx-primary-dark);
  border-bottom-color: var(--hx-primary);
}

/* ------------------------------------------------------------------ timeline */

.hx-timeline {
  display: grid;
  gap: var(--hx-s4);
}

.hx-timeline-row {
  display: flex;
  gap: var(--hx-s4);
  align-items: flex-start;
}

.hx-timeline-mark {
  position: relative;
  width: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.hx-timeline-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--hx-sunken);
  color: var(--hx-faint);
  border: 1px solid var(--hx-border);
}

.hx-timeline-dot svg {
  width: 17px;
  height: 17px;
}

.hx-timeline-dot.is-done {
  background: var(--hx-success-soft);
  color: var(--hx-success);
  border-color: rgba(37, 115, 93, 0.3);
}

/* Connector between consecutive steps. */
.hx-timeline-row:not(:last-child) .hx-timeline-mark::after {
  content: "";
  position: absolute;
  top: 36px;
  bottom: calc(-1 * var(--hx-s4) - 2px);
  width: 2px;
  background: var(--hx-border);
}

.hx-timeline-body {
  padding-top: 5px;
  min-width: 0;
}

.hx-timeline-title {
  font-weight: 700;
}

.hx-timeline-meta {
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
}

/* ------------------------------------------------------------------ definition list */

.hx-dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--hx-s4) var(--hx-s5);
  margin: 0;
}

.hx-dl > div {
  min-width: 0;
}

.hx-dl dt {
  font-size: var(--hx-fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--hx-muted);
}

.hx-dl dd {
  margin: 4px 0 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ climate chart */

.hx-chart {
  position: relative;
  width: 100%;
  overflow-x: auto;
  padding-top: var(--hx-s3);
}

.hx-chart svg {
  display: block;
  min-width: 620px;
  width: 100%;
  height: auto;
  touch-action: pan-x;
}

.hx-chart-grid {
  stroke: var(--hx-border);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.hx-chart-axis {
  fill: var(--hx-muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hx-chart-time {
  fill: var(--hx-faint);
}

.hx-chart-line-temperature,
.hx-chart-line-temp {
  fill: none;
  stroke: var(--hx-primary);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.hx-chart-line-humidity,
.hx-chart-line-hum {
  fill: none;
  stroke: var(--hx-info);
  stroke-width: 2.6;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.hx-chart-gradient-start {
  stop-color: var(--hx-primary);
  stop-opacity: 0.2;
}

.hx-chart-gradient-end {
  stop-color: var(--hx-primary);
  stop-opacity: 0.01;
}

[data-metric="humidity"] .hx-chart-gradient-start,
[data-metric="humidity"] .hx-chart-gradient-end {
  stop-color: var(--hx-info);
}

.hx-chart-band {
  fill: rgba(232, 111, 46, 0.22);
  stroke: none;
}

.hx-chart-area {
  fill: url("#hx-climate-fill");
}

.hx-chart-point {
  stroke: var(--hx-surface);
  stroke-width: 1.5;
}

.hx-chart-point-temperature,
.hx-chart-point-temp {
  fill: var(--hx-primary);
}

.hx-chart-point-humidity,
.hx-chart-point-hum {
  fill: var(--hx-info);
}

.hx-chart-crosshair {
  stroke: var(--hx-border-strong);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  opacity: 0;
  pointer-events: none;
}

.hx-chart-focus {
  opacity: 0;
  stroke: var(--hx-surface);
  stroke-width: 3;
  filter: drop-shadow(0 2px 3px rgba(43, 33, 24, 0.2));
  pointer-events: none;
}

.hx-chart-crosshair.is-visible,
.hx-chart-focus.is-visible {
  opacity: 1;
}

.hx-chart-tooltip {
  position: absolute;
  z-index: 2;
  display: grid;
  gap: 2px;
  min-width: 138px;
  padding: 9px 12px;
  color: var(--hx-muted);
  background: rgba(43, 33, 24, 0.94);
  border-radius: var(--hx-r-sm);
  box-shadow: var(--hx-shadow-md);
  font-size: 11px;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -100%);
  transition: opacity 80ms ease;
}

.hx-chart-tooltip.is-visible {
  opacity: 1;
}

.hx-chart-tooltip span {
  color: rgba(255, 255, 255, 0.68);
}

.hx-chart-tooltip strong {
  color: #fff;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.hx-chart-tooltip-range {
  display: block;
  margin-top: 1px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.6);
}

.hx-chart-tooltip-range[hidden] {
  display: none;
}

.hx-chart-eyebrow {
  margin-bottom: 3px;
  color: var(--hx-primary-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hx-chart-title {
  margin: 0;
}

.hx-chart-unit {
  margin-left: auto;
  padding: 6px 10px;
  color: var(--hx-muted);
  background: var(--hx-sunken);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-pill);
  font-size: 11px;
  font-weight: 700;
}

.hx-chart-legend {
  display: flex;
  gap: var(--hx-s5);
  align-items: center;
  font-size: var(--hx-fs-sm);
  font-weight: 600;
  color: var(--hx-muted);
  margin-bottom: var(--hx-s4);
}

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

.hx-chart-swatch {
  width: 14px;
  height: 3px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ misc */

.hx-inline-form {
  display: inline;
}

.hx-stack {
  display: grid;
  gap: var(--hx-s5);
}

.hx-row {
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  flex-wrap: wrap;
}

.hx-muted {
  color: var(--hx-muted);
}

.hx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ search input
   A filter-bar text field with a leading magnifier. The icon is positioned rather
   than inlined so the input keeps its native clear button on WebKit. */

.hx-search {
  position: relative;
  flex: 1 1 240px;
  min-width: 180px;
}

.hx-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 17px;
  height: 17px;
  transform: translateY(-50%);
  color: var(--hx-faint);
  pointer-events: none;
}

.hx-search .hx-input {
  padding-left: 36px;
}

/* ------------------------------------------------------------------ inline link */

.hx-link {
  color: var(--hx-primary-dark);
  text-decoration: none;
  font-weight: 600;
}

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

/* ------------------------------------------------------------------ card title */

.hx-card-title {
  margin: 0 0 var(--hx-s4);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--hx-text);
}

/* ------------------------------------------------------------------ payment workspace */

.hx-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hx-s4);
  margin-bottom: var(--hx-s4);
}

.hx-section-head .hx-card-title {
  margin-bottom: 3px;
}

.hx-section-head p,
.hx-payment-composer-head p {
  margin: 0;
  color: var(--hx-muted);
  font-size: var(--hx-fs-sm);
}

.hx-payment-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  overflow: hidden;
  background: var(--hx-sunken);
  margin-bottom: var(--hx-s4);
}

.hx-payment-summary > div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
  border-right: 1px solid var(--hx-border);
}

.hx-payment-summary > div:last-child {
  border-right: 0;
}

.hx-payment-summary span {
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.hx-payment-summary strong {
  font-size: var(--hx-fs-md);
  font-variant-numeric: tabular-nums;
}

.hx-payment-summary .is-due {
  background: var(--hx-warning-soft);
}

.hx-payment-summary .is-due strong {
  color: #8a5700;
}

.hx-payment-composer {
  padding: var(--hx-s4);
  margin-bottom: var(--hx-s5);
  border: 1px solid color-mix(in srgb, var(--hx-primary) 28%, var(--hx-border));
  border-radius: var(--hx-r-md);
  background: linear-gradient(145deg, var(--hx-primary-soft), var(--hx-surface) 70%);
}

.hx-payment-composer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--hx-s4);
  margin-bottom: var(--hx-s4);
}

.hx-payment-composer-head h3,
.hx-payment-history-head h3 {
  margin: 0 0 3px;
  font-size: var(--hx-fs-base);
  font-weight: 800;
}

.hx-payment-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--hx-s3);
  padding-top: var(--hx-s1);
  margin-bottom: var(--hx-s3);
}

.hx-payment-history-head span,
.hx-optional {
  color: var(--hx-muted);
  font-size: var(--hx-fs-xs);
  font-weight: 600;
}

.hx-payment-method {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--hx-r-pill);
  background: var(--hx-sunken);
  color: var(--hx-text);
  font-size: var(--hx-fs-xs);
  font-weight: 750;
}

.hx-table-scroll {
  overflow-x: auto;
  margin-inline: calc(var(--hx-s5) * -1);
}

.hx-table-scroll .hx-table th:first-child,
.hx-table-scroll .hx-table td:first-child {
  padding-left: var(--hx-s5);
}

.hx-table-scroll .hx-table th:last-child,
.hx-table-scroll .hx-table td:last-child {
  padding-right: var(--hx-s5);
}

@media (max-width: 640px) {
  .hx-section-head,
  .hx-payment-composer-head {
    align-items: stretch;
    flex-direction: column;
  }

  .hx-payment-summary {
    grid-template-columns: 1fr;
  }

  .hx-payment-summary > div {
    grid-template-columns: 1fr auto;
    align-items: baseline;
    border-right: 0;
    border-bottom: 1px solid var(--hx-border);
  }

  .hx-payment-summary > div:last-child {
    border-bottom: 0;
  }
}

/* ------------------------------------------------------------------ detail list
   Label/value rows for a summary panel. Values sit right-aligned so figures line
   up down the column. */

.hx-detail-list {
  margin: 0 0 var(--hx-s4);
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--hx-border);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  overflow: hidden;
}

.hx-detail-list > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--hx-s4);
  padding: 10px 14px;
  background: var(--hx-surface);
}

.hx-detail-list dt {
  margin: 0;
  font-size: 13px;
  color: var(--hx-muted);
}

.hx-detail-list dd {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--hx-text);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hx-detail-list .is-total dd {
  font-size: 17px;
  color: var(--hx-primary-dark);
}

/* ------------------------------------------------------------------ extra-small pill
   For a marker that rides alongside a cell's main text rather than standing alone. */

.hx-pill-xs {
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 10px;
  vertical-align: middle;
}

/* ------------------------------------------------------------------ KPI row
   Headline figures across the top of a report or dashboard. auto-fit keeps them
   on one line while they fit and wraps them without a breakpoint when they don't. */

.hx-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--hx-s4);
  margin-bottom: var(--hx-s5);
}

.hx-kpi {
  padding: var(--hx-s4) var(--hx-s5);
  background: var(--hx-surface);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-sm);
}

.hx-kpi-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

.hx-kpi-label svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.hx-kpi-value {
  margin-top: 6px;
  font-size: 27px;
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--hx-text);
  font-variant-numeric: tabular-nums;
}

.hx-kpi-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--hx-muted);
}

.hx-kpi.is-primary .hx-kpi-value { color: var(--hx-primary-dark); }
.hx-kpi.is-success .hx-kpi-value { color: var(--hx-success); }
.hx-kpi.is-warning .hx-kpi-value { color: #B4790E; }
.hx-kpi.is-danger  .hx-kpi-value { color: var(--hx-danger); }

/* ------------------------------------------------------------------ switch
   A checkbox styled as a toggle. The input stays in the layout (opacity 0, not
   display:none) so it remains focusable and reachable by keyboard. */

.hx-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--hx-s3);
  cursor: pointer;
}

.hx-switch input {
  position: absolute;
  opacity: 0;
  width: 42px;
  height: 24px;
  margin: 0;
  cursor: pointer;
}

.hx-switch-track {
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: var(--hx-border-strong);
  transition: background var(--hx-transition);
}

.hx-switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(43, 33, 24, 0.3);
  transition: transform var(--hx-transition);
}

.hx-switch input:checked ~ .hx-switch-track,
.hx-switch.is-on .hx-switch-track {
  background: var(--hx-primary);
}

.hx-switch input:checked ~ .hx-switch-track::after,
.hx-switch.is-on .hx-switch-track::after {
  transform: translateX(18px);
}

.hx-switch input:focus-visible ~ .hx-switch-track {
  outline: 2px solid var(--hx-primary);
  outline-offset: 2px;
}

.hx-switch-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--hx-text);
}

/* ------------------------------------------------------------------ card grid
   Responsive grid of equal cards — used where rows would be too wide to read,
   such as the per-device alarm settings. */

.hx-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--hx-s4);
}

/* ------------------------------------------------------------------ muted pill
   For a neutral state that should read as "off" rather than good or bad. */

.hx-pill-muted {
  background: var(--hx-sunken);
  color: var(--hx-muted);
  border-color: var(--hx-border);
}

/* ------------------------------------------------------------------ chip list */

.hx-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--hx-s2);
}

/* ------------------------------------------------------------------ inline empty
   A quiet placeholder inside a card, where the full empty-state block would
   overwhelm the panel around it. */

.hx-empty-inline {
  padding: var(--hx-s5) var(--hx-s4);
  text-align: center;
  font-size: 13px;
  color: var(--hx-muted);
  background: var(--hx-sunken);
  border: 1px dashed var(--hx-border-strong);
  border-radius: var(--hx-r-sm);
}

/* ------------------------------------------------------------------ flush table
   A table sitting directly inside a padded card: no outer border or radius of
   its own, and edge cells aligned to the card's own padding. */

.hx-table-flush {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.hx-table-flush thead th {
  background: transparent;
  border-top: 0;
}

.hx-table-flush th:first-child,
.hx-table-flush td:first-child {
  padding-left: 0;
}

.hx-table-flush th:last-child,
.hx-table-flush td:last-child {
  padding-right: 0;
}

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

/* ------------------------------------------------------------------ section rule
   Separates groups of fields inside one long form, where separate cards would
   fragment a single logical task. */

.hx-rule {
  margin: var(--hx-s5) 0 var(--hx-s4);
  border: 0;
  border-top: 1px solid var(--hx-border);
}

/* ------------------------------------------------------------------ order lines
   One row per item: product, quantity, unit price, running line total, remove.
   Grid rather than a table so each row can collapse to stacked fields on narrow
   screens without losing its labels. */

.hx-lines {
  display: flex;
  flex-direction: column;
  gap: var(--hx-s3);
}

.hx-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 90px 130px 110px 36px;
  gap: var(--hx-s3);
  align-items: end;
  padding: var(--hx-s3);
  background: var(--hx-sunken);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
}

.hx-line .hx-field {
  margin: 0;
}

.hx-line label {
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--hx-muted);
}

.hx-line-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 9px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--hx-text);
}

.hx-line-total-label {
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--hx-muted);
}

.hx-line-remove {
  margin-bottom: 6px;
}

.hx-line-remove:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

@media (max-width: 1100px) {
  .hx-line {
    grid-template-columns: minmax(0, 1fr) 80px 110px;
    grid-template-areas:
      "product product product"
      "qty price total"
      "remove remove remove";
  }

  .hx-line-product { grid-area: product; }
  .hx-line-qty     { grid-area: qty; }
  .hx-line-price   { grid-area: price; }
  .hx-line-total   { grid-area: total; }

  .hx-line-remove {
    grid-area: remove;
    justify-self: end;
    margin-bottom: 0;
  }
}

/* ------------------------------------------------------------------ sticky panel
   Keeps the order summary in view while a long item list scrolls past. Disabled
   on short viewports, where sticking would hide part of the panel itself. */

@media (min-height: 700px) and (min-width: 1024px) {
  .hx-sticky {
    position: sticky;
    top: calc(var(--hx-topbar-h, 64px) + var(--hx-s4));
  }
}

/* ------------------------------------------------------------------ date picker
   Calendar fields in compact filters stay fixed-width; form fields continue to fill their row. */

.hx-input-date {
  flex: 0 0 auto;
  width: auto;
  min-width: 150px;
}

.app-date-picker-display {
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b6b5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='2'/%3E%3Cpath d='M16 3v4M8 3v4M3 10h18'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 17px;
  cursor: pointer;
}

.app-time-picker-display {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b6b5c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

.flatpickr-calendar {
  overflow: hidden;
  width: 322px;
  background: var(--hx-surface);
  border: 1px solid var(--hx-border) !important;
  border-radius: var(--hx-r-md);
  box-shadow: var(--hx-shadow-xl) !important;
  font-family: var(--hx-font);
}

.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after {
  border-bottom-color: var(--hx-border);
}

.flatpickr-months {
  padding: 8px 5px 3px;
  background: var(--hx-surface-warm);
}

.flatpickr-current-month,
.flatpickr-current-month input.cur-year,
.flatpickr-current-month .flatpickr-monthDropdown-months {
  color: var(--hx-text);
  font-weight: 800;
}

span.flatpickr-weekday {
  color: var(--hx-muted);
  font-size: 11px;
  font-weight: 800;
}

.flatpickr-day {
  color: var(--hx-text);
  border-radius: var(--hx-r-sm);
  font-weight: 600;
}

.flatpickr-day:hover,
.flatpickr-day:focus {
  background: var(--hx-primary-soft);
  border-color: var(--hx-primary-soft);
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  color: var(--hx-on-primary);
  background: var(--hx-primary);
  border-color: var(--hx-primary);
}

.flatpickr-day.today:not(.selected) {
  color: var(--hx-primary-dark);
  border-color: var(--hx-primary);
}

.flatpickr-time {
  border-top: 1px solid var(--hx-border) !important;
}

.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm {
  color: var(--hx-text);
  font-family: var(--hx-font);
  font-weight: 700;
}

.flatpickr-monthSelect-month {
  color: var(--hx-text);
  border-radius: var(--hx-r-sm);
  font-weight: 700;
}

.flatpickr-monthSelect-month:hover,
.flatpickr-monthSelect-month:focus {
  background: var(--hx-primary-soft);
  border-color: var(--hx-primary-soft);
}

.flatpickr-monthSelect-month.selected {
  color: var(--hx-on-primary);
  background: var(--hx-primary);
  border-color: var(--hx-primary);
}

/* ------------------------------------------------------------------ rich text
   A toolbar over a contenteditable surface. The real <textarea> stays in the
   DOM as the thing that submits — it is only hidden while the editor is shown,
   and swapped back into view by the HTML-source toggle. */

.hx-rte {
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  overflow: hidden;
}

.hx-rte:focus-within {
  border-color: var(--hx-primary);
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

.hx-rte-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px;
  background: var(--hx-sunken);
  border-bottom: 1px solid var(--hx-border);
}

.hx-rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: var(--hx-r-xs);
  background: transparent;
  color: var(--hx-muted);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-rte-btn svg {
  width: 15px;
  height: 15px;
}

.hx-rte-btn:hover {
  background: var(--hx-surface);
  border-color: var(--hx-border-strong);
  color: var(--hx-text);
}

.hx-rte-btn:focus-visible {
  outline: 2px solid var(--hx-primary);
  outline-offset: 1px;
}

.hx-rte-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--hx-border-strong);
}

.hx-rte-surface {
  min-height: 190px;
  max-height: 460px;
  overflow-y: auto;
  padding: var(--hx-s4);
  font-size: var(--hx-fs-base);
  line-height: 1.65;
  color: var(--hx-text);
}

.hx-rte-surface:focus {
  outline: none;
}

/* The authored copy should read here roughly as it will on the storefront. */
.hx-rte-surface > :first-child { margin-top: 0; }
.hx-rte-surface > :last-child { margin-bottom: 0; }
.hx-rte-surface p { margin: 0 0 0.75em; }
.hx-rte-surface h2 { margin: 1.1em 0 0.5em; font-size: 19px; font-weight: 800; }
.hx-rte-surface h3 { margin: 1em 0 0.4em; font-size: 16px; font-weight: 800; }
.hx-rte-surface h4 { margin: 1em 0 0.4em; font-size: 14px; font-weight: 800; }
.hx-rte-surface ul,
.hx-rte-surface ol { margin: 0 0 0.75em; padding-left: 1.4em; }
.hx-rte-surface li { margin: 0.2em 0; }
.hx-rte-surface a { color: var(--hx-primary-dark); }

.hx-rte-surface blockquote {
  margin: 0 0 0.75em;
  padding: 4px 0 4px var(--hx-s4);
  border-left: 3px solid var(--hx-primary-soft);
  color: var(--hx-muted);
}

.hx-rte-surface img {
  max-width: 100%;
  height: auto;
  border-radius: var(--hx-r-xs);
}

.hx-rte-surface table {
  width: 100%;
  margin: 0 0 0.75em;
  border-collapse: collapse;
  font-size: var(--hx-fs-sm);
}

.hx-rte-surface th,
.hx-rte-surface td {
  padding: 6px 10px;
  border: 1px solid var(--hx-border);
  text-align: left;
}

.hx-rte-surface th {
  background: var(--hx-sunken);
  font-weight: 700;
}

/* The raw-markup view: exactly one of the two is visible at a time. */
.hx-rte-source {
  display: none;
  width: 100%;
  min-height: 190px;
  padding: var(--hx-s4);
  border: 0;
  background: var(--hx-surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--hx-text);
  resize: vertical;
}

.hx-rte-source:focus {
  outline: none;
}

.hx-rte.is-source .hx-rte-surface { display: none; }
.hx-rte.is-source .hx-rte-source { display: block; }

/* ------------------------------------------------------------------ gallery
   Six fixed slots; the first is the hero. Tiles carry their own file input and
   remove checkbox, so a tile keeps its inputs wherever it is moved to. */

.hx-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: var(--hx-s3);
}

.hx-gallery-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: var(--hx-sunken);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  transition: border-color var(--hx-transition), opacity var(--hx-transition);
}

.hx-gallery-tile.is-primary {
  border-color: var(--hx-primary);
  background: var(--hx-primary-soft);
}

/* A slot pending removal stays visible but reads as struck out. */
.hx-gallery-tile.is-removing {
  opacity: 0.45;
}

.hx-gallery-figure {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--hx-r-xs);
  overflow: hidden;
  background: var(--hx-surface);
  border: 1px dashed var(--hx-border-strong);
}

.hx-gallery-figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hx-gallery-badge {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 2px 7px;
  border-radius: var(--hx-r-pill);
  background: rgba(43, 33, 24, 0.72);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.hx-gallery-tile.is-primary .hx-gallery-badge {
  background: var(--hx-primary);
}

.hx-gallery-move {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.hx-gallery-move button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-xs);
  background: var(--hx-surface);
  color: var(--hx-muted);
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-gallery-move button svg {
  width: 13px;
  height: 13px;
}

.hx-gallery-move button:hover:not(:disabled) {
  border-color: var(--hx-primary);
  color: var(--hx-primary-dark);
}

.hx-gallery-move button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.hx-gallery-tile input[type="file"] {
  width: 100%;
  font-size: 11px;
  color: var(--hx-muted);
}

.hx-gallery-remove {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--hx-muted);
  cursor: pointer;
}

/* ------------------------------------------------------------------ prose
   Rendered product copy — the sanitized HTML the editor produced, shown back in
   the console. Mirrors .hx-rte-surface so what was written is what is seen. */

.hx-prose {
  font-size: var(--hx-fs-base);
  line-height: 1.65;
  color: var(--hx-text);
}

.hx-prose > :first-child { margin-top: 0; }
.hx-prose > :last-child { margin-bottom: 0; }
.hx-prose p { margin: 0 0 0.75em; }
.hx-prose h2 { margin: 1.1em 0 0.5em; font-size: 19px; font-weight: 800; }
.hx-prose h3 { margin: 1em 0 0.4em; font-size: 16px; font-weight: 800; }
.hx-prose h4 { margin: 1em 0 0.4em; font-size: 14px; font-weight: 800; }
.hx-prose ul,
.hx-prose ol { margin: 0 0 0.75em; padding-left: 1.4em; }
.hx-prose li { margin: 0.2em 0; }
.hx-prose a { color: var(--hx-primary-dark); }

.hx-prose blockquote {
  margin: 0 0 0.75em;
  padding: 4px 0 4px var(--hx-s4);
  border-left: 3px solid var(--hx-primary-soft);
  color: var(--hx-muted);
}

.hx-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--hx-r-xs);
}

.hx-prose table {
  width: 100%;
  margin: 0 0 0.75em;
  border-collapse: collapse;
  font-size: var(--hx-fs-sm);
}

.hx-prose th,
.hx-prose td {
  padding: 6px 10px;
  border: 1px solid var(--hx-border);
  text-align: left;
}

.hx-prose th {
  background: var(--hx-sunken);
  font-weight: 700;
}

/* ===================================================================
   HRM — tables and pay documents
   Payroll tables carry more numeric columns than anything else in the
   console, so they get their own spacing rules: wider gutters at the
   edges, tighter ones between figures, and a baseline row height that
   does not jump when a cell grows a second line.
   =================================================================== */

/* Roomier variant for data-dense tables. Opt in with .hx-table-roomy. */
.hx-table-roomy tbody td {
  padding-top: var(--hx-s5);
  padding-bottom: var(--hx-s5);
}

.hx-table-roomy thead th {
  padding-top: var(--hx-s4);
  padding-bottom: var(--hx-s4);
}

/* Edge gutters: the first and last columns should not touch the card border. */
.hx-table thead th:first-child,
.hx-table tbody td:first-child {
  padding-left: var(--hx-s5);
}

.hx-table thead th:last-child,
.hx-table tbody td:last-child {
  padding-right: var(--hx-s5);
}

/* Numeric runs read better with a little less air between them than prose. */
.hx-table thead th.hx-cell-num,
.hx-table tbody td.hx-cell-num {
  padding-left: var(--hx-s3);
  padding-right: var(--hx-s3);
}

.hx-table thead th.hx-cell-num:last-child,
.hx-table tbody td.hx-cell-num:last-child {
  padding-right: var(--hx-s5);
}

/* A second line in a cell should not shove the row's baseline around. */
.hx-table tbody td {
  line-height: 1.45;
}

.hx-cell-sub {
  line-height: 1.35;
  margin-top: 3px;
}

/* Keep money columns from collapsing to nothing, but no wider than a formatted
   amount actually needs — the payroll register carries eight columns and every
   spare pixel here comes out of the row's action buttons. */
.hx-cell-num { min-width: 72px; }

/* The one figure per row that matters most — net pay, a total. */
.hx-cell-figure {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: var(--hx-fs-md);
  color: var(--hx-ink, inherit);
  white-space: nowrap;
  min-width: 84px;
}

/* Totals row on a register-style table. */
.hx-table tfoot td {
  padding: var(--hx-s4) var(--hx-s4);
  border-top: 2px solid var(--hx-border-strong);
  font-weight: 700;
  background: var(--hx-sunken);
}

.hx-table tfoot td:first-child { padding-left: var(--hx-s5); }
.hx-table tfoot td:last-child { padding-right: var(--hx-s5); }

/* Softer hover than the default so a wide numeric row does not flash. */
.hx-table-roomy tbody tr { transition: background var(--hx-transition); }

/* A small "3 of 5" style ratio, for payable days against days in month. */
.hx-ratio {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Five-tile KPI row, for the payroll register's headcount / gross / overtime /
   deductions / net. The default 190px floor fits four per row and leaves the
   fifth stranded on a line of its own, which reads as an afterthought when it
   is in fact the number people came for. */
.hx-kpi-row-5 {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

@media (min-width: 1160px) {
  .hx-kpi-row-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Five tiles share the width four normally get, and a hatchery's monthly total
   runs to seven digits plus a currency sign. The figure scales with the
   viewport and never wraps: a money amount broken across two lines is worse
   than a smaller one, because the eye reads the fragment as its own number. */
.hx-kpi-row-5 .hx-kpi-value {
  font-size: clamp(17px, 1.5vw, 24px);
  letter-spacing: -0.015em;
  white-space: nowrap;
}

/* The identity column. Names carry a second line (staff number, job title)
   and without a floor the browser squeezes it into three wrapped lines while
   numeric columns sit half empty. */
.hx-cell-name {
  min-width: 168px;
  font-weight: 700;
}

.hx-cell-name .hx-cell-sub {
  font-weight: 500;
}

/* Inline filter bar.
   Bare inputs and selects inherit width:100%, which inside a wrapping flex
   row makes every control claim its own line. This sizes them to their
   content instead, so a filter row reads as one row. Added as a modifier
   rather than changed on .hx-filterbar itself, to leave the other modules'
   filter bars exactly as they are. */
.hx-filterbar-inline > .hx-select,
.hx-filterbar-inline > .hx-input {
  width: auto;
  min-width: 150px;
}

.hx-filterbar-inline > .hx-search {
  flex: 1 1 240px;
  min-width: 200px;
}

.hx-filterbar-inline > .hx-select-wide {
  min-width: 210px;
}

/* Push the buttons to the trailing edge so Apply and Clear always sit together. */
.hx-filterbar-inline > .hx-filterbar-gap {
  flex: 1 1 auto;
}

@media (max-width: 720px) {
  .hx-filterbar-inline > .hx-select,
  .hx-filterbar-inline > .hx-input,
  .hx-filterbar-inline > .hx-search {
    width: 100%;
    flex-basis: 100%;
  }
}

/* Row actions as visible buttons rather than a kebab menu. Each carries a
   title for the tooltip and an aria-label for anyone not seeing the icon. */
.hx-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--hx-s2);
  white-space: nowrap;
}

.hx-actions form {
  display: inline-flex;
  margin: 0;
}

.hx-act {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  color: var(--hx-muted);
  cursor: pointer;
  flex: 0 0 auto;
  transition: all var(--hx-transition);
}

.hx-act svg {
  width: 17px;
  height: 17px;
}

.hx-act:hover {
  color: var(--hx-primary-dark);
  border-color: var(--hx-primary);
  background: var(--hx-primary-soft);
}

.hx-act.is-primary {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 42%, var(--hx-border));
  background: var(--hx-primary-soft);
}

.hx-act.is-primary:hover {
  color: #fff;
  border-color: var(--hx-primary-dark);
  background: var(--hx-primary-dark);
}

.hx-act:focus-visible {
  outline: 2px solid var(--hx-primary-ring);
  outline-offset: 1px;
}

/* Destructive actions only turn red on hover, so a row of buttons does not
   read as a row of warnings. */
.hx-act.is-danger:hover {
  color: #fff;
  background: var(--hx-danger);
  border-color: var(--hx-danger);
}

.hx-customer-action {
  display: inline-flex;
  width: auto;
  height: 34px;
  gap: 5px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 750;
}

.hx-customer-action.is-orders {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 30%, var(--hx-border));
  background: var(--hx-info-soft);
}

.hx-customer-action.is-orders:hover {
  color: #fff;
  border-color: var(--hx-info);
  background: var(--hx-info);
}

.hx-customer-action.is-edit {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 34%, var(--hx-border));
  background: var(--hx-primary-soft);
}

.hx-customer-action.is-edit:hover {
  color: #fff;
  border-color: var(--hx-primary-dark);
  background: var(--hx-primary-dark);
}

.hx-customer-action.is-danger {
  color: var(--hx-danger);
  border-color: color-mix(in srgb, var(--hx-danger) 30%, var(--hx-border));
  background: var(--hx-danger-soft);
}

.hx-alarm-card-head {
  align-items: flex-start;
}

.hx-alarm-card-actions {
  align-self: flex-start;
}

.hx-alarm-card-action {
  display: inline-flex;
  width: auto;
  height: 36px;
  gap: 6px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
}

.hx-alarm-card-action.is-edit {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 34%, var(--hx-border));
  background: var(--hx-primary-soft);
}

.hx-alarm-card-action.is-edit:hover {
  color: #fff;
  border-color: var(--hx-primary-dark);
  background: var(--hx-primary-dark);
}

.hx-alarm-card-action.is-danger {
  color: #fff;
  border-color: var(--hx-danger);
  background: var(--hx-danger);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--hx-danger) 22%, transparent);
}

.hx-alarm-card-action.is-danger:hover {
  border-color: color-mix(in srgb, var(--hx-danger) 78%, #000);
  background: color-mix(in srgb, var(--hx-danger) 78%, #000);
}

.hx-product-form-card,
.hx-product-form-fields {
  display: grid;
  gap: var(--hx-s5);
}

.hx-product-form-card > .hx-card-title,
.hx-product-form-card > .hx-card-subtitle {
  margin: 0;
}

.hx-product-detail-action {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding-inline: 15px;
  font-weight: 800;
  box-shadow: var(--hx-shadow-sm);
}

.hx-product-detail-action.is-stock {
  color: #fff;
  border-color: var(--hx-info);
  background: linear-gradient(135deg, var(--hx-info), color-mix(in srgb, var(--hx-info) 74%, #000));
}

.hx-product-detail-action.is-edit {
  color: #fff;
  border-color: var(--hx-primary);
  background: linear-gradient(135deg, var(--hx-primary), var(--hx-primary-dark));
}

.hx-product-detail-action:hover {
  color: #fff;
  transform: translateY(-1px);
  filter: saturate(1.08);
  box-shadow: var(--hx-shadow-sm);
}

.hx-product-detail-action svg {
  width: 17px;
  height: 17px;
}

.hx-ledger-pager {
  margin: 0;
}

@media (max-width: 480px) {
  .hx-alarm-card-head {
    align-items: stretch;
  }

  .hx-alarm-card-actions {
    width: 100%;
  }

  .hx-alarm-card-action {
    flex: 1 1 0;
  }
}

/* Keep the actions column tight to its content, and never let it be the column
   that gets squeezed — a half-visible button reads as a broken page. */
.hx-table td.hx-cell-actions,
.hx-table th.hx-cell-actions {
  width: 1%;
  white-space: nowrap;
}

/* Integration registry: prominent connection toggle plus a compact tool group. */
.hx-integrations-table {
  min-width: 980px;
}

.hx-integration-adjustments {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.hx-adjustment-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: var(--hx-r-pill);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.hx-adjustment-chip svg {
  width: 13px;
  height: 13px;
}

.hx-adjustment-chip.is-temperature {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 24%, transparent);
  background: var(--hx-primary-soft);
}

.hx-adjustment-chip.is-humidity {
  color: var(--hx-info);
  border-color: color-mix(in srgb, var(--hx-info) 24%, transparent);
  background: var(--hx-info-soft);
}

.hx-integration-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: max-content;
}

.hx-integration-actions form {
  display: inline-flex;
  margin: 0;
}

.hx-device-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: var(--hx-r-sm);
  font: inherit;
  font-size: var(--hx-fs-xs);
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--hx-transition), box-shadow var(--hx-transition),
    color var(--hx-transition), background var(--hx-transition), border-color var(--hx-transition);
}

.hx-device-toggle svg {
  width: 16px;
  height: 16px;
}

.hx-device-toggle:hover {
  transform: translateY(-1px);
}

.hx-device-toggle:focus-visible {
  outline: 2px solid var(--hx-primary-ring);
  outline-offset: 2px;
}

.hx-device-toggle.is-activate {
  color: var(--hx-success);
  border-color: color-mix(in srgb, var(--hx-success) 28%, var(--hx-border));
  background: var(--hx-success-soft);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--hx-success) 14%, transparent);
}

.hx-device-toggle.is-activate:hover {
  color: #fff;
  border-color: var(--hx-success);
  background: var(--hx-success);
  box-shadow: 0 5px 14px color-mix(in srgb, var(--hx-success) 26%, transparent);
}

.hx-device-toggle.is-deactivate {
  color: #955f05;
  border-color: color-mix(in srgb, #b97808 28%, var(--hx-border));
  background: var(--hx-warning-soft);
}

.hx-device-toggle.is-deactivate:hover {
  color: #784900;
  border-color: #d49a32;
  background: #ffedc2;
  box-shadow: 0 4px 12px rgba(149, 95, 5, 0.13);
}

.hx-integration-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--hx-border);
  border-radius: calc(var(--hx-r-sm) + 2px);
  background: var(--hx-sunken);
}

.hx-integration-tool {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  color: var(--hx-muted);
  background: transparent;
  cursor: pointer;
  transition: all var(--hx-transition);
}

.hx-integration-tool svg {
  width: 16px;
  height: 16px;
}

.hx-integration-tool:hover,
.hx-integration-tool:focus-visible {
  color: var(--hx-primary-dark);
  background: var(--hx-surface);
  box-shadow: 0 1px 4px rgba(61, 42, 27, 0.12);
}

.hx-integration-tool:focus-visible {
  outline: 2px solid var(--hx-primary-ring);
  outline-offset: 1px;
}

.hx-integration-tool.is-danger:hover,
.hx-integration-tool.is-danger:focus-visible {
  color: var(--hx-danger);
  background: var(--hx-danger-soft);
}

/* Explanatory bullets on the generate page, and anywhere a short list of
   consequences reads better than a paragraph. */
.hx-checklist {
  margin: 0 0 var(--hx-s4);
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--hx-s3);
}

.hx-checklist li {
  position: relative;
  padding-left: var(--hx-s6);
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
  line-height: 1.5;
}

.hx-checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--hx-primary-soft);
  border: 1.5px solid var(--hx-primary);
}

/* Payslip earning/deduction lists: align the amounts into a column so the
   eye can add them up, which is the whole point of a payslip. */
.hx-detail-list .hx-line-tag {
  margin-left: var(--hx-s2);
  vertical-align: middle;
}

/* ===================================================================
   Print — payslips and the payroll register
   The console has no PDF generator; these two documents are produced by
   the browser's own print/save-as-PDF, so the stripped-down print views
   need real page styling rather than a screen layout squeezed onto paper.
   =================================================================== */

/* The print views render outside .hx-shell, so they supply their own page. */
.hx-print-page {
  background: #fff;
  color: #1c1310;
}

.hx-print-sheet {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--hx-s6) var(--hx-s5);
}

.hx-print-sheet-narrow { max-width: 720px; }

.hx-print-toolbar {
  display: flex;
  justify-content: space-between;
  gap: var(--hx-s3);
  margin-bottom: var(--hx-s5);
}

/* Letterhead: hatchery name, document type, period, and who it is for. */
.hx-payslip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--hx-s5);
  padding-bottom: var(--hx-s4);
  margin-bottom: var(--hx-s5);
  border-bottom: 2px solid currentColor;
}

.hx-payslip-head h1 {
  margin: 0;
  font-size: var(--hx-fs-xl);
  line-height: 1.2;
}

.hx-payslip-meta {
  margin: var(--hx-s1) 0 0;
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
  text-align: right;
}

.hx-payslip-head > div:first-child .hx-payslip-meta { text-align: left; }

.hx-print-subhead {
  margin: var(--hx-s5) 0 var(--hx-s2);
  font-size: var(--hx-fs-md);
}

.hx-print-table { width: 100%; }
.hx-print-table tfoot td { font-weight: 600; border-top: 1.5px solid currentColor; }

/* The net-pay box is the number people look for first. */
.hx-print-net td {
  font-size: var(--hx-fs-lg);
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

/* Signature column on the register, and the sign-off rules under both documents. */
.hx-print-sign { min-width: 120px; }

.hx-print-signoff {
  display: flex;
  gap: var(--hx-s6);
  margin-top: calc(var(--hx-s8) + var(--hx-s5));
  font-size: var(--hx-fs-sm);
  color: var(--hx-muted);
}

.hx-print-signoff > div { flex: 1; text-align: center; }

.hx-print-rule {
  display: block;
  border-top: 1px solid currentColor;
  margin-bottom: var(--hx-s2);
}

/* Utilities usable on any page, not just the print views. */
.hx-print-only { display: none; }

/* Incubator cards: running load per machine, mirroring the mobile incubator list. */
.hx-incubator-card-head {
  align-items: flex-start;
  padding: 0 0 var(--hx-s4);
  margin-bottom: var(--hx-s4);
}

.hx-incubator-card-title {
  min-width: 0;
}

.hx-incubator-card-title .hx-card-title {
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}

.hx-incubator-card-actions {
  align-self: flex-start;
}

.hx-incubator-card-action {
  display: inline-flex;
  width: auto;
  min-width: 0;
  height: 36px;
  gap: 6px;
  padding: 0 11px;
  font-size: var(--hx-fs-sm);
  font-weight: 750;
}

.hx-incubator-card-action.is-edit {
  color: var(--hx-primary-dark);
  border-color: color-mix(in srgb, var(--hx-primary) 38%, var(--hx-border));
  background: var(--hx-primary-soft);
}

.hx-incubator-card-action.is-edit:hover {
  color: #fff;
  border-color: var(--hx-primary-dark);
  background: var(--hx-primary-dark);
}

.hx-incubator-card-action.is-danger {
  color: #fff;
  border-color: var(--hx-danger);
  background: var(--hx-danger);
  box-shadow: 0 3px 9px rgba(209, 67, 67, 0.2);
}

.hx-incubator-card-action.is-danger:hover {
  filter: brightness(1.07);
  box-shadow: 0 5px 12px rgba(209, 67, 67, 0.28);
}

.hx-inc-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--hx-s3);
}

.hx-inc-tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--hx-s3) var(--hx-s4);
  border-radius: var(--hx-r-sm);
}

.hx-inc-tile.is-batches { background: var(--hx-info-soft); }
.hx-inc-tile.is-eggs { background: var(--hx-warning-soft); }

.hx-inc-tile-label {
  font-size: var(--hx-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--hx-muted);
}

.hx-inc-tile-value {
  font-size: var(--hx-fs-lg);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--hx-text);
}

.hx-inc-tile.is-over .hx-inc-tile-value { color: var(--hx-danger); }

.hx-inc-tile-meta {
  font-size: var(--hx-fs-xs);
  font-weight: 600;
  color: var(--hx-muted);
}

.hx-inc-load { margin-top: var(--hx-s4); }

.hx-inc-load-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--hx-s3);
  margin-bottom: 6px;
}

.hx-inc-load-pct {
  font-size: var(--hx-fs-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--hx-text);
}

.hx-inc-load-pct.is-over { color: var(--hx-danger); }

/* Incubator form: numeric machine settings read as complete controls rather than bare inputs. */
.hx-incubator-setting-field {
  gap: var(--hx-s2);
  padding: var(--hx-s4);
  border: 1px solid color-mix(in srgb, var(--hx-primary) 20%, var(--hx-border));
  border-radius: var(--hx-r-md);
  background: linear-gradient(135deg, var(--hx-primary-soft), var(--hx-surface) 68%);
}

.hx-incubator-setting-field.is-interval {
  margin-top: var(--hx-s5);
  border-color: color-mix(in srgb, var(--hx-info) 20%, var(--hx-border));
  background: linear-gradient(135deg, var(--hx-info-soft), var(--hx-surface) 68%);
}

.hx-incubator-number-control {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: stretch;
  overflow: hidden;
  min-height: 46px;
  border: 1px solid var(--hx-border-strong);
  border-radius: var(--hx-r-sm);
  background: var(--hx-surface);
  transition: border-color var(--hx-transition), box-shadow var(--hx-transition);
}

.hx-incubator-number-control:focus-within {
  border-color: var(--hx-primary);
  box-shadow: 0 0 0 3px var(--hx-primary-ring);
}

.hx-incubator-number-control.is-invalid {
  border-color: var(--hx-danger);
}

.hx-incubator-number-icon {
  display: grid;
  place-items: center;
  color: var(--hx-primary-dark);
  border-right: 1px solid var(--hx-border);
  background: var(--hx-primary-soft);
}

.is-interval .hx-incubator-number-icon {
  color: var(--hx-info);
  background: var(--hx-info-soft);
}

.hx-incubator-number-icon svg {
  width: 20px;
  height: 20px;
}

.hx-incubator-number-control .hx-input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: var(--hx-fs-md);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.hx-incubator-number-control .hx-input:focus,
.hx-incubator-number-control .hx-input[aria-invalid="true"] {
  border: 0;
  box-shadow: none;
}

.hx-incubator-number-unit {
  display: grid;
  place-items: center;
  padding: 0 var(--hx-s3);
  color: var(--hx-muted);
  border-left: 1px solid var(--hx-border);
  background: var(--hx-sunken);
  font-size: var(--hx-fs-sm);
  font-weight: 750;
  white-space: nowrap;
}

@media (max-width: 480px) {
  .hx-incubator-card-head {
    flex-direction: column;
  }

  .hx-incubator-card-actions {
    width: 100%;
    margin-left: 0;
  }

  .hx-incubator-card-action {
    flex: 1;
  }
}

/* Capacity warning dialog: the two numbers the user is being asked to weigh. */
.hx-capacity-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--hx-s3);
}

.hx-capacity-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  padding: var(--hx-s3);
  border: 1px solid var(--hx-border);
  border-radius: var(--hx-r-sm);
  background: var(--hx-sunken);
}

.hx-capacity-stat.is-over {
  border-color: #f0b4b4;
  background: var(--hx-danger-soft);
}

.hx-capacity-value {
  font-size: var(--hx-fs-xl);
  font-weight: 800;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--hx-text);
}

.hx-capacity-stat.is-over .hx-capacity-value { color: var(--hx-danger); }

.hx-capacity-label {
  font-size: var(--hx-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--hx-muted);
}

.hx-capacity-stat.is-over .hx-capacity-label { color: var(--hx-danger); }

@media print {
  /* Chrome: navigation, filters and controls are noise on paper. */
  .hx-sidebar,
  .hx-topbar,
  .hx-scrim,
  .hx-nav,
  .hx-filterbar,
  .hx-page-head-actions,
  .hx-form-actions,
  .hx-menu,
  .hx-pager,
  .hx-modal,
  .hx-print-toolbar,
  .hx-no-print {
    display: none !important;
  }

  .hx-print-only { display: revert; }

  @page { margin: 12mm; }

  html,
  body,
  .hx-body,
  .hx-print-page {
    background: #fff !important;
    color: #000 !important;
  }

  /* The shell reserves room for a sidebar that is no longer there. */
  .hx-shell { display: block; }

  .hx-main,
  .hx-content,
  .hx-print-sheet {
    margin: 0 !important;
    padding: 0 !important;
    max-width: none !important;
    width: 100% !important;
  }

  /* Flat on paper: shadows and fills waste toner and print as grey mush. */
  .hx-card,
  .hx-table-wrap,
  .hx-kpi,
  .hx-stat {
    box-shadow: none !important;
    border: 1px solid #999 !important;
    background: #fff !important;
    break-inside: avoid;
  }

  .hx-table { font-size: 11px; }
  .hx-table th,
  .hx-table td { padding: 4px 6px !important; }
  .hx-table thead { display: table-header-group; }
  .hx-table tr { break-inside: avoid; }

  .hx-pill {
    border: 1px solid #666 !important;
    background: #fff !important;
    color: #000 !important;
  }

  a { text-decoration: none !important; color: #000 !important; }

  /* A payslip is one document per person. */
  .hx-print-sheet-narrow { break-after: page; }
}
