@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap");

/* ============================================
   DESIGN SYSTEM - SAFE Calculator
   ============================================ */

:root {
  --primary-navy: #0d0a40;
  --brand-indigo: #4a32e5;
  --focus-indigo: #5f46ff;
  --text-main: #0d0a40;
  --text-muted: #444266;
  --text-light: #9ca3af;

  --bg-page: #f8f8ff;
  --bg-card: #ffffff;
  --border-fintech: rgba(0, 0, 0, 0.1);

  --shadow-input: 0px 1px 2px -1px rgba(0, 0, 0, 0.08),
    0px 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-button: 0px 1.33px 4px rgba(33, 33, 38, 0.2);
  --shadow-button-inset: inset 0px 1.33px 0px rgba(255, 255, 255, 0.07);
  --shadow-focus: 0px 2px 4px -2px rgba(0, 0, 0, 0.1),
    0px 4px 6px -1px rgba(0, 0, 0, 0.1);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --chart-1: #a855f7;
  --chart-2: #6366f1;
  --chart-3: #3b82f6;
  --chart-4: #06b6d4;
  --chart-5: #10b981;

  /* Slate variables for AI insights and helper text */
  --slate-100: #e2e8f0;
  --slate-500: #64748b;
  --slate-600: #475569;
}

/* Base Layout & Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.6;
  background-color: var(--bg-page);
  color: var(--text-main);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

svg {
  flex-shrink: 0;
}

.icon-error, .icon-trash, .icon-sparkles, .icon-mini {
  stroke: currentColor;
  fill: none;
}

.icon-plus, .spinner {
  fill: currentColor;
  stroke: none;
}

@media print {
  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

h1,
h4 {
  color: var(--primary-navy);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-family: inter !important;
}

h1 {
  font-size: 52px;
  line-height: 62px;
  margin-bottom: 0.5rem;
}



/* Header Utilities */
.header-description {
  max-width: 640px;
  font-size: 1rem;
  color: var(--slate-500);
}

.error-container {
  max-width: 800px;
  margin: 0 auto 2rem auto;
}

.input-error-msg {
  color: #ef4444;
  font-size: 13px;
  font-weight: 400;
  margin-top: 8px;
  display: block;
}

.input-invalid-border {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 1px #ef4444, var(--shadow-focus) !important;
}

/* Priced Round Card Styles */
.config-card {
  background: #f7f3fe !important;
  border-radius: 6px;
  padding: 24px;
  border: 1px solid var(--border-fintech);
  margin-bottom: 24px;
  box-shadow: var(--shadow-input);
}

.valuation-input-wrapper {
  border: 1px solid var(--border-fintech);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: var(--shadow-input);
  transition: all 0.2s ease;
}

.valuation-input-wrapper:hover,
.valuation-input-wrapper:focus-within {
  border-color: var(--focus-indigo);
  box-shadow: 0 0 0 1px var(--focus-indigo), var(--shadow-focus);
}

.valuation-main-input {
  border: none;
  font-weight: 500; /* Standardized */
  font-size: 14px;
  box-shadow: none;
}

/* deeply reset hover/focus for this inner input to prevent double borders */
.valuation-main-input:hover,
.valuation-main-input:focus {
  box-shadow: none !important;
  border: none !important;
}

.valuation-subtext {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}

.valuation-subtext strong {
  color: var(--primary-navy);
}

.option-pool-card {
  background: #fbfbfc;
  border-radius: 6px;
  padding: 24px;
  border: 1px solid var(--border-fintech);
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-input);
}
.option-pool-main-input {
  width: 80px;
  text-align: right;
  border: none;
  background: transparent;
  height: 100%;
  box-shadow: none;
}

.option-pool-suffix {
  color: var(--text-light);
  font-size: 14px;
}

.additional-shares-note {
  color: rgba(99, 91, 255, 1);
  font-size: 12px;
  font-weight: 500; /* Standardized */
}

.investors-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}



.investors-table-header {
  display: flex;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 8px;
  line-height: 16px;
  gap: 40px;
}

