:root {
  color-scheme: dark;
  --bg: #02030a;
  --text: #f8fbff;
  --soft: rgba(248, 251, 255, 0.78);
  --muted: rgba(216, 226, 242, 0.56);
  --line: rgba(255, 255, 255, 0.14);
  --panel: rgba(7, 10, 20, 0.42);
  --panel-strong: rgba(7, 10, 20, 0.64);
  --cyan: #66f5ff;
  --blue: #6b8cff;
  --emerald: #65ffc8;
  --amber: #ffd166;
  --danger: #ff5f86;
  --radius: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(82, 113, 255, 0.28), transparent 34rem),
    linear-gradient(180deg, #071034 0%, #02030a 38rem, #000 100%);
  overflow-x: hidden;
}

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

.shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  padding: 0 0 56px;
}

.shader-stage {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(250px, 1fr) auto;
  min-height: 100vh;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #000;
  box-shadow: none;
  isolation: isolate;
}

.shader-canvas,
.stage-vignette {
  position: absolute;
  inset: 0;
}

.shader-canvas {
  z-index: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.stage-vignette {
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 42%, transparent 0%, rgba(0, 0, 0, 0.1) 36%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.5) 0%, transparent 28%, transparent 55%, rgba(0, 0, 0, 0.84) 100%);
}

.stage-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(18px, 4vw, 56px);
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  margin: 0 0 4px;
  color: rgba(248, 251, 255, 0.5);
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.73rem;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stage-focus {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 28px clamp(18px, 4vw, 56px) 46px;
  pointer-events: none;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.18rem, 1.5vw, 1.55rem);
  font-weight: 680;
  line-height: 1.02;
  letter-spacing: 0.02em;
  text-shadow:
    0 0 16px rgba(255, 255, 255, 0.24),
    0 18px 50px rgba(0, 0, 0, 0.5);
}

h2 {
  margin: 6px 0 0;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 640;
  line-height: 1.15;
}

.service-pill,
.window-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(0, 0, 0, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.86);
}

.is-online .status-dot {
  background: var(--emerald);
  box-shadow: 0 0 16px rgba(101, 255, 200, 0.86);
}

.is-error .status-dot {
  background: var(--danger);
  box-shadow: 0 0 16px rgba(255, 95, 134, 0.86);
}

.is-warn .status-dot {
  background: var(--amber);
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.86);
}

.window-metrics {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  width: min(100% - 36px, 1160px);
  margin: 0 auto;
  padding: 0 0 32px;
}

.window-metric,
.detail-panel,
.users-panel,
.message {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    var(--panel);
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(24px) saturate(1.25);
}

.window-metric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  gap: 13px 16px;
  align-items: center;
  padding: 16px 18px;
}

.metric-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  grid-column: 1 / -1;
}

.metric-body {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  grid-column: 1 / -1;
}

.quota-number {
  display: grid;
  gap: 5px;
}

.quota-number strong {
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(2.2rem, 5vw, 4.25rem);
  font-weight: 650;
  line-height: 0.88;
}

.quota-number span {
  color: var(--muted);
  font-size: 0.82rem;
}

.meter-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 86px;
  aspect-ratio: 1;
  overflow: visible;
  isolation: isolate;
  flex: 0 0 auto;
}

.meter-wrap::before {
  content: "";
  position: absolute;
  inset: 19%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(102, 245, 255, 0.28), transparent 68%);
  filter: blur(15px);
}

.meter {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.meter-track,
.meter-value {
  fill: none;
  stroke-width: 9;
}

.meter-track {
  stroke: rgba(255, 255, 255, 0.14);
}

.meter-value {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  filter: drop-shadow(0 0 8px rgba(102, 245, 255, 0.42));
  transition: stroke-dashoffset 320ms ease;
}

.meter-value-alt {
  stroke: var(--emerald);
  filter: drop-shadow(0 0 8px rgba(101, 255, 200, 0.4));
}

.meter-label {
  display: none;
}

.stats-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 8px;
  margin: 0;
}

.stats-list div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
}

.stats-list dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.7rem;
}

.stats-list dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: #fff;
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.detail-panel {
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 18px;
}

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

.detail-value {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  color: var(--soft);
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.panel-note {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.message {
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 14px 16px;
  color: #ffd8df;
  border-color: rgba(255, 95, 134, 0.34);
  background: rgba(60, 8, 22, 0.5);
}

.users-panel {
  width: min(1200px, calc(100% - 32px));
  margin: 18px auto 0;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.users-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
}

.users-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
}

.users-table th,
.users-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  text-align: left;
  vertical-align: middle;
}

.users-table th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.users-table td {
  color: var(--soft);
  font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88rem;
}

.users-table tbody tr {
  transition: background 180ms ease;
}

.users-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.045);
}

.users-table tr:last-child td {
  border-bottom: 0;
}

.email-cell {
  color: #fff;
}

.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 760;
}

.state-chip.usage-high {
  color: #ffe7ec;
  background: rgba(255, 95, 134, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 95, 134, 0.34);
}

.state-chip.usage-medium {
  color: #ffedc2;
  background: rgba(255, 209, 102, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.34);
}

