/* Alvear Lending — design system v3 (Brand Kit applied)
 * Brand tokens from Alvear_logo_styles.pdf:
 *   Headings: Proxima Nova Extrabold  (Manrope as free fallback)
 *   Body:     Proxima Nova Light      (Manrope as free fallback)
 *   Accent:   Museo Moderno Regular   (Google Fonts, free)
 * Palette: #2ce584 (green) · #000000 · #4c5679 (slate) · #dbe2f5 (lavender) · #fafafa
 * Visual DNA: tonal Tesla-light surfaces, 16px radius, brand green strictly
 * for CTAs/active states, slate for secondary structure, generous whitespace. */

:root {
  /* === Surfaces (Tesla-light tonal layers) === */
  --bg: #ffffff;
  --surface: #fafafa;
  --surface-1: #f7f7f8;
  --surface-2: #f2f2f4;
  --surface-3: #e8e8ea;
  --surface-inverse: #0d0f10;

  /* === Brand === */
  --brand-green:      #2ce584;  /* primary brand green */
  --brand-green-dim:  #22c970;  /* hover/pressed */
  --brand-green-deep: #1a8c50;  /* text on light, success-fg */
  --brand-green-soft: #e8faf0;  /* tinted bg */
  --brand-slate:      #4c5679;  /* secondary brand (logo blue) */
  --brand-slate-soft: #dbe2f5;  /* lavender tint */
  --brand-ink:        #000000;  /* brand black */

  /* Aliases kept for backwards compatibility with existing components */
  --neon: var(--brand-green);
  --neon-dim: var(--brand-green-dim);
  --neon-soft: var(--brand-green-soft);
  --primary: var(--brand-green-deep);
  --primary-on: #ffffff;

  /* === Text === */
  --on-surface: #0d0f10;
  --on-surface-muted: #5b6166;
  --on-surface-faint: #8c9197;
  --on-surface-disabled: #b9bdc1;

  /* === Borders === */
  --outline: #e5e5e7;
  --outline-strong: #d1d3d7;
  --outline-faint: #f0f0f2;

  /* === Status === */
  --success: var(--brand-green);
  --success-bg: var(--brand-green-soft);
  --success-fg: var(--brand-green-deep);
  --warning-bg: #fef6e7;
  --warning-fg: #a96b00;
  --error-bg: #ffeceb;
  --error-fg: #b3261e;
  --info-bg: var(--brand-slate-soft);
  --info-fg: var(--brand-slate);

  /* === Radii === */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 999px;

  /* === Spacing === */
  --gap-xs: 4px;
  --gap-sm: 8px;
  --gap-md: 16px;
  --gap-lg: 24px;
  --gap-xl: 40px;
  --gap-2xl: 64px;

  /* === Elevation === */
  --shadow-modal: 0 10px 30px rgba(13, 15, 16, 0.08);
  --shadow-glow: 0 0 0 4px rgba(0, 255, 136, 0.18);

  /* === Typography === */
  /* Brand spec: Proxima Nova Extrabold/Light (Adobe Fonts).
     Manrope is loaded as a free Proxima Nova alternative,
     so the type system works even without an Adobe kit. */
  --font-sans: 'Proxima Nova', 'Manrope', 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Proxima Nova', 'Manrope', 'Inter', system-ui, sans-serif;
  --font-accent: 'MuseoModerno', 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--on-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--neon); color: #000; }

/* Typography scale — headings use the display font (Proxima Nova → Manrope) */
.t-display { font-family: var(--font-display); font-size: 56px; line-height: 1.05; letter-spacing: -0.03em; font-weight: 800; }
.t-h1 { font-family: var(--font-display); font-size: 40px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 800; }
.t-h2 { font-family: var(--font-display); font-size: 28px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 800; }
.t-h3 { font-family: var(--font-display); font-size: 20px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; }
.t-h4 { font-family: var(--font-display); font-size: 16px; line-height: 1.4; font-weight: 700; }
.t-body { font-size: 15px; line-height: 1.6; color: var(--on-surface); font-weight: 400; }
.t-body-lg { font-size: 17px; line-height: 1.55; color: var(--on-surface); font-weight: 400; }
.t-secondary, .text-secondary { color: var(--on-surface-muted); }
.t-faint { color: var(--on-surface-faint); }
.t-mono, .num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.t-xs, .text-xs { font-size: 12px; }
.t-sm, .text-sm { font-size: 13px; }