/* Utility Classes */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.items-center {
  align-items: center;
}
.items-start {
  align-items: flex-start;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.text-right {
  text-align: right;
}
.text-left {
  text-align: left;
}
.w-full {
  width: 100%;
}
.max-w-xs {
  max-width: 20rem;
}
.mb-0 {
  margin-bottom: 0;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-6 {
  margin-bottom: 1.5rem;
}
.mb-24 {
  margin-bottom: 24px;
}
.mt-12 {
  margin-top: 12px;
}
.p-share {
  padding: 0.4rem 0.8rem;
  font-size: 0.8125rem;
}
.flex-2 {
  flex: 2;
}
.flex-1 {
  flex: 1;
}



/* Chart Wrappers */
.chart-wrapper-pie {
  width: 100%;
  height: auto;
  min-height: 200px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pie-canvas-box {
  width: 250px;
  height: 200px;
  position: relative;
  flex-shrink: 0;
}

.chart-legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.5rem 1rem;
  width: 100%;
  margin-top: 1rem;
  padding: 0 0.5rem;
}

.chart-wrapper-bar {
  width: 100%;
  height: 310px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.chart-summary-text {
  text-align: center;
  width: 100%;
  margin-top: 8px;
  font-size: 0.875rem;
  font-weight: 500; /* Standardized */
  color: var(--text-medium);
}

/* AI Advisor Insight Styles */

.insight-icon {
  font-size: 1.125rem;
}

.insight-danger {
  color: var(--danger);
  font-weight: 500;
}

/* Row-scoped Component Classes */
.row-card-header {
  display: flex;
  gap: 12px;
  align-items: center;
}

.row-card-grid-shareholder {
  display: grid;
  grid-template-columns: 1fr 1fr 90px;
  gap: 12px;
  align-items: flex-end;
}

.row-card-grid-safe {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}



.row-select {
  height: 38px;
  font-size: 13px;
}

.row-input-right {
  text-align: right;
}

.row-trash-btn {
  opacity: 0.3;
}

.safe-card-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--bg-page);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.safe-name-input {
  background: transparent;
  border: none;
  font-weight: 500; /* Standardized */
  font-size: 14px;
  padding-left: 0;
  flex: 1;
  box-shadow: none;
}

.safe-discount-input {
  background: transparent;
  border: none;
  text-align: right;
  box-shadow: none;
}

.badge-fixed-height {
  height: 38px;
  border-radius: 6px;
}

.series-investor-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.series-investor-input {
  border: 1px solid var(--border-fintech);
  text-align: right;
}

/* Labels - Refined All-Caps Style */


.card-subtext,
.dilution-note,
.helper-text {
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text-light);
}

/* Tooltip Styles */
.tooltip-trigger {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  cursor: help;
  color: var(--text-light);
  position: relative;
}

.tooltip-trigger svg {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.tooltip-trigger:hover svg {
  opacity: 1;
  color: var(--brand-indigo);
}

.tooltip-trigger.tooltip-compact {
  margin-left: 0;
  transform: translateY(-2px);
}

.tooltip-trigger.tooltip-compact svg {
  width: 12px;
  height: 12px;
}

.tooltip-content {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: var(--primary-navy);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1.4;
  width: 200px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  font-weight: 400;
  letter-spacing: normal;
  text-transform: none;
}

.tooltip-content::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: var(--primary-navy) transparent transparent transparent;
}

.tooltip-trigger:hover .tooltip-content {
  opacity: 1;
  transform: translateX(-50%) translateY(-12px);
}

.card-subtext {
  margin-top: 0.25rem;
}

strong,
b {
  font-weight: 500;
}

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

.container {
  width: 100%;
  max-width: 1280px; /* Constrain for better readability */
  margin: 0 auto;
  padding: 0 4%; /* Responsive padding */
}

/* Center main header */
header.mb-12 {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.header-description {
  text-align: center;
  max-width: 640px;
}

/* ============================================
   CALCULATOR SHELL
   ============================================ */

.layout-controls {
  display: flex;
  justify-content: flex-end;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto 0.5rem auto;
  padding: 0 0.5rem;
}

.btn-reset {
  background: transparent !important;
  border: none !important;
  color: var(--text-light) !important;
  padding: 6px 12px;
  box-shadow: none !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  cursor: pointer;
}

.btn-reset svg {
  color: var(--text-muted) !important;
}

.btn-reset:hover {
  /* Hover effects removed */
  color: var(--text-light) !important;
}

.btn-reset:hover svg {
  /* Hover effects removed */
  color: var(--text-muted) !important;
}

.split-layout-wrapper {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-top: 0;
  flex-wrap: nowrap;
  justify-content: center;
  width: 100%;
  padding: 0.5rem;
}
.ai-insights-content p{
  font-size: 14px;
}
.calculator-column,
.results-column {
  flex: 1; /* Allow them to share space equally or based on content */
  width: 100%;
  min-width: 0; /* Prevent flex blowout */
}

/* Give the calculator column slightly more weight to match previous ratio */
.calculator-column {
  flex: 1.3;
}

.results-column {
  flex: 1;
}

/* Responsive Stacking */
@media (max-width: 1024px) {
  .split-layout-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    max-width: 100%;
    margin: 0 auto;
    padding: 1rem;
    overflow-x: hidden; /* Prevent horizontal scroll on this container */
  }

  .results-charts-row {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  
  body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
    -webkit-text-size-adjust: 100%;
  }

  .card, .btn, .input, .select {
    transition: none !important; /* Disabling transitions on mobile prevents some scroll-related jitter */
  }
}

.calculator-shell {
  width: 100%;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.calculator-shell section {
  background-color: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-fintech);
  padding: 24px;
  margin-bottom: 0; /* Let flex gap handle spacing */
  box-shadow: var(--shadow-input);
}

.results-column > section {
  background-color: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  margin-bottom: 0;
}

/* Ensure proper spacing in results sections */
.results-column .card-header {
  margin-bottom: 1.5rem;
}

.results-column .results-summary-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .results-column .results-summary-row {
    grid-template-columns: 1fr;
  }
}

.results-charts-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr; /* More room for the pie chart with callouts */
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-fintech);
  align-items: center;
  width: 100%;
}

.pie-chart-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.chart-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.bar-chart-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}


@media (max-width: 1024px) {
  .results-charts-row {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
}

@media (max-width: 1024px) {
  .results-charts-row {
    flex-direction: column;
    gap: 3rem;
  }
}

.card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-fintech);
  /* Keep subtle border */
  box-shadow: var(--shadow-input);
  padding: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* Card Header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 1.25rem; /* Slightly more room */
  gap: 1rem;
}

.card-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.card-title-group h2 {
  margin-bottom: 0;
}

/* Explicit P Weight Rule */
p {
  font-weight: 400;
  color: var(--text-main);
}

/* Card Footer */
.card-footer {
  padding: 1rem 1.5rem;
  margin: 1.5rem -24px -24px -24px;
  background: var(--bg-page);
  border-top: 1px solid var(--border-fintech);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 1rem;
}

