/* ===========================================================================
   Enterprise AI Gateway — Bounteous-styled UI
   Typography: Nunito Sans (matches bounteous.com)
   Palette pulled from bounteous.com's stylesheet (top-frequency colors)
   =========================================================================== */

:root {
  /* Brand palette */
  --b-ink:        #0b111c;   /* primary dark — backgrounds, headings */
  --b-ink-2:      #1a2032;
  --b-violet:     #2e1869;
  --b-violet-2:   #33139f;
  --b-violet-3:   #523ba5;
  --b-magenta:    #b61ca7;
  --b-magenta-2: #872a95;
  --b-pink:       #d7126d;
  --b-cyan:       #8ee7ff;
  --b-blue:       #34b4ff;
  --b-blue-2:     #4d9de9;

  /* Neutrals */
  --b-white:      #ffffff;
  --b-gray-50:    #f7f8fb;
  --b-gray-100:   #f3f3f5;
  --b-gray-200:   #e7e8ee;
  --b-gray-300:   #d7d6de;
  --b-gray-500:   #6a7283;
  --b-gray-700:   #3f3e46;
  --b-gray-900:   #0b111c;

  /* Semantic */
  --fg:           var(--b-ink);
  --bg:           var(--b-white);
  --muted:        var(--b-gray-500);
  --border:       var(--b-gray-200);
  --accent:       var(--b-violet-2);
  --accent-hover: var(--b-magenta);

  /* Effects */
  --shadow-sm:    0 1px 2px rgba(11, 17, 28, 0.06);
  --shadow-md:    0 4px 16px rgba(11, 17, 28, 0.08);
  --shadow-lg:    0 24px 60px -12px rgba(46, 24, 105, 0.25);
  --radius:       12px;
  --radius-lg:    18px;
  --radius-sm:    8px;

  /* Type */
  --font-sans:   "Nunito Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono:   "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); }

h1, h2, h3, h4 {
  font-family: var(--font-sans);
  color: var(--b-ink);
  letter-spacing: -0.02em;
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
}

h1 { font-size: clamp(2rem, 4.5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 2.5vw, 2.125rem); margin: 2rem 0 0.75rem; }
h3 { font-size: 1.125rem; font-weight: 700; }

p { margin: 0 0 1rem; }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

code {
  background: var(--b-gray-100);
  padding: 0.125em 0.4em;
  border-radius: 6px;
  color: var(--b-ink);
}

/* ---- Layout shell ---- */

.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main {
  flex: 1;
  padding: 0;
}

/* ---- Header ---- */

header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  height: 64px;
}

.brand {
  font-weight: 800;
  font-size: 1.0625rem;
  color: var(--b-ink) !important;
  letter-spacing: -0.01em;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.brand::before {
  content: "";
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background:
    radial-gradient(60% 60% at 30% 30%, var(--b-cyan) 0%, transparent 60%),
    linear-gradient(135deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
  box-shadow: 0 4px 10px -2px rgba(51, 19, 159, 0.45);
}

.brand-sub {
  display: inline-block;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--border);
  margin-left: 0.5rem;
}

header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

header nav a {
  color: var(--b-ink);
}
header nav a:hover { color: var(--accent); }

.user-chip {
  background: var(--b-gray-100);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font-size: 0.825rem;
  color: var(--b-gray-700);
  font-weight: 600;
}

.logout-form { display: inline; margin: 0; }

.link-button {
  background: none;
  border: 0;
  color: var(--b-ink);
  font: inherit;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.link-button:hover { color: var(--accent); }

/* ---- Nav dropdown (admin menu) ---- */
.nav-dropdown {
  position: relative;
}
.nav-dropdown > summary {
  list-style: none;            /* hide default disclosure triangle */
}
.nav-dropdown > summary::-webkit-details-marker { display: none; }
.nav-dropdown > summary svg {
  transition: transform 0.15s ease;
}
.nav-dropdown[open] > summary svg { transform: rotate(180deg); }

.nav-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  min-width: 16rem;
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  list-style: none;
  margin: 0;
  padding: 0.4rem;
  z-index: 100;
}
.nav-menu li { margin: 0; }
.nav-menu a {
  display: block;
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  color: var(--b-ink);
  text-decoration: none;
  font-weight: 500;
}
.nav-menu a:hover {
  background: var(--b-gray-50);
  color: var(--b-violet-2);
}
.nav-menu-title {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
}
.nav-menu-sub {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ---- Hero ---- */

.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 70% at 80% 20%, rgba(142, 231, 255, 0.18) 0%, transparent 60%),
    radial-gradient(50% 60% at 10% 90%, rgba(182, 28, 167, 0.22) 0%, transparent 60%),
    linear-gradient(180deg, var(--b-ink) 0%, var(--b-violet) 100%);
  color: var(--b-white);
  padding: clamp(4rem, 9vw, 7rem) 0 clamp(4.5rem, 10vw, 8rem);
  isolation: isolate;
}

