/* app/assets/stylesheets/application.css */
/* FundClose Design System — Refined Fintech Aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500;600&family=Newsreader:ital,wght@0,400;0,500;0,600;1,400&display=swap');

/* ═══════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════ */

:root {
  /* Color — Deep navy anchored, warm gold accent */
  --ink: #0a0f1a;
  --ink-light: #1a2035;
  --ink-muted: #3d4663;
  --ink-subtle: #6b7394;
  --surface: #ffffff;
  --surface-raised: #f8f9fc;
  --surface-sunken: #f0f2f7;
  --surface-overlay: rgba(10, 15, 26, 0.04);
  --border: #e2e5ef;
  --border-light: #eef0f6;
  --border-subtle: #eef0f6;
  --border-strong: #c8cdd9;
  --accent: #c9952c;
  --accent-light: #f5e6c4;
  --accent-dark: #a07722;
  --primary: #1a56db;
  --primary-light: #e8eefb;
  --primary-dark: #1347b8;
  --success: #0d7a3e;
  --success-light: #e6f5ed;
  --warning: #b45309;
  --warning-light: #fef3e2;
  --danger: #c23030;
  --danger-light: #fce8e8;

  /* Typography */
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-editorial: 'Newsreader', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Spacing scale (4px base) */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;
  --sp-32: 8rem;

  /* Type scale */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;
  --text-6xl: 3.75rem;
  --text-hero: clamp(2.5rem, 5vw, 4.5rem);

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.25rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(10, 15, 26, 0.04);
  --shadow-sm: 0 1px 3px rgba(10, 15, 26, 0.06), 0 1px 2px rgba(10, 15, 26, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(10, 15, 26, 0.06), 0 2px 4px -2px rgba(10, 15, 26, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(10, 15, 26, 0.06), 0 4px 6px -4px rgba(10, 15, 26, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(10, 15, 26, 0.08), 0 8px 10px -6px rgba(10, 15, 26, 0.04);
  --shadow-glow: 0 0 0 3px rgba(26, 86, 219, 0.15);
  --shadow-gold: 0 0 0 3px rgba(201, 149, 44, 0.15);

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
  --container-max: 1200px;
  --container-wide: 1400px;
}

/* ═══════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
}

/* ═══════════════════════════════════════════
   TYPOGRAPHY
   ═══════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.t-hero { font-size: var(--text-hero); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.t-h1 { font-size: var(--text-5xl); }
.t-h2 { font-size: var(--text-4xl); }
.t-h3 { font-size: var(--text-3xl); }
.t-h4 { font-size: var(--text-2xl); }
.t-h5 { font-size: var(--text-xl); font-weight: 600; }
.t-body { font-size: var(--text-base); }
.t-small { font-size: var(--text-sm); }
.t-tiny { font-size: var(--text-xs); }
.t-mono { font-family: var(--font-mono); font-size: 0.9em; }
.t-serif { font-family: var(--font-editorial); }
.t-muted { color: var(--ink-subtle); }
.t-label { font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-subtle); }
.t-amount { font-family: var(--font-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.t-accent { color: var(--accent); }
.t-success { color: var(--success); }
.t-danger { color: var(--danger); }
.t-overline { font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

/* ═══════════════════════════════════════════
   LAYOUT PRIMITIVES
   ═══════════════════════════════════════════ */

.container { max-width: var(--container-max); margin: 0 auto; padding: 0 var(--sp-6); }
.container-wide { max-width: var(--container-wide); margin: 0 auto; padding: 0 var(--sp-6); }
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-8); }
.row { display: flex; align-items: center; gap: var(--sp-4); }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   CARD
   ═══════════════════════════════════════════ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  transition: box-shadow var(--duration-base) var(--ease-out);
}

.card:hover { box-shadow: var(--shadow-md); }
.card-flat { box-shadow: none; }
.card-flat:hover { box-shadow: none; }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border-light);
}

.card-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--sp-5) var(--sp-6);
}

.card-metric .metric-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1;
  margin-top: var(--sp-2);
}

.card-metric .metric-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-subtle);
}

.card-metric .metric-change {
  font-size: var(--text-sm);
  font-weight: 500;
  margin-top: var(--sp-2);
}

/* ═══════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1;
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

.btn:focus-visible { outline: none; box-shadow: var(--shadow-glow); }

.btn-primary {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-light); }

.btn-accent {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-dark); box-shadow: var(--shadow-gold); }

.btn-secondary {
  background: white;
  color: var(--ink);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-sunken); border-color: var(--ink-subtle); }

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover { background: #a82828; }

.btn-sm { padding: var(--sp-2) var(--sp-3); font-size: var(--text-xs); }
.btn-lg { padding: var(--sp-4) var(--sp-8); font-size: var(--text-md); }
.btn-xl { padding: var(--sp-5) var(--sp-10); font-size: var(--text-lg); border-radius: var(--radius-lg); }

/* ═══════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════ */