/* Footer value with primary color */
.footer-value-primary {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-main);
}

/* ============================================
   INPUTS & FORM CONTROLS
   ============================================ */

.input,
input[type="text"],
input[type="number"],
.input {
  font-family: "Inter", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  width: 100%;
  padding: 8px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border-fintech);
  background-color: #f8f8ff;
  color: var(--text-muted);
  outline: none;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-input);
  display: flex;
  align-items: center;
}

.input:hover {
  border-color: var(--focus-indigo);
  /* Use box-shadow to simulate 2px border without layout shift */
  box-shadow: 0 0 0 1px var(--focus-indigo), var(--shadow-focus);
  z-index: 1; /* Ensure shadow sits on top */
}

.input:focus {
  /* Focus state handled by separate rule below, but ensure no padding shift here */
  z-index: 1;
}

.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
.select:focus {
  border-color: var(--focus-indigo);
  box-shadow: 0 0 0 3px rgba(95, 70, 255, 0.1);
  outline: none;
}

.input:disabled,
.input[readonly],
input:disabled,
input[readonly] {
  background-color: var(--bg-page) !important;
  color: var(--text-light) !important;
  cursor: not-allowed !important;
  border-color: var(--border-fintech) !important;
  box-shadow: none !important;
  pointer-events: none;
}

.input:disabled:hover,
.input[readonly]:hover {
  border-color: var(--border-fintech) !important;
  box-shadow: none !important;
}

/* Select Inputs */
select,
.select {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 20px;
  width: 100%;
  padding: 8px 32px 8px 8px;
  height: 38px;
  border-radius: 6px;
  border: 1px solid var(--border-fintech);
  background-color: #f8f8ff;
  color: var(--text-muted);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23667085' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-input);
}

select:hover,
.select:hover {
  border-color: var(--focus-indigo);
  box-shadow: 0 0 0 1px var(--focus-indigo), var(--shadow-focus);
}

select:focus,
.select:focus {
  border-color: var(--focus-indigo);
  box-shadow: 0 0 0 3px rgba(95, 70, 255, 0.1);
}

select:disabled {
  background-color: var(--bg-page);
  color: var(--text-light);
  cursor: not-allowed;
}

/* Checkboxes */
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-indigo);
  cursor: pointer;
}

/* Required Indicator */
.required::after {
  content: " *";
  color: var(--danger);
}

/* ============================================
   BUTTONS
   ============================================ */

.btn {
  font-family: "Inter", sans-serif;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  cursor: pointer;
  border-radius: 8px;
  /* Fix for layout regression: prevent shrinking with long titles */
  flex-shrink: 0;
  white-space: nowrap;
}

/* Primary Button */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  background: transparent;
  color: #111;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
  background-color: #f0e6ff;
  color: #5F17EA;
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

.btn-primary:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-icon-1 {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.btn-primary:hover .btn-icon {
  color: #5F17EA;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: none;
}

/* Icon Buttons (for row-level actions) */
.btn-icon,
.btn-trash {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s, color 0.2s;
}

.btn-icon:hover,
.btn-trash:hover {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.btn-trash svg,
.btn-icon svg {
  width: 16px;
  height: 16px;
}

/* Outline button for theme toggle or reset */
.btn-outline {
  border: 1px solid #000000;
  color: #000000;
  padding: 0.5rem 1rem;
  border-radius: 8px; /* Matching primary radius */
  transition: all 0.2s;
}

.btn-outline:hover {
  background-color: #f7f7f7;
  border-color: #333333;
}

/* ============================================
   TABLES (Replicated from User Snippet)
   ============================================ */

.table-container {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 1000px;
  margin: 2rem auto 0 auto;
  padding-top: 2rem;
}

.table-wrapper-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling for mobile tables */
}

/* "Ownership Breakdown" Label */
.subsection-title {
  font-size: 0.75rem; /* text-xs */
  font-weight: 500; /* font-medium */
  letter-spacing: 0.05em; /* tracking-wider */
  color: var(--text-muted); /* text-muted-foreground */
  margin-bottom: 1rem;
  text-align: center;
  border-bottom: none;
  padding-bottom: 0;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem; /* text-xs */
  margin: 0 auto;
}

thead {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1); /* border-border/50 */
  position: static;
  background: transparent;
}

th {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem;
  font-weight: 500; /* font-medium */
  color: var(--text-muted); /* text-muted-foreground */
  padding-bottom: 0.5rem; /* pb-2 */
  text-align: right;
  border-bottom: none;
  letter-spacing: normal;
  text-transform: none;
  padding-top: 0;
  white-space: nowrap;
}

th:first-child {
  text-align: left;
}

th.text-right {
  text-align: center;
}

tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05); /* divide-y divide-border/30 */
  transition: background-color 0.2s ease;
}
tbody tr:last-child {
  border-bottom: none;
}

td {
  font-family: "Inter", sans-serif;
  font-size: 0.75rem; /* text-xs */
  font-weight: 400;
  padding: 1rem 0.75rem; /* Standardizing padding */
  vertical-align: middle;
  text-align: right;
  color: var(--text-dark);
  border-bottom: none;
}

td:first-child {
  text-align: left;
  padding-left: 1rem;
}

/* First cell left padding */
td:first-child {
  padding-left: 0; /* Removed offset for better centering */
}

tr {
  transition: background-color 0.2s ease;
}

/* Removed conflicting centering overrides */

