/* Input design tokens */
:root {
  --calc-radius: 3px;
  --calc-radius-pill: 999px;
  --calc-border-default: #6B649E;
  --calc-border-hover: #5a5488;
  --calc-border-focus: #621CE3;
  --calc-border-filled: #6B649E;
  --calc-border-error: var(--color-error);
  --calc-border-disabled: #B4B0D1;
  --calc-border-calculated: #8F89B9;

  --calc-bg-default: #FAFAFA;
  --calc-bg-focus: #FAFAFA;
  --calc-bg-filled: #FAFAFA;
  --calc-bg-error: var(--color-neutral--100);
  --calc-bg-disabled: #f7f6fb;
  --calc-bg-calculated: #E8F7F6;

  --calc-label-color: #2E2856;
  --calc-label-focus: #2E2856;
  --calc-label-error: var(--color-error--dark);
  --calc-label-disabled: #9d96bf;
  --calc-label-calculated: #2E2856;
  --calc-helper-color: #B4B0D1;
  --calc-helper-error: var(--color-error--dark);
  --calc-helper-calculated: #4A437C;
  --calc-symbol-color: #6B649E;
  --calc-symbol-calculated: #6B649E;

  --calc-action-bg: #13776d;
  --calc-action-bg-hover: #0f615a;
  --calc-action-icon: #ffffff;
  --calc-action-icon-error: #c44747;
  --calc-action-icon-disabled: rgba(255, 255, 255, 0.75);
}

/* Finance Calculator Styles */

.finance-calculator-container {
  padding: 0;
  background: transparent;
}

.calculator-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #d9cff9;
}

.calculator-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: #2d0b6a;
  margin: 0;
}

.calculator-actions {
  display: inline-flex;
  gap: 0.75rem;
}

.calculator-actions .btn-primary {
  background: #7c3aed;
  border-color: #7c3aed;
  font-weight: 600;
}

.calculator-actions .btn-primary:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}

.calculator-actions .btn-outline-primary {
  color: #4b2ca0;
  border-color: #cdbdf7;
  background: #ffffff;
}

.calculator-actions .btn-outline-primary:hover {
  background: #ede7ff;
  border-color: #b7a3f0;
  color: #331f7c;
}

.product-selection {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #d9cff9;
  padding-left: 0;
  padding-right: 0;
}

.product-selection .form-label {
  font-weight: 500;
  color: #493894;
}

.product-selection .calc-input-frame {
  background: var(--calc-bg-default);
  border: 1px solid var(--calc-border-default);
}

.product-selection .calc-input-frame .form-select {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  height: 20px !important;
  font-size: 0.875rem !important;
  appearance: none !important;
  background-repeat: no-repeat !important;
  background-position: right 0 center !important;
  background-size: 10px 6px !important;
  padding-right: 16px !important;
  color: var(--calc-label-color) !important;
  width: 100% !important;
}

.product-selection .calc-input-frame .form-select:focus {
  outline: none !important;
  box-shadow: none !important;
}

.calculator-main-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
}

.calculator-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (max-width: 1400px) {
  .calculator-main-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.calculator-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  color: #4b2ca0;
  margin-bottom: 0.35rem;
}

/* Input wrapper */
.calc-input-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.calc-input-group label {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--calc-label-color);
  margin-bottom: 0;
}

.calc-input-group:focus-within label {
  color: var(--calc-label-focus);
}

.calc-input-group.is-error label {
  color: var(--calc-label-error);
}

.calc-input-group.is-disabled label {
  color: var(--calc-label-disabled);
}

.calc-input-frame {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--calc-border-default);
  border-radius: var(--calc-radius);
  background: var(--calc-bg-default);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-sizing: border-box;
}

.calc-input-frame > .input-group,
.calc-input-frame > .funding-profile-group {
  width: 100%;
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0;
}

/* Ensure input-groups inside calc-input-frame never wrap, even with error states */
.calc-input-frame .input-group {
  flex-wrap: nowrap !important;
}

.calc-input-frame .funding-profile-group .form-control {
  border: none;
  background: transparent;
  padding: 0;
  height: 20px;
  font-size: 0.875rem;
}

