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

:root {
  --color-bg-body: #0d1117;
  --color-bg-card: #161b22;
  --color-bg-hover: #1c2128;
  --color-border: #21262d;
  --color-border-accent: #30363d;
  --color-text-primary: #e6edf3;
  --color-text-secondary: #8b949e;
  --color-text-tertiary: #c9d1d9;
  --color-text-muted: #7d7f82;
  --color-brand: #ff0000;
  --color-danger: #f85149;
  --color-success: #3fb950;
  --color-warning: #d29922;
  --color-accent-gold: #c9a84c;
  --color-burgundy: rgb(86 5 4);
  --font-s: 10px;
  --font-m: 12px;
  --font-l: 14px;
  --font-xl: 18px;
  --font-xxl: 24px;
  --radius-card: 12px;
  --radius-input: 6px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--font-m);
  background: var(--color-bg-body);
  color: var(--color-text-primary);
}

/* Display font (Anta) for h1s, the sidebar nav section headers, and the
   top-level Alerts nav item. */
h1,
.nav-section-header,
.nav-section-label,
.nav-item[data-section="alerts"] {
  font-family: 'Anta', sans-serif;
  text-transform: uppercase;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 14px 16px;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
}
.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.top-bar-account-select {
  padding: 4px 28px 4px 8px;
  background: var(--color-bg-body);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  font-size: var(--font-m);
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238b949e'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 14px;
}

/* Layout */
.layout {
  display: flex;
  min-height: calc(100vh - 37px);
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--color-bg-card);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.sidebar-logo-wrap {
  padding: 10px 57px 14px;
  border-bottom: 1px solid var(--color-border);
  margin: 4px auto;
  background-color: #000000;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.sidebar-logo {
  width: 100%;
  height: auto;
  display: block;
}
.mobile-logo { cursor: pointer; }
.site-selector {
  padding: 12px 20px 4px;
}
#account-selector {
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
  padding-bottom: 12px;
}
.site-label {
  display: block;
  font-size: var(--font-s);
  font-weight: 700;
  color: var(--color-accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.site-select {
  width: 100%;
  padding: 8px 32px 8px 12px;
  font-size: var(--font-l);
  font-family: inherit;
  color: #fff;
  background: var(--color-burgundy);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%238b949e'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.site-select:hover {
  border-color: var(--color-text-muted);
}
.site-select:focus {
  outline: none;
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.2);
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-group,
.nav-element {
  display: flex;
  flex-direction: column;
}
.nav-group {
  font-family: 'Anta', sans-serif;
}
.nav-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 4px 0px;
}

.nav-section-label {
  display: block;
  padding: 8px 20px 4px;
  font-weight: 700;
  color: var(--color-accent-gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-section-label:hover {
  color: #f0cc8a;
}
.nav-vendor-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  margin: 0 12px;
  width: calc(100% - 24px);
  font-size: var(--font-l);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  font-family: inherit;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-vendor-toggle:hover,
.nav-vendor-toggle.nav-section-toggle:not(.collapsed) {
  background: var(--color-bg-hover);
  color: #ffffff;
}
.nav-vendor-toggle .nav-section-chevron {
  margin-left: auto;
}
.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-section-toggle:not(.collapsed) {
  color: var(--color-accent-gold);
}
.nav-section-toggle:hover {
  color: #ffffff;
}
.nav-section-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}
.nav-section-toggle.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}
.nav-section-group {
  overflow: hidden;
  max-height: 500px;
  transition: max-height 0.25s ease-in-out;
}
.nav-section-group.collapsed {
  max-height: 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px;
  margin: 0 12px;
  font-size: var(--font-l);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  width: calc(100% - 24px);
  text-align: left;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  border-radius: 8px;
}
.nav-item-expandable .nav-section-chevron {
  margin-left: auto;
}
.nav-item-expandable.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}
.nav-item.nav-disabled {
  opacity: 0.35;
  pointer-events: none;
  cursor: default;
}
.nav-site-group-label {
  display: none;
}
#sfcc-nav-group .nav-item,
#shopify-nav-group .nav-item,
#crux-nav-group .nav-item {
  margin: 0 12px 0 18px;
  width: calc(100% - 30px);
  padding-left: 28px;
}
.nav-context-selector {
  padding: 8px 16px 12px;
}
.nav-context-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-accent-gold);
  margin-bottom: 8px;
  padding-left: 2px;
}
.site-select-grouped {
  width: 100%;
  padding: 8px 12px;
  background: var(--color-burgundy);
  color: #fff;
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  font-size: var(--font-l);
  font-family: inherit;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238b949e'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 28px;
}
.site-select-grouped optgroup {
  color: var(--color-text-secondary);
  font-style: normal;
  font-weight: 600;
  font-size: var(--font-m);
}
.site-select-grouped option {
  color: var(--color-text-primary);
  font-weight: 400;
  padding: 4px 8px;
}
.site-select-grouped option:checked {
  color: var(--color-accent-gold);
}
.nav-item-link {
  text-decoration: none;
  font-family: inherit;
}
.nav-item-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.nav-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.nav-item.active {
  background: rgb(118, 3, 3);
  color: #ffffff;
  font-weight: 600;
}
.nav-item.has-active-alerts:not(.active) {
  color: var(--color-brand);
}
.nav-item.has-active-alerts .nav-icon {
  animation: pulse-alert 1s ease-in-out infinite;
}
@keyframes pulse-alert {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  pointer-events: none;
  display: block;
  align-self: center;
}
.nav-logo-icon {
  object-fit: contain;
  opacity: 0.45;
  transition: opacity 0.15s;
}
.nav-vendor-toggle:hover .nav-logo-icon,
.nav-vendor-toggle:not(.collapsed) .nav-logo-icon {
  opacity: 0.9;
}
.nav-external-icon {
  width: 12px;
  height: 12px;
  margin-left: auto;
  opacity: 0.5;
  flex-shrink: 0;
}
.nav-item-link:hover .nav-external-icon {
  opacity: 0.8;
}
.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease-in-out;
}
.nav-sub.open {
  max-height: 500px;
}
.nav-sub-label {
  padding: 12px 20px 4px 34px;
  font-size: var(--font-s);
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.nav-sub-item {
  padding: 8px 20px 8px 28px;
  margin: 0 12px 0 18px;
  width: calc(100% - 30px);
  font-size: var(--font-l);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border: none;
  background: none;
  text-align: left;
  transition: background 0.15s, color 0.15s;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  border-radius: 8px;
}
.nav-sub-item:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}
.nav-sub-item.active {
  color: #ffffff;
  font-weight: 600;
  background: var(--color-burgundy);
}

/* Main content */
.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px 32px;
  min-width: 0;
}
.section { display: block; }

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--color-brand);
}
.header h1 { font-size: var(--font-xxl); font-weight: 700; color: var(--color-text-primary); text-transform: uppercase; }
.header { align-items: center; }
.header-meta { display: flex; align-items: center; gap: 12px; }
.header-meta-text { text-align: right; }
.header-meta-line { font-size: var(--font-m); color: var(--color-text-secondary); line-height: 1.2; }
.header-meta-next { color: var(--color-text-muted); }
.title-site { color: var(--color-brand); font-style: italic; }
.section-subtitle { color: #ff0000; font-style: italic; }

/* Device toggle */
.device-toggle {
  display: inline-flex;
  gap: 1px;
  align-items: center;
  background: var(--color-border);
  border-radius: var(--radius-input);
  overflow: hidden;
  margin-left: 16px;
}
/* Legacy class kept for any callsite that still toggles `.visible`. */
.device-toggle.visible { display: inline-flex; }
.device-toggle-icon {
  display: flex;
  align-items: center;
  padding: 0 8px 0 12px;
  color: var(--color-text-secondary);
}
.filter-row-sticky {
  display: flex;
  justify-content: flex-end;
  padding-top: 12px;
  padding-bottom: 12px;
  margin-top: 50px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg-body);
}
.filter-row-sticky:empty {
  display: none;
}

#overview-details-section {
  padding-top: 16px;
}

/* ============================================================================
 * Site Alert Configurations card
 * Used by the Orders page; reusable for any future per-site config sections.
 * Prefixed `site-cfg-*` to avoid colliding with the older `alert-cfg-*`
 * classes used by the Settings → Alerts page (see further down).
 * ============================================================================ */

.site-cfg-card { margin-bottom: 24px; }

.site-cfg-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
}
.site-cfg-toggle-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.site-cfg-badge {
  display: none;
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(139, 148, 158, 0.15);
  color: var(--color-text-secondary);
  border: 1px solid rgba(139, 148, 158, 0.3);
}
.site-cfg-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.site-cfg-toggle[aria-expanded="true"] .site-cfg-chevron {
  transform: rotate(-135deg);
}

.site-cfg-body {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--color-border);
}