tr:hover td {
  background-color: var(--slate-50);
}

/* Column Widths (Balanced for Spacing) */
.col-name {
  width: 25%; /* Reduced from 30% to give more space to data */
  display: table-cell;
}
.col-shares,
.col-shares-pre,
.col-shares-post {
  width: 18%; /* Increased from 15% */
}
/* Numeric columns centering and balanced padding */
.col-shares-pre,
.col-shares-post,
.col-pct,
.col-pct-pre,
.col-pct-post,
.col-pps {
  text-align: center !important;
  padding-left: 1rem !important;
  padding-right: 1rem !important;
}

.col-pct,
.col-pct-pre,
.col-pct-post,
.col-pps {
  width: 13%;
}

/* Ensure no other styles override */
th:not(:first-child),
td:not(:first-child) {
  padding-left: 1.5rem; /* Force separation between columns */
  padding-right: 0.5rem;
}



/* Ensure no other styles override */
/* Standard Badge/Tag Styling (Consolidated) */
.tag {
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 9999px; /* Pill */
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  margin-left: 0.5rem;
  white-space: nowrap;
  text-transform: none;
  letter-spacing: 0;
  border: 1px solid transparent;
}

.tag-topup {
  background-color: #EBF8F3;
  color: #069668 !important;
  border-color: #069668;
}

.tag-post {
  background-color: #ECF2FE;
  color: #2663EB !important;
  border-color: #2663EB;
}

.tag-mfn {
  background-color: #F2EFFE;
  color: #7C3AED !important;
  border-color: #7C3AED;
}

.tag-pre {
  background-color: #FEF6EA;
  color: #D97707 !important;
  border-color: #D97707;
}


/* Utilities applied in script.js */
.text-muted {
  color: rgba(100, 116, 139, 0.6);
} /* text-muted-foreground/60 */
.disclosure-note {
  font-size: 0.6rem;
}
.text-dark {
  color: #0f172a;
} /* text-foreground */
.text-brand {
  color: rgba(99, 91, 255, 1);
} /* text-primary (purple) */
.font-medium {
  font-weight: 500;
}

.flex-cell-content {
  display: flex;
  align-items: center;
  gap: 0.5rem; /* gap-2 */
}

.col-pct {
  width: 12%;
}

.col-shares-pre {
  width: 15%;
}

.col-shares-post {
  width: 15%;
}

.col-pct-pre {
  width: 10%;
}

.col-pct-post {
  width: 10%;
}

.col-pps {
  width: 10%;
}

.col-actions {
  width: 48px;
  text-align: right;
}

.text-right {
  text-align: right;
}

/* Empty state placeholder */
.table-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-light);
  font-style: italic;
}

/* Table inputs (compact) */
table .input,
table input {
  height: 32px;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

table select {
  height: 32px;
  padding: 0.25rem 1.5rem 0.25rem 0.5rem;
  font-size: 0.875rem;
}


table .percentage-input-wrapper .percentage-suffix {
  height: 32px;
  font-size: 0.75rem;
  padding: 0 0.5rem;
}

/* Unused metrics removed */

/* ============================================
   CHARTS & VISUALIZATIONS
   ============================================ */

/* ============================================
   AI INSIGHT PANEL
   ============================================ */

.ai-insights-box {
  background: #f9f7fe;
  border: 1px solid var(--border-fintech);
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--shadow-input);
}

.ai-header-group {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.ai-icon-circle {
  width: 40px;
  height: 40px;
  background: #f3e8ff; /* Light purple tint */
  color: #9333ea; /* Purple sparkles */
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-icon-circle svg {
  width: 20px;
  height: 20px;
}

.ai-title-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ai-main-title {
  font-size: 16px;
  font-weight: 500;
  color: #111827;
}

.ai-insights-content {
  font-family: "Inter", sans-serif;
  line-height: 1.6;
  font-size: 14px;
  color: #374151; /* Neutral grey-dark */
}

.ai-insights-content p {
  margin-bottom: 1.25rem;
}

.ai-insights-content strong {
  color: var(--text-dark);
  font-weight: 600;
}

.ai-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--primary);
}

/* ============================================
   EXPAND / COLLAPSE SECTIONS
   ============================================ */

/* Unused collapsible removed */

/* ============================================
   AI SKELETON LOADER
   ============================================ */

.ai-skeleton-loader {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.ai-skeleton-line {
  height: 12px;
  background-color: var(--slate-100);
  border-radius: 4px;
  animation: pulse-opacity 1.5s infinite ease-in-out;
}

@keyframes pulse-opacity {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.4;
  }
}

/* ============================================
   RESULTS CARD REFACTOR
   ============================================ */

/* 1. Results Layout (New Hierarchy) */
.results-layout {
  padding: 1rem 0 2.5rem 0;
}

.founder-outcome-label {
 font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  text-align: left;
  letter-spacing: 0.05em;
}

.main-stats-grid {
  display: flex;
  gap: 3rem;
  margin-bottom: 2.5rem;
  padding: 0.5rem 0;
  align-items: flex-end;
  flex-wrap: wrap;
}

.export-actions-mini {
  display: flex;
  gap: 12px;
  margin-left: auto; /* Push to right */
  align-self: center;
}

.btn-mini-export {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  box-shadow: var(--shadow-button);
  min-width: 100px; /* Equal sizing */
}

.btn-mini-export.primary {
  background: var(--brand-indigo);
  color: white;
}

.btn-mini-export.primary:hover {
  background: var(--focus-indigo);
  transform: translateY(-1px);
}

