/* ========================================
   SELECTIVE CAPITAL — MCA APPROVAL TEMPLATE
   Color: Blue → Purple → Magenta gradient
   ======================================== */

:root {
  /* Type Scale */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.875rem, 0.8rem  + 0.35vw, 1rem);
  --text-base: clamp(1rem,     0.95rem + 0.25vw, 1.125rem);
  --text-lg:   clamp(1.125rem, 1rem    + 0.75vw, 1.5rem);
  --text-xl:   clamp(1.5rem,   1.2rem  + 1.25vw, 2.25rem);
  --text-2xl:  clamp(2rem,     1.2rem  + 2.5vw,  3.5rem);

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

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

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Fonts */
  --font-body: 'General Sans', 'Helvetica Neue', sans-serif;
  --font-display: 'Cabinet Grotesk', 'General Sans', sans-serif;

  /* Selective Capital Brand Colors */
  --sc-blue: #5B8DEF;
  --sc-purple: #9B59D0;
  --sc-magenta: #E040A0;
  --sc-gradient: linear-gradient(135deg, #5B8DEF, #9B59D0, #E040A0);
  --sc-gradient-subtle: linear-gradient(135deg, rgba(91,141,239,0.08), rgba(155,89,208,0.08), rgba(224,64,160,0.08));
  --sc-gradient-hover: linear-gradient(135deg, #4A7CE0, #8A48BF, #D03090);
}

/* Light Mode */
:root, [data-theme="light"] {
  --color-bg: #F8F9FC;
  --color-surface: #FFFFFF;
  --color-surface-2: #F3F4F8;
  --color-surface-offset: #ECEEF5;
  --color-border: #DDE0EB;
  --color-divider: #E8EAF0;
  --color-text: #1A1A2E;
  --color-text-muted: #6B7089;
  --color-text-faint: #A0A4B8;
  --color-primary: #7B4FD4;
  --color-primary-hover: #6A3EC3;
  --color-success: #22C55E;
  --color-success-bg: rgba(34, 197, 94, 0.1);

  --shadow-sm: 0 1px 3px rgba(26, 26, 46, 0.06);
  --shadow-md: 0 4px 16px rgba(26, 26, 46, 0.08);
  --shadow-lg: 0 12px 40px rgba(26, 26, 46, 0.12);
  --shadow-glow: 0 0 30px rgba(123, 79, 212, 0.15);
}

/* ======== LAYOUT ======== */

body {
  background: var(--color-bg);
  padding: var(--space-4);
  display: flex;
  justify-content: center;
  position: relative;
}

.document {
  max-width: 860px;
  width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

/* ======== EDIT PANEL ======== */

.edit-panel {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  z-index: 100;
  width: 300px;
}

.edit-panel-header {
  display: flex;
  justify-content: flex-end;
}

.edit-toggle-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-interactive);
}

.edit-toggle-btn:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-primary);
}

.edit-toggle-btn svg {
  display: inline;
  width: 16px;
  height: 16px;
}

.edit-panel-body {
  display: none;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-top: var(--space-2);
  box-shadow: var(--shadow-lg);
  max-height: 70vh;
  overflow-y: auto;
}

.edit-panel-body.open {
  display: block;
}

.edit-panel-header h2 {
  display: none;
}

.edit-group {
  margin-bottom: var(--space-3);
}

.edit-group label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.edit-group input,
.edit-group select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  background: var(--color-surface-2);
  transition: border-color var(--transition-interactive);
}

.edit-group input:focus,
.edit-group select:focus {
  outline: none;
  border-color: var(--color-primary);
}

.btn-apply {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--sc-gradient);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-md);
  margin-top: var(--space-3);
  transition: opacity var(--transition-interactive);
}

.btn-apply:hover {
  opacity: 0.9;
}

.link-gen-divider {
  height: 1px;
  background: var(--color-divider);
  margin: var(--space-4) 0;
}

.btn-generate {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-primary);
  color: var(--color-primary);
  font-weight: 700;
  font-size: var(--text-sm);
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
}

