@import url("tokens.css");

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Password show/hide (login, change-password, users) */
.pw-field-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
}
.pw-field-wrap input[type="password"],
.pw-field-wrap input[type="text"] {
  flex: 1 1 auto;
  width: 100%;
  padding-right: 2.75rem !important;
  box-sizing: border-box;
}
.pw-toggle {
  position: absolute;
  right: 0.2rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  padding: 0.4rem 0.55rem;
  border-radius: 4px;
  font-size: 0.95rem;
  line-height: 1;
  z-index: 1;
}
.pw-toggle:hover {
  color: var(--brand-orange, #f49040);
  background: rgba(244, 144, 64, 0.1);
}
.pw-toggle[aria-pressed="true"] {
  color: var(--brand-orange, #f49040);
}
.pw-field-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}
.pw-field-row .pw-field-wrap {
  flex: 1 1 12rem;
  min-width: 0;
}
.pw-field-row .pw-generate {
  flex: 0 0 auto;
  white-space: nowrap;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  background: var(--surface-0);
  color: var(--text-primary);
}

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

a:hover {
  text-decoration: underline;
}

.portal-runtime-banner {
  padding: 0.5rem 1.5rem;
  background: #2a2418;
  border-bottom: 1px solid var(--brand-orange);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.portal-chrome {
  position: sticky;
  top: 0;
  z-index: 2000;
}
.portal-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  height: var(--header-height);
  padding: 0 1.5rem;
  background: var(--brand-black);
  border-bottom: 1px solid var(--border);
  position: relative;
}

/* Left rail — reserve width on first paint (before JS) so main does not reflow */
html {
  --rail-width: var(--rail-expanded);
}
html.rail-collapsed {
  --rail-width: var(--rail-collapsed);
}
body.portal-has-rail {
  --rail-width: var(--rail-expanded);
}
body.portal-has-rail.rail-collapsed,
html.rail-collapsed body.portal-has-rail {
  --rail-width: var(--rail-collapsed);
}
.portal-rail {
  position: fixed;
  top: var(--rail-top, var(--header-height));
  left: 0;
  bottom: 0;
  width: var(--rail-width);
  z-index: 1890;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.5rem 0.4rem 0.75rem;
  background: var(--brand-black);
  border-right: 1px solid var(--border);
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
}
.portal-rail-item {
  position: relative;
  flex: 0 0 auto;
}
.portal-rail-link,
.portal-rail-child {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  min-height: 2.1rem;
}
.portal-rail-link {
  padding: 0.15rem 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.portal-rail-link:hover,
.portal-rail-child:hover {
  color: var(--text-primary);
  background: var(--surface-1);
  text-decoration: none;
}
.portal-rail-link.active,
.portal-rail-child.active {
  color: var(--brand-orange);
  background: rgba(244, 144, 64, 0.12);
}
.portal-rail-icon {
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 2.1rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
  display: block;
}
.portal-rail-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.portal-rail-item.has-children > .portal-rail-link::after {
  content: "▾";
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.7;
  padding-right: 0.2rem;
}
.portal-rail-item.has-children.is-open > .portal-rail-link::after {
  transform: rotate(-180deg);
}
.portal-rail-flyout-title {
  display: none;
}
.portal-rail-children {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.15rem 0 0.35rem 2.5rem;
}
.portal-rail-children[hidden] {
  display: none;
}
.portal-rail-child {
  padding: 0.35rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  min-height: 2.1rem;
}
.portal-rail-collapse {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}
.portal-rail-collapse:hover {
  color: var(--text-primary);
}
.portal-rail-collapse-icon {
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.portal-rail-collapse-icon::before {
  content: "‹";
  font-size: 1.35rem;
  line-height: 1;
}
body.rail-collapsed .portal-rail-collapse-icon::before {
  content: "›";
}
body.rail-collapsed .portal-rail {
  overflow: visible;
}
body.rail-collapsed .portal-rail-item.has-children > .portal-rail-link::after {
  display: none;
}
body.rail-collapsed .portal-rail-label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
body.rail-collapsed .portal-rail-flyout-title {
  display: block;
  padding: 0.3rem 0.55rem 0.45rem;
  color: var(--brand-orange);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.rail-collapsed .portal-rail-children:not([hidden]) {
  position: absolute;
  left: 100%;
  top: 0;
  min-width: 13rem;
  padding: 0.35rem;
  background: var(--brand-black);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 2100;
}
@media (min-width: 901px) {
  body:has(#portal-header-root)::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--rail-width);
    background: var(--brand-black);
    border-right: 1px solid var(--border);
    z-index: 1880;
    pointer-events: none;
  }
  body:has(#portal-header-root) .portal-main,
  body.portal-has-rail .portal-main {
    margin-left: var(--rail-width);
    max-width: none;
    width: auto;
  }
  body:has(#portal-header-root) .superadmin-subnav,
  body.portal-has-rail .superadmin-subnav {
    display: none !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  .portal-rail {
    transition: none;
  }
}

.portal-user-menu {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  padding-left: 1rem;
}

.portal-alert-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.portal-alert-bell.is-alert {
  animation: portal-bell-shake 0.7s ease-in-out, portal-bell-flash 0.7s ease-in-out;
}
.portal-alert-badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.1rem;
  height: 1.1rem;
  padding: 0 0.25rem;
  border-radius: 999px;
  background: var(--brand-orange);
  color: #1a1208;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
@keyframes portal-bell-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-12deg); }
  40% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
  80% { transform: rotate(6deg); }
}
@keyframes portal-bell-flash {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(244, 144, 64, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .portal-alert-bell.is-alert { animation: none; }
}
.portal-alert-overlay {
  position: fixed;
  inset: var(--header-height) 0 0 0;
  z-index: 2100;
  background: rgba(0, 0, 0, 0.35);
}
.portal-alert-panel {
  margin-left: auto;
  width: min(22rem, 100%);
  max-height: min(70vh, 28rem);
  overflow: auto;
  background: var(--surface-0, #1a2230);
  border-left: 1px solid var(--border);
  padding: 0.75rem 0.85rem 1rem;
}
.portal-alert-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.portal-alert-clear {
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}
.portal-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.portal-alert-item {
  margin: 0 0 0.4rem;
  padding: 0.45rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
}
.portal-alert-item a {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.82rem;
  display: block;
}
.portal-alert-item.portal-alert-open a {
  color: var(--text-muted);
}
.portal-alert-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .portal-alert-bell {
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
  }
  .portal-alert-panel {
    width: 100%;
    max-height: min(80vh, 32rem);
  }
  .portal-alert-item a {
    min-height: 2.5rem;
    display: flex;
    align-items: center;
  }
  .portal-alert-clear {
    min-height: 2.5rem;
    padding: 0.35rem 0.7rem;
  }
}

/* Global active-client selector (left of user name) */
.portal-client-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 0.25rem;
}
.portal-client-select label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.portal-client-select select {
  min-width: 11rem;
  max-width: 16rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-family: inherit;
}
.portal-client-select select:focus {
  outline: none;
  border-color: var(--brand-orange);
}

.portal-demo-banner {
  padding: 0.45rem 1.5rem;
  background: #2a2418;
  border-bottom: 1px solid var(--brand-orange);
  color: var(--text-primary);
  font-size: 0.8rem;
  text-align: center;
}
.portal-user-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  max-width: 10rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}
a.portal-user-name:hover {
  color: var(--brand-orange, #f49040);
  text-decoration: underline;
}
.portal-logout-btn {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}
.portal-logout-btn:hover {
  border-color: var(--brand-orange, #f49040);
}
.portal-user-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}
.portal-user-link:hover {
  color: var(--text-primary);
  background: var(--surface-1);
  text-decoration: none;
}
.portal-user-link.active {
  color: var(--brand-orange);
  background: rgba(244, 144, 64, 0.12);
}

.portal-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.portal-brand img {
  height: 36px;
  width: auto;
}

.portal-brand span {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.portal-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.portal-nav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
}

.portal-nav a:hover {
  color: var(--text-primary);
  background: var(--surface-1);
  text-decoration: none;
}

.portal-nav a.active {
  color: var(--brand-orange);
  background: rgba(244, 144, 64, 0.12);
}

.portal-nav a.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.portal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.client-context-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
  background: none;
  border: none;
}

.client-context-bar label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.client-context-bar select {
  min-width: 140px;
  padding: 0.25rem 0.45rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
}

.superadmin-subnav {
  display: flex;
  gap: 0.25rem;
  padding: 0.4rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.superadmin-subnav a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.superadmin-subnav a:hover {
  color: var(--text-primary);
  background: var(--surface-1);
  text-decoration: none;
}

.superadmin-subnav a.active {
  color: var(--brand-orange);
  background: rgba(244, 144, 64, 0.12);
}

.client-required-banner {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid var(--warning);
  color: var(--warning);
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-muted);
}

.badge-accent {
  background: rgba(244, 144, 64, 0.18);
  color: var(--brand-orange);
}

.badge-success {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
}

.portal-main {
  max-width: 1280px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: var(--page-chrome-pad-y) var(--page-chrome-pad-x) 1rem;
  box-sizing: border-box;
}

.page-header {
  margin: 0 0 var(--page-subtitle-gap);
}

.page-header .page-title {
  margin-bottom: var(--page-title-gap);
}

.page-header .page-subtitle,
.page-header .section-subtitle {
  margin-bottom: 0;
}

.page-title {
  margin: 0 0 var(--page-title-gap);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.page-subtitle,
.section-subtitle {
  margin: 0 0 var(--page-subtitle-gap);
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.event-master-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--brand-orange, #f49040);
  background: rgba(244, 144, 64, 0.1);
  border-radius: var(--radius-sm, 6px);
}
.event-master-banner-text {
  flex: 1 1 12rem;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--text-primary);
}
.event-master-banner-btn {
  flex: 0 0 auto;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--brand-orange, #f49040);
  background: var(--surface-1);
  color: var(--text-primary);
  cursor: pointer;
}
.event-master-banner-btn:hover {
  background: rgba(244, 144, 64, 0.18);
}
.event-child-open {
  font-weight: 700;
  color: var(--brand-orange, #f49040);
  white-space: nowrap;
}

/* Event boards: filters + tall viewport list */
.event-board-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.4rem 0.7rem !important;
  margin-bottom: var(--page-section-gap) !important;
}

.event-filters-chips {
  flex: 1 1 auto;
  min-width: 0;
}

.event-find-ticket {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  flex: 1 1 16rem;
  min-width: 14rem;
  margin: 0 0 0 auto;
}

.event-find-ticket input[type="search"] {
  flex: 1 1 10rem;
  min-width: 0;
  height: auto;
  min-height: 2rem;
  font-size: 16px;
  line-height: 1.2;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-1);
  color: var(--text-primary);
}

.event-find-ticket button[type="submit"],
.event-copy-link-btn,
.event-back-btn {
  flex: 0 0 auto;
  min-height: 2rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.875rem;
}

.event-find-status {
  flex: 1 1 100%;
  font-size: 0.8rem;
  color: var(--warning, #e6a23c);
  min-height: 1em;
}

.event-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0;
  flex-wrap: wrap;
}

.event-detail-title {
  margin: 0;
  font-size: 1.125rem;
  min-width: 0;
}

.event-ticket-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 0.15em;
  word-break: break-all;
}

.event-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .event-find-ticket {
    flex: 1 1 100%;
    margin-left: 0;
    min-width: 0;
  }
  .event-find-ticket button[type="submit"],
  .event-copy-link-btn,
  .event-back-btn {
    min-height: 2.5rem;
  }
}

.event-board-table-scroll {
  max-height: calc(100vh - var(--header-height) - var(--event-board-chrome));
  overflow: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

.event-board-table-scroll.panel-table-scroll {
  /* Override the default ~10-row panel cap */
  max-height: calc(100vh - var(--header-height) - var(--event-board-chrome));
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Event board list tables: fill card width; H-scroll only when viewport is narrow */
#outage-table,
#pm-table {
  width: 100%;
  min-width: 64rem;
  table-layout: fixed;
  border-collapse: collapse;
}
#outage-table th,
#outage-table td,
#pm-table th,
#pm-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* PM board columns (sum 100%): ID 10, Start 11, End 11, Cust 5, Type 13, Sev 6, Score 5, Status 7, Summary 32 */
#pm-table th,
#pm-table td {
  padding: 0.3rem 0.4rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#pm-table .pm-id-cell,
#pm-table th:nth-child(1),
#pm-table td:nth-child(1) {
  width: 10%;
}
#pm-table th:nth-child(2),
#pm-table td:nth-child(2),
#pm-table .pm-start-cell {
  width: 11%;
}
#pm-table th:nth-child(3),
#pm-table td:nth-child(3),
#pm-table .pm-end-cell {
  width: 11%;
}
#pm-table .pm-end-open {
  color: var(--text-muted);
  font-style: italic;
  font-weight: 500;
}
#pm-table th:nth-child(4),
#pm-table td:nth-child(4),
#pm-table .pm-cust-cell {
  width: 5%;
  text-align: center;
} /* Cust */
#pm-table th:nth-child(5),
#pm-table td:nth-child(5),
#pm-table .pm-type-cell {
  width: 13%;
} /* Type */
#pm-table .pm-type-short {
  font-size: 0.72rem;
}
#pm-table th:nth-child(6),
#pm-table td:nth-child(6),
#pm-table .pm-sev-cell {
  width: 6%;
} /* Sev */
#pm-table th:nth-child(7),
#pm-table td:nth-child(7),
#pm-table .pm-score-cell {
  width: 5%;
  text-align: center;
  font-weight: 700;
} /* Score */
#pm-table th:nth-child(8),
#pm-table td:nth-child(8),
#pm-table .pm-status-cell {
  width: 7%;
} /* Status */
#pm-table th:nth-child(9),
#pm-table td:nth-child(9),
#pm-table .pm-summary-cell {
  width: 32%;
  max-width: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
}

/* Outage board columns (sum 100%): ID 10, Start 11, End 11, Type 16, Off/Tot 8, Score 7, Resolution 8, Summary 29 */
#outage-table th,
#outage-table td {
  padding: 0.35rem 0.5rem;
}
#outage-table .ev-id,
#outage-table th:nth-child(1),
#outage-table td:nth-child(1) {
  width: 10%;
}
#outage-table .ev-start,
#outage-table th:nth-child(2),
#outage-table td:nth-child(2) {
  width: 11%;
}
#outage-table .ev-end,
#outage-table th:nth-child(3),
#outage-table td:nth-child(3) {
  width: 11%;
}
#outage-table .ev-type,
#outage-table th:nth-child(4),
#outage-table td:nth-child(4) {
  width: 16%;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  line-height: 1.35;
}
#outage-table th:nth-child(5),
#outage-table td:nth-child(5) {
  width: 8%;
} /* Off/Tot */
#outage-table .ev-score,
#outage-table th:nth-child(6),
#outage-table td:nth-child(6) {
  width: 7%;
  text-align: center;
}
#outage-table th:nth-child(7),
#outage-table td:nth-child(7) {
  width: 8%;
} /* Resolution */
#outage-table .ev-summary,
#outage-table th:nth-child(8),
#outage-table td:nth-child(8) {
  width: 29%;
  max-width: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.telemetry-stats .stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-value {
  font-size: 2rem;
  line-height: 1.1;
  color: var(--text-primary);
}

