/* =========================================================
   REDealIQ Design System
   Modern, premium, conversion-optimized
   ========================================================= */

:root {
  /* Brand */
  --brand-50:  #ecfeff;
  --brand-100: #cffafe;
  --brand-200: #a5f3fc;
  --brand-300: #67e8f9;
  --brand-400: #22d3ee;
  --brand-500: #06b6d4;
  --brand-600: #0891b2;
  --brand-700: #0e7490;
  --brand-800: #155e75;
  --brand-900: #164e63;

  --accent-500: #14f195;
  --accent-600: #0fc97a;
  --warn-500:   #f59e0b;
  --danger-500: #ef4444;

  /* Surfaces (dark by default) */
  --bg:          #07101c;
  --bg-elev-1:   #0c1626;
  --bg-elev-2:   #111d33;
  --bg-elev-3:   #182943;
  --border:      rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.16);

  /* Text */
  --text:        #e7eef7;
  --text-muted:  #93a4ba;
  --text-dim:    #5e7290;

  /* Effects */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
  --shadow-1:  0 1px 2px rgba(0,0,0,.4), 0 4px 16px rgba(0,0,0,.25);
  --shadow-2:  0 10px 40px rgba(6,182,212,0.15), 0 1px 2px rgba(0,0,0,.5);
  --glow:      0 0 0 1px rgba(34,211,238,.4), 0 0 28px rgba(34,211,238,.25);

  --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(20,241,149,.18), transparent 60%),
               radial-gradient(900px 600px at 10% 10%, rgba(6,182,212,.22), transparent 60%),
               linear-gradient(180deg, #07101c 0%, #07101c 100%);
  --grad-accent: linear-gradient(135deg, #22d3ee 0%, #14f195 100%);
  --grad-text:   linear-gradient(135deg, #22d3ee 0%, #a5f3fc 50%, #14f195 100%);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Light mode toggle (optional) */
[data-theme="light"] {
  --bg: #f7fafc;
  --bg-elev-1: #ffffff;
  --bg-elev-2: #ffffff;
  --bg-elev-3: #eef3f9;
  --border: rgba(15,23,42,0.08);
  --border-strong: rgba(15,23,42,0.16);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --grad-hero: radial-gradient(1200px 600px at 80% -10%, rgba(20,241,149,.10), transparent 60%),
               radial-gradient(900px 600px at 10% 10%, rgba(6,182,212,.14), transparent 60%),
               linear-gradient(180deg, #f7fafc 0%, #ffffff 100%);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--brand-300); text-decoration: none; }
a:hover { color: var(--brand-200); }

img { max-width: 100%; display: block; }

/* ---------- Layout ---------- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 880px; margin: 0 auto; padding: 0 24px; }

section { padding: 96px 0; position: relative; }
section.compact { padding: 56px 0; }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  section { padding: 64px 0; }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 16px; }
h1 { font-size: clamp(36px, 5.4vw, 64px); }
h2 { font-size: clamp(28px, 3.4vw, 44px); }
h3 { font-size: 22px; }
h4 { font-size: 17px; }
p  { color: var(--text-muted); font-size: 17px; margin: 0 0 12px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--brand-300);
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 999px; background: rgba(34,211,238,0.08);
  margin-bottom: 18px;
}
.gradient-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.muted { color: var(--text-muted); }
.mono  { font-family: var(--font-mono); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: 10px;
  font-weight: 600; font-size: 15px;
  cursor: pointer; border: 1px solid transparent;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--grad-accent); color: #042024; box-shadow: var(--shadow-2); }
.btn-primary:hover { box-shadow: var(--glow); color: #042024; }
.btn-ghost   { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--bg-elev-2); }
.btn-link    { background: transparent; color: var(--brand-300); padding: 0; }
.btn-lg      { padding: 16px 28px; font-size: 17px; border-radius: 12px; }
.btn-sm      { padding: 8px 14px; font-size: 13px; border-radius: 8px; }

/* ---------- Cards ---------- */
.card {
  background: linear-gradient(180deg, var(--bg-elev-1) 0%, var(--bg-elev-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.card.padded-lg { padding: 36px; }
.card-hover { transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.card-hover:hover { transform: translateY(-3px); border-color: var(--brand-600); box-shadow: var(--shadow-2); }
.card .badge {
  position: absolute; top: 16px; right: 16px;
  background: rgba(20,241,149,0.12); color: var(--accent-500);
  font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; letter-spacing: 0.08em; text-transform: uppercase;
}

/* ---------- Navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px);
  background: rgba(7,16,28,0.7);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .nav { background: rgba(255,255,255,0.7); }
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; max-width: 1200px; margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 18px; color: var(--text); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--grad-accent);
  display: grid; place-items: center; color: #042024; font-weight: 900;
}
.nav-links { display: flex; gap: 28px; align-items: center; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 15px; }
.nav-links a:hover { color: var(--text); }
@media (max-width: 800px) {
  .nav-links { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  background: var(--grad-hero);
  padding-top: 80px; padding-bottom: 80px;
  position: relative; overflow: hidden;
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center;
}
@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero h1 strong { color: var(--brand-300); font-weight: 800; }
.hero-bullets { display: flex; flex-direction: column; gap: 10px; margin: 24px 0 32px; }
.hero-bullets li {
  list-style: none; padding-left: 28px; position: relative; color: var(--text-muted); font-size: 16px;
}
.hero-bullets li::before {
  content: ""; position: absolute; left: 0; top: 6px;
  width: 18px; height: 18px; border-radius: 6px;
  background: var(--grad-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 6L9 17l-5-5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/14px no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 6L9 17l-5-5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/14px no-repeat;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.trust-row { display: flex; align-items: center; gap: 20px; margin-top: 28px; color: var(--text-dim); font-size: 13px; }
.trust-avatars { display: flex; }
.trust-avatars span {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--bg-elev-3); margin-left: -8px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--brand-300);
}
.trust-avatars span:first-child { margin-left: 0; }

/* ---------- Inline Calculator ---------- */
.calc-card { padding: 26px; border-radius: var(--radius-lg); }
.calc-tabs { display: flex; gap: 4px; padding: 4px; background: var(--bg-elev-3); border-radius: 10px; margin-bottom: 18px; }
.calc-tab { flex: 1; text-align: center; padding: 9px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-muted); transition: all .15s; }
.calc-tab.active { background: var(--bg-elev-1); color: var(--text); box-shadow: var(--shadow-1); }
.calc-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.calc-input { display: flex; flex-direction: column; gap: 6px; }
.calc-input label { font-size: 12px; color: var(--text-muted); font-weight: 600; }
.calc-input .field {
  display: flex; align-items: center; background: var(--bg-elev-3);
  border: 1px solid var(--border); border-radius: 10px; padding: 0 10px;
  transition: border-color .15s, box-shadow .15s;
}
.calc-input .field:focus-within { border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(34,211,238,.18); }
.calc-input .prefix, .calc-input .suffix { color: var(--text-dim); font-size: 14px; padding: 0 4px; }
.calc-input input {
  background: transparent; border: 0; outline: 0; flex: 1;
  padding: 12px 0; color: var(--text); font-size: 15px; font-family: var(--font-mono);
}
.calc-input input::placeholder { color: var(--text-dim); }

.calc-results {
  margin-top: 18px; padding: 18px;
  background: linear-gradient(135deg, rgba(34,211,238,.08), rgba(20,241,149,.06));
  border: 1px solid var(--border); border-radius: 12px;
}
.calc-results-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric .label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-muted); font-weight: 600; }
.metric .value { font-size: 26px; font-weight: 700; font-family: var(--font-mono); letter-spacing: -.02em; }
.metric .value.good { color: var(--accent-500); }
.metric .value.warn { color: var(--warn-500); }
.metric .value.bad  { color: var(--danger-500); }

/* Deal score */
.deal-score {
  display: flex; align-items: center; gap: 16px;
  margin-top: 16px; padding: 14px 18px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-elev-3);
}
.score-ring {
  --p: 0; --size: 64px;
  width: var(--size); height: var(--size); border-radius: 50%;
  background: conic-gradient(var(--accent-500) calc(var(--p) * 1%), var(--bg-elev-1) 0);
  display: grid; place-items: center; position: relative;
}
.score-ring::after {
  content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--bg-elev-1);
}
.score-ring .score-num { position: relative; z-index: 1; font-size: 18px; font-weight: 800; }
.deal-score .label { font-size: 12px; text-transform: uppercase; color: var(--text-muted); letter-spacing: .1em; font-weight: 700;}
.deal-score .verdict { font-size: 15px; font-weight: 600; }

/* ---------- Features grid ---------- */
.feature {
  display: flex; flex-direction: column; gap: 10px;
}
.feature .icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, rgba(34,211,238,.18), rgba(20,241,149,.18));
  display: grid; place-items: center; color: var(--brand-300);
  margin-bottom: 8px;
}
.feature h3 { margin: 0; }
.feature p { color: var(--text-muted); margin: 0; }

/* ---------- Stats ---------- */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.stat { text-align: center; }
.stat .num { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.stat .num .gradient-text { font-weight: 800; }
.stat .label { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
@media (max-width: 760px) { .stats-row { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Comparison Table ---------- */
.compare-table {
  width: 100%; border-collapse: collapse;
  background: var(--bg-elev-1); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
.compare-table th, .compare-table td {
  padding: 16px 18px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px;
}
.compare-table thead th {
  background: var(--bg-elev-2); color: var(--text); font-weight: 700;
}
.compare-table .col-us { background: rgba(20,241,149,.05); color: var(--text); }
.compare-table .yes { color: var(--accent-500); font-weight: 700; }
.compare-table .no  { color: var(--text-dim); }
.compare-table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Testimonials ---------- */
.testimonial { padding: 28px; }
.testimonial p { font-size: 16px; color: var(--text); margin-bottom: 18px; }
.testimonial .who { display: flex; align-items: center; gap: 12px; }
.testimonial .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--grad-accent); color: #042024;
  display: grid; place-items: center; font-weight: 800;
}
.testimonial .name { font-weight: 600; font-size: 14px; color: var(--text); }
.testimonial .role { font-size: 12px; color: var(--text-muted); }

/* ---------- Pricing ---------- */
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
@media (max-width: 900px) { .pricing-grid { grid-template-columns: 1fr; } }
.price-card { display: flex; flex-direction: column; gap: 16px; padding: 32px; position: relative; }
.price-card.featured { border-color: var(--brand-500); box-shadow: var(--glow); transform: scale(1.02); }
.price-card .tier { font-size: 14px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--brand-300); }
.price-card .price { font-size: 44px; font-weight: 800; letter-spacing: -.03em; font-family: var(--font-sans); }
.price-card .price small { font-size: 14px; color: var(--text-muted); font-weight: 500; }
.price-card ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.price-card li { padding-left: 26px; position: relative; color: var(--text-muted); font-size: 14px; }
.price-card li::before {
  content: ""; position: absolute; left: 0; top: 4px;
  width: 16px; height: 16px; border-radius: 4px; background: var(--grad-accent);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 6L9 17l-5-5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/12px no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20 6L9 17l-5-5' stroke='black' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/12px no-repeat;
}
.toggle-billing {
  display: inline-flex; padding: 4px; background: var(--bg-elev-3);
  border-radius: 10px; gap: 4px; margin: 24px auto;
}
.toggle-billing button {
  border: 0; background: transparent; padding: 8px 18px; border-radius: 8px;
  color: var(--text-muted); cursor: pointer; font-weight: 600;
}
.toggle-billing button.active { background: var(--bg-elev-1); color: var(--text); }
.save-tag { color: var(--accent-500); font-size: 11px; font-weight: 700; margin-left: 4px; }

/* ---------- FAQ ---------- */
.faq details {
  background: var(--bg-elev-1); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 22px; margin-bottom: 10px;
  cursor: pointer;
}
.faq details[open] { border-color: var(--brand-600); }
.faq summary { font-weight: 600; color: var(--text); list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq summary::after {
  content: "+"; color: var(--brand-300); font-weight: 700; font-size: 22px; line-height: 1;
  transition: transform .2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { margin: 12px 0 0; }

/* ---------- CTA ---------- */
.cta-band {
  background: var(--grad-accent); color: #042024;
  border-radius: var(--radius-lg);
  padding: 56px; text-align: center;
}
.cta-band h2 { color: #042024; }
.cta-band p { color: rgba(4,32,36,.78); font-size: 18px; }
.cta-band .btn-primary { background: #07101c; color: #ffffff; box-shadow: 0 1px 1px rgba(0,0,0,.3); }
.cta-band .btn-primary:hover { color: #fff; }

/* ---------- Footer ---------- */
.footer { background: var(--bg-elev-1); border-top: 1px solid var(--border); padding: 56px 0 28px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 36px; }
.footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-muted); }
.footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.footer a { color: var(--text-muted); font-size: 14px; }
.footer a:hover { color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); margin-top: 36px; padding-top: 22px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--text-dim); font-size: 13px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } }

/* =========================================================
   APP / DASHBOARD STYLES
   ========================================================= */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--bg-elev-1); border-right: 1px solid var(--border); padding: 22px 16px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { margin-bottom: 28px; padding: 0 8px; }
.sidebar-section { margin-top: 22px; }
.sidebar-section h5 { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--text-dim); padding: 0 10px; margin: 0 0 8px; }
.sidebar a.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.sidebar a.nav-item:hover { background: var(--bg-elev-2); color: var(--text); }
.sidebar a.nav-item.active { background: rgba(34,211,238,.08); color: var(--brand-300); border-left: 3px solid var(--brand-500); }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

.workspace { padding: 28px 36px; max-width: 1400px; }
.workspace-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.workspace-head h1 { font-size: 28px; margin: 0; }
.deal-meta { display: flex; gap: 16px; align-items: center; color: var(--text-muted); font-size: 14px; }
.deal-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 28px; overflow-x: auto; }
.deal-tab { padding: 12px 18px; cursor: pointer; color: var(--text-muted); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; }
.deal-tab.active { color: var(--text); border-bottom-color: var(--brand-500); }

.panels { display: grid; grid-template-columns: 1.1fr 1fr; gap: 22px; }
@media (max-width: 1000px) { .panels { grid-template-columns: 1fr; } }

/* Sliders */
.slider-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.slider-row .slider-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); font-weight: 600; }
.slider-row .slider-head .v { color: var(--brand-300); font-family: var(--font-mono); }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: var(--bg-elev-3); outline: none;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px;
  background: var(--grad-accent); border-radius: 50%; cursor: pointer; box-shadow: var(--shadow-1);
}
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; background: var(--grad-accent); border-radius: 50%; border: 0; cursor: pointer;
}