.site-cfg-section-heading {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}
.site-cfg-section-heading.with-spacing { margin-top: 32px; }

.site-cfg-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.site-cfg-chart-wrap {
  flex: 1 1 480px;
  min-width: 0;
  padding-bottom: 20px;
}

.site-cfg-panel {
  width: 240px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
  color: var(--color-text-secondary);
  text-align: right;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 16px;
}
.site-cfg-panel-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-primary);
  text-align: left;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 4px;
}

.site-cfg-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-end;
}
.site-cfg-input {
  width: 90px;
  padding: 3px 6px;
  background: var(--color-bg-body);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  color: inherit;
  text-align: right;
}
.site-cfg-rec-hint {
  font-size: 10.5px;
  font-style: italic;
}

.site-cfg-actions {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 6px;
}
.site-cfg-actions .btn-primary,
.site-cfg-actions .btn-ghost {
  font-size: 12px;
  padding: 6px 12px;
}
.site-cfg-status {
  font-style: italic;
  color: var(--color-text-secondary);
  text-align: right;
}

.site-cfg-explainer {
  margin-top: 18px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--color-text-secondary);
  background: var(--color-bg-body);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 14px 16px;
}
.site-cfg-explainer-title {
  color: var(--color-text-primary);
  font-weight: 600;
  margin-bottom: 6px;
}
.site-cfg-explainer-list {
  margin: 0;
  padding-left: 18px;
}
.site-cfg-explainer p { margin: 8px 0 0; }
.site-cfg-explainer p.first { margin-top: 0; }
.site-cfg-explainer .note { color: var(--color-success); }
.site-cfg-explainer .alert { color: #ff6b6b; }
.site-cfg-explainer .closing { font-style: italic; margin-top: 8px; }

.site-cfg-explainer-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.site-cfg-explainer-section p > strong { color: var(--color-text-primary); }
.site-cfg-settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.site-cfg-settings-table th,
.site-cfg-settings-table td {
  padding: 6px 8px;
  vertical-align: top;
}
.site-cfg-settings-table thead tr {
  text-align: left;
  color: var(--color-text-primary);
}
.site-cfg-settings-table th {
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
}
.site-cfg-settings-table th.col-setting,
.site-cfg-settings-table td.col-setting { width: 130px; color: var(--color-text-primary); }
.site-cfg-settings-table th.col-when,
.site-cfg-settings-table td.col-when { width: 170px; }

@container alert-configs (max-width: 760px) {
  .site-cfg-panel { width: 100% !important; }
}

/* When a collapsible heading is also a sticky section header (e.g. Page
   Type Breakdown), pin it to the top of the viewport when scrolled past. */
.collapsible-heading.sticky-section-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-bg-body);
  margin-top: 24px;
  padding-top: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.device-btn {
  padding: 4px 16px;
  font-size: var(--font-m);
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.device-btn:hover { background: var(--color-bg-hover); color: var(--color-text-primary); }
.device-btn.active { color: var(--color-brand); font-weight: 600; background: rgba(255, 0, 0, 0.08); }

/* URL list */
.url-list {
  margin-bottom: 24px;
}
.url-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
  margin-bottom: 8px;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.url-row:hover { border-color: var(--color-border-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.url-row.active { border-color: #ffffff; box-shadow: 0 2px 8px rgba(255,255,255,0.12); }
.url-row::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}
.url-row:hover::after { border-color: var(--color-text-secondary); }
.url-row.active::after { transform: translateY(-50%) rotate(-135deg); border-color: #ffffff; }
.url-row .url-path {
  font-weight: 600;
  font-size: var(--font-l);
  width: 300px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--color-text-primary);
}
.url-row .url-metrics {
  display: flex;
  gap: 20px;
  font-size: var(--font-l);
}
.url-row .url-metric-label { color: var(--color-text-secondary); margin-right: 4px; }
.url-external-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  margin-left: auto;
  margin-right: 20px;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.url-external-link:hover {
  color: var(--color-text-primary);
  background: rgba(255,255,255,0.08);
}
.url-row.no-data-row { opacity: 0.5; cursor: default; }
.url-row.no-data-row:hover { border-color: var(--color-border); box-shadow: none; }
.url-row.no-data-row::after { display: none; }
.no-data-label { color: var(--color-text-secondary); font-style: italic; }
.url-row-expand {
  margin-bottom: 8px;
}
.url-row-expand .kpi-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-top: 16px;
}
.url-row-expand .collapsible-heading {
  margin-top: 8px;
}
.url-row-expand .trend-panel {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  border: 1px solid var(--color-border);
}
.url-row-expand .trend-panel h2 {
  font-size: var(--font-l);
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--color-text-primary);
}

/* KPI row */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 0;
}
.kpi-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
}
.kpi-card::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}
.kpi-card:hover::after { border-color: var(--color-text-secondary); }
.kpi-card.active::after { transform: rotate(-135deg); border-color: var(--color-brand); }
.kpi-card:hover { border-color: var(--color-border-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.kpi-card.active { border-color: var(--color-brand); box-shadow: 0 2px 8px rgba(255,0,0,0.12); }
.trend-expand {
  margin-bottom: 24px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.trend-expand:empty { margin-bottom: 24px; }
.trend-expand .trend-panel {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin-top: 16px;
  border: 1px solid var(--color-border);
}
.trend-panel h2 {
  font-size: var(--font-l);
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--color-text-primary);
}
.kpi-card .kpi-label {
  font-size: var(--font-l);
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.kpi-card .kpi-value {
  font-size: var(--font-xxl);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-text-primary);
}
.kpi-card .badge,
.perf-badge {
  display: inline-block;
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 20px;
}
.badge-good { background: rgba(63, 185, 80, 0.15); color: var(--color-success); }
.badge-warning { background: rgba(255, 159, 10, 0.15); color: var(--color-warning); }
.badge-poor { background: rgba(248, 81, 73, 0.15); color: var(--color-danger); }
.perf-site-list { color: #6e7681; font-weight: 400; }

/* Chart row */
.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(300px, calc(33.33% - 11px)), 1fr));
  gap: 16px;
}
.chart-row.half-row {
  grid-template-columns: 1fr 1fr;
}
/* Orders charts row: auto-fit so charts wrap to one column whenever they
   would otherwise be < 500px wide. Cards stretch to equal height via grid
   stretch + align-items; the chart inside keeps its natural aspect ratio
   and any extra card height shows as empty space at the bottom of the
   shorter chart. min-width: 0 lets the cards actually shrink inside their
   grid track. */
.orders-charts-row {
  margin-bottom: 24px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 500px), 1fr));
  align-items: stretch;
}
.orders-charts-row > .card {
  min-width: 0;
  height: 100%;
  position: relative;
}
/* When a chart card is toggled full-width, span the entire grid row so the
   sibling card drops to the next row. Chart.js + the resize-fix plugin
   pick up the new parent width via ResizeObserver and redraw. */
.orders-charts-row > .card.fullwidth { grid-column: 1 / -1; }

/* Top-right toggle button. Two SVGs swap visibility based on `.fullwidth`. */
.card-fullwidth-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid var(--color-border-accent);
  border-radius: 4px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.card-fullwidth-toggle:hover {
  color: var(--color-text-primary);
  border-color: var(--color-text-muted);
}
.card-fullwidth-toggle .icon-collapse { display: none; }
.card.fullwidth .card-fullwidth-toggle .icon-expand { display: none; }
.card.fullwidth .card-fullwidth-toggle .icon-collapse { display: block; }
.trend-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
  white-space: nowrap;
}
/* Trend badge states:
 *   above    — running above expected (green)
 *   expected — within natural variation, slightly below expected (gray)
 *   below    — significantly below expected (red)
 *
 * Legacy class names (on-trend / caution / investigate / alert) are kept as
 * aliases so any older callsite keeps rendering until it's migrated.
 */
