@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap");

/* ─── Design Tokens ─── */
:root {
  --bg: #f5f5f4;
  --bg-subtle: #efedeb;
  --surface-0: #fafaf9;
  --surface-1: #f0eeec;
  --surface-2: #e7e5e4;
  --surface-3: #d6d3d1;
  --ink-900: #1c1917;
  --ink-700: #44403c;
  --ink-500: #78716c;
  --ink-400: #a8a29e;
  --ink-300: #d6d3d1;
  --brand: #059669;
  --brand-light: #10b981;
  --brand-subtle: rgba(5, 150, 105, 0.06);
  --brand-glow: rgba(5, 150, 105, 0.18);
  --emerald: #059669;
  --emerald-bg: rgba(5, 150, 105, 0.08);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.08);
  --rose: #dc2626;
  --rose-bg: rgba(220, 38, 38, 0.06);
  --cyan: #0891b2;
  --gradient-card: linear-gradient(135deg, #fafaf9 0%, #e7e5e4 100%);
  --gradient-card-shine: linear-gradient(135deg, rgba(5, 150, 105, 0.08) 0%, transparent 50%, rgba(5, 150, 105, 0.03) 100%);
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 22px;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04), 0 1px 3px rgba(28, 25, 23, 0.06);
  --shadow-md: 0 4px 12px rgba(28, 25, 23, 0.06), 0 1px 3px rgba(28, 25, 23, 0.04);
  --shadow-lg: 0 12px 36px rgba(28, 25, 23, 0.1), 0 4px 12px rgba(28, 25, 23, 0.06);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --mono: "JetBrains Mono", "Fira Code", "SF Mono", monospace;
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
html, body { min-height: 100dvh; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink-700);
  background: var(--bg);
  line-height: 1.5;
  font-size: 14px;
}

/* ─── Subtle background ─── */
.bg-layer {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 70% 50% at 0% 0%, rgba(5, 150, 105, 0.03), transparent),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(5, 150, 105, 0.02), transparent);
}

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0.25;
  background-image:
    linear-gradient(to right, rgba(28, 25, 23, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(28, 25, 23, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 60% 40% at 50% 0%, black 0%, transparent 70%);
}

/* ─── Layout ─── */
.screen { position: relative; z-index: 1; }
.hidden { display: none !important; }

/* ─── Typography ─── */
.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  font-family: var(--mono);
}

h1 { font-size: 34px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.15; color: var(--ink-900); }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink-900); margin: 6px 0; }
h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; color: var(--ink-900); margin: 4px 0; }

.subhead { margin: 0; color: var(--ink-500); font-size: 14px; line-height: 1.6; }
.meta { font-size: 12px; color: var(--ink-500); }

/* ─── "Machine code" inline highlight ─── */
.mono-tag {
  font-family: var(--mono);
  font-size: 0.85em;
  font-weight: 500;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 7px;
  color: var(--ink-700);
}

/* ─── Form Elements ─── */
input, select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink-900);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder { color: var(--ink-400); }
select option { background: #fff; color: var(--ink-900); }

input:hover, select:hover {
  border-color: var(--border-strong);
}

input:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
}

input:disabled, select:disabled {
  background: var(--surface-1);
  color: var(--ink-500);
  cursor: not-allowed;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-500);
  letter-spacing: 0.01em;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2378716c' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 34px;
}

/* ─── Grid ─── */
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ─── Buttons ─── */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--brand);
  color: #fff;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 20px;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast), box-shadow var(--transition-fast);
  position: relative;
}

