/* ============================================================
   Maverick Capital · Embedded Flex Line
   App-level CSS — extends Revenued tokens, adds Maverick chrome.
   ============================================================ */

:root {
  /* Maverick chrome — Mercury/Plaid-inspired warm light neutral */
  --mv-bg:        #FAFAF7;   /* outer canvas — slightly warm off-white */
  --mv-rail:      #F4F2EC;   /* sidebar / left rail — warmer than canvas */
  --mv-surface:   #FFFFFF;   /* work surface cards */
  --mv-ink:       #1A1B1F;   /* primary text */
  --mv-ink-2:     #5B5D63;   /* secondary text */
  --mv-ink-3:     #8A8D94;   /* tertiary */
  --mv-line:      #E7E4DC;   /* warm hairline */
  --mv-line-2:    #EFEDE6;
  --mv-hover:     #EFEDE6;
  --mv-accent:    #E86B2E;   /* Maverick brand accent — coral/amber */
  --mv-accent-2:  #C44E15;
  --mv-positive:  #2D7D5B;
  --mv-negative:  #B7273A;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-primary);
  color: var(--mv-ink);
  background: var(--mv-bg);
  font-feature-settings: "ss01", "tnum" 0;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   App shell — Maverick chrome
   ============================================================ */
.mv-app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.mv-side {
  background: var(--mv-rail);
  border-right: 1px solid var(--mv-line);
  display: flex;
  flex-direction: column;
  padding: 14px 10px 10px;
  overflow: hidden;
}
.mv-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 16px;
  border-bottom: 1px solid var(--mv-line-2);
  margin-bottom: 8px;
}
.mv-brand-mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--mv-ink);
  color: var(--mv-bg);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: -0.02em;
}
.mv-brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
  color: var(--mv-ink);
}
.mv-brand-name span {
  color: var(--mv-ink-3);
  font-weight: 500;
}

/* Merchant switcher */
.mv-merchant {
  margin: 4px 4px 14px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--mv-surface);
  border: 1px solid var(--mv-line);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.mv-merchant:hover { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.04); }
.mv-merchant-mark {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6B4226 0%, #8C5A3A 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.mv-merchant-name {
  font-size: 13px; font-weight: 600;
  color: var(--mv-ink);
  line-height: 1.2;
}
.mv-merchant-role {
  font-size: 11px;
  color: var(--mv-ink-3);
  margin-top: 1px;
}
.mv-merchant-chev { margin-left: auto; color: var(--mv-ink-3); }

.mv-nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--mv-ink-3);
  padding: 14px 12px 4px;
}
.mv-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--mv-ink-2);
  cursor: pointer;
  margin: 1px 0;
  position: relative;
}
.mv-nav-item:hover { background: var(--mv-hover); color: var(--mv-ink); }
.mv-nav-item.disabled {
  opacity: 0.45;
  cursor: default;
  pointer-events: auto; /* allow tooltip on hover */
}
.mv-nav-item.disabled:hover {
  background: transparent;
  color: var(--mv-ink-2);
}
.mv-nav-item.active {
  background: var(--mv-surface);
  color: var(--mv-ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 0 0 1px var(--mv-line);
}
.mv-nav-item.active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 8px; bottom: 8px;
  width: 2px;
  background: var(--mv-accent);
  border-radius: 0 2px 2px 0;
}
.mv-nav-item .ic { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.mv-nav-item .badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--mv-accent);
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mv-side-foot {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--mv-line-2);
  display: flex; align-items: center; gap: 10px;
}
.mv-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1F2937 0%, #4B5563 100%);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 11px;
}
.mv-side-foot-name { font-size: 12px; font-weight: 600; line-height: 1.2; }
.mv-side-foot-email { font-size: 10px; color: var(--mv-ink-3); margin-top: 1px; }

/* Main area */
.mv-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--mv-bg);
}