.btn-generate:hover {
  background: rgba(123, 79, 212, 0.08);
}

.btn-generate svg {
  display: inline;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.link-output {
  margin-top: var(--space-3);
}

.link-output label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.link-output textarea {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-family: monospace;
  background: var(--color-surface-2);
  color: var(--color-text);
  resize: none;
  line-height: 1.5;
}

.btn-copy {
  width: 100%;
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--color-success);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.btn-copy:hover {
  opacity: 0.9;
}

/* ======== EMAIL SECTION ======== */

.btn-email {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-3);
  background: var(--sc-gradient);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.btn-email:hover { opacity: 0.9; }
.btn-email:disabled { opacity: 0.5; cursor: not-allowed; }

.email-send-status {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: center;
}

.email-send-status.success { color: var(--color-success); }
.email-send-status.error { color: #ef4444; }

.btn-email svg {
  display: inline;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.email-preview {
  margin-top: var(--space-3);
}

.email-preview label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-2);
}

.email-preview-box {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text);
  line-height: 1.6;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.email-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.btn-email-open {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-xs);
  border: none;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.btn-email-open:hover {
  opacity: 0.9;
}

.btn-email-copy {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 700;
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
  transition: all var(--transition-interactive);
}

.btn-email-copy:hover {
  border-color: var(--color-primary);
}

/* ======== HEADER ======== */

.doc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-8) var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.logo-img {
  height: 70px;
  width: auto;
  object-fit: contain;
}

.approval-badge {
  display: flex;
  align-items: center;
}

.badge-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  background: var(--color-success-bg);
  border: 2px solid var(--color-success);
  border-radius: var(--radius-full);
}

.badge-check {
  width: 24px;
  height: 24px;
  color: var(--color-success);
  display: inline;
  flex-shrink: 0;
}

.badge-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-sm);
  letter-spacing: 0.15em;
  color: var(--color-success);
}

/* ======== CLIENT BAR ======== */

.client-bar {
  background: var(--sc-gradient-subtle);
  border-bottom: 1px solid var(--color-divider);
}

.client-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  padding: var(--space-5) var(--space-8);
}

.client-detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.client-detail .label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}

.client-detail .value {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
}

/* ======== FUNDING HERO ======== */

.funding-hero {
  text-align: center;
  padding: var(--space-10) var(--space-8) var(--space-8);
}

.funding-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--color-text-muted);
}

.funding-amount {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 800;
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: var(--space-3) 0 var(--space-6);
  line-height: 1.1;
}

.funding-slider-wrap {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.funding-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  outline: none;
  cursor: pointer;
}

.funding-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sc-gradient);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(123, 79, 212, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.funding-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.funding-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sc-gradient);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-2);
}

.slider-note {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-top: var(--space-3);
}

/* ======== TERMS GRID ======== */

.terms-section {
  padding: var(--space-8);
}

.section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.section-title::before {
  content: '';
  width: 4px;
  height: 1.2em;
  background: var(--sc-gradient);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.terms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.term-card {
  background: var(--color-surface-2);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.term-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.term-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.term-value {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

/* Term Payment Banner */
.term-payment-banner {
  margin-top: var(--space-5);
  background: var(--sc-gradient-subtle);
  border: 1px solid rgba(123, 79, 212, 0.2);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  position: relative;
  overflow: hidden;
}

.term-payment-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--sc-gradient);
  border-radius: var(--radius-full);
}

.term-payment-banner-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
}

.tpb-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
}

.tpb-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.tpb-value {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tpb-divider {
  width: 1px;
  height: 40px;
  background: var(--color-border);
  flex-shrink: 0;
}

/* ======== EARLY PAYOFF ======== */

.payoff-section {
  padding: var(--space-8);
  background: var(--sc-gradient-subtle);
  border-top: 1px solid var(--color-divider);
}

.payoff-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
  max-width: 100%;
}

.payoff-slider-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
  padding: 0 var(--space-2);
}

.payoff-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-surface-offset);
  outline: none;
  cursor: pointer;
}

.payoff-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sc-gradient);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(123, 79, 212, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease;
}