.btn:hover {
  background: var(--brand-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active { transform: translateY(0); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.secondary { background: #0891b2; }
.btn.secondary:hover { background: #0e7490; }

.btn.ghost {
  background: transparent;
  color: var(--ink-700);
  border: 1px solid var(--border-strong);
}

.btn.ghost:hover {
  background: var(--surface-2);
  border-color: var(--ink-400);
  color: var(--ink-900);
  transform: none;
  box-shadow: none;
}

.btn.compact { padding: 7px 14px; font-size: 13px; }

.btn.danger { background: var(--rose); color: #fff; }
.btn.danger:hover { background: #b91c1c; }
.btn.ghost.danger { background: transparent; color: var(--rose); border-color: var(--border-strong); }
.btn.ghost.danger:hover { background: rgba(239, 68, 68, 0.08); border-color: var(--rose); color: #b91c1c; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }

/* ─── Badges ─── */
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid rgba(5, 150, 105, 0.15);
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge.muted {
  background: var(--surface-1);
  color: var(--ink-500);
  border-color: var(--border);
  font-family: var(--mono);
}

.badge.success {
  background: var(--emerald-bg);
  color: var(--emerald);
  border-color: rgba(5, 150, 105, 0.15);
}

.badge.danger {
  background: var(--rose-bg);
  color: var(--rose);
  border-color: rgba(220, 38, 38, 0.15);
}

/* ═══════════════════════════════════════════
   AUTH SCREEN
   ═══════════════════════════════════════════ */

.auth-screen {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-shell {
  width: min(1100px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(28, 25, 23, 0.08), 0 4px 16px rgba(28, 25, 23, 0.04);
  border: 1px solid var(--border);
}

/* Left panel - visual */
.auth-visual {
  background: linear-gradient(160deg, #f0fdf4 0%, #ecfdf5 40%, #f0fdf4 100%);
  color: var(--ink-900);
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  position: relative;
  overflow: hidden;
}

.auth-visual::before {
  content: "";
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 100%, rgba(5, 150, 105, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(5, 150, 105, 0.04), transparent);
  pointer-events: none;
}

.auth-visual > * { position: relative; z-index: 1; }
.auth-visual h1 { margin: 0; color: var(--ink-900); }
.auth-visual .subhead { font-size: 15px; max-width: 380px; color: var(--ink-500); margin-top: -10px; }

/* Floating card mockup */
.auth-card-mockup {
  display: flex;
  justify-content: center;
  perspective: 800px;
  margin-top: 8px;
}

.mockup-card {
  width: 320px;
  height: 200px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
  border: 1px solid rgba(5, 150, 105, 0.2);
  box-shadow: 0 8px 30px rgba(28, 25, 23, 0.15), 0 0 20px rgba(5, 150, 105, 0.06);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  transform: rotateY(-5deg) rotateX(5deg);
  animation: card-float 6s ease-in-out infinite;
}

.mockup-card::before {
  content: "";
  position: absolute; inset: 0;
  background: var(--gradient-card-shine);
  pointer-events: none;
}

.mockup-card-logo {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

.mockup-card-logo .logo-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 8px rgba(5, 150, 105, 0.6);
}

.mockup-card-number {
  font-family: var(--mono);
  font-size: 16px;
  letter-spacing: 0.15em;
  color: rgba(255,255,255,0.6);
}

.mockup-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.mockup-card-name {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.4);
}

.mockup-card-exp {
  font-family: var(--mono);
  font-size: 12px;
  color: rgba(255,255,255,0.35);
}

.mockup-card-chip {
  width: 36px; height: 28px;
  border-radius: 5px;
  background: linear-gradient(135deg, #059669 0%, #10b981 40%, #047857 100%);
  opacity: 0.85;
  position: absolute;
  top: 60px; left: 24px;
}

.mockup-card-chip::after {
  content: "";
  position: absolute; inset: 3px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.15);
}

@keyframes card-float {
  0%, 100% { transform: rotateY(-5deg) rotateX(5deg) translateY(0); }
  50% { transform: rotateY(-3deg) rotateX(3deg) translateY(-8px); }
}

/* Feature list */
.feature-list {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  max-width: 400px;
}

.feature-list article {
  border: 1px solid rgba(5, 150, 105, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  padding: 14px 16px;
  transition: background var(--transition-fast), border-color var(--transition-fast);
  backdrop-filter: blur(4px);
}

.feature-list article:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(5, 150, 105, 0.25);
}

.feature-list h3 {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  font-family: var(--mono);
}

.feature-list p { margin: 0; font-size: 12px; color: var(--ink-500); }

/* Right panel - form */
.auth-card {
  background: #fff;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card-inner {
  width: 100%;
  max-width: 360px;
  padding: 48px 0;
}

.eyebrow.logo {
  font-size: 13px;
  letter-spacing: 0.12em;
}

.auth-card-inner .eyebrow.logo { margin-bottom: 16px; }
.auth-card-inner h2 { margin: 0 0 6px; font-size: 24px; }
.auth-card-inner .subhead { margin-bottom: 28px; font-size: 14px; }

/* Mode switch pill */
.mode-switch {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 3px;
  margin: 0 0 28px;
  position: relative;
}

.mode-btn {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-500);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 0;
  cursor: pointer;
  transition: color var(--transition-fast);
  border-radius: calc(var(--radius-md) - 3px);
  text-align: center;
  position: relative;
  z-index: 1;
}

.mode-btn:hover { color: var(--ink-700); }

.mode-btn.active {
  color: var(--brand);
}

/* Sliding indicator behind active tab */
.mode-indicator {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(50% - 3px);
  height: calc(100% - 6px);
  background: #fff;
  border-radius: calc(var(--radius-md) - 3px);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-base);
  z-index: 0;
}

.mode-btn:last-of-type.active ~ .mode-indicator,
.mode-switch:has(.mode-btn:last-of-type.active) .mode-indicator {
  transform: translateX(100%);
}

/* Auth form fields */
.auth-fields {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 24px;
}

.auth-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.auth-field span {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-500);
}

.auth-field input {
  padding: 12px 14px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

/* Auth submit button */
.auth-submit-btn {
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

/* Auth feedback */
#auth-feedback {
  min-height: 20px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--rose);
  font-family: var(--mono);
  text-align: center;
}

/* ═══════════════════════════════════════════
   APP SCREEN (Dashboard)
   ═══════════════════════════════════════════ */

.app-screen {
  display: block;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
}

.app-shell {
  max-width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 32px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  border-radius: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-left .eyebrow { margin: 0; }

.header-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.header-account-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-400);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Metric Grid */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

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

.metric-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: border-color var(--transition-fast);
}

.metric-card:hover {
  border-color: var(--border-strong);
}

.metric-card span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-500);
  font-weight: 600;
  font-family: var(--mono);
}

.metric-card strong {
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: -0.02em;
  font-family: var(--mono);
}

.metric-card small {
  font-size: 11px;
  color: var(--ink-400);
  font-weight: 400;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0;
  padding: 0 32px;
  background: #fff;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  box-shadow: none;
}

.tab-btn {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--ink-500);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: none;
  text-align: center;
}

.tab-btn:hover {
  color: var(--ink-700);
  background: transparent;
}

.tab-btn.active {
  color: var(--brand);
  background: transparent;
  border-bottom-color: var(--brand);
  font-weight: 600;
}

/* Tab Content */
.tab-content {
  display: grid;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
  padding: 24px 32px;
}

.tab-panel { display: none; gap: 16px; }
.tab-panel.active { display: grid; }

/* Panels */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 18px 20px;
  box-shadow: none;
  transition: border-color var(--transition-fast);
}

.panel:hover { border-color: var(--border-strong); }

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-head .actions { margin-top: 0; }

.panel-copy {
  margin: 0 0 14px;
  color: var(--ink-500);
  font-size: 13px;
}

/* Welcome Banner */
.welcome-banner {
  background: var(--brand-subtle);
  border-color: rgba(5, 150, 105, 0.15);
  padding: 14px 20px;
}

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

.welcome-content h3 { color: var(--brand); font-size: 14px; margin: 0; }
.welcome-content .subhead { font-size: 13px; margin: 2px 0 0; }
.welcome-content .actions { margin-top: 0; flex-shrink: 0; }
.welcome-content .btn { padding: 8px 16px; font-size: 13px; }

/* Quick Actions */
.quick-actions-row {
  display: flex;
  gap: 8px;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-700);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: none;
}

.quick-action-btn svg { color: var(--ink-400); flex-shrink: 0; width: 16px; height: 16px; }

.quick-action-btn:hover {
  border-color: var(--border-strong);
  color: var(--ink-900);
  background: var(--surface-1);
}

.quick-action-btn:hover svg { color: var(--brand); }

.quick-action-btn:active { transform: none; }

/* Transaction Table */
.txn-table-header, .txn-row {
  display: grid;
  grid-template-columns: 130px 1fr 140px 100px 100px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.txn-table-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-400);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
}