.btn-mini-export.secondary {
  background: white;
  color: var(--primary-navy);
  border: 1px solid var(--border-fintech);
}

.btn-mini-export.secondary:hover {
  background: #f8f8ff;
  border-color: var(--brand-indigo);
  transform: translateY(-1px);
}

.btn-reset {
  padding: 6px 12px;
  font-size: 13px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: white;
  border: 1px solid var(--border-fintech);
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset:hover {
  background: #f8f8ff;
  border-color: var(--brand-indigo);
  color: var(--brand-indigo);
}

.btn-reset svg {
  opacity: 0.7;
}

.btn-reset:hover svg {
  opacity: 1;
}

.no-pdf {
  display: flex;
}

@media (max-width: 640px) {
  .export-actions-mini {
    width: 100%;
    justify-content: space-between;
    margin-top: 1rem;
  }
  .btn-mini-export {
    flex: 1;
    justify-content: center;
  }
}

.stat-large {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-value {
  font-size: 56px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
}

.stat-value.purple {
  color: #5f17ea;
}

.stat-value.grey {
  color: #374151;
}

.stat-label {
  font-size: 16px;
  color: #6b7280;
  font-weight: 400;
}

.secondary-stats-row {
  display: flex;
}

.stat-small {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 2rem;
}

.stat-small:first-child {
  padding-left: 0;
}

.stat-label-caps {
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  letter-spacing: 0.05em;
}

.stat-value-small {
  font-size: 24px;
  font-weight: 500;
  color: #111827;
}

/* 2. Charts Row - Unified Card */
.results-charts-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start; /* Keep columns at their natural height */
  gap: 2.5rem;
  margin-bottom: 2.5rem;
  background: var(--white);
  padding: 0 2.5rem;
  border-top: 0px;
}

@media (max-width: 1024px) {
  .results-charts-row {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
}

.chart-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  padding: 0;
  border: none;
}

.bar-chart-container,
.chart-wrapper-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.chart-title {
  text-align: center;
  width: 100%;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-bottom: 1.5rem;
  letter-spacing: 0.05em;
}

/* Donut Chart Container - Horizontal Layout */
.donut-container {
  position: relative;
  width: 100%;
}

/* Donut Chart Container - Horizontal Layout */
.donut-container {
  position: relative;
  width: 100%;
}

.pie-chart-wrapper {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  width: 100%;
}

.canvas-box {
  position: relative;
  width: 100%;
  min-width: 0;
}

.legend-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.5rem; /* Tighter gap for a more structured feel */
  min-width: 0;
  padding-left: 0.5rem; /* Slight breather from the chart */
}

.custom-legend-row {
  display: flex;
  align-items: flex-start; /* Align dot to top when text wraps */
  gap: 0.75rem;
  padding: 0.25rem 0;
  min-width: 0;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.legend-name {
  flex: 1;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-medium);
  word-break: break-word; /* Allow wrapping */
  line-height: 1.25;
}

.legend-pct {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dark);
  margin-left: auto;
  text-align: right;
  min-width: 45px;
}

/* Mobile: stacked charts */
@media (max-width: 640px) {
  .pie-chart-wrapper {
    flex-direction: column;
    min-height: auto;
  }
  .canvas-box {
    max-width: 100%;
  }
}

.donut-center-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-dark);
}

/* Bar Chart Container */
.bar-chart-container {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.bar-labels {
  display: flex;
  justify-content: space-around;
  width: 100%;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-light);
}

.bar-caption {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-medium);
  text-align: center;
}

/* Legend Updates */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.5rem;
  width: 100%;
}

.legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
}

.legend-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-pct {
  font-weight: 500;
  color: var(--text-dark);
}

/* 3. Ownership Breakdown Table */
.results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid rgba(233, 234, 235, 1);
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--white);
}

.results-table th {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(233, 234, 235, 1);
  border-right: 1px solid rgba(233, 234, 235, 1);
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-light);
  background: rgba(249, 250, 251, 0.5);
  text-align: left;
  letter-spacing: 0.05em;
  text-align: left;
  letter-spacing: 0.05em;
}

.results-table th.text-right {
  text-align: right;
}

.results-table th:last-child {
  border-right: none;
}

.results-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid rgba(233, 234, 235, 1);
  border-right: 1px solid rgba(233, 234, 235, 1);
  font-size: 0.8125rem;
  color: var(--text-dark);
  vertical-align: middle;
  line-height: 1.5;
}

.results-table td.text-right {
  text-align: right;
}

.results-table td:last-child {
  border-right: none;
}

.results-table tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr:hover {
  background-color: rgba(249, 250, 251, 0.5);
  transition: background-color 0.15s ease;
}

/* Better alignment for numeric columns */
.results-table .col-cat {
  width: 25%;
  min-width: 120px;
}

.results-table .text-right {
  width: 15%;
  min-width: 100px;
}

.results-table .col-pps {
  width: 12%;
  min-width: 90px;
}

.pre-value {
  color: var(--text-light);
}

.post-value {
  color: var(--primary);
  font-weight: 500;
}

.pps-value {
  color: var(--text-dark);
}

/* ============================================
   PRICED ROUND CARD LAYOUT
   ============================================ */

.highlight-added {
  color: var(--primary);
  font-weight: 500;
}

/* Valuation Block */
.valuation-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

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

/* ============================================
   SPACING UTILITIES
   ============================================ */

