/* =====================================================================
   ZIVIDAX DESIGN SYSTEM
   Concept: a developer console doubling as a financial ledger — every
   API call is a transaction. Mono "ledger" numbers, stamp-style status
   badges (approved/pending/banned, like a stamped document), dark
   ink background. Signature element: the wallet ledger-strip and the
   rotated stamp badges.
   ===================================================================== */

:root {
  --ink:        #0C1015;
  --surface:    #141920;
  --surface-2:  #1B222C;
  --border:     #242C37;
  --text:       #E8ECF1;
  --text-muted: #8B95A1;
  --text-faint: #5A6472;

  --amber:      #F4B740;  /* signature accent — ledger / wallet / credit */
  --amber-dim:  #6B5526;
  --teal:       #4FD1C5;  /* AVA / live / success */
  --teal-dim:   #1E4B47;
  --danger:     #E5484D;
  --danger-dim: #4A2326;
  --success:    #3DD68C;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

p { margin: 0 0 1em; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 6px;
}

::selection { background: var(--amber-dim); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------------
   Auth pages (login / register / consent screen)
   --------------------------------------------------------------------- */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(700px 400px at 20% 0%, rgba(244,183,64,0.07), transparent 60%),
    radial-gradient(700px 400px at 80% 100%, rgba(79,209,197,0.06), transparent 60%),
    var(--ink);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  animation: rise 0.4s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--amber), #C98A1F);
  color: #1A1304;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 18px;
}

.auth-card h1 { font-size: 22px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--amber);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 18px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--amber); color: #1A1304; }
.btn-primary:hover { opacity: 0.92; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--text-faint); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

.auth-foot { margin-top: 18px; font-size: 13px; text-align: center; }
.flash {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}
.flash-error { background: var(--danger-dim); color: #FFC9CB; border: 1px solid #6B2E32; }
.flash-success { background: var(--teal-dim); color: #C9F4EF; border: 1px solid #2A6A63; }

/* Consent screen */
.consent-card { text-align: left; }
.consent-title { font-size: 19px; }
.consent-identity {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin: 18px 0;
}
.avatar-circle {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--teal-dim); color: var(--teal);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}
.consent-name { font-weight: 600; font-size: 14px; }
.consent-scope { margin-bottom: 22px; }
.scope-list { margin: 8px 0; padding-left: 18px; color: var(--text-muted); font-size: 13.5px; }
.scope-list li { margin-bottom: 4px; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn { flex: 1; }

/* ---------------------------------------------------------------------
   App shell (console + admin)
   --------------------------------------------------------------------- */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 28px; padding: 0 6px;
}
.sidebar-brand .brand-mark { margin: 0; width: 32px; height: 32px; font-size: 15px; border-radius: 8px; }
.sidebar-brand span { font-family: var(--font-display); font-weight: 700; font-size: 15px; }

.nav-group { margin-bottom: 18px; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--amber-dim); color: var(--amber); }
.nav-icon { width: 16px; text-align: center; opacity: 0.85; }

.sidebar-foot { margin-top: auto; padding: 10px 6px; }
.sidebar-user { font-size: 13px; font-weight: 600; }
.sidebar-user-sub { font-size: 11.5px; color: var(--text-faint); }

.main {
  padding: 28px 36px 60px;
  max-width: 1180px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 26px; flex-wrap: wrap; gap: 12px;
}
.page-head h1 { font-size: 24px; }

/* Ledger strip — the signature wallet display */
.ledger-strip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
}
.ledger-strip::before {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent, transparent 38px, rgba(244,183,64,0.04) 38px, rgba(244,183,64,0.04) 39px);
  pointer-events: none;
}
.ledger-balance .eyebrow { margin-bottom: 4px; }
.ledger-balance .amount {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--amber);
}
.ledger-balance .amount span { color: var(--text-faint); font-size: 18px; }

/* Cards / grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.card h3 { font-size: 14px; color: var(--text-muted); font-weight: 600; margin-bottom: 10px; }
.card .stat { font-family: var(--font-mono); font-size: 26px; font-weight: 700; }

/* Stamp badges — signature status element, looks rubber-stamped */
.stamp {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border: 1.5px dashed currentColor;
  border-radius: 4px;
  transform: rotate(-2deg);
  font-weight: 700;
}
.stamp-active   { color: var(--success); }
.stamp-pending  { color: var(--amber); }
.stamp-banned, .stamp-rejected { color: var(--danger); }
.stamp-approved { color: var(--success); }

/* Tables */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; }
th, td {
  text-align: left;
  padding: 13px 18px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }
td.num { font-family: var(--font-mono); }

/* Key display */
.key-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  font-family: var(--font-mono);
  font-size: 13px;
  margin-bottom: 8px;
}
.key-row code { flex: 1; overflow-x: auto; white-space: nowrap; color: var(--teal); }

/* Code blocks (docs) */
.code-block {
  position: relative;
  background: #0A0D12;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  margin: 14px 0 20px;
  overflow-x: auto;
}
.code-block pre { margin: 0; font-family: var(--font-mono); font-size: 12.5px; color: #C9D6E3; line-height: 1.6; }
.code-block .copy-btn {
  position: absolute; top: 10px; right: 10px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 11px; font-family: var(--font-mono);
  padding: 4px 8px; border-radius: 4px; cursor: pointer;
}
.code-block .copy-btn:hover { color: var(--text); }

.tag-ava  { color: var(--teal); }
.tag-nyzo { color: var(--amber); }

.divider { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

.empty-state {
  text-align: center; padding: 50px 20px; color: var(--text-faint);
}

/* Forms inside cards */
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-form .field { margin-bottom: 0; flex: 1; min-width: 160px; }

/* Responsive */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