.txn-row {
  font-size: 13px;
  color: var(--ink-700);
  border-bottom: 1px solid var(--surface-2);
  transition: background var(--transition-fast);
}

.txn-row:last-child { border-bottom: 0; }
.txn-row:hover { background: var(--surface-1); }

.txn-col-date { font-family: var(--mono); font-size: 12px; color: var(--ink-500); }
.txn-col-merchant { font-weight: 500; }
.txn-col-agent { font-family: var(--mono); font-size: 12px; color: var(--ink-500); }
.txn-col-amount { font-family: var(--mono); font-weight: 600; text-align: right; }
.txn-col-status { text-align: right; }

.txn-mcc {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-400);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
}

.txn-empty {
  padding: 32px 0;
  text-align: center;
  color: var(--ink-400);
  font-size: 13px;
}

/* Inline Form Toggle */
.inline-form { margin-top: 0; margin-bottom: 16px; }
.inline-form.hidden { display: none; }

.inline-form-divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Spend Progress Bar */
.spend-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-2);
  margin-top: 8px;
  overflow: hidden;
}

.spend-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--brand);
  transition: width var(--transition-base);
}

.spend-bar-fill.warning { background: var(--amber); }
.spend-bar-fill.danger { background: var(--rose); }

/* API Keys Table */
.keys-table-header, .key-row {
  display: grid;
  grid-template-columns: 1fr 180px 70px 120px 100px 80px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

.keys-table-header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-400);
  font-family: var(--mono);
  border-bottom: 1px solid var(--border);
}