.payoff-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.payoff-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--sc-gradient);
  border: 3px solid var(--color-surface);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.payoff-day-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 80px;
  flex-shrink: 0;
}

.payoff-day-num {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.payoff-day-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
}

/* Tier Cards */
.payoff-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.tier-card {
  position: relative;
  background: var(--color-surface);
  border: 2px solid var(--color-divider);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-align: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.tier-card.active {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow), var(--shadow-md);
  transform: translateY(-2px);
}

.tier-badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-3);
  background: var(--sc-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: var(--radius-full);
  white-space: nowrap;
  text-transform: uppercase;
}

.tier-days {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
}

.tier-rate {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tier-amount {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.tier-savings {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-success);
}

/* Payoff Summary */
.payoff-summary {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.payoff-summary-inner {
  padding: var(--space-5) var(--space-6);
  display: flex;
  gap: var(--space-8);
  justify-content: center;
  flex-wrap: wrap;
}

.summary-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.summary-val {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
}

.summary-val.highlight {
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.summary-val.savings {
  color: var(--color-success);
}

/* ======== ACCEPT OFFER ======== */

.accept-section {
  padding: var(--space-8);
  text-align: center;
  border-top: 1px solid var(--color-divider);
}

.accept-heading {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.accept-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
}

.btn-accept {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  background: var(--sc-gradient);
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-full);
  box-shadow: 0 4px 20px rgba(123, 79, 212, 0.35);
  transition: all 0.25s ease;
}

.btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px rgba(123, 79, 212, 0.45);
}

.btn-accept svg { display: inline; width: 20px; height: 20px; flex-shrink: 0; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.open {
  display: flex;
}

.modal-card {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: 80vh;
  max-height: 80dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-5) var(--space-6);
  background: var(--sc-gradient);
}

.modal-header h3 {
  color: #fff;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  margin: 0;
}

.modal-close {
  color: rgba(255,255,255,0.8);
  font-size: 24px;
  line-height: 1;
  padding: 0;
  background: none;
  border: none;
}

.modal-close:hover { color: #fff; }

.modal-body {
  padding: var(--space-5) var(--space-6);
}

.modal-summary {
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.8;
}

.modal-summary .ms-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-1) 0;
}

.modal-summary .ms-label { color: var(--color-text-muted); }
.modal-summary .ms-val { font-weight: 700; color: var(--color-text); }
.modal-summary .ms-val.big {
  font-size: var(--text-lg);
  background: var(--sc-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-legal {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.5;
}

.modal-footer {
  display: flex;
  gap: var(--space-3);
  padding: 0 var(--space-6) var(--space-5);
}

.btn-modal-cancel {
  flex: 1;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-surface);
  transition: border-color var(--transition-interactive);
}

.btn-modal-cancel:hover { border-color: var(--color-text-muted); }

.btn-modal-confirm {
  flex: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  background: var(--color-success);
  color: #fff;
  font-weight: 700;
  font-size: var(--text-sm);
  border: none;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.btn-modal-confirm:hover { opacity: 0.9; }
.btn-modal-confirm svg { display: inline; width: 18px; height: 18px; flex-shrink: 0; }
.btn-modal-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-status {
  padding: 0 var(--space-6) var(--space-5);
  font-size: var(--text-sm);
  text-align: center;
}

.modal-status.success { color: var(--color-success); font-weight: 600; }
.modal-status.error { color: #ef4444; font-weight: 600; }

/* ======== STIPULATIONS ======== */

.stips-section {
  padding: var(--space-8);
  border-top: 1px solid var(--color-divider);
}

.stips-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-5);
  max-width: 100%;
}

.stips-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.stip-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-2);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-lg);
  transition: border-color var(--transition-interactive), box-shadow var(--transition-interactive);
}

.stip-item:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-glow);
}

.stip-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--sc-gradient-subtle);
  border: 1px solid rgba(123, 79, 212, 0.15);
  flex-shrink: 0;
}

.stip-icon svg {
  color: var(--color-primary);
  display: inline;
  width: 22px;
  height: 22px;
}