/* Top bar */
.mv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  border-bottom: 1px solid var(--mv-line);
  background: var(--mv-bg);
  flex-shrink: 0;
}
.mv-crumb {
  font-size: 12px;
  color: var(--mv-ink-3);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mv-crumb b { color: var(--mv-ink); font-weight: 600; }

/* Top-left cluster: Back-to-home + breadcrumb */
.mv-top-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.mv-home-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  background: var(--trust-tech);
  color: #fff;
  border: 1px solid var(--trust-tech);
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms ease-out, box-shadow 140ms ease-out, background 140ms;
  box-shadow: 0 2px 6px rgba(0,18,43,0.12);
}
.mv-home-btn:hover {
  background: #0a2746;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0,18,43,0.18);
}
.mv-home-btn:active {
  transform: translateY(0);
}
.mv-search {
  width: 320px;
  padding: 7px 12px 7px 32px;
  border: 1px solid var(--mv-line);
  background: var(--mv-surface);
  border-radius: 7px;
  font: inherit;
  font-size: 12.5px;
  color: var(--mv-ink);
  outline: none;
}
.mv-search:focus { border-color: var(--mv-ink-3); }
.mv-search-wrap { position: relative; }
.mv-search-wrap .ic {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 14px; height: 14px;
  color: var(--mv-ink-3);
}
.mv-top-actions { display: flex; align-items: center; gap: 8px; }
.mv-icon-btn {
  width: 32px; height: 32px;
  border-radius: 7px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--mv-ink-2);
  cursor: pointer;
  display: grid; place-items: center;
  position: relative;
}
.mv-icon-btn:hover { background: var(--mv-hover); }
.mv-icon-btn .dot {
  position: absolute;
  top: 7px; right: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--mv-accent);
  border: 1.5px solid var(--mv-bg);
}

/* Scrolling work surface */
.mv-work {
  flex: 1;
  overflow: auto;
  background: var(--mv-bg);
}

/* ============================================================
   Capital section — Revenued visual identity
   Switches background, type rhythm, and accent palette.
   The "walking into a different room" feeling.
   ============================================================ */
.cap {
  background: #FBFBF9;
  min-height: 100%;
}
.cap-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 32px 64px;
}

/* Capital header / cobrand strip */
.cap-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 20px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border-1);
}
.cap-title {
  font-family: var(--font-primary);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--trust-tech);
  line-height: 1.1;
  margin: 0;
}
.cap-cobrand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 500;
  color: var(--tt-60);
  letter-spacing: 0.01em;
}
.cap-cobrand img { height: 12px; opacity: 0.85; }
.cap-cobrand--equal img { height: 18px; opacity: 1; }
.cap-cobrand--hidden { display: none; }

/* ============================================================
   Revenued buttons — used inside Capital section
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font-primary);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  padding: 12px 20px;
  transition: opacity 140ms, transform 140ms, background 140ms;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover { opacity: 0.92; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--growth-galaxy); color: #fff; }
.btn-teal { background: var(--funding-pool); color: var(--trust-tech); }
.btn-dark { background: var(--trust-tech); color: #fff; }
.btn-ghost {
  background: #fff; color: var(--trust-tech);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}
.btn-ghost:hover { background: var(--tt-5); }
.btn-text {
  background: transparent; color: var(--growth-galaxy);
  padding: 8px 12px;
}
.btn-text:hover { background: var(--gg-5); }
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* Form controls */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 12px; font-weight: 600;
  color: var(--tt-80);
  letter-spacing: -0.005em;
}
.field-hint { font-size: 11px; color: var(--tt-60); }
.field-input {
  font-family: var(--font-primary);
  font-size: 15px;
  color: var(--fg-1);
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  outline: none;
  transition: border-color 140ms, box-shadow 140ms;
  width: 100%;
}
.field-input:focus {
  border-color: var(--growth-galaxy);
  box-shadow: 0 0 0 3px rgba(0,64,186,0.10);
}
.field-prefix {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--tt-60);
  font-weight: 600;
  pointer-events: none;
}
.field-wrap { position: relative; }
.field-wrap .field-input.has-prefix { padding-left: 28px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }

