:root {
  --bg: #0f1419;
  --surface: #151c28;
  --card: #1a2332;
  --border: #2a3548;
  --text: #e7ecf3;
  --muted: #8b9cb3;
  --link: #a8d4ff;
  --link-hover: #cce8ff;
  --accent: #4d9bff;
  --accent-hover: #6aadff;
  --error: #f87171;
  --nav-bg: #1e2838;
  --nav-active: #2a3a52;
  --header-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 4px 24px rgba(0, 0, 0, 0.25);
  --radius: 10px;
  --radius-sm: 6px;
  --header-brand-width: 800px;
  --header-brand-height: 100px;
  --header-fleet-max-height: 100px;
  --header-fleet-max-width: 280px;
  --header-band-bg: #000000;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

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

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* —— Header —— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0.75rem 1.5rem 1rem;
  background: var(--header-band-bg);
  border-bottom: 1px solid #0a0a0a;
  box-shadow: none;
}

.site-header__wrap {
  width: 100%;
  max-width: none;
  margin-left: auto;
  margin-right: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--header-band-bg);
}

.site-header__brand-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1.25rem;
  width: 100%;
  max-width: 100%;
  background: var(--header-band-bg);
}

.site-fleet-logo-link {
  display: block;
  line-height: 0;
  flex: 0 0 auto;
  max-width: min(var(--header-fleet-max-width), 36vw);
  background: var(--header-band-bg);
}

.site-fleet-logo-link:hover {
  text-decoration: none;
  opacity: 0.96;
}

.site-fleet-logo {
  display: block;
  height: var(--header-fleet-max-height);
  width: auto;
  max-width: 100%;
  max-height: var(--header-fleet-max-height);
  object-fit: contain;
  object-position: center;
}

.site-banner-logo-link {
  display: block;
  line-height: 0;
  width: var(--header-brand-width);
  max-width: min(var(--header-brand-width), calc(100% - 2rem));
  flex: 1 1 auto;
  margin-left: 0;
  margin-right: 0;
  background: var(--header-band-bg);
}

.site-banner-logo-link:hover {
  text-decoration: none;
  opacity: 0.96;
}

.site-banner-logo {
  display: block;
  width: var(--header-brand-width);
  max-width: 100%;
  height: auto;
  aspect-ratio: 8 / 1;
  object-fit: contain;
  object-position: center top;
}

.site-header__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.65rem;
  width: 100%;
  max-width: none;
}

.site-header__nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.site-header__page {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
  padding-left: 0.5rem;
}


@media (max-width: 900px) {
  .site-header__brand-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .site-fleet-logo-link {
    max-width: min(220px, 70vw);
  }

  .site-fleet-logo {
    height: 72px;
    max-height: 72px;
  }

  .site-banner-logo-link {
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 900px) {
  .site-header__page {
    flex: 1 1 100%;
    margin-left: 0;
    padding-left: 0;
  }
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--nav-bg);
  text-decoration: none;
}

.site-nav a.active {
  color: var(--text);
  background: var(--nav-active);
  border-color: #3d5270;
}

.device-subnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin: 0 0 1.25rem;
  padding: 0.5rem 0.6rem;
  max-width: 72rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(30, 40, 56, 0.55);
}

.device-subnav > a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
}

.device-subnav > a:hover {
  color: var(--text);
  background: rgba(42, 58, 82, 0.55);
  text-decoration: none;
}

.device-subnav > a.active {
  color: var(--text);
  background: var(--nav-active);
  border-color: #6b84a6;
}

/* Nested Diagnostics cluster — not a button; inset group of links */
.device-subnav__group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.35rem;
  margin-left: 0.25rem;
  padding: 0.2rem 0.35rem 0.2rem 0.55rem;
  border-radius: 8px;
  border: 1px dashed #3d5270;
  background: rgba(15, 20, 28, 0.65);
}

.device-subnav__group.is-active {
  border-style: solid;
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.08);
}

.device-subnav__group-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7dd3fc;
  user-select: none;
  pointer-events: none;
  padding-right: 0.2rem;
}

.device-subnav__group a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.28rem 0.6rem;
  border-radius: 5px;
  border: 1px solid transparent;
}

.device-subnav__group a:hover {
  color: var(--text);
  background: rgba(42, 58, 82, 0.7);
  text-decoration: none;
}

.device-subnav__group a.active {
  color: var(--text);
  background: var(--nav-active);
  border-color: #6b84a6;
}

.card.detail-overview-card,
.card.device-wide {
  max-width: 72rem;
  width: 100%;
  padding: 0;
  overflow: hidden;
}

.overview-section--span2 {
  grid-column: span 2;
}

.overview-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
}

.overview-section {
  padding: 1.05rem 1.2rem 1.15rem;
  min-width: 0;
}

.overview-section + .overview-section {
  border-left: 1px solid var(--border);
}

