/* ============================================
   EAF Backoffice — same design language as eandres.com
   ============================================ */

:root {
  --color-bg:         #F7F9FE;
  --color-hero-from:  #0B1550;
  --color-hero-to:    #16205E;
  --color-surface:    #FFFFFF;
  --color-surface-2:  #EEF1FA;
  --color-border:     #E5E9F5;
  --color-border-mid: #D3D9EF;

  --color-gold:        #2A4CF0;
  --color-gold-bright: #4C6EFF;
  --color-gold-dim:    rgba(42, 76, 240, 0.08);
  --color-blue:        #7C6CF0;
  --color-cyan:        #17B7C9;
  --color-cyan-dim:    rgba(23, 183, 201, 0.08);

  --color-text:       #0A0F1F;
  --color-text-muted: #57607A;
  --color-text-dim:   #97A0B8;

  --color-ok:      #17A673;
  --color-ok-dim:  rgba(23, 166, 115, 0.1);
  --color-warn:    #C98A17;
  --color-warn-dim: rgba(201, 138, 23, 0.1);
  --color-error:   #E0485A;
  --color-error-dim: rgba(224, 72, 90, 0.1);

  --font-display: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --font-sans:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --shadow-card: 0 14px 34px -10px rgba(42, 76, 240, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  min-height: 100vh;
}

a { color: inherit; }

/* -------------------------------------------------------
   Logo (shared with the main site)
   ------------------------------------------------------- */
.logo-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--color-text);
}
.logo-text {
  display: flex;
  align-items: baseline;
  font-family: var(--font-display);
  line-height: 1;
}
.logo-text-eaf {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.logo-text-labs {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-left: 2px;
  background: linear-gradient(135deg, var(--color-gold-bright), var(--color-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* -------------------------------------------------------
   Login
   ------------------------------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--color-bg);
}

.login-card {
  width: 100%;
  max-width: 480px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-lg, 0 30px 70px -20px rgba(42, 76, 240, 0.28));
  padding: 52px 56px;
}

.login-card .logo-lockup { margin-bottom: 30px; }
.login-card .logo-lockup svg { width: 38px; height: 38px; }
.login-card .logo-text-eaf { font-size: 1.55rem; }
.login-card .logo-text-labs { font-size: 0.92rem; }

.login-card h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin: 0 0 6px;
}
.login-card p.sub {
  color: var(--color-text-muted);
  font-size: 14.5px;
  margin: 0 0 32px;
}

label {
  display: block;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--color-text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

input {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 15px;
  margin-bottom: 22px;
}
input:focus { outline: none; border-color: var(--color-gold); background: var(--color-surface); }

button.submit {
  width: 100%;
  background: linear-gradient(110deg, var(--color-gold), var(--color-blue));
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 12px 24px -8px rgba(42, 76, 240, 0.4);
}
button.submit:disabled { opacity: 0.6; cursor: default; }

.form-error {
  color: var(--color-error);
  font-size: 13px;
  margin: -10px 0 16px;
  min-height: 16px;
}

/* -------------------------------------------------------
   MFA (TOTP) setup / challenge screens
   ------------------------------------------------------- */
.mfa-qr {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  margin: 20px 0 16px;
}
.mfa-qr img { display: block; }

.mfa-manual-label {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0 0 8px;
}

.mfa-secret-code {
  display: block;
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.06em;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 24px;
  word-break: break-all;
  color: var(--color-text);
}

.otp-input {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.35em;
}

/* -------------------------------------------------------
   App shell — sidebar + content
   ------------------------------------------------------- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .logo-lockup { padding: 0 8px; margin-bottom: 28px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--color-surface-2); color: var(--color-text); }
.nav-item.active { background: var(--color-gold-dim); color: var(--color-gold); }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--color-border);
}

.logout-btn {
  width: 100%;
  background: none;
  border: 1px solid var(--color-border);
  color: var(--color-text-dim);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.logout-btn:hover { border-color: var(--color-error); color: var(--color-error); }

.content {
  flex: 1;
  min-width: 0;
  padding: 36px 40px;
}

.view { display: none; }
.view.active { display: block; }

.view-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 4px;
}
.view-sub {
  color: var(--color-text-muted);
  font-size: 13.5px;
  margin: 0 0 28px;
}

/* -------------------------------------------------------
   Stat cards (accumulated totals)
   ------------------------------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
}

.stat-label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.stat-value small {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-dim);
  margin-left: 4px;
}

.stat-card--accent .stat-value { color: var(--color-gold); }

.stat-card--balance {
  background: linear-gradient(135deg, var(--color-gold-dim), var(--color-cyan-dim));
  border-color: var(--color-border-mid);
  grid-column: span 2;
}
.stat-card--balance .stat-label { color: var(--color-gold); }
.stat-card--balance .stat-value {
  font-size: 2.1rem;
  background: linear-gradient(110deg, var(--color-gold), var(--color-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-card--balance .stat-value small { -webkit-text-fill-color: var(--color-text-dim); }

/* -------------------------------------------------------
   Resumen — per-asset balance cards
   ------------------------------------------------------- */
.balance-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.balance-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-card);
}

