:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090b10;
  color: #f8fafc;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --bg: #090b10;
  --panel: #11141c;
  --panel-2: #171b25;
  --line: rgba(255, 255, 255, 0.1);
  --muted: #9ca3af;
  --muted-2: #6b7280;
  --text: #f8fafc;
  --cyan: #00d4ff;
  --magenta: #ff00ff;
  --danger: #fb7185;
  --success: #34d399;
  --warning: #fbbf24;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.04), transparent 32%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

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

.login-panel {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  padding: 24px;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(12, 15, 22, 0.96);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-logo {
  display: inline-flex;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border: 1px solid rgba(0, 212, 255, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.brand strong,
.account-card__header strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand span,
.account-card__header span,
.eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
}

.nav-button,
.button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-button {
  justify-content: flex-start;
  width: 100%;
  padding: 0 14px;
}

.nav-button--active {
  border-color: rgba(0, 212, 255, 0.42);
  background: rgba(0, 212, 255, 0.12);
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions > span {
  max-width: 260px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(23, 27, 37, 0.96), rgba(17, 20, 28, 0.96));
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.2);
}

.key-panel,
.invite-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  padding: 16px;
}

.invite-form {
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: end;
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
  outline: none;
  padding: 0 12px;
}

input:focus,
select:focus {
  border-color: rgba(0, 212, 255, 0.62);
}

.button {
  padding: 0 16px;
  font-weight: 900;
}

.button--primary {
  border: 0;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  color: #fff;
}

.button--secondary {
  background: rgba(255, 255, 255, 0.07);
}

.icon-button {
  width: 42px;
  flex: 0 0 auto;
}

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

.status {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.055);
}

.status--error {
  border-color: rgba(251, 113, 133, 0.42);
}

.status--success {
  border-color: rgba(52, 211, 153, 0.36);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.search-row > span {
  color: var(--muted);
}

.search-row input {
  border: 0;
  background: transparent;
  padding: 0;
}

.table {
  overflow: hidden;
}

.table-header,
.table-row {
  display: grid;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
}

.table-header {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.045);
}

.table-row {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.table-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-header--invites,
.table-row--invites {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 130px 190px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 92px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--text);
  font-size: 0.76rem;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.08);
}

.pill--accepted,
.pill--active {
  color: var(--success);
}

.pill--pending,
.pill--paused {
  color: var(--warning);
}

.pill--expired,
.pill--revoked,
.pill--archived {
  color: var(--danger);
}

.accounts {
  display: grid;
  gap: 14px;
}

.account-card {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.account-card__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.account-card__header > div {
  min-width: 0;
}

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

.project-list {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 140px 42px 42px;
  gap: 8px;
  align-items: center;
}

.project-row--new {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 140px auto;
}

@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    align-items: center;
    height: auto;
    overflow-x: auto;
  }

  .brand {
    margin: 0 10px 0 0;
  }

  .nav-button {
    width: auto;
    white-space: nowrap;
  }

  .invite-form,
  .account-grid,
  .project-row,
  .project-row--new {
    grid-template-columns: 1fr;
  }

  .key-panel,
  .table-header--invites,
  .table-row--invites {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .workspace {
    width: calc(100% - 28px);
    padding: 18px 0;
  }

  .sidebar {
    padding: 14px;
  }

  .topbar,
  .topbar-actions,
  .account-card__header {
    align-items: stretch;
    flex-direction: column;
  }
}