/* Accent voice — Museo Moderno (quotes, eyebrow flourishes) */
.t-accent, .quote {
  font-family: var(--font-accent);
  font-weight: 400;
  letter-spacing: 0;
}

/* Brand logo helpers — drop in <img class="brand-logo"> for the wordmark */
.brand-logo { display: block; height: 28px; width: auto; }
.brand-logo-sm { height: 22px; }
.brand-logo-lg { height: 40px; }

.label-caps {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-surface-muted);
}

/* Layout */
.container { max-width: 1280px; margin: 0 auto; padding: 0 32px; }
.container-md { max-width: 960px; margin: 0 auto; padding: 0 32px; }
.container-sm { max-width: 600px; margin: 0 auto; padding: 0 32px; }
.section, .page-section { padding: 48px 0; }
.section-lg { padding: 80px 0; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 24px; }
.stack-xl > * + * { margin-top: 40px; }
.stack-sm > * + * { margin-top: 8px; }
.row { display: flex; gap: 16px; align-items: center; }
.row-wrap { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-sidebar { grid-template-columns: 1fr 320px; gap: 32px; }
.gap-lg { gap: 32px; }

/* Nav (sticky + glassmorphism) */
.nav-bar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--outline-faint);
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  gap: 24px;
}
.nav-logo {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
.nav-logo .dot {
  display: inline-block; width: 7px; height: 7px;
  background: var(--neon); border-radius: 999px;
  margin-left: 4px; vertical-align: middle;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a {
  font-size: 14px; font-weight: 500;
  color: var(--on-surface-muted);
  padding-bottom: 2px;
  transition: color .15s;
}
.nav-links a:hover { color: var(--on-surface); }
.nav-links a.active {
  color: var(--on-surface);
  border-bottom: 2px solid var(--neon);
  padding-bottom: 0;
}
.nav-cta { display: flex; gap: 12px; align-items: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--r-md);
  border: 0;
  font-size: 14px; font-weight: 600;
  letter-spacing: -0.005em;
  transition: transform .1s, background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }

.btn-primary { background: var(--neon); color: #000; font-weight: 700; }
.btn-primary:hover:not(:disabled) {
  background: var(--neon-dim);
  box-shadow: 0 0 0 4px rgba(0, 255, 136, 0.16);
}

.btn-secondary {
  background: var(--surface-1); color: var(--on-surface);
  border: 1px solid var(--outline);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-2); border-color: var(--outline-strong);
}

.btn-ghost { background: transparent; color: var(--on-surface-muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-1); color: var(--on-surface); }

.btn-danger { background: var(--error-bg); color: var(--error-fg); }
.btn-danger:hover:not(:disabled) { background: #fcd5d3; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 15px; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-elevated {
  background: #fff;
  border: 1px solid var(--outline-faint);
  box-shadow: 0 1px 0 rgba(13,15,16,0.02), 0 4px 16px rgba(13,15,16,0.04);
}
.card-soft {
  background: var(--surface-1);
  border: 1px solid var(--outline-faint);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card-inverse {
  background: var(--surface-inverse);
  color: #fff;
  border-radius: var(--r-lg);
  padding: 32px;
}
.card-inverse .label-caps { color: var(--on-surface-faint); }

/* Ticket card (deal summary) */
.ticket {
  position: relative;
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: var(--r-lg);
  padding: 28px;
  overflow: hidden;
}
.ticket::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--neon);
}
.ticket-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px dashed var(--outline);
}
.ticket-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.ticket-grid .label-caps { margin-bottom: 6px; }
.ticket-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }

/* Inputs */
.field { display: block; }
.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--on-surface-muted);
  margin-bottom: 8px;
}
.field-label .optional {
  font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--on-surface-faint); font-size: 11px;
}
.input {
  display: block;
  width: 100%;
  background: var(--surface-1);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 500;
  color: var(--on-surface);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--on-surface-faint); }