.hero::before {
  /* Soft diagonal gradient overlay for depth */
  content: "";
  position: absolute;
  inset: -20%;
  background:
    linear-gradient(135deg,
      transparent 0%,
      rgba(135, 42, 149, 0.18) 35%,
      transparent 70%);
  z-index: -1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
}

.hero h1 {
  color: var(--b-white);
  font-weight: 800;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.05;
  margin-bottom: 1.25rem;
}

.hero h1 .accent {
  background: linear-gradient(120deg, var(--b-cyan) 0%, var(--b-magenta) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .lede {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(1.0625rem, 1.4vw, 1.25rem);
  max-width: 38rem;
  margin-bottom: 2rem;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.875rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.fine.fine--error {
  color: #ffd7d7;
  background: rgba(216, 47, 47, 0.18);
  border: 1px solid rgba(216, 47, 47, 0.35);
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  display: inline-block;
  font-size: 0.875rem;
}

/* ---- Status badge ---- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.85);
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
  animation: status-pulse 2.2s infinite cubic-bezier(0.66, 0, 0, 1);
}

@keyframes status-pulse {
  0%   { box-shadow: 0 0 0 0    rgba(34, 197, 94, 0.6); }
  70%  { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0    rgba(34, 197, 94, 0); }
}

/* Hero visual card */

.hero-visual {
  position: relative;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hero-visual::before {
  content: "● ● ●";
  display: block;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 0.3em;
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.hero-visual .line { margin: 0 0 0.35rem; white-space: pre; }
.hero-visual .c-cmt { color: rgba(255, 255, 255, 0.5); }
.hero-visual .c-key { color: var(--b-cyan); }
.hero-visual .c-str { color: #ffe19f; }
.hero-visual .c-prompt { color: var(--b-magenta); font-weight: 700; }

/* ---- Buttons ---- */

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--b-white);
  color: var(--b-ink) !important;
  font-weight: 700;
  font-size: 0.9375rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.35);
}
.cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.4);
  background: var(--b-cyan);
}
.cta:active { transform: translateY(0); }

.cta--primary {
  background: linear-gradient(135deg, var(--b-magenta) 0%, var(--b-violet-2) 100%);
  color: var(--b-white) !important;
}
.cta--primary:hover {
  background: linear-gradient(135deg, var(--b-magenta-2) 0%, var(--b-violet) 100%);
  color: var(--b-white) !important;
}

.cta--ghost {
  background: transparent;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  color: var(--b-white) !important;
  box-shadow: none;
}
.cta--ghost:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.08);
}

.cta--disabled {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55) !important;
  cursor: not-allowed;
  pointer-events: none;
  border: 1px dashed rgba(255, 255, 255, 0.18);
}

.cta-microsoft-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
}

/* ---- Feature grid ---- */

.features {
  background: var(--b-white);
  padding: clamp(4rem, 8vw, 6rem) 0;
}

.section-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  font-size: 0.75rem;
  color: var(--b-magenta);
  margin-bottom: 0.75rem;
}

.section-title {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  margin-bottom: 1rem;
}

.section-lede {
  color: var(--b-gray-700);
  max-width: 42rem;
  font-size: 1.0625rem;
  margin-bottom: 3rem;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
@media (max-width: 880px) {
  .feature-grid { grid-template-columns: 1fr; }
}

.feature {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.feature:hover {
  transform: translateY(-3px);
  border-color: var(--b-violet-3);
  box-shadow: var(--shadow-md);
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
  color: var(--b-white);
  margin-bottom: 0.5rem;
}
.feature-icon svg { width: 22px; height: 22px; stroke-width: 2; }

.feature h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--b-ink);
  margin: 0;
}

