/* Starkwood ONE v2.1.52 — exact updated-prototype Equity & Amortization Calculator */
#sw-equity-calculator-v2152 {
  --sw-eq-blue: #2954e5;
  --sw-eq-navy: #0b1739;
  --sw-eq-gold: #c9994a;
  --sw-eq-purple: #7d5cc6;
  --sw-eq-green: #149b70;
  box-sizing: border-box;
  width: 100%;
  max-width: 672px;
  padding: 32px;
  color: #1e293b;
}
#sw-equity-calculator-v2152 *,
#sw-equity-calculator-v2152 *::before,
#sw-equity-calculator-v2152 *::after { box-sizing: border-box; }

/* Header matches the updated JSX: p-8 max-w-2xl, flex, text-xl, text-sm. */
.sw-eq-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sw-eq-header > div:first-child { min-width: 0; }
.sw-eq-title { margin: 0; font-size: 20px; line-height: 28px; font-weight: 700; color: #1e293b; white-space: nowrap; }
.sw-eq-subtitle { margin: 2px 0 0; font-size: 14px; line-height: 20px; color: #64748b; }
.sw-eq-subtitle strong { color: var(--sw-eq-blue); font-weight: 600; }
.sw-eq-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; margin-left: 12px; }
.sw-eq-btn { border: 1px solid #d9e1ef; background: #fff; color: #334155; border-radius: 8px; min-height: 34px; padding: 8px 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; line-height: 16px; font-weight: 600; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.sw-eq-btn:hover { background: #f8fafc; border-color: #b9c6da; }
.sw-eq-btn:active { transform: translateY(1px); }
.sw-eq-btn--primary { border-color: var(--sw-eq-blue); color: var(--sw-eq-blue); }
.sw-eq-btn--solid { background: var(--sw-eq-blue); color: #fff; border-color: var(--sw-eq-blue); }
.sw-eq-btn--solid:hover { background: #2149cf; }
.sw-eq-btn svg { width: 14px; height: 14px; flex: 0 0 auto; }

.sw-eq-stack { display: grid; gap: 20px; margin-top: 20px; }
.sw-eq-card { background: #fff; border: 1px solid #f1f5f9; border-radius: 16px; box-shadow: 0 1px 2px rgba(15,23,42,.05); padding: 20px; }
.sw-eq-card-label { margin-bottom: 8px; font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .025em; text-transform: uppercase; color: #64748b; }
.sw-eq-unit-label { margin-bottom: 12px; font-size: 14px; line-height: 20px; font-weight: 600; color: #334155; }
.sw-eq-search { position: relative; }
.sw-eq-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: #94a3b8; pointer-events: none; }
.sw-eq-input, .sw-eq-select { width: 100%; border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; color: #0f172a; min-height: 38px; padding: 8px 12px; font: inherit; font-size: 14px; line-height: 20px; outline: none; }
.sw-eq-input:focus, .sw-eq-select:focus { border-color: var(--sw-eq-blue); box-shadow: 0 0 0 3px rgba(41,84,229,.09); }
.sw-eq-search .sw-eq-input { padding-left: 36px; }
.sw-eq-select { margin-top: 12px; }
.sw-eq-buyer { margin-top: 8px; font-size: 11px; line-height: 16px; color: #94a3b8; }

.sw-eq-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 37px; padding: 8px 0; border-bottom: 1px dotted #e2e8f0; }
.sw-eq-row:last-child { border-bottom: 0; }
.sw-eq-row--total { border-top: 2px solid #cbd5e1; border-bottom: 0; margin-top: 4px; padding-top: 10px; }
.sw-eq-row-label { min-width: 0; font-size: 14px; line-height: 20px; color: #475569; }
.sw-eq-row--indent .sw-eq-row-label { padding-left: 20px; }
.sw-eq-row--bold .sw-eq-row-label, .sw-eq-row--total .sw-eq-row-label { color: #1e293b; font-weight: 700; }
.sw-eq-row-value { flex: 0 0 auto; text-align: right; font-size: 14px; line-height: 20px; font-weight: 600; color: #334155; white-space: nowrap; }
.sw-eq-row--total .sw-eq-row-value { font-size: 16px; line-height: 24px; color: #1e293b; font-weight: 700; }
.sw-eq-edit { display: flex; align-items: center; justify-content: flex-end; gap: 4px; flex: 0 0 auto; }
.sw-eq-edit input { width: 112px; border: 0; border-bottom: 2px solid var(--sw-eq-blue); border-radius: 0; background: transparent; color: var(--sw-eq-blue); text-align: right; font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; outline: none; padding: 1px 3px; }
.sw-eq-edit span { color: var(--sw-eq-blue); font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; }
.sw-eq-highlight { margin: 4px -8px 0; padding: 0 8px; border-radius: 12px; background: #f3f0fa; }
.sw-eq-inline-note { padding: 0 4px 8px; font-size: 11px; line-height: 16px; color: var(--sw-eq-purple); }
.sw-eq-date-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 8px 0; border-bottom: 1px dotted #e2e8f0; }
.sw-eq-date-label { font-size: 14px; line-height: 20px; color: #64748b; }
.sw-eq-date-controls { display: flex; align-items: center; gap: 4px; }
.sw-eq-date-controls input, .sw-eq-date-controls select { border: 1px solid #e2e8f0; border-radius: 8px; background: #fff; padding: 4px 8px; font-size: 12px; line-height: 16px; color: #334155; }
.sw-eq-loan-scenario { margin-top: 8px; }
.sw-eq-loan-scenario-label { margin-bottom: 6px; font-size: 11px; line-height: 16px; color: #64748b; }
.sw-eq-segmented { display: flex; gap: 8px; }
.sw-eq-segmented button { flex: 1; border: 0; border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 16px; font-weight: 600; cursor: pointer; background: #eef0f5; color: #41485a; }
.sw-eq-segmented button.is-active { background: var(--sw-eq-navy); color: #fff; }
.sw-eq-scenario-copy { margin-top: 6px; font-size: 11px; line-height: 16px; color: #94a3b8; }
.sw-eq-muted-note { margin: 0 0 8px; font-size: 11px; line-height: 16px; color: #94a3b8; }
.sw-eq-reconcile { margin-top: 8px; padding: 0 4px; font-size: 11px; line-height: 16px; color: var(--sw-eq-purple); }
.sw-eq-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sw-eq-table { width: 100%; min-width: 610px; border-collapse: collapse; font-size: 12px; line-height: 16px; }
.sw-eq-table th { padding: 6px 8px; border-bottom: 1px solid #f1f5f9; text-align: left; font-weight: 500; color: #94a3b8; white-space: nowrap; }
.sw-eq-table td { padding: 6px 8px; border-bottom: 1px solid #f8fafc; color: #64748b; white-space: nowrap; }
.sw-eq-table tr:last-child td { border-bottom: 0; }
.sw-eq-table td:last-child { color: #334155; font-weight: 600; }
.sw-eq-table tr.is-deferred { background: #f3f0fa; }
.sw-eq-deferred-tag { display: inline-block; margin-left: 6px; color: var(--sw-eq-purple); font-size: 10px; font-weight: 600; }
.sw-eq-footer-note { text-align: center; font-size: 12px; line-height: 16px; color: #94a3b8; }
.sw-eq-error { border: 1px solid #fecaca; background: #fff7f7; border-radius: 14px; padding: 18px; color: #b91c1c; font-size: 13px; line-height: 18px; }
.sw-eq-loading { min-height: 260px; display: grid; place-items: center; color: #64748b; font-size: 13px; }
.sw-eq-spinner { width: 28px; height: 28px; margin: 0 auto 10px; border: 3px solid #e2e8f0; border-top-color: var(--sw-eq-blue); border-radius: 50%; animation: swEqSpin .8s linear infinite; }
@keyframes swEqSpin { to { transform: rotate(360deg); } }

/* Exact DocumentViewerModal presentation used by the updated prototype. */
.sw-eq-modal { position: fixed; inset: 0; z-index: 999970; isolation: isolate; display: flex; flex-direction: column; align-items: center; padding: 32px 0; background: rgba(11,23,57,.65); overflow: hidden; }
.sw-eq-doc-toolbar { width: 100%; max-width: 842px; margin-bottom: 12px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; }
.sw-eq-doc-title { min-width: 0; color: #fff; font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sw-eq-doc-size { margin-left: 8px; color: rgba(255,255,255,.6); font-size: 10px; line-height: 14px; font-weight: 400; }
.sw-eq-doc-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.sw-eq-doc-actions .sw-eq-btn { min-height: 34px; }
.sw-eq-doc-actions .sw-eq-btn:not(.sw-eq-btn--solid) { background: #fff; border-color: #fff; color: #334155; }
.sw-eq-doc-area { width: 842px; max-width: 100vw; max-height: calc(100vh - 96px); overflow: auto; padding: 24px 24px 0; background: #d7dce6; display: flex; flex-direction: column; align-items: center; }
.sw-eq-a4-page { width: 794px; min-height: 1123px; padding: 76px; margin-bottom: 24px; box-sizing: border-box; flex: 0 0 auto; background: #fff; box-shadow: 0 10px 28px rgba(15,23,42,.22); color: #0b1739; font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.4; }
.sw-eq-print-head { display: flex; justify-content: space-between; align-items: flex-start; }
.sw-eq-print-title { font-size: 16px; line-height: 22px; font-weight: 700; color: #0b1739; }
.sw-eq-print-sub { margin-top: 2px; font-size: 11px; line-height: 15px; color: #64748b; }
.sw-eq-print-date { font-size: 10px; line-height: 14px; color: #94a3b8; text-align: right; }
.sw-eq-print-notice { margin-top: 8px; padding: 6px 10px; border: 1px solid #e9d9b8; border-radius: 6px; background: #fbf6e9; color: #946a1e; font-size: 10px; line-height: 14px; font-weight: 600; }
.sw-eq-print-cols { display: flex; gap: 18px; margin-top: 12px; }
.sw-eq-print-col { flex: 1; min-width: 0; }
.sw-eq-print-section { margin-bottom: 3px; color: #64748b; font-size: 10px; line-height: 14px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; }
.sw-eq-print-section.is-gap { margin-top: 12px; }
.sw-eq-print-row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; border-bottom: 1px solid #f1f5f9; }
.sw-eq-print-row > span:first-child { min-width: 0; color: #475569; }
.sw-eq-print-row > span:last-child { flex: 0 0 auto; color: #0b1739; font-weight: 400; white-space: nowrap; }
.sw-eq-print-row .is-indent { padding-left: 10px; }
.sw-eq-print-row.is-total { padding-top: 4px; border-top: 1.5px solid #1e293b; border-bottom: 0; font-weight: 700; }
.sw-eq-print-row.is-total > span { color: #0b1739; font-weight: 700; }
.sw-eq-print-schedule { margin-top: 14px; page-break-inside: auto; }
.sw-eq-print-schedule-note { margin-bottom: 4px; color: #94a3b8; font-size: 9px; line-height: 13px; }
.sw-eq-print-table { width: 100%; border-collapse: collapse; font-size: 9.5px; line-height: 13px; }
.sw-eq-print-table th { padding: 3px 4px; border-bottom: 1.5px solid #1e293b; text-align: left; color: #0b1739; font-weight: 700; }
.sw-eq-print-table td { padding: 2.5px 4px; border-bottom: 1px solid #f1f5f9; color: #0b1739; }
.sw-eq-print-table .is-num { text-align: right; }
.sw-eq-print-table tr.is-deferred { background: #f3f0fa; }
.sw-eq-print-table td:last-child { font-weight: 600; }
.sw-eq-print-deferred-note { margin-top: 3px; color: #8b6fce; font-size: 9px; line-height: 13px; }
.sw-eq-print-foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid #e2e8f0; color: #94a3b8; font-size: 9.5px; line-height: 13px; text-align: center; }

/* Settings stay database-backed but are no longer shown beside the print button. */
.sw-eq-settings-panel { width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow: auto; border-radius: 16px; background: #fff; box-shadow: 0 24px 70px rgba(2,8,23,.34); }
.sw-eq-modal-bar { min-height: 56px; padding: 11px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; background: var(--sw-eq-navy); color: #fff; }
.sw-eq-modal-title { font-size: 14px; font-weight: 700; }
.sw-eq-modal-actions { display: flex; align-items: center; gap: 8px; }
.sw-eq-settings-body { padding: 22px; }
.sw-eq-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sw-eq-setting-field label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: #475569; }
.sw-eq-setting-field input, .sw-eq-setting-field select { width: 100%; min-height: 40px; border: 1px solid #dbe3ef; border-radius: 9px; padding: 8px 10px; font: inherit; font-size: 13px; color: #0f172a; }
.sw-eq-settings-note { margin-top: 14px; border-radius: 10px; padding: 10px 12px; background: #f8fafc; font-size: 11px; line-height: 16px; color: #64748b; }
.sw-eq-settings-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 0 22px 22px; }
.sw-eq-toast { position: fixed; right: 24px; bottom: 24px; z-index: 1001000; max-width: 360px; border-radius: 10px; padding: 11px 14px; background: #0f172a; color: #fff; box-shadow: 0 12px 35px rgba(2,8,23,.28); font-size: 12px; font-weight: 700; }
.sw-eq-toast.is-error { background: #991b1b; }

@media (max-width: 767px) {
  #sw-equity-calculator-v2152 { max-width: none; padding: 20px 16px 32px; }
  .sw-eq-header { flex-direction: column; }
  .sw-eq-title { white-space: normal; }
  .sw-eq-actions { width: 100%; margin-left: 0; }
  .sw-eq-actions .sw-eq-btn { flex: 1; }
  .sw-eq-card { padding: 17px; border-radius: 14px; }
  .sw-eq-row { align-items: flex-start; }
  .sw-eq-row-label { font-size: 13px; line-height: 18px; }
  .sw-eq-row--indent .sw-eq-row-label { padding-left: 10px; }
  .sw-eq-edit input { width: 92px; }
  .sw-eq-date-row { align-items: flex-start; flex-direction: column; }
  .sw-eq-date-controls { width: 100%; }
  .sw-eq-date-controls input { flex: 1; min-width: 0; }
  .sw-eq-segmented { flex-direction: column; }
  .sw-eq-settings-grid { grid-template-columns: 1fr; }
  .sw-eq-modal { padding: 16px 0 0; }
  .sw-eq-doc-toolbar { padding: 0 12px; }
  .sw-eq-doc-size { display: none; }
  .sw-eq-doc-actions .sw-eq-btn { padding-left: 9px; padding-right: 9px; }
  .sw-eq-doc-area { max-height: calc(100vh - 72px); }
  .sw-eq-toast { left: 16px; right: 16px; bottom: 16px; max-width: none; }
}

@media print {
  @page { size: A4; margin: .5in; }
  body * { visibility: hidden !important; }
  #sw-eq-doc-print-area, #sw-eq-doc-print-area * { visibility: visible !important; }
  #sw-eq-doc-print-area { position: absolute !important; left: 0 !important; top: 0 !important; width: 100% !important; max-width: none !important; max-height: none !important; overflow: visible !important; box-shadow: none !important; background: none !important; padding: 0 !important; display: block !important; }
  .sw-eq-a4-page { width: auto !important; min-height: 0 !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; }
  .sw-eq-doc-toolbar { display: none !important; }
  .sw-eq-print-table, .sw-eq-print-table tr { break-inside: avoid; }
  .sw-eq-print-schedule { break-inside: auto; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