.trend-badge.above,
.trend-badge.on-trend {
  background: rgba(63, 185, 80, 0.15);
  color: var(--color-success);
}
.trend-badge.expected {
  background: rgba(139, 148, 158, 0.25);
  color: var(--color-text-primary);
}
.trend-badge.below,
.trend-badge.caution,
.trend-badge.investigate,
.trend-badge.alert {
  background: rgba(248, 81, 73, 0.2);
  color: var(--color-danger);
}
.chart-row > .trend-expand,
.full-row {
  grid-column: 1 / -1;
}
.chart-wrap.padded { padding-bottom: 20px; }
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  border: 1px solid var(--color-border);
}
.card.clickable,
.card.card-expandable {
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card.clickable::after,
.card.card-expandable::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 24px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}
.card.clickable:hover,
.card.card-expandable:hover { border-color: var(--color-border-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.card.clickable:hover::after,
.card.card-expandable:hover::after { border-color: var(--color-text-secondary); }
.card.clickable.active,
.card.card-expandable.active { border-color: var(--color-brand); box-shadow: 0 2px 8px rgba(255,0,0,0.12); }
.card.clickable.active::after,
.card.card-expandable.active::after { transform: rotate(-135deg); border-color: var(--color-brand); }
.card h2 {
  font-size: var(--font-l);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-primary);
}
.device-card-avg { font-weight: 400; color: #fff; font-size: var(--font-l); }
.nav-summary { display: flex; gap: 16px; justify-content: center; font-weight: 400; padding: 8px 0 0; }
.nav-legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.nav-fast-dot { background: var(--color-success); }
.nav-slow-dot { background: var(--color-danger); }
.nav-fast { color: var(--color-success); }
.nav-slow { color: var(--color-danger); }
.card h2 .badge {
  display: inline-block;
  font-size: var(--font-m);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  float: right;
  margin-top: 2px;
  margin-right: 20px;
}
.chart-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 12px;
  padding-top: 8px;
  font-size: var(--font-l);
  color: var(--color-text-secondary);
  line-height: 1.4;
}
.chart-wrap {
  position: relative;
}
.trend-expand .chart-wrap,
.url-row-expand .chart-wrap {
  border-radius: 8px;
  padding: 12px;
}

/* Table */
.table-card-wrap { position: relative; margin-bottom: 24px; min-width: 0; overflow: hidden; display: flex; flex-direction: column; }
.table-card-wrap > .table-card { flex: 1; }
.table-card-wrap > .scroll-fade { position: absolute; top: 0; right: 0; bottom: 0; width: 32px; background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15)); pointer-events: none; z-index: 2; border-radius: 0 var(--radius-card) var(--radius-card) 0; opacity: 0; transition: opacity 0.3s ease; }
.table-card-wrap.is-scrollable > .scroll-fade { opacity: 1; }
.table-card-wrap.scrolled-end > .scroll-fade { opacity: 0; }
.table-card { margin-bottom: 0; overflow-x: auto; position: relative; scrollbar-width: none; }
.table-card-wrap .table-card { border-radius: var(--radius-card); }
.table-card::-webkit-scrollbar { display: none; }
/* Unwrapped table-cards (fallback) */
.table-card:not(.table-card-wrap .table-card) { margin-bottom: 24px; }
.table-card h2 {
  font-size: var(--font-l);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-primary);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-l);
}
th {
  text-align: left;
  font-weight: 600;
  color: var(--color-text-secondary);
  font-size: var(--font-m);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
}
td {
  padding: 12px;
  border-bottom: 1px solid var(--color-bg-card);
  color: var(--color-text-tertiary);
}
tr:last-child td { border-bottom: none; }
.status-active {
  display: inline-block;
  font-size: var(--font-m);
  font-weight: 600;
  padding: 2px 12px;
  border-radius: 20px;
  background: rgba(63, 185, 80, 0.15);
  color: var(--color-success);
}
.status-inactive {
  display: inline-block;
  font-size: var(--font-m);
  padding: 2px 12px;
  border-radius: 20px;
  background: rgba(139, 148, 158, 0.15);
  color: var(--color-text-secondary);
}
.cartridges {
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sandbox credits section */
.credits-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  margin-bottom: 24px;
}
.credit-summary { display: flex; flex-direction: column; gap: 16px; }
.credit-stat {
  border-radius: 8px;
  padding: 12px 16px;
  border-left: 4px solid transparent;
}
.credit-stat.stat-warn {
  border-left-color: var(--color-warning);
  background: rgba(210, 153, 34, 0.1);
}
.credit-stat.stat-error {
  border-left-color: var(--color-danger);
  background: rgba(248, 81, 73, 0.1);
}
.credit-stat .stat-label { font-size: var(--font-l); color: var(--color-text-secondary); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.credit-stat .stat-value { font-size: var(--font-xxl); font-weight: 700; color: var(--color-text-primary); }
.credit-stat .stat-sub { font-size: var(--font-l); color: var(--color-text-secondary); margin-top: 2px; }
.section-title {
  font-size: var(--font-xl);
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 16px;
  color: var(--color-text-primary);
}

/* Inline cell warnings */
.cell-warning {
  background: rgba(210, 153, 34, 0.15);
  border-radius: var(--radius-input);
  padding: 4px 8px;
  display: inline-block;
  color: var(--color-warning);
}
.cell-critical {
  background: rgba(248, 81, 73, 0.15);
  border-radius: var(--radius-input);
  padding: 4px 8px;
  display: inline-block;
  color: var(--color-danger);
}
.cell-ok {
  padding: 4px 8px;
  display: inline-block;
}
.flag-badge {
  font-size: var(--font-m);
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}
.flag-ok { background: rgba(63, 185, 80, 0.15); color: var(--color-success); }
.flag-warn { background: rgba(210, 153, 34, 0.15); color: var(--color-warning); }
.flag-error { background: rgba(248, 81, 73, 0.15); color: var(--color-danger); }
.schedule-days { color: var(--color-text-secondary); margin-top: 2px; }
.storage-bar-wrap {
  width: 80px;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-left: 8px;
}
.storage-bar-fill { height: 100%; border-radius: 3px; }
.storage-row { display: flex; align-items: center; gap: 4px; font-size: var(--font-l); margin-bottom: 2px; color: var(--color-text-tertiary); }
.storage-row:last-child { margin-bottom: 0; }

/* Action buttons */
.btn-start {
  font-size: var(--font-m);
  font-weight: 600;
  padding: 4px 12px;
  border: none;
  border-radius: var(--radius-input);
  cursor: pointer;
  background: #ffffff;
  color: var(--color-bg-body);
  transition: opacity 0.15s;
}
.btn-start:hover { opacity: 0.85; }
.btn-start:disabled { opacity: 0.4; cursor: default; }
.btn-stop { background: var(--color-danger); color: var(--color-bg-body); }
.btn-start-error {
  color: var(--color-danger);
  margin-top: 4px;
}

/* Info tooltip */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.info-tip .info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-text-muted);
  color: #fff;
  font-size: var(--font-s);
  font-weight: 700;
  cursor: help;
  flex-shrink: 0;
}
.info-tip .info-text {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-border-accent);
  color: var(--color-text-primary);
  font-weight: 400;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: normal;
  min-width: 260px;
  max-width: 360px;
  margin-bottom: 4px;
  z-index: 10;
}
.info-tip:hover .info-text { display: block; }

/* Metric description under chart */
.card-metric-desc {
  color: var(--color-text-secondary);
  padding: 8px 0 0;
  margin-top: 8px;
  border-top: 1px solid var(--color-border);
  line-height: 1.4;
}
.card-metric-desc strong {
  color: var(--color-text-tertiary);
}

/* Nav glossary */
.nav-glossary {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.nav-glossary-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--font-m);
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.nav-glossary-toggle::before {
  content: '\25B8';
  display: inline-block;
  margin-right: 4px;
  transition: transform 0.2s;
}
.nav-glossary.open .nav-glossary-toggle::before {
  transform: rotate(90deg);
}
.nav-glossary-toggle:hover { color: var(--color-text-primary); }
.nav-glossary-content {
  display: none;
  margin-top: 8px;
  padding-left: 2px;
}
.nav-glossary.open .nav-glossary-content {
  display: block;
}
.nav-glossary-item {
  color: var(--color-text-secondary);
  line-height: 1.6;
}
.nav-glossary-term {
  color: var(--color-text-tertiary);
  font-weight: 600;
}


/* Timezone label in the sidebar, below the Documentation link */
.nav-timezone {
  padding: 12px 20px;
  margin-top: auto;
}
.nav-timezone .footer-timezone {
  color: var(--color-text-muted);
  font-size: var(--font-s);
}

/* Refresh button */
.refresh-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-xl);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.15s, background 0.15s;
  font-family: inherit;
}
.refresh-btn:hover {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.08);
}
.refresh-btn:disabled {
  cursor: default;
  opacity: 0.5;
}
.refresh-btn.loading {
  animation: spin 0.8s linear infinite;
}
.refresh-error {
  color: var(--color-danger);
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* About CrUX collapsible */
.crux-about {
  margin-top: 0;
  padding-top: 0;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}
.crux-about-updated {
  color: var(--color-text-muted);
}
.crux-about-toggle {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-size: var(--font-l);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color 0.15s;
}
.crux-about-toggle:hover { color: var(--color-text-primary); }
.crux-header-row:hover .crux-about-toggle { color: var(--color-text-primary); }
.crux-header-row.open .crux-about-toggle { color: var(--color-brand); }
.crux-header-row.open .crux-about-toggle .collapse-caret {
  transform: rotate(-135deg);
  border-color: var(--color-brand);
}
.crux-about-content {
  display: none;
  margin-top: 12px;
}
.crux-about.open .crux-about-content {
  display: block;
}
.crux-about-content p {
  font-size: var(--font-l);
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-bottom: 12px;
}
.crux-about-content p:last-child {
  margin-bottom: 0;
}
.crux-about-content strong {
  color: var(--color-text-tertiary);
}
.crux-thresholds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-l);
  margin: 8px 0 12px;
}
.crux-thresholds-table th,
.crux-thresholds-table td {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}
.crux-thresholds-table th {
  color: var(--color-text-tertiary);
  font-weight: 600;
}
.crux-thresholds-table td {
  color: var(--color-text-secondary);
}
.crux-thresholds-table td:first-child {
  color: var(--color-text-tertiary);
  font-weight: 600;
}

