:root {
  --radius: 0;
  --fill-speed: 180ms ease-in-out;
  --font-body: "IBM Plex Mono", monospace;
  --font-display: "Space Mono", monospace;
}

html[data-theme="dark"] {
  --bg: #020202;
  --bg-soft: #070707;
  --panel: #0b0b0b;
  --panel-strong: #030303;
  --line: #f4f4f4;
  --text: #f7f7f7;
  --muted: #8f8f8f;
  --contrast: #000000;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.03);
  --overlay: rgba(0, 0, 0, 0.96);
  --row-hover: rgba(255, 255, 255, 0.04);
  --gridline: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.16);
}

html[data-theme="light"] {
  --bg: #ffffff;
  --bg-soft: #f4f4f4;
  --panel: #ffffff;
  --panel-strong: #f8f8f8;
  --line: #050505;
  --text: #050505;
  --muted: #5f5f5f;
  --contrast: #ffffff;
  --shadow: 0 0 0 1px rgba(0, 0, 0, 0.03);
  --overlay: rgba(255, 255, 255, 0.96);
  --row-hover: rgba(0, 0, 0, 0.04);
  --gridline: rgba(0, 0, 0, 0.09);
  --hairline: rgba(0, 0, 0, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overscroll-behavior: none;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border-radius: var(--radius);
}

#app {
  min-height: 100vh;
  background: var(--bg);
  position: relative;
}

#app::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(to bottom, rgba(127, 127, 127, 0.04), transparent 20%),
    var(--bg);
  z-index: -1;
  pointer-events: none;
}

.screen {
  min-height: 100vh;
  padding: 32px;
  position: relative;
  background: var(--bg);
}

.centered-screen {
  display: grid;
  place-items: center;
}

.minimal-screen {
  background: var(--bg);
}

.splash-shell,
.minimal-auth-shell {
  width: 100%;
  display: grid;
  place-items: center;
}

.hero-lockup {
  width: min(36vw, 300px);
  display: grid;
  justify-items: stretch;
  gap: 12px;
}

.brand-logo {
  width: 100%;
  max-width: 220px;
  justify-self: center;
  display: block;
}

.brand-wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(64px, 10vw, 112px);
  line-height: 0.92;
  letter-spacing: 0.12em;
  text-align: center;
  text-indent: 0.12em;
  font-weight: 700;
}

.brand-subtitle {
  width: 100%;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  padding-top: 8px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  font-size: clamp(8px, 0.74vw, 11px);
  white-space: nowrap;
  color: var(--muted);
}

.minimal-form {
  width: min(28vw, 320px);
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.minimal-field {
  gap: 6px;
}

.label,
.mini-label,
.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 11px;
}

.helper-copy {
  color: color-mix(in srgb, var(--text) 82%, transparent);
  line-height: 1.6;
}

.helper-copy.negative {
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: var(--panel-strong);
}

.minimal-field input,
.settings-input,
.search-input {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 12px 14px;
  outline: none;
}

.minimal-field input:focus,
.settings-input:focus,
.search-input:focus {
  background: var(--panel-strong);
}

.button,
.ghost-button,
.nav-item,
.ticker-button,
.live-indicator,
.theme-toggle,
.profile-button,
.logout-button {
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  padding: 9px 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  transition:
    background var(--fill-speed),
    color var(--fill-speed),
    border-color var(--fill-speed),
    opacity var(--fill-speed);
}

.button:hover,
.ghost-button:hover,
.nav-item:hover,
.ticker-button:hover,
.theme-toggle:hover,
.logout-button:hover {
  background: var(--line);
  color: var(--contrast);
}

.button.active,
.nav-item.active,
.theme-toggle.active,
.toggle-chip.active,
.range-chip.active,
.live-indicator.is-live,
.status-pill.inverse {
  background: var(--line);
  color: var(--contrast);
}

.enter-button,
.auth-button {
  width: 100%;
}

.enter-button {
  margin-top: 6px;
  padding-top: 10px;
  padding-bottom: 10px;
  letter-spacing: 0.32em;
}

.alternate-link {
  justify-self: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  padding: 0;
}

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

.brand-footer {
  position: fixed;
  right: 18px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--text) 84%, transparent);
}

.brand-footer img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.dashboard {
  padding: 98px 24px 96px;
}

.topbar {
  position: fixed;
  top: 14px;
  left: 24px;
  right: 24px;
  min-height: 46px;
  border: 1px solid var(--line);
  background: var(--overlay);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  z-index: 20;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(8px);
}

.topbar-context-title {
  position: static;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text);
  white-space: nowrap;
  justify-self: center;
  text-align: center;
}

.nav-cluster,
.account-cluster,
.brand-cluster {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}