.feature p {
  color: var(--b-gray-700);
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ---- How-it-works ---- */

.how {
  background: linear-gradient(180deg, var(--b-gray-50) 0%, var(--b-white) 100%);
  padding: clamp(4rem, 8vw, 6rem) 0;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  counter-reset: step;
}
@media (max-width: 880px) { .how-grid { grid-template-columns: 1fr; } }

.step {
  position: relative;
  padding: 1.5rem 1.5rem 1.5rem 4rem;
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
  color: var(--b-white);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-sans);
}
.step h3 { font-size: 1.0625rem; margin-bottom: 0.4rem; }
.step p { color: var(--b-gray-700); font-size: 0.9375rem; margin: 0; }

/* ---- Page hero (smaller than landing hero) ---- */

.page-hero {
  background:
    radial-gradient(60% 70% at 80% 20%, rgba(142, 231, 255, 0.14) 0%, transparent 60%),
    radial-gradient(50% 60% at 10% 90%, rgba(182, 28, 167, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, var(--b-ink) 0%, var(--b-violet) 100%);
  color: var(--b-white);
  padding: 3rem 0 3.5rem;
  margin-bottom: 2rem;
}
.page-hero .container { max-width: 1180px; padding-inline: 1.5rem; }
.page-hero h1 {
  color: var(--b-white);
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  margin: 0 0 0.5rem;
}
.page-hero .lede {
  color: rgba(255, 255, 255, 0.78);
  font-size: 1rem;
  max-width: 48rem;
  margin: 0;
}

.identity-card {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0.5rem 1rem 0.5rem 0.5rem;
  margin-bottom: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: 0.875rem;
}
.identity-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--b-cyan) 0%, var(--b-magenta) 100%);
  color: var(--b-ink);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.825rem;
  letter-spacing: -0.02em;
}
.identity-text { line-height: 1.1; }
.identity-name { font-weight: 700; color: var(--b-white); }
.identity-meta { color: rgba(255, 255, 255, 0.62); font-size: 0.75rem; margin-top: 2px; }
.identity-team {
  background: rgba(142, 231, 255, 0.18);
  color: var(--b-cyan);
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-left: 0.4rem;
}

/* ---- Portal page (key management) ---- */

.page-key {
  max-width: 880px;
  margin: -3rem auto 0;
  padding: 0 1.5rem 5rem;
  position: relative;
  z-index: 1;
}
.page-key > h1 { display: none; }   /* identity card in the page-hero replaces it */

/* Card surfaces */

.surface {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}
.surface + .surface { margin-top: 1.5rem; }

.surface-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.surface-title {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--b-ink);
  margin: 0;
}
.surface-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.25rem 0 0;
}

/* Empty state (no key yet) */

.empty-state {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.empty-state-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
  display: grid;
  place-items: center;
  color: var(--b-white);
  box-shadow: var(--shadow-lg);
}
.empty-state-icon svg { width: 32px; height: 32px; stroke-width: 1.75; }
.empty-state h2 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.empty-state p {
  color: var(--b-gray-700);
  max-width: 32rem;
  margin: 0 auto 1.75rem;
  font-size: 0.9375rem;
}

/* Key status card (the normal view) */

.key-status {
  background:
    radial-gradient(80% 100% at 100% 0%, rgba(142, 231, 255, 0.08) 0%, transparent 60%),
    linear-gradient(135deg, var(--b-ink) 0%, var(--b-violet) 100%);
  color: var(--b-white);
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.key-status::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(182, 28, 167, 0.25) 0%, transparent 70%);
  pointer-events: none;
}
.key-status h2 {
  color: var(--b-white);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.5rem;
  opacity: 0.7;
}
.key-display {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--b-cyan);
  margin: 0.25rem 0 1.5rem;
}
.key-display .dots {
  color: rgba(255, 255, 255, 0.35);
  margin-right: 0.5rem;
}

.key-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}
@media (max-width: 640px) {
  .key-meta { grid-template-columns: repeat(2, 1fr); }
}

.key-meta .meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 0.4rem;
  font-weight: 700;
}
.key-meta .meta-value {
  font-weight: 600;
  color: var(--b-white);
  font-size: 0.9375rem;
}
.key-meta .meta-value code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--b-cyan);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Plain-key reveal (one-time) */

.key-reveal {
  border: 2px solid var(--b-magenta);
  background:
    linear-gradient(135deg, rgba(182, 28, 167, 0.04) 0%, rgba(51, 19, 159, 0.04) 100%),
    var(--b-white);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
}
.key-reveal-tag {
  position: absolute;
  top: -12px;
  left: 1.5rem;
  background: var(--b-magenta);
  color: var(--b-white);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}
