/* Static Header */
.static-header {
  background: linear-gradient(135deg, #1a2332 0%, #253447 100%);
  border-bottom: 1px solid #3d4f66;
  margin: -20px -20px 0 -20px;
  padding: 20px 20px;
}

.static-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0;
}

.static-header-left h1 {
  font-size: 24px;
  font-weight: 600;
  color: #ffffff;
  margin: 0;
  letter-spacing: 0.5px;
}

.static-header-right {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.company-name {
  font-size: 16px;
  color: #ffffff;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.contact-email {
  font-size: 13px;
  color: #7fb3ff;
  font-weight: 400;
}

.tagline {
  font-size: 11px;
  color: #a8b2c1;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Sticky Header */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, #1a2332 0%, #253447 100%);
  border-bottom: 2px solid #4a7cb8;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  margin: 0 -20px 20px -20px;
  padding: 15px 20px;
}

.sticky-header-content {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  max-width: 1200px;
  margin: 0;  /* <-- Changed from "0 auto" to "0" */
}

.project-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 20px;
}

.project-name-input {
  background: transparent;
  border: 1px solid transparent;
  color: #ffffff;
  font-size: 18px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
  min-width: 200px;
  transition: all 0.2s;
}

.project-name-input:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #4a9eff;
}

.project-name-input:focus {
  background-color: #1a2332;
  border-color: #4a9eff;
  outline: none;
}

.project-name-input::placeholder {
  color: #7a8a9a;
}

.metrics {
  display: flex;
  gap: 25px;
  align-items: center;
  align-self: center;
  margin-left: auto;
}

.metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.metric-label {
  font-size: 11px;
  color: #a8b2c1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #7fb3ff;
}

.header-calculate-btn {
  padding: 8px 20px;
  background-color: #4a7cb8;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 0;
}

.header-calculate-btn:hover {
  background-color: #5a8bc9;
}


body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 20px;
  background-color: #1a2332;
  color: #e8eaf0;
}

h3 {
  margin-bottom: 15px;
  font-weight: 400;
  font-size: 20px;
  color: #c5cad6;
}

h4 {
  margin: 30px 0 15px 0;
  color: #7fb3ff;
  font-weight: 600;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 8px;
  border-bottom: 3px solid #4a7cb8;
}

.input-row {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 15px;
  padding: 12px;
  background-color: #253447;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-wrap: wrap;
}

.input-row:hover {
  background-color: #2a3b4f;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

/* Revenue row layout (Settlements, Other Revenue) */
.input-row.revenue-row {
  display: grid;
  grid-template-columns: minmax(140px, 160px) 160px 180px 200px;
  gap: 12px;
  align-items: center;
}

.input-row.revenue-row label {
  white-space: nowrap;
}

.input-row.revenue-row .input-group {
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row.revenue-row .input-group > span:first-child {
  text-align: right;
  display: inline-block;
  width: 40px;
}

.input-row.revenue-row .input-group input[type="number"] {
  width: 100px;
  min-width: 0;
}

.input-row.revenue-row .input-group input[type="date"] {
  width: 130px;
  min-width: 0;
}

/* Product module row layout - flexbox for proper spacing */
.input-row.product-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}

.input-row.product-row .budget-name-input {
  width: 180px;
  flex-shrink: 0;
}

/* # symbol */
.input-row.product-row .quantity-label {
  color: #a8b2c1;
  font-weight: 500;
  flex-shrink: 0;
}

/* Quantity input */
.input-row.product-row .quantity-input {
  width: 60px;
  flex-shrink: 0;
}

/* $ symbol */
.input-row.product-row .dollar-symbol {
  color: #a8b2c1;
  font-weight: 500;
  flex-shrink: 0;
}

/* Avg Price input */
.input-row.product-row .amount-input {
  width: 110px;
  flex-shrink: 0;
}

/* Calculated revenue */
.input-row.product-row .calculated-amount {
  flex-shrink: 0;
}

/* Input groups for Start and Sales/mo */
.input-row.product-row .input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.input-row.product-row .input-group > span:first-child {
  color: #a8b2c1;
  font-weight: 500;
  flex-shrink: 0;
}

/* Start date input */
.input-row.product-row .input-group input[type="date"] {
  width: 130px;
  flex-shrink: 0;
}

/* Sales per month input */
.input-row.product-row .sales-per-month-input {
  width: 60px;
  flex-shrink: 0;
}

/* Controls */
.input-row.product-row .budget-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  margin-left: auto;
}