.stip-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.stip-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.stip-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
}

.stip-status {
  flex-shrink: 0;
}

.stip-badge {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stip-badge.pending {
  background: rgba(123, 79, 212, 0.1);
  color: var(--color-primary);
  border: 1px solid rgba(123, 79, 212, 0.25);
}

.stip-upload {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--sc-gradient);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: opacity var(--transition-interactive);
}

.upload-btn:hover { opacity: 0.9; }
.upload-btn svg { display: inline; width: 14px; height: 14px; flex-shrink: 0; }

.upload-btn.uploaded {
  background: var(--color-success);
}

.upload-status {
  font-size: var(--text-xs);
  color: var(--color-success);
  font-weight: 600;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-submit-stips {
  width: 100%;
  margin-top: var(--space-5);
  padding: var(--space-4);
  background: var(--sc-gradient);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  border: none;
  border-radius: var(--radius-md);
  transition: opacity var(--transition-interactive);
}

.btn-submit-stips:hover:not(:disabled) { opacity: 0.9; }
.btn-submit-stips:disabled { opacity: 0.4; cursor: not-allowed; }

.stip-submit-status {
  text-align: center;
  margin-top: var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
}

.stip-submit-status.success { color: var(--color-success); }
.stip-submit-status.error { color: #ef4444; }

/* ======== FOOTER ======== */

.doc-footer {
  border-top: 1px solid var(--color-divider);
  padding: var(--space-6) var(--space-8);
  background: var(--color-surface-2);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  gap: var(--space-8);
  align-items: flex-start;
}

.footer-rep {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.footer-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-faint);
}

.footer-name {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
}

.footer-contact {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer-brand {
  text-align: right;
  max-width: 400px;
}

.footer-company {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.footer-disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  line-height: 1.5;
}

/* ======== RESPONSIVE ======== */

@media (max-width: 768px) {
  body {
    padding: var(--space-2);
  }

  .edit-panel {
    position: fixed;
    top: var(--space-2);
    right: var(--space-2);
    width: 280px;
  }

  .doc-header {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-6) var(--space-5) var(--space-4);
    align-items: flex-start;
  }

  .client-info {
    grid-template-columns: repeat(2, 1fr);
    padding: var(--space-4) var(--space-5);
  }

  .funding-hero {
    padding: var(--space-8) var(--space-5) var(--space-6);
  }

  .terms-section {
    padding: var(--space-6) var(--space-5);
  }

  .terms-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .payoff-section {
    padding: var(--space-6) var(--space-5);
  }

  .stips-section {
    padding: var(--space-6) var(--space-5);
  }

  .term-payment-banner-inner {
    flex-direction: column;
    gap: var(--space-4);
  }

  .tpb-divider {
    width: 60%;
    height: 1px;
  }

  .tpb-block {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  .payoff-tiers {
    grid-template-columns: 1fr;
  }

  .payoff-summary-inner {
    flex-direction: column;
    gap: var(--space-4);
    align-items: stretch;
  }

  .summary-row {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer-content {
    flex-direction: column;
    gap: var(--space-4);
  }

  .footer-brand {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .client-info {
    grid-template-columns: 1fr;
  }

  .terms-grid {
    grid-template-columns: 1fr;
  }

  .funding-amount {
    font-size: clamp(1.5rem, 1rem + 3vw, 2.5rem);
  }
}

/* ======== ANIMATIONS ======== */

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

.term-card, .tier-card {
  animation: fadeInUp 0.4s ease both;
}

.term-card:nth-child(1), .tier-card:nth-child(1) { animation-delay: 0.05s; }
.term-card:nth-child(2), .tier-card:nth-child(2) { animation-delay: 0.1s; }
.term-card:nth-child(3), .tier-card:nth-child(3) { animation-delay: 0.15s; }
.term-card:nth-child(4) { animation-delay: 0.2s; }
.term-card:nth-child(5) { animation-delay: 0.25s; }
.term-card:nth-child(6) { animation-delay: 0.3s; }
