/* Compact calculators intended for inline placement inside articles. */
.fcu-simple-tool {
  width: 100%;
  max-width: 760px !important;
  margin: 18px auto 24px !important;
  padding: 16px !important;
  border: 1px solid var(--fcu-primary, #1769ff) !important;
  border-radius: 14px !important;
  background: var(--fcu-soft, #f7faff) !important;
  color: var(--fcu-text, #172033);
  box-shadow: none !important;
  font-family: inherit;
}

.fcu-simple-tool[hidden],
.fcu-simple-tool [hidden] {
  display: none !important;
}

.fcu-simple-head {
  margin-bottom: 12px !important;
  padding-bottom: 8px !important;
}

.fcu-simple-head h2 {
  margin-bottom: 3px !important;
  font-size: clamp(19px, 4vw, 23px) !important;
}

.fcu-simple-head p {
  font-size: 12px !important;
  line-height: 1.4 !important;
}

.fcu-simple-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
  margin: 0;
}

.fcu-simple-field {
  min-width: 0;
}

.fcu-simple-label-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  min-height: 22px;
  margin-bottom: 4px;
}

.fcu-simple-label-row label,
.fcu-simple-select label {
  min-width: 0;
  margin: 0;
  color: #344054;
  font-size: 12px !important;
  font-weight: 700;
  line-height: 1.35 !important;
}

.fcu-required {
  color: var(--fcu-danger, #b42318);
}

.fcu-simple-value {
  flex: 0 0 auto;
  max-width: 48%;
  padding: 2px 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--fcu-primary-soft, #eaf2ff);
  color: var(--fcu-primary-dark, #0f55d4);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fcu-simple-input {
  display: flex;
  align-items: stretch;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--fcu-border-strong, #b8c8dc);
  border-radius: 9px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.fcu-simple-input:focus-within {
  border-color: var(--fcu-primary, #1769ff);
  box-shadow: 0 0 0 3px rgba(23, 105, 255, .11);
}

.fcu-simple-field.is-invalid .fcu-simple-input {
  border-color: var(--fcu-danger, #b42318);
  box-shadow: 0 0 0 2px rgba(180, 35, 24, .08);
}

.fcu-simple-input input {
  width: 100%;
  min-width: 0;
  min-height: 40px !important;
  margin: 0;
  padding: 8px 9px !important;
  border: 0 !important;
  border-radius: 0 !important;
  outline: 0;
  background: transparent;
  color: var(--fcu-text, #172033);
  font-size: 16px !important;
  line-height: 1.2;
  box-shadow: none !important;
}

.fcu-simple-unit {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 9px;
  border-left: 1px solid #e1e8f2;
  background: #f8fafc;
  color: var(--fcu-muted, #667085);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.fcu-simple-tool .fcu-field-error {
  min-height: 0;
  margin: 3px 0 0 !important;
  font-size: 10px !important;
  line-height: 1.25 !important;
}

.fcu-simple-select {
  display: grid;
  gap: 4px;
  margin-top: 9px;
}

.fcu-simple-select select {
  width: 100%;
  min-height: 40px !important;
  margin: 0;
  padding: 7px 9px !important;
  border: 1px solid var(--fcu-border-strong, #b8c8dc);
  border-radius: 9px;
  background: #fff;
  color: var(--fcu-text, #172033);
  font-size: 13px !important;
}

.fcu-simple-result {
  min-height: 76px;
  margin-top: 11px !important;
  padding: 10px !important;
  border: 1px solid #d6e3f2;
  border-radius: 10px !important;
  background: #eef5ff;
  text-align: center;
}

.fcu-simple-result > p {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  margin: 0;
  color: #44546a;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.fcu-simple-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 7px !important;
}

.fcu-simple-metric {
  display: flex;
  min-width: 0;
  min-height: 74px;
  padding: 9px 7px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid #d9e4f1;
  border-radius: 9px;
  background: #fff;
  text-align: center;
}

.fcu-simple-metric span {
  display: block;
  color: var(--fcu-muted, #667085);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.3;
}

.fcu-simple-metric strong {
  display: block;
  max-width: 100%;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--fcu-primary-dark, #0f55d4);
  font-size: clamp(15px, 3vw, 19px);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.fcu-simple-help {
  min-height: auto !important;
  margin-top: 8px !important;
  color: #526174 !important;
  font-size: 11px !important;
}

.fcu-simple-action {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 8px;
  align-items: start;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #a7f3d0;
  border-left: 4px solid #059669;
  border-radius: 8px;
  background: #ecfdf5;
  color: #14532d;
  font-size: 11px;
  line-height: 1.4;
  text-align: left;
}

.fcu-simple-action strong {
  color: #047857;
  white-space: nowrap;
}

.fcu-simple-action--warning {
  border-color: #fde68a;
  border-left-color: #d97706;
  background: #fffbeb;
  color: #78350f;
}

.fcu-simple-action--warning strong { color: #b45309; }

.fcu-simple-action--danger {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: #fff1f2;
  color: #7f1d1d;
}

.fcu-simple-action--danger strong { color: #b91c1c; }

.fcu-simple-error {
  min-height: auto !important;
  padding: 8px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--fcu-danger, #b42318) !important;
  font-weight: 750;
}

.fcu-simple-note {
  margin: 8px 0 0 !important;
  padding: 0 !important;
  color: var(--fcu-muted, #667085);
  font-size: 10px !important;
  line-height: 1.4 !important;
  text-align: center;
}

.fcu-debt-groups {
  display: grid;
  gap: 8px;
}

.fcu-debt-card {
  position: relative;
  min-width: 0;
  margin: 0;
  padding: 9px;
  border: 1px solid #cfe0f5;
  border-radius: 10px;
  background: #fff;
}

.fcu-debt-card legend {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--fcu-primary-soft, #eaf2ff);
  color: var(--fcu-primary-dark, #0f55d4);
  font-size: 11px;
  font-weight: 800;
}

.fcu-debt-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.fcu-debt-settings {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  align-items: end;
  margin-top: 9px;
}

.fcu-debt-settings .fcu-simple-select { margin-top: 0; }

.fcu-debt-plan {
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid #cfe0f5;
  border-radius: 9px;
  background: #fff;
  text-align: left;
}

.fcu-debt-plan h3 {
  margin: 0 !important;
  padding: 8px 10px;
  background: #eaf2ff;
  color: #0f55d4;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

.fcu-debt-plan-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) minmax(96px, auto);
  gap: 7px;
  align-items: center;
  padding: 7px 9px;
  border-top: 1px solid #e5edf6;
  color: #344054;
  font-size: 11px;
}

.fcu-debt-plan-row > b {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #0f55d4;
  color: #fff;
  font-size: 10px;
}

.fcu-debt-plan-row > span:last-child { text-align: right; }
.fcu-debt-plan-row strong { color: #047857; }
.fcu-debt-plan-row small { display: block; color: #667085; font-size: 9px; line-height: 1.35; }

.fcu-add-debt,
.fcu-remove-debt {
  border: 1px solid #9dbcf4;
  border-radius: 8px;
  background: #fff;
  color: var(--fcu-primary-dark, #0f55d4);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.fcu-add-debt {
  width: auto !important;
  min-height: 34px !important;
  margin: 8px 0 0 !important;
  padding: 6px 10px !important;
}

.fcu-remove-debt {
  position: absolute;
  top: 5px;
  right: 7px;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 3px 7px !important;
  color: #b42318;
}

@media (max-width: 639px) {
  .fcu-simple-tool {
    margin: 12px 0 18px !important;
    padding: 10px !important;
  }

  .fcu-simple-head {
    margin-bottom: 8px !important;
    padding-bottom: 6px !important;
  }

  .fcu-simple-head h2 {
    font-size: 18px !important;
  }

  .fcu-simple-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px !important;
  }

  .fcu-simple-label-row {
    min-height: 27px;
  }

  .fcu-simple-label-row label {
    font-size: 11px !important;
  }

  .fcu-simple-input input,
  .fcu-simple-select select {
    min-height: 38px !important;
  }

  .fcu-simple-unit {
    padding: 0 7px;
    font-size: 10px;
  }

  .fcu-simple-result {
    margin-top: 8px !important;
    padding: 7px !important;
  }

  .fcu-simple-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px !important;
  }

  .fcu-simple-metric {
    min-height: 64px;
    padding: 7px 5px;
  }

  .fcu-debt-grid .fcu-simple-field--balance {
    grid-column: 1 / -1;
  }

  .fcu-debt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .fcu-debt-settings {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .fcu-simple-action {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .fcu-simple-action strong { white-space: normal; }
}

@media (max-width: 359px) {
  .fcu-simple-grid:not(.fcu-debt-grid) {
    grid-template-columns: 1fr;
  }

  .fcu-simple-metrics {
    grid-template-columns: 1fr;
  }
}