/* Deal library table */
.deal-table { width: 100%; border-collapse: collapse; }
.deal-table th, .deal-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
.deal-table th { color: var(--text-muted); font-weight: 600; text-transform: uppercase; font-size: 11px; letter-spacing: .1em; }
.deal-table tr:hover td { background: var(--bg-elev-2); cursor: pointer; }
.tag {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px;
  font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.tag-good { background: rgba(20,241,149,.12); color: var(--accent-500); }
.tag-warn { background: rgba(245,158,11,.12); color: var(--warn-500); }
.tag-bad  { background: rgba(239,68,68,.12); color: var(--danger-500); }

/* Chart placeholder */
.chart-box { height: 240px; }

/* Utility */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.hide-mobile { }
@media (max-width: 760px) { .hide-mobile { display: none; } }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-elev-2); color: var(--text); border: 1px solid var(--border-strong);
  padding: 14px 18px; border-radius: 10px; box-shadow: var(--shadow-2);
  display: flex; gap: 10px; align-items: center; opacity: 0; transform: translateY(20px);
  transition: opacity .2s, transform .2s; pointer-events: none; z-index: 100;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(7,16,28,.75);
  display: none; align-items: center; justify-content: center; z-index: 200;
  backdrop-filter: blur(6px);
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-elev-1); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); max-width: 480px; width: 90%; padding: 32px;
  box-shadow: var(--shadow-2);
}
.modal h3 { margin-top: 0; }
.modal .close { float: right; cursor: pointer; color: var(--text-muted); font-size: 24px; line-height: 1; }
.modal input[type=email], .modal input[type=text], .modal input[type=password] {
  width: 100%; padding: 12px 14px; background: var(--bg-elev-3); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); margin-top: 6px; font-size: 15px;
}