/* Cards */
.card {
  background: #fff;
  border: 1px solid var(--border-1);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 28px; }
.card-tight { padding: 20px; }

/* Eyebrow text */
.eb {
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--growth-galaxy);
}
.eb-muted { color: var(--tt-60); }

/* Stat callout — used liberally */
.stat-num {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 32px;
  letter-spacing: -0.02em;
  color: var(--trust-tech);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.stat-num-xl {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 56px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--trust-tech);
  font-variant-numeric: tabular-nums;
}
.stat-num-xxl {
  font-family: var(--font-primary);
  font-weight: 700;
  font-size: 72px;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--trust-tech);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--tt-60);
}

/* Pill / badge */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pill-teal { background: var(--fp-10); color: #075c3e; }
.pill-blue { background: var(--gg-10); color: var(--growth-galaxy); }
.pill-warn { background: #FEF1E0; color: #7A4310; }
.pill-neutral { background: var(--tt-5); color: var(--tt-80); }
.pill-dark { background: var(--trust-tech); color: #fff; letter-spacing: 0.08em; }

/* Concentric rings decorative */
.rings {
  position: absolute;
  pointer-events: none;
}
.rings .ring {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  border-style: solid;
}

/* Disclosure block */
.disclosure {
  font-size: 11px;
  line-height: 1.55;
  color: var(--tt-60);
  padding: 12px 14px;
  background: var(--tt-5);
  border-radius: 8px;
  border-left: 2px solid var(--tt-20);
}

/* Demo controls chip — persistent, bottom-left of viewport */
@keyframes demo-chip-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(4,196,158,0.55), 0 0 12px rgba(4,196,158,0.85); }
  50%      { box-shadow: 0 0 0 6px rgba(4,196,158,0), 0 0 12px rgba(4,196,158,0.85); }
}
@keyframes demo-chip-glow {
  0%, 100% { box-shadow: 0 10px 36px rgba(0,18,43,0.40), 0 0 0 1px rgba(4,196,158,0.28), 0 0 0 4px rgba(4,196,158,0); }
  50%      { box-shadow: 0 10px 36px rgba(0,18,43,0.45), 0 0 0 1px rgba(4,196,158,0.45), 0 0 0 6px rgba(4,196,158,0.08); }
}
.demo-chip {
  position: fixed;
  bottom: 20px; left: 20px;
  z-index: 90;
  background: var(--trust-tech);
  color: #fff;
  border-radius: 999px;
  padding: 8px 8px 8px 18px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 10px 36px rgba(0,18,43,0.40), 0 0 0 1px rgba(4,196,158,0.28);
  font-size: 13px;
  font-weight: 600;
  animation: demo-chip-glow 3.2s ease-in-out infinite;
}
.demo-chip-expanded {
  border: none;
}
.demo-chip-collapsed {
  cursor: pointer;
  padding: 9px 14px 9px 16px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  border: none;
  gap: 8px;
  color: #fff;
  transition: transform 0.15s ease-out;
}
.demo-chip-collapsed:hover { transform: translateY(-1px); }
.demo-chip-collapsed .demo-chip-label {
  border-right: none;
  padding-right: 0;
  color: #fff;
  font-size: 11.5px;
  letter-spacing: 0.10em;
}
.demo-chip-label {
  display: flex; align-items: center; gap: 8px;
  padding-right: 10px;
  border-right: 1px solid rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.85);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
}
.demo-chip-label::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--funding-pool);
  animation: demo-chip-pulse 1.8s ease-in-out infinite;
}
.demo-chip-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font: inherit;
  font-weight: 500;
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.demo-chip-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.demo-chip-btn.active {
  background: rgba(4,196,158,0.20);
  color: var(--funding-pool);
  font-weight: 700;
}
.demo-chip-collapse {
  margin-left: 2px;
  padding: 7px 9px;
  color: rgba(255,255,255,0.55);
}
.demo-chip-collapse:hover { color: #fff; background: rgba(255,255,255,0.10); }
.demo-chip-divider {
  width: 1px; height: 16px;
  background: rgba(255,255,255,0.12);
  margin: 0 2px;
}

/* Jump-to-screen dropdown inside the demo chip */
.demo-chip-jump { position: relative; }
.demo-chip-jump-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
  max-width: 220px;
}
.demo-chip-jump-btn > span:nth-child(2) {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.demo-chip-menu {
  position: absolute;
  bottom: calc(100% + 8px); left: 0;
  min-width: 240px;
  background: var(--trust-tech);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 14px 40px rgba(0,18,43,0.40), 0 0 0 1px rgba(255,255,255,0.08);
  display: flex; flex-direction: column;
  animation: demoMenuIn 140ms cubic-bezier(0.2,0,0,1);
  max-height: 60vh; overflow-y: auto;
}
@keyframes demoMenuIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.demo-chip-menu-header {
  padding: 8px 10px 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.45);
}
.demo-chip-menu-item {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.85);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  transition: background 140ms, color 140ms;
}
.demo-chip-menu-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}
.demo-chip-menu-item.active {
  background: rgba(4,196,158,0.16);
  color: var(--funding-pool);
}
.demo-chip-menu-idx {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 10.5px;
  color: rgba(255,255,255,0.40);
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 22px;
}
.demo-chip-menu-item.active .demo-chip-menu-idx {
  color: var(--funding-pool);
}
.demo-chip-menu-label { flex: 1; }