/* Details accordion */
.details-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  cursor: pointer;
  position: relative;
  margin-top: 32px;
  margin-bottom: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.details-toggle:hover { border-color: var(--color-border-accent); box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.details-toggle.active { border-color: #ffffff; box-shadow: 0 2px 8px rgba(255,255,255,0.12); }
.details-toggle::after {
  content: '';
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: translateY(-50%) rotate(45deg);
  transition: transform 0.2s;
  pointer-events: none;
}
.details-toggle:hover::after { border-color: var(--color-text-secondary); }
.details-toggle.active::after { transform: translateY(-50%) rotate(-135deg); border-color: #ffffff; }
.details-toggle .details-label {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
}
.details-summary {
  display: flex;
  align-items: center;
  gap: 16px;
}
.details-summary .ff-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-l);
  color: var(--color-text-tertiary);
}
.ff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ff-bar {
  width: 200px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  background: var(--color-border);
}
.ff-bar span { height: 100%; }
.details-expand {
  display: none;
  margin-bottom: 24px;
}
.details-expand.open {
  display: block;
}
.details-expand .chart-row {
  margin-top: 16px;
}

/* CrUX trend grid */
.trend-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.trend-card {
  background: var(--color-bg-card);
  border-radius: var(--radius-card);
  padding: 16px 20px;
  border: 1px solid var(--color-border);
}
.trend-card h3 {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
}
.trend-card .trend-value {
  font-size: var(--font-xxl);
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--color-text-primary);
}
.trend-card .trend-delta {
  font-weight: 600;
  margin-left: 8px;
}
.trend-delta.improved { color: var(--color-success); }
.trend-delta.regressed { color: var(--color-danger); }
.trend-delta.flat { color: var(--color-text-secondary); }

/* Usage KPI row — no carets, no pointer, spacing below */
/* Uptime section */
#section-uptime .kpi-row { grid-template-columns: repeat(4, 1fr); margin-bottom: 24px; }
.inventory-kpi-row { grid-template-columns: repeat(3, 1fr); margin-bottom: 24px; }
.kpi-card-static { cursor: default; }
.kpi-card-static::after { display: none; }
.kpi-card-static:hover { border-color: var(--color-border); box-shadow: none; }

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}
.status-up { background: var(--color-success); }
.status-blocked { background: var(--color-warning); }
.status-down { background: var(--color-danger); }
.status-pending { background: var(--color-text-muted); }
.uptime-status-pill { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 3px; margin-left: 6px; }
.uptime-status-pill.status-down { background: rgba(248, 81, 73, 0.15); color: var(--color-danger); }
.uptime-status-pill.status-blocked { background: rgba(210, 153, 34, 0.15); color: var(--color-warning); }
.uptime-status-pill.status-pending { background: rgba(139, 148, 158, 0.15); color: var(--color-text-muted); }

.url-cell { word-break: break-all; max-width: 500px; }

/* Expandable uptime rows */
.uptime-expandable { cursor: pointer; }
.uptime-expandable:hover td { background: var(--color-bg-card); }
.uptime-expandable td:first-child::before {
  content: '\25B6'; /* right triangle */
  display: inline-block;
  font-size: var(--font-s);
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--color-text-muted);
}
.uptime-expandable.expanded td:first-child::before { transform: rotate(90deg); }
.uptime-alert-badge {
  display: inline-block;
  font-size: var(--font-s);
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}
.uptime-badge-disabled {
  background: rgba(248, 81, 73, 0.15);
  color: var(--color-danger);
}
.uptime-badge-snoozed {
  background: rgba(210, 153, 34, 0.15);
  color: var(--color-warning);
}
.resp-detail-row td { padding: 0 !important; border-top: none !important; }
.resp-detail-content {
  background: var(--color-bg-body);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  margin: 0 12px 12px;
  padding: 12px 16px;
}
.resp-detail-item {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-size: var(--font-l);
  border-bottom: 1px solid var(--color-bg-card);
}
.resp-detail-item:last-child { border-bottom: none; }
.resp-detail-label {
  color: var(--color-text-secondary);
  min-width: 100px;
  flex-shrink: 0;
  font-weight: 500;
}
.resp-header-name { color: var(--color-text-secondary); }
.resp-body-snippet {
  margin: 0;
  color: var(--color-text-secondary);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}

/* Textarea for config fields */
.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: monospace;
  font-size: var(--font-l);
  line-height: 1.5;
}

/* Usage section */
#section-usage .kpi-row, #section-usage .chart-row { margin-bottom: 24px; }
#section-usage .chart-row { grid-template-columns: 1fr 1fr; }

/* Admin pages */
.admin-form { margin-bottom: 24px; }
.admin-form h2 { margin-bottom: 12px; }
.admin-form-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.admin-form-row .form-input { flex: 1; min-width: 140px; }
.admin-form-row .btn { flex-shrink: 0; }
.admin-table { width: 100%; }
.admin-table th { text-align: left; font-size: var(--font-m); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }
.admin-table td { vertical-align: middle; }
.admin-actions { white-space: nowrap; }
.admin-actions .btn { margin-left: 8px; }
.admin-accounts-cell { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.account-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--color-border);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-card);
  padding: 2px 12px;
  font-size: var(--font-m);
  color: var(--color-text-tertiary);
}
.account-tag-remove {
  background: none;
  border: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: var(--font-l);
  padding: 0 2px;
  line-height: 1;
}
.account-tag-remove:hover { color: var(--color-danger); }
.admin-assign-account-select {
  background: transparent;
  border: 1px dashed var(--color-border-accent);
  border-radius: var(--radius-card);
  padding: 2px 8px;
  font-size: var(--font-m);
  color: var(--color-text-secondary);
  cursor: pointer;
}
.admin-assign-account-select:hover { border-color: var(--color-text-muted); }
.admin-role-badge {
  display: inline-block;
  font-size: var(--font-m);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
}
.admin-role-admin { background: rgba(31, 111, 235, 0.15); color: #58a6ff; }
.admin-role-user { background: rgba(139, 148, 158, 0.15); color: var(--color-text-secondary); }
.form-input-sm { padding: 4px 8px; font-size: var(--font-l); }
.admin-edit-role { padding: 4px 8px; font-size: var(--font-l); background: var(--color-bg-body); color: var(--color-text-tertiary); border: 1px solid var(--color-border-accent); border-radius: var(--radius-input); }

#orders-hourly-card {
  margin-bottom: 24px;
}

