:root {
  color-scheme: dark;
  --bg: #060b15;
  --bg-alt: #09111f;
  --panel: rgba(10, 18, 33, 0.82);
  --panel-strong: rgba(9, 16, 29, 0.94);
  --border: rgba(170, 191, 255, 0.11);
  --border-strong: rgba(220, 92, 120, 0.34);
  --text: #eff3ff;
  --muted: #92a0be;
  --muted-strong: #b4bfd8;
  --navy: #0c1b31;
  --red: #dc5c78;
  --red-soft: rgba(220, 92, 120, 0.16);
  --rose: #f4c5cd;
  --success: #79d4a5;
  --warning: #efc667;
  --danger: #f19caf;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(235, 156, 178, 0.16), transparent 26%),
    radial-gradient(circle at top right, rgba(123, 162, 255, 0.12), transparent 22%),
    linear-gradient(180deg, #04070d 0%, #071120 48%, #050913 100%);
  overflow-x: hidden;
}

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

.backdrop-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(132, 152, 202, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 152, 202, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at center, black 38%, transparent 88%);
  pointer-events: none;
  opacity: 0.42;
}

.backdrop-glow {
  position: fixed;
  width: 36rem;
  height: 36rem;
  border-radius: 999px;
  filter: blur(72px);
  pointer-events: none;
  opacity: 0.5;
}

.backdrop-glow-one {
  top: -12rem;
  left: -10rem;
  background: rgba(232, 150, 172, 0.2);
}

.backdrop-glow-two {
  right: -16rem;
  bottom: -14rem;
  background: rgba(104, 136, 255, 0.16);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1660px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.chrome-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)),
    linear-gradient(180deg, rgba(8, 13, 24, 0.94), rgba(7, 12, 21, 0.9));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-view {
  min-height: calc(100vh - 84px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(100%, 920px);
  padding: 42px;
  position: relative;
  overflow: hidden;
}

.login-card::before,
.hero-banner::before,
.sidebar-card::before {
  content: "";
  position: absolute;
  inset: auto;
  width: 18rem;
  height: 18rem;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(232, 148, 170, 0.17), transparent 72%);
  filter: blur(24px);
  pointer-events: none;
}

.login-card::before {
  right: -7rem;
  bottom: -8rem;
}