/* Full-screen overlay used for cash draw / pay now */
.cap-overlay {
  position: absolute;
  inset: 0;
  background: #FBFBF9;
  z-index: 30;
  overflow: auto;
  animation: overlayIn 240ms cubic-bezier(0.2,0,0,1);
}
@keyframes overlayIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Step indicator (used in forms / draw flow) */
.steps {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--tt-60);
}
.steps-bar {
  flex: 1;
  height: 3px;
  border-radius: 2px;
  background: var(--tt-10);
  overflow: hidden;
}
.steps-bar > i {
  display: block;
  height: 100%;
  background: var(--growth-galaxy);
  transition: width 240ms cubic-bezier(0.2,0,0,1);
}

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 320ms cubic-bezier(0.2,0,0,1); }

@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin { animation: spin 800ms linear infinite; }

/* Checkbox */
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-1);
}
.checkbox-box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: #fff;
  display: grid; place-items: center;
  margin-top: 1px;
  transition: all 140ms;
}
.checkbox input { display: none; }
.checkbox input:checked + .checkbox-box {
  background: var(--growth-galaxy);
  border-color: var(--growth-galaxy);
}
.checkbox input:checked + .checkbox-box::after {
  content: "";
  width: 10px; height: 5px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translate(1px,-1px);
}

/* Number-to-spell tabular nums everywhere */
.tnum { font-variant-numeric: tabular-nums; }

/* Lucide icon size helpers */
.i-14 { width: 14px; height: 14px; }
.i-16 { width: 16px; height: 16px; }
.i-18 { width: 18px; height: 18px; }
.i-20 { width: 20px; height: 20px; }
.i-24 { width: 24px; height: 24px; }
.i-32 { width: 32px; height: 32px; }