.mb-2 {
  margin-bottom: 0.5rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.mb-6 {
  margin-bottom: 1.5rem;
}

.mb-8 {
  margin-bottom: 2rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-8 {
  margin-top: 2rem;
}

.w-full {
  width: 100%;
}

.max-w-4xl {
  max-width: 56rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

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

/* ============================================
   BADGES
   ============================================ */

.badge-error {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-caveat {
  background-color: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.investor-row.highlight-row {
  background-color: #f5f3ff !important;
  transition: background-color 0.3s ease;
}

@keyframes flash-highlight {
  0% {
    background-color: rgba(95, 23, 234, 0.1);
  }
  100% {
    background-color: transparent;
  }
}

.highlight-flash {
  animation: flash-highlight 2s ease-out forwards;
}

/* ============================================
   PRICED ROUND CARD LAYOUT
   ============================================ */

.input-group {
  display: flex;
  flex-direction: column;
}

.input-group .detail-label {
  margin-bottom: 0.5rem;
}

/* Investor Table */
.investor-table thead {
  background-color: var(--background-light);
}

.investor-table th {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
}

@media (max-width: 640px) {
  .container {
    padding: 0 16px;
  }

  .calculator-shell section {
    padding: 1rem;
  }

  .results-column {
    padding: 1rem;
  }

  .results-table th,
  .results-table td {
    padding: 0.75rem 0.875rem;
    font-size: 0.8125rem;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .card-footer {
    margin: 1rem -16px -16px -16px;
    padding: 1rem;
  }

  h1 {
    font-size: 1.75rem;
  }
}

.subsection-title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-medium);
    margin-bottom: 1rem;
    text-align: left;
}

.split-layout-wrapper {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  margin-top: 0;
  justify-content: center;

  flex-wrap: nowrap;
}

.calculator-column {
  flex: 1;
  min-width: 0;
  max-width: 655px;
}

.results-column {
  flex: 1.2;
  max-width: 784px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background-color: var(--bg-card);
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid var(--border-fintech);
  box-shadow: var(--shadow-input);
  scrollbar-width: thin;
  scrollbar-color: var(--border-fintech) transparent;
}

.results-column::-webkit-scrollbar {
  width: 8px;
}

.results-column::-webkit-scrollbar-track {
  background: transparent;
}

.results-column::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
}

.results-column::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-light);
}

/* Reference-Specific Input Styles */
.input-row-card {
  background: #fdfdfe;
  border: 1px solid var(--border-fintech);
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 16px;
}

.input-with-symbol,
.input-with-symbol-right {
  position: relative;
  display: flex;
  align-items: center;
}

.input-symbol {
  position: absolute;
  color: #9ca3af;
  font-size: 0.875rem;
  pointer-events: none;
  font-weight: 500;
}

.input-with-symbol .input-symbol {
  left: 1rem;
}
.input-with-symbol-right .input-symbol {
  right: 1rem;
}

.input-with-symbol input {
  padding-left: 2rem;
}
.input-with-symbol-right input {
  padding-right: 2rem;
}

.valuation-input-wrapper,
.valuation-main-input {
  background-color: #ffffff !important;
}

.input-suffix {
  margin-left: 0.5rem;
  color: #9ca3af;
  font-size: 0.875rem;
  font-weight: 400;
}

.pct-badge {
  background: #f9fafb;
  padding: 0 0.75rem;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.8125rem;
  color: #6b7280;
  min-width: 75px;
  border: 1px solid #f1f5f9;
}

.card-footer-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-fintech);
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-total-value {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--primary-navy);
}

.text-purple-accent {
  color: var(--brand-indigo);
  font-size: 0.8125rem;
  font-weight: 500;
}

.card-footer-info {
  font-size: 0.75rem;
  color: var(--text-medium);
  font-weight: 500;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
}

.card-footer-value {
  color: var(--text-dark);
  font-weight: 500;
}

@media (max-width: 1024px) {
  .input-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    row-gap: 1rem;
  }

  .input-row .col-actions {
    grid-column: 2;
    justify-self: end;
    align-self: start;
  }

  #safes-container .input-row,
  #series-container .input-row {
    grid-template-columns: 1fr 1fr;
  }
}

.input-row:last-child {
  border-bottom: none;
}

/* Conflict removed: .col-name and others moved to table-cell display at the top */

.col-pct {
  text-align: right;
  justify-content: flex-end;
  padding-right: 0;
}