.nav-cluster {
  min-width: 0;
  justify-self: start;
}

.account-cluster {
  justify-content: flex-end;
  justify-self: end;
  margin-left: auto;
}

.brand-chip {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--bg);
  display: grid;
  place-items: center;
  padding: 4px;
  flex: 0 0 auto;
}

.brand-chip img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.nav-item,
.live-indicator,
.theme-toggle,
.logout-button {
  min-width: 88px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: 10px;
  line-height: 1;
}

.live-indicator.is-down {
  opacity: 0.6;
}

.sync-label {
  font-size: 10px;
  white-space: nowrap;
  text-align: right;
}

.profile-button {
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-size: 10px;
  border-radius: 999px;
}

.page {
  display: grid;
  gap: 36px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.page-title {
  margin: 6px 0 0;
  font-family: var(--font-body);
  font-size: clamp(24px, 3vw, 36px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.layout-grid {
  display: grid;
  grid-template-columns: 2.2fr 1fr;
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 16px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.metric-card {
  border: 1px solid var(--line);
  padding: 18px 20px;
  background: var(--bg);
}

.value,
.hero-stat,
.graph-value {
  margin-top: 10px;
  font-size: clamp(20px, 2.4vw, 30px);
  line-height: 1;
}

.status-cluster,
.top-actions,
.chip-row,
.graph-legend,
.range-switcher,
.queue-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.badge,
.status-pill,
.chip,
.toggle-chip,
.range-chip {
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: var(--panel-strong);
}

.toggle-chip,
.range-chip {
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  transition: background var(--fill-speed), color var(--fill-speed);
}

.toggle-chip:hover,
.range-chip:hover {
  background: var(--line);
  color: var(--contrast);
}

.chart-shell {
  background: var(--bg);
  padding: 0;
}

.graph-panel {
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
}

.graph-header {
  margin-bottom: 18px;
  justify-content: space-between;
  align-items: flex-start;
}

.graph-meta {
  display: grid;
  gap: 10px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend-item.active {
  color: var(--text);
}

.legend-marker {
  width: 14px;
  height: 2px;
  background: var(--text);
  display: inline-block;
}

.chart-shell svg {
  width: 100%;
  height: 420px;
  display: block;
}

.gridline {
  stroke: var(--gridline);
  stroke-width: 1;
}

.axis-label,
.x-axis-label {
  fill: var(--muted);
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.chart-path {
  fill: none;
  stroke: var(--text);
  stroke-width: 2;
}

.chart-fill {
  fill: color-mix(in srgb, var(--text) 6%, transparent);
}

.table-wrap {
  overflow: auto;
}

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

th,
td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
  white-space: nowrap;
}

thead th {
  color: var(--muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

tbody tr:hover {
  background: var(--row-hover);
}

.settings-grid,
.list,
.system-checks,
.subtle-list {
  display: grid;
  gap: 12px;
}

.check-row,
.subtle-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 8px;
}

.subtle-row:last-child,
.check-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

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

.queue-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
}

.empty-state {
  border: 1px solid var(--line);
  padding: 18px;
  background: var(--bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.loading-shell {
  border: 1px solid var(--line);
  padding: 24px;
  background: var(--panel-strong);
}

.view-caption {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
}

.mono-divider {
  width: 100%;
  height: 1px;
  background: var(--hairline);
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 1fr;
    left: 18px;
    right: 18px;
    padding: 10px 14px;
    gap: 10px;
  }

  .nav-cluster {
    justify-content: center;
    flex-wrap: wrap;
  }

  .account-cluster {
    justify-content: space-between;
    width: 100%;
    margin-left: 0;
    flex-wrap: wrap;
  }

  .dashboard {
    padding-top: 132px;
  }

  .metric-grid,
  .queue-grid,
  .layout-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .screen,
  .dashboard {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-lockup,
  .splash-shell {
    width: auto;
  }

  .brand-wordmark {
    font-size: clamp(54px, 18vw, 92px);
  }

  .brand-subtitle {
    letter-spacing: 0.18em;
    text-indent: 0.18em;
    font-size: 8px;
  }

  .minimal-form {
    width: min(78vw, 320px);
  }

  .topbar {
    top: 10px;
    left: 10px;
    right: 10px;
    padding: 8px 10px;
  }

  .nav-item,
  .button,
  .ghost-button,
  .ticker-button,
  .live-indicator,
  .theme-toggle,
  .logout-button {
    min-width: auto;
    padding: 7px 9px;
    font-size: 10px;
    letter-spacing: 0.12em;
  }

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

  .chart-shell svg {
    height: 300px;
  }

  table {
    min-width: 720px;
  }

  .brand-footer {
    right: 8px;
    bottom: 8px;
    gap: 6px;
    font-size: 8px;
  }
}