.key-row {
  font-size: 13px;
  color: var(--ink-700);
  border-bottom: 1px solid var(--surface-2);
  transition: background var(--transition-fast);
}

.key-row:last-child { border-bottom: 0; }
.key-row:hover { background: var(--surface-1); }

.key-col-name { font-weight: 500; }

.key-col-prefix {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-500);
}

.key-col-prefix code {
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

.key-col-type {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-500);
  text-transform: uppercase;
}

.key-col-agent {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-500);
}

.key-col-created {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-400);
}

.key-col-actions {
  display: flex;
  justify-content: flex-end;
}

.key-row.revoked { opacity: 0.5; }
.key-row.revoked .key-col-name { text-decoration: line-through; }

/* Key Created Banner */
.key-created-banner {
  background: rgba(5, 150, 105, 0.06);
  border: 1px solid rgba(5, 150, 105, 0.15);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
}

.key-created-banner.hidden { display: none; }

.key-created-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key-created-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--brand);
}

.key-created-value {
  display: flex;
  align-items: center;
  gap: 8px;
}

.key-created-value code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-900);
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 4px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

/* Account Info */
.account-info-row {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}

.account-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.account-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--ink-400);
  font-family: var(--mono);
}

.account-detail-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-900);
}

.account-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--mono);
  text-transform: capitalize;
  color: var(--ink-500);
}

.account-status-indicator .status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-400);
}

.account-status-indicator.status-active { color: var(--emerald); }
.account-status-indicator.status-active .status-dot { background: var(--emerald); box-shadow: 0 0 6px rgba(5, 150, 105, 0.4); }

.account-status-indicator.status-pending { color: var(--amber); }
.account-status-indicator.status-pending .status-dot { background: var(--amber); box-shadow: 0 0 6px rgba(217, 119, 6, 0.4); }

.account-status-indicator.status-inactive { color: var(--ink-400); }
.account-status-indicator.status-inactive .status-dot { background: var(--ink-400); }