.key-reveal-warn {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--b-gray-700);
  line-height: 1.55;
}
.key-reveal-warn-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  color: var(--b-magenta);
}
.key-reveal-value {
  font-family: var(--font-mono);
  background: var(--b-ink);
  color: var(--b-cyan);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  font-size: 1rem;
  overflow-x: auto;
  margin: 0 0 0.75rem;
  white-space: nowrap;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.key-reveal-value code { background: transparent; color: inherit; padding: 0; }

/* Snippet cards */

.snippets-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 1rem;
}
.snippet {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0 0 1rem;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.snippet:hover { border-color: var(--b-violet-3); }

.snippet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.1rem;
  background: var(--b-gray-50);
  border-bottom: 1px solid var(--border);
}
.snippet-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.snippet-icon {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--b-ink);
  color: var(--b-cyan);
}
.snippet-icon svg { width: 13px; height: 13px; }
.snippet-title {
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--b-ink);
}
.snippet-note {
  margin: 0;
  padding: 0.6rem 1.1rem;
  font-size: 0.8125rem;
  color: var(--muted);
  background: var(--b-gray-50);
  border-bottom: 1px solid var(--border);
}
.snippet-body {
  margin: 0;
  padding: 1.1rem;
  background: var(--b-ink);
  color: #e6e8ee;
  overflow-x: auto;
  font-size: 0.825rem;
  line-height: 1.65;
}
.snippet-body code { background: transparent; color: inherit; padding: 0; }

/* Copy button */

.copy-btn {
  font: 700 0.75rem / 1 var(--font-sans);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: var(--b-ink);
  color: var(--b-white);
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.copy-btn:hover { background: var(--b-violet-2); }
.copy-btn:active { transform: scale(0.97); }
.copy-btn--lg {
  font-size: 0.825rem;
  padding: 0.6rem 1.1rem;
}
.copy-btn--inline {
  background: rgba(255, 255, 255, 0.08);
  color: var(--b-cyan);
  border: 1px solid rgba(142, 231, 255, 0.2);
}
.copy-btn--inline:hover {
  background: rgba(142, 231, 255, 0.15);
  color: var(--b-cyan);
}

/* Destructive action card */

.danger-zone {
  border: 1px solid #fecaca;
  background: linear-gradient(180deg, #fef2f2 0%, var(--b-white) 100%);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.danger-zone-title {
  font-weight: 700;
  color: #991b1b;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}
.danger-zone p { color: var(--b-gray-700); font-size: 0.9rem; }
.danger-zone .cta { margin-top: 0.5rem; }

.cta--warn {
  background: var(--b-white);
  color: #991b1b !important;
  border: 1.5px solid #fecaca;
  box-shadow: none;
}
.cta--warn:hover {
  background: #991b1b;
  color: var(--b-white) !important;
  border-color: #991b1b;
}

/* Done banner (post-mint) */

.mint-success-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, var(--b-white) 100%);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  color: #065f46;
  font-size: 0.9rem;
}
.mint-success-banner svg { color: #10b981; flex-shrink: 0; }

.action-form { margin: 0; }

/* ---- Shared utilities ---- */

.alert {
  padding: 1rem 1.125rem;
  border-radius: var(--radius);
  margin: 1.25rem 0;
  font-size: 0.9375rem;
  line-height: 1.55;
  border: 1px solid transparent;
}
.alert--success {
  background: #f1fdf4;
  border-color: #c4e9cf;
  color: #166534;
}
.alert--error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.muted { color: var(--muted); }
.fine  { font-size: 0.85rem; color: var(--muted); margin-top: 1rem; }
.hint  { color: var(--b-gray-700); font-size: 0.9375rem; }

/* ---- Admin page ---- */

.page-admin {
  max-width: 1180px;
  margin: -3rem auto 0;
  padding: 0 1.5rem 5rem;
  position: relative;
  z-index: 1;
}
.page-admin > h1 { display: none; }     /* hero owns the title */

/* Deep-link tool cards (LiteLLM + Langfuse jumps) */

.tools-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) { .tools-row { grid-template-columns: 1fr; } }

.tool-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: var(--shadow-sm);
}
.tool-card:hover {
  border-color: var(--b-violet-3);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  color: inherit;
}
.tool-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--b-white);
  flex-shrink: 0;
}
.tool-icon svg { width: 22px; height: 22px; }
.tool-body { flex: 1; min-width: 0; }
.tool-body h3 {
  margin: 0 0 0.3rem;
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--b-ink);
  letter-spacing: -0.01em;
}
.tool-arrow {
  display: inline-block;
  margin-left: 0.15rem;
  color: var(--b-magenta);
  font-weight: 700;
  transition: transform 0.15s ease;
}
.tool-card:hover .tool-arrow { transform: translate(2px, -2px); }
.tool-body p {
  margin: 0;
  color: var(--b-gray-700);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Stats row */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 880px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
}
.stat-card[data-tone="ok"]::before     { background: linear-gradient(180deg, #10b981, #059669); }
.stat-card[data-tone="warn"]::before   { background: linear-gradient(180deg, #f59e0b, #d97706); }
.stat-card[data-tone="quiet"]::before  { background: linear-gradient(180deg, var(--b-gray-300), var(--b-gray-500)); }

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0 0.4rem;
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--b-ink);
  line-height: 1;
  margin: 0;
}
.stat-foot { font-size: 0.8125rem; color: var(--muted); margin-top: 0.5rem; }

/* Admin section card */

.admin-section {
  background: var(--b-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.admin-section-head {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: var(--b-gray-50);
}
.admin-section-head h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--b-ink);
}

/* Search input */

.admin-search {
  position: relative;
  display: flex;
  align-items: center;
}
.admin-search input {
  font: 500 0.875rem var(--font-sans);
  padding: 0.5rem 0.85rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--b-white);
  width: 16rem;
  color: var(--b-ink);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.admin-search input:focus {
  outline: none;
  border-color: var(--b-violet-2);
  box-shadow: 0 0 0 3px rgba(51, 19, 159, 0.12);
}
.admin-search svg {
  position: absolute;
  left: 0.7rem;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

/* Admin table — richer treatment */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--b-white);
}
.admin-table thead { background: var(--b-white); }
.admin-table th {
  text-align: left;
  padding: 0.85rem 1.25rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  background: var(--b-gray-50);
  white-space: nowrap;
}
.admin-table td {
  padding: 0.95rem 1.25rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr { transition: background 0.1s ease; }
.admin-table tbody tr:hover td { background: var(--b-gray-50); }

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--b-violet-2) 0%, var(--b-magenta) 100%);
  color: var(--b-white);
  font-weight: 800;
  font-size: 0.825rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}