/* Orders KPI row */
.orders-kpi-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.kpi-card .kpi-sub {
  color: var(--color-text-secondary);
  margin-top: 4px;
}
.kpi-card .kpi-multi {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.kpi-card .kpi-multi .kpi-item {
  display: flex;
  flex-direction: column;
}
.kpi-card .kpi-multi .kpi-item .sub-label {
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}
.kpi-card .kpi-multi .kpi-item .sub-value {
  font-size: var(--font-xl);
  font-weight: 600;
  color: var(--color-text-primary);
}
/* Today vs avg KPI card layout */
.kpi-today-avg {
  display: flex;
  align-items: baseline;
  gap: 20px;
  margin-top: 4px;
}
.kpi-trend {
  align-self: center;
}
.kpi-primary {
  display: flex;
  flex-direction: column;
}
.kpi-primary-value {
  font-size: var(--font-xxl);
  font-weight: 700;
  color: var(--color-text-primary);
}
.kpi-primary-label {
  color: var(--color-text-secondary);
}
.kpi-secondary {
  display: flex;
  flex-direction: column;
}
.kpi-secondary-value {
  font-size: var(--font-xl);
  font-weight: 600;
  color: var(--color-text-secondary);
}
.kpi-secondary-label {
  color: #6e7681;
}
.kpi-mid {
  display: flex;
  flex-direction: column;
}
.kpi-mid-value {
  font-size: var(--font-xxl);
  font-weight: 600;
  color: var(--color-text-tertiary);
}
.kpi-mid-label {
  color: var(--color-text-secondary);
}
/* Breakdown stats table below charts */
.breakdown-table {
  width: 100%;
  margin-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: var(--font-l);
}
.breakdown-table th {
  text-align: right;
  color: var(--color-text-secondary);
  font-weight: 500;
  padding: 8px 8px;
  font-size: var(--font-m);
}
.breakdown-table th:first-child {
  text-align: left;
}
.breakdown-table td {
  padding: 4px 8px;
  border-top: 1px solid var(--color-border);
}
.breakdown-table td:first-child {
  color: var(--color-text-primary);
}
.breakdown-table td:not(:first-child) {
  text-align: right;
  color: var(--color-text-tertiary);
}
.breakdown-table .col-today {
  background: rgba(29, 109, 227, 0.08);
  color: #58a6ff;
}
.breakdown-table th.col-today {
  color: #58a6ff;
}
/* Hourly progress summary below charts */
.hourly-progress {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}
.hourly-progress .progress-label {
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.hourly-progress .progress-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.hourly-progress .progress-item {
  color: var(--color-text-tertiary);
}
.hourly-progress .progress-item strong {
  color: var(--color-text-primary);
}
.no-data {
  padding: 40px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: var(--font-l);
}
.no-data-alert {
  color: var(--color-danger);
  text-align: left;
  padding: 20px;
}
#sandbox-alert, #orders-alert, #code-versions-alert, #crux-alert {
  margin-bottom: 16px;
}
.order-alert-card {
  border-color: var(--color-brand);
  box-shadow: 0 2px 8px rgba(255,0,0,0.12);
}
.order-alert-link {
  display: block;
  text-decoration: none;
  cursor: pointer;
}
.order-alert-link:hover {
  opacity: 0.85;
}
.no-data-alert div:first-child {
  font-weight: 600;
  margin-bottom: 8px;
}
.order-issue-list {
  list-style: none;
  padding: 0;
  margin: 8px 0;
  color: var(--color-text-tertiary);
  font-size: var(--font-l);
}
.order-issue-list li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 0;
}
.order-issue-list li .status-dot {
  flex-shrink: 0;
  align-self: center;
}
.order-issue-list .issue-text {
  min-width: 0;
}
.order-issue-time {
  color: var(--color-text-secondary);
  margin-top: 8px;
  display: block;
}

.no-account {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  color: var(--color-text-secondary);
}
.no-account h1 { color: var(--color-text-primary); font-size: var(--font-xxl); margin-bottom: 8px; }
.no-account p { font-size: var(--font-l); }

/* Overview page */
.overview-section-title {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 24px 0 12px;
}
.overview-section-title.overall-title {
  margin-top: 0;
}
.crux-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding-bottom: 12px;
  margin-bottom: 0;
  cursor: pointer;
}
.crux-header-row.with-divider {
  border-top: 2px solid var(--color-brand);
  padding-top: 16px;
}
.crux-header-row .overview-section-title {
  margin: 0;
  font-size: var(--font-xl);
}
.crux-page-label { font-size: var(--font-l); color: var(--color-text-secondary); font-style: italic; font-weight: 400; text-transform: none; letter-spacing: normal; }
.crux-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.overview-title-date {
  font-weight: 400;
  color: var(--color-text-secondary);
  margin-left: 8px;
  letter-spacing: 0;
  text-transform: none;
}
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
#overview-kpi-row {
  margin-bottom: 0;
}
#overview-charts {
  margin-bottom: 0;
}