/* Policy Row */
.policies-list { display: grid; gap: 6px; }

.policy-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 12px 16px;
  transition: border-color var(--transition-fast);
}

.policy-item:hover { border-color: var(--border-strong); }

.policy-item .policy-info { display: flex; flex-direction: column; gap: 2px; }

.policy-item .policy-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}

.policy-item .policy-rules {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-500);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(28, 25, 23, 0.4);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  animation: modal-fade-in 0.2s ease;
}

.modal-overlay.hidden { display: none; }

.modal-dialog {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modal-slide-in 0.25s ease;
}

.modal-dialog.modal-sm { max-width: 520px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 0;
  gap: 16px;
}

.modal-header h3 { margin: 0 0 4px; }

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px 24px;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-slide-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Stripe Payment */
#stripe-payment-wrap {
  margin-top: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  padding: 16px;
}

#payment-element { margin-bottom: 10px; min-height: 164px; }
.payment-hint { margin: 0; }
.payment-hint.error { color: var(--rose); }
.payment-hint.info { color: var(--ink-500); }

/* Cards Grid */
.cards { display: grid; gap: 6px; }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.card h3 { margin: 0 0 6px; font-size: 15px; }

/* Code Block — terminal look for agent logs */
.code {
  margin: 0;
  border-radius: var(--radius-md);
  border: 1px solid #1e293b;
  background: #0f172a;
  color: #94a3b8;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  min-height: 120px;
  max-height: 400px;
  overflow: auto;
  padding: 14px 16px;
}

.code::-webkit-scrollbar { width: 6px; height: 6px; }
.code::-webkit-scrollbar-track { background: transparent; }
.code::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }

/* Toast Stack */
.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink-700);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  animation: toast-in 0.3s ease;
  font-family: var(--mono);
}

.toast.success {
  border-color: rgba(5, 150, 105, 0.25);
  background: rgba(5, 150, 105, 0.06);
  color: var(--emerald);
}

.toast.error {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(220, 38, 38, 0.06);
  color: var(--rose);
}

.toast.info {
  border-color: rgba(8, 145, 178, 0.25);
  background: rgba(8, 145, 178, 0.06);
  color: #0891b2;
}

/* Animations */
@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-float {
  0%, 100% { transform: rotateY(-5deg) rotateX(5deg) translateY(0); }
  50% { transform: rotateY(-3deg) rotateX(3deg) translateY(-8px); }
}

/* Agent card in list */
.agent-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 14px 18px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.agent-card-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.agent-card-item .agent-info { display: flex; flex-direction: column; gap: 2px; }

.agent-card-item .agent-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}

.agent-card-item .agent-id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-500);
  background: var(--surface-1);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 4px;
  display: inline-block;
  margin-top: 2px;
}

.agent-card-item .agent-status {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.agent-card-item.deleted {
  opacity: 0.5;
  border-style: dashed;
}

/* Issued Card in list */
.issued-card-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 16px 18px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.issued-card-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.issued-card-icon {
  width: 44px; height: 30px;
  border-radius: 6px;
  background: linear-gradient(135deg, #1c1917 0%, #292524 100%);
  border: 1px solid rgba(5, 150, 105, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: 700;
  color: rgba(5, 150, 105, 0.5);
  letter-spacing: 0.1em;
}

.issued-card-details { display: flex; flex-direction: column; gap: 2px; }

.issued-card-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}

.issued-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-500);
  display: flex;
  gap: 12px;
}

.issued-card-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.issued-card-spend {
  font-size: 14px;
  font-weight: 700;
  font-family: var(--mono);
  color: var(--ink-900);
}

.issued-card-limit {
  font-size: 11px;
  color: var(--ink-500);
  font-family: var(--mono);
}

/* Status indicators */
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.active { background: var(--emerald); box-shadow: 0 0 4px rgba(5, 150, 105, 0.3); }
.status-dot.frozen { background: var(--cyan); box-shadow: 0 0 4px rgba(8, 145, 178, 0.3); }
.status-dot.closed { background: var(--ink-400); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-400); }

