:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: #111114;
  --panel-soft: #15151a;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #fafafa;
  --accent-text: #111114;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #60a5fa;
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #14141a 0, #09090b 55%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

textarea {
  resize: vertical;
}

.page-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  position: sticky;
  top: 0;
  backdrop-filter: blur(18px);
  background: rgba(9, 9, 11, 0.72);
  border-bottom: 1px solid var(--line);
  z-index: 10;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.9rem;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #ffffff, #c7c7ce);
  color: #0a0a0c;
  box-shadow: var(--shadow);
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.text-link {
  color: var(--muted);
  transition: color 0.18s ease;
}

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

.main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.flash-stack {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.flash {
  border-radius: 16px;
  padding: 0.95rem 1rem;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.04);
}

.flash-success {
  border-color: rgba(34, 197, 94, 0.3);
}

.flash-error {
  border-color: rgba(239, 68, 68, 0.35);
}

.flash-info {
  border-color: rgba(96, 165, 250, 0.35);
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.panel-muted {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
}

.accent-panel {
  border-color: rgba(255, 255, 255, 0.18);
}

.panel-hero {
  padding: 2rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 3.5vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

h2 {
  font-size: 1.15rem;
  line-height: 1.2;
}

.lede {
  color: var(--muted);
  line-height: 1.6;
  max-width: 65ch;
  margin-top: 0.8rem;
}

.hero-grid,
.two-column-grid,
.three-column-grid,
.stats-grid,
.detail-grid {
  display: grid;
  gap: 1.25rem;
}

.hero-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  align-items: stretch;
}

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

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

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

.stack-layout,
.stack-form,
.list-stack,
.log-stack,
.credential-stack {
  display: grid;
  gap: 1rem;
}

.feature-block {
  display: grid;
  gap: 0.55rem;
  padding-top: 0.3rem;
}

.feature-block + .feature-block {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.feature-block p,
.list-item p,
.log-row p,
.table-subtext,
.muted-text {
  color: var(--muted);
}

.field-group {
  display: grid;
  gap: 0.45rem;
}

.field-label {
  color: var(--muted);
  font-size: 0.96rem;
}

.field-input,
.field-textarea,
.generated-box {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  color: var(--text);
  padding: 0.95rem 1rem;
  outline: none;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.field-input:focus,
.field-textarea:focus,
.generated-box:focus {
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-1px);
}

.mono-textarea,
.credential-value,
.generated-box,
code {
  font-family: "SFMono-Regular", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.field-error {
  color: #fca5a5;
  font-size: 0.92rem;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border: 0;
  border-radius: 999px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

.ghost-button,
.icon-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.wide-button {
  width: 100%;
}

.inline-form {
  display: inline-flex;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-card {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.1rem 1.2rem;
  display: grid;
  gap: 0.45rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-value {
  font-size: clamp(1.4rem, 2.2vw, 2.4rem);
  letter-spacing: -0.04em;
}

.list-item,
.log-row,
.credential-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 18px;
  padding: 0.9rem 1rem;
}

.credential-row {
  align-items: stretch;
}

.credential-value {
  flex: 1;
  overflow-wrap: anywhere;
  background: rgba(255, 255, 255, 0.025);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.compact-credentials {
  max-height: 540px;
  overflow: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 0.46rem 0.75rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.7rem;
  border: 1px solid var(--line-strong);
}

.badge-active {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.12);
}

.badge-revoked,
.badge-expired,
.badge-used-up {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.12);
}

.table-wrap {
  overflow: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  text-align: left;
  padding: 0.95rem 0.75rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.table-empty,
.empty-state {
  color: var(--muted);
}

.auth-shell {
  min-height: 72vh;
  display: grid;
  place-items: center;
}

.auth-panel {
  width: min(460px, 100%);
}

.generated-box {
  min-height: 180px;
}

.log-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.95rem;
}

.compact-log-stack .log-row {
  padding: 0.8rem 0.95rem;
}

.small-button {
  padding: 0.55rem 0.85rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 960px) {
  .hero-grid,
  .two-column-grid,
  .three-column-grid,
  .stats-grid,
  .detail-grid,
  .panel-header {
    grid-template-columns: 1fr;
  }

  .panel-header {
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .nav {
    width: 100%;
  }

  .credential-row,
  .list-item,
  .log-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .action-row,
  .log-meta {
    width: 100%;
    justify-content: flex-start;
  }
}