/* Loading shimmer */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.shimmer {
  background: linear-gradient(90deg, var(--bg-elev-2) 0%, var(--bg-elev-3) 50%, var(--bg-elev-2) 100%);
  background-size: 800px 100%; animation: shimmer 1.6s infinite;
}

/* Tooltip helper */
[data-tip] { position: relative; cursor: help; border-bottom: 1px dashed var(--text-dim); }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--bg-elev-3); color: var(--text); padding: 6px 10px; border-radius: 6px;
  white-space: nowrap; font-size: 12px; border: 1px solid var(--border); box-shadow: var(--shadow-1);
}

/* =========================================================
   PRINT — clean white LP-ready report
   ========================================================= */
@media print {
  @page { margin: 0.5in; size: letter; }

  body {
    background: #ffffff !important;
    color: #0f172a !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide everything except the active report content */
  .sidebar,
  .nav,
  .deal-tabs,
  .workspace-head > div:last-child, /* action buttons */
  .toast,
  .modal-overlay,
  .footer,
  #tab-assumptions,
  #tab-proforma,
  #tab-sensitivity,
  #tab-exit {
    display: none !important;
  }

  .app-shell { grid-template-columns: 1fr !important; }
  .workspace { padding: 0 !important; max-width: 100% !important; }

  #tab-report,
  #tab-report .card,
  #reportPreview {
    display: block !important;
    background: #ffffff !important;
    box-shadow: none !important;
    border: 0 !important;
    padding: 0 !important;
    color: #0f172a !important;
  }

  /* Make sure text inside the report is dark on white */
  #reportPreview * {
    color: #0f172a !important;
    background: transparent !important;
    border-color: #cbd5e1 !important;
  }

  #reportPreview h2,
  #reportPreview h3 {
    color: #0f172a !important;
    border-bottom: 1px solid #cbd5e1 !important;
    padding-bottom: 6px !important;
    margin-top: 18px !important;
  }

  #reportPreview .deal-table,
  #reportPreview table {
    width: 100% !important;
    border-collapse: collapse !important;
    margin: 8px 0 !important;
  }
  #reportPreview .deal-table td,
  #reportPreview table td,
  #reportPreview table th {
    padding: 8px 10px !important;
    border: 1px solid #e2e8f0 !important;
    font-size: 12pt !important;
  }

  /* Gradient text fallback to solid black for print */
  .gradient-text {
    background: none !important;
    -webkit-text-fill-color: #0f172a !important;
    color: #0f172a !important;
  }

  /* Avoid breaking tables across pages */
  table, tr, td, th { page-break-inside: avoid; }

  /* Add a print-only header to the report */
  #reportPreview::before {
    content: "REDealIQ — Underwriting Report";
    display: block;
    font-size: 10pt;
    color: #64748b !important;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-bottom: 2px solid #0f172a;
    padding-bottom: 8px;
    margin-bottom: 16px;
  }
}