.cg-form { margin-top: 1.25rem; }
.cg-form fieldset { border: 1px solid #dce5f2; border-radius: 8px; padding: 16px; margin: 0 0 18px; min-width: 0; }
.cg-form legend { position: static; width: auto; height: auto; margin: 0; overflow: visible; clip: auto; white-space: normal; color: #173866; font-weight: bold; padding: 0 6px; }
.cg-form fieldset > div { display: block; margin-inline-end: 0; }
.cg-form fieldset > .tool-form__overview,.cg-form .tool-form__overview { display: grid; align-items: start; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.cg-form #cg-exemption-fields { display: grid; grid-template-columns: minmax(0,1fr); gap: 14px; margin-top: 16px; }
.cg-form #cg-exemption-fields > * { min-width: 0; margin: 0; }
.cg-form #cg-replacement-fields { display: grid; gap: 8px; }
.cg-form .form-field { min-width: 0; }
.cg-form input,.cg-form select { max-width: 100%; box-sizing: border-box; }
.cg-form input[inputmode=decimal] { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.cg-form input[type=date] { width: 100%; direction: ltr; min-height: 44px; }
.cg-form input[type=checkbox] { width: auto; margin-left: .5em; }
.cg-form .cg-check { display: grid; grid-template-columns: 20px minmax(0,1fr); align-items: start; gap: 10px; margin: 12px 0; line-height: 1.65; }
.cg-check span { min-width: 0; }
.cg-form .cg-check input { width: 18px; height: 18px; margin: .35em 0 0; }
.cg-index { margin: 8px 0; font-size: .92em; padding: 10px; background: #f2f6fc; border-radius: 6px; }
.cg-index select { display: block; margin-top: 8px; width: 100%; }
.cg-expense { padding: 12px 0; border-bottom: 1px solid #dce5f2; }
.cg-expense button { margin-top: 8px; }
.cg-error,.cg-warning { border-right: 4px solid #965b13; padding: 12px; background: #fff8ec; }
.cg-result { margin: 24px 0; background: #f4f8ff; border: 1px solid #bfd0e7; border-radius: 8px; padding: 18px; }
.cg-result h2 { margin-top: 0; }
.cg-result table { width: 100%; border-collapse: collapse; font-size: .94em; }
.cg-result th,.cg-result td { padding: 10px 5px; border-bottom: 1px solid #dce5f2; text-align: right; overflow-wrap: anywhere; }
.cg-result th { width: 62%; font-weight: normal; }
.cg-result caption { text-align: right; margin: 14px 0 6px; font-weight: bold; }
.cg-result td { font-variant-numeric: tabular-nums; }
.cg-form .form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cg-form button,.cg-form .calculator-button { min-height: 44px; cursor: pointer; }
.cg-note { background: #f2f6fc; border-radius: 6px; padding: 12px 14px; line-height: 1.7; }
.cg-form [hidden],.cg-result[hidden],.cg-error[hidden] { display: none !important; }
@media(max-width:600px) {
  .cg-form fieldset { padding: 14px; }
  .cg-form fieldset > .tool-form__overview,.cg-form .tool-form__overview { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .cg-form .form-field,.cg-form .cg-check { font-size: 16px; }
  .cg-form .form-help,.cg-form small { font-size: 14px; line-height: 1.6; }
  .cg-form .form-actions .calculator-button { flex: 1 1 100%; }
  .cg-result {padding: 12px;}
}

.cg-defaults { font-size: .9rem; line-height: 1.6; color: #42536a; margin: 0 0 12px; }
.cg-form > .advanced-settings { margin-top: 16px; }
.cg-form .advanced-settings__body > .form-field { margin-bottom: 14px; }
.cg-scenarios { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin: 16px 0; }
.cg-scenarios > div { background: #fff; border: 1px solid #bfd0e7; border-radius: 8px; padding: 12px; min-width: 0; }
.cg-scenarios span,.cg-scenarios strong { display: block; }
.cg-scenarios strong { font-size: 1.35rem; margin-top: 6px; color: #173866; }
.cg-result ul { padding-inline-start: 22px; line-height: 1.65; }
.cg-result details { margin-top: 18px; }
.cg-result button { min-height: 44px; }
@media(max-width:600px) { .cg-scenarios { grid-template-columns: minmax(0,1fr); } .cg-defaults {font-size:14px;} }

.cg-form input[data-cg-date] { width:100%; direction:ltr; text-align:right; min-height:44px; }
.cg-exemption-choice { margin: 12px 0; }
.cg-share { display:inline-block; margin-inline-start:12px; padding:10px; }
