html[data-theme],
body {
  --primary: #22c55e;
  --secondary: #38bdf8;
  --body-bg: #020617;
  --body-fg: #e5e7eb;
  --body-quiet-color: #b6c2d2;
  --body-loud-color: #f8fafc;
  --breadcrumbs-bg: #020617;
  --link-fg: #7dd3fc;
  --link-hover-color: #e0f2fe;
  --hairline-color: rgba(148, 163, 184, 0.18);
  --darkened-bg: #020617;
  --selected-bg: rgba(56, 189, 248, 0.14);
}

body {
  background: #020617;
  color: #e5e7eb;
  font-family: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  text-rendering: optimizeLegibility;
}

#header {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: 5rem;
  align-items: center;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  color: #e5e7eb;
  border-bottom: 1px solid rgba(56, 189, 248, 0.22);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
  transition: min-height 160ms ease, padding 160ms ease, box-shadow 160ms ease;
}

#container {
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.08), transparent 28rem),
    #020617;
}

#content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.25rem;
}

#content-main,
.module,
.inline-group,
#changelist,
.paginator,
.submit-row,
.breadcrumbs {
  border-color: rgba(148, 163, 184, 0.18) !important;
}

#branding h1,
#branding h1 a:link,
#branding h1 a:visited {
  color: #e5e7eb;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

#branding {
  display: flex;
  align-items: center;
}

.admin-brand {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
}

.admin-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #e5e7eb;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 0;
}

.admin-logo {
  display: block;
  width: 132px;
  height: auto;
  max-height: 42px;
  object-fit: contain;
  border: none;
  background: transparent;
  transition: width 160ms ease, max-height 160ms ease;
}

.admin-brand-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.32rem;
}

.admin-sidebar-toggle {
  border-color: rgba(56, 189, 248, 0.36);
  white-space: nowrap;
}

.admin-sidebar-toggle-brand {
  padding: 0.24rem 0.52rem;
  font-size: 0.7rem;
  line-height: 1.1;
}

.admin-theme-toggle-brand {
  width: auto;
  min-height: 1.75rem;
  margin-top: 0;
  padding: 0.22rem 0.52rem;
  font-size: 0.7rem;
  line-height: 1.1;
  white-space: nowrap;
}

body.admin-header-compact #header {
  min-height: 3.35rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

body.admin-header-compact .admin-logo {
  width: 96px;
  max-height: 30px;
}

body.admin-header-compact .admin-brand-actions {
  gap: 0.24rem;
}

body.admin-header-compact .admin-sidebar-toggle-brand,
body.admin-header-compact .admin-theme-toggle-brand {
  min-height: 1.55rem;
  padding: 0.18rem 0.42rem;
  font-size: 0.66rem;
}

body.admin-sidebar-collapsed #nav-sidebar,
body.admin-sidebar-collapsed .nav-sidebar,
body.admin-sidebar-collapsed [data-nav-sidebar],
body.admin-sidebar-collapsed aside.sidebar,
body.admin-sidebar-collapsed #toggle-nav-sidebar,
body.admin-sidebar-collapsed .toggle-nav-sidebar {
  display: none !important;
}

body.admin-sidebar-collapsed #content {
  max-width: min(1680px, calc(100vw - 2rem));
}

body.admin-sidebar-collapsed #main,
body.admin-sidebar-collapsed .main,
body.admin-sidebar-collapsed #content-main {
  margin-left: 0 !important;
}

.admin-top-links {
  display: flex;
  gap: 0.55rem;
  align-items: center;
  flex-wrap: wrap;
}

.admin-btn {
  color: #e5e7eb;
  text-decoration: none;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 0.4rem 0.78rem;
  background: rgba(15, 23, 42, 0.72);
  font-size: 0.82rem;
  line-height: 1.25;
  cursor: pointer;
}

.admin-btn:hover {
  border-color: #38bdf8;
  color: #dbeafe;
}

#user-tools {
  color: #b6c2d2;
  font-size: 0.82rem;
  line-height: 1.45;
}

#user-tools a {
  color: #bfdbfe;
  border-bottom-color: rgba(191, 219, 254, 0.28);
}