/* ─── Docs Tab ─── */
.docs-panel { padding: 24px 28px; }

.docs-section {
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.docs-section:last-child { border-bottom: none; }

.docs-section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-900);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

.docs-section-desc {
  font-size: 13px;
  color: var(--ink-500);
  margin: 0 0 14px;
  line-height: 1.5;
}

.docs-endpoint {
  margin-bottom: 14px;
}

.docs-endpoint:last-child { margin-bottom: 0; }

.docs-endpoint-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.docs-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.docs-method.get { background: rgba(5, 150, 105, 0.1); color: #059669; }
.docs-method.post { background: rgba(37, 99, 235, 0.1); color: #2563eb; }
.docs-method.patch { background: rgba(217, 119, 6, 0.1); color: #d97706; }
.docs-method.delete { background: rgba(220, 38, 38, 0.1); color: #dc2626; }

.docs-path {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  background: none;
  border: none;
  padding: 0;
}

.docs-scope {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-400);
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  margin-left: auto;
}

.docs-code-block {
  border: 1px solid #1e293b;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #0f172a;
}

.docs-code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: #1e293b;
  border-bottom: 1px solid #334155;
}

.docs-code-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
}

.docs-copy-btn {
  padding: 3px 10px !important;
  font-size: 11px !important;
  border-color: #334155 !important;
  color: #94a3b8 !important;
}

.docs-copy-btn:hover {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

.docs-code {
  margin: 0;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #e2e8f0;
  overflow-x: auto;
  white-space: pre;
  background: #0f172a;
}

.docs-dim { color: #475569; }
.docs-kw { color: #7dd3fc; }
.docs-str { color: #86efac; }
.docs-comment { color: #475569; font-style: italic; }

.docs-notes {
  display: grid;
  gap: 8px;
}

.docs-note {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-500);
  line-height: 1.5;
}

.docs-note strong {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
  font-family: var(--mono);
  flex-shrink: 0;
  min-width: 100px;
}

/* ─── Responsive ─── */
@media (max-width: 1080px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-card { border-radius: var(--radius-2xl); }

  .tab-content { padding: 20px 24px; }

  .metric-grid,
  .metric-grid.three-col,
  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .quick-actions-row { flex-wrap: wrap; }

  .txn-table-header, .txn-row {
    grid-template-columns: 100px 1fr 100px 80px;
  }
  .txn-col-agent { display: none; }

  .keys-table-header, .key-row {
    grid-template-columns: 1fr 160px 70px 100px 80px;
  }
  .key-col-created { display: none; }

  .welcome-content { flex-direction: column; align-items: flex-start; }

  .modal-dialog { max-width: 90vw; }
}

@media (max-width: 760px) {
  .grid.two,
  .grid.three,
  .grid.four,
  .metric-grid,
  .metric-grid.three-col {
    grid-template-columns: 1fr;
  }

  .tab-content { padding: 16px; }
  .tabs { padding: 0 16px; }

  .app-header {
    flex-direction: column;
    align-items: stretch;
    padding: 12px 16px;
  }

  .header-left { flex-direction: column; align-items: flex-start; gap: 6px; }
  .header-right { justify-content: space-between; }

  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .tab-btn {
    white-space: nowrap;
    flex: none;
  }

  .toast-stack {
    left: 12px;
    right: 12px;
    width: auto;
  }

  .auth-card { padding: 0 20px; }

  .issued-card-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .issued-card-right {
    align-items: flex-start;
    flex-direction: row;
    gap: 12px;
  }

  .txn-table-header, .txn-row {
    grid-template-columns: 80px 1fr 80px;
  }
  .txn-col-agent, .txn-col-status { display: none; }

  .keys-table-header, .key-row {
    grid-template-columns: 1fr 140px 80px;
  }
  .key-col-type, .key-col-agent, .key-col-created { display: none; }

  .key-created-value { flex-wrap: wrap; }
  .key-created-value code { min-width: 0; }

  .modal-dialog {
    max-width: 100%;
    max-height: 85vh;
  }
}