/* Misc */
.divider { height: 1px; background: var(--border-1); border: none; margin: 24px 0; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-4 { gap: 16px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-6 { gap: 24px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; } .mb-8 { margin-bottom: 32px; }
.text-muted { color: var(--tt-60); }
.text-strong { color: var(--trust-tech); }

/* ============================================================
   MOBILE — collapse the desktop chrome and stack grids.
   The cascade target most layouts via attribute selectors so
   inline gridTemplateColumns can be flipped to a single column.
   ============================================================ */

/* Tablet + smaller laptops */
@media (max-width: 1024px) {
  .cap-shell { padding: 24px 18px; }
}

/* Tablet — narrow */
@media (max-width: 880px) {
  /* Safety net — no horizontal page scroll, ever */
  html, body { overflow-x: hidden; }

  /* App chrome collapses: sidebar hidden, top bar simplified, main full-width */
  .mv-app { grid-template-columns: 1fr; }
  .mv-side { display: none; }
  .mv-search-wrap, .mv-top .mv-icon-btn[title="Reports"] { display: none; }
  .mv-top { padding: 10px 16px; }
  .mv-crumb { font-size: 12px; }
  .mv-work { padding: 0; }

  /* Capital shell — tighter padding; clip decorative rings/confetti */
  .cap { overflow-x: clip; }
  .cap-shell { padding: 18px 14px; max-width: 100%; }
  .cap-header { flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }

  /* Card headers that pair eyebrow+title with a toolbar — let the toolbar wrap */
  .cap-shell .card > div:first-child[style*="justify-content: space-between"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
  /* And let any inner flex toolbar wrap too (calendar's month-nav + view-toggle) */
  .cap-shell .card > div:first-child[style*="justify-content: space-between"] > div[style*="display: flex"] {
    flex-wrap: wrap !important;
  }
  /* Payment calendar month label — drop the rigid 130px min on phones */
  .cap-shell .card [style*="min-width: 130px"][style*="font-size: 13px"] {
    min-width: 0 !important;
  }

  /* Stack inline grids that won't fit at narrow widths.
     PRESERVE: repeat(7,…) calendar, repeat(12,…) reporting strip, narrow row layouts
     ("auto 1fr …", "1fr auto …") that already squeeze sensibly. */
  /* Preserve grids that START with "auto " (icon+content row patterns like
     the dashboard's active-draws list); preserve calendar (repeat(7,...) and
     12-month reporting strip (repeat(12,...). Everything else collapses. */
  .mv-work [style*="grid-template-columns"]:not([style*="repeat(7"]):not([style*="repeat(12"]):not([style*="grid-template-columns: auto"]) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px !important;
  }
  /* When the how-it-works 3-step row stacks, hide the arrow connector cells */
  .mv-work [style*="1fr auto 1fr auto 1fr"] > div[style*="placeItems: center"][style*="padding: 0px 12px"],
  .mv-work [style*="1fr auto 1fr auto 1fr"] > div[style*="place-items: center"][style*="padding: 0px 12px"] {
    display: none !important;
  }
  /* Preserve 2-col KPI tiles + small "field-row" inputs where they comfortably fit */
  .mv-work .field-row { grid-template-columns: 1fr 1fr !important; }
  .mv-work .field-row-3 { grid-template-columns: 1fr 1fr 1fr !important; }

  /* Card padding reductions */
  .card-pad { padding: 18px !important; }

  /* Hero numbers — clamp using inline override won't work; scale via font-size adjusts */
  .cap-shell h1,
  .cap-shell h2 { letter-spacing: -0.02em; }

  /* Cap-shell direct big number divs — generic shrink */
  .cap-shell [style*="font-size: 88px"],
  .cap-shell [style*="fontSize: 88"] { font-size: 56px !important; }
  .cap-shell [style*="font-size: 80px"],
  .cap-shell [style*="fontSize: 80"] { font-size: 52px !important; }
  .cap-shell [style*="font-size: 72px"],
  .cap-shell [style*="fontSize: 72"] { font-size: 48px !important; }
  .cap-shell [style*="font-size: 64px"],
  .cap-shell [style*="fontSize: 64"] { font-size: 44px !important; }
  .cap-shell [style*="font-size: 56px"],
  .cap-shell [style*="fontSize: 56"] { font-size: 40px !important; }
  .cap-shell [style*="font-size: 52px"],
  .cap-shell [style*="fontSize: 52"] { font-size: 38px !important; }
  .cap-shell [style*="font-size: 48px"],
  .cap-shell [style*="fontSize: 48"] { font-size: 36px !important; }
  .cap-shell [style*="font-size: 44px"],
  .cap-shell [style*="fontSize: 44"] { font-size: 32px !important; }
  .cap-shell [style*="font-size: 40px"],
  .cap-shell [style*="fontSize: 40"] { font-size: 30px !important; }
  .cap-shell [style*="font-size: 36px"],
  .cap-shell [style*="fontSize: 36"] { font-size: 28px !important; }
  .cap-shell [style*="font-size: 32px"],
  .cap-shell [style*="fontSize: 32"] { font-size: 24px !important; }

  /* Heavy section padding — relax */
  .cap-shell .card[style*="padding: 36"],
  .cap-shell .card[style*="padding: 40"],
  .cap-shell .card[style*="padding: 44"],
  .cap-shell .card[style*="padding: 48"],
  .cap-shell .card[style*="padding: 52"] { padding: 22px !important; }

  /* Demo chip — compact pill at the bottom; expanded version stays small too */
  .demo-chip { bottom: 14px; left: auto; right: 14px; max-width: calc(100vw - 28px); }
  .demo-chip-collapsed { padding: 8px 14px; font-size: 12px; }
  .demo-chip-expanded { flex-wrap: wrap; padding: 8px 10px; gap: 4px; }
  .demo-chip-jump-btn { max-width: 100%; }
  .demo-chip-menu { left: auto; right: 0; min-width: 220px; max-height: 50vh; }

  /* Leave room for the chip at the bottom of every scrolling surface */
  .mv-work { padding-bottom: 80px; }
  /* Launcher overlay too */
  .mv-app + div[style*="position: fixed"][style*="inset: 0"] { padding-bottom: 96px !important; }

  /* Launcher card row — stack */
  .launcher-card-row,
  div[style*="grid-template-columns: repeat(3, 1fr)"]:has(button) {
    grid-template-columns: 1fr !important;
  }

  /* Launcher full-screen overlay — let cards stack, shrink padding/heading */
  div[style*="position: fixed"][style*="inset: 0"] [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  div[style*="position: fixed"][style*="inset: 0"] h1 {
    font-size: 32px !important;
  }
  div[style*="position: fixed"][style*="inset: 0"] [style*="max-width: 1080px"] {
    max-width: 100% !important;
  }
  div[style*="position: fixed"][style*="inset: 0"][style*="padding: 40px 32px"] {
    padding: 24px 16px 96px !important;
  }
  div[style*="position: fixed"][style*="inset: 0"] [style*="padding: 24px"][style*="border-radius: 16px"] {
    padding: 18px !important;
  }
}

/* Funded screen — large decorative rings live inside .funded-stage; clip them */
@media (max-width: 880px) {
  .funded-stage { overflow-x: clip; }
}

/* Marketing hero stats — flex row with gap: 24 wraps gracefully on phones */
@media (max-width: 540px) {
  .cap-shell [style*="display: flex"][style*="gap: 24px"] {
    flex-wrap: wrap !important;
    gap: 16px 20px !important;
  }
}

/* Payment calendar — keep 7 columns but shrink cells so they fit narrow viewports */
@media (max-width: 540px) {
  .cap-shell [style*="repeat(7, 1fr)"] {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 3px !important;
  }
  /* Tighten the day-cell buttons so $650 fits */
  .cap-shell [style*="repeat(7, 1fr)"] > button[style*="aspect-ratio"] {
    padding: 4px 4px !important;
    font-size: 11px !important;
    aspect-ratio: 1 / 1.1 !important;
  }
  .cap-shell [style*="repeat(7, 1fr)"] > button[style*="aspect-ratio"] > span:first-child {
    font-size: 11px !important;
  }
  .cap-shell [style*="repeat(7, 1fr)"] > button[style*="aspect-ratio"] > span:nth-child(2) {
    font-size: 9px !important;
  }
  /* 12-month reporting strip — let it scroll horizontally if it must */
  .cap-shell [style*="repeat(12,"] {
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
  }
}

/* Phone */
@media (max-width: 540px) {
  .mv-top { padding: 8px 12px; }
  .mv-top-actions { gap: 4px; }
  .mv-icon-btn { width: 32px; height: 32px; }
  .mv-home-btn { padding: 6px 10px; }
  .mv-home-btn span { display: none; }
  .mv-top-left { gap: 8px; }

  .cap-shell { padding: 14px 10px; }
  .cap-header { gap: 10px; margin-bottom: 14px; }
  .cap-header .pill, .cap-header .btn-text { font-size: 11px; }

  /* Even tighter card pad on phones */
  .card-pad { padding: 14px !important; }
  .cap-shell .card[style*="padding"] { padding: 16px !important; }

  /* Cap-shell direct big number further shrink on phones */
  .cap-shell [style*="font-size: 88px"],
  .cap-shell [style*="fontSize: 88"] { font-size: 42px !important; }
  .cap-shell [style*="font-size: 80px"],
  .cap-shell [style*="fontSize: 80"] { font-size: 40px !important; }
  .cap-shell [style*="font-size: 72px"],
  .cap-shell [style*="fontSize: 72"] { font-size: 38px !important; }
  .cap-shell [style*="font-size: 64px"],
  .cap-shell [style*="fontSize: 64"] { font-size: 36px !important; }
  .cap-shell [style*="font-size: 56px"],
  .cap-shell [style*="fontSize: 56"] { font-size: 32px !important; }

  /* Buttons full-width on phones */
  .btn-lg { padding: 11px 18px !important; font-size: 14px !important; }

  /* Field rows stack on phones */
  .mv-work .field-row { grid-template-columns: 1fr !important; }
  .mv-work .field-row-3 { grid-template-columns: 1fr !important; }

  /* Tweaks panel — make sure it's positioned reasonably */
  .tweaks-panel { left: 12px !important; right: 12px !important; width: auto !important; bottom: 64px !important; }

  /* Comparison table on howitworks — let it scroll horizontally if needed */
  .cap-shell .card > div[style*="grid-template-columns: minmax(0, 1.6fr)"] {
    overflow-x: auto;
    grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(70px, 1fr)) !important;
  }
}

/* ============================================================
   MOBILE — Dashboard
   Proper layout per section, not band-aid overrides.
   ============================================================ */
@media (max-width: 540px) {
  /* HERO ------------------------------------------------------- */
  .dash-hero-grid {
    padding: 24px 20px !important;
    grid-template-columns: 1fr !important;
    gap: 24px !important;
    align-items: stretch !important;
  }
  /* Reorder so the visual hierarchy reads: amount → donut → bar → blurb → KPIs → actions */
  .dash-hero-main { display: contents; }
  .dash-hero-amount { order: 1; font-size: 48px !important; margin: 10px 0 4px !important; }
  .dash-hero-main > .eb,
  .dash-hero-main > [class*="Eyebrow"],
  .dash-hero-grid > .dash-hero-main > div:first-of-type { order: 0; }
  .dash-hero-side { order: 3; gap: 16px !important; }
  .dash-hero-bar { order: 2; margin: 6px 0 0 !important; max-width: none !important; }
  .dash-hero-blurb { order: 4; font-size: 14px !important; margin: 0 !important; }
  .dash-hero-actions { order: 5; flex-direction: column !important; gap: 8px !important; }
  .dash-hero-actions .btn { width: 100% !important; }
  /* KPIs sit between donut and blurb feels heavy — keep tight */
  .dash-kpis { gap: 8px !important; }
  .dash-kpis > div { padding: 10px 12px !important; }
  .dash-kpis > div > div:last-child { font-size: 15px !important; }

  /* ACTIVE DRAWS row — restructure into a stacked card --------- */
  .dash-draw-row {
    grid-template-columns: auto 1fr !important;
    grid-template-areas:
      "icon  label"
      "amt   amt"
      "pill  pill" !important;
    row-gap: 10px !important;
    column-gap: 12px !important;
    padding: 14px !important;
  }
  .dash-draw-icon  { grid-area: icon; }
  .dash-draw-label { grid-area: label; min-width: 0; }
  .dash-draw-amount {
    grid-area: amt;
    text-align: left !important;
    display: flex !important;
    align-items: baseline !important;
    gap: 10px !important;
    padding-top: 8px;
    border-top: 1px solid var(--border-1);
  }
  .dash-draw-amount > div:first-child { font-size: 18px !important; }
  .dash-draw-pill { grid-area: pill; justify-self: start !important; }

  /* TRANSACTION HISTORY — table → cards ---------------------- */
  .tx-header { display: none !important; }
  .tx-row {
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "desc  amt"
      "meta  bal" !important;
    row-gap: 6px !important;
    column-gap: 14px !important;
    padding: 14px 16px !important;
    align-items: center !important;
  }
  .tx-desc   { grid-area: desc; min-width: 0; }
  .tx-desc > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }
  /* Stuff date + type into the same row, side by side */
  .tx-date {
    grid-area: meta;
    align-self: center;
    justify-self: start;
    font-size: 11.5px !important;
    color: var(--tt-60) !important;
    /* Indent so it aligns under the description text (past the icon) */
    padding-left: 38px;
  }
  .tx-type {
    grid-area: meta;
    align-self: center;
    justify-self: start;
    /* Push past the date */
    padding-left: 88px;
  }
  .tx-amount { grid-area: amt; font-size: 15px !important; }
  .tx-balance {
    grid-area: bal;
    font-size: 11.5px !important;
  }

  /* Transaction history header — tab filters wrap on phones */
  .card[style*="overflow: hidden"] > div[style*="20px 24px 16px"] {
    flex-wrap: wrap !important;
    gap: 12px !important;
  }
}

/* ============================================================
   MOBILE — Cold marketing landing
   ============================================================ */
@media (max-width: 540px) {
  /* Hero card — tighter padding, smaller headline */
  .cap-shell [style*="padding: 52px 48px 48px"] {
    padding: 28px 22px !important;
  }
  .cap-shell .card[style*="background: linear-gradient"] h1 {
    font-size: 32px !important;
    margin-bottom: 14px !important;
  }
  /* Apply now + See how it works — vertical stack so neither shrinks */
  .cap-shell [style*="display: flex"][style*="gap: 12px"][style*="margin-bottom: 24px"] {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .cap-shell [style*="display: flex"][style*="gap: 12px"][style*="margin-bottom: 24px"] .btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .cap-shell [style*="display: flex"][style*="gap: 12px"][style*="margin-bottom: 24px"] .btn-text {
    text-align: center;
    padding: 12px !important;
  }
  /* "How it works" 4-step row — vertical borders look wrong when stacked */
  .cap-shell [style*="repeat(4, 1fr)"][style*="gap: 0"] > div {
    border-right: none !important;
    border-bottom: 1px solid var(--border-1);
    padding: 18px 0 !important;
  }
  .cap-shell [style*="repeat(4, 1fr)"][style*="gap: 0"] > div:last-child {
    border-bottom: none;
    padding-bottom: 0 !important;
  }
  .cap-shell [style*="repeat(4, 1fr)"][style*="gap: 0"] > div:first-child {
    padding-top: 0 !important;
  }
  /* Value-prop card grid — tighter padding on phones */
  .cap-shell [style*="grid-template-columns: repeat(4, 1fr)"][style*="gap: 14px"] > .card {
    padding: 18px !important;
  }
}

/* Very narrow — final squeeze */
@media (max-width: 380px) {
  .cap-shell { padding: 12px 8px; }
  .demo-chip-expanded { font-size: 11.5px; }
  .demo-chip-label { font-size: 10px; }
}