.balance-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
}

.balance-info { min-width: 0; }
.balance-label {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: 4px;
}
.balance-value {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.1;
  white-space: nowrap;
}
.balance-value small { font-size: 0.85rem; font-weight: 600; color: var(--color-text-dim); }

.mini-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--color-text-muted);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--color-border);
}
.mini-stats strong { color: var(--color-text); font-family: var(--font-display); font-weight: 800; }
.mini-stats .dot { color: var(--color-border-mid); }

/* -------------------------------------------------------
   Activity feed
   ------------------------------------------------------- */
.activity-list { display: flex; flex-direction: column; }
.activity-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--color-border);
}
.activity-row:last-child { border-bottom: none; padding-bottom: 0; }
.activity-row:first-child { padding-top: 0; }

.activity-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.activity-icon--payment { background: var(--color-gold-dim); color: var(--color-gold); }
.activity-icon--message { background: var(--color-cyan-dim); color: var(--color-cyan); }

.activity-text { flex: 1; min-width: 0; font-size: 13.5px; }
.activity-text b { font-family: var(--font-display); font-weight: 700; }
.activity-sub { font-size: 12px; color: var(--color-text-dim); margin-top: 1px; }

.activity-date {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--color-text-dim);
  white-space: nowrap;
}

/* -------------------------------------------------------
   Search box
   ------------------------------------------------------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  margin-bottom: 16px;
  max-width: 360px;
}
.search-box svg { flex-shrink: 0; color: var(--color-text-dim); }
.search-box input {
  border: none;
  background: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 13.5px;
  color: var(--color-text);
  width: 100%;
}

tr.row-clickable { cursor: pointer; transition: background .12s; }
tr.row-clickable:hover { background: var(--color-surface-2); }

/* -------------------------------------------------------
   Detail modal
   ------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 31, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
.modal-overlay[hidden] { display: none; }

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 560px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 28px 30px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
}
.modal-close {
  background: var(--color-surface-2);
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 16px;
  line-height: 1;
}
.modal-close:hover { color: var(--color-text); }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 20px;
  margin-bottom: 18px;
}
.detail-item { min-width: 0; }
.detail-label {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-dim);
  margin-bottom: 3px;
}
.detail-value { font-size: 14px; word-break: break-word; }
.detail-value.mono { font-family: var(--font-mono); font-size: 12.5px; }

.detail-section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-gold);
  margin: 20px 0 10px;
  padding-top: 14px;
  border-top: 1px solid var(--color-border);
}
.detail-section-title:first-child { margin-top: 0; padding-top: 0; border-top: none; }

.fee-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13.5px;
  border-bottom: 1px solid var(--color-border);
}
.fee-row:last-child { border-bottom: none; font-weight: 800; }
.fee-note {
  font-size: 11px;
  color: var(--color-text-dim);
  margin-top: 6px;
}

.raw-toggle {
  background: none;
  border: 1px dashed var(--color-border-mid);
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  font-family: var(--font-mono);
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-top: 16px;
}
.raw-json {
  background: var(--color-text);
  color: #D7E4FF;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  padding: 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
}

/* -------------------------------------------------------
   Table (orders)
   ------------------------------------------------------- */