.input-row.revenue-row .input-group input.duration-input {
  width: 85px;
  min-width: 0;
}

/* StartDetail budget layout */
.input-row.startDetail-row {
  display: grid;
  grid-template-columns: 180px 30px 110px 180px 180px auto;
  gap: 12px;
  align-items: center;
}

.input-row.startDetail-row .budget-name-input {
  grid-column: 1;
  width: 100%;
  min-width: 0;
}

/* $ symbol as separate grid child */
.input-row.startDetail-row .dollar-symbol {
  grid-column: 2;
  text-align: right;
  color: #a8b2c1;
  font-weight: 500;
}

/* Amount input as separate grid child */
.input-row.startDetail-row .amount-input {
  grid-column: 3;
  width: 100%;
  min-width: 0;
}

/* Start date group */
.input-row.startDetail-row .input-group:nth-of-type(1) {
  grid-column: 4;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row.startDetail-row .input-group:nth-of-type(1) > span:first-child {
  text-align: right;
  display: inline-block;
  width: 40px;
}

/* Duration group */
.input-row.startDetail-row .input-group:nth-of-type(2) {
  grid-column: 5;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row.startDetail-row .input-group input[type="date"] {
  width: 130px;
  min-width: 0;
}

.input-row.startDetail-row .input-group input.duration-input {
  width: 85px;
  min-width: 0;
}

.input-row.startDetail-row .budget-controls {
  grid-column: 6;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.input-row.startDetail-row .budget-controls span {
  font-size: 12px;
  white-space: nowrap;
}

/* Simple budget layout */
.input-row.simple-row {
  display: grid;
  grid-template-columns: 180px 30px 110px 180px auto;
  gap: 12px;
  align-items: center;
}

.input-row.simple-row .budget-name-input {
  grid-column: 1;
  width: 100%;
  min-width: 0;
}

/* $ symbol as separate grid child */
.input-row.simple-row .dollar-symbol {
  grid-column: 2;
  text-align: right;
  color: #a8b2c1;
  font-weight: 500;
}

/* Amount input as separate grid child */
.input-row.simple-row .amount-input {
  grid-column: 3;
  width: 100%;
  min-width: 0;
}

.input-row.simple-row .input-group {
  grid-column: 4;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row.simple-row .input-group > span:first-child {
  text-align: right;
  display: inline-block;
  width: 40px;
}

.input-row.simple-row .input-group input[type="date"] {
  width: 130px;
  min-width: 0;
}

.input-row.simple-row .budget-controls {
  grid-column: 5;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

/* Percent budget layout */
.input-row.percent-row {
  display: grid;
  grid-template-columns: 180px 30px 55px 40px 200px 140px 1fr;
  gap: 12px;
  align-items: center;
}

.input-row.percent-row .budget-name-input {
  grid-column: 1;
  width: 100%;
  min-width: 0;
}

/* % symbol */
.input-row.percent-row .percent-symbol {
  grid-column: 2;
  text-align: right;
  color: #a8b2c1;
  font-weight: 500;
}

/* Percent input */
.input-row.percent-row .percent-input {
  grid-column: 3;
  width: 100%;
  min-width: 0;
}

/* "of" label */
.input-row.percent-row .of-label {
  grid-column: 4;
  text-align: center;
  color: #a8b2c1;
  font-weight: 500;
}

/* Driver selection */
.input-row.percent-row .input-group {
  grid-column: 5;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row.percent-row .input-group select.driver-select {
  padding: 8px 10px;
  border: 1px solid #3d4f66;
  border-radius: 4px;
  background-color: #1a2332;
  color: #e8eaf0;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  cursor: pointer;
  width: 160px;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
}

.input-row.percent-row .input-group select.driver-select:focus {
  outline: none;
  border-color: #5a8bc9;
}

/* Calculated amount display */
.input-row.percent-row .calculated-amount {
  grid-column: 6;
}

.input-row.percent-row .budget-controls {
  grid-column: 7;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
}

.input-row.percent-row .budget-controls span {
  font-size: 12px;
  white-space: nowrap;
}

.input-row label {
  font-weight: 500;
  color: #a8b2c1;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-group span {
  color: #a8b2c1;
  font-weight: 500;
  flex-shrink: 0;
}

.input-group input {
  padding: 8px 10px;
  border: 1px solid #3d4f66;
  border-radius: 4px;
  background-color: #1a2332;
  color: #e8eaf0;
  font-size: 14px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  margin-left: 8px;
  height: 36px;
  box-sizing: border-box;
}

.input-group input:focus {
  outline: none;
  border-color: #5a8bc9;
}

/* Ensure all inputs maintain consistent height and dark theme */
input[type="text"],
input[type="number"],
input[type="date"] {
  background-color: #1a2332 !important;
  color: #e8eaf0 !important;
  border: 1px solid #3d4f66;
  border-radius: 4px;
  padding: 8px 10px;
  height: 36px;
  box-sizing: border-box;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus {
  border-color: #5a8bc9;
  outline: none;
}

/* Fixed widths only for simple revenue/land rows, not budget rows */
.input-row:not(.startDetail-row):not(.percent-row) .input-group input[type="number"] {
  width: 150px;
}

.input-row:not(.startDetail-row):not(.percent-row) .input-group input[type="date"] {
  width: 160px;
}

.calculated-amount {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background-color: rgba(74, 158, 255, 0.1);
  border-radius: 4px;
  border: 1px solid #4a9eff;
  min-width: 120px;
}

.calculated-amount span:first-child {
  color: #7a8a9a;
  font-size: 12px;
}

.calculated-value {
  color: #4a9eff;
  font-weight: 600;
  font-size: 14px;
}

.percent-input {
  width: 60px;
}

.driver-select {
  padding: 6px 10px;
  border: 1px solid #3d4f66;
  border-radius: 4px;
  background-color: #1a2332;
  color: #e8eaf0;
  font-size: 14px;
}

.input-row:not(.startDetail-row):not(.percent-row) .input-group input.duration-input {
  width: 85px;
}

button {
  margin-top: 15px;
  padding: 10px 24px;
  cursor: pointer;
  background-color: #4a7cb8;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 500;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #5a8bc9;
}

.section {
  margin-bottom: 30px;
  padding: 20px;
  border: 1px solid #3d4f66;
  border-radius: 8px;
  background-color: #1e2a3a;
  max-width: 1200px;
}

#manualResult, #fileResult {
  margin-top: 15px;
  font-size: 18px;
  font-weight: 500;
  color: #7fb3ff;
}

#rocResult {
  font-size: 20px;
  font-weight: 600;
  color: #7fb3ff;
  margin: 10px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
  background-color: #253447;
}

th, td {
  border: 1px solid #3d4f66;
  padding: 10px;
  text-align: right;
  font-size: 14px;
}

th {
  background-color: #2d3e52;
  font-weight: 500;
  color: #c5cad6;
}

td:first-child, th:first-child {
  text-align: left;
  font-weight: normal;
}

/* Make all time period columns consistent width */
th:not(:first-child):not(:nth-child(2)), 
td:not(:first-child):not(:nth-child(2)) {
  width: 110px;
  min-width: 110px;
  max-width: 110px;
}

/* First column (Item) - flexible */
th:first-child, 
td:first-child {
  min-width: 150px;
}

/* Second column (Total $) - fixed width */
th:nth-child(2), 
td:nth-child(2) {
  width: 120px;
  min-width: 120px;
  max-width: 120px;
}

tr.budget-subitem td:first-child {
  font-weight: normal;
}

.total-row {
  font-weight: 600;
  background-color: #2d3e52;
}

.subtotal-row {
  background-color: #2a3b4f;
}

.subtotal-row td {
  font-weight: bold;
}

.total-row td {
  font-weight: bold;
}

.budget-group {
  cursor: pointer;
  background-color: #253447;
}

.budget-group td:first-child {
  font-weight: normal;
}

.expand-icon {
  display: inline-block;
  margin-right: 8px;
  cursor: pointer;
  transition: transform 0.2s;
  user-select: none;
}

.budget-group.collapsed .expand-icon {
  transform: rotate(0deg);
}

.budget-group:not(.collapsed) .expand-icon {
  transform: rotate(90deg);
}

.budget-subitem {
  display: none;
  background-color: #1e2a3a;
}

.budget-group:not(.collapsed)[data-budget="settlements_qty"] ~ .budget-subitem[data-budget="settlements_qty"],
.budget-group:not(.collapsed)[data-budget="settlements_revenue"] ~ .budget-subitem[data-budget="settlements_revenue"],
.budget-group:not(.collapsed)[data-budget="acquisition"] ~ .budget-subitem[data-budget="acquisition"],
.budget-group:not(.collapsed)[data-budget="construction"] ~ .budget-subitem[data-budget="construction"],
.budget-group:not(.collapsed)[data-budget="consultants"] ~ .budget-subitem[data-budget="consultants"],
.budget-group:not(.collapsed)[data-budget="subdivision"] ~ .budget-subitem[data-budget="subdivision"],
.budget-group:not(.collapsed)[data-budget="marketing"] ~ .budget-subitem[data-budget="marketing"],
.budget-group:not(.collapsed)[data-budget="selling_costs"] ~ .budget-subitem[data-budget="selling_costs"],
.budget-group:not(.collapsed)[data-budget="other_costs"] ~ .budget-subitem[data-budget="other_costs"],
.budget-group:not(.collapsed)[data-budget="overheads"] ~ .budget-subitem[data-budget="overheads"] {
  display: table-row;
}

/* Custom budgets - each needs its own expansion rule */
.budget-group:not(.collapsed)[data-budget="custom_budget_0"] ~ .budget-subitem[data-parent="custom_budget_0"],
.budget-group:not(.collapsed)[data-budget="custom_budget_1"] ~ .budget-subitem[data-parent="custom_budget_1"],
.budget-group:not(.collapsed)[data-budget="custom_budget_2"] ~ .budget-subitem[data-parent="custom_budget_2"],
.budget-group:not(.collapsed)[data-budget="custom_budget_3"] ~ .budget-subitem[data-parent="custom_budget_3"],
.budget-group:not(.collapsed)[data-budget="custom_budget_4"] ~ .budget-subitem[data-parent="custom_budget_4"],
.budget-group:not(.collapsed)[data-budget="custom_budget_5"] ~ .budget-subitem[data-parent="custom_budget_5"],
.budget-group:not(.collapsed)[data-budget="custom_budget_6"] ~ .budget-subitem[data-parent="custom_budget_6"],
.budget-group:not(.collapsed)[data-budget="custom_budget_7"] ~ .budget-subitem[data-parent="custom_budget_7"],
.budget-group:not(.collapsed)[data-budget="custom_budget_8"] ~ .budget-subitem[data-parent="custom_budget_8"],
.budget-group:not(.collapsed)[data-budget="custom_budget_9"] ~ .budget-subitem[data-parent="custom_budget_9"] {
  display: table-row;
}

.budget-subitem td:first-child {
  font-style: italic;
  color: #999;
  padding-left: 28px;
}

/* Subtle row hover for better readability */
#cashflowTable tbody tr:not(.subtotal-row):not(.total-row):not(.budget-group):hover {
  background-color: #1e2a3a;
}

.empty-cell {
  background-color: #1e2a3a;
}

th:first-child, td:first-child {
  white-space: nowrap;
}

th:nth-child(2), td:nth-child(2) {
  white-space: nowrap;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #3d4f66;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #4a7cb8;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

.budget-container {
  margin: 20px 0;
  padding: 15px;
  background-color: #1e2a3a;
  border-radius: 6px;
  border-left: 4px solid #4a7cb8;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: all 0.2s ease;
}

.budget-container:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  border-left-color: #5a8bc9;
}

.budget-container[data-category="consultants"] {
  border-left-color: #4a7cb8;
}

.budget-container[data-category="construction"] {
  border-left-color: #e67e22;
}

.budget-container[data-category="subdivision"] {
  border-left-color: #9b59b6;
}

.budget-container[data-category="marketing"] {
  border-left-color: #3498db;
}

.budget-container[data-category="selling_costs"] {
  border-left-color: #1abc9c;
}

.budget-container[data-category="other_costs"] {
  border-left-color: #95a5a6;
}

.budget-container[data-category="overheads"] {
  border-left-color: #34495e;
}

.budget-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px solid #3d4f66;
}

.budget-header label {
  font-weight: 600;
  font-size: 16px;
  color: #c5cad6;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.add-budget-item-btn {
  padding: 6px 12px;
  font-size: 14px;
  margin: 0;
}

.budget-subtotal {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 15px;
  padding: 12px 15px;
  background: linear-gradient(135deg, #253447 0%, #2a3b4f 100%);
  border-radius: 6px;
  border: 1px solid #3d4f66;
}

.budget-subtotal:hover {
  background: linear-gradient(135deg, #2a3b4f 0%, #2f4159 100%);
}

.add-custom-budget-section {
  margin: 20px 0;
  text-align: center;
}

.add-custom-budget-btn {
  padding: 10px 20px;
  font-size: 16px;
  background-color: #4a7cb8;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
}

.add-custom-budget-btn:hover {
  background-color: #5a8cc8;
}

.budget-container.custom-budget {
  border-left: 4px solid #f97316;
}

.custom-budget-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background-color: #f97316;
  color: white;
  border-radius: 3px;
  font-size: 12px;
  font-weight: bold;
  margin-right: 8px;
  flex-shrink: 0;
}

.budget-header input.budget-name-input {
  font-weight: 500;
  font-size: 14px;
  padding: 8px 10px;
  background-color: transparent;
  border: 1px solid transparent;
  color: #e8eaf0;
  border-radius: 4px;
  text-transform: uppercase;
  height: 36px;
  box-sizing: border-box;
}

.budget-header input.budget-name-input:hover {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: #4a9eff;
}

.budget-header input.budget-name-input:focus {
  background-color: #1a2332;
  border-color: #4a9eff;
  outline: none;
}

.remove-custom-budget-btn {
  padding: 4px 8px;
  font-size: 18px;
  background-color: transparent;
  color: #c84a4a;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  font-weight: bold;
  line-height: 1;
}

.remove-custom-budget-btn:hover {
  background-color: rgba(200, 74, 74, 0.1);
  color: #d85a5a;
}

.replace-module-btn {
  padding: 4px 10px;
  font-size: 12px;
  background-color: #5a6a7a;
  color: #a8b2c1;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
  font-weight: 400;
}

.replace-module-btn:hover {
  background-color: #6a7a8a;
  color: #e8eaf0;
}

.module-type-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 20px 0;
}

.module-type-option {
  display: flex;
  align-items: center;
  padding: 12px;
  border: 2px solid #3d4f66;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.module-type-option:hover {
  border-color: #4a9eff;
  background-color: rgba(74, 158, 255, 0.1);
}

.module-type-option input[type="radio"] {
  margin-right: 12px;
  cursor: pointer;
}

.module-type-option .option-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.module-type-option .option-content strong {
  color: #e8eaf0;
  font-size: 14px;
}

.module-type-option .option-content span {
  color: #a8b2c1;
  font-size: 12px;
}

.budget-empty-state {
  text-align: center;
  padding: 30px;
  color: #7a8a9a;
  font-style: italic;
}



.modal-buttons .btn-danger {
  background: #d9534f;
  color: white;
}

.modal-buttons .btn-danger:hover {
  background: #c9302c;
}

.budget-line-count {
  display: inline-block;
  background-color: #3d4f66;
  color: #a8b2c1;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

.budget-subtotal span:first-child {
  font-weight: 600;
  color: #7fb3ff;
}

.budget-subtotal-amount {
  font-weight: 700;
  font-size: 16px;
  color: #ffffff;
  padding: 8px 16px;
  background-color: #4a7cb8;
  border-radius: 20px;
  min-width: 120px;
  text-align: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.budget-name-input {
  width: 180px;
  padding: 8px 10px;
  border: 1px solid #3d4f66;
  border-radius: 4px;
  background-color: #1a2332;
  color: #e8eaf0;
  font-size: 14px;
  height: 36px;
  box-sizing: border-box;
}

.add-line-below-btn {
  background-color: #5cb85c;
  padding: 2px 8px;
  font-size: 18px;
  min-width: auto;
  line-height: 1;
  margin-left: 4px;
  border-radius: 3px;
  cursor: pointer;
  color: white;
  font-weight: bold;
}

.add-line-below-btn:hover {
  background-color: #4cae4c;
}

.remove-budget-item-btn {
  background-color: #d9534f;
  padding: 2px 8px;
  font-size: 18px;
  min-width: auto;
  line-height: 1;
  margin-left: 4px;
  border-radius: 3px;
  cursor: pointer;
}

.budget-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

#resultsOutput {
  display: none;
  margin-top: 20px;
}

#resultsOutput p {
  font-size: 20px;
  font-weight: 600;
  color: #7fb3ff;
  margin: 10px 0;
}

#cashflowOutput {
  display: none;
  margin-top: 30px;
}

.cashflow-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 15px;
}

.cashflow-header h3 {
  margin: 0;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view-toggle span {
  color: #a8b2c1;
  font-weight: 500;
}

/* Custom Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

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

.modal-content {
  background: #2a3f5f;
  border-radius: 8px;
  padding: 25px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  margin: 0 0 15px 0;
  color: #e8f4f8;
  font-size: 18px;
}

.modal-content input[type="text"] {
  width: 100%;
  padding: 6px 10px;
  background: #1a2332;
  border: 1px solid #4a9eff;
  border-radius: 4px;
  color: #e8f4f8;
  font-size: 14px;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.modal-buttons {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-buttons button {
  padding: 8px 20px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
}

.modal-buttons .btn-primary {
  background: #4a9eff;
  color: white;
}

.modal-buttons .btn-primary:hover {
  background: #357abd;
}

.modal-buttons .btn-secondary {
  background: #5a6a7a;
  color: white;
}

.modal-buttons .btn-secondary:hover {
  background: #4a5a6a;
}
.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

.demo-btn,
.reset-btn {
  padding: 8px 16px;
  background: #4a5568;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  min-width: 100px;
  font-weight: 500;
}

.demo-btn:hover,
.reset-btn:hover {
  background: #2d3748;
}

/* Footer */
.footer {
  background: linear-gradient(135deg, #1a2332 0%, #253447 100%);
  border-top: 1px solid #3d4f66;
  margin: 40px -20px -20px -20px;
  padding: 20px;
  text-align: center;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 30px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.footer-links a {
  color: #7fb3ff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.footer-links a:hover {
  color: #4a9eff;
  text-decoration: underline;
}

.footer-copyright {
  color: #a8b2c1;
  font-size: 12px;
  margin-top: 10px;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
  * {
    box-sizing: border-box;
  }

  body {
    padding: 5px;
    overflow-x: hidden;
    width: 100%;
  }

  .static-header {
    margin: -5px -5px 0 -5px;
    padding: 15px 10px;
  }

  .static-header-content {
    flex-direction: column;
    gap: 15px;
    text-align: center;
    width: 100%;
  }

  .static-header-left h1 {
    font-size: 18px;
  }

  .static-header-right {
    text-align: center;
  }

  .header-buttons {
    justify-content: center;
    flex-wrap: wrap;
  }

  .demo-btn,
  .reset-btn {
    min-width: 90px;
    padding: 6px 12px;
    font-size: 12px;
  }

  .sticky-header {
    padding: 8px 5px;
  }

  .sticky-header-content {
    flex-direction: column;
    gap: 10px;
    padding: 10px 5px;
  }

  .project-name-input {
    width: 100% !important;
    max-width: 100%;
  }

  .metrics {
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
  }

  .metric {
    font-size: 12px;
  }

  .container {
    padding: 10px 5px;
    width: 100%;
    max-width: 100%;
  }

  .budget-section {
    margin-bottom: 20px;
    width: 100%;
  }

  .budget-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .input-row {
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .input-row .input-group,
  .input-row input,
  .input-row select,
  .input-row button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-shrink: 1 !important;
  }

  /* Force all input groups to stack vertically */
  .input-group {
    flex-direction: column !important;
    align-items: flex-start !important;
    width: 100% !important;
    gap: 5px !important;
  }

  /* Input group labels */
  .input-group > span:first-child {
    font-size: 12px !important;
    margin-bottom: 3px !important;
    width: auto !important;
  }

  /* Make all inputs full width and SAME HEIGHT */
  .input-group input,
  .input-group select,
  input[type="date"],
  input[type="number"],
  input[type="text"],
  .duration-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    padding: 10px !important;
    box-sizing: border-box !important;
    line-height: normal !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
  }

  /* iOS Safari date input fix - remove internal padding */
  input[type="date"]::-webkit-date-and-time-value {
    text-align: left !important;
    height: 24px !important;
    line-height: 24px !important;
  }

  /* Remove iOS inner shadows */
  input[type="date"]::-webkit-inner-spin-button,
  input[type="date"]::-webkit-calendar-picker-indicator {
    height: 24px !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* Toggle containers */
  .toggle-container,
  .straight-line-toggle {
    width: 100% !important;
    max-width: 100% !important;
    justify-content: flex-start !important;
  }

  /* Duration inputs */
  input.duration-input {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Product rows - convert to vertical stack */
  .input-row.product-row {
    flex-direction: column !important;
    align-items: flex-start !important;
  }

  .input-row.product-row .quantity-input,
  .input-row.product-row .amount-input,
  .input-row.product-row .budget-name-input,
  .input-row.product-row .sales-per-month-input,
  .input-row.product-row .input-group,
  .input-row.product-row .calculated-amount {
    width: 100% !important;
    max-width: 100% !important;
    flex-shrink: 1 !important;
  }

  .input-row.product-row .quantity-label,
  .input-row.product-row .dollar-symbol {
    display: inline-block !important;
    margin-right: 5px;
  }

  /* StartDetail rows - DISABLE GRID on mobile */
  .input-row.startDetail-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }

  .input-row.startDetail-row .budget-name-input,
  .input-row.startDetail-row .dollar-symbol,
  .input-row.startDetail-row .amount-input,
  .input-row.startDetail-row .input-group,
  .input-row.startDetail-row .budget-controls {
    grid-column: auto !important;
    width: 100% !important;
  }

  .input-row.startDetail-row .dollar-symbol {
    display: inline-block !important;
    margin-right: 5px !important;
    width: auto !important;
  }

  .input-row.startDetail-row .amount-input {
    display: inline-block !important;
    width: calc(100% - 30px) !important;
  }

  /* Simple rows (Acquisition Cost) - DISABLE GRID on mobile */
  .input-row.simple-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }

  .input-row.simple-row .budget-name-input,
  .input-row.simple-row .dollar-symbol,
  .input-row.simple-row .amount-input,
  .input-row.simple-row .input-group,
  .input-row.simple-row .budget-controls {
    grid-column: auto !important;
    width: 100% !important;
  }

  .input-row.simple-row .dollar-symbol {
    display: inline-block !important;
    margin-right: 5px !important;
    width: auto !important;
  }

  .input-row.simple-row .amount-input {
    display: inline-block !important;
    width: calc(100% - 30px) !important;
  }

  /* Percent rows - DISABLE GRID on mobile */
  .input-row.percent-row {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
  }

  .input-row.percent-row .input-group {
    width: 100% !important;
    grid-column: auto !important;
  }

  .input-row.percent-row .budget-name-input,
  .input-row.percent-row .dollar-symbol,
  .input-row.percent-row .amount-input,
  .input-row.percent-row .budget-controls {
    grid-column: auto !important;
    width: 100% !important;
  }

  .budget-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .budget-row input,
  .budget-row select,
  .budget-row button {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .budget-name-input {
    width: 100% !important;
  }

  .budget-controls {
    justify-content: flex-start;
    gap: 10px;
    flex-wrap: wrap;
  }

  .calculate-btn {
    width: 100%;
  }

  #cashflowTable {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
  }

  #cashflowTable table {
    min-width: 800px;
  }

  .footer {
    margin: 30px -5px -5px -5px;
    padding: 15px 10px;
  }

  .modal-content {
    width: 95%;
    max-width: 95%;
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .static-header-left h1 {
    font-size: 16px;
  }

  .company-name {
    font-size: 14px;
  }

  .contact-email,
  .tagline {
    font-size: 10px;
  }

  .metric-label,
  .metric-value {
    font-size: 11px;
  }

  .header-calculate-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .budget-section h3 {
    font-size: 16px;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"] {
    font-size: 14px;
  }

  .demo-btn,
  .reset-btn {
    min-width: 80px;
    font-size: 11px;
  }
}