.overview-section__title {
  margin: 0 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.overview-kv {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
}

.overview-kv--stack {
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.7rem;
}

.overview-kv__item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.overview-kv__label {
  font-size: 0.75rem;
  color: var(--muted);
}

.overview-kv__value {
  font-size: 0.95rem;
  word-break: break-word;
}

.overview-status-pills {
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
}

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

  .overview-section--span2 {
    grid-column: auto;
  }

  .overview-section + .overview-section {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

.site-header__actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.65rem 0.85rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.site-header__session {
  text-align: right;
  line-height: 1.25;
  max-width: min(16rem, 42vw);
}

.site-header__session-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__session-email {
  display: block;
  font-size: 0.75rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-header__session-role {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.15rem;
}

.site-header__session-role--owner {
  color: #22d3ee;
}

.site-header__session-role--mixed {
  color: #3b82f6;
}

.site-header__session-role--view_only {
  color: #94a3b8;
}

.site-header__actions form {
  margin: 0;
}

.btn-link {
  color: var(--link);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
}

.btn-link:hover {
  color: var(--link-hover);
}

/* —— Main layout —— */
.page-main {
  padding: 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.page-toolbar h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.page-toolbar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.85rem;
  padding: 0.65rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.bulk-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.bulk-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.bulk-actions-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.bulk-actions-label select {
  min-width: 9rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.col-check {
  width: 2.25rem;
  text-align: center;
  vertical-align: middle;
}

.col-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  padding: 1rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-bar__smoker-static .filter-bar__smoker-name {
  display: block;
  min-width: 11rem;
  padding: 0.45rem 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--text);
}

.filter-bar select,
.filter-bar input[type="datetime-local"],
.filter-bar input[type="search"],
.filter-bar input[type="text"] {
  min-width: 11rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color-scheme: dark;
}

/* Native calendar glyph — force bright orange on dark inputs */
.filter-bar input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  cursor: pointer;
  filter: invert(58%) sepia(88%) saturate(2500%) hue-rotate(1deg) brightness(105%) contrast(104%);
}

.filter-bar select:focus,
.filter-bar input[type="datetime-local"]:focus,
.filter-bar input[type="search"]:focus,
.filter-bar input[type="text"]:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.filter-bar__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-bar__hint {
  flex: 1 1 100%;
  margin: 0;
}

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.auth-layout .card {
  margin: 0;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 auto 1.25rem;
  padding: 0.85rem 0.9rem 0.75rem;
  width: 100%;
  max-width: 320px;
  background: #000000;
  border: 1px solid #000000;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px #0a0a0a;
}

.auth-logo {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0;
  background: #000000;
}

.auth-fleet-logo {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  object-fit: contain;
  background: #000000;
}

.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.card {
  background: var(--card);
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  max-width: 24rem;
  width: 100%;
}

.card.wide { max-width: 40rem; }

.detail-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 1.05fr);
  gap: 1.5rem;
  align-items: start;
  max-width: 72rem;
  width: 100%;
  margin-bottom: 1.5rem;
}

.detail-top-grid__full {
  grid-column: 1 / -1;
}

.portal-smoker-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.portal-family,
.portal-shared-access {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.portal-shared-access h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.portal-add-phones {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.portal-add-phones h4 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.portal-phone-creds {
  margin: 0.75rem 0;
}

.portal-phone-cta {
  margin: 0.75rem 0;
}

.portal-invite-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
  margin-bottom: 0.75rem;
}

.portal-invite-form label {
  flex: 1 1 12rem;
  margin: 0;
}

.portal-invite-role {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.portal-invite-role legend {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0 0.25rem;
}

.portal-invite-role__option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

.portal-invite-role__option input {
  width: auto;
  margin: 0;
}

.portal-invite-pending__meta {
  flex: 1 1 100%;
  font-size: 0.85rem;
}

.portal-invite-pending {
  list-style: none;
  padding: 0;
  margin: 0;
}

.portal-invite-pending li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.portal-invite-pending__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  width: 100%;
}

.portal-invite-pending__link {
  flex: 1 1 16rem;
  min-width: 0;
}

.portal-invite-pending__link code {
  word-break: break-all;
}

.portal-invite-flash {
  margin: 0.5rem 0 1rem;
}

.portal-invite-revoke-form {
  display: inline;
  margin: 0;
}

.portal-invite-link {
  word-break: break-all;
}

.admin-user-smokers {
  margin: 0;
  padding-left: 1.1rem;
}

.detail-top-grid .card {
  max-width: none;
  width: 100%;
}

.detail-main-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.detail-card {
  padding: 1rem 1.15rem 1.1rem;
}

.detail-card h2 {
  margin: 0 0 0.85rem;
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-card__footer {
  margin: 0.85rem 0 0;
  font-size: 0.85rem;
}

.detail-fields {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.detail-fields--cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.25rem;
}

.detail-field--wide {
  grid-column: 1 / -1;
}

.detail-field__label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.detail-field__value {
  font-size: 0.95rem;
  word-break: break-word;
}

.detail-field__hint {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.inline-alias-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.inline-alias-form input[type="text"] {
  flex: 1 1 10rem;
  min-width: 0;
  margin: 0;
}

.inline-alias-form .btn {
  flex: 0 0 auto;
}

.detail-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.9rem;
}

.detail-status-meta {
  font-size: 0.85rem;
  color: var(--muted);
  text-transform: capitalize;
}

.fw-version-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.fw-version-tile {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.fw-version-tile__board {
  font-size: 0.7rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.fw-version-tile__ver {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.fw-attempt-log {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.fw-attempt-log__title {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.fw-attempt-log__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.fw-attempt-log__filters label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  user-select: none;
}

.fw-attempt-log__filters input {
  margin: 0;
}

.fw-attempt-log__empty {
  display: none;
  margin: 0.5rem 0.85rem;
  font-size: 0.8125rem;
}

.fw-attempt-log__empty.is-visible {
  display: block;
}

.fw-attempt-log__table {
  max-height: 14rem;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.fw-attempt-log__table table {
  font-size: 0.8125rem;
}

.fw-attempt-log__table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--card);
}

.detail-tools {
  margin: 0.25rem 0 0;
  padding: 0 0.15rem;
}

.detail-cook-card {
  max-width: 72rem;
  width: 100%;
  margin-top: 0;
}

.fw-versions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  align-items: baseline;
}
.fw-versions code {
  margin-left: 0.25rem;
}

@media (max-width: 640px) {
  .detail-fields--cols {
    grid-template-columns: 1fr;
  }
  .fw-version-grid {
    grid-template-columns: 1fr;
  }
}

.detail-top-grid__clients h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
}

.detail-top-grid__clients.card {
  padding: 1rem 1.1rem;
}

.detail-top-grid__clients .table-scroll {
  max-height: min(32rem, 70vh);
  overflow: auto;
}

.detail-top-grid__clients table {
  min-width: 0;
  width: 100%;
}

.detail-top-grid__clients th,
.detail-top-grid__clients td {
  padding: 0.3rem 0.45rem;
  font-size: 0.8125rem;
  line-height: 1.25;
  vertical-align: middle;
}

.detail-top-grid__clients th {
  padding-top: 0.35rem;
  padding-bottom: 0.35rem;
  font-size: 0.7rem;
}

.detail-top-grid__clients td code {
  font-size: 0.72rem;
  word-break: break-all;
}

.detail-top-grid__clients td.mqtt-clients-seen {
  font-size: 0.75rem;
  white-space: nowrap;
}

.detail-top-grid__clients tbody tr:nth-child(even) {
  background: transparent;
}

.detail-top-grid__clients tbody tr:hover {
  background: rgba(77, 155, 255, 0.06);
}

.mqtt-clients-live {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.mqtt-clients-live.on {
  color: var(--cyan, #22d3ee);
}

.mqtt-clients-filter {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.mqtt-clients-filter input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.mqtt-client-revoked {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr.mqtt-client-row--revoked td {
  opacity: 0.72;
}

button.mqtt-client-revoke {
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  line-height: 1.2;
}

@media (max-width: 960px) {
  .detail-top-grid {
    grid-template-columns: 1fr;
  }
}

.phone-linking__lead {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text);
}

.phone-linking__cta {
  margin: 0 0 0.5rem;
}

.phone-linking__hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}

.admin-advanced {
  margin-top: 0.5rem;
  font-size: 0.875rem;
}

.admin-advanced summary {
  cursor: pointer;
  color: var(--link, #4d9bff);
  font-weight: 600;
}

.admin-advanced[open] summary {
  margin-bottom: 0.5rem;
}

.admin-advanced .detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.detail-actions form {
  margin: 0;
}

.account-user-list {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
  color: var(--text);
}

.account-user-list li { margin: 0.25rem 0; }

.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.users-toolbar__actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.users-setup-flash {
  margin-bottom: 1rem;
}

/* —— Users page: full viewport, side-by-side, no page scroll —— */
html:has(body.page-users) {
  height: 100%;
  overflow: hidden;
}

body.page-users {
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

body.page-users .site-header {
  flex-shrink: 0;
  padding: 0.4rem 1rem 0.55rem;
}

body.page-users .site-fleet-logo {
  height: 3.25rem;
  max-height: 3.25rem;
}

body.page-users .site-banner-logo {
  height: 3.25rem;
  max-height: 3.25rem;
  width: auto;
  max-width: min(520px, 52vw);
}

body.page-users .page-main {
  flex: 1;
  min-height: 0;
  max-width: none;
  margin: 0;
  padding: 0.65rem 0.85rem 0.75rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.users-page {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.users-page__alerts {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

.users-page__alerts p {
  margin: 0;
}

.users-setup-flash {
  flex-shrink: 0;
  margin: 0;
}

.users-page__grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 0.75rem;
  overflow: hidden;
}

.users-page__column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body.page-users .users-page__card {
  flex: 1;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  overflow: hidden;
}

.users-page__heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.users-page__subheading {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
}

.users-toolbar__titles {
  min-width: 0;
}

body.page-users .users-panel {
  flex-shrink: 0;
  margin: 0;
  padding: 0.75rem 0.85rem;
}

.users-page__table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.users-page__table-wrap::-webkit-scrollbar {
  display: none;
}

body.page-users .users-page__table {
  min-width: 0;
  width: 100%;
}

body.page-users .users-page__table th,
body.page-users .users-page__table td {
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
  vertical-align: top;
}

body.page-users .users-page__joined {
  white-space: nowrap;
  font-size: 0.8rem;
}

body.page-users .col-actions {
  white-space: normal;
  text-align: left;
  min-width: 9.5rem;
}

.users-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.65rem;
  align-items: center;
}

.users-action-group .btn-link,
.users-action-group .inline-form {
  margin: 0;
}

body.page-users .admin-user-smokers {
  margin: 0;
  padding-left: 1rem;
  font-size: 0.82rem;
}

.users-page__footnote {
  flex-shrink: 0;
  margin: 0;
  font-size: 0.75rem;
}

.users-page--single {
  gap: 0.65rem;
}

.users-page__card--full {
  flex: 1;
}

.users-subnav {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  padding: 0.15rem 0 0.35rem;
  border-bottom: 1px solid var(--border);
}

.users-subnav a {
  display: inline-block;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.users-subnav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
}

.users-subnav a.active {
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-bottom-color: var(--card);
  margin-bottom: -1px;
}

.users-page__back {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.9rem;
}

.users-detail__header {
  margin-bottom: 0.5rem;
}

.users-detail__smokers {
  margin-bottom: 0.75rem;
}

.users-detail__smokers h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.users-detail__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.75rem;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.users-detail__grid::-webkit-scrollbar {
  display: none;
}

.users-panel--danger {
  border-color: rgba(244, 114, 182, 0.35);
}

.form-hint {
  margin: -0.35rem 0 0.5rem;
  font-size: 0.82rem;
}

.users-password-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0.35rem 0 0.75rem;
}

.users-password-option__hint {
  font-size: 0.88rem;
}

.users-password-fields {
  display: grid;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.users-add-form label + label {
  margin-top: 0.65rem;
}

body.page-users .users-page__table a {
  font-weight: 600;
}

/* Add/invite form open: allow page scroll (form can exceed viewport). */
html:has(body.page-users--scroll) {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

body.page-users.page-users--scroll {
  height: auto;
  min-height: 100dvh;
  overflow: auto;
}

body.page-users.page-users--scroll .page-main,
body.page-users.page-users--scroll .users-page,
body.page-users.page-users--scroll .users-page__card {
  overflow: visible;
  flex: none;
  min-height: auto;
}

body.page-users.page-users--scroll .users-page__table-wrap {
  flex: none;
  max-height: none;
  overflow: visible;
}

.users-page--add-open .users-page__table-wrap,
.users-page--add-open .users-page__footnote {
  display: none;
}

.users-page--add-open .users-panel {
  padding-bottom: 2.5rem;
}

.users-page--add-open .users-add-form .form-actions {
  margin-top: 1rem;
  padding-bottom: 0.5rem;
}

@media (max-width: 960px) {
  body.page-users {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  html:has(body.page-users) {
    height: auto;
    overflow: auto;
  }

  body.page-users .page-main {
    overflow: visible;
  }

  .users-page {
    overflow: visible;
  }

  .users-page__grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  body.page-users .users-page__card {
    min-height: auto;
    overflow: visible;
  }

  .users-page__table-wrap {
    max-height: none;
    overflow: visible;
  }

  .users-detail__grid {
    grid-template-columns: 1fr;
  }
}

.users-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.users-panel {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--nav-bg);
}

.users-panel h4 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.inline-form {
  display: inline;
  margin: 0;
}

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

.col-actions .btn-link,
.col-actions .inline-form {
  margin-left: 0.75rem;
}

.btn-link--danger {
  color: #f472b6;
}

.btn-link--danger:hover {
  color: #f9a8d4;
}

button.btn-link {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--link);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.35rem 0.5rem;
  width: auto;
}

button.btn-link:hover {
  background: transparent;
  color: var(--link-hover);
  text-decoration: underline;
}

button.btn-link--danger {
  color: #f472b6;
}

button.btn-link--danger:hover {
  color: #f9a8d4;
  background: transparent;
}

.card h2 {
  margin: 0 0 0.75rem;
  font-size: 1.2rem;
}

.card h1 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
}

label { display: block; margin-bottom: 0.75rem; }

.password-input-wrap {
  position: relative;
  display: block;
  margin-top: 0.35rem;
}

.password-input-wrap input {
  width: 100%;
  padding-right: 2.75rem;
  box-sizing: border-box;
}

.password-toggle-btn {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}

.password-toggle-btn:hover {
  color: var(--text);
  background: var(--nav-active);
}

.password-toggle-btn--visible {
  color: #22d3ee;
}

.password-toggle-btn:focus-visible {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button, .btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-sm);
  width: auto;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s;
}

button:hover, .btn:hover {
  background: var(--accent-hover);
  color: #fff;
  text-decoration: none;
}

button.secondary, .btn.secondary {
  background: var(--nav-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

button.secondary:hover, .btn.secondary:hover {
  background: var(--nav-active);
}

/* —— Tables —— */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

th, td {
  text-align: left;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface);
}

tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

tbody tr:hover {
  background: rgba(77, 155, 255, 0.06);
}

tbody tr:last-child td {
  border-bottom: none;
}

table a {
  font-weight: 500;
}

th.col-fleet-actions,
td.col-fleet-actions {
  width: 5.5rem;
  padding-left: 0.25rem;
  padding-right: 0.5rem;
  text-align: right;
  white-space: nowrap;
}

td.col-fleet-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem;
}

.fleet-display-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  line-height: 0;
}

.fleet-display-icon:hover {
  color: var(--link-hover);
  background: var(--nav-bg);
  text-decoration: none;
}

.fleet-display-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.conn-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.5rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  line-height: 1.25;
  white-space: nowrap;
}

.conn-status--online {
  color: #eab308;
  background: rgba(234, 179, 8, 0.12);
  border-color: rgba(234, 179, 8, 0.5);
}

.conn-status--offline {
  color: #9ca3af;
  background: rgba(55, 65, 81, 0.4);
  border-color: #4b5563;
}

a.conn-status--history {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.55);
  text-decoration: none;
  cursor: pointer;
}

a.conn-status--history:hover {
  color: #bfdbfe;
  background: rgba(59, 130, 246, 0.28);
  border-color: rgba(59, 130, 246, 0.75);
}

.conn-status--history-disabled {
  color: #71717a;
  background: rgba(63, 63, 70, 0.35);
  border-color: #3f3f46;
  cursor: not-allowed;
  opacity: 0.65;
  user-select: none;
}

/* Smoker mode — colorblind-safe (gray / blue / cyan / violet; no red+green) */
.mode-status {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.5rem;
  border: 1px solid;
  border-radius: var(--radius-sm);
  line-height: 1.25;
  white-space: nowrap;
}

.mode-status--off {
  color: #a1a1aa;
  background: rgba(82, 82, 91, 0.25);
  border-color: #52525b;
}

.mode-status--hold {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.55);
}

.mode-status--smoke_all {
  color: #67e8f9;
  background: rgba(34, 211, 238, 0.12);
  border-color: rgba(34, 211, 238, 0.5);
}

.mode-status--smoke_heat {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.15);
  border-color: rgba(167, 139, 250, 0.55);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.link-row .sep {
  color: var(--muted);
  user-select: none;
}

.error { color: var(--error); }
.ok { color: #22d3ee; }
.hidden { display: none; }

pre {
  background: var(--bg);
  padding: 1rem;
  overflow: auto;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

dl {
  display: grid;
  grid-template-columns: minmax(8rem, 10rem) 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 0.9rem;
}

dd {
  margin: 0;
}

.form-footnote { margin-top: 1.25rem; font-size: 0.85rem; }
.form-success { color: #4ade80; margin: 0 0 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
code.tiny { font-size: 0.72rem; word-break: break-all; }

code {
  font-size: 0.88em;
  background: var(--bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}

/* —— Debug —— */
.debug-main { max-width: none; }

.debug-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.debug-filter select {
  min-width: 16rem;
  width: auto;
}

.mqtt-status.on { color: #22d3ee; }

#fleet-live-status.on {
  color: #22d3ee;
}
.debug-hint { margin-top: 0; }

.mqtt-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  height: min(70vh, 720px);
  overflow: auto;
}

.mqtt-line {
  padding: 0.15rem 0;
  border-bottom: 1px solid #1a2332;
  word-break: break-all;
}

.mqtt-line .ts { color: var(--muted); }
.mqtt-line .topic { color: #93c5fd; }
.mqtt-line .payload { color: var(--text); }

.dir {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-right: 0.25rem;
}

.dir-device { background: #14532d; color: #bbf7d0; }
.dir-app { background: #1e3a5f; color: #bfdbfe; }
.dir-other { background: #374151; color: #e5e7eb; }

/* —— Responsive —— */
@media (max-width: 640px) {
  .site-header {
    padding: 0.75rem 1rem;
  }

  .site-header__toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .site-header__actions {
    justify-content: flex-end;
  }

  .page-main {
    padding: 1rem;
  }

  .auth-layout .card button {
    width: 100%;
  }

  dl {
    grid-template-columns: 1fr;
  }

  dl dt {
    margin-top: 0.5rem;
  }

  dl dt:first-child {
    margin-top: 0;
  }
}

/* User portal (Phase 5) — match fleet admin header scale */
.site-portal-logo-link {
  max-width: min(var(--header-fleet-max-width), 36vw);
}

.site-portal-logo {
  height: var(--header-fleet-max-height);
  max-height: var(--header-fleet-max-height);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.auth-brand--dual {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
  max-width: min(100%, 520px);
}

.auth-brand--dual .auth-portal-mark {
  flex: 0 0 auto;
  max-width: min(140px, 38vw);
  height: auto;
  max-height: 72px;
}

.auth-brand--dual .auth-banner-mark {
  flex: 1 1 200px;
  width: auto;
  max-width: min(320px, 72vw);
  height: auto;
  aspect-ratio: 8 / 1;
}

.copy-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.copy-row code {
  font-size: 0.95rem;
  word-break: break-all;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  line-height: 0;
}

.copy-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.copy-btn--ok {
  color: #22d3ee;
  border-color: #22d3ee;
}

.copy-toast-host {
  position: fixed;
  z-index: 10000;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.copy-toast {
  min-width: 10rem;
  max-width: min(22rem, calc(100vw - 2rem));
  padding: 0.65rem 0.9rem;
  border-radius: var(--radius-sm);
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #22d3ee;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(0.4rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.copy-toast--show {
  opacity: 1;
  transform: translateY(0);
}

.btn.danger,
button.danger {
  background: #be185d;
  color: #fff;
  border: 1px solid #f472b6;
}

.btn.danger:hover,
button.danger:hover {
  background: #9d174d;
  color: #fff;
}

.btn.danger:disabled,
button.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.detail-danger-card {
  margin-top: 1.25rem;
  border-color: #831843;
}

.detail-danger-copy {
  color: var(--muted);
  max-width: 40rem;
  margin: 0 0 0.85rem;
  line-height: 1.45;
}

.confirm-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 1.25rem 1.35rem;
  max-width: min(26rem, calc(100vw - 2rem));
}

.confirm-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
}

.confirm-dialog h3 {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
}

.confirm-dialog p {
  margin: 0 0 0.85rem;
  color: var(--muted);
  line-height: 1.45;
}

.confirm-dialog__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.confirm-dialog input[type="text"] {
  width: 100%;
  margin-bottom: 1rem;
}

.confirm-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.portal-admin-creds {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.portal-admin-creds h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.portal-creds-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  margin: 0.75rem 0 0;
}

.portal-creds-dl dt {
  color: var(--muted);
  font-weight: 500;
}

.portal-creds-dl dd {
  margin: 0;
}

.portal-nav {
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.portal-nav-dropdown {
  position: relative;
  display: inline-block;
}

.portal-nav-dropdown__toggle {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.portal-nav-dropdown__toggle:hover,
.portal-nav-dropdown.is-open .portal-nav-dropdown__toggle {
  color: var(--text);
  background: var(--nav-bg);
}

.portal-nav-dropdown__toggle.active {
  color: var(--text);
  background: var(--nav-active);
  border-color: #3d5270;
}

.portal-nav-dropdown__menu {
  position: absolute;
  top: calc(100% + 0.35rem);
  right: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 11rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.portal-nav-dropdown.is-open .portal-nav-dropdown__menu {
  display: flex;
}

.portal-nav-dropdown__menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.portal-nav-dropdown__menu a:hover {
  color: var(--text);
  background: rgba(42, 58, 82, 0.7);
  text-decoration: none;
}

.portal-nav-dropdown__menu a.active {
  color: var(--text);
  background: var(--nav-active);
}

.portal-probe-monitor-status--on {
  color: #22d3ee;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.portal-smoker-list {
  display: grid;
  gap: 1rem;
}

.portal-smoker-card h3 {
  margin-top: 0;
}

.portal-layout .portal-smoker-card.card {
  max-width: none;
}

.portal-shared-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.portal-shared-table table {
  min-width: 0;
}

.portal-shared-table .btn.secondary {
  white-space: nowrap;
}

.portal-probe-live-card {
  max-width: none;
  margin-top: 1.25rem;
}

.portal-probe-live-card--embedded {
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.portal-meat-probes-setup-card {
  max-width: none;
  padding: 1rem 1.25rem 1.1rem;
}

.portal-meat-probes-setup-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.portal-meat-probes-setup-toolbar h2 {
  margin: 0;
  font-size: 1.3rem;
}

.portal-meat-probes-setup-desc {
  margin: 0 0 0.65rem;
  font-size: 0.9rem;
}

.portal-meat-probes-smoker-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.75rem;
}

.portal-meat-probes-smoker-picker label {
  font-weight: 600;
}

.portal-meat-probes-smoker-context {
  margin: 0.25rem 0 0.35rem;
}

.portal-meat-probes-smoker-label {
  color: var(--muted, #a1a1aa);
  margin-right: 0.35rem;
}

.portal-meat-probes-smoker-note {
  margin: 0 0 0.75rem;
  font-size: 0.92rem;
}

.portal-meat-probes-setup-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
}

.portal-meat-probes-setup-add-label {
  font-size: 0.85rem;
  color: var(--muted, #a1a1aa);
}

.portal-meat-probes-setup-add select {
  min-width: 10.5rem;
  max-width: 14rem;
}

.portal-meat-probes-accounts {
  display: grid;
  gap: 0;
}

.portal-meat-probes-provider-block {
  display: grid;
  grid-template-columns: minmax(7rem, 9rem) 1fr;
  gap: 0.35rem 0.85rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.portal-meat-probes-provider-block:last-child {
  border-bottom: none;
}

.portal-meat-probes-provider-name {
  font-weight: 600;
  padding-top: 0.15rem;
}

.portal-meat-probes-provider-body {
  min-width: 0;
}

.portal-meat-probes-account-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.portal-meat-probes-account-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  padding: 0.15rem 0;
}

.portal-meat-probes-linked-label {
  color: var(--muted, #a1a1aa);
}

.portal-meat-probes-account-error {
  font-size: 0.82rem;
  flex: 1 1 100%;
}

.portal-meat-probes-unlink-form {
  display: inline;
  margin: 0;
}

.portal-meat-probes-add-account {
  display: inline-block;
  margin-top: 0.2rem;
  font-size: 0.85rem;
}

.portal-meat-probes-none {
  margin: 0;
  font-size: 0.88rem;
}

.portal-probe-account-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.portal-probe-account-badge::before {
  content: "[";
}

.portal-probe-account-badge::after {
  content: "]";
}

.portal-probe-account-badge--active {
  color: #22d3ee;
  background: rgba(34, 211, 238, 0.12);
}

.portal-probe-account-badge--error {
  color: #f472b6;
  background: rgba(244, 114, 182, 0.12);
}

.portal-probe-account-badge--pending {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.12);
}

.portal-meat-probes-live-section .portal-probe-live-card--embedded + .portal-probe-live-card--embedded {
  margin-top: 0.5rem;
}

.portal-meat-probes-live-section .portal-probe-live-head {
  margin-bottom: 0.65rem;
}

.portal-meat-probes-live-section .portal-probe-assign-all {
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.75rem;
}

.portal-meat-probes-live-section .portal-probe-live-head h3 {
  font-size: 1.05rem;
}

.portal-probe-live-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.portal-probe-live-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.portal-probe-live-head h3 {
  margin: 0 0 0.25rem;
}

.portal-probe-live-sub {
  margin: 0;
  font-size: 0.9rem;
}

.portal-probe-assign-all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(59, 130, 246, 0.08);
}

.portal-probe-assign-all__label {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: nowrap;
}

.portal-probe-assign-all select {
  flex: 1 1 14rem;
  min-width: 12rem;
  max-width: 22rem;
}

.portal-probe-table-wrap {
  overflow-x: auto;
}

.portal-probe-table {
  min-width: 42rem;
  margin: 0;
}

.portal-probe-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.portal-probe-table tbody tr.portal-probe-row {
  background: transparent;
}

.portal-probe-table tbody tr.portal-probe-row:hover {
  background: rgba(59, 130, 246, 0.06);
}

.portal-probe-table tbody tr.portal-probe-sensors-row:hover {
  background: transparent;
}

.portal-probe-col-expand {
  width: 2.75rem;
  padding-right: 0.25rem;
  text-align: center;
}

.portal-probe-col-name {
  font-weight: 600;
  min-width: 6rem;
}

.portal-probe-col-id {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.portal-probe-col-temp {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #22d3ee;
  white-space: nowrap;
  min-width: 5.5rem;
}

.portal-probe-col-smoker select {
  width: 100%;
  min-width: 11rem;
  max-width: 16rem;
}

.portal-probe-col-graph {
  width: 4.5rem;
  text-align: center;
}

.portal-probe-col-actions {
  width: 6.5rem;
  text-align: right;
  white-space: nowrap;
}

.portal-probe-graph-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}

.portal-probe-graph-check input {
  margin: 0;
}

.portal-probe-col-actions .btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.portal-probe-unbind-form {
  display: inline;
  margin-left: 0.35rem;
}

.portal-probe-form-hidden {
  display: none;
}

.portal-probe-expand-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.portal-probe-expand-btn:hover,
.portal-probe-expand-btn:focus-visible {
  border-color: #3b82f6;
  color: #22d3ee;
  background: rgba(59, 130, 246, 0.12);
}

.portal-probe-expand-icon {
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
}

.portal-probe-sensors-row > td {
  padding: 0 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.35);
}

.portal-probe-sensors-panel {
  margin: 0.15rem 0 0.35rem 2.5rem;
  padding: 0.75rem 1rem;
  border-left: 3px solid #3b82f6;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(59, 130, 246, 0.06);
}

.portal-probe-sensors-title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.portal-probe-sensors-table {
  width: 100%;
  min-width: 0;
  margin: 0;
}

.portal-probe-sensors-table th,
.portal-probe-sensors-table td {
  padding: 0.4rem 0.65rem;
  font-size: 0.88rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.portal-probe-sensors-table tbody tr:last-child td {
  border-bottom: none;
}

.portal-probe-sensors-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.portal-probe-oauth-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.portal-alias-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: flex-end;
  margin: 0.75rem 0;
}

.portal-alias-form label {
  flex: 1 1 12rem;
}

p.success {
  color: #22d3ee;
  font-weight: 600;
}

/* —— Mobile nav drawer (hamburger) —— */
.site-header__mobile-bar {
  display: none;
}

.site-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--nav-bg);
  color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

.site-nav-toggle:hover {
  background: var(--nav-active);
}

.site-nav-toggle__icon,
.site-nav-toggle__icon::before,
.site-nav-toggle__icon::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.site-nav-toggle__icon {
  position: relative;
}

.site-nav-toggle__icon::before,
.site-nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.site-nav-toggle__icon::before {
  top: -6px;
}

.site-nav-toggle__icon::after {
  top: 6px;
}

.site-header.is-nav-open .site-nav-toggle__icon {
  background: transparent;
}

.site-header.is-nav-open .site-nav-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.site-header.is-nav-open .site-nav-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.portal-nav-mobile-only {
  display: none;
}

.portal-nav__drawer-label {
  display: none;
  margin: 0.5rem 0 0.15rem;
  padding: 0.65rem 1rem 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

body.site-nav-open {
  overflow: hidden;
}

body.site-nav-open::before {
  content: "";
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9;
}

.site-header {
  z-index: 11;
}

/* —— Responsive: phones, tablets, desktop —— */
@media (max-width: 1024px) {
  .page-main {
    padding: 1.25rem;
  }

  .detail-top-grid {
    grid-template-columns: 1fr;
  }

  .portal-meat-probes-provider-block {
    grid-template-columns: 1fr;
    gap: 0.35rem 0;
  }

  .portal-meat-probes-provider-name {
    padding-top: 0;
  }
}

@media (max-width: 900px) {
  .portal-layout {
    font-size: 1.0625rem;
  }

  .portal-layout .muted {
    font-size: 0.98rem;
  }

  .portal-layout .page-toolbar h2,
  .portal-layout .card h3 {
    font-size: 1.3rem;
  }

  .site-header {
    padding: 0.65rem 1rem 0.85rem;
  }

  .site-header__toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .site-header__mobile-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
  }

  .site-header__page--bar {
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .site-header__page--desktop {
    display: none;
  }

  .site-nav-toggle {
    display: inline-flex;
  }

  .site-header__nav-row {
    flex-wrap: wrap;
    overflow: visible;
    gap: 0;
  }

  .site-nav--drawer {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 0;
    margin-top: 0.35rem;
    padding: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  }

  .site-header.is-nav-open .site-nav--drawer {
    display: flex;
  }

  .site-nav--drawer a,
  .site-nav--drawer .portal-nav-dropdown__toggle {
    display: block;
    width: 100%;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 600;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    border: none;
    white-space: normal;
    margin: 0;
  }

  .site-nav--drawer a + a,
  .site-nav--drawer .portal-nav-mobile-only {
    margin-top: 0.15rem;
  }

  .site-nav--drawer a.active,
  .site-nav--drawer .portal-nav-dropdown__toggle.active {
    background: var(--nav-active);
    border-color: transparent;
  }

  .portal-nav-desktop-only {
    display: none !important;
  }

  .portal-nav-mobile-only {
    display: block;
  }

  .portal-nav__drawer-label {
    display: block;
  }

  .site-header__actions {
    width: 100%;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 0.75rem;
  }

  .site-header__session {
    max-width: none;
    flex: 1 1 auto;
    text-align: left;
    min-width: 0;
    font-size: 0.95rem;
  }

  .site-header__session-name {
    font-size: 1rem;
  }

  .site-header__actions .btn.secondary {
    font-size: 1rem;
    padding: 0.65rem 1rem;
  }

  .device-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    max-width: none;
  }

  .device-subnav > a,
  .device-subnav__group {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .page-toolbar__actions {
    width: 100%;
  }

  .page-toolbar .btn,
  .page-toolbar a.btn {
    width: 100%;
    text-align: center;
  }

  .filter-bar label,
  .filter-bar select,
  .filter-bar input {
    flex: 1 1 100%;
    min-width: 0;
  }

  .bulk-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .bulk-actions {
    width: 100%;
  }

  .bulk-actions-label select {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
  }

  .portal-invite-form {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-invite-form label,
  .portal-invite-role,
  .portal-invite-form .btn {
    flex: 1 1 auto;
    width: 100%;
  }

  .portal-invite-form .btn.secondary {
    width: 100%;
  }

  .portal-alias-form {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-alias-form label,
  .portal-alias-form .btn {
    width: 100%;
  }

  .portal-meat-probes-setup-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-meat-probes-setup-add {
    width: 100%;
  }

  .portal-meat-probes-setup-add select {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    width: 100%;
  }

  .portal-probe-assign-all {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-probe-assign-all select {
    max-width: none;
    width: 100%;
  }

  .portal-creds-dl {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .portal-creds-dl dt {
    margin-top: 0.5rem;
  }

  .portal-creds-dl dt:first-child {
    margin-top: 0;
  }

  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .users-toolbar__actions {
    width: 100%;
  }

  .users-toolbar__actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .form-actions .btn,
  .form-actions button,
  .form-actions a.btn {
    width: 100%;
    text-align: center;
  }

  .portal-invite-pending__row {
    flex-direction: column;
    align-items: stretch;
  }

  .portal-invite-pending__link {
    width: 100%;
  }

  .copy-row {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .page-main {
    padding: 0.85rem;
  }

  .card {
    padding: 1rem 1.05rem;
  }

  .card.wide {
    max-width: none;
  }

  .auth-layout {
    align-items: flex-start;
    padding: 1rem 0.85rem 1.5rem;
  }

  .auth-layout .card {
    max-width: none;
  }

  .auth-brand--dual {
    max-width: none;
  }

  .auth-brand--dual .auth-portal-mark {
    max-width: min(120px, 34vw);
    max-height: 64px;
  }

  .auth-brand--dual .auth-banner-mark {
    max-width: min(280px, 88vw);
  }

  th, td {
    padding: 0.5rem 0.55rem;
    font-size: 0.85rem;
  }

  th {
    font-size: 0.72rem;
  }

  table {
    min-width: 520px;
  }

  .portal-probe-table {
    min-width: 36rem;
  }

  .portal-smoker-links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    line-height: 1.45;
  }

  .portal-smoker-links a {
    display: inline-block;
    font-size: 1rem;
  }
}

  .col-actions {
    white-space: normal;
  }

  .col-actions .btn-link,
  .col-actions .inline-form {
    margin-left: 0;
    display: block;
    margin-top: 0.35rem;
  }

  td.col-fleet-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .overview-kv {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .site-fleet-logo {
    height: 56px;
    max-height: 56px;
  }

  .site-portal-logo {
    height: 56px;
    max-height: 56px;
  }

  .page-toolbar h2,
  .card h2 {
    font-size: 1.1rem;
  }

  button, .btn {
    padding: 0.6rem 1rem;
  }

  table {
    min-width: 460px;
  }
}