.stat-detail {
  min-height: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.meta-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.badge-warning {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: var(--brand-orange);
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.panel-header-meta {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.inventory-export-btn {
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

.inventory-export-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.panel-body {
  padding: 1.25rem;
}

.poller-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.poller-status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.85rem;
}

.poller-status-chip strong {
  font-weight: 600;
}

.panel-table-body {
  padding: 0;
}

.panel-table-scroll {
  --panel-table-row-height: 2.65rem;
  max-height: calc(var(--panel-table-row-height) * 10);
  overflow: auto;
}

.panel-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Toggle switch for scrape enable/disable */
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.8rem;
  color: var(--text-muted);
  user-select: none;
}
.toggle-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-slider {
  position: relative;
  width: 2.2rem;
  height: 1.2rem;
  background: var(--surface-3);
  border-radius: 0.6rem;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle-slider::after {
  content: "";
  position: absolute;
  top: 0.15rem;
  left: 0.15rem;
  width: 0.9rem;
  height: 0.9rem;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
}
.toggle-label input:checked + .toggle-slider {
  background: var(--brand-orange);
}
.toggle-label input:checked + .toggle-slider::after {
  transform: translateX(1rem);
}

.pagination-tab {
  min-width: 2rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.pagination-tab:hover:not(:disabled) {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}

.pagination-tab.is-active {
  background: var(--brand-orange);
  border-color: var(--brand-orange);
  color: #fff;
}

.pagination-tab:disabled {
  opacity: 0.45;
  cursor: default;
}

.pagination-nav {
  min-width: 2.2rem;
  letter-spacing: -0.03em;
}

.inventory-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.inventory-table-scroll-top {
  overflow-y: hidden;
  margin-bottom: 0.15rem;
}

.inventory-table-scroll-top > div {
  height: 1px;
}

.inventory-table-scroll-bottom {
  margin-bottom: 0;
}

.data-table-wide {
  width: max-content;
  min-width: 100%;
}

.data-table-wide th,
.data-table-wide td {
  white-space: nowrap;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

table.data-table th,
table.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}

table.data-table th {
  color: var(--brand-orange);
  font-weight: 600;
  background: rgba(36, 48, 68, 0.5);
}

table.data-table th.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

table.data-table th.sortable-th:hover,
table.data-table th.sortable-th:focus-visible {
  background: rgba(36, 48, 68, 0.78);
  outline: none;
}

table.data-table th.sortable-th.is-sorted {
  color: var(--text-primary);
}

table.data-table th.sortable-th .sortable-label {
  margin-right: 0.35rem;
}

table.data-table th.sortable-th .sort-indicator {
  display: inline-block;
  min-width: 0.85rem;
  font-size: 0.7rem;
  color: var(--brand-orange);
  vertical-align: middle;
}

table.data-table th.sortable-th.is-sorted .sort-indicator {
  color: var(--text-primary);
}

table.data-table th.sortable-th .sort-indicator-idle {
  opacity: 0.45;
}

table.data-table tr:last-child td {
  border-bottom: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--brand-orange);
  color: var(--text-on-accent);
  border-color: var(--brand-orange);
}

.btn-primary:hover {
  background: #e08030;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  border-color: var(--brand-orange);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}

.btn-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

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

.form-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-0);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.875rem;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(244, 144, 64, 0.2);
}

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

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

/* Placeholder/loading/empty row inside a .data-table body. Referenced by
   several pages (Network Utilization, Status, Thresholds, event tables)
   but previously never defined. */
.empty-row td,
td.empty-row {
  padding: 1.25rem;
  text-align: center;
  color: var(--text-muted);
  font-style: italic;
}

.coming-soon-hero {
  text-align: center;
  padding: 4rem 2rem;
}

.coming-soon-hero h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.coming-soon-hero p {
  margin: 0;
  color: var(--text-muted);
  max-width: 480px;
  margin-inline: auto;
}

.watermark {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.error-banner {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.hidden {
  display: none !important;
}

/* Narrow header tweaks live under Responsive section (hamburger drawer). */

.config-panel {
  max-width: 100%;
}

.drift-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.drift-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

.drift-ok {
  background: rgba(0, 200, 83, 0.08);
  border-left: 3px solid var(--success, #00c853);
}

.drift-critical {
  background: rgba(255, 82, 82, 0.08);
  border-left: 3px solid var(--danger, #ff5252);
}

.drift-device {
  font-weight: 600;
  min-width: 12rem;
}

.drift-indicator {
  flex: 1;
}

.drift-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.diff-selector-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.diff-selector-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.diff-selector-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.diff-meta {
  margin-bottom: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Replaces inline styles previously on the Config Diff sections. */
.network-section {
  margin-top: 1.25rem;
}

.network-toolbar-tight {
  margin-bottom: 1rem;
}

.diff-compare-actions {
  text-align: center;
  margin-top: 0.75rem;
}

.diff-view-toggle {
  display: flex;
  gap: 0.25rem;
}

.diff-view-toggle .btn.active {
  background: var(--brand-orange);
  color: #fff;
  border-color: var(--brand-orange);
}

.diff-meta-row {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  margin-bottom: 1rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface-1);
  border-radius: 4px;
}

.diff-side-by-side {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.diff-column {
  flex: 1;
  overflow-x: auto;
  min-width: 0;
}

.diff-column-a {
  border-right: 1px solid var(--border);
}

.diff-column-content {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
  font-family: var(--font-mono, "SF Mono", "Fira Code", "Consolas", monospace);
  white-space: pre;
  tab-size: 2;
}

.diff-unified {
  margin: 0;
  padding: 0.75rem;
  font-size: 0.75rem;
  line-height: 1.5;
  font-family: var(--font-mono, "SF Mono", "Fira Code", "Consolas", monospace);
  white-space: pre;
  overflow-x: auto;
  max-height: 70vh;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
}

.diff-added {
  background: rgba(46, 160, 67, 0.18);
  color: #7ee787;
}

.diff-removed {
  background: rgba(248, 81, 73, 0.15);
  color: #ffa198;
}

.diff-hunk {
  color: #79c0ff;
  background: rgba(56, 139, 253, 0.1);
  font-weight: 600;
}

.diff-column-content span,
.diff-unified span {
  display: block;
}

.placeholder-text {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.875rem;
}

.portal-footer {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.portal-footer p {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.portal-footer .confidential {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Status page */
.billing-sync-card {
  padding: 1.25rem;
  margin-bottom: 0.5rem;
}

.billing-sync-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 1rem;
}

.billing-sync-steps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem 1rem;
}

.billing-sync-step {
  padding: 0.55rem 0.65rem;
  background: var(--bg-secondary, rgba(127, 127, 127, 0.08));
  border-radius: 8px;
  font-size: 0.875rem;
}

.billing-step-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.billing-step-detail {
  margin-top: 0.25rem;
  font-size: 0.78rem;
  word-break: break-word;
}

.billing-step-error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--danger, #ef4444);
  word-break: break-word;
}

.momentum-upload-block {
  margin-top: 1.1rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border, rgba(127, 127, 127, 0.25));
}

.momentum-upload-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}

.momentum-pending {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.9rem;
  word-break: break-word;
}

.momentum-empty {
  margin: 0.25rem 0 0.55rem;
  font-size: 0.85rem;
}

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

.momentum-upload-actions input[type="file"] {
  max-width: 100%;
  font-size: 0.85rem;
}

.status-split {
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) minmax(22rem, 1.35fr);
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 0.5rem;
}
.status-split .section-title { margin-top: 0; }
.status-split-left,
.status-split-right {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.status-split-left .poller-card-grid {
  flex: 1;
  grid-template-columns: 1fr;
  min-height: 0;
}
.status-split-left .poller-status-card {
  height: 100%;
  box-sizing: border-box;
}
.public-map-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 1rem 1.15rem 1.1rem;
  box-sizing: border-box;
}
.public-map-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.public-map-head .watermark { margin: 0; }
.public-map-head a { font-size: 0.85rem; white-space: nowrap; }
.public-map-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.25rem 1.5rem;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}
.public-map-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.public-map-col-planned { min-height: 0; }
.public-map-textarea {
  width: 100%;
  box-sizing: border-box;
  margin: 0.25rem 0 0.7rem;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.85rem;
  line-height: 1.4;
  resize: vertical;
  min-height: 3.25rem;
}
.public-map-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
}
.public-map-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0.25rem 0 0.5rem;
}
.public-map-add-row select { flex: 1; min-width: 0; }
.public-planned-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  min-height: 4rem;
  overflow: auto;
}
.public-planned-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border, #e6e6e6);
  font-size: 0.85rem;
}
.public-planned-list li span { flex: 1; min-width: 0; }
.public-map-status { min-height: 1.1rem; margin: 0; }

.poller-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1rem;
}

.poller-status-card {
  padding: 1.25rem;
}

.poller-status-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.poller-status-header > :first-child {
  flex: 1;
}

.header-uptime {
  flex: 1;
  text-align: left;
  font-size: 0.875rem;
  line-height: 1.5;
}

.poller-status-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem 1rem;
  font-size: 0.875rem;
}

.poller-status-details .detail-label {
  color: var(--text-secondary);
  font-weight: 500;
}

.backlog-bar-container {
  width: 100%;
  height: 12px;
  background: var(--bg-secondary);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.backlog-bar {
  height: 100%;
  background: var(--success);
  border-radius: 6px;
  transition: width 0.3s ease, background 0.3s ease;
}

.backlog-bar.backlog-warn {
  background: var(--warning);
}

.backlog-stats {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.badge-green {
  background: #22c55e33;
  color: #22c55e;
}

.badge-yellow {
  background: #eab30833;
  color: #eab308;
}

.badge-orange {
  background: #f59e0b33;
  color: #f59e0b;
}

.badge-red {
  background: #ef444433;
  color: #ef4444;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.exception-section {
  border-top: 1px solid var(--border);
  padding: 0.5rem 0;
}

.exception-section .panel-header h3 {
  margin: 0;
  font-weight: 600;
}

.stat-card[data-exception-section]:hover,
.stat-card[data-ex-filter]:hover {
  border-color: var(--brand-orange);
}

.stat-card[data-ex-filter].is-active {
  border-color: var(--brand-orange);
  background: rgba(245, 158, 11, 0.08);
}

/* ── Admin Hierarchy layout + groups ── */
.hierarchy-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) 1fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 900px) {
  .hierarchy-layout {
    grid-template-columns: 1fr;
  }
}
.hierarchy-groups-panel {
  padding: 1rem;
  position: sticky;
  top: 0.75rem;
}
.hierarchy-groups-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}
.hierarchy-groups-head h2 {
  margin: 0;
  font-size: 1rem;
}
.hierarchy-groups-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 40vh;
  overflow-y: auto;
}
.hierarchy-group-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  cursor: pointer;
  font-family: inherit;
}
.hierarchy-group-item:hover {
  border-color: var(--brand-orange);
}
.hierarchy-group-item.is-selected {
  border-color: var(--brand-orange);
  background: rgba(245, 158, 11, 0.08);
}
.hierarchy-group-swatch {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 999px;
  margin-top: 0.25rem;
  flex-shrink: 0;
}
.hierarchy-group-meta {
  min-width: 0;
  flex: 1;
}
.hierarchy-group-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.hierarchy-group-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.hierarchy-group-form input[type="text"],
.hierarchy-group-form input[type="color"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.35rem 0.5rem;
  font-family: inherit;
}
.hierarchy-group-form-actions {
  display: flex;
  gap: 0.35rem;
}
.hierarchy-group-members {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
}
.hierarchy-group-detail-head {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.hierarchy-member-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.hierarchy-member-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.hgroup-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hg-color, #94a3b8) 22%, transparent);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--hg-color, #94a3b8) 55%, transparent);
  flex-shrink: 0;
}
.hgroup-badge-inherited {
  opacity: 0.92;
  border-style: dashed;
}
.hgroup-badge .hgroup-via {
  font-size: 0.55rem;
  font-weight: 600;
  opacity: 0.75;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.hgroup-assign {
  max-width: 7.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.75rem;
  padding: 0.2rem 0.3rem;
  font-family: inherit;
}
.tree-group-filter {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  font-family: inherit;
}

/* ── Admin Hierarchy Tree ── */
.tree-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tree-search-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.9rem;
  width: 300px;
  font-family: inherit;
}

.tree-search-input:focus {
  outline: none;
  border-color: var(--brand-orange);
}

.tree-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tree-device {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.tree-device.olt {
  border-left: 3px solid #4fc3f7;
}

.tree-device.cmts {
  border-left: 3px solid #ffa726;
}

.tree-device-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  cursor: pointer;
  transition: background 0.15s;
  flex-wrap: wrap;
}

.tree-device-header:hover {
  background: var(--surface-3);
}

.tree-device-header.is-expanded {
  border-bottom: 1px solid var(--border);
}

.tree-toggle {
  font-size: 0.75rem;
  width: 1rem;
  text-align: center;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.tree-toggle-empty {
  visibility: hidden;
}

.tree-device-id {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  min-width: 200px;
}

.tree-device-type {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.tree-port-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
  margin-right: auto;
}

.tree-device-alias {
  max-width: 200px;
}

.tree-device-ports {
  background: rgba(255, 255, 255, 0.02);
}

.tree-device-ports .data-table {
  margin: 0;
  border: none;
}

.tree-device-ports .data-table th {
  font-size: 0.75rem;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.tree-device-ports .data-table td {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.tree-port-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.alias-input {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
  font-family: inherit;
  width: 180px;
  transition: border-color 0.2s, background 0.2s;
}

.alias-input:hover {
  border-color: var(--border);
  background: var(--surface-2);
}

.alias-input:focus {
  outline: none;
  border-color: var(--brand-orange);
  background: var(--surface-2);
}

.alias-input.is-edited {
  border-color: var(--brand-orange);
  background: rgba(245, 158, 11, 0.05);
}

.alias-port-name {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.save-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2500;
}

.save-overlay.hidden {
  display: none;
}

.save-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  max-width: min(90vw, 28rem);
  text-align: center;
}

.save-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: save-spin 0.8s linear infinite;
  flex-shrink: 0;
}

.save-overlay-msg {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

@keyframes save-spin {
  to { transform: rotate(360deg); }
}
/* ---- Network Telemetry selector bar ---- */
.telemetry-selector-bar {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
}

.telemetry-selector-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1rem;
  align-items: flex-end;
}

.telemetry-search-field {
  flex: 1 1 240px;
  min-width: 200px;
  margin: 0;
}

.telemetry-filter-field {
  flex: 0 1 160px;
  min-width: 140px;
  margin: 0;
}

.telemetry-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface-2);
}

.telemetry-mode-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.55rem 1.1rem;
  cursor: pointer;
  min-height: 2.4rem;
}

.telemetry-mode-btn + .telemetry-mode-btn {
  border-left: 1px solid var(--border);
}

.telemetry-mode-btn:hover {
  color: var(--text-primary);
  background: rgba(244, 144, 64, 0.08);
}

.telemetry-mode-btn.is-active {
  background: var(--brand-orange);
  color: #fff;
}

.telemetry-context-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-top: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm, 6px);
  background: rgba(244, 144, 64, 0.1);
  border: 1px solid rgba(244, 144, 64, 0.25);
  font-size: 0.875rem;
  color: var(--text-primary);
}

.telemetry-context-banner.hidden,
.panel.hidden {
  display: none !important;
}

.btn-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-orange);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  text-decoration: underline;
}

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

.section-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--text-primary);
}

tr.telemetry-match-row > td {
  background: rgba(244, 144, 64, 0.12);
}