.form-group { margin-bottom: var(--sp-5); }

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: var(--sp-2);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  margin-top: var(--sp-1);
}

.form-input {
  width: 100%;
  padding: var(--sp-3) var(--sp-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  appearance: none;
}

.form-input:hover { border-color: var(--border-strong); }
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: var(--shadow-glow); }
.form-input::placeholder { color: var(--ink-subtle); }
.form-input.error { border-color: var(--danger); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(194, 48, 48, 0.15); }

.form-select {
  composes: form-input;
  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='M2 4l4 4 4-4' stroke='%236b7394' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--sp-4) center;
  padding-right: var(--sp-10);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
  margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════
   BADGE / TAG / STATUS
   ═══════════════════════════════════════════ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-1) var(--sp-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  line-height: 1.4;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--primary-light); color: var(--primary); }
.badge-neutral { background: var(--surface-sunken); color: var(--ink-muted); }
.badge-gold { background: var(--accent-light); color: var(--accent-dark); }

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot-active { background: var(--success); }
.status-dot-pending { background: var(--warning); }
.status-dot-inactive { background: var(--ink-subtle); }

/* ═══════════════════════════════════════════
   TABLE
   ═══════════════════════════════════════════ */

.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-subtle);
  background: var(--surface-raised);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--surface-raised); }

.table .col-amount {
  font-family: var(--font-mono);
  font-weight: 500;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════
   NAV — MARKETING
   ═══════════════════════════════════════════ */

.marketing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px) saturate(180%);
  border-bottom: 1px solid var(--border-light);
  padding: 0 var(--sp-6);
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.marketing-nav .nav-inner {
  max-width: var(--container-wide);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.marketing-nav .nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  list-style: none;
}

.marketing-nav .nav-link {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
}

.marketing-nav .nav-link:hover { color: var(--ink); background: var(--surface-overlay); }

/* ═══════════════════════════════════════════
   LOGO
   ═══════════════════════════════════════════ */

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--ink);
  letter-spacing: -0.02em;
}

.logo-mark {
  width: 28px;
  height: 28px;
  background: var(--ink);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: var(--text-sm);
  font-weight: 800;
}

/* ═══════════════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════════════ */

.dashboard-layout {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--ink);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 50;
  overflow-y: auto;
}

.sidebar-header {
  padding: var(--sp-5) var(--sp-5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
}

.sidebar-nav-group {
  margin-bottom: var(--sp-6);
}

.sidebar-nav-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 var(--sp-3);
  margin-bottom: var(--sp-2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast);
  margin-bottom: 2px;
}

.sidebar-link:hover { background: rgba(255, 255, 255, 0.08); color: white; }
.sidebar-link.active { background: rgba(255, 255, 255, 0.12); color: white; font-weight: 600; }

.sidebar-link svg {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--surface-raised);
}

.dashboard-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-8);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.dashboard-content {
  padding: var(--sp-8);
}

.page-header {
  margin-bottom: var(--sp-8);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: var(--text-base);
  color: var(--ink-subtle);
  margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════
   PORTAL LAYOUT (LP-facing)
   ═══════════════════════════════════════════ */

.portal-layout {
  min-height: 100vh;
  background: var(--surface-raised);
}

.portal-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 var(--sp-6);
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.portal-header .nav-link {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-md);
  transition: color var(--duration-fast), background var(--duration-fast);
}
.portal-header .nav-link:hover {
  color: var(--ink);
  background: var(--surface-overlay);
}
.portal-header .nav-link.active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface-sunken);
}

.portal-content {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--sp-8) var(--sp-6);
}

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */

.progress-bar {
  height: 6px;
  background: var(--surface-sunken);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: var(--radius-full);
  transition: width var(--duration-slow) var(--ease-out);
}

.progress-bar-fill.gold { background: var(--accent); }
.progress-bar-fill.success { background: var(--success); }

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: var(--sp-16) var(--sp-8);
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--sp-6);
  background: var(--surface-sunken);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-subtle);
}

/* ═══════════════════════════════════════════
   SUBSCRIPTION WORKFLOW
   ═══════════════════════════════════════════ */

.subscription-layout {
  min-height: 100vh;
  background: var(--surface-raised);
}