.card-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

th {
  font-family: var(--font-display);
  color: var(--color-text-dim);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  background: var(--color-surface-2);
}

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
}
.badge--approved  { background: var(--color-ok-dim);    color: var(--color-ok); }
.badge--initiated,
.badge--pending   { background: var(--color-warn-dim);  color: var(--color-warn); }
.badge--declined,
.badge--voided,
.badge--error     { background: var(--color-error-dim); color: var(--color-error); }

/* -------------------------------------------------------
   Messages (leads) — horizontal, expandable rows
   ------------------------------------------------------- */
.lead-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lead-row {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.lead-row.is-open { border-color: var(--color-border-mid); box-shadow: var(--shadow-card); }

.lead-row-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  cursor: pointer;
  user-select: none;
}
.lead-row-head:hover { background: var(--color-surface-2); }

.lead-avatar {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-gold), var(--color-blue));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 13px;
}

.lead-row-id { flex: 1; min-width: 0; }
.lead-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14.5px;
}
.lead-company {
  font-size: 12.5px;
  color: var(--color-text-muted);
}

.lead-service-tag {
  flex-shrink: 0;
  background: var(--color-cyan-dim);
  color: var(--color-cyan);
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 4px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.lead-row-date {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-dim);
  white-space: nowrap;
}

.lead-chevron {
  flex-shrink: 0;
  color: var(--color-text-dim);
  transition: transform .18s ease;
}
.lead-row.is-open .lead-chevron { transform: rotate(180deg); color: var(--color-gold); }

.lead-row-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .2s ease;
}
.lead-row.is-open .lead-row-body { grid-template-rows: 1fr; }
.lead-row-body-inner { overflow: hidden; }

.lead-message {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-surface-2);
  border-left: 2px solid var(--color-gold);
  border-radius: 0 8px 8px 0;
  padding: 14px 16px;
  margin: 0 20px 14px;
}

.lead-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 12px;
  color: var(--color-text-dim);
  padding: 0 20px 16px;
}
.lead-meta span { display: inline-flex; align-items: center; gap: 5px; }
.lead-meta svg { flex-shrink: 0; opacity: 0.7; }

/* -------------------------------------------------------
   Dashboard charts
   ------------------------------------------------------- */
.chart-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 22px 24px 18px;
  margin-bottom: 18px;
}
.chart-card-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}




.empty-state {
  color: var(--color-text-dim);
  font-size: 13px;
  padding: 28px;
  text-align: center;
  background: var(--color-surface);
  border: 1px dashed var(--color-border-mid);
  border-radius: var(--radius-md);
}

@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    overflow-x: auto;
  }
  .sidebar .logo-lockup { margin: 0 12px 0 0; }
  .sidebar-footer { margin-top: 0; margin-left: auto; padding-top: 0; border-top: none; }
  .content { padding: 22px 18px; }
}

/* -------------------------------------------------------
   Live toast notifications
   ------------------------------------------------------- */
.toast-stack {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-gold);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.toast--show { opacity: 1; transform: translateX(0); }

.toast-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gold-dim);
  color: var(--color-gold);
}
.toast--message .toast-icon { background: var(--color-cyan-dim); color: var(--color-cyan); }

.toast-text { font-size: 13px; line-height: 1.4; }
.toast-text b { font-family: var(--font-display); font-weight: 800; display: block; margin-bottom: 2px; }
.toast-text span { color: var(--color-text-muted); }