.col-actions {
  width: 40px;
  min-width: 40px;
  max-width: 40px;
  text-align: right;
  flex-shrink: 0;
  justify-self: end;
  align-self: center;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.col-actions .btn-trash {
  margin: 0;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-row .input,
.input-row .select,
.input-row input,
.input-row select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  height: 36px;
  margin: 0;
}

.input-row .col-pct {
  font-size: 0.875rem;
  color: var(--text-dark);
  font-weight: 400;
  line-height: 36px;
}

.input-row .percentage-input-wrapper {
  display: flex;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
  align-items: stretch;
}

.input-row .percentage-input-wrapper .compact-input,
.input-row .percentage-input-wrapper input {
  flex: 1;
  min-width: 60px;
  max-width: 100%;
  box-sizing: border-box;
  height: 36px;
}

.input-row * {
  box-sizing: border-box;
}

.input-row .input,
.input-row .select,
.input-row input,
.input-row select {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.input-row select,
.input-row .select {
  padding-right: 2rem;
}

@media (max-width: 1500px) {
  .calculator-column {
    width: 100%;
    max-width: 655.2px;
  }
  .results-column {
    width: 100%;
    max-width: 784px;
  }
}

@media (max-width: 1000px) {
  .split-layout-wrapper {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    gap: 2rem;
  }
  .results-column {
    position: static;
    max-height: none;
    overflow: visible;
    width: 100%;
    max-width: 100%;
    padding: 1.5rem;
    box-shadow: var(--shadow-input);
    -webkit-overflow-scrolling: touch;
  }
  .calculator-column {
    width: 100%;
    max-width: 100%;
  }
}

.input-header {
  display: none;
}

@media (max-width: 640px) {
  .input-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
  }

  .input-row:last-child {
    border-bottom: none;
  }

  .input-row > [data-label] {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .input-row > [data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--text-light);
    color: var(--text-light);
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
  }

  .input-row .col-actions {
    width: 100%;
    text-align: left;
    margin-top: 0.5rem;
    grid-column: 1;
  }

  .input-row .col-actions .btn-trash {
    margin-left: 0;
  }

  .input-row .percentage-input-wrapper {
    width: 100%;
  }

  .input-row .percentage-input-wrapper .compact-input,
  .input-row .percentage-input-wrapper input {
    width: 100%;
    box-sizing: border-box;
  }

  #safes-container .input-row,
  #series-container .input-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================
   EXPORT BUTTONS & PDF FUNCTIONALITY
   ============================================ */

/* Bottom Export Section */
/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-dialog {
  background: var(--bg-card);
  border-radius: 16px; /* Slightly more rounded */
  width: 90%;
  max-width: 500px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  border: 1px solid var(--border-fintech);
}

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

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--border-fintech);
}



.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-light);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-page);
  color: var(--text-main);
}

.modal-body {
  padding: 32px;
}

.modal-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-top: 4px;
}

.modal-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.input-group.full-width {
  grid-column: span 2;
}