.subscription-header {
  background: white;
  padding: var(--sp-4) var(--sp-6);
}

.subscription-progress {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-6);
  background: white;
  border-bottom: 1px solid var(--border);
}

.subscription-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--ink-subtle);
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font-family: inherit;
  line-height: 1;
  cursor: default;
  -webkit-appearance: none;
  appearance: none;
}
.subscription-step:focus { outline: none; }
.subscription-step:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

.subscription-step.active { color: var(--primary); font-weight: 600; }
.subscription-step.completed { color: var(--success); }
.subscription-step.completed,
.subscription-step.reachable { cursor: pointer; }
.subscription-step.completed:hover .subscription-step-number,
.subscription-step.reachable:hover .subscription-step-number {
  filter: brightness(1.08);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.subscription-step-number {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  border: 2px solid var(--border);
  background: white;
  transition: box-shadow 120ms ease, filter 120ms ease;
}

.subscription-step.active .subscription-step-number {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.subscription-step.completed .subscription-step-number {
  border-color: var(--success);
  background: var(--success);
  color: transparent;
  position: relative;
}

.subscription-step.completed .subscription-step-number::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='5 12.5 10 17.5 19 7.5'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

.subscription-step-divider {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 20px;
}

.subscription-step-divider.completed { background: var(--success); }

/* ---- Input with inline action (eye icon) ---- */

.input-with-affix {
  position: relative;
}

.input-with-affix .form-input {
  padding-right: 40px;
}

.input-affix-btn {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--ink-subtle);
  cursor: pointer;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
}

.input-affix-btn:hover { color: var(--ink); background: var(--surface-raised); }
.input-affix-btn:focus { outline: none; }
.input-affix-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* ---- Review & Sign ---- */

.review-grid {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}

.review-agreement {
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  background: var(--surface-raised);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--ink-muted);
}

.review-summary .stack > .summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-light);
  margin: 0;
}

.review-summary .stack > .summary-row:last-child { border-bottom: 0; }

.summary-value-wrap {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  text-align: right;
}

.summary-edit {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: var(--text-xs);
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  -webkit-appearance: none;
  appearance: none;
}

.summary-edit:hover { color: var(--primary-dark, var(--primary)); opacity: 0.8; }
.summary-edit:focus { outline: none; }
.summary-edit:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

.summary-amount {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
  font-family: var(--font-mono, inherit);
}

.summary-amount:not(.is-filled) {
  color: var(--ink-subtle);
  font-weight: 500;
  font-size: var(--text-base);
  font-family: inherit;
}

.review-summary .stack > .summary-row-amount { padding-top: var(--sp-4); }

.subscription-body {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--sp-10) var(--sp-6);
}

.subscription-section-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.subscription-section-desc {
  font-size: var(--text-base);
  color: var(--ink-subtle);
  margin-bottom: var(--sp-8);
}

/* ═══════════════════════════════════════════
   ENTITY TYPE SELECTOR
   ═══════════════════════════════════════════ */

.entity-type-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-3);
}

@media (max-width: 640px) {
  .entity-type-grid { grid-template-columns: 1fr; }
}

.entity-type-card {
  padding: var(--sp-4) var(--sp-5);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
}

.entity-type-card:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.entity-type-card.selected { border-color: var(--primary); background: var(--primary-light); }

.entity-type-card input[type="radio"] { display: none; }

.entity-type-radio {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration-fast);
}

.entity-type-card.selected .entity-type-radio {
  border-color: var(--primary);
  background: var(--primary);
}

.entity-type-card.selected .entity-type-radio::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}

.entity-type-name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.entity-type-desc {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════
   MARKETING HERO
   ═══════════════════════════════════════════ */

.hero {
  position: relative;
  padding: calc(var(--header-height) + var(--sp-20)) 0 var(--sp-20);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% -10%, rgba(26, 86, 219, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 20%, rgba(201, 149, 44, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

.hero-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image:
    linear-gradient(var(--border-light) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-light) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, black 20%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-1) var(--sp-4);
  background: var(--accent-light);
  color: var(--accent-dark);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  margin-bottom: var(--sp-6);
}

.hero-title {
  font-size: var(--text-hero);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  margin-bottom: var(--sp-6);
}

.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-description {
  font-size: var(--text-xl);
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto var(--sp-10);
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.hero-proof {
  margin-top: var(--sp-12);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-8);
}

.hero-stat {
  text-align: center;
}

.hero-stat-value {
  font-family: var(--font-mono);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--ink);
}

.hero-stat-label {
  font-size: var(--text-xs);
  color: var(--ink-subtle);
  margin-top: var(--sp-1);
}

/* ═══════════════════════════════════════════
   MARKETING SECTIONS
   ═══════════════════════════════════════════ */

.section {
  padding: var(--sp-24) 0;
}

.section-dark {
  background: var(--ink);
  color: white;
}

.section-dark .t-muted { color: rgba(255, 255, 255, 0.6); }
.section-dark .card { background: var(--ink-light); border-color: rgba(255, 255, 255, 0.08); }
.section-dark h2, .section-dark h3 { color: white; }

.section-muted {
  background: var(--surface-raised);
}

.section-header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--sp-16);
}

