:root {
  color-scheme: dark;
  --ink: #10192b;
  --panel: #162238;
  --panel-2: #1d2c43;
  --line: #33445d;
  --text: #dce6f2;
  --muted: #8fa1b8;
  --gold: #f0b24b;
  --cyan: #51c5d6;
  --coral: #f06d68;
  --green: #75d39a;
  --shadow: 0 28px 70px rgb(3 8 18 / 44%);
  font-family: Aptos, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgb(16 25 43 / 94%), rgb(16 25 43 / 99%)),
    repeating-linear-gradient(90deg, transparent 0 55px, rgb(81 197 214 / 5%) 56px);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
input,
dialog {
  border-radius: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ambient {
  position: fixed;
  z-index: -1;
  border: 1px solid rgb(81 197 214 / 13%);
  transform: rotate(28deg);
  pointer-events: none;
}

.ambient-one {
  width: 34rem;
  height: 34rem;
  top: -18rem;
  right: -8rem;
}

.ambient-two {
  width: 22rem;
  height: 22rem;
  bottom: -13rem;
  left: -4rem;
  border-color: rgb(240 178 75 / 11%);
}

.eyebrow {
  margin: 0 0 .4rem;
  color: var(--cyan);
  font: 700 .7rem/1.2 "Cascadia Mono", Consolas, monospace;
  letter-spacing: .17em;
}

h1,
h2,
strong {
  font-family: Bahnschrift, "Arial Narrow", sans-serif;
}

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

.brand-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border: 1px solid var(--cyan);
  background: linear-gradient(145deg, rgb(81 197 214 / 16%), transparent);
  color: var(--cyan);
  font: 700 1.25rem/1 "Cascadia Mono", Consolas, monospace;
  box-shadow: inset 0 0 0 5px var(--ink);
}

.brand-mark.small {
  width: 2.9rem;
  height: 2.9rem;
  font-size: .9rem;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 2rem;
  place-items: center;
}

.login-card {
  position: relative;
  width: min(100%, 29rem);
  padding: clamp(2rem, 6vw, 4rem);
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgb(29 44 67 / 96%), rgb(18 29 48 / 98%));
  box-shadow: var(--shadow);
}

.login-card::before {
  position: absolute;
  top: -1px;
  left: -1px;
  width: 38%;
  height: 3px;
  background: var(--gold);
  content: "";
}

.login-card .brand-mark {
  margin-bottom: 2.4rem;
}

.login-card h1 {
  margin-bottom: .65rem;
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  font-stretch: condensed;
  letter-spacing: -.06em;
}

.login-copy,
.field-hint,
.key-warning {
  color: var(--muted);
  line-height: 1.6;
}

label {
  display: block;
  margin: 1.5rem 0 .55rem;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
}

input {
  width: 100%;
  height: 3rem;
  border: 1px solid var(--line);
  padding: 0 .85rem;
  background: var(--ink);
  color: var(--text);
}

input:hover {
  border-color: #536880;
}

.button {
  min-height: 2.65rem;
  border: 1px solid var(--line);
  padding: .65rem 1rem;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 750;
  letter-spacing: .02em;
  transition: border-color 130ms ease, background 130ms ease, transform 130ms ease;
}

.button:hover {
  border-color: var(--cyan);
  background: #24364e;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  border-color: var(--gold);
  background: var(--gold);
  color: #181b24;
}

.button.primary:hover {
  border-color: #ffd486;
  background: #ffd486;
}

.button.ghost {
  background: transparent;
}

.button.full {
  width: 100%;
  margin-top: 1rem;
}

.button.compact {
  min-height: 2.2rem;
  padding: .4rem .7rem;
}

.button.danger {
  border-color: rgb(240 109 104 / 55%);
  color: #ffaaa6;
}

.button:disabled {
  opacity: .48;
  cursor: not-allowed;
}

.form-message {
  min-height: 1.4rem;
  margin: .8rem 0 0;
  color: #ffaaa6;
  font-size: .82rem;
}

.security-note {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-top: 1.6rem;
  color: var(--muted);
  font-size: .76rem;
}

.status-dot {
  display: inline-block;
  width: .48rem;
  height: .48rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgb(117 211 154 / 10%);
}

.app-shell {
  width: min(100% - 2rem, 94rem);
  margin: 0 auto;
  padding-bottom: 4rem;
}

.topbar {
  display: flex;
  min-height: 6.25rem;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand-lockup,
.topbar-actions,
.hero,
.panel-heading,
.dialog-heading,
.dialog-actions,
.key-box {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: .9rem;
}

.brand-lockup h1 {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: -.035em;
}

.topbar-actions {
  gap: .6rem;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-right: .6rem;
  color: var(--muted);
  font: 600 .72rem/1 "Cascadia Mono", Consolas, monospace;
}

.hero {
  justify-content: space-between;
  gap: 2rem;
  min-height: 13rem;
  padding: 2.8rem 0 2rem;
}

.hero h2 {
  width: min(24ch, 100%);
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 4rem);
  font-stretch: condensed;
  line-height: .98;
  letter-spacing: -.045em;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  background: var(--panel);
}