/* ---- Customer tab (CSR view) ---- */
.customer-page .customer-search-bar {
  margin-bottom: 1.25rem;
  padding: 1rem 1.25rem;
}

.customer-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: flex-end;
}

.customer-search-field {
  flex: 1 1 280px;
  margin: 0;
}

.customer-search-btn {
  appearance: none;
  border: 0;
  background: var(--brand-orange);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 2.4rem;
}

.customer-search-btn:hover {
  filter: brightness(1.05);
}

.customer-search-results {
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  max-height: 280px;
  overflow: auto;
}

.customer-search-hit {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
}

.customer-search-hit:last-child {
  border-bottom: 0;
}

.customer-search-hit.is-active,
.customer-search-hit:hover {
  background: rgba(244, 144, 64, 0.1);
}

.customer-search-hit .watermark {
  display: block;
  margin-top: 0.15rem;
}

.customer-search-empty {
  padding: 0.85rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.customer-recent {
  margin-top: 0.65rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.customer-recent-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
}

.customer-recent-chip:hover {
  border-color: var(--brand-orange);
}

.customer-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.customer-empty-title {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.customer-hero {
  padding: 1.25rem 1.35rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(244, 144, 64, 0.12), transparent 55%);
}

.customer-hero-name {
  margin: 0 0 0.35rem;
  font-size: 1.45rem;
}

.customer-hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin-bottom: 0.35rem;
}

.customer-hero-addr {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
}

.customer-hero-contact {
  margin: 0.25rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.customer-device-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}

.customer-device-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.customer-device-tab.is-active {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 1px rgba(244, 144, 64, 0.35);
  background: rgba(244, 144, 64, 0.08);
}

.cust-status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.cust-block {
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}

.cust-block-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--brand-orange);
}

.cust-subhead {
  margin: 1rem 0 0.45rem;
  font-size: 0.85rem;
}

.cust-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .cust-two-col {
    grid-template-columns: 1fr;
  }
}

.cust-dl {
  display: grid;
  gap: 0.45rem;
  margin: 0;
}

.cust-dl > div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.cust-dl dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.cust-dl dd {
  margin: 0;
}

.cust-metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.cust-metric-tile {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.cust-metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.cust-metric-value {
  font-size: 1.25rem;
  line-height: 1.15;
}

.cust-metric-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: 0.2rem;
}

.cust-metric-chip {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  width: fit-content;
  background: rgba(148, 163, 184, 0.2);
  color: var(--text-muted);
}

.cust-grade-good {
  border-color: rgba(52, 211, 153, 0.45);
}
.cust-grade-good .cust-metric-chip,
.cust-metric-chip.cust-grade-good {
  background: rgba(52, 211, 153, 0.18);
  color: #34d399;
}
.cust-grade-watch {
  border-color: rgba(251, 191, 36, 0.45);
}
.cust-grade-watch .cust-metric-chip,
.cust-metric-chip.cust-grade-watch {
  background: rgba(251, 191, 36, 0.18);
  color: #fbbf24;
}
.cust-grade-problem {
  border-color: rgba(248, 113, 113, 0.5);
}
.cust-grade-problem .cust-metric-chip,
.cust-metric-chip.cust-grade-problem {
  background: rgba(248, 113, 113, 0.18);
  color: #f87171;
}

.cust-note {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.cust-banner-warn {
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.3);
  font-size: 0.875rem;
  line-height: 1.45;
}

.cust-uptime-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  align-items: center;
  margin-bottom: 0.55rem;
}

.cust-uptime-bar {
  display: flex;
  width: 100%;
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.cust-uptime-seg {
  height: 100%;
  min-width: 2px;
  cursor: default;
  transition: filter 0.12s ease;
}

.cust-uptime-seg:hover {
  filter: brightness(1.15);
}

.cust-uptime-seg.is-online {
  background: linear-gradient(180deg, #34d399, #059669);
}

.cust-uptime-seg.is-offline {
  background: linear-gradient(180deg, #f87171, #dc2626);
}

.cust-uptime-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.cust-uptime-legend .lg-online::before,
.cust-uptime-legend .lg-offline::before {
  content: "";
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -1px;
}

.cust-uptime-legend .lg-online::before {
  background: #34d399;
}
.cust-uptime-legend .lg-offline::before {
  background: #f87171;
}

.cust-uptime-tip {
  min-height: 1.1rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
}

.cust-trends {
  margin-top: 0.85rem;
  display: grid;
  gap: 0.35rem;
}

.cust-trend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cust-spark {
  display: block;
}

/* CPE table: single-line Type | MAC | IP Ping inside narrow Device tile */
.cust-cpe-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table.cust-cpe-table,
.cust-tile table.cust-cpe-table {
  display: table;
  width: max-content;
  min-width: 100%;
  max-width: none;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 0.72rem;
  line-height: 1.2;
  overflow: visible;
}
table.cust-cpe-table th,
table.cust-cpe-table td,
.cust-tile table.cust-cpe-table th,
.cust-tile table.cust-cpe-table td {
  padding: 0.2rem 0.35rem;
  vertical-align: middle;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.2;
}
table.cust-cpe-table th {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
/* Override .cust-tile code { word-break: break-all } that forced 2-line MACs/IPs */
table.cust-cpe-table code,
.cust-tile table.cust-cpe-table code {
  font-size: 0.72rem;
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
  word-wrap: normal;
}
/* Right-justified Ping column */
table.cust-cpe-table th.cust-cpe-ping-col,
table.cust-cpe-table td.cust-cpe-ping-col {
  text-align: right;
  width: 1%;
  padding-left: 0.5rem;
  white-space: nowrap;
}
/* Compact Ping: secondary button look, row-height (override 44px touch-min). */
.cust-cpe-table .cust-cpe-ping-btn,
button.cust-cpe-ping-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  padding: 0 0.35rem;
  min-height: 1.2rem;
  min-width: 0;
  height: 1.2rem;
  width: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: normal;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  opacity: 0.92;
  vertical-align: middle;
  box-shadow: none;
  touch-action: manipulation;
}
.cust-cpe-table .cust-cpe-ping-btn:hover,
button.cust-cpe-ping-btn:hover {
  border-color: var(--brand-orange);
  background: var(--surface-2);
  color: var(--text-primary);
  text-decoration: none;
}
.cust-cpe-table .cust-cpe-ping-btn:disabled,
button.cust-cpe-ping-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}
.cust-cpe-table .cust-cpe-ping-btn:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 1px;
}

/* Customer summary redesign */
.cust-device-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.cust-device-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}
.cust-device-chip:hover {
  border-color: var(--brand-orange);
}
.cust-device-chip.is-active {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 1px var(--brand-orange);
  background: rgba(244, 144, 64, 0.08);
}
.cust-device-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 22rem;
}

.cust-summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.85rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  align-items: stretch; /* Device | Customer | Online history equal height */
}
/* Grid children must allow shrink or long MAC/CPE tables blow past the viewport */
.cust-summary-row > * {
  min-width: 0;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.cust-summary-row .cust-tile {
  flex: 1 1 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 12rem;
}
/* Online history: keep bar usable; fill vertical space evenly with siblings */
.cust-summary-row .cust-tile-history .cust-uptime-wrap,
.cust-summary-row .cust-tile-history .cust-uptime-meta {
  max-width: 100%;
}
.cust-summary-row .cust-tile-history .cust-uptime-bar {
  margin-top: 0.5rem;
  min-height: 1.35rem;
}
@media (max-width: 1100px) {
  .cust-summary-row {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 720px) {
  .cust-summary-row {
    grid-template-columns: 1fr;
  }
}

.cust-tile-device-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  max-width: 100%;
}
.cust-device-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-left: auto;
  max-width: 100%;
}
.cust-action-btn {
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  opacity: 0.92;
}
.cust-action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

/* Outage close modal (resolution dropdown + note) */
body.outage-close-modal-open {
  overflow: hidden;
}
.outage-close-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.outage-close-modal.hidden {
  display: none;
}
.outage-close-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.outage-close-modal-panel {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  max-height: min(88vh, 36rem);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
  background: var(--surface-1, #1a1f2e);
  border-radius: var(--radius-lg, 10px);
}
.outage-close-modal.is-force .outage-close-modal-panel {
  border-color: rgba(245, 158, 11, 0.55);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.15), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.outage-close-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.outage-close-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
}
.outage-close-modal-sub {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.35;
}
.outage-close-modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.outage-close-modal-close:hover {
  color: var(--text-primary, #e2e8f0);
  background: rgba(255, 255, 255, 0.06);
}
.outage-close-modal-body {
  padding: 0.9rem 1rem 0.5rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.outage-close-modal-warn {
  margin: 0;
  padding: 0.55rem 0.7rem;
  font-size: 0.85rem;
  line-height: 1.4;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: var(--text-primary);
}
.outage-close-modal-warn[hidden] {
  display: none !important;
}
.outage-close-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.3rem;
}
.outage-close-field select,
.outage-close-field textarea {
  width: 100%;
  box-sizing: border-box;
  font-size: 0.95rem;
  line-height: 1.35;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-2, rgba(127, 127, 127, 0.08));
  color: var(--text-primary);
}
.outage-close-field select {
  min-height: 2.35rem;
  cursor: pointer;
}
.outage-close-field textarea {
  min-height: 5rem;
  resize: vertical;
  font-family: inherit;
}
.outage-close-error {
  margin: 0;
  font-size: 0.82rem;
  color: var(--danger, #ef4444);
}
.outage-close-error[hidden] {
  display: none !important;
}
.outage-close-modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
}
.outage-close-modal.is-busy .outage-close-modal-close,
.outage-close-modal.is-busy .outage-close-modal-backdrop {
  pointer-events: none;
  opacity: 0.55;
}

/* DOCSIS live-action modal (Docsis Ping, CPE Ping, Live Poll, Reset) */
body.cust-modal-open {
  overflow: hidden;
}
.cust-action-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}
.cust-action-modal.hidden {
  display: none;
}
.cust-action-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.cust-action-modal-panel {
  position: relative;
  z-index: 1;
  width: min(36rem, 100%);
  max-height: min(88vh, 40rem);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--border);
}
.cust-action-modal.is-ok .cust-action-modal-panel {
  border-color: rgba(34, 197, 94, 0.45);
}
.cust-action-modal.is-fail .cust-action-modal-panel {
  border-color: rgba(239, 68, 68, 0.5);
}
.cust-action-modal.is-busy .cust-action-modal-panel {
  border-color: rgba(244, 144, 64, 0.5);
}
.cust-action-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.65rem;
  border-bottom: 1px solid var(--border);
}
.cust-action-modal-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.25;
}
.cust-action-modal-sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.cust-action-modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted, #94a3b8);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.cust-action-modal-close:hover {
  color: var(--text-primary, #e2e8f0);
  background: rgba(255, 255, 255, 0.06);
}
.cust-action-modal.is-busy .cust-action-modal-close,
.cust-action-modal.is-busy .cust-action-modal-backdrop {
  pointer-events: none;
  opacity: 0.55;
}
.cust-action-modal-meta {
  padding: 0.65rem 1rem 0.25rem;
}
.cust-action-modal-dl {
  margin: 0;
  display: grid;
  gap: 0.28rem 0.75rem;
}
.cust-action-modal-dl > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 0.35rem 0.65rem;
  align-items: baseline;
  font-size: 0.84rem;
}
.cust-action-modal-dl dt {
  margin: 0;
  color: var(--text-muted, #94a3b8);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.cust-action-modal-dl dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cust-action-modal-status {
  padding: 0.35rem 1rem 0.55rem;
}
.cust-action-modal-body {
  padding: 0 1rem 0.85rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.cust-action-modal-foot {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.65rem 1rem 0.85rem;
  border-top: 1px solid var(--border);
}
.cust-action-modal.is-confirm .cust-action-modal-panel {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.12);
}
.cust-action-warn {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.cust-action-warn .cust-action-msg {
  margin: 0;
}
.cust-action-modal #cust-action-modal-primary {
  min-height: auto;
  min-width: auto;
  padding: 0.4rem 0.85rem;
}
.cust-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-1, rgba(255, 255, 255, 0.04));
}
.cust-action-badge.is-ok {
  color: #4ade80;
  border-color: rgba(34, 197, 94, 0.45);
  background: rgba(34, 197, 94, 0.1);
}
.cust-action-badge.is-fail {
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.1);
}
.cust-action-badge.is-busy {
  color: #fb923c;
  border-color: rgba(244, 144, 64, 0.5);
  background: rgba(244, 144, 64, 0.1);
}
.cust-action-spinner {
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid rgba(251, 146, 60, 0.35);
  border-top-color: #fb923c;
  border-radius: 50%;
  animation: cust-action-spin 0.75s linear infinite;
  flex-shrink: 0;
}
@keyframes cust-action-spin {
  to { transform: rotate(360deg); }
}
.cust-action-cmd {
  margin: 0 0 0.55rem;
}
.cust-action-cmd code {
  font-size: 0.82rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
}
.cust-action-msg {
  margin: 0.35rem 0;
  font-size: 0.9rem;
  line-height: 1.4;
}
.cust-action-output-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  margin: 0.35rem 0 0.35rem;
}
.cust-cli-output {
  margin: 0;
  padding: 0.7rem 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  max-height: min(22rem, 48vh);
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary, #e2e8f0);
}

.cust-usage-strip {
  padding: 0.85rem 1rem;
  margin-bottom: 0.85rem;
}
.cust-usage-grid {
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
}

.cust-center-section {
  padding: 0.85rem 1rem 1rem;
  margin-bottom: 0.85rem;
}
.cust-center-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.cust-center-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}
@media (max-width: 720px) {
  .cust-center-tiles {
    grid-template-columns: 1fr;
  }
}
.cust-center-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-1);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.cust-center-tile:hover:not(:disabled) {
  border-color: var(--brand-orange);
}
.cust-center-tile.is-active {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 1px var(--brand-orange);
  background: rgba(244, 144, 64, 0.1);
}
.cust-center-tile.is-na,
.cust-center-tile:disabled {
  opacity: 0.65;
  cursor: default;
}
/* PON Status: same size as clickable tiles, display-only (no expand) */
.cust-center-tile-static {
  cursor: default;
  pointer-events: none;
}
.cust-center-tile-static:hover {
  border-color: var(--border);
  box-shadow: none;
  background: var(--surface-1);
}
.cust-center-tile-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.cust-center-hint {
  font-size: 0.72rem;
}
.cust-center-detail {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.cust-center-charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
@media (max-width: 720px) {
  .cust-center-charts {
    grid-template-columns: 1fr;
  }
}

.cust-uptime-bar {
  display: flex;
  width: 100%;
  height: 1.1rem;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-0);
  border: 1px solid var(--border);
  cursor: crosshair;
}
.cust-uptime-seg {
  display: block;
  height: 100%;
  min-width: 2px;
  box-sizing: border-box;
}
.cust-uptime-seg.is-online {
  background: #34d399;
}
.cust-uptime-seg.is-offline {
  background: #f87171;
}
.cust-uptime-seg.is-hover {
  outline: 1px solid #fff;
  outline-offset: -1px;
  z-index: 1;
  position: relative;
}
.cust-uptime-tip {
  min-height: 1.25rem;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
}