.section-header .t-label {
  margin-bottom: var(--sp-3);
}

.section-header h2 {
  margin-bottom: var(--sp-4);
}

.feature-card {
  padding: var(--sp-8);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: white;
  transition: all var(--duration-base) var(--ease-out);
}

.feature-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-5);
  font-size: var(--text-xl);
}

.feature-icon-primary { background: var(--primary-light); color: var(--primary); }
.feature-icon-gold { background: var(--accent-light); color: var(--accent-dark); }
.feature-icon-success { background: var(--success-light); color: var(--success); }

.feature-card h3 {
  font-size: var(--text-lg);
  margin-bottom: var(--sp-3);
}

.feature-card p {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  line-height: 1.6;
}

/* ═══════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════ */

.footer {
  background: var(--ink);
  color: rgba(255, 255, 255, 0.6);
  padding: var(--sp-16) 0 var(--sp-8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--sp-10);
  margin-bottom: var(--sp-12);
}

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

.footer h4 {
  color: white;
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--sp-4);
}

.footer a {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  font-size: var(--text-sm);
  display: block;
  margin-bottom: var(--sp-2);
  transition: color var(--duration-fast);
}

.footer a:hover { color: white; }

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: var(--sp-8);
  font-size: var(--text-xs);
  display: flex;
  justify-content: space-between;
}

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-in {
  animation: fade-in-up 0.6s var(--ease-out) both;
}

.animate-in-delay-1 { animation-delay: 100ms; }
.animate-in-delay-2 { animation-delay: 200ms; }
.animate-in-delay-3 { animation-delay: 300ms; }
.animate-in-delay-4 { animation-delay: 400ms; }

/* Turbo frame loading state */
turbo-frame[busy] {
  opacity: 0.6;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   AVATAR
   ═══════════════════════════════════════════ */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: 0.625rem; }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-sm); }