/* ── Settings / Configurations ── */
.settings-card {
  margin-top: 16px;
}
.logout-wrap {
  margin-top: 24px;
}
.settings-card > .form-section-title {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.settings-card > .collapsible-body:not(.collapsed) {
  padding-top: 16px;
}
.settings-toolbar {
  margin-bottom: 16px;
}
.settings-form {
  margin-bottom: 0;
}
.settings-form h2 {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: 20px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-label {
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--font-l);
  font-family: inherit;
  color: var(--color-text-primary);
  background: var(--color-bg-body);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
select.form-input {
  padding-right: 36px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='%238b949e'%3E%3Cpath d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.form-input:focus {
  border-color: var(--color-brand);
  box-shadow: 0 0 0 2px rgba(255, 0, 0, 0.2);
}
.form-input[readonly] {
  opacity: 0.5;
  cursor: not-allowed;
}
.form-input.input-error {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 2px rgba(248, 81, 73, 0.2);
}
.field-error {
  color: var(--color-danger);
  margin-top: 4px;
}
.form-section-title {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}
.form-section-title.collapsible {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title.collapsible:hover { color: var(--color-brand); }
.form-section-title.config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.config-header-label {
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Toggle switch */
.config-toggle {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
  cursor: pointer;
}
.config-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.config-toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border-accent);
  border-radius: 10px;
  transition: background 0.2s;
}
.config-toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--color-text-secondary);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.config-toggle input:checked + .config-toggle-track {
  background: rgba(255, 0, 0, 0.3);
}
.config-toggle input:checked + .config-toggle-track::after {
  transform: translateX(16px);
  background: var(--color-brand);
}

/* Vendor group labels */
.vendor-group-label {
  padding: 20px 0 4px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

/* Collectors interval table */
.collectors-intro { font-size: 13px; margin: 0 0 16px; }
.collectors-table { width: 100%; border-collapse: collapse; }
.collectors-table thead tr {
  text-align: left;
  font-size: 12px;
  border-bottom: 1px solid #21262d;
  color: var(--color-text-muted);
}
.collectors-table th { padding: 6px 12px; }
.collectors-table th.col-vendor { padding-left: 0; padding-right: 12px; width: 100px; }
.collectors-table td.cell-vendor { font-weight: 500; }
.collectors-table td.cell-default { color: #6e7681; font-size: 12px; }
.collectors-input {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: var(--color-bg-body);
  color: var(--color-text-primary);
  font-size: 13px;
}
.collectors-unit { margin-left: 4px; }
.collectors-actions { margin-top: 16px; display: flex; gap: 8px; }
.collectors-actions > button { padding: 6px 16px; }

/* No-data variants for tighter contexts */
.no-data.compact { padding: 8px 0; }
.no-data.padded { padding: 12px 0; }
.no-data.centered { padding: 24px; text-align: center; }

/* Inline icon used inside button/label text */
.icon-inline { vertical-align: -2px; }

/* Uptime monitoring rows — domain editor + custom-headers toggle/textarea */
.uptime-domain-row { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.uptime-url-row { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.uptime-row-line { display: flex; gap: 8px; align-items: center; }
.uptime-header-toggle {
  font-size: 11px;
  padding: 2px 6px;
  white-space: nowrap;
  margin-left: auto;
  color: var(--color-text-muted);
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-accent);
  border-radius: 4px;
}
.uptime-header-input {
  font-size: 12px;
  font-family: monospace;
  resize: vertical;
}

/* CrUX site discovery row + footer + group editor */
.crux-discover-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.crux-discover-btn { font-size: 12px; display: flex; align-items: center; gap: 6px; }
.crux-discover-status { font-size: 12px; color: var(--color-text-muted); }
.crux-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; margin-top: 8px; }
.add-group-link {
  background: none;
  border: none;
  color: #388bfd;
  cursor: pointer;
  font-size: 13px;
  padding: 0;
}
.crux-total-count { font-size: 12px; }
.crux-group-suggestions { font-size: 11px; color: #6e7681; padding-bottom: 4px; }
.crux-group-name {
  font-weight: 600;
  border: none;
  background: transparent;
  color: #e6edf3;
  font-size: 14px;
  padding: 2px 0;
  width: 200px;
}
.crux-group-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.btn-remove-group { font-size: 12px; color: var(--color-danger); padding: 4px 10px; }

/* Per-site fallback note */
.per-site-note { font-size: var(--font-m); margin: 0; }
/* "(not configured)" hint inside a channel label */
.channel-not-configured { font-size: 11px; }

/* Disabled config card */
.settings-card.config-disabled {
  opacity: 0.5;
}
.settings-card.config-disabled .config-header-label {
  cursor: default;
}
.settings-card.config-disabled .config-header-label:hover {
  color: var(--color-text-primary);
}
.collapse-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s;
}
.form-section-title.open .collapse-caret,
.config-header-label.open .collapse-caret {
  transform: rotate(-135deg);
  border-color: var(--color-brand);
}
/* Collapsible sections */
.collapsible-heading {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 32px;
  margin-bottom: 12px;
  padding: 0;
}
.collapsible-heading-right { display: flex; align-items: center; gap: 10px; }
.collapsible-heading .collapse-caret {
  border-color: var(--color-text-secondary);
}
.collapsible-heading.open .collapse-caret {
  transform: rotate(-135deg);
}
.collapsible-heading:hover { color: #ffffff; }
.collapsible-heading:hover .collapse-caret { border-color: var(--color-text-primary); }
.collapsible-body { opacity: 1; transition: max-height 0.4s ease, opacity 0.3s ease; overflow: hidden; }
.collapsible-body.collapsed,
.collapsible-heading + .collapsible-body:not(.open) { max-height: 0; opacity: 0; overflow: hidden; }
.collapsible-heading + .collapsible-body.open { max-height: 2000px; opacity: 1; }
.crux-section {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--color-bg-body);
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
/* Site cards (inline editing) */
.site-card {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  margin-top: 12px;
  overflow: hidden;
  background-color: #362e2e;
}
.site-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
}
.site-card-header::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-right: 2px solid var(--color-text-muted);
  border-bottom: 2px solid var(--color-text-muted);
  transform: rotate(-45deg);
  transition: transform 0.2s;
  margin-left: auto;
  margin-right: 8px;
  pointer-events: none;
}
.site-card-header.open::after {
  transform: rotate(45deg);
  border-color: var(--color-brand);
}
.site-card-header[data-toggle="crux"] .site-card-info {
  font-size: var(--font-l);
  color: var(--color-text-secondary);
}
.site-card-header[data-toggle="crux"] {
  position: relative;
}
.site-card-header[data-toggle="crux"]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 1px;
  background: var(--color-brand);
}
.site-card-header:hover { background-color: #523b3b }
.site-card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.site-card-name { color: var(--color-text-secondary); }
.site-card-section {
  padding: 16px;
  border-top: 1px solid var(--color-border);
}
.site-card-section.collapsed {
  display: none;
}
.site-card-actions-bar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 0 4px;
}

.crux-section-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.crux-section-label {
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-primary);
}
.crux-section-hint {
  color: var(--color-text-muted);
}
.crux-url-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 32px;
}
.crux-url-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.crux-url-row .form-input {
  flex: 1;
}
.crux-url-row .drag-handle {
  cursor: grab;
  color: var(--color-text-muted);
  font-size: 14px;
  user-select: none;
  padding: 0 2px;
  opacity: 0.5;
}
.crux-url-row .drag-handle:hover { opacity: 1; }
.crux-url-row.dragging { opacity: 0.4; }
.uptime-url-card { background: #362e2e; border: 1px solid var(--color-border); border-radius: 8px; padding: 10px 12px; }
.crux-url-list.drag-over {
  outline: 2px dashed var(--color-brand);
  outline-offset: 2px;
  border-radius: 4px;
  min-height: 24px;
}
.btn-remove {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--font-xl);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
}
.btn-remove:hover {
  color: var(--color-danger);
  background: rgba(248, 81, 73, 0.1);
}
.add-url-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--color-text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}
.add-url-link:hover {
  color: var(--color-text-primary);
}
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}
.btn-primary {
  padding: 8px 20px;
  font-size: var(--font-l);
  font-weight: 600;
  color: #ffffff;
  background: var(--color-brand);
  border: none;
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: inherit;
}
.btn-primary:hover {
  background: #cc0000;
}
.btn-danger {
  padding: 8px 20px;
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-danger);
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover {
  background: rgba(248, 81, 73, 0.2);
}
.btn-ghost {
  padding: 8px 20px;
  font-size: var(--font-l);
  font-weight: 600;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover:not(.disabled):not(:disabled) {
  color: var(--color-text-primary);
  border-color: var(--color-text-muted);
}
.btn-ghost.disabled, .btn-ghost:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-sm {
  padding: 4px 12px;
  font-size: var(--font-m);
}
.site-list-actions {
  display: flex;
  gap: 6px;
}
.config-group {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-brand);
}
.config-group:first-child {
  margin-top: 24px;
}
.config-group:last-child,
.config-group.last {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.site-platform-config > .config-group:last-child,
.site-crux-config > .config-group:last-child {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--color-brand);
}
/* Hide border on the last config-group before the save button in site cards */
.settings-form > :nth-last-child(2) > .config-group,
.settings-form > .config-group:nth-last-child(2) {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.config-group-label {
  font-size: var(--font-l);
  font-weight: 600;
  color: #e5e5e7;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.site-crux-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-crux-toggle .collapse-caret {
  margin-top: -2px;
}
.site-crux-toggle.open .collapse-caret {
  transform: rotate(-135deg);
  border-color: var(--color-brand);
}
.config-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.form-group-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.form-label-inline {
  font-size: var(--font-l);
  color: #e5e5e7;
  white-space: nowrap;
  min-width: 140px;
}
.form-group-inline .form-input {
  flex: 1;
}
.form-group-inline .field-error {
  width: 100%;
  padding-left: 152px;
}

/* Login page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg-body);
}
.login-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  display: block;
  width: 160px;
  margin: 0 auto 24px;
}
.login-card h2 {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  text-align: center;
  margin-bottom: 24px;
}
.login-card .form-group { margin-bottom: 16px; }
.login-card .form-label { display: block; margin-bottom: 8px; }
.login-btn {
  width: 100%;
  padding: 12px 16px;
  font-size: var(--font-l);
  font-weight: 600;
  font-family: inherit;
  color: var(--color-bg-body);
  background: #ffffff;
  border: none;
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: opacity 0.15s;
  margin-top: 8px;
}
.login-btn:hover { opacity: 0.85; }
.login-error {
  color: var(--color-danger);
  font-size: var(--font-l);
  margin-bottom: 8px;
  text-align: center;
}
.forgot-link { display: block; text-align: center; margin-top: 12px; color: var(--color-accent); font-size: var(--font-l); text-decoration: none; }
.forgot-link:hover { text-decoration: underline; }
.terms-link { display: block; text-align: center; margin-top: 8px; color: var(--color-text-muted); font-size: var(--font-m); text-decoration: none; }
.terms-link:hover { color: var(--color-text-secondary); text-decoration: underline; }
.nav-terms-link { display: block; padding: 8px 20px; color: var(--color-text-muted); font-size: var(--font-m); text-decoration: none; }
.nav-terms-link:hover { color: var(--color-text-secondary); }
.nav-beta-badge { display: inline-block; background: rgba(210, 153, 34, 0.15); color: var(--color-warning); padding: 1px 6px; border-radius: 3px; font-size: 10px; font-weight: 700; letter-spacing: 0.5px; }
.forgot-desc { color: var(--color-text-secondary); font-size: var(--font-l); margin: 0 0 16px; text-align: center; line-height: 1.5; }
.forgot-success { color: var(--color-success); font-size: var(--font-l); margin-bottom: 8px; text-align: center; line-height: 1.5; }
.forgot-success a { color: var(--color-accent); }

/* Account picker */
.account-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-pick-btn {
  display: block;
  padding: 12px 16px;
  font-size: var(--font-l);
  font-weight: 500;
  color: var(--color-text-primary);
  background: var(--color-bg-body);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-input);
  text-decoration: none;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.account-pick-btn:hover {
  border-color: var(--color-brand);
  background: var(--color-bg-hover);
}

/* Bottom nav separator (Profile, Settings, Admin) */
.nav-group-bottom {
  border-top: 1px solid var(--color-border);
  margin-top: 8px;
  padding-top: 8px;
}
/* Logout */
.nav-group-logout {
  margin-top: auto;
  border-top: 1px solid var(--color-border);
  padding-top: 8px;
}
.nav-logout {
  width: auto;
  padding: 8px 16px;
  color: var(--color-text-secondary);
  font-size: var(--font-l);
}
.nav-logout:hover {
  color: var(--color-danger);
  background: transparent;
}

/* Overview cards */
.overview-status-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.overview-status-main {
  flex: 2;
  margin-bottom: 0 !important;
}
.overview-status-side {
  flex: 1;
  margin-bottom: 0 !important;
}
.overview-group {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}
.overview-group > .overview-cards { flex: 1; }
.overview-group-title {
  font-size: var(--font-l);
  font-weight: 600;
  color: #f5f0e8;
  margin-bottom: 16px;
}
.overview-group .card.table-card {
  margin-bottom: 0;
  border: none;
  padding: 0;
  background: none;
}
.overview-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.overview-cards-half {
  grid-template-columns: repeat(2, 1fr);
}
.overview-card {
  display: block;
  background: var(--color-bg-body);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px;
  color: var(--color-text-primary);
}
.overview-card-alert {
  border-color: var(--color-brand);
}
.overview-card-title {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  margin-bottom: 12px;
}
.overview-card-status {
  font-size: var(--font-xl);
  font-weight: 600;
  margin-bottom: 4px;
}
.overview-card-status-ok {
  color: var(--color-success);
}
.overview-card-status-alert {
  color: var(--color-danger);
}
.overview-card-count {
  font-size: var(--font-l);
  color: var(--color-text-secondary);
}
.overview-card-down-list {
  list-style: none;
  margin-top: 12px;
  font-size: var(--font-l);
  color: var(--color-text-primary);
}
.overview-card-down-list li {
  display: flex;
  align-items: center;
  padding: 4px 0;
  word-break: break-all;
}

/* Config page section headings */
.config-section-heading {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin: 24px 0 8px;
}
.config-section-heading:first-child {
  margin-top: 0;
}

/* Read-only CrUX overall section */
.crux-section-readonly input[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
  background: var(--color-bg-card);
}

/* Auto-tracked domains in uptime config */
.auto-domains-info {
  padding: 8px 0;
}
.auto-domain-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  margin-bottom: 4px;
  font-size: var(--font-l);
}
.auto-domain-url {
  color: var(--color-text-tertiary);
  font-family: monospace;
}
.auto-domain-site {
  color: var(--color-text-secondary);
}