.cust-qh-block {
  margin-bottom: 0.85rem;
}
.cust-qh-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.cust-qh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.55rem;
}
.cust-qh-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  background: var(--surface-1);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s, background 0.12s;
}
.cust-qh-tile:hover {
  border-color: var(--brand-orange);
}
.cust-qh-tile.is-active {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 1px var(--brand-orange);
  background: rgba(244, 144, 64, 0.1);
}
.cust-qh-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.cust-qh-value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text-primary);
}
.cust-qh-spark {
  margin-top: 0.15rem;
  opacity: 0.95;
}

.cust-primary-detail {
  margin-bottom: 1rem;
}
.cust-detail-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.cust-overall-status {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.cust-channel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.cust-port-snr {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}
.cust-port-snr-chip {
  background: var(--surface-2, #1e1e1e);
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  min-width: 2.8rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.cust-port-snr-chip .chip-label {
  color: var(--text-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.cust-port-snr-chip .chip-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cust-port-snr-chip.g-green .chip-val { color: #66bb6a; }
.cust-port-snr-chip.g-yellow .chip-val { color: #c9a227; }
.cust-port-snr-chip.g-red .chip-val { color: #e57373; }
@media (max-width: 900px) {
  .cust-channel-grid {
    grid-template-columns: 1fr;
  }
}
.cust-ch-table tr.is-primary-ch {
  background: rgba(244, 144, 64, 0.08);
}
.cust-suggest {
  margin-top: 0.85rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--brand-orange);
  background: var(--surface-0);
  border-radius: 0 var(--radius-sm, 4px) var(--radius-sm, 4px) 0;
  font-size: 0.88rem;
}
.cust-suggest p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
}
.cust-issue-list {
  margin: 0.5rem 0 0 1.1rem;
  color: var(--text-primary);
  font-size: 0.9rem;
}
.cust-chart-wrap {
  position: relative;
  background: var(--surface-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  padding: 0.45rem 0.55rem 0.4rem;
  margin: 0.35rem 0 0.65rem;
}
.cust-chart-body {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 0.4rem;
  row-gap: 0.1rem;
  align-items: stretch;
}
.cust-chart-ymax,
.cust-chart-ymin {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  align-self: start;
  min-width: 2.4rem;
  text-align: right;
}
.cust-chart-ymin {
  align-self: end;
  grid-row: 2;
}
.cust-chart-ymax {
  grid-row: 1;
}
.cust-chart-plot {
  position: relative;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 140px;
  cursor: crosshair;
}
.cust-chart {
  width: 100%;
  height: 150px;
  display: block;
}
.cust-chart-xlabels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  padding-left: 2.8rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.cust-chart-x-current {
  color: var(--brand-orange);
}
.cust-chart-hover-tip {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  padding: 0.25rem 0.45rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-primary);
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
.cust-chart-hover-tip[hidden] {
  display: none !important;
}
.cust-chart-dot {
  pointer-events: none;
}

/* ---- Customer tab Mode A (centered search) & Mode B layout ---- */
.customer-search-mode {
  min-height: 55vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 1.5rem;
}

.customer-search-center {
  width: 100%;
  max-width: 720px;
}

.customer-search-title {
  text-align: center;
}

.customer-search-sub {
  text-align: center;
}

.customer-search-card {
  padding: 1.35rem 1.5rem;
}

.customer-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.customer-field-grid .form-field {
  margin: 0;
}

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

@media (max-width: 640px) {
  .customer-field-grid {
    grid-template-columns: 1fr;
  }
  .customer-field-wide {
    grid-column: auto;
  }
}

.customer-search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1rem;
  gap: 0.75rem;
}

/* Inline coaching / field correction on Customer search */
.customer-search-coach {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  line-height: 1.4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.customer-search-coach.hidden {
  display: none !important;
}

.customer-search-coach.is-info {
  background: color-mix(in srgb, var(--brand-orange, #e87722) 10%, var(--surface-1));
  border-color: color-mix(in srgb, var(--brand-orange, #e87722) 45%, var(--border));
  color: var(--text-primary);
}

.customer-search-coach.is-warn {
  background: color-mix(in srgb, #eab308 12%, var(--surface-1));
  border-color: color-mix(in srgb, #eab308 50%, var(--border));
  color: var(--text-primary);
}

.customer-search-coach.is-error {
  background: color-mix(in srgb, #ef4444 10%, var(--surface-1));
  border-color: color-mix(in srgb, #ef4444 45%, var(--border));
  color: var(--text-primary);
}

.customer-search-coach .coach-text {
  flex: 1 1 12rem;
  min-width: 0;
}

.customer-search-coach .coach-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.customer-search-coach .coach-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.customer-search-coach .coach-btn:hover {
  border-color: var(--brand-orange, #e87722);
}

.customer-search-coach .coach-btn-primary {
  border-color: var(--brand-orange, #e87722);
  background: color-mix(in srgb, var(--brand-orange, #e87722) 18%, var(--surface-1));
}

.customer-field-msg {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--text-secondary);
}

.customer-field-msg.hidden {
  display: none !important;
}

.customer-field-msg.is-warn {
  color: #b45309;
}

.customer-field-msg.is-info {
  color: var(--text-secondary);
}

.customer-field-msg.is-error {
  color: #b91c1c;
}

.customer-search-form-table input.is-field-warn {
  border-color: #eab308 !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, #eab308 25%, transparent);
}

.customer-search-form-table input.is-field-error {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, #ef4444 20%, transparent);
}

.customer-search-form-table input.is-field-ok {
  border-color: color-mix(in srgb, #22c55e 70%, var(--border)) !important;
}

.customer-results-note {
  padding: 0.45rem 0.9rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--brand-orange, #e87722) 8%, var(--surface-2));
  color: var(--text-secondary);
}

.customer-search-empty {
  padding: 1rem 1.1rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.customer-search-empty strong {
  color: var(--text-primary);
}

.customer-search-empty ul {
  margin: 0.5rem 0 0 1.1rem;
  padding: 0;
}

.customer-search-empty li {
  margin: 0.2rem 0;
}

.customer-live-results {
  margin-top: 1rem;
  padding: 0;
  overflow: hidden;
}

.customer-results-head {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---- Shared Event detail: Notes + Event Log ---- */
.event-notes-heading,
.event-log-heading {
  font-size: 0.95rem;
  margin: 1rem 0 0.5rem 0;
}

.event-notes-card,
.event-log-card {
  padding: 1rem;
  margin-bottom: 1rem;
}

.event-note-item {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.event-note-compose {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.event-note-as {
  font-size: 0.8rem;
  white-space: nowrap;
}

.event-note-input {
  flex: 1;
  min-width: 12rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
  font-size: 0.85rem;
}

.event-log-scroll {
  max-height: 14rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.event-log-table {
  margin: 0;
  font-size: 0.8125rem;
}

.event-log-table th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}

.event-log-when {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.event-log-detail {
  max-width: 28rem;
  word-break: break-word;
}

.event-log-empty,
.event-notes-empty {
  margin: 0;
  font-size: 0.85rem;
}

.event-log-foot {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
}

/* Event detail map overlays (Outage + PM) — match top-left count legend:
   dark translucent panel so white text is readable on map tiles. */
.event-map-overlay,
.pm-map-overlay,
.event-map-legend-bar {
  position: absolute;
  z-index: 500;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  font-size: 0.75rem;
  line-height: 1.3;
}

.event-map-overlay,
.pm-map-overlay {
  top: 0.4rem;
  right: 0.4rem;
  max-width: 11.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.35rem 0.5rem;
}

.event-map-legend-bar {
  top: 0.4rem;
  left: 0.4rem;
  max-width: calc(100% - 10rem);
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 0.25rem 0.5rem;
}

.event-map-overlay label,
.pm-map-overlay label {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0;
}

.event-map-overlay select,
.pm-map-overlay select {
  font-size: 0.72rem;
  padding: 0.22rem 0.35rem;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  max-width: 100%;
  font-family: inherit;
}

.event-map-overlay select option,
.pm-map-overlay select option {
  background: #1a1d24;
  color: #fff;
}

.event-map-overlay .pm-map-legend,
.event-map-overlay .event-map-legend,
.pm-map-overlay .pm-map-legend,
.pm-map-overlay .event-map-legend {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.9);
}

.event-map-overlay .pm-map-legend span::before,
.event-map-overlay .event-map-legend span::before,
.pm-map-overlay .pm-map-legend span::before,
.pm-map-overlay .event-map-legend span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 3px;
  vertical-align: middle;
}

.event-map-overlay .lg-green::before,
.pm-map-overlay .lg-green::before {
  background: #4caf50;
}
.event-map-overlay .lg-yellow::before,
.pm-map-overlay .lg-yellow::before {
  background: #ffc107;
}
.event-map-overlay .lg-red::before,
.pm-map-overlay .lg-red::before {
  background: #ef5350;
}
.event-map-overlay .lg-grey::before,
.pm-map-overlay .lg-grey::before {
  background: #9e9e9e;
}

.event-map-overlay .event-map-counts,
.pm-map-overlay .event-map-counts,
.event-map-overlay #outage-map-counts,
.event-map-overlay #pm-map-counts,
.pm-map-overlay #pm-map-counts,
.pm-map-overlay #outage-map-counts {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.88);
  margin-top: 0.1rem;
}

/* Unified map popup (event detail maps + shared shell)
   Network Map also has map.html overrides for flush right scroll. */
.map-popup-wrap .leaflet-popup-content-wrapper {
  background: var(--surface-1, #1e1e1e);
  color: #f3f3f3;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.map-popup-wrap .leaflet-popup-tip {
  background: var(--surface-1, #1e1e1e);
}
.map-popup-wrap .leaflet-popup-content {
  margin: 7px 0 7px 8px;
  padding: 0;
  min-width: 188px;
  color: #f3f3f3;
}
.map-popup-wrap .leaflet-popup-close-button {
  top: 2px !important;
  right: 2px !important;
  z-index: 2;
  color: #aaa !important;
}
.map-popup {
  min-width: 200px;
  max-width: 248px;
  color: #f3f3f3;
  font-size: 0.62rem;
  line-height: 1.3;
  padding-right: 0;
}
.map-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.3rem;
  margin-bottom: 0.25rem;
  padding-right: 1.15rem; /* clear close X */
}
.map-popup-addr,
.map-popup-device,
.map-popup-note {
  padding-right: 0.45rem;
}
/* Beat Leaflet `.leaflet-container a { color: #0078A8 }` (0,1,1).
   Match .portal-nav a.active: orange wash + bright orange text. */
.leaflet-container a.map-acct-detail-btn,
.map-popup-wrap a.map-acct-detail-btn {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
  padding: 0.30rem 0.55rem;
  margin-right: 0.35rem;
  border: none;
  border-radius: var(--radius-sm, 4px);
  color: var(--brand-orange, #f49040);
  background: rgba(244, 144, 64, 0.12);
  text-decoration: none;
  font-size: 0.61rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  min-width: 2.12rem;
}
.leaflet-container a.map-acct-detail-btn:hover,
.map-popup-wrap a.map-acct-detail-btn:hover {
  background: rgba(244, 144, 64, 0.22);
  color: var(--brand-orange, #f49040);
  text-decoration: none;
}
.leaflet-tooltip.map-addr-tooltip {
  background: rgba(20, 22, 28, 0.94);
  color: #f3f3f3;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-size: 0.72rem;
  line-height: 1.25;
  padding: 0.22rem 0.45rem;
  max-width: 260px;
}
.leaflet-tooltip-top.map-addr-tooltip:before {
  border-top-color: rgba(20, 22, 28, 0.94);
}
.map-popup-metrics {
  margin-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 0.28rem 2px 0 0;
  max-height: 7.25rem;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-gutter: auto;
  margin-right: 0;
}
.map-popup-metrics::-webkit-scrollbar {
  width: 5px;
}
.map-popup-metrics::-webkit-scrollbar-track {
  background: transparent;
}
.map-popup-metrics::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.32);
  border-radius: 3px;
}
.map-popup-metrics-scroll {
  max-height: none;
  overflow: visible;
}
.map-popup .map-metric-rows {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.map-popup .map-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 0.2rem 0.32rem;
  min-height: 1.75rem;
}
.map-popup .map-metric-left {
  display: flex;
  align-items: baseline;
  gap: 0.28rem;
  min-width: 4.2rem;
  flex-shrink: 0;
}
.map-popup .map-metric-label {
  font-size: 0.5rem;
  color: var(--text-muted, #9a9a9a);
  white-space: nowrap;
}
.map-popup .map-metric-val {
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.map-popup .map-metric-spark-wrap {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
/* Per-row now | past — full width of spark column */
.map-popup .map-metric-spark-axis {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: baseline;
  width: 100%;
  box-sizing: border-box;
  font-size: 0.42rem;
  line-height: 1;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 1px;
  gap: 0;
}
.map-popup .map-metric-spark-axis .now {
  color: #fff;
  font-weight: 700;
  margin-right: auto;
  flex: 0 0 auto;
}
.map-popup .map-metric-spark-axis .past {
  color: #888;
  margin-left: auto;
  flex: 0 0 auto;
  text-align: right;
}
.map-popup .map-metric-spark {
  display: block;
  height: 28px;
  width: 100%;
}
.map-popup .map-metric-spark-legend {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  font-size: 0.5rem;
  color: #9a9a9a;
  margin-bottom: 0.1rem;
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(20, 22, 28, 0.95);
}
.map-popup .map-metric-spark-legend .leg-now {
  color: #fff;
  font-weight: 700;
}
.map-popup .map-metric-spark-legend .leg-past {
  color: #9a9a9a;
}
.map-popup .map-metric-spark-legend .leg-hint {
  margin-left: auto;
  color: #777;
  font-style: italic;
}
.map-popup .map-metric-spark-empty {
  font-size: 0.55rem;
  color: #777;
}

.event-street-filter {
  margin-left: auto;
  min-width: 160px;
  max-width: 220px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  color: var(--text-primary);
}

/* Google Maps navigation start point on event detail */
.event-nav-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.event-nav-btn {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  color: #fff;
  background: var(--brand-orange, #e87722);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in srgb, var(--brand-orange, #e87722) 70%, #000);
  white-space: nowrap;
}

.event-nav-btn:hover {
  filter: brightness(1.06);
  color: #fff;
  text-decoration: none;
}

.event-nav-meta {
  font-size: 0.85rem;
  min-width: 0;
  flex: 1 1 12rem;
}

.customer-detail-mode.hidden,
.customer-search-mode.hidden {
  display: none !important;
}

.customer-detail-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
}

.customer-back-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.customer-back-btn:hover {
  border-color: var(--brand-orange);
}

.customer-topbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
}

.cust-top-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0.25rem;
  align-items: start;
}

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

.cust-tile {
  min-height: 12rem;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* contain long MAC/serial/CPE tables inside the card */
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

/* ABS billing packages under Customer (center) tile */
.cust-packages {
  margin-top: 0.75rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  min-width: 0;
  max-width: 100%;
}
.cust-packages .cust-subhead {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #94a3b8);
}
.cust-package-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.cust-package-list li {
  font-size: 0.88rem;
  line-height: 1.35;
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-sm, 4px);
  background: var(--surface-1, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cust-device-tabs-in-tile {
  margin-bottom: 0.85rem;
}

.cust-tile-device-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  max-width: 100%;
}

.cust-outage-badge {
  text-align: right;
  flex: 0 1 auto;
  max-width: min(18rem, 100%);
  min-width: 0;
}

.cust-outage-badge-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: #ef5350;
  line-height: 1.25;
  text-transform: uppercase;
}

.cust-outage-badge-id {
  font-size: 0.72rem;
  margin: 0.2rem 0 0.35rem;
  word-break: break-all;
}

.cust-outage-badge-id code {
  font-size: 0.7rem;
}

.cust-grade-offline {
  color: var(--text-muted, #94a3b8);
  font-weight: 700;
}

.cust-outage-view-btn {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
  text-decoration: none;
}

.cust-outage-view-btn:hover {
  border-color: #ef5350;
  color: #ef5350;
}

.cust-device-identity {
  margin-bottom: 0.5rem;
  max-width: 100%;
  min-width: 0;
}

.cust-device-id {
  margin: 0.35rem 0 0.15rem;
  font-size: 1.05rem;
  max-width: 100%;
}

.cust-device-id code,
.cust-tile code {
  word-break: break-all;
  overflow-wrap: anywhere;
}

/* Generic data tables in tiles still scroll; CPE table uses .cust-cpe-table-scroll */
.cust-tile .data-table:not(.cust-cpe-table) {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cust-tile .cust-dl > div {
  grid-template-columns: minmax(4.5rem, 6.5rem) minmax(0, 1fr);
}

.cust-tile-customer .customer-hero-name,
.cust-tile-customer .customer-hero-addr,
.cust-tile-customer .customer-hero-meta {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cust-tile-history .cust-uptime-bar,
.cust-tile-history .cust-uptime-meta,
.cust-tile-history .cust-uptime-legend {
  max-width: 100%;
  box-sizing: border-box;
}

/* Tablet / phone: stack device head so actions do not force horizontal bleed */
@media (max-width: 1100px) {
  .cust-tile-device-head {
    flex-direction: column;
    align-items: stretch;
  }
  .cust-device-actions {
    margin-left: 0;
    width: 100%;
  }
  .cust-outage-badge {
    text-align: left;
    max-width: 100%;
  }
  .cust-summary-row .card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Customer search form as labeled table */
.customer-search-form-table {
  width: 100%;
  border-collapse: collapse;
}

.customer-search-form-table th {
  text-align: left;
  width: 7.5rem;
  padding: 0.45rem 0.75rem 0.45rem 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  vertical-align: middle;
  white-space: nowrap;
}

.customer-search-form-table td {
  padding: 0.35rem 0;
}

.customer-search-form-table input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.9rem;
}

.customer-search-form-table input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(244, 144, 64, 0.2);
}

.customer-results-table tbody tr.customer-result-row {
  cursor: pointer;
}

.customer-results-table tbody tr.customer-result-row:hover {
  background: rgba(244, 144, 64, 0.1);
}

.customer-detail-search-wrap {
  position: relative;
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
}

.customer-detail-search-wrap input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.875rem;
}

.customer-detail-search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 40;
  margin-top: 0.25rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  max-height: 280px;
  overflow: auto;
}

.customer-map-btn {
  appearance: none;
  border: 0;
  background: var(--brand-orange);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.45rem 1rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
}

.customer-map-btn:hover {
  filter: brightness(1.06);
}

/* ==========================================================================
   Responsive: tablet (A) + phone field ops (B)
   Desktop-only areas (Device full telemetry, Super Admin density) keep scroll.
   ========================================================================== */

/* Shared helpers — scroll on wrappers, never display:block on <table> */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-sm,
.outage-action,
.portal-logout-btn {
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  touch-action: manipulation;
}
.btn-sm {
  min-height: 2.25rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

/* Event board filter chips — same look for Outage + PM (desktop) */
.outage-filter-btn,
.pm-filter-btn,
.event-filter-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.28rem 0.65rem;
  min-height: 0;
  min-width: 0;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text-primary);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 4px);
  cursor: pointer;
  touch-action: manipulation;
  white-space: nowrap;
}
.outage-filter-btn:hover,
.pm-filter-btn:hover,
.event-filter-btn:hover {
  border-color: var(--brand-orange);
}
.event-filter-btn.active,
.pm-filter-btn.active {
  background: rgba(244, 144, 64, 0.18);
  border-color: var(--brand-orange);
  color: var(--text-primary);
  font-weight: 600;
}

/* Phone/tablet: compact Type/Show selects (Events, Utilization, Status, Reporting) */
.event-filters-selects {
  display: none;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
.event-filter-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
}
.event-filter-field .filter-label {
  flex: 0 0 auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.event-filter-select {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 2rem;
  font-size: 16px;
  line-height: 1.2;
  padding: 0.3rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  background: var(--surface-1);
  color: var(--text-primary);
}
/* Clickable impacted/member rows on event detail */
.event-acct-row {
  cursor: pointer;
}
.event-acct-row:hover {
  background: rgba(244, 144, 64, 0.1);
}
.event-acct-row.is-focused {
  background: rgba(244, 144, 64, 0.16);
}

/* Mobile nav toggle (hidden on desktop) */
.portal-nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: var(--touch-min);
  height: var(--touch-min);
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  cursor: pointer;
  flex-shrink: 0;
}
.portal-nav-toggle-bar {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.portal-nav-toggle.is-open .portal-nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.portal-nav-toggle.is-open .portal-nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.portal-nav-toggle.is-open .portal-nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}
.portal-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  /* Below header chrome, above Leaflet maps (≤1000) and page content */
  z-index: 1900;
}
.portal-nav-backdrop.hidden {
  display: none;
}
body.portal-nav-lock {
  overflow: hidden;
}

/* Safe-area + fluid title (desktop keeps max-width from base .portal-main) */
.portal-main {
  box-sizing: border-box;
  padding-left: max(var(--page-chrome-pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--page-chrome-pad-x), env(safe-area-inset-right, 0px));
}
.page-title {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
  word-break: break-word;
}

/* ---- Tablet & below (~900px) ---- */
@media (max-width: 900px) {
  .portal-main {
    max-width: 100%;
    padding-top: 0.65rem;
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }
  .event-board-table-scroll,
  .event-board-table-scroll.panel-table-scroll {
    max-height: calc(100vh - var(--header-height) - 12.5rem);
  }
  .event-filters-chips:not(.util-subnav) {
    display: none !important;
  }
  .event-filters-selects {
    display: flex;
  }
  /* Alarms | Detail tabs stay visible; phone/tablet only need Plant. */
  .util-filters-selects .event-filter-field:has(#util-filter-view) {
    display: none;
  }
  .reporting-filters .reporting-field {
    flex-direction: row;
    align-items: center;
    flex: 1 1 10rem;
    min-width: 0;
  }
  .reporting-filters .input-sm,
  .reporting-filters .event-filter-select {
    font-size: 16px;
    min-height: 2rem;
    min-width: 0;
    flex: 1 1 auto;
  }
  /* Top bar: Menu (left) — Logo (center) — User/Logout (right) */
  .portal-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 0.5rem;
    height: auto;
    min-height: var(--header-height);
    padding: 0.45rem 0.65rem;
    gap: 0;
  }
  .portal-nav-toggle {
    display: flex;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    margin-left: 0;
    z-index: 1;
  }
  .portal-brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-items: center;
    pointer-events: none; /* keep logo visual-only; nav/user still clickable */
  }
  .portal-brand img {
    height: 32px;
    pointer-events: auto;
  }
  .portal-brand span,
  .portal-brand-text {
    display: none;
  }
  .portal-user-menu,
  .portal-user-link {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    margin-left: 0;
    padding-left: 0;
    gap: 0.35rem;
    z-index: 1;
  }
  .portal-user-name {
    max-width: 5.5rem;
    font-size: 0.75rem;
  }
  /* Drawer still overlays from the left; not part of the 3-column bar.
     Parent .portal-header is z-index 2000 (above Leaflet); keep drawer on top
     of header siblings within that stacking context. */
  html,
  body.portal-has-rail {
    --rail-width: 0px;
  }
  body:has(#portal-header-root)::before {
    content: none;
  }
  body:has(#portal-header-root) .portal-main,
  body.portal-has-rail .portal-main {
    margin-left: 0;
  }
  .portal-rail {
    display: none;
    top: 0;
    padding-top: calc(var(--header-height) + 0.75rem);
    width: min(18rem, 86vw);
    z-index: 2100;
    box-shadow: var(--shadow);
  }
  body.portal-nav-lock #portal-rail,
  .portal-header.nav-open ~ #portal-rail,
  .portal-chrome:has(.portal-header.nav-open) ~ #portal-rail {
    display: flex;
  }
  body.portal-has-rail.rail-collapsed .portal-rail-label {
    position: static;
    width: auto;
    height: auto;
    clip: auto;
    overflow: visible;
  }
  body.portal-has-rail.rail-collapsed .portal-rail-children:not([hidden]) {
    position: static;
    min-width: 0;
    border: 0;
    box-shadow: none;
    padding: 0.15rem 0 0.35rem 2.5rem;
  }
  .portal-rail-collapse {
    display: none;
  }
  body.portal-has-rail .superadmin-subnav {
    display: none !important;
  }
  .portal-nav {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(18rem, 86vw);
    z-index: 2100;
    flex-direction: column;
    gap: 0.15rem;
    padding: calc(var(--header-height) + 0.75rem) 0.75rem 1.5rem;
    background: var(--brand-black);
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    grid-column: unset;
    grid-row: unset;
  }
  .portal-header.nav-open .portal-nav {
    display: flex;
  }
  .portal-header.nav-open .portal-nav-toggle,
  .portal-header.nav-open .portal-user-menu {
    z-index: 2110;
  }
  .portal-nav a {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border-radius: var(--radius-md);
    min-height: var(--touch-min);
  }

  .superadmin-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    scrollbar-width: thin;
  }
  .superadmin-subnav a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 0.55rem 0.85rem;
    min-height: var(--touch-min);
  }

  /* Grids collapse */
  .card-grid,
  .poller-card-grid,
  .telemetry-stats.card-grid,
  .oncall-now {
    grid-template-columns: 1fr 1fr !important;
  }
  .status-split {
    grid-template-columns: 1fr;
  }
  .public-map-body {
    grid-template-columns: 1fr;
  }
  .users-layout,
  .oncall-layout {
    grid-template-columns: 1fr !important;
  }

  /* Tables: horizontal scroll on wrappers only (never display:block on <table>) */
  .panel-table-scroll,
  .users-table-wrap,
  .inventory-table-scroll,
  .event-board-table-scroll,
  .table-scroll,
  .card.panel-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  table.data-table:not(.data-table-wide) {
    min-width: 40rem;
  }
  table.data-table-wide,
  .data-table-wide {
    width: max-content;
    min-width: max(100%, 48rem);
  }
  /* Still fill wide tablets; min-width keeps columns readable when card is narrow */
  #outage-table,
  #pm-table {
    width: 100%;
    min-width: 56rem;
  }
  #pm-table th,
  #pm-table td {
    padding: 0.4rem 0.5rem;
    font-size: 0.9rem;
  }
  /* Keep same % column plan as desktop on tablet */
  #pm-table .pm-id-cell,
  #pm-table th:nth-child(1),
  #pm-table td:nth-child(1) { width: 12%; }
  #pm-table th:nth-child(2),
  #pm-table td:nth-child(2),
  #pm-table .pm-start-cell { width: 12%; }
  #pm-table th:nth-child(3),
  #pm-table td:nth-child(3) { width: 5%; }
  #pm-table th:nth-child(4),
  #pm-table td:nth-child(4) { width: 15%; }
  #pm-table th:nth-child(5),
  #pm-table td:nth-child(5) { width: 6%; }
  #pm-table th:nth-child(6),
  #pm-table td:nth-child(6),
  #pm-table .pm-score-cell { width: 5%; }
  #pm-table th:nth-child(7),
  #pm-table td:nth-child(7) { width: 8%; }
  #pm-table .pm-summary-cell,
  #pm-table th:nth-child(8),
  #pm-table td:nth-child(8) { width: 37%; }

  #outage-table .ev-id,
  #outage-table th:nth-child(1),
  #outage-table td:nth-child(1) { width: 10%; }
  #outage-table .ev-start,
  #outage-table th:nth-child(2),
  #outage-table td:nth-child(2) { width: 11%; }
  #outage-table .ev-end,
  #outage-table th:nth-child(3),
  #outage-table td:nth-child(3) { width: 11%; }
  #outage-table .ev-type,
  #outage-table th:nth-child(4),
  #outage-table td:nth-child(4) {
    width: 16%;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }
  #outage-table th:nth-child(5),
  #outage-table td:nth-child(5) { width: 8%; }
  #outage-table .ev-score,
  #outage-table th:nth-child(6),
  #outage-table td:nth-child(6) { width: 7%; }
  #outage-table th:nth-child(7),
  #outage-table td:nth-child(7) { width: 8%; }
  #outage-table .ev-summary,
  #outage-table th:nth-child(8),
  #outage-table td:nth-child(8) { width: 29%; }

  /* Customer detail topbar */
  .customer-detail-topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .customer-detail-search-wrap {
    flex: 1 1 100%;
    order: 3;
  }
  .customer-workspace {
    grid-template-columns: 1fr !important;
  }

  /* Forms full width */
  .form-field input,
  .form-field select,
  .form-field textarea,
  .login-card input {
    font-size: 16px; /* avoid iOS zoom */
    min-height: var(--touch-min);
  }
}

/* ---- Phone (~640px) — field ops subset ---- */
@media (max-width: 640px) {
  .portal-main {
    padding: 0.55rem 0.65rem 1.5rem;
  }
  .page-subtitle,
  .section-subtitle {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
  }
  .event-board-table-scroll,
  .event-board-table-scroll.panel-table-scroll {
    max-height: calc(100vh - var(--header-height) - 13.5rem);
  }
  .card-grid,
  .poller-card-grid,
  .telemetry-stats.card-grid,
  .oncall-now,
  .cust-metric-grid:not(.nh-detail-tiles) {
    grid-template-columns: 1fr !important;
  }
  .status-split {
    grid-template-columns: 1fr !important;
  }
  .public-map-body {
    grid-template-columns: 1fr !important;
  }
  /* Network monitor device detail: keep compact 2-col metric tiles */
  .nh-detail-tiles.cust-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .customer-field-grid {
    grid-template-columns: 1fr !important;
  }
  .customer-search-form-table,
  .customer-search-form-table tr,
  .customer-search-form-table td {
    display: block;
    width: 100%;
  }
  .customer-search-form-table td {
    padding: 0.35rem 0;
  }
  .customer-search-card {
    padding: 0.85rem;
  }
  .customer-detail-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .customer-back-btn,
  .customer-map-btn {
    width: 100%;
    min-height: var(--touch-min);
  }
  .customer-topbar-meta {
    font-size: 0.8rem;
  }

  /* Filters: chips on desktop; phone uses compact selects (page CSS) */
  /* Spacing/stack for outage header is owned by outage_events.html page CSS */
  .outage-filters.event-board-filters,
  .pm-filters.event-board-filters {
    height: auto !important;
    min-height: 0 !important;
  }

  /* Action toolbars stack */
  .card[style*="display:flex"] {
    flex-wrap: wrap;
  }

  /* On-call form full width */
  .oncall-form .form-row,
  .users-form .form-row {
    margin-bottom: 0.65rem;
  }
  .login-card {
    width: min(400px, 94vw) !important;
    padding: 1.25rem 1rem !important;
  }

  /* Hide brand wordmark already done; tighten footer */
  .portal-footer {
    font-size: 0.7rem;
    padding: 1rem 0.75rem;
  }

  /* Desktop-dense admin: still scrollable, slightly denser hint */
  .section-title {
    font-size: 1.05rem;
  }
}

/* Map field mode */
@media (max-width: 900px) {
  .map-layout {
    flex-direction: column !important;
    height: auto !important;
    min-height: calc(100vh - 8rem);
  }
  .map-sidebar-wrapper {
    width: 100% !important;
    max-height: 40vh;
  }
  .map-sidebar {
    width: 100% !important;
    max-height: 40vh;
    border-radius: 8px 8px 0 0 !important;
    border-right: 1px solid var(--border) !important;
  }
  .map-sidebar-wrapper.collapsed .map-sidebar {
    max-height: 0;
  }
  .map-main,
  #map-canvas,
  #map {
    min-height: 55vh !important;
    height: 55vh !important;
    border-radius: 0 0 8px 8px !important;
  }
  .map-health-wrapper {
    flex-direction: column;
  }
  .map-health-sidebar {
    width: 100% !important;
    max-height: 30vh;
  }
}

/* Prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
  .portal-nav-toggle-bar,
  .map-sidebar {
    transition: none;
  }
}

/* ── Network → Monitor / Utilization ─────────────────────────── */
/* Title left · Updated time right (same row). */
.network-page-head {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: baseline;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.85rem;
  box-sizing: border-box;
}
.network-page-head .page-title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.network-page-head .network-updated {
  flex: 0 0 auto;
  margin: 0;
  margin-left: auto;
  font-size: 0.82rem;
  text-align: right;
  white-space: nowrap;
}
.network-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin: 0 0 1.25rem;
}
.network-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
}
.network-health-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.network-health-card {
  text-align: left;
  background: var(--surface-1);
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  font: inherit;
}
.network-health-card:hover {
  border-color: var(--brand-orange, #f49040);
  box-shadow: 0 0 0 1px rgba(244, 144, 64, 0.25);
}
.network-health-card.is-selected {
  border-color: var(--brand-orange, #f49040);
  box-shadow: 0 0 0 2px rgba(244, 144, 64, 0.35);
}
.network-health-card.status-ok {
  border-left: 4px solid var(--success);
}
.network-health-card.status-degraded {
  border-left: 4px solid var(--warning);
}
.network-health-card.status-critical {
  border-left: 4px solid var(--danger);
}
.network-health-card.status-unknown {
  border-left: 4px solid var(--text-muted);
}
.nhc-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  align-items: baseline;
}
.nhc-id {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-all;
}
.nhc-badge {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}
.nhc-status {
  margin: 0.35rem 0 0.55rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
}
.nhc-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  font-size: 0.8rem;
}
.nhc-metrics span {
  display: block;
  color: var(--text-muted, #94a3b8);
  font-size: 0.7rem;
}
.nhc-metrics strong {
  font-size: 1rem;
}
.nhc-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}
.nhc-await {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--brand-orange, #f49040);
}
.network-detail-panel {
  margin-top: 1.5rem;
  background: var(--surface-1);
  border: 1px solid var(--border, #334155);
  border-radius: 10px;
  padding: 1rem 1.15rem 1.25rem;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* contain children; tables scroll inside .nh-table-scroll */
}
.network-detail-panel .panel-header {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.35rem;
}
.network-detail-panel #detail-title {
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  line-height: 1.25;
  word-break: break-word;
}
.network-detail-panel #detail-close {
  flex: 0 0 auto;
}
.network-detail-panel #detail-status {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
}
.network-detail-panel .panel-body {
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}
/* Horizontal scroll wrappers for wide detail/alarm tables */
.nh-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin: 0 0 0.85rem;
}
.nh-detail-table,
.nh-alarm-table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}
.nh-detail-table th,
.nh-detail-table td,
.nh-alarm-table th,
.nh-alarm-table td {
  white-space: nowrap;
  vertical-align: top;
}
.nh-alarm-table td:nth-child(3) {
  /* Alarm name may be long — allow wrap within a cap */
  white-space: normal;
  max-width: 16rem;
}
.nh-detail-tiles.cust-metric-grid {
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.nh-detail-tiles .cust-metric-tile {
  min-width: 0;
  padding: 0.55rem 0.65rem;
}
.nh-detail-tiles .cust-metric-value {
  font-size: 1.05rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.nh-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
/* Large chart in the detail panel (legacy class kept for safety). */
.nh-spark-lg {
  color: var(--brand-orange, #f49040);
  background: rgba(15, 23, 42, 0.5);
  border-radius: 6px;
  display: block;
  width: 100%;
}
/* ── Utilization device-first (PON) ─────────────────────────────────── */
.util-section-title {
  margin: 1.25rem 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--text-muted, #94a3b8);
  text-transform: uppercase;
}
.util-section-title:first-child {
  margin-top: 0.25rem;
}
.util-device-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.util-device-card {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  background: var(--surface-1, rgba(15, 23, 42, 0.55));
  overflow: hidden;
}
.util-device-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  font: inherit;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
}
.util-device-header:hover {
  background: rgba(244, 144, 64, 0.08);
}
.util-device-card.is-open .util-device-header {
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.util-chevron {
  color: var(--text-muted, #94a3b8);
  font-size: 0.7rem;
  width: 1rem;
}
.util-device-title {
  font-weight: 700;
  font-size: 1rem;
}
.util-device-meta {
  font-size: 0.8rem;
}
.util-device-body {
  padding: 0 0.35rem 0.5rem;
  max-height: min(28rem, 70vh);
  overflow: auto;
}
.util-metric-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #243044;
}
.util-metric-table {
  margin: 0;
  font-size: 0.8rem;
  table-layout: fixed;
  width: 100%;
}
.util-metric-table th {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}
/* Compact numeric cols; spark takes remaining width */
.util-metric-table .util-col-scope,
.util-metric-table td.util-label {
  width: 16%;
}
.util-metric-table .util-col-mbps { width: 12%; }
.util-metric-table .util-col-pct { width: 7%; }
.util-metric-table .util-col-p98 { width: 7%; }
/* Spark absorbs remaining row width so Polled sits flush (sum 100%) */
.util-metric-table .util-col-spark { width: 44%; }
.util-metric-table .util-col-age { width: 7%; }

/* DOCSIS: extra Cap + Mod columns. PON widths above stay 7-col / 100%. */
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-scope,
.util-device-card[data-util-kind="docsis"] .util-metric-table td.util-label {
  width: 14%;
}
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-mbps { width: 9%; }
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-cap { width: 8%; }
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-mod { width: 14%; }
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-pct,
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-p98,
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-age { width: 6%; }
.util-device-card[data-util-kind="docsis"] .util-metric-table .util-col-spark,
.util-device-card[data-util-kind="docsis"] .util-spark { width: 31%; }
.util-mod {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  font-size: 0.78rem;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}
.util-mod-na {
  color: var(--text-muted, #64748b);
  font-weight: 400;
}
.util-role-docsis_us_ch .util-label {
  padding-left: 1.25rem;
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
}
.util-summary-row .util-label {
  font-weight: 600;
}
.util-role-port_total .util-label {
  color: #f49040;
}
.util-port-row .util-label {
  padding-left: 1.25rem;
  font-weight: 500;
}
.util-expand-sep td {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #94a3b8);
  padding-top: 0.65rem !important;
  border-bottom: 0 !important;
}
.util-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 0.78rem;
  padding-left: 0.35rem !important;
  padding-right: 0.35rem !important;
}
.util-updown {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.util-dir-sep {
  color: var(--text-muted, #94a3b8);
  font-weight: 400;
}
.util-up {
  color: inherit;
}
.util-down {
  color: inherit;
}
.util-muted {
  color: var(--text-muted, #94a3b8);
}
.util-spark {
  min-width: 200px;
  width: 44%;
  vertical-align: middle;
  color: var(--text-muted);
  padding: 0.2rem 0.35rem !important;
}
.util-spark-wrap {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.35rem;
  min-width: 200px;
  width: 100%;
  max-width: none; /* fill full spark column — no dead gap before Polled */
  color: var(--text-muted);
}
.util-spark-wrap.util-spark-empty {
  align-items: center;
  min-height: 3rem;
  font-size: 0.72rem;
}
.util-spark-y {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  min-width: 2.4rem;
  padding: 0 0 1.05rem;
  font-size: 0.58rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted, #94a3b8);
}
.util-spark-ymax {
  color: var(--text-muted, #94a3b8);
}
.util-spark-ymin {
  color: var(--text-muted, #64748b);
}
.util-spark-hit {
  fill: transparent;
  stroke: none;
  cursor: crosshair;
}
.util-spark-hit.is-hot {
  fill: var(--brand-orange, #f49040);
  fill-opacity: 0.85;
}
.util-spark-tip {
  position: fixed;
  z-index: 3000;
  display: none;
  pointer-events: none;
  max-width: 16rem;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  background: #1a2230;
  border: 1px solid var(--brand-orange, #f49040);
  color: var(--text-primary, #e8eef7);
  font-size: 0.75rem;
  line-height: 1.35;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.util-spark-tip.is-on {
  display: block;
}
.util-spark-tip-when {
  display: block;
  font-weight: 600;
}
.util-spark-tip-pct {
  display: block;
  color: var(--brand-orange, #f49040);
  font-variant-numeric: tabular-nums;
}
.util-spark-plot {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
}
.util-spark-svg {
  display: block;
  width: 100%;
  min-width: 100%;
  height: 44px;
  color: var(--brand-orange, #f59e0b);
}
.util-spark-x {
  display: flex;
  justify-content: space-between;
  font-size: 0.55rem;
  line-height: 1;
  margin-top: 0.14rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: var(--text-muted, #64748b);
}
.util-spark-x-left {
  color: var(--text-muted, #94a3b8);
}
.util-spark-x-right {
  color: var(--text-muted, #64748b);
}
.util-age {
  font-size: 0.72rem;
  color: var(--text-muted, #94a3b8);
  white-space: nowrap;
}
.util-hot {
  color: #f87171;
  font-weight: 600;
}
.util-warm {
  color: #fbbf24;
  font-weight: 600;
}

/* CPU / Memory history: dual Y-axis, grid, time on X (left = current) */
.nh-hist-chart {
  width: 100%;
  margin: 0 0 0.35rem;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.35rem 0.25rem 0.15rem;
  box-sizing: border-box;
}
.nh-hist-svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 148px;
  max-height: 200px;
  color: var(--brand-orange, #f49040);
}
.nh-hist-grid {
  stroke: rgba(148, 163, 184, 0.18);
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.nh-hist-baseline {
  stroke: rgba(148, 163, 184, 0.35);
  stroke-width: 1;
}
.nh-hist-xtick {
  stroke: rgba(148, 163, 184, 0.4);
  stroke-width: 1;
}
.nh-hist-ylabel {
  fill: #94a3b8;
  font-size: 11px;
  font-family: system-ui, -apple-system, sans-serif;
}
.nh-hist-xlabel {
  fill: #94a3b8;
  font-size: 10.5px;
  font-family: system-ui, -apple-system, sans-serif;
}
.nh-hist-line {
  stroke: currentColor;
}
/* Inline sparkline inside a table cell — no chrome. */
.nh-spark {
  display: block;
  color: inherit;
}
.nh-spark-meta {
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
  margin: 0.25rem 0 0.75rem;
}
.network-detail-panel .section-title {
  margin-top: 1rem;
  font-size: 0.95rem;
}
.mono {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8rem;
  word-break: break-all;
}
.error-text {
  color: var(--danger);
}
/* Error/empty messages inside the health CSS grid must span all tracks. */
.network-grid-full {
  grid-column: 1 / -1;
}

/* Network → Utilization */
#util-table tr.util-warm td:nth-child(5) {
  color: var(--warning);
  font-weight: 600;
}
#util-table tr.util-hot td:nth-child(5) {
  color: var(--danger);
  font-weight: 700;
}
.network-toolbar label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-muted, #94a3b8);
}
/* Not scoped to .network-toolbar: the Config Diff selects live in
   .diff-selector-group and were rendering as unstyled native widgets. */
.input-sm {
  min-width: 10rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border, #334155);
  background: var(--surface-1);
  color: inherit;
  font: inherit;
}
.input-sm:focus-visible,
.network-health-card:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* ── Network → Monitor (triage view) ─────────────────────────────── */
.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;
}

/* Needs attention */
.nh-attention {
  margin: 1.25rem 0;
}
.nh-attention-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.nh-attention-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-radius: var(--radius-md);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-muted);
}
.nh-attention-card.is-critical {
  border-left-color: var(--danger);
  background: rgba(248, 113, 113, 0.07);
}
.nh-attention-card.is-warn {
  border-left-color: var(--warning);
  background: rgba(251, 191, 36, 0.06);
}
.nh-attention-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.nh-attention-device {
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-all;
}
.nh-attention-headline {
  font-size: 0.9rem;
}
.nh-attention-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.nh-all-clear {
  margin: 1.25rem 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  border-left: 4px solid var(--success);
  background: rgba(74, 222, 128, 0.06);
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* KPI strip */
.util-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
  max-width: 100%;
}
.util-subnav-link {
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
}
.util-subnav-link.is-active {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}
.nh-kpi-grid {
  margin-bottom: 1.25rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.nh-kpi-active {
  border-color: var(--brand-orange) !important;
  box-shadow: 0 0 0 1px var(--brand-orange);
}
#alarm-table .nh-alarm-row {
  cursor: pointer;
}
#alarm-table .nh-alarm-row:hover {
  background: rgba(244, 144, 64, 0.08);
}

/*
 * Network Monitor fleet table: show sticky thead + 10 device rows without
 * vertical scroll. Generic .panel-table-scroll uses 10 × row-height for the
 * whole box (incl. padding + header), which only fits ~7–8 body rows.
 */
.network-section .panel-body.panel-table-scroll {
  --nh-fleet-row-height: 2.75rem;
  --nh-fleet-visible-rows: 10;
  padding: 0;
  /* thead (1) + body rows */
  max-height: calc(var(--nh-fleet-row-height) * (var(--nh-fleet-visible-rows) + 1));
  overflow: auto;
}
.network-section .panel-body.panel-table-scroll .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.network-section #fleet-table th,
.network-section #fleet-table td {
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
  line-height: 1.3;
  vertical-align: middle;
}

/* Fleet table — whole row expands/collapses detail */
.network-section #fleet-table tbody tr.nh-fleet-row {
  cursor: pointer;
}
.network-section #fleet-table tbody tr.nh-fleet-row:hover td {
  background: rgba(244, 144, 64, 0.06);
}
.network-section #fleet-table tbody tr.nh-fleet-row.is-selected td {
  background: rgba(244, 144, 64, 0.12);
  box-shadow: inset 3px 0 0 var(--brand-orange);
}
.network-section #fleet-table tbody tr.nh-fleet-row.nh-row-critical.is-selected td {
  background: rgba(248, 113, 113, 0.12);
}
.network-section #fleet-table tbody tr.nh-fleet-row.nh-row-warn.is-selected td {
  background: rgba(251, 191, 36, 0.12);
}
.network-section #fleet-table tbody tr.nh-fleet-row:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: -2px;
}
.nh-device-btn {
  font-weight: 600;
  text-align: left;
  word-break: break-all;
  color: var(--brand-orange);
}
.nh-device-sub {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.nh-row-critical td {
  background: rgba(248, 113, 113, 0.06);
}
.nh-row-warn td {
  background: rgba(251, 191, 36, 0.05);
}
.nh-seen {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
}
.nh-zero {
  color: var(--text-muted);
}
.nh-count-new {
  color: var(--warning);
  font-weight: 700;
}
.nh-count-chronic {
  color: var(--text-muted);
  font-weight: 600;
}
.nh-metric-warn {
  color: var(--warning);
  font-weight: 600;
}
.nh-metric-crit {
  color: var(--danger);
  font-weight: 700;
}
.nh-spark-cell {
  color: var(--brand-orange);
  min-width: 96px;
}
.nh-spark-none {
  font-size: 0.72rem;
}

/* Status pills */
.nh-pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid transparent;
}
.nh-pill-ok {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.4);
  background: rgba(74, 222, 128, 0.1);
}
.nh-pill-warn {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.1);
}
.nh-pill-critical {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
}
.nh-pill-stale,
.nh-pill-unknown {
  color: var(--text-muted);
  border-color: var(--border);
  background: var(--surface-2);
}

/* Alarm drill-in */
.nh-detail-tiles {
  margin-bottom: 1.25rem;
}
.nh-alarm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin-bottom: 0.85rem;
}
.nh-alarm-toolbar label {
  display: inline-flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.nh-alarm-band {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.1rem 0 0.4rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding-left: 0.5rem;
  border-left: 3px solid var(--border);
}
.nh-alarm-band.nh-band-new {
  border-left-color: var(--warning);
  color: var(--warning);
}
.nh-alarm-band.nh-band-aging {
  border-left-color: var(--brand-orange);
}
.nh-alarm-table {
  font-size: 0.82rem;
}
.nh-alarm-cat {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.nh-alarm-age {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.nh-alarm-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.2rem 1rem;
  margin: 0;
  padding: 0.35rem 0;
  font-size: 0.78rem;
}
.nh-alarm-dl dt {
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}
.nh-alarm-dl dd {
  margin: 0;
  word-break: break-all;
}

/* Severity chips */
.nh-sev {
  display: inline-block;
  min-width: 4.2rem;
  text-align: center;
  padding: 0.08rem 0.4rem;
  border-radius: var(--radius-sm);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.nh-sev-critical {
  color: #fff;
  background: var(--danger);
}
.nh-sev-major {
  color: var(--danger);
  background: rgba(248, 113, 113, 0.15);
}
.nh-sev-minor {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.13);
}
.nh-sev-warning {
  color: var(--brand-orange);
  background: rgba(244, 144, 64, 0.13);
}
.nh-sev-unknown {
  color: var(--text-muted);
  background: var(--surface-2);
}

/* ── Network → responsive ────────────────────────────────────────
   The Network block is appended after every media query in this file,
   so its own breakpoints must live here at the end. */
@media (max-width: 900px) {
  .network-page-head {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.25rem 0.75rem;
    margin-bottom: 0.65rem;
  }
  .network-page-head .network-updated {
    white-space: normal;
    text-align: left;
    margin-left: 0;
    width: 100%;
  }
  .nh-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0.55rem;
  }
  .nh-kpi-grid .stat-card {
    padding: 0.75rem 0.65rem;
    min-width: 0;
  }
  .nh-kpi-grid .stat-value {
    font-size: 1.35rem;
  }
  .nh-kpi-grid .stat-label {
    font-size: 0.7rem;
  }
  .network-section .panel-table-scroll,
  .network-section .panel-body.panel-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  #fleet-table {
    width: max-content;
    min-width: 48rem;
  }
  #fleet-table th,
  #fleet-table td {
    white-space: nowrap;
  }
  .util-device-header {
    flex-wrap: wrap;
    gap: 0.35rem 0.65rem;
    min-height: var(--touch-min);
  }
  .util-device-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .util-metric-table {
    width: 100%;
    min-width: 0;
  }
  .util-metric-table th,
  .util-metric-table td {
    white-space: nowrap;
  }
  .util-metric-table th:first-child,
  .util-metric-table td.util-label {
    position: sticky;
    left: 0;
    z-index: 1;
    background: #243044;
  }
  .util-spark-wrap {
    min-width: 0;
    max-width: 100%;
  }
  .util-col-spark {
    min-width: 0;
  }
  .network-toolbar,
  .network-toolbar-tight {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }
  .network-toolbar label,
  .network-toolbar-tight label {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    width: 100%;
    font-size: 0.8rem;
  }
  .network-toolbar select,
  .network-toolbar-tight select,
  .network-toolbar input,
  .network-toolbar-tight input,
  .network-toolbar .input-sm,
  .network-toolbar-tight .input-sm {
    width: 100%;
    max-width: 100%;
    min-height: var(--touch-min);
    font-size: 16px; /* avoid iOS zoom */
  }
  .network-toggle {
    min-height: var(--touch-min);
  }
  .diff-view-toggle {
    flex-wrap: wrap;
  }
  .diff-view-toggle .btn {
    flex: 1 1 auto;
  }
  .config-panel .panel-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nhc-metrics {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .nh-detail-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .diff-side-by-side {
    flex-direction: column;
  }
  .diff-selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  .diff-selector-group,
  .network-toolbar label {
    width: 100%;
  }
  .input-sm {
    width: 100%;
    min-width: 0;
  }
  .network-health-card {
    min-height: var(--touch-min);
  }
  .nh-attention-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }
  .nh-alarm-toolbar label {
    width: 100%;
  }
  .nh-alarm-dl {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  .nh-alarm-dl dt {
    margin-top: 0.35rem;
  }
  /* Config / unified diff: allow horizontal swipe for long lines */
  #diff-view-container,
  .diff-unified,
  .diff-side-by-side {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}
@media (max-width: 640px) {
  .network-health-grid {
    grid-template-columns: 1fr;
  }
  .nh-detail-grid {
    grid-template-columns: 1fr;
  }
  .network-toolbar {
    gap: 0.6rem;
  }
  .nhc-foot {
    flex-direction: column;
    gap: 0.2rem;
  }
  .nh-kpi-grid {
    grid-template-columns: 1fr !important;
  }
  .network-page-head .page-title {
    font-size: 1.2rem;
  }
  #fleet-table {
    min-width: 44rem;
  }
  .util-metric-table {
    min-width: 40rem;
  }
  .util-spark-wrap {
    min-width: 180px;
  }
  .util-device-meta {
    font-size: 0.75rem;
  }
  .network-detail-panel {
    padding: 0.7rem 0.55rem 0.95rem;
    margin-top: 0.85rem;
    border-radius: 8px;
  }
  .network-detail-panel #detail-close {
    width: 100%;
    min-height: var(--touch-min);
  }
  .network-detail-panel .section-title {
    font-size: 0.9rem;
    margin-top: 0.85rem;
  }
  .nh-detail-tiles.cust-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.4rem;
  }
  .nh-detail-tiles .cust-metric-label {
    font-size: 0.65rem;
  }
  .nh-detail-tiles .cust-metric-value {
    font-size: 0.9rem;
  }
  .nh-alarm-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .nh-alarm-toolbar label {
    width: 100%;
  }
  .nh-alarm-toolbar .input-sm,
  .nh-alarm-toolbar input,
  .nh-alarm-toolbar select {
    width: 100%;
    min-height: var(--touch-min);
    font-size: 16px;
  }
  .nh-alarm-table {
    min-width: 36rem;
  }
  .nh-detail-table {
    min-width: 28rem;
  }
  .nh-hist-chart {
    padding: 0.25rem 0.1rem 0.1rem;
  }
  .nh-hist-svg {
    min-height: 130px;
  }
  .nh-hist-ylabel {
    font-size: 9px;
  }
  .nh-hist-xlabel {
    font-size: 9px;
  }
  .nh-spark-meta {
    font-size: 0.7rem;
  }
  .btn-link.nh-alarm-more {
    min-height: var(--touch-min);
    padding: 0.35rem 0.5rem;
  }
}

/* Tablet (900) device detail polish */
@media (max-width: 900px) {
  .network-detail-panel {
    padding: 0.85rem 0.75rem 1.1rem;
  }
  .network-detail-panel #detail-title {
    font-size: 1.05rem;
  }
  .nh-detail-tiles.cust-metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .nh-alarm-toolbar {
    gap: 0.55rem 0.75rem;
  }
  .nh-alarm-toolbar label {
    flex: 1 1 10rem;
    min-width: 0;
  }
  .nh-alarm-toolbar .input-sm {
    min-height: 2.4rem;
    font-size: 16px;
  }
  .nh-alarm-table {
    min-width: 40rem;
  }
  .nh-detail-table {
    min-width: 30rem;
  }
  .nh-table-scroll {
    margin-bottom: 0.75rem;
  }
}

/* Executive Dashboard (Home) */
.exec-home .exec-row {
  margin-bottom: 1.15rem;
}
.exec-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.65rem 1rem;
  margin-bottom: 0.45rem;
}
.exec-row-title {
  margin: 0 0 0.45rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--brand-orange);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.exec-row-head .exec-row-title {
  margin-bottom: 0;
}
.exec-row-note {
  margin: -0.2rem 0 0.55rem;
  font-size: 0.8rem;
}
.exec-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 0.75rem;
}
.exec-ops-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 36rem;
}
.exec-events-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none;
  width: 100%;
}
.exec-event-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
  overflow: visible;
}
a.exec-event-hit {
  text-decoration: none;
  color: inherit;
  border-radius: 0.4rem;
  transition: background-color 0.12s ease, box-shadow 0.12s ease;
}
a.exec-event-hit:hover,
a.exec-event-hit:focus-visible {
  text-decoration: none;
  color: inherit;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 0 0 0 1px var(--brand-orange);
  outline: none;
}
.exec-event-closed-metrics {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.exec-event-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
  min-width: 0;
}
.exec-event-col {
  min-width: 0;
}
.exec-event-col + .exec-event-col {
  border-left: 1px solid var(--border);
  padding-left: 0.75rem;
}
.exec-event-col-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.exec-event-card .stat-value {
  font-size: 1.85rem;
  line-height: 1.15;
}
.exec-event-metrics {
  margin: 0.2rem 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.3rem 0.65rem;
}
.exec-event-metrics-closed {
  grid-template-columns: 1fr 1fr;
}
.exec-event-metrics dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.exec-event-metrics dd {
  margin: 0.1rem 0 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.exec-event-kpi-row {
  margin: 0.15rem 0 0;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  align-items: baseline;
  min-width: 0;
  overflow: visible;
}
.exec-event-kpi-row-single {
  grid-template-columns: 1fr;
}
.exec-event-kpi {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  min-width: 0;
  overflow: visible;
}
.exec-event-kpi + .exec-event-kpi {
  border-left: 1px solid var(--border);
  padding-left: 0.75rem;
}
.exec-event-kpi-label {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.exec-event-kpi-value {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: visible;
}
.exec-event-charts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  margin-top: 0.15rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}
.exec-spark-block {
  min-width: 0;
  position: relative;
}
.exec-spark-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.exec-spark-line,
.exec-spark-bars {
  height: 36px;
}
.exec-spark-bars {
  background: rgba(244, 144, 64, 0.07);
  border-radius: 3px;
}
.exec-spark-line svg,
.exec-spark-bars svg {
  display: block;
  width: 100%;
  height: 36px;
  color: var(--brand-orange);
  overflow: visible;
}
.exec-spark-bars svg rect.exec-spark-bar-hit {
  fill: transparent;
  pointer-events: auto;
}
.exec-spark-empty {
  font-size: 0.75rem;
}
.exec-spark-tip {
  position: absolute;
  left: 0;
  bottom: calc(100% + 2px);
  transform: translateX(-50%);
  padding: 0.18rem 0.45rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.exec-spark-tip[hidden] {
  display: none;
}
.exec-reporting-stub {
  padding: 1.15rem 1.25rem 1.35rem;
  max-width: 40rem;
}
.exec-reporting-stub h2 {
  margin: 0.65rem 0 0.4rem;
  font-size: 1.15rem;
}
.exec-reporting-stub p {
  margin: 0 0 0.65rem;
}
.reporting-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
}
.reporting-filters .reporting-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}
.reporting-filters .filter-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.reporting-filters .input-sm {
  min-width: 9rem;
}
.reporting-to-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.reporting-to-controls #filter-to-current[aria-pressed="true"] {
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}
.reporting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.reporting-summary {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.reporting-table-card {
  padding: 0;
  overflow: hidden;
}
#reporting-table {
  width: 100%;
  min-width: 64rem;
}
#reporting-table th,
#reporting-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}
#reporting-table .reporting-summary-cell {
  white-space: nowrap;
  max-width: 18rem;
}
#reporting-table .reporting-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.reporting-type {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-weight: 600;
}
.reporting-type-outage {
  background: rgba(30, 100, 220, 0.2);
  color: #6eb6ff;
}
.reporting-type-pm {
  background: rgba(80, 180, 100, 0.2);
  color: #8fd99a;
}
.reporting-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border);
}
.reporting-page-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.exec-alerts-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.exec-capacity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none;
  width: 100%;
}
.exec-capacity-heading {
  margin: 0.75rem 0 0.5rem;
  font-size: 1rem;
}
.exec-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  flex-wrap: wrap;
}
.exec-help-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  flex: 0 0 auto;
  background: var(--surface-2, transparent);
}
.exec-help-tip {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 0.35rem);
  z-index: 40;
  width: 18rem;
  max-width: min(22rem, 70vw);
  padding: 0.45rem 0.55rem;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 6px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
  text-transform: none;
  letter-spacing: 0;
}
.exec-help:hover .exec-help-tip,
.exec-help:focus-within .exec-help-tip {
  display: block;
}
.exec-home .stat-card,
.exec-tile {
  overflow: visible;
}
.exec-tile {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.exec-tile:hover {
  text-decoration: none;
  border-color: var(--brand-orange);
}
.exec-tile-disabled {
  cursor: default;
  pointer-events: none;
}
.exec-tone-ok {
  color: var(--success);
}
.exec-tone-warn {
  color: var(--warning);
}
.exec-tone-danger {
  color: var(--danger);
}
.exec-tone-muted {
  color: var(--text-muted);
}
.exec-stat-split {
  font-size: 1.45rem;
}
.exec-cap-counts {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}
.exec-cap-ok { color: var(--success); }
.exec-cap-warn { color: var(--warning); }
.exec-cap-crit { color: var(--danger); }
.util-alarm-level {
  display: inline-block;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.12rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}
.util-alarm-warn {
  background: rgba(251, 191, 36, 0.18);
  color: var(--warning);
}
.util-alarm-crit {
  background: #ef444433;
  color: #ef4444;
}
.exec-mock-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--brand-orange);
  color: var(--brand-orange);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.exec-mock-badge-inline {
  margin-bottom: 0.75rem;
}
.exec-ops-panel {
  margin-bottom: 0;
}

.exec-ops-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: none;
  width: 100%;
  gap: 0.75rem;
}
.exec-ops-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}
.exec-ops-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}
.exec-ops-cell {
  text-align: left;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0.35rem 0.45rem;
  min-width: 0;
}
.exec-ops-cell.is-selected {
  background: rgba(245, 158, 11, 0.08);
  box-shadow: inset 0 0 0 1px var(--brand-orange);
}
.exec-ops-cell-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-muted);
}
.exec-ops-cell .stat-value {
  font-size: 1.45rem;
  line-height: 1.15;
}
.exec-ops-indent {
  padding-left: 1.5rem;
  color: var(--text-muted);
}
.exec-ops-pair-follow td {
  border-top: none;
  padding-top: 0.15rem;
}
.exec-ops-pair-top td {
  border-bottom: none;
}
.exec-ops-dlg-h {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-orange);
}
@media (max-width: 900px) {
  .exec-ops-grid {
    grid-template-columns: 1fr;
  }
}

.exec-ops-table-scroll {
  max-height: 22rem;
  overflow-y: auto;
}
.exec-ops-table-scroll .exec-ops-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #243044;
}
.exec-ops-tile {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: inherit;
  font: inherit;
}
.exec-ops-tile.is-selected {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 1px var(--brand-orange);
}
.exec-ops-table thead th[data-sort] {
  cursor: pointer;
  user-select: none;
}
.exec-ops-table thead th[data-sort][aria-sort="descending"]::after {
  content: " ▼";
  font-size: 0.7em;
}
.exec-ops-table thead th[data-sort][aria-sort="ascending"]::after {
  content: " ▲";
  font-size: 0.7em;
}
.exec-ops-panel .panel-header h3 {
  margin: 0;
  font-size: 0.95rem;
}
.exec-ops-table tbody tr[data-ops-idx] {
  cursor: pointer;
}
.exec-ops-table tbody tr[data-ops-idx]:hover td {
  background: rgba(244, 144, 64, 0.06);
}
.exec-status {
  font-weight: 600;
  font-size: 0.8rem;
}
.exec-status-c {
  color: var(--success);
}
.exec-status-p {
  color: var(--warning);
}
.exec-detail-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  color: var(--text-primary);
  padding: 0;
  max-width: 32rem;
  width: calc(100% - 2rem);
}
.exec-detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.exec-detail-form {
  margin: 0;
}
.exec-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.exec-detail-head h2 {
  margin: 0;
  font-size: 1.05rem;
}
.exec-detail-body {
  padding: 1rem 1.15rem 1.25rem;
}
.exec-detail-dl {
  margin: 0;
  display: grid;
  gap: 0.65rem;
}
.exec-detail-row {
  display: grid;
  grid-template-columns: 9.5rem 1fr;
  gap: 0.5rem;
}
.exec-detail-row dt {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.exec-detail-row dd {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.exec-uplink-panel {
  margin-top: 0.35rem;
}
.exec-uplink-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}
.exec-uplink-head h3 {
  margin: 0;
}
.exec-uplink-note {
  margin: 0.2rem 0 0;
  font-size: 0.78rem;
}
.exec-uplink-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.exec-uplink-win {
  min-width: 2.6rem;
  padding: 0.28rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.exec-uplink-win + .exec-uplink-win {
  border-left: 1px solid var(--border);
}
.exec-uplink-win.is-active,
.exec-uplink-win[aria-pressed="true"] {
  background: rgba(244, 144, 64, 0.16);
  color: var(--text-primary);
}
.exec-uplink-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.1rem;
}
.exec-uplink-card {
  min-width: 0;
  position: relative;
}
.exec-uplink-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
}
.exec-uplink-cap {
  margin: 0.15rem 0 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.exec-uplink-chart {
  position: relative;
  height: auto;
}
.exec-uplink-chart svg {
  display: block;
  width: 100%;
  height: 168px;
}
.exec-uplink-ylabel-l,
.exec-uplink-ylabel-r {
  font-variant-numeric: tabular-nums;
}
.exec-uplink-xlabels {
  position: relative;
  height: 1.15rem;
  margin: 0.08rem 0 0;
  color: var(--text-muted);
}
.exec-uplink-chart.is-twoline .exec-uplink-xlabels {
  height: 1.85rem;
}
.exec-uplink-xlabel {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.exec-uplink-chart.is-twoline .exec-uplink-xlabel {
  font-size: 0.62rem;
}
.exec-uplink-xlabel.is-first {
  transform: translateX(0);
  text-align: left;
}
.exec-uplink-xlabel.is-last {
  transform: translateX(-100%);
  text-align: right;
}
.exec-uplink-xlabel-day {
  display: block;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.exec-uplink-xlabel-time {
  display: block;
}
.exec-uplink-empty {
  grid-column: 1 / -1;
  margin: 0;
}
.exec-uplink-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0.35rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
}
.exec-uplink-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  margin-right: 0.3rem;
  vertical-align: -0.1rem;
}
.exec-uplink-swatch-in {
  background: var(--chart-in, #22c55e);
}
.exec-uplink-swatch-out {
  background: var(--chart-out, #a78bfa);
}
.exec-uplink-tip {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, calc(-100% - 6px));
  padding: 0.2rem 0.45rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: normal;
  max-width: min(22rem, calc(100% - 0.75rem));
  text-align: center;
  pointer-events: none;
  z-index: 4;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.exec-uplink-tip[hidden] {
  display: none;
}
@media (max-width: 900px) {
  .exec-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .exec-events-grid {
    grid-template-columns: 1fr;
    max-width: none;
    width: 100%;
  }
  .exec-capacity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
    width: 100%;
  }
  .exec-event-split {
    grid-template-columns: 1fr 1fr;
  }
  .exec-event-charts {
    grid-template-columns: 1fr;
  }
  .exec-detail-row {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }
  .exec-uplink-body {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 640px) {
  .exec-home .exec-kpi-grid,
  .exec-home .exec-ops-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .exec-home .exec-events-grid {
    grid-template-columns: 1fr !important;
    max-width: none;
    width: 100%;
  }
  .exec-home .exec-capacity-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: none;
    width: 100%;
  }
  .exec-event-split {
    grid-template-columns: 1fr 1fr;
  }
  .exec-event-charts {
    grid-template-columns: 1fr;
  }
}

/* DOCSIS US Total-BW / modulation (stepped-down profiles) */
.util-mod-degraded { color: #e6a23c; font-weight: 700; }
.pm-us-util-card { padding: 0.85rem 1rem; margin-bottom: 1rem; }
.pm-us-util-card h3 { margin: 0 0 0.4rem; font-size: 0.95rem; }
.pm-us-util-mix { font-size: 0.85rem; margin: 0 0 0.5rem; color: var(--text-muted); }

/* Event boards: tablet keeps table + H-scroll; phone uses stacked cards */
@media (min-width: 641px) and (max-width: 1024px) {
  #outage-table th:first-child,
  #outage-table td:first-child,
  #pm-table th:first-child,
  #pm-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #243044;
  }
}

@media (max-width: 640px) {
  .event-board-table-scroll,
  #outage-event-list,
  #pm-event-list {
    overflow-x: visible;
    max-height: none;
  }
  #outage-table,
  #pm-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto;
  }
  #outage-table thead,
  #pm-table thead {
    display: none;
  }
  #outage-table,
  #outage-table tbody,
  #pm-table,
  #pm-table tbody {
    display: block;
  }
  #outage-table tbody tr,
  #pm-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.75rem;
    margin: 0 0 0.65rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    white-space: normal;
    cursor: pointer;
  }
  #outage-table tbody tr:last-child,
  #pm-table tbody tr:last-child {
    margin-bottom: 0;
  }
  #outage-table td,
  #pm-table td {
    display: block;
    width: auto !important;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    padding: 0.12rem 0;
  }
  #outage-table td::before,
  #pm-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    margin-bottom: 0.05rem;
  }
  #outage-table td:nth-child(1),
  #outage-table td:nth-child(4),
  #outage-table td:nth-child(8),
  #pm-table td:nth-child(1),
  #pm-table td:nth-child(9) {
    grid-column: 1 / -1;
  }
  #outage-table td.ev-type .badge {
    margin: 0.1rem 0.25rem 0.1rem 0;
  }
  #outage-table tr:has(td.empty-row),
  #pm-table tr:has(td.empty-row) {
    display: block;
    border: none;
    padding: 0.75rem;
    background: transparent;
  }
  #outage-table td.empty-row,
  #pm-table td.empty-row {
    grid-column: 1 / -1;
  }
  #outage-table td.empty-row::before,
  #pm-table td.empty-row::before {
    content: none;
  }
  .outage-split,
  .pm-split {
    flex-direction: column-reverse;
    min-height: 0;
    gap: 0.65rem;
  }
  .outage-split-map,
  .pm-split-map {
    min-height: min(40vh, 16rem);
    height: min(40vh, 16rem);
  }
  #outage-detail-map,
  #pm-detail-map {
    min-height: min(40vh, 16rem) !important;
    height: min(40vh, 16rem);
  }

  /* Shared phone cards: Device, Home Field ops, Monitor, Util, Admin tables */
  #exec-ops-table,
  #modem-table,
  #ont-table,
  #fleet-table,
  #alarm-table,
  #util-alarms-table,
  #reporting-table,
  #failed-table,
  #ex-table,
  #threshold-table,
  #users-table,
  #poll-table,
  table.phone-card-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: auto;
  }
  #exec-ops-table thead,
  #modem-table thead,
  #ont-table thead,
  #fleet-table thead,
  #alarm-table thead,
  #util-alarms-table thead,
  #reporting-table thead,
  #failed-table thead,
  #ex-table thead,
  #threshold-table thead,
  #users-table thead,
  #poll-table thead,
  table.phone-card-table thead {
    display: none;
  }
  #exec-ops-table,
  #exec-ops-table tbody,
  #modem-table,
  #modem-table tbody,
  #ont-table,
  #ont-table tbody,
  #fleet-table,
  #fleet-table tbody,
  #alarm-table,
  #alarm-table tbody,
  #util-alarms-table,
  #util-alarms-table tbody,
  #reporting-table,
  #reporting-table tbody,
  #failed-table,
  #failed-table tbody,
  #ex-table,
  #ex-table tbody,
  #threshold-table,
  #threshold-table tbody,
  #users-table,
  #users-table tbody,
  #poll-table,
  #poll-table tbody,
  table.phone-card-table,
  table.phone-card-table tbody {
    display: block;
  }
  #exec-ops-table tbody tr,
  #modem-table tbody tr,
  #ont-table tbody tr,
  #fleet-table tbody tr,
  #alarm-table tbody tr,
  #util-alarms-table tbody tr,
  #reporting-table tbody tr,
  #failed-table tbody tr,
  #ex-table tbody tr,
  #threshold-table tbody tr,
  #users-table tbody tr,
  #poll-table tbody tr,
  table.phone-card-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.12rem 0.65rem;
    margin: 0 0 0.6rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-1);
    white-space: normal;
  }
  #exec-ops-table td,
  #modem-table td,
  #ont-table td,
  #fleet-table td,
  #alarm-table td,
  #util-alarms-table td,
  #reporting-table td,
  #failed-table td,
  #ex-table td,
  #threshold-table td,
  #users-table td,
  #poll-table td,
  table.phone-card-table td {
    display: block;
    width: auto !important;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    padding: 0.1rem 0;
  }
  #exec-ops-table td::before,
  #modem-table td::before,
  #ont-table td::before,
  #fleet-table td::before,
  #alarm-table td::before,
  #util-alarms-table td::before,
  #reporting-table td::before,
  #failed-table td::before,
  #ex-table td::before,
  #threshold-table td::before,
  #users-table td::before,
  #poll-table td::before,
  table.phone-card-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
  }
  #exec-ops-table td:nth-child(1),
  #modem-table td:nth-child(1),
  #ont-table td:nth-child(1),
  #fleet-table td:nth-child(1),
  #users-table td:nth-child(1) {
    grid-column: 1 / -1;
  }
  /* Device inventory: keep identity + presence on phone, hide the long RF/optical tail */
  #modem-table td:nth-child(n+7),
  #ont-table td:nth-child(n+7) {
    display: none !important;
  }
  .inventory-table-scroll,
  .exec-ops-table-scroll,
  .panel-table-scroll,
  .users-table-wrap,
  .nh-table-scroll {
    overflow-x: visible;
  }
  table.data-table:not(.data-table-wide),
  table.data-table-wide,
  .data-table-wide {
    min-width: 0 !important;
    width: 100% !important;
  }

  .portal-header {
    grid-template-columns: auto 1fr auto;
    column-gap: 0.35rem;
  }
  .portal-nav-toggle {
    margin-left: 0;
  }
  .portal-brand img {
    height: 26px;
  }
  .portal-user-name {
    display: none;
  }
  .portal-client-select label {
    display: none;
  }
  .portal-client-select select {
    max-width: 7.5rem;
    font-size: 0.8rem;
  }
  .portal-runtime-banner {
    font-size: 0.72rem;
    padding: 0.3rem 0.65rem;
  }

  .map-layout {
    flex-direction: column;
    height: calc(100vh - 9rem);
    min-height: 24rem;
  }
  .map-sidebar-wrapper {
    width: 100%;
  }
  .map-sidebar-wrapper:not(.collapsed) .map-sidebar {
    width: 100%;
    max-height: 28vh;
  }
  .map-timebar {
    left: 4px;
    right: 4px;
    max-width: none;
    bottom: 4px;
  }
  .sidebar-pull {
    writing-mode: horizontal-tb;
    width: 100%;
    height: auto;
    padding: 0.35rem;
  }

  .customer-search-form-table,
  .customer-search-form-table tbody,
  .customer-search-form-table tr,
  .customer-search-form-table th,
  .customer-search-form-table td {
    display: block;
    width: 100%;
  }
  .customer-search-form-table th {
    padding-bottom: 0.15rem;
  }
  .login-card {
    max-width: 100%;
    margin: 0 0.5rem;
  }
  .login-brand img {
    width: 120px;
    height: 120px;
  }
  .help-table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
  }
  .telemetry-selector-row .form-field,
  .telemetry-search-field,
  .telemetry-filter-field {
    flex: 1 1 100%;
    min-width: 0;
  }
  .telemetry-mode-toggle {
    width: 100%;
  }
  .telemetry-mode-btn {
    flex: 1;
    padding: 0.55rem 0.4rem;
  }
  .nh-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  .network-toolbar,
  .diff-selector-row {
    flex-direction: column;
    align-items: stretch;
  }
  .util-spark-wrap {
    min-width: 0;
    max-width: 100%;
  }
  .oncall-now {
    grid-template-columns: 1fr !important;
  }

  /* Utilization Detail: stacked port cards, spark full width, hide Cap/Mod */
  .util-device-body {
    overflow-x: visible;
    max-height: none;
  }
  .util-metric-table,
  .util-metric-table tbody {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto;
  }
  .util-metric-table thead {
    display: none;
  }
  .util-metric-table tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.15rem 0.6rem;
    margin: 0 0 0.6rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-2, rgba(255, 255, 255, 0.03));
    white-space: normal;
  }
  .util-metric-table td {
    display: block;
    width: auto !important;
    max-width: none !important;
    white-space: normal !important;
    overflow: visible !important;
    padding: 0.1rem 0;
  }
  .util-metric-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
  }
  .util-metric-table td.util-label,
  .util-metric-table td.util-spark,
  .util-metric-table td.util-col-mod {
    grid-column: 1 / -1;
  }
  .util-metric-table td.util-col-cap,
  .util-metric-table th.util-col-cap {
    display: none !important;
  }
  .util-metric-table tr.util-expand-sep td,
  .util-metric-table tr.util-port-empty td {
    grid-column: 1 / -1;
  }
  .util-metric-table tr.util-expand-sep td::before,
  .util-metric-table tr.util-port-empty td::before {
    content: none;
  }
  .util-spark-wrap {
    min-width: 0;
    max-width: 100%;
  }
}

/* Sandbox read-only banner (DB access plan Rev 3, Phase 1; dev runtime only). */
.aniq-sandbox-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  padding: 0.45rem 1rem;
  background: #f59e0b;
  color: #111;
  font-weight: 600;
  font-size: 0.85rem;
  text-align: center;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
[data-sandbox-disabled="1"] {
  cursor: not-allowed !important;
  opacity: 0.5;
}