.user-info { min-width: 0; }
.user-email {
  font-weight: 600;
  color: var(--b-ink);
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 22rem;
}
.user-sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.team-chip {
  background: var(--b-gray-100);
  color: var(--b-gray-700);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
}

.key-cell code {
  background: var(--b-ink);
  color: var(--b-cyan);
  padding: 0.2rem 0.55rem;
  font-size: 0.8125rem;
  border-radius: 6px;
}

.timestamp { color: var(--b-gray-700); font-size: 0.875rem; white-space: nowrap; }
.timestamp-rel { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }

.state {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  margin-left: 0.4rem;
  vertical-align: middle;
  white-space: nowrap;
}
.state--active     { background: #d1fae5; color: #065f46; }
.state--minting    { background: #fef3c7; color: #92400e; }
.state--revoking   { background: #ffedd5; color: #9a3412; }
.state--revoked    { background: var(--b-gray-100); color: var(--b-gray-700); }
.state--failed,
.state--failed_cleanup { background: #fee2e2; color: #991b1b; }

.inline-form { display: inline; margin: 0; }

.btn {
  font: 700 0.75rem / 1 var(--font-sans);
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.btn--danger {
  background: var(--b-white);
  color: #991b1b;
  border-color: #fecaca;
}
.btn--danger:hover {
  background: #991b1b;
  color: var(--b-white);
  border-color: #991b1b;
}

.empty-row td {
  text-align: center;
  padding: 3rem 1rem !important;
  color: var(--muted);
}

.alert--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

/* ---- Footer ---- */

footer {
  background: var(--b-ink);
  color: rgba(255, 255, 255, 0.7);
  padding: 1.5rem 0;
  margin-top: auto;
  font-size: 0.875rem;
}
footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
footer a { color: var(--b-cyan); }
footer a:hover { color: var(--b-white); }
.footer-meta {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
}