.brand-lockup {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-logo-wrap {
  width: 92px;
  height: 92px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo,
.sidebar-logo {
  object-fit: cover;
  display: block;
}

.brand-logo {
  width: 72px;
  height: 72px;
}

.sidebar-logo {
  width: 56px;
  height: 56px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #b7c5eb;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: "Sora", "Manrope", system-ui, sans-serif;
  letter-spacing: -0.04em;
}

h1 {
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.94;
}

h2 {
  font-size: clamp(1.7rem, 2vw, 2.3rem);
}

h3 {
  font-size: clamp(1.25rem, 1.6vw, 1.65rem);
}

.hero-copy,
.muted-copy,
.sidebar-copy,
.stat-card span,
.empty-state {
  color: var(--muted);
  line-height: 1.6;
}

.hero-copy span {
  color: var(--rose);
}

.login-form,
.editor-form {
  display: grid;
  gap: 18px;
}

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

.field span {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b8c5e1;
}

.field input,
.field select,
.field textarea,
.search-shell input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(162, 183, 235, 0.12);
  background: rgba(255, 255, 255, 0.028);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-shell input:focus {
  border-color: rgba(220, 92, 120, 0.55);
  background: rgba(255, 255, 255, 0.05);
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.code-editor {
  min-height: 520px;
  resize: vertical;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.92rem;
  line-height: 1.65;
}

.login-actions,
.form-actions,
.topbar-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  appearance: none;
  border: 1px solid rgba(182, 199, 245, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(220, 92, 120, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, #f4c5cd, #dc5c78 72%);
  color: #fff7f8;
  border-color: rgba(220, 92, 120, 0.55);
}

.btn-danger {
  background: linear-gradient(135deg, #8f2d48, #d84f71);
  border-color: rgba(241, 156, 175, 0.35);
}

.btn-subtle {
  background: rgba(255, 255, 255, 0.025);
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

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

.sidebar {
  position: sticky;
  top: 24px;
  align-self: start;
  display: grid;
  gap: 18px;
}

.sidebar-card,
.status-card,
.nav-stack,
.detail-panel,
.hero-banner,
.stat-card {
  position: relative;
  overflow: hidden;
}

.sidebar-card,
.status-card,
.nav-stack {
  padding: 18px;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.nav-stack {
  display: grid;
  gap: 10px;
}

.nav-btn {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(162, 183, 235, 0.09);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted-strong);
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-btn:hover,
.nav-btn.active {
  color: var(--text);
  transform: translateY(-1px);
  border-color: rgba(220, 92, 120, 0.3);
  background: linear-gradient(135deg, rgba(34, 47, 80, 0.84), rgba(154, 84, 110, 0.44));
}

.status-list {
  margin: 0;
  display: grid;
  gap: 14px;
}

.status-list div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
}

.status-list dd {
  margin: 0;
  color: var(--text);
  font-weight: 800;
}

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

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

.hero-banner,
.detail-panel {
  padding: 20px;
}

.hero-banner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.hero-banner::before,
.sidebar-card::before {
  right: -9rem;
  bottom: -9rem;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  padding: 16px 18px;
  border-radius: 999px;
  background: rgba(45, 156, 104, 0.18);
  border: 1px solid rgba(121, 212, 165, 0.22);
  color: #dfffee;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stats-grid,
.source-summary-grid,
.section-grid,
.two-up {
  display: grid;
  gap: 18px;
}

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

.stat-card {
  padding: 22px;
}

.stat-label {
  margin: 0 0 12px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #bbc8eb;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: clamp(1.7rem, 3vw, 2.5rem);
  font-family: "Sora", sans-serif;
}

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

.detail-panel {
  display: grid;
  gap: 18px;
}

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

.panel-head.split {
  align-items: center;
}

.section-grid {
  grid-template-columns: 1.05fr 1.45fr;
}

.section-grid.three-panels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
}

.section-grid.three-panels .detail-panel {
  align-content: start;
}

.section-grid.three-panels .btn {
  width: auto;
  min-width: 220px;
  justify-self: start;
}

.section-grid.three-panels .field textarea {
  min-height: 152px;
}

.section-grid.keys-grid {
  grid-template-columns: 1fr;
  align-items: start;
}

.key-generator-panel {
  max-width: 720px;
}

.field-grid {
  display: grid;
  gap: 14px;
}

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field-grid.key-grid {
  grid-template-columns: minmax(0, 1.35fr) 108px 112px;
}

.field-grid .wide {
  grid-column: span 1;
}

.search-shell {
  min-width: min(100%, 360px);
  display: grid;
  gap: 8px;
}

.search-shell span {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b9c6e4;
}

.table-shell {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid rgba(154, 176, 229, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid rgba(154, 176, 229, 0.08);
}

th {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #b8c5e2;
  background: rgba(255, 255, 255, 0.02);
}

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

code {
  display: inline-block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.status-pill.active {
  color: #e8fff3;
  background: rgba(121, 212, 165, 0.18);
  border: 1px solid rgba(121, 212, 165, 0.24);
}

.status-pill.revoked,
.status-pill.disabled {
  color: #ffe8eb;
  background: rgba(241, 156, 175, 0.14);
  border: 1px solid rgba(241, 156, 175, 0.24);
}

.status-pill.normal {
  color: #e9f0ff;
  background: rgba(117, 151, 255, 0.14);
  border: 1px solid rgba(117, 151, 255, 0.2);
}

.status-pill.premium {
  color: #fff4f5;
  background: rgba(220, 92, 120, 0.15);
  border: 1px solid rgba(220, 92, 120, 0.25);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}

.row-actions .btn {
  padding: 8px 11px;
  font-size: 0.82rem;
}

.key-generator-panel .btn-primary {
  width: auto;
  min-width: 220px;
  justify-self: start;
}

.key-list-panel .panel-head.split {
  gap: 14px;
}

.key-list-panel .search-shell {
  min-width: min(100%, 300px);
}

.key-table-shell {
  overflow-x: auto;
  overflow-y: hidden;
}

.key-table {
  min-width: 980px;
}

.key-table th,
.key-table td {
  padding: 12px 10px;
}

.key-table code {
  max-width: 170px;
  font-size: 0.78rem;
}

.key-table th:last-child,
.key-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 1;
}

.key-table th:last-child {
  background: rgba(33, 40, 53, 0.98);
}

.key-table td:last-child {
  background: rgba(21, 28, 40, 0.97);
  box-shadow: -10px 0 18px rgba(5, 9, 19, 0.32);
}

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

.source-tab {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(155, 177, 229, 0.1);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.source-tab:hover,
.source-tab.active {
  transform: translateY(-1px);
  border-color: rgba(220, 92, 120, 0.3);
  background: linear-gradient(135deg, rgba(19, 33, 60, 0.86), rgba(81, 17, 33, 0.46));
}

.source-tab strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Sora", sans-serif;
  font-size: 1.02rem;
}

.source-tab span {
  color: var(--muted);
  font-size: 0.92rem;
}

.source-meta-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(155, 177, 229, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.source-link {
  color: #d4dfff;
  text-decoration: none;
  font-weight: 700;
}

.source-link:hover {
  color: var(--rose);
}

.stack-list {
  display: grid;
  gap: 12px;
}

.stack-item {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid rgba(155, 177, 229, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.stack-item strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Sora", sans-serif;
  font-size: 1rem;
}

.stack-item small,
.stack-item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.source-summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.source-summary-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(155, 177, 229, 0.09);
  background: rgba(255, 255, 255, 0.025);
}

.source-summary-card strong {
  display: block;
  margin-bottom: 10px;
  font-family: "Sora", sans-serif;
}

.source-summary-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  min-width: 240px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 14, 26, 0.94);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  color: var(--text);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.pager-label {
  min-width: 92px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.copyable {
  cursor: pointer;
  user-select: none;
}

.copyable:hover {
  background: rgba(220, 92, 120, 0.16);
}

.empty-state {
  padding: 20px;
  text-align: center;
}

@media (max-width: 1220px) {
  .stats-grid,
  .source-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .section-grid,
  .two-up,
  .section-grid.three-panels {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 1460px) {
  .section-grid.keys-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .shell {
    width: min(100%, calc(100% - 24px));
    padding-top: 20px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .topbar,
  .hero-banner,
  .source-meta-bar,
  .panel-head.split {
    flex-direction: column;
    align-items: stretch;
  }

  .search-shell {
    min-width: 0;
  }

  .field-grid.two,
  .field-grid.three,
  .field-grid.key-grid,
  .stats-grid,
  .source-summary-grid,
  .source-tabs {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    grid-template-columns: 1fr;
  }
}