.calc-input-frame .input-group-text {
  background: transparent;
  border: none;
  border-right: 1px solid var(--calc-symbol-color);
  color: var(--calc-symbol-color);
  font-weight: 400;
  font-size: 0.875rem;
  height: 20px;
  padding: 0 9px 0 0;
  margin-right: 9px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* Percentage symbol at end of input (no border) */
.calc-input-frame .input-group-text:last-child {
  border: none;
  border-right: none;
  padding: 0 0 0 9px;
  margin-right: 0;
  margin-left: 9px;
}

.calc-input-frame > .input-group .form-control,
.calc-input-frame > .input-group .form-select {
  padding: 0;
  color: var(--calc-label-color);
  background: transparent;
  border: none;
  height: 20px;
  font-size: 0.875rem;
}

.calc-input-frame > .form-control,
.calc-input-frame > .form-select,
.calc-input-frame > select {
  width: 100%;
  background: transparent;
  border: none;
  padding: 0;
  color: var(--calc-label-color);
  height: 20px;
  font-size: 0.875rem;
}

.calc-input-frame > .form-select,
.calc-input-frame > select {
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px 6px;
  padding-right: 16px;
}

/* Override for all dropdowns in calculator columns */
.calculator-column .calc-input-frame .form-select,
.calculator-column .calc-input-frame select {
  background: transparent;
  border: none;
  padding: 0 !important;
  height: 20px !important;
  font-size: 0.875rem !important;
  appearance: none;
  background-repeat: no-repeat;
  background-position: right 0 center;
  background-size: 10px 6px;
  padding-right: 16px;
  color: var(--calc-label-color);
  width: 100%;
}

.calculator-column .calc-input-frame .form-select:focus,
.calculator-column .calc-input-frame select:focus {
  outline: none !important;
  box-shadow: none !important;
}

.calc-input-frame .form-control::placeholder,
.calc-input-frame .form-select::placeholder {
  color: var(--calc-helper-color);
}

.calc-input-frame .form-control:focus,
.calc-input-frame .form-select:focus {
  outline: none;
  box-shadow: none;
}

/* Ensure field_with_errors doesn't break layout in calc-input-group */
.calc-input-group .field_with_errors {
  display: contents; /* Make wrapper transparent to layout */
}



/* Let the frame handle error styling - change its border color */
.calc-input-group:has(.field_with_errors) .calc-input-frame {
  border-color: var(--calc-border-error) !important;
  background: var(--calc-bg-error) !important;
}

/* Style the label when in error state */
.calc-input-group .field_with_errors label {
  color: var(--calc-label-error) !important;
}

/* Restore calculator styling to inputs inside field_with_errors wrapper */
.calc-input-frame .field_with_errors input,
.calc-input-frame .field_with_errors select,
.calc-input-frame .field_with_errors textarea {
  border: none;
  background: transparent;
  box-shadow: none;
  color: var(--calc-label-color);
  padding: 0;
}

/* Error placeholder text styling */
.calc-input-frame .field_with_errors input::placeholder,
.calc-input-frame .field_with_errors textarea::placeholder {
  color: var(--color-error--dark) !important;
}

.funding-profile-group {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.funding-profile-group .form-control {
  flex: 1;
}

.funding-profile-group .input-group-text {
  background: transparent;
  border: none;
  color: #4b2ca0;
  font-weight: 600;
}

/* Apply calculated styling to fields with calculated-field class */
.calc-input-frame .calculated-field {
  background: transparent;
  color: var(--calc-helper-calculated) !important;
  cursor: not-allowed;
}

/* Apply calculated styling to the input group containing calculated fields */
.calc-input-group:has(.calculated-field) .calc-input-frame {
  border-color: var(--calc-border-calculated);
  background: var(--calc-bg-calculated);
}

.calc-input-group:has(.calculated-field) label {
  color: var(--calc-label-calculated);
}

.calc-input-group:has(.calculated-field) .calc-input-frame .input-group-text {
  color: var(--calc-symbol-calculated);
}

.subsidies-container {
  background: #f6f3ff;
  border: 1px dashed rgba(75, 44, 160, 0.35);
  border-radius: var(--calc-radius);
  padding: 0.8rem 1rem;
  margin-top: 0.2rem;
  animation: fadeIn 0.2s ease-in;
}

.results-column {
  background: linear-gradient(180deg, #e9ddff 0%, #f3eeff 100%);
  color: #2d0b6a;
  border-radius: 20px;
  padding: 1.5rem;
  min-height: 100%;
  box-shadow: 0 10px 28px rgba(94, 46, 180, 0.18);
}

.results-column h6 {
  font-weight: 600;
  margin-bottom: 1.25rem;
  color: #2d0b6a;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(125, 76, 205, 0.25);
}

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

.result-label {
  font-size: 0.85rem;
  color: rgba(45, 11, 106, 0.7);
}

.result-value {
  font-weight: 600;
  color: #2d0b6a;
}

.result-value.placeholder {
  color: rgba(45, 11, 106, 0.45);
}

.calculate-btn-container {
  margin-top: 1.5rem;
}

/* Ensure optional sections reveal correctly without progressive logic */
.d-none[data-progressive-calculator-target] {
  display: none !important;
}

[data-progressive-calculator-target].d-none.showing {
  display: block !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive tweaks */
@media (max-width: 992px) {
  .calculator-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .calculator-actions .btn {
    width: 100%;
  }
}

/* Input state modifiers */
.calc-input-group:hover .calc-input-frame {
  border-color: var(--calc-border-hover);
}

.calc-input-group:focus-within .calc-input-frame {
  border-color: var(--calc-border-focus);
  box-shadow: 0 0 0 2px rgba(98, 28, 227, 0.15);
  background: var(--calc-bg-focus);
}

/* Dropdown specific focus styles */
.calc-input-group:focus-within .calc-input-frame:has(.form-select),
.calc-input-group:focus-within .calc-input-frame:has(select) {
  border-bottom-color: var(--calc-border-focus);
  border-radius: var(--calc-radius) var(--calc-radius) 0 0;
}

.calc-input-frame > .form-select:focus,
.calc-input-frame > select:focus {
}

.calc-input-group.is-filled label {
  color: var(--calc-label-focus);
}

.calc-input-group.is-filled .calc-input-frame {
  border-color: var(--calc-border-filled);
  background: var(--calc-bg-filled);
}

.calc-input-group.is-calculated .calc-input-frame {
  border-color: var(--calc-border-calculated);
  background: var(--calc-bg-calculated);
}

.calc-input-group.is-calculated label {
  color: var(--calc-label-calculated);
}

.calc-input-group.is-calculated .calc-input-frame .input-group-text {
  color: var(--calc-symbol-calculated);
}

.calc-input-group.is-calculated .calc-input-frame .form-control {
  color: var(--calc-helper-calculated);
}

/* Readonly calculated field styling */
.calc-input-group.is-calculated .form-control:read-only {
  cursor: not-allowed;
  opacity: 0.8;
}

.calc-input-group.is-calculated .form-control:read-only:focus {
  box-shadow: none;
  outline: none;
}

/* Ensure deposit and net trade-in show calculated styling when filled from modal */
.calc-input-group:has(input[name*="deposit"][data-calculated="true"]) .calc-input-frame,
.calc-input-group:has(input[name*="net_trade_in"][data-calculated="true"]) .calc-input-frame {
  border-color: var(--calc-border-calculated);
  background: var(--calc-bg-calculated);
}

.calc-input-group:has(input[name*="deposit"][data-calculated="true"]) .form-control,
.calc-input-group:has(input[name*="net_trade_in"][data-calculated="true"]) .form-control {
  color: var(--calc-helper-calculated);
}

.calc-input-group.is-error .calc-input-frame {
  border-color: var(--calc-border-error);
  background: var(--calc-bg-error);
}

.calc-input-group.is-error label,
.calc-input-group.is-error .calc-helper-text {
  color: var(--calc-label-error);
}

.calc-input-group.is-disabled,
.calc-input-group.is-disabled * {
  cursor: not-allowed;
}

.calc-input-group.is-disabled .calc-input-frame {
  border-color: var(--calc-border-disabled);
  background: var(--calc-bg-disabled);
  opacity: 0.7;
}

.calc-input-group.is-disabled label,
.calc-input-group.is-disabled .calc-helper-text {
  color: var(--calc-label-disabled);
}

.calc-helper-text {
  font-size: 0.75rem;
  color: var(--calc-helper-color);
}

.calc-helper-text.is-error {
  color: var(--calc-helper-error);
}

.calc-inline-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--calc-radius);
  border: none !important;
  background: var(--calc-action-bg);
  color: var(--calc-action-icon);
  padding: 0;
  transition: background 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
  font-size: 0.75rem;
}

.calc-inline-action-btn:hover {
  background: var(--calc-action-bg-hover);
}

.calc-input-group.is-error .calc-inline-action-btn {
  background: #fbdede;
  color: var(--calc-action-icon-error);
}

.calc-input-group.is-disabled .calc-inline-action-btn {
  background: #eceaf4;
  color: var(--calc-action-icon-disabled);
}

.calc-inline-action-btn--wide {
  width: 100%;
  padding: 0 1rem;
  border-radius: var(--calc-radius);
  font-weight: 500;
  justify-content: center;
  background: var(--calc-action-bg);
  color: var(--calc-action-icon);
  border: none !important;
}

.calc-inline-action-btn--wide:hover {
  background: var(--calc-action-bg-hover);
}

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

.calc-input-field .calc-input-frame {
  flex: 1;
}

/* Commission value field layout - button separate from input */
.calc-input-group[data-controller*="commission-pair"] .calc-input-field {
  display: flex;
  gap: 6px;
  align-items: center;
}

.calc-input-group[data-controller*="commission-pair"] .calc-input-field .calc-input-frame {
  flex: 1;
}

/* Commission dual input styling */
.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
}

.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .form-control {
  border: none;
  background: transparent;
  height: 20px;
  line-height: 20px;
  font-size: 0.875rem;
  color: var(--calc-label-color);
  padding: 0;
  text-align: center;
}

/* Pound input */
.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .form-control[data-commission-pair-target="pounds"] {
  width: 45%;
  text-align: right;
  padding-right: 9px;
}

/* Percentage input */
.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .form-control[data-commission-pair-target="percent"] {
  width: 35%;
  text-align: center;
  border-left: 1px solid var(--calc-symbol-color);
  padding-left: 9px;
  margin-left: 0;
}

/* Override the input-group-text for commission to not have border */
.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .input-group-text:first-child {
  border-right: none;
  margin-right: 0;
  padding-right: 9px;
}

/* Percentage symbol - but not if it's followed by a button */
.calc-input-group[data-controller*="commission-pair"] .calc-input-frame .input-group-text:last-of-type {
  border: none;
  padding-left: 3px;
  margin: 0;
}

/* Deposit dual input styling */
.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .input-group {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  width: 100% !important;
}

.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .form-control {
  border: none;
  background: transparent;
  height: 20px;
  line-height: 20px;
  font-size: 0.875rem;
  color: var(--calc-label-color);
  padding: 0;
  text-align: center;
}

/* Pound input */
.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .form-control[data-deposit-pair-target="pounds"] {
  width: 45%;
  text-align: right;
  padding-right: 9px;
}

/* Percentage input */
.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .form-control[data-deposit-pair-target="percent"] {
  width: 35%;
  text-align: center;
  border-left: 1px solid var(--calc-symbol-color);
  padding-left: 9px;
  margin-left: 0;
}

/* Override the input-group-text for deposit to not have border */
.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .input-group-text:first-child {
  border-right: none;
  margin-right: 0;
  padding-right: 9px;
}

/* Percentage symbol */
.calc-input-group[data-controller*="deposit-pair"] .calc-input-frame .input-group-text:last-of-type {
  border: none;
  padding-left: 3px;
  margin: 0;
}

/* Net Advance Modal Styling */
.net-advance-modal .modal-header {
  background: #E8F7F6;
  color: #2E2856;
  border-bottom: none;
}

.net-advance-modal .modal-header .modal-title {
  color: #2E2856;
  font-weight: 600;
}

.net-advance-modal .modal-header .btn-close {
  opacity: 0.8;
}

.net-advance-modal .modal-header .btn-close:hover {
  opacity: 1;
}

.net-advance-modal .modal-body {
  background: var(--calc-bg-calculated);
  padding: 1.5rem;
}

.net-advance-modal .modal-footer {
  background: #C3EBE7;
  border-top: none;
  padding: 1rem 1.5rem;
}

.net-advance-modal .modal-footer .btn-secondary {
  background: rgba(46, 40, 86, 0.1);
  border-color: rgba(46, 40, 86, 0.3);
  color: #2E2856;
}

.net-advance-modal .modal-footer .btn-secondary:hover {
  background: rgba(46, 40, 86, 0.2);
  border-color: rgba(46, 40, 86, 0.4);
  color: #2E2856;
}

.net-advance-modal .modal-footer .btn-primary {
  background: #621CE3;
  border-color: #621CE3;
  color: white;
  font-weight: 600;
}

.net-advance-modal .modal-footer .btn-primary:hover {
  background: #4b2ca0;
  border-color: #4b2ca0;
  color: white;
}

/* Fees Modal Styling */
.fees-modal .modal-header {
  background: #E8F7F6;
  color: #2E2856;
  border-bottom: none;
}

.fees-modal .modal-header .modal-title {
  color: #2E2856;
  font-weight: 600;
}

.fees-modal .modal-header .btn-close {
  opacity: 0.8;
}

.fees-modal .modal-header .btn-close:hover {
  opacity: 1;
}

.fees-modal .modal-body {
  background: var(--calc-bg-calculated);
  padding: 1.5rem;
}

.fees-modal .modal-footer {
  background: #C3EBE7;
  border-top: none;
  padding: 1rem 1.5rem;
}

.fees-modal .modal-footer .btn-secondary {
  background: rgba(46, 40, 86, 0.1);
  border-color: rgba(46, 40, 86, 0.3);
  color: #2E2856;
}

.fees-modal .modal-footer .btn-secondary:hover {
  background: rgba(46, 40, 86, 0.2);
  border-color: rgba(46, 40, 86, 0.4);
  color: #2E2856;
}

.fees-modal .modal-footer .btn-primary {
  background: #621CE3;
  border-color: #621CE3;
  color: white;
  font-weight: 600;
}

.fees-modal .modal-footer .btn-primary:hover {
  background: #4b2ca0;
  border-color: #4b2ca0;
  color: white;
}

/* Commission Modal Styling */
.commission-modal .modal-header {
  background: #E8F7F6;
  color: #2E2856;
  border-bottom: none;
}

.commission-modal .modal-header .modal-title {
  color: #2E2856;
  font-weight: 600;
}

.commission-modal .modal-header .btn-close {
  opacity: 0.8;
}

.commission-modal .modal-header .btn-close:hover {
  opacity: 1;
}

.commission-modal .modal-body {
  background: var(--calc-bg-calculated);
  padding: 1.5rem;
}

.commission-modal .modal-footer {
  background: #C3EBE7;
  border-top: none;
  padding: 1rem 1.5rem;
}

.commission-modal .modal-footer .btn-secondary {
  background: rgba(46, 40, 86, 0.1);
  border-color: rgba(46, 40, 86, 0.3);
  color: #2E2856;
}

.commission-modal .modal-footer .btn-secondary:hover {
  background: rgba(46, 40, 86, 0.2);
  border-color: rgba(46, 40, 86, 0.4);
  color: #2E2856;
}

.commission-modal .modal-footer .btn-primary {
  background: #621CE3;
  border-color: #621CE3;
  color: white;
  font-weight: 600;
}

.commission-modal .modal-footer .btn-primary:hover {
  background: #4b2ca0;
  border-color: #4b2ca0;
  color: white;
}

.net-advance-columns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.net-advance-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.net-advance-column .calculator-column-header {
  font-weight: 600;
  color: #4b2ca0;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.fees-columns {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.fees-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fees-column .calculator-column-header {
  font-weight: 600;
  color: #4b2ca0;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.commission-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.commission-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.commission-column .calculator-column-header {
  font-weight: 600;
  color: #4b2ca0;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.commission-basis {
  max-width: 400px;
}

.commission-basis .calc-input-frame .form-select {
  height: 32px !important;
  line-height: 1.5 !important;
  padding: 6px 16px 6px 9px !important;
}

.net-advance-result {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(75, 44, 160, 0.2);
}

.net-advance-result .calc-input-group {
  max-width: 300px;
}

.net-advance-result .form-label {
  font-size: 1rem;
  font-weight: 600;
}

/* Responsive behavior for modals */
@media (max-width: 1200px) {
  .net-advance-columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

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

@media (max-width: 768px) {
  .net-advance-columns {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .net-advance-modal .modal-body {
    padding: 1rem;
  }

  .fees-columns {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .fees-modal .modal-body {
    padding: 1rem;
  }

  .commission-columns {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .commission-modal .modal-body {
    padding: 1rem;
  }
}

/* Seasonal Payment Modal Styling */
.seasonal-payment-modal .modal-header {
  background-color: #E8F7F6;
  border-bottom: 1px solid #B4B0D1;
  padding: 1rem 1.5rem;
}

.seasonal-payment-modal .modal-header .modal-title {
  color: #2E2856;
  font-weight: 600;
}

.seasonal-payment-modal .modal-header .btn-close {
  background-color: transparent;
}

.seasonal-payment-modal .modal-header .btn-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.seasonal-payment-modal .modal-body {
  padding: 0;
}

.seasonal-payment-modal .modal-footer {
  background-color: #C3EBE7;
  border-top: 1px solid #B4B0D1;
  padding: 1rem 1.5rem;
}

.seasonal-payment-modal .modal-footer .btn-secondary {
  background-color: transparent;
  border-color: #6B649E;
  color: #6B649E;
}

.seasonal-payment-modal .modal-footer .btn-secondary:hover {
  background-color: #6B649E;
  border-color: #6B649E;
  color: white;
}

.seasonal-payment-modal .modal-footer .btn-primary {
  background-color: #2E2856;
  border-color: #2E2856;
  color: white;
}

.seasonal-payment-modal .modal-footer .btn-primary:hover {
  background-color: #221f42;
  border-color: #221f42;
}

.seasonal-payment-modal .modal-footer .btn-outline-primary {
  background-color: transparent;
  border-color: #2E2856;
  color: #2E2856;
}

.seasonal-payment-modal .modal-footer .btn-outline-primary:hover {
  background-color: #2E2856;
  border-color: #2E2856;
  color: white;
}

/* Seasonal payment table input styling */
.seasonal-payment-modal .calc-input-frame {
  margin-bottom: 0;
}

.seasonal-payment-modal .calc-input-frame .input-group {
  min-height: auto;
}

.seasonal-payment-modal .calc-input-frame .form-control {
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
  min-height: auto;
}

.seasonal-payment-modal .calc-input-frame .input-group-text {
  font-size: 0.875rem;
  padding: 0.375rem 0.5rem;
  min-height: auto;
}

.seasonal-payment-modal .table thead th,
.seasonal-payment-modal .table tbody th,
.seasonal-payment-modal .table tbody td {
  background: var(--calc-bg-calculated);
}

/* 1) Same-element selector (no space) */
.seasonal-payment-modal.modal-controls {
  background: var(--calc-bg-calculated);
  border-bottom: 1px solid #B4B0D1;
}

/* 2) Three-in-a-row layout */
.seasonal-payment-modal .controls-bar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

/* Reset Bootstrap form-switch offsets */
.seasonal-payment-modal .controls-bar .form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-left: 0;
  margin-bottom: 0;
}
.seasonal-payment-modal .controls-bar .form-check-input {
  float: none;        /* undo Bootstrap */
  margin-left: 0;     /* undo Bootstrap’s negative offset */
}

/* Make input smaller (doesn't hog all space) */
.seasonal-payment-modal .controls-bar .calc-input-group {
  flex: 0 1 320px;    /* basis controls width; tweak as needed */
  max-width: 360px;
}
.seasonal-payment-modal .controls-bar .calc-input-frame,
.seasonal-payment-modal .controls-bar .input-group {
  width: 100%;
}

/* Keep button on the far right and a bit larger */
.seasonal-payment-modal .controls-bar .btn {
  margin-left: auto;  /* push to the far right */
  min-width: 220px;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .seasonal-payment-modal .controls-bar { flex-direction: column; }
  .seasonal-payment-modal .controls-bar .btn { margin-left: 0; width: 100%; }
}

/* Calculator Overlay Styles (Modal-styled without being a Bootstrap modal) */
.calculator-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1040; /* Same as Bootstrap modals */
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  padding: 2rem;
}

.calculator-overlay-content {
  position: relative;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  padding: 2rem;
}

.calculator-overlay-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: transparent;
  border: none;
  font-size: 2rem;
  line-height: 1;
  color: #4b2ca0;
  cursor: pointer;
  padding: 0.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s ease;
  z-index: 10;
}

.calculator-overlay-close:hover {
  background: rgba(75, 44, 160, 0.1);
}

@media (max-width: 768px) {
  .calculator-overlay {
    padding: 1rem;
  }

  .calculator-overlay-content {
    padding: 1.5rem;
    max-width: 100%;
  }
}


/* Table Sort Styles */
th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.5rem;
}

th.sortable:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 0.5rem;
  opacity: 0.3;
  font-size: 1.2em;
}

th.sortable:hover::after {
  opacity: 0.6;
}

th.sortable[aria-sort="ascending"]::after {
  content: '↑';
  opacity: 1;
}

th.sortable[aria-sort="descending"]::after {
  content: '↓';
  opacity: 1;
}

th.no-sort {
  cursor: default;
}
