.hf-calc {
  --hf-ink: #1f2933;
  --hf-muted: #5f6b7a;
  --hf-line: #d9dee7;
  --hf-panel: #ffffff;
  --hf-page: #f4f6f8;
  --hf-teal: #0f766e;
  --hf-teal-dark: #115e59;
  --hf-amber: #f5b335;
  --hf-amber-soft: #fff4d6;
  --hf-danger: #b42318;
  --hf-radius: 8px;
  color: var(--hf-ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 28px 0;
}

.hf-calc *,
.hf-calc *::before,
.hf-calc *::after {
  box-sizing: border-box;
}

.hf-calc__header {
  align-items: flex-end;
  background: linear-gradient(135deg, #ffffff 0%, #f4fbf9 58%, #fff7e5 100%);
  border: 1px solid var(--hf-line);
  border-radius: var(--hf-radius);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 22px;
}

.hf-calc__eyebrow {
  color: var(--hf-teal-dark);
  font-size: 0.78rem;
  font-weight: 750;
  letter-spacing: 0;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.hf-calc__title {
  color: var(--hf-ink);
  font-size: clamp(1.55rem, 2vw, 2.25rem);
  line-height: 1.1;
  margin: 0;
}

.hf-calc__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hf-calc__badges span {
  background: #ffffff;
  border: 1px solid var(--hf-line);
  border-radius: 999px;
  color: #344054;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 7px 10px;
}

.hf-calc__grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(300px, 0.95fr) minmax(360px, 1.25fr);
}

.hf-panel {
  background: var(--hf-panel);
  border: 1px solid var(--hf-line);
  border-radius: var(--hf-radius);
  box-shadow: 0 12px 30px rgba(31, 41, 51, 0.07);
  padding: 18px;
}

.hf-panel__head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.hf-panel h3,
.hf-subpanel h3 {
  color: var(--hf-ink);
  font-size: 1rem;
  line-height: 1.25;
  margin: 0;
}

.hf-field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hf-field-grid--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hf-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.hf-field > span:first-child {
  color: #344054;
  font-size: 0.84rem;
  font-weight: 700;
}

.hf-field input,
.hf-field select {
  appearance: none;
  background: #ffffff;
  border: 1px solid #c9d1dd;
  border-radius: 6px;
  color: var(--hf-ink);
  font: inherit;
  font-size: 0.95rem;
  height: 44px;
  min-width: 0;
  padding: 9px 10px;
  width: 100%;
}

.hf-field select {
  background-image: linear-gradient(45deg, transparent 50%, #687487 50%),
    linear-gradient(135deg, #687487 50%, transparent 50%);
  background-position:
    calc(100% - 16px) 18px,
    calc(100% - 11px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 32px;
}

.hf-field input:focus,
.hf-field select:focus,
.hf-btn:focus {
  border-color: var(--hf-teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
  outline: none;
}

.hf-input-unit {
  align-items: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.hf-input-unit input {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
}

.hf-input-unit > span:last-child {
  align-items: center;
  align-self: stretch;
  background: #eef2f6;
  border: 1px solid #c9d1dd;
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: #475467;
  display: flex;
  font-size: 0.82rem;
  font-weight: 750;
  justify-content: center;
  min-width: 72px;
  padding: 0 10px;
  white-space: nowrap;
}

.hf-subpanel {
  border-top: 1px solid var(--hf-line);
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
}

.hf-btn {
  align-items: center;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 750;
  min-height: 38px;
  padding: 8px 12px;
}

.hf-btn--ghost {
  background: #ffffff;
  border: 1px solid var(--hf-line);
  color: var(--hf-teal-dark);
}

.hf-result-hero {
  background: linear-gradient(135deg, #0f766e 0%, #16857b 100%);
  border-radius: var(--hf-radius);
  color: #ffffff;
  display: grid;
  gap: 4px;
  padding: 18px;
}

.hf-result-hero__label {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

.hf-result-hero strong {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
}

.hf-result-hero span:last-child {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.hf-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.hf-metric,
.hf-mini-result {
  background: #f8fafc;
  border: 1px solid var(--hf-line);
  border-radius: 7px;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
}

.hf-metric span,
.hf-mini-result span {
  color: var(--hf-muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.hf-metric strong,
.hf-mini-result strong {
  color: var(--hf-ink);
  font-size: 1.03rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.hf-results-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 12px;
}

.hf-table-wrap {
  border: 1px solid var(--hf-line);
  border-radius: var(--hf-radius);
  margin-top: 14px;
  overflow-x: auto;
}

.hf-table {
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 680px;
  width: 100%;
}

.hf-table th,
.hf-table td {
  border-bottom: 1px solid var(--hf-line);
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
}

.hf-table thead th {
  background: var(--hf-amber-soft);
  color: #5b3b00;
  font-size: 0.78rem;
  font-weight: 800;
}

.hf-table th:first-child,
.hf-table td:first-child {
  text-align: left;
}

.hf-table tbody th {
  color: #344054;
  font-weight: 750;
}

.hf-table tbody tr:last-child th,
.hf-table tbody tr:last-child td {
  border-bottom: 0;
}

.hf-note {
  background: #f4fbf9;
  border-left: 4px solid var(--hf-teal);
  color: #344054;
  font-size: 0.9rem;
  font-weight: 650;
  margin: 14px 0 0;
  padding: 10px 12px;
}

@media (max-width: 980px) {
  .hf-calc__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hf-calc__badges {
    justify-content: flex-start;
  }

  .hf-calc__grid,
  .hf-field-grid,
  .hf-field-grid--compact {
    grid-template-columns: 1fr;
  }

  .hf-metrics,
  .hf-results-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 540px) {
  .hf-calc {
    margin: 18px 0;
  }

  .hf-calc__header,
  .hf-panel {
    padding: 14px;
  }

  .hf-metrics,
  .hf-results-row {
    grid-template-columns: 1fr;
  }

  .hf-input-unit {
    grid-template-columns: minmax(0, 1fr);
  }

  .hf-input-unit input {
    border-radius: 6px 6px 0 0;
  }

  .hf-input-unit > span:last-child {
    border: 1px solid #c9d1dd;
    border-radius: 0 0 6px 6px;
    min-height: 32px;
  }
}

/* ============================================================
   Content block — Instructions · Information · FAQ
   ============================================================ */
.hf-content-block {
  color: var(--hf-ink, #1f2933);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.97rem;
  line-height: 1.7;
  margin: 36px auto 0;
  max-width: 860px;
}

.hf-content-block h3 {
  border-left: 4px solid #0f766e;
  color: #0f3330;
  font-size: 1.18rem;
  font-weight: 750;
  line-height: 1.3;
  margin: 36px 0 14px;
  padding-left: 12px;
}

.hf-content-block h3:first-child {
  margin-top: 0;
}

.hf-content-block p {
  margin: 0 0 14px;
}

.hf-content-block ol {
  margin: 0 0 14px;
  padding-left: 1.5rem;
}

.hf-content-block ol li {
  margin-bottom: 10px;
}

/* FAQ definition list */
.hf-content-block dl {
  margin: 0;
}

.hf-content-block dl dt {
  color: #0f3330;
  font-size: 1rem;
  font-weight: 750;
  margin-top: 20px;
}

.hf-content-block dl dt:first-child {
  margin-top: 0;
}

.hf-content-block dl dd {
  color: #344054;
  margin: 6px 0 0 1.25rem;
  padding: 0;
}

@media (max-width: 540px) {
  .hf-content-block {
    font-size: 0.93rem;
  }

  .hf-content-block h3 {
    font-size: 1.07rem;
  }
}

/* ==========================================================================
   Unit Converter Component
   ========================================================================== */

.hf-converter-grid {
  display: flex;
  flex-direction: column;
}

.hf-converter-grid__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--hf-border);
}

.hf-converter-grid__row:last-child {
  border-bottom: none;
}

.hf-converter-grid__row:nth-child(even) {
  background-color: #f8fafc;
}

.hf-converter-grid__label {
  flex: 1;
  font-weight: 600;
  color: var(--hf-text-dark);
  font-size: 0.95rem;
}

.hf-converter-grid__input {
  flex: 1;
  max-width: 150px;
  padding: 8px 10px;
  border: 1px solid var(--hf-border);
  border-radius: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.95rem;
  color: var(--hf-text-dark);
  background-color: #fff;
  text-align: right;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.hf-converter-grid__input:focus {
  outline: none;
  border-color: var(--hf-brand-teal);
  box-shadow: 0 0 0 3px rgba(45, 126, 122, 0.15);
}