/* Generate avatar colors from initials */
.avatar-a { background: #3b82f6; }
.avatar-b { background: #8b5cf6; }
.avatar-c { background: #ec4899; }
.avatar-d { background: #f59e0b; }
.avatar-e { background: #10b981; }
.avatar-f { background: #6366f1; }
.avatar-g { background: #14b8a6; }

/* ═══════════════════════════════════════════
   FUNNEL / PIPELINE VISUALIZATION
   ═══════════════════════════════════════════ */

.funnel {
  display: flex;
  gap: var(--sp-1);
  align-items: stretch;
  height: 64px;
}

.funnel-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
  padding: var(--sp-2);
  transition: all var(--duration-fast);
  cursor: default;
}

.funnel-stage-count {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-lg);
}

.funnel-stage-label {
  font-size: 0.625rem;
  font-weight: 500;
  color: var(--ink-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.funnel-stage.active { background: var(--primary-light); }
.funnel-stage.active .funnel-stage-count { color: var(--primary); }

/* ═══════════════════════════════════════════
   PRICING
   ═══════════════════════════════════════════ */

.pricing-card {
  padding: var(--sp-8);
  border: 2px solid var(--border);
  border-radius: var(--radius-2xl);
  background: white;
  position: relative;
  transition: all var(--duration-base) var(--ease-out);
}

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

.pricing-card.featured {
  border-color: var(--accent);
  box-shadow: var(--shadow-xl);
}

.pricing-card.featured::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  font-size: var(--text-xs);
  font-weight: 700;
  padding: var(--sp-1) var(--sp-4);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.pricing-name {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.pricing-price {
  font-family: var(--font-mono);
  font-size: var(--text-4xl);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: var(--sp-1);
}

.pricing-price span {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--ink-subtle);
}

.pricing-desc {
  font-size: var(--text-sm);
  color: var(--ink-subtle);
  margin-bottom: var(--sp-6);
  padding-bottom: var(--sp-6);
  border-bottom: 1px solid var(--border-light);
}

.pricing-features {
  list-style: none;
  margin-bottom: var(--sp-8);
}

.pricing-features li {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  font-size: var(--text-sm);
  padding: var(--sp-2) 0;
  color: var(--ink-muted);
}

.pricing-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: 700;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   TOAST / FLASH
   ═══════════════════════════════════════════ */

.flash {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 200;
  padding: var(--sp-4) var(--sp-6);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xl);
  animation: fade-in-up 0.4s var(--ease-out);
  max-width: 420px;
}

.flash-success { background: var(--success); color: white; }
.flash-error { background: var(--danger); color: white; }
.flash-notice { background: var(--ink); color: white; }

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform var(--duration-base) var(--ease-out); }
  .sidebar.open { transform: translateX(0); }
  .dashboard-main { margin-left: 0; }
}

@media (max-width: 640px) {
  :root {
    --text-hero: 2rem;
    --sp-24: 4rem;
    --sp-20: 3rem;
  }
  .hero-proof { flex-direction: column; gap: var(--sp-4); }
  .hero-actions { flex-direction: column; width: 100%; }
  .hero-actions .btn { width: 100%; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════
   AUTH FORMS (Devise views)
   ═══════════════════════════════════════════ */

.auth-shell {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(var(--header-height) + var(--sp-10)) var(--sp-6) var(--sp-16);
}

.auth-card {
  padding: var(--sp-8);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--sp-6);
}

.auth-header h1 {
  margin-bottom: var(--sp-2);
}

.auth-subhead {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.auth-form .form-group:last-child {
  margin-bottom: 0;
}

.auth-submit {
  width: 100%;
}

.auth-remember {
  display: flex;
  align-items: center;
}

.auth-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--ink-muted);
  cursor: pointer;
  user-select: none;
}

.auth-checkbox input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin: var(--sp-6) 0;
  color: var(--ink-subtle);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-light);
}

.auth-link {
  font-size: var(--text-sm);
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.auth-link:hover {
  color: var(--ink);
  text-decoration: underline;
}

.auth-actions-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.auth-actions-row .btn { flex: 1; }

.auth-danger-zone {
  margin-top: var(--sp-8);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--border-light);
}

.form-error-summary {
  background: var(--danger-light);
  border: 1px solid rgba(194, 48, 48, 0.2);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-5);
  font-size: var(--text-sm);
  color: var(--ink);
}

.form-error-summary h3 {
  margin-bottom: var(--sp-2);
}

.form-error-summary ul {
  list-style: disc;
  padding-left: var(--sp-5);
  color: var(--danger);
}

.form-error-summary li {
  margin-top: 2px;
}

/* ═══════════════════════════════════════════
   HELP CENTER
   ═══════════════════════════════════════════ */

.help-article-body h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-top: var(--sp-6);
  margin-bottom: var(--sp-3);
  color: var(--ink);
}

.help-article-body h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-2);
  color: var(--ink);
}

.help-article-body h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
  color: var(--ink);
}

.help-article-body p {
  font-size: var(--text-base);
  line-height: 1.65;
  margin-bottom: var(--sp-4);
  color: var(--ink-light);
}

.help-article-body ul,
.help-article-body ol {
  margin-bottom: var(--sp-4);
  padding-left: var(--sp-6);
}

.help-article-body li {
  font-size: var(--text-base);
  line-height: 1.65;
  margin-bottom: var(--sp-1);
  color: var(--ink-light);
}

.help-article-body a {
  color: var(--primary);
  text-decoration: underline;
}

.help-article-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.125rem 0.375rem;
  background: var(--surface-sunken);
  border-radius: var(--radius-sm);
}

.help-article-body pre {
  background: var(--ink-light);
  color: var(--surface);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin-bottom: var(--sp-4);
}

.help-article-body pre code {
  background: transparent;
  color: inherit;
  padding: 0;
}

.help-article-body blockquote {
  border-left: 3px solid var(--border-strong);
  padding-left: var(--sp-4);
  margin-bottom: var(--sp-4);
  color: var(--ink-muted);
  font-style: italic;
}

.help-article-body hr {
  border: 0;
  border-top: 1px solid var(--border-light);
  margin: var(--sp-6) 0;
}

.help-figure {
  margin: var(--sp-5) 0;
}

.help-figure-placeholder {
  background: var(--surface-sunken);
  border: 1px dashed var(--border-strong);
  padding: var(--sp-8);
  text-align: center;
  color: var(--ink-subtle);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.help-figure figcaption {
  text-align: center;
  color: var(--ink-subtle);
  font-size: var(--text-xs);
  margin-top: var(--sp-2);
}