.metric {
  min-height: 9rem;
  padding: 1.45rem;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric.accent {
  background: linear-gradient(125deg, rgb(81 197 214 / 10%), transparent 55%);
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric span {
  font: 700 .7rem/1.2 "Cascadia Mono", Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: .65rem 0 .25rem;
  color: var(--text);
  font-size: 2.35rem;
  line-height: 1;
}

.metric.accent strong {
  color: var(--cyan);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 25rem);
  gap: 1rem;
  margin-top: 1rem;
}

.panel {
  border: 1px solid var(--line);
  background: rgb(22 34 56 / 86%);
}

.panel-heading {
  min-height: 6rem;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
  margin: 0;
  font-size: 1.4rem;
}

.search {
  width: min(100%, 17rem);
  margin: 0;
}

.search input {
  height: 2.55rem;
}

.users-list {
  display: grid;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(13rem, 1.6fr) auto;
  gap: 1.2rem;
  align-items: center;
  padding: 1.25rem 1.4rem;
  border-bottom: 1px solid var(--line);
}

.user-card:last-child {
  border-bottom: 0;
}

.user-card.is-disabled {
  opacity: .66;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.user-name {
  overflow: hidden;
  font: 700 1.08rem/1.2 "Cascadia Mono", Consolas, monospace;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  padding: .25rem .45rem;
  color: var(--muted);
  font: 700 .61rem/1 "Cascadia Mono", Consolas, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.badge.live {
  border-color: rgb(117 211 154 / 42%);
  color: var(--green);
}

.user-meta {
  margin-top: .45rem;
  color: var(--muted);
  font-size: .75rem;
}

.quota-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .55rem;
}

.quota-head strong {
  font: 700 .95rem/1 "Cascadia Mono", Consolas, monospace;
}

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

.quota-tape {
  position: relative;
  height: .78rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    repeating-linear-gradient(90deg, transparent 0 19px, rgb(220 230 242 / 10%) 20px),
    var(--ink);
}

.quota-tape progress {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  appearance: none;
  background: transparent;
}

.quota-tape progress::-webkit-progress-bar {
  background: transparent;
}

.quota-tape progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--gold), var(--cyan));
}

.quota-tape progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--gold), var(--cyan));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .4rem;
  max-width: 25rem;
}

.actions .button {
  min-height: 2.15rem;
  padding: .38rem .56rem;
  font-size: .7rem;
}

.empty-state {
  display: grid;
  min-height: 15rem;
  place-content: center;
  gap: .4rem;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

.audit-list {
  max-height: 48rem;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.audit-item {
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.audit-tick {
  width: .5rem;
  height: .5rem;
  margin-top: .25rem;
  border: 1px solid var(--cyan);
  transform: rotate(45deg);
}

.audit-item p {
  margin: 0 0 .25rem;
  font-size: .8rem;
  line-height: 1.35;
}

.audit-item time {
  color: var(--muted);
  font: .65rem/1.2 "Cascadia Mono", Consolas, monospace;
}

dialog {
  width: min(calc(100% - 2rem), 34rem);
  border: 1px solid var(--line);
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgb(3 8 18 / 75%);
  backdrop-filter: blur(5px);
}

.dialog-card {
  display: block;
  padding: 1.6rem;
}

.dialog-heading {
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.dialog-heading h2 {
  margin: 0;
}

.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 1.5rem;
}

.input-suffix {
  display: grid;
  grid-template-columns: 1fr auto;
}

.input-suffix span {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-left: 0;
  padding: 0 .85rem;
  background: var(--ink);
  color: var(--muted);
  font-size: .78rem;
}

.field-hint {
  margin: .65rem 0 0;
  font-size: .75rem;
}

.dialog-actions {
  justify-content: flex-end;
  gap: .6rem;
  margin-top: 1.5rem;
}

.key-warning {
  border-left: 3px solid var(--gold);
  padding-left: .9rem;
}

.key-box {
  gap: .5rem;
  border: 1px solid var(--line);
  padding: .65rem;
  background: var(--ink);
}

.key-box code {
  flex: 1;
  overflow-wrap: anywhere;
  color: var(--gold);
  font: 700 .76rem/1.5 "Cascadia Mono", Consolas, monospace;
}

.key-owner {
  margin-top: .7rem;
  color: var(--muted);
  font-size: .76rem;
}

.toast {
  position: fixed;
  z-index: 10;
  right: 1rem;
  bottom: 1rem;
  max-width: min(calc(100% - 2rem), 26rem);
  border: 1px solid var(--cyan);
  padding: .85rem 1rem;
  background: var(--panel-2);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(.75rem);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

@media (max-width: 960px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .audit-list {
    max-height: 24rem;
  }

  .user-card {
    grid-template-columns: 1fr 1.4fr;
  }

  .actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    max-width: none;
  }
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100% - 1rem, 94rem);
  }

  .topbar {
    align-items: flex-start;
    padding: 1rem 0;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .live-pill {
    width: 100%;
    justify-content: flex-end;
    margin-right: 0;
  }

  .hero {
    min-height: 17rem;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

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

  .metric {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .user-card {
    grid-template-columns: 1fr;
  }

  .actions {
    grid-column: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}