.state-chip.usage-low {
  color: #dbfff1;
  background: rgba(101, 255, 200, 0.16);
  box-shadow: inset 0 0 0 1px rgba(101, 255, 200, 0.32);
}

.reason {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.78rem;
}

.reason.is-warning {
  color: var(--amber);
}

.is-loading .status-dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.65;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .shader-stage {
    grid-template-rows: auto minmax(260px, 38dvh) auto;
    min-height: auto;
  }

  .stage-focus {
    min-height: 260px;
    padding-top: 34px;
    padding-bottom: 34px;
  }

  .window-metrics,
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .shell {
    width: 100%;
    padding: 0 0 28px;
  }

  .shader-stage {
    min-height: auto;
    border-radius: 0;
  }

  .shader-canvas {
    opacity: 0.96;
    filter: brightness(1.76) saturate(1.38) contrast(1.08);
  }

  .stage-vignette {
    background:
      radial-gradient(circle at 50% 42%, transparent 0%, rgba(0, 0, 0, 0.02) 38%, rgba(0, 0, 0, 0.64) 100%),
      linear-gradient(180deg, rgba(0, 0, 0, 0.56) 0%, rgba(0, 0, 0, 0.1) 30%, rgba(0, 0, 0, 0.02) 56%, rgba(0, 0, 0, 0.68) 100%);
  }

  .stage-bar,
  .stage-focus {
    padding-left: 18px;
    padding-right: 18px;
  }

  .stage-bar {
    grid-template-columns: minmax(0, 1fr) auto;
    display: grid;
    align-items: center;
    gap: 12px;
    padding-top: 18px;
    padding-bottom: 10px;
  }

  .brand-lockup {
    gap: 0;
  }

  .brand-copy {
    display: grid;
    gap: 2px;
  }

  .brand-kicker {
    font-size: 0.62rem;
  }

  h1 {
    font-size: 1.02rem;
    line-height: 1.05;
  }

  .service-pill {
    justify-self: end;
    min-height: 30px;
    padding: 6px 10px;
    gap: 7px;
    font-size: 0.8rem;
  }

  .status-dot {
    width: 7px;
    height: 7px;
  }

  .stage-focus {
    min-height: clamp(330px, 52dvh, 470px);
    align-items: center;
    justify-content: center;
    padding-top: 24px;
    padding-bottom: 72px;
  }

  .window-metrics {
    width: calc(100% - 20px);
    gap: 10px;
    margin-top: -36px;
    padding-bottom: 10px;
  }

  .window-metric {
    grid-template-columns: minmax(0, 1fr) 68px;
    gap: 10px 12px;
    padding: 14px;
    border-radius: 10px;
  }

  .metric-head {
    display: contents;
  }

  .metric-head > div {
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
  }

  .metric-head .window-chip {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    min-width: 50px;
    min-height: 30px;
    justify-content: center;
    padding: 6px 10px;
    font-size: 0.86rem;
  }

  .metric-body {
    display: contents;
    align-items: center;
  }

  .quota-number {
    grid-column: 1;
    grid-row: 2;
    gap: 3px;
  }

  .quota-number strong {
    font-size: 2.45rem;
    line-height: 0.9;
  }

  .quota-number span {
    font-size: 0.76rem;
  }

  .meter-wrap {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
    width: 62px;
  }

  .meter-track,
  .meter-value {
    stroke-width: 10;
  }

  .stats-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
    gap: 6px;
  }

  .stats-list div {
    min-height: 58px;
    padding: 8px;
  }

  .stats-list dt {
    font-size: 0.64rem;
  }

  .stats-list dd {
    font-size: 0.7rem;
    line-height: 1.25;
  }

  .detail-panel,
  .users-panel,
  .message {
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 16px;
    border-radius: 10px;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .detail-value {
    font-size: 0.74rem;
  }

  .panel-head {
    display: grid;
    gap: 12px;
    margin-bottom: 18px;
    padding: 2px 2px 0;
  }

  .users-table-wrap {
    overflow: hidden;
    border-radius: 10px;
  }

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

  .users-table thead {
    display: none;
  }

  .users-table,
  .users-table tbody,
  .users-table tr,
  .users-table td {
    display: block;
  }

  .users-table tr {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .users-table tr:last-child {
    border-bottom: 0;
  }

  .users-table td {
    padding: 4px 0;
    border-bottom: 0;
    font-size: 0.76rem;
  }

  .users-table td:nth-child(2),
  .users-table td:nth-child(3) {
    display: inline-flex;
    align-items: center;
    vertical-align: top;
  }

  .users-table td:nth-child(3) {
    margin-left: 10px;
  }

  .usage-cell {
    gap: 8px;
    line-height: 1.35;
  }

  .email-cell {
    margin-bottom: 10px;
    overflow-wrap: anywhere;
    line-height: 1.4;
  }

  .state-chip {
    min-height: 24px;
    padding: 3px 8px;
    font-size: 0.72rem;
  }

  .reason {
    margin-top: 4px;
    font-size: 0.68rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .shader-canvas {
    display: none;
  }

  .shader-stage {
    background:
      radial-gradient(circle at 50% 36%, rgba(102, 245, 255, 0.16), transparent 22rem),
      #030617;
  }
}