.breadcrumbs {
  background: rgba(2, 6, 23, 0.78);
  color: #b6c2d2;
  padding: 0.65rem 1rem;
}

.breadcrumbs a {
  color: #7dd3fc;
}

.module,
#changelist,
.inline-group,
fieldset.module,
.submit-row {
  background: rgba(2, 6, 23, 0.64);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  overflow: hidden;
}

.module h2,
.module caption,
.inline-group h2,
#changelist-filter h2 {
  background: rgba(15, 23, 42, 0.94);
  color: #e0f2fe;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0;
}

#content h1 {
  color: #f8fafc;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: 0;
  font-family: "Space Grotesk", "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

a:link,
a:visited {
  color: #7dd3fc;
}

a:hover,
a:focus {
  color: #e0f2fe;
}

table {
  background: rgba(2, 6, 23, 0.54);
  color: #e5e7eb;
}

thead th,
tfoot td {
  background: rgba(15, 23, 42, 0.96);
  color: #cbd5e1;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

tbody tr {
  background: rgba(2, 6, 23, 0.36);
}

tbody tr:nth-child(even),
.row2 {
  background: rgba(15, 23, 42, 0.46);
}

td,
th {
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.row1 {
  background: rgba(2, 6, 23, 0.36);
}

#changelist .actions,
#toolbar,
#changelist-filter,
#changelist-form .results,
.filtered #changelist .actions {
  background: rgba(2, 6, 23, 0.58);
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.18);
}

#changelist-filter {
  border-left: 1px solid rgba(148, 163, 184, 0.18);
}

#changelist-filter li.selected {
  border-left-color: #38bdf8;
}

#changelist-filter a {
  color: #cbd5e1;
}

#changelist-filter li.selected a {
  color: #e0f2fe;
}

input,
textarea,
select,
.vTextField {
  background: #020617 !important;
  color: #e5e7eb !important;
  border: 1px solid #334155 !important;
  border-radius: 8px !important;
}

input:focus,
textarea:focus,
select:focus,
.vTextField:focus {
  border-color: #38bdf8 !important;
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.22);
  outline: none;
}

label,
.form-row label,
.aligned label,
.help,
p.help,
div.help,
form .aligned p.help {
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.48;
}

.object-tools a,
.object-tools a:link,
.object-tools a:visited,
.addlink,
.changelink,
.deletelink {
  border-radius: 8px;
}

.object-tools a,
.object-tools a:link,
.object-tools a:visited {
  background: linear-gradient(90deg, #15803d, #22c55e);
  color: #ecfdf5;
}

.submit-row {
  background: rgba(2, 6, 23, 0.74);
}

.errornote,
ul.errorlist {
  background: rgba(127, 29, 29, 0.22);
  border-color: rgba(248, 113, 113, 0.34);
  color: #fecaca;
}

.messagelist li {
  border-radius: 8px;
  background: rgba(22, 163, 74, 0.16);
  color: #bbf7d0;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.ops-dashboard {
  display: flow-root;
  clear: both;
  position: relative;
  z-index: 0;
  margin: 0 0 1.35rem;
  padding: 0.9rem;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: radial-gradient(circle at top left, #0f172a, #020617);
}

.ops-dashboard + .ops-dashboard,
.ops-dashboard + .suite-dashboard,
.suite-dashboard + .ops-dashboard {
  margin-top: 1.75rem;
}

.ops-dashboard.admin-section + .ops-dashboard.admin-section {
  margin-top: 2.25rem;
}

.ops-dashboard .collapsible-body {
  display: flow-root;
}

#mobile-fleet {
  clear: both;
  position: relative;
  z-index: 1;
  margin-top: 2.5rem;
}

.ops-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.ops-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #e2e8f0;
}

.ops-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.ops-kpi {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(2, 6, 23, 0.54);
}

.ops-label {
  margin: 0;
  font-size: 0.8rem;
  color: #b6c2d2;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.ops-value {
  margin: 0.25rem 0 0;
  font-size: 0.95rem;
  color: #e2e8f0;
  font-weight: 600;
}

.ops-graphs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  align-items: start;
}

.ops-graph-card {
  min-width: 0;
  position: relative;
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 0.55rem;
  background: rgba(2, 6, 23, 0.54);
  overflow: hidden;
}