.input:hover { background: var(--surface-2); }
.input:focus {
  outline: 0;
  background: #fff;
  border-color: var(--on-surface);
}
.input.error { border-color: var(--error-fg); background: var(--error-bg); }
.field-help { font-size: 12px; color: var(--on-surface-faint); margin-top: 6px; }
.field-error { font-size: 12px; color: var(--error-fg); margin-top: 6px; font-weight: 500; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6166' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}
textarea.input { resize: vertical; min-height: 88px; line-height: 1.5; }

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.pill::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.9;
}
.pill.prequalified, .pill.approved, .pill.funded, .pill.paid, .pill.open { background: var(--success-bg); color: var(--success-fg); }
.pill.review, .pill.pending, .pill.submitted { background: var(--warning-bg); color: var(--warning-fg); }
.pill.outside, .pill.declined, .pill.rejected { background: var(--error-bg); color: var(--error-fg); }
.pill.restricted { background: #fff4e5; color: #b04500; }
.pill-plain { padding: 3px 9px; font-size: 10px; }
.pill-plain::before { display: none; }

.live-dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--neon); border-radius: 999px;
  vertical-align: middle;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0,255,136,0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(0,255,136,0); }
}

/* Banners */
.banner {
  padding: 14px 18px;
  border-radius: var(--r-md);
  font-size: 14px;
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid transparent;
}
.banner-info { background: var(--info-bg); color: var(--info-fg); }
.banner-warning { background: var(--warning-bg); color: var(--warning-fg); }
.banner-success { background: var(--success-bg); color: var(--success-fg); }
.banner-error { background: var(--error-bg); color: var(--error-fg); }

/* Stats */
.stat-card {
  background: #fff;
  border: 1px solid var(--outline);
  border-radius: var(--r-lg);
  padding: 20px;
}
.stat-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--on-surface-muted);
}
.stat-value {
  font-size: 32px; font-weight: 700;
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat-trend {
  display: inline-flex; gap: 4px; align-items: center;
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
}
.stat-trend.up { color: var(--success-fg); }
.stat-trend.flat { color: var(--on-surface-muted); }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--outline-faint);
}
.table th {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--on-surface-muted);
  background: transparent;
  border-bottom: 1px solid var(--outline);
}
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--surface-1); cursor: pointer; }
.table tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--neon); }
.table .row-mono { font-variant-numeric: tabular-nums; }
.table .row-dim { color: var(--on-surface-muted); font-size: 12px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(13, 15, 16, 0.4);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: var(--r-xl);
  padding: 32px;
  max-width: 520px; width: 100%;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--outline-faint);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--on-surface-muted);
}
.empty-icon, .empty .icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--surface-1);
  display: inline-flex;
  align-items: center; justify-content: center;
  margin-bottom: 20px;
  font-size: 28px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--outline-faint);
  padding: 32px 0;
  margin-top: 96px;
}
.footer-inner {
  display: flex; justify-content: space-between; align-items: flex-start;
  flex-wrap: wrap; gap: 24px;
}
.footer .legal { font-size: 12px; color: var(--on-surface-faint); max-width: 480px; line-height: 1.5; }
.footer .links {
  display: flex; gap: 28px; flex-wrap: wrap;
  font-size: 13px; color: var(--on-surface-muted);
}
.footer .links a:hover { color: var(--on-surface); }

/* Hero shells */
.page-hero {
  padding: 64px 0 32px;
  border-bottom: 1px solid var(--outline-faint);
  background: linear-gradient(180deg, #fff 0%, var(--surface) 100%);
}
.page-hero-inner {
  max-width: 1280px; margin: 0 auto; padding: 0 32px;
  display: flex;
  align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
}
.eyebrow {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--on-surface-muted);
  margin-bottom: 10px;
}

/* Misc */
.divider { height: 1px; background: var(--outline-faint); margin: 24px 0; }
.divider-dashed { height: 1px; background: transparent; border-top: 1px dashed var(--outline); margin: 24px 0; }
.hidden { display: none !important; }

/* Backwards-compat with legacy class names used in pages */
.h-display { font-family: var(--font-display); font-size: 56px; line-height: 1.05; font-weight: 800; letter-spacing: -0.03em; }
.h-lg { font-family: var(--font-display); font-size: 32px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.h-md { font-family: var(--font-display); font-size: 22px; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
.h-sm { font-family: var(--font-display); font-size: 16px; line-height: 1.3; font-weight: 700; }
.neon-bg { background: var(--neon); color: #000; }
.neon-bg:hover:not(:disabled) { background: var(--neon-dim); }

/* Responsive */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-sidebar { grid-template-columns: 1fr; }
  .ticket-grid { grid-template-columns: 1fr 1fr; }
  .t-display, .h-display { font-size: 36px; }
  .t-h1 { font-size: 28px; }
  .nav-links { display: none; }
  .container, .container-md, .container-sm { padding: 0 20px; }
  .page-hero { padding: 32px 0 16px; }
  .section, .page-section { padding: 32px 0; }
}