.checkbox-group {
  grid-column: span 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.checkbox-note {
  font-size: 11px;
  color: var(--text-light);
  line-height: 1.4;
  margin-left: 28px; /* Align with label text */
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
}

.recipient-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.recipient-row .input {
  flex: 1;
}

.btn-remove-recipient {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.btn-remove-recipient:hover {
  color: #ef4444;
  background: #fee2e2;
}

.btn-add-recipient {
  background: none;
  border: none;
  color: #5f17ea;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  margin-top: 4px;
  transition: color 0.2s;
}

.btn-add-recipient:hover {
  color: #4b11ba;
}

.checkbox-container input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.modal-footer-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header div {
    display: flex;
    flex-direction: column;
}

.modal-footer .btn-export {
  flex: 1;
}

.error-message {
  display: block;
  color: #ef4444;
  font-size: 12px;
  margin-top: 6px;
}

/* Toast Notification */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  color: var(--text-main);
  padding: 16px 20px;
  border-radius: 8px;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border-fintech);
  z-index: 10000;
  animation: slideInRight 0.3s ease;
  max-width: 400px;
  font-size: 14px;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-notification.success {
  border-left: 4px solid #10b981;
}

.toast-notification.error {
  border-left: 4px solid #ef4444;
}

/* Loading Spinner */
.spinner {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Responsive Export Buttons */
@media (max-width: 640px) {
  .export-buttons-container {
    flex-direction: column;
  }

  .btn-export {
    width: 100%;
  }

  .toast-notification {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

.muted-text p{
    font-size: 0.5rem;
    color: rgb(107, 114, 128);
    margin-top: 0.75rem;
    font-style: italic;
    padding: 0px 0.5rem;
}

.insight-danger {
  color: #dc2626;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 20px;
}
.insight-item{
  color: #0d0a40;
}
.insight-info {
  background-color: #f8fafc;
  border-left: 3px solid #64748b;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  color: #475569;
  border-radius: 0 4px 4px 0;
}

/* ============================================
   CHART ALIGNMENT MASTER OVERRIDES
   ============================================ */

.results-charts-row {
  display: flex !important;
  flex-direction: row !important;
  gap: 2.5rem !important;
  align-items: flex-start !important;
  justify-content: center !important;
  width: 100% !important;
}

.field-label {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    line-height: 16px !important;
    color: var(--primary-navy) !important;
    letter-spacing: 0.05em !important;
    display: block !important;
    margin-bottom: 0.5rem;
}

.chart-column {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  min-width: 0 !important;
}

.bar-chart-container,
.chart-wrapper-bar,
.donut-container,
.chart-wrapper-pie {
  width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
}

@media (max-width: 1383px) {
  .results-charts-row {
    flex-wrap: wrap !important;
    gap: 2rem !important;
  }
  .chart-column {
    flex: 1 1 320px !important;
    min-width: 320px !important;
  }
  .bar-chart-container,
  .chart-wrapper-bar,
  .donut-container,
  .chart-wrapper-pie {
    min-height: 350px !important;
  }
}

@media (max-width: 1024px) {
  .results-charts-row {
    flex-direction: column !important;
    align-items: center !important;
  }
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 500;
    color: var(--primary-navy);
    margin: 0px;
    font-family: inter !important;
}

/* ============================================
   MOBILE UI OPTIMIZATION (640px and below)
   ============================================ */
@media (max-width: 640px) {
  /* Headline Scaling */
  header h1, 
  #safe-calculator-root h1 {
    font-size: 32px !important;
    line-height: 1.2 !important;
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
  }
  
  .header-description {
    font-size: 14px !important;
    padding: 0 1rem;
    line-height: 1.5 !important;
  }

  /* Main Stat (The large percentage) */
  .stat-value {
    font-size: 42px !important;
  }
  
  .main-stats-grid {
    gap: 1.5rem !important;
    margin-bottom: 2rem !important;
    justify-content: center !important;
    flex-direction: column;
    align-items: center;
  }

  .stat-large {
    align-items: center;
    text-align: center;
  }

  /* Secondary Stats (Post-money, PPS, Total Shares) */
  .secondary-stats-row {
    flex-direction: column !important;
    gap: 0px !important;
    border: 1px solid var(--border-fintech);
    border-radius: 12px;
    background: #fdfdfe;
    overflow: hidden;
  }

  .stat-small {
    padding: 1.25rem !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border-fintech);
    width: 100%;
    align-items: center;
    text-align: center;
  }

  .stat-small:last-child {
    border-bottom: none;
  }

  .stat-value-small {
    font-size: 20px !important;
    margin-top: 4px;
  }

  .stat-label-caps {
    font-size: 11px !important;
    color: #64748b;
    text-transform: uppercase;
  }

  /* Results card padding adjustments */
  .results-column {
    padding: 1rem !important;
    gap: 1.25rem !important;
  }
  
  .results-layout {
    padding: 0.5rem 0 1.5rem 0 !important;
  }

  /* Charts grid spacing */
  .results-charts-row {
    padding: 0 !important;
    gap: 2.5rem !important;
    flex-direction: column !important;
  }
  
  .chart-column {
    width: 100% !important;
    flex: none !important;
  }
  
  .chart-title {
    font-size: 13px !important;
    margin-bottom: 1rem !important;
    padding: 0 1rem;
  }

  /* Table responsiveness and density */
  .table-wrapper-responsive {
    margin: 0 -1rem;
    padding: 0 1rem;
    width: calc(100% + 2rem);
    overflow-x: auto;
  }
  
  table tr th, 
  table tr td {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }

  /* Disclosure note */
  .disclosure-note {
    font-size: 12px !important;
    line-height: 1.5 !important;
    text-align: center;
  }
  
  /* Export actions mini (top right) */
  .export-actions-mini {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 0.5rem !important;
  }
  
  .btn-mini-export {
    width: 100% !important;
    flex: none !important;
  }

  /* Split layout full width */
  .split-layout-wrapper {
    padding: 0 1rem !important;
    gap: 1.5rem !important;
  }

  /* SAFE card grid: stack on mobile */
  .row-card-grid-safe {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* Shareholder card grid: stack on mobile */
  .row-card-grid-shareholder {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  .pct-badge.badge-fixed-height {
    text-align: center;
  }

  /* Series investor row: stack name & input */
  .series-investor-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .series-investor-row .investor-name {
    width: 100% !important;
    flex: none !important;
  }

  .series-investor-row .input-with-symbol {
    flex: 1 !important;
    min-width: 0 !important;
  }

  /* Investors table header: hide on mobile since rows are stacked */
  .investors-table-header {
    display: none !important;
  }

  /* Option pool card: stack layout */
  .option-pool-card {
    padding: 16px !important;
  }

  .option-pool-card .flex-between {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* Config card (pre-money valuation) */
  .config-card {
    padding: 16px !important;
  }

  /* Section padding tighter */
  .calculator-shell section {
    padding: 16px !important;
  }

  /* Card header: stack title and button */
  .card-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  /* Input row cards: tighter padding */
  .input-row-card {
    padding: 14px !important;
  }

  /* Table: show ALL columns, scroll horizontally */
  .table-wrapper-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 -16px !important;
    padding: 0 !important;
    width: calc(100% + 32px) !important;
  }

  table {
    min-width: 600px !important;
    table-layout: auto !important;
  }

  table tr th,
  table tr td {
    padding: 8px 10px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
  }

  th:not(:first-child),
  td:not(:first-child) {
    padding-left: 8px !important;
    padding-right: 8px !important;
  }

  .col-name {
    width: auto !important;
    min-width: 100px !important;
    position: sticky !important;
    left: 0 !important;
    background: #fff !important;
    z-index: 1 !important;
  }

  thead .col-name {
    background: var(--bg-card) !important;
    z-index: 2 !important;
  }

  .total-row .col-name {
    background: var(--bg-page) !important;
  }

  /* Tags: smaller on mobile */
  .tag {
    font-size: 8px !important;
    padding: 1px 4px !important;
    margin-left: 0.25rem !important;
  }

  .flex-cell-content {
    flex-wrap: wrap !important;
    gap: 2px !important;
  }

  /* Modal: full-width on mobile */
  .modal-dialog {
    width: 95% !important;
    max-width: none !important;
    margin: 1rem !important;
  }

  .modal-body {
    padding: 20px !important;
  }

  .modal-form-grid {
    grid-template-columns: 1fr !important;
  }

  .input-group.full-width,
  .checkbox-group {
    grid-column: span 1 !important;
  }

  /* AI insights box */
  .ai-insights-box {
    padding: 16px !important;
  }

  .ai-header-group {
    margin-bottom: 16px !important;
  }

  /* Founder outcome label */
  .founder-outcome-label {
    text-align: center !important;
    font-size: 14px !important;
  }

  /* Tooltip: wider on mobile */
  .tooltip-content {
    min-width: 200px !important;
    max-width: 260px !important;
    font-size: 12px !important;
  }

  /* Breakdown section table container */
  .table-container {
    padding: 0 !important;
  }

  .subsection-title {
    text-align: center !important;
    font-size: 14px !important;
  }
}