.ops-graph-card h3 {
  margin: 0 0 0.45rem;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.ops-routing-card {
  grid-column: 1 / -1;
  overflow: hidden;
}

.ops-fleet-wide {
  grid-column: 1 / -1;
}

.scanner-event-list {
  display: grid;
  gap: 0.55rem;
}

.scanner-event-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem;
  border: 1px solid rgba(31, 41, 55, 0.88);
  border-radius: 10px;
  background: rgba(2, 6, 23, 0.48);
}

.scanner-event-card[data-state="warn"] {
  border-color: rgba(251, 146, 60, 0.5);
  background: rgba(67, 20, 7, 0.3);
}

.scanner-event-card[data-state="ok"] {
  border-color: rgba(34, 197, 94, 0.35);
}

.scanner-event-card .suite-meta {
  display: block;
  margin-top: 0.2rem;
}

.scanner-event-link {
  white-space: nowrap;
}

body[data-theme="light"] .scanner-event-card,
html[data-theme="light"] .scanner-event-card {
  border-color: rgba(148, 163, 184, 0.42);
  background: #ffffff;
}

body[data-theme="light"] .scanner-event-card[data-state="warn"],
html[data-theme="light"] .scanner-event-card[data-state="warn"] {
  border-color: rgba(251, 146, 60, 0.55);
  background: #fff7ed;
}

body[data-theme="light"] .scanner-event-card[data-state="ok"],
html[data-theme="light"] .scanner-event-card[data-state="ok"] {
  border-color: rgba(34, 197, 94, 0.35);
}

.ops-chart {
  width: 100%;
  max-width: 100%;
  min-height: 240px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.92) 0%, rgba(2, 6, 23, 0.96) 100%);
  border: 1px solid rgba(31, 41, 55, 0.85);
  overflow: hidden;
}

.ops-chart canvas {
  max-width: 100% !important;
}

.ops-routing-map-chart {
  height: 420px;
  min-height: 420px;
}

.ops-network-flow-chart {
  height: 500px;
  min-height: 500px;
}

.ops-chart[tabindex="0"] {
  cursor: zoom-in;
}

.ops-chart-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(8px);
}

.ops-chart-modal[hidden] {
  display: none;
}

.ops-chart-modal-panel {
  width: min(1380px, 96vw);
  max-height: 92vh;
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(2, 6, 23, 0.98));
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.ops-chart-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ops-chart-modal-head h2 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.05rem;
}

.ops-chart-modal-canvas {
  height: min(72vh, 760px);
  min-height: 620px;
}

.ops-chart svg {
  display: block;
  width: 100%;
  height: 240px;
}

.ops-routing-map-chart svg {
  height: 100%;
  min-height: 420px;
}

.ops-generated {
  clear: both;
  margin: 0.65rem 0 0;
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.45;
}

.suite-dashboard {
  margin: 0 0 1.1rem;
  padding: 0.9rem;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: radial-gradient(circle at top left, #071322, #020617);
}

.qa-admin-dashboard {
  margin: 0 0 1.1rem;
  padding: 0.9rem;
  border: 1px solid #1f2937;
  border-radius: 12px;
  background: radial-gradient(circle at top left, #08182a, #020617);
}

.qa-admin-controls {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0.65rem;
}

.qa-admin-card {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(2, 6, 23, 0.54);
}

.qa-admin-card select,
.qa-admin-card input[type="text"] {
  width: 100%;
  margin-top: 0.3rem;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 0.4rem 0.45rem;
}

.qa-inline-controls {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.3rem;
}

.qa-inline-controls .admin-btn {
  white-space: nowrap;
}

.qa-toggle-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.55rem;
  color: #cbd5e1;
}

.qa-toggle-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.qa-admin-json {
  width: 100%;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #020617;
  color: #e5e7eb;
  padding: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.35;
}

.suite-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}

.suite-head h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #e2e8f0;
}

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

.suite-btn-primary {
  background: linear-gradient(90deg, #15803d, #22c55e);
  border-color: #15803d;
  color: #ecfdf5;
}

.suite-controls {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.suite-control-card {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(2, 6, 23, 0.54);
}

.suite-control-card select {
  width: 100%;
  margin-top: 0.3rem;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  border-radius: 8px;
  padding: 0.4rem 0.45rem;
}

.suite-hint {
  margin: 0.45rem 0 0;
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.5;
  font-weight: 500;
}

.suite-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.suite-check-card {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  border: 1px solid #1f2937;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  background: rgba(15, 23, 42, 0.65);
  font-size: 0.83rem;
  line-height: 1.45;
}

.suite-check-card small {
  color: #b6c2d2;
}

.suite-help-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.95);
  color: #cbd5e1;
  font-size: 0.66rem;
  line-height: 1;
  font-weight: 700;
  cursor: help;
  vertical-align: middle;
}

.suite-help-dot:focus {
  outline: 1px solid #38bdf8;
  outline-offset: 1px;
}

.suite-graph-hint {
  margin: 0 0 0.4rem;
  color: #b6c2d2;
  font-size: 0.83rem;
  line-height: 1.45;
}

.suite-progress {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #334155;
  background: rgba(2, 6, 23, 0.7);
  margin-top: 0.35rem;
}

.suite-progress-fill {
  height: 100%;
  width: 0%;
  transition: width 0.2s linear;
}

.suite-progress-fill.running {
  background: linear-gradient(90deg, #38bdf8, #60a5fa, #38bdf8);
}

.suite-progress-fill.done {
  background: linear-gradient(90deg, #22c55e, #86efac);
}

.suite-meta {
  margin: 0.35rem 0 0;
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.48;
  font-weight: 500;
}

.suite-graphs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.suite-grid {
  margin-top: 0.65rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.55rem;
}

.suite-status-card {
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 0.5rem;
  background: rgba(2, 6, 23, 0.62);
}

.suite-status-card h4 {
  margin: 0 0 0.35rem;
  color: #cbd5e1;
  font-size: 0.86rem;
}

.suite-status-card p {
  margin: 0.15rem 0;
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.45;
}

.suite-status-card.ok {
  border-color: rgba(34, 197, 94, 0.6);
}

.suite-status-card.error {
  border-color: rgba(248, 113, 113, 0.6);
}

.suite-status-card.running {
  border-color: rgba(56, 189, 248, 0.8);
}

.suite-error {
  color: #fecaca !important;
}

.suite-history {
  margin: 0.7rem 0 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid #1f2937;
  border-radius: 10px;
  padding: 0.55rem;
  background: #020617;
  color: #b6c2d2;
  font-size: 0.84rem;
  line-height: 1.5;
}

.runtime-trace-mini {
  margin-top: 0.45rem;
  max-height: 150px;
}

.runtime-trace-pre {
  margin-top: 0.45rem;
  max-height: 260px;
}

.runtime-trace-wide {
  grid-column: 1 / -1;
}

.group-ops-hub {
  margin-top: 1rem;
}

.group-ops-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.group-ops-frames {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.group-ops-frame-card {
  border: 1px solid #1f2937;
  border-radius: 12px;
  padding: 0.55rem;
  background: rgba(2, 6, 23, 0.54);
}

.group-ops-frame-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.group-ops-frame-card iframe {
  width: 100%;
  height: 680px;
  border: 1px solid #1f2937;
  border-radius: 8px;
  background: #020617;
}

@media (max-width: 1200px) {
  .ops-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ops-graphs {
    grid-template-columns: 1fr;
  }

  .suite-controls {
    grid-template-columns: 1fr;
  }

  .suite-graphs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .suite-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-ops-frames {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .ops-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .suite-catalog {
    grid-template-columns: 1fr;
  }

  .suite-grid {
    grid-template-columns: 1fr;
  }

  .suite-graphs {
    grid-template-columns: 1fr;
  }
}

.login #container {
  border: 1px solid #1f2937;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.36);
}

.login #content {
  background: radial-gradient(circle at top left, #111827, #020617);
}

.login #content-main form {
  background: transparent;
  border: none;
}

.login .form-row label {
  color: #9ca3af;
}

.login .form-row input {
  background: #020617;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

.button,
input[type="submit"],
input[type="button"],
.submit-row input,
a.button {
  background: linear-gradient(90deg, #15803d, #22c55e);
  border-color: #15803d;
  color: #ecfdf5;
}