/* ── Hamburger (hidden on desktop) ── */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 5px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text-primary);
  border-radius: 1px;
}
.mobile-header {
  display: none;
}
.sidebar-overlay {
  display: none;
}

/* ── Tablet / narrow desktop ── */
@media (max-width: 1200px) {
  .kpi-row,
  .url-row-expand .kpi-row,
  #section-uptime .kpi-row,
  .inventory-kpi-row,
  .orders-kpi-row,
  .chart-row,
  .credits-row,
  .overview-cards,
  .overview-cards-half {
    grid-template-columns: 1fr;
  }
  .chart-row.half-row {
    grid-template-columns: 1fr;
  }
  .overview-status-row {
    flex-direction: column;
  }
  .table-card th,
  .table-card td { white-space: nowrap; }
}

/* ── Mobile Responsive ── */
/* Site Alert Configurations — when the configs body becomes narrow enough
   that the chart and controls would no longer fit side-by-side, the controls
   wrap below; in that single-column state, stretch them to full width.
   Uses a container query so this responds to the panel's actual size, not
   just the viewport (avoids breaking when the sidebar is open vs collapsed). */
#alert-configs-body {
  container-type: inline-size;
  container-name: alert-configs;
}
@container alert-configs (max-width: 760px) {
  #stall-threshold-controls {
    width: 100% !important;
  }
}

@media (max-width: 768px) {
  /* Mobile header bar */
  .mobile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-brand);
  }
  .mobile-logo {
    height: 28px;
    width: auto;
  }
  .hamburger { display: flex; }
  .sidebar .sidebar-logo-wrap { display: none; }

  /* Sidebar → slide-out overlay */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .sidebar-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Main content */
  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  /* Header — page title row */
  .header {
    flex-wrap: wrap;
    gap: 8px;
    border-bottom: none;
    padding-bottom: 8px;
    margin-bottom: 16px;
  }
  .header h1 { font-size: var(--font-xl); }

  /* All grids → single column */
  .kpi-row,
  .url-row-expand .kpi-row,
  #section-uptime .kpi-row,
  .chart-row,
  .credits-row,
  .form-row {
    grid-template-columns: 1fr;
  }
  .orders-kpi-row {
    grid-template-columns: 1fr;
  }


  /* URL rows — no expand on mobile */
  .url-row { flex-wrap: wrap; pointer-events: none; cursor: default; }
  .url-row .url-external-link { pointer-events: auto; }
  .url-row::after { display: none; }
  .url-row:hover { border-color: var(--color-border); box-shadow: none; }
  .url-row .url-path { width: auto; min-width: 0; flex: 1 1 100%; }
  .url-row .url-metrics { flex: 1 1 100%; flex-wrap: wrap; gap: 8px 16px; }
  .url-row-expand { display: none !important; }
  .url-external-link { margin-right: 0; }

  /* Cards — no expand on mobile */
  .kpi-card { pointer-events: none; cursor: default; }
  .kpi-card::after { display: none; }
  .kpi-card:hover { border-color: var(--color-border); box-shadow: none; }
  .card.clickable,
  .card.card-expandable { pointer-events: none; cursor: default; }
  .card.clickable::after,
  .card.card-expandable::after { display: none; }
  .card.clickable:hover,
  .card.card-expandable:hover { border-color: var(--color-border); box-shadow: none; }
  .trend-expand { display: none; }

  /* Filter rows — reduce top margin */
  .filter-row-sticky { margin-top: 16px; }

  /* Cards — reduce padding on mobile */
  .card { padding: 16px; }
  .card h2 .badge { margin-right: 0; }

  /* Fixed-width elements */
  .ff-bar { width: 100% !important; max-width: 200px; }
  .cartridges { max-width: none; }
  .url-cell { max-width: none; word-break: normal; }
}

/* Alerts */
.priority-badge {
  display: inline-block;
  font-size: var(--font-m);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  line-height: 1;
}
.priority-p1 { background: rgba(248, 81, 73, 0.15); color: var(--color-danger); }
.priority-p2 { background: rgba(210, 153, 34, 0.15); color: var(--color-warning); }
.priority-info { background: rgba(56, 139, 253, 0.15); color: #388bfd; }
.priority-resolved { background: rgba(139, 148, 158, 0.15); color: #ffffff; }
.alerts-table { width: 100%; min-width: 700px; }
.alerts-table col:nth-child(1),
.alerts-table col:nth-child(2) { width: 80px; }
.alerts-table col:nth-child(3),
.alerts-table col:nth-child(5),
.alerts-table col:nth-child(6) { width: 140px; }
.cols-product col:nth-child(1) { width: 140px; }
.cols-product col:nth-child(3) { width: 90px; }
.cols-product col:nth-child(4) { width: 100px; }
.cols-product col:nth-child(5) { width: 110px; }
.cols-product col:nth-child(6) { width: 140px; }
.cols-product col:nth-child(7) { width: 120px; }
.cols-product col:nth-child(8) { width: 130px; }
.alert-card-open { border: 3px solid var(--color-brand); }
.alert-card-info { border: 3px solid #388bfd; }
.alert-card-heading-toggle {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  margin-bottom: 16px;
}
.alert-card-heading-toggle.collapsed {
  margin-bottom: -4px;
}
.alert-card-heading-toggle .nav-section-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  transition: transform 0.2s;
}
.alert-card-heading-toggle.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}
.alert-card-body {
  overflow: hidden;
  max-height: 2000px;
  transition: max-height 0.3s ease-in-out;
}
.alert-card-body.collapsed {
  max-height: 0;
}

.alert-history-list { flex: 1; }
.alert-history-event { padding: 2px 0; font-size: var(--font-l); color: var(--color-text-tertiary); display: flex; align-items: center; }
.alert-history-event.expandable { cursor: pointer; }
.alert-history-event.expandable:hover { color: #ffffff; }
.alert-history-toggle-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  flex-shrink: 0;
}
.alert-history-toggle {
  display: inline-block;
  font-size: var(--font-s);
  color: var(--color-text-muted);
  transition: transform 0.15s;
}
.alert-history-toggle::before { content: '\25B6'; }
.alert-history-event.expanded .alert-history-toggle { transform: rotate(90deg); }
.alert-history-text { margin-left: 6px; }
.alert-history-details {
  margin-left: 16px;
  margin-bottom: 4px;
  padding: 8px 0;
  border-left: 2px solid var(--color-border);
  padding-left: 12px;
}
.alert-history-details .resp-detail-item { padding: 2px 0; font-size: var(--font-m); }
.alert-history-details .resp-detail-label { min-width: 90px; font-size: var(--font-m); }
.resp-detail-item-history { align-items: flex-start; }

.alerts-incident-row { cursor: pointer; }
.alerts-incident-row:hover td { background: var(--color-bg-card); }
.alerts-incident-row td:first-child::before {
  content: '\25B6';
  display: inline-block;
  font-size: var(--font-s);
  margin-right: 8px;
  transition: transform 0.15s;
  color: var(--color-text-muted);
}
.alerts-incident-row.expanded td:first-child::before { transform: rotate(90deg); }
.alert-event-log-row td { padding: 0 !important; border-top: none !important; }

/* Snooze inline controls */
.snooze-cell { white-space: nowrap; }
.snooze-duration-inline { background: var(--color-bg-card); color: var(--color-text-secondary); border: 1px solid var(--color-border-accent); border-radius: 4px; padding: 2px 4px; font-size: var(--font-m); cursor: pointer; margin-right: 4px; }
.snooze-inline-btn, .unsnooze-inline-btn, .enable-inline-btn { border: none; font-size: var(--font-l); cursor: pointer; padding: 2px 8px; border-radius: 4px; transition: color 0.15s, background 0.15s; }
.unsnooze-inline-btn, .enable-inline-btn { padding: 1px 1px 0px 4px; font-size: var(--font-m); margin-left: 4px;}
.snooze-inline-btn { background: rgba(210, 153, 34, 0.2); color: var(--color-warning); }
.snooze-inline-btn.disable-action { background: rgba(248, 81, 73, 0.2); color: var(--color-danger); }
.snooze-inline-btn:hover { color: #fff; background: rgba(210, 153, 34, 0.45); }
.snooze-inline-btn.disable-action:hover { color: #fff; background: rgba(248, 81, 73, 0.45); }
.unsnooze-inline-btn:hover, .enable-inline-btn:hover { color: var(--color-success); background: rgba(63, 185, 80, 0.15); }
.snooze-inline-btn:disabled, .unsnooze-inline-btn:disabled, .enable-inline-btn:disabled { opacity: 0.4; cursor: default; }
.snooze-status { font-size: var(--font-m); color: var(--color-warning); }
.snooze-status.disabled-status { color: var(--color-danger); }
.status-dot.status-snoozed { background: var(--color-warning); }
.status-dot.status-unsnoozed { background: #58a6ff; }
.status-dot.status-disabled { background: var(--color-brand); }
.status-dot.status-enabled { background: #58a6ff; }
.status-dot.status-notified { background: #a371f7; }

.alert-card-subtitle { margin: -4px 0 8px; color: var(--color-text-secondary); font-weight: 400; }

/* Alert config table (settings page) */
/* Alert config cards */
.alert-cfg-group { margin-bottom: 24px; }
.alert-cfg-group-label { font-size: var(--font-l); color: var(--color-text-primary); margin: 0; font-weight: 600; cursor: pointer; user-select: none; display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.alert-cfg-group-label:hover { color: var(--color-brand); }
.alert-cfg-group-chevron { width: 14px; height: 14px; color: var(--color-text-muted); transform: rotate(90deg); transition: transform 0.2s; flex: none; }
.alert-cfg-group.collapsed .alert-cfg-group-chevron { transform: rotate(0deg); }
.alert-cfg-group-body { margin-top: 16px; }
.alert-cfg-group.collapsed .alert-cfg-group-body { display: none; }
.alert-cfg-card { border: 1px solid var(--color-border); border-radius: 8px; margin-top: 12px; overflow: hidden; background-color: #362e2e; }
.alert-cfg-card .alert-cfg-header:hover { background-color: #523b3b; }
/* Channel tabs inside an alert config card */
.alert-cfg-channels-tabs { display: flex; gap: 2px; margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--color-border); background: #1c2128; padding-left: 16px; padding-right: 16px; flex-wrap: wrap; border-radius: 8px 8px 0 0; }
.alert-cfg-channels-tabs.no-fields-above { margin-top: 0; border-top: none; padding-top: 0; }
.alert-cfg-channel-tab { background: transparent; border: none; padding: 10px 16px; cursor: pointer; color: var(--color-text-secondary); font-size: var(--font-m); border-radius: 6px 6px 0 0; display: flex; align-items: center; gap: 6px; }
.alert-cfg-channel-tab:hover { color: var(--color-text-primary); background: rgba(255,255,255,0.04); }
.alert-cfg-channel-tab.active { color: var(--color-text-primary); background: #0d1117; }
.alert-cfg-channel-tab.has-config { color: var(--color-text-primary); }
.alert-cfg-channel-tab .tab-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--color-good); margin-left: 4px; }
.alert-cfg-channel-tab.disabled { opacity: 0.5; cursor: not-allowed; }
.alert-cfg-channels-panels { background: #0d1117; padding: 16px; border-radius: 0 0 8px 8px; }
.alert-cfg-channel-panel { display: none; }
.alert-cfg-channel-panel.active { display: block; }
/* Override the standalone channel styling when inside tab panels — no border/bg needed */
.alert-cfg-channel-panel .alert-cfg-channel { padding: 0; background: transparent; border: none; }
.alert-cfg-channel-panel .alert-cfg-channel-header { justify-content: flex-start; gap: 12px; }
.alert-cfg-channel-panel .alert-cfg-channel-header .alert-cfg-channel-label { min-width: 140px; white-space: nowrap; }
.alert-cfg-channel-panel .alert-cfg-channel-fields { border-top: none; padding-top: 12px; margin-top: 0; }
.alert-cfg-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; cursor: pointer; user-select: none; }
.alert-cfg-header:hover { background: rgba(255,255,255,0.03); }
.alert-cfg-header-left { display: flex; align-items: center; gap: 10px; }
.alert-cfg-header-right { display: flex; align-items: center; gap: 8px; }
.alert-cfg-label { color: var(--color-text-primary); font-weight: 500; font-size: var(--font-l); }
.alert-cfg-detail { margin-bottom: 16px; margin-left: 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.alert-cfg-detail-text { flex: 1; min-width: 0; }
.alert-cfg-detail .alert-priority-select { flex: none; margin-top: 10px; }
.alert-cfg-body > .config-fields { margin-left: 12px; }
.alert-cfg-key { display: none; font-size: var(--font-l); color: var(--color-text-muted); font-family: monospace; margin-bottom: 6px; }
.alert-cfg-channel-badge { display: inline-block; font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 3px; background: rgba(139, 148, 158, 0.15); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: 0.3px; }
.alert-cfg-header .nav-section-chevron { width: 14px; height: 14px; color: var(--color-text-muted); transition: transform 0.2s; transform: rotate(-90deg); flex-shrink: 0; }
.alert-cfg-header.open .nav-section-chevron { transform: rotate(90deg); color: var(--color-brand); }
.alert-cfg-body { padding: 0 24px 20px; border-top: 1px solid var(--color-border) }
.alert-cfg-body.collapsed { display: none; }
.alert-cfg-desc { color: var(--color-text-primary); font-size: var(--font-l); margin: 0; line-height: 1.5; padding: 10px 0 20px }
.alert-cfg-threshold { margin-top: 8px; }
.alert-cfg-card .config-fields .form-label-inline { min-width: 220px; }
.alert-cfg-channels { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.alert-cfg-channel { padding: 8px 12px; background: #362e2e; border: 1px solid var(--color-border); border-radius: 6px; }
.alert-cfg-channel-header { display: flex; align-items: center; justify-content: space-between; }
.alert-cfg-channel-header .alert-cfg-channel-label { display: flex; align-items: center; gap: 8px; }
.alert-cfg-channel-label { font-size: var(--font-l); color: var(--color-text-primary); font-weight: 500; }
.alert-cfg-channel-fields { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--color-border); }
.alert-cfg-field-warn { display: block; font-size: 11px; color: var(--color-warning); margin-top: 4px; padding-left: 152px; }
.alert-cfg-channel-fields .form-input { flex: 1; }
.alert-cfg-channel-fields .alert-notify-teams-dest { flex: 1; }
.alert-notify-select { background: var(--color-bg-body); color: var(--color-text-primary); border: 1px solid var(--color-border-accent); border-radius: var(--radius-input); padding: 4px 8px; font-size: var(--font-l); cursor: pointer; }
.alert-priority-select { background: var(--color-bg-card); color: var(--color-text-secondary); border: 1px solid var(--color-border-accent); border-radius: 4px; padding: 2px 4px; font-size: var(--font-m); cursor: pointer; }
.alert-notify-teams-dest { background: var(--color-bg-body); color: var(--color-text-primary); border: 1px solid var(--color-border-accent); border-radius: var(--radius-input); padding: 2px 4px; font-size: var(--font-l); }
.alert-notify-teams-dest option { padding: 2px 6px; }
.alert-notify-teams-dest option:checked { background: rgb(118, 3, 3); color: #fff; }

.text-muted { color: var(--color-text-secondary); }

.overview-card-down-list .priority-badge { margin-right: 4px; }

/* Dashboard loading indicator */
.dashboard-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 120px 20px; gap: 20px; }
.loading-label { font-size: var(--font-xl); font-weight: 700; color: var(--color-text-primary); letter-spacing: 2px; }
.loading-bar-track { width: 260px; height: 24px; background: var(--color-bg-card); border: 2px solid var(--color-border-accent); border-radius: 4px; overflow: hidden; padding: 4px; }
.loading-bar-fill { height: 100%; width: 40%; background: repeating-linear-gradient(90deg, var(--color-brand) 0px, var(--color-brand) 12px, #5c0000 12px, #5c0000 16px); border-radius: 2px; animation: loading-slide 1.2s ease-in-out infinite; }
.dashboard-loading-inline { padding: 60px 20px; }
.dashboard-loading-inline .loading-label { font-size: var(--font-xl); }
.dashboard-loading-inline .loading-bar-track { width: 200px; height: 20px; }
@keyframes loading-slide { 0% { margin-left: 0; width: 0%; } 50% { margin-left: 0; width: 100%; } 100% { margin-left: 100%; width: 0%; } }

/* Modal overlay (used by admin Database edit dialog) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-accent);
  border-radius: var(--radius-card);
  padding: 24px;
  width: 480px;
  max-width: 90vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}
.modal-card h3 {
  color: var(--color-text-primary);
  margin: 0 0 12px;
  font-size: var(--font-l);
}
