/* Homa Profit Calculator, namespaced for compatibility with any WordPress theme. */
.homa-calc,
.homa-calc * { box-sizing: border-box; }
.homa-calc {
  --homa-calc-brand: #16845b;
  --homa-calc-ink: #18342b;
  --homa-calc-muted: #67796f;
  --homa-calc-line: #e4ebe6;
  --homa-calc-pale: #f2f8f4;
  color: var(--homa-calc-ink);
  direction: rtl;
  font-family: inherit;
  width: 100%;
  max-width: 1280px;
  margin: 28px auto;
  background: #fff;
  border: 1px solid #e2eae4;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 50px rgba(17, 72, 46, .07);
  font-size: 15px;
  line-height: 1.8;
  isolation: isolate;
}
.homa-calc h2, .homa-calc h3, .homa-calc p { margin: 0; padding: 0; line-height: 1.7; text-align: right; }
.homa-calc button, .homa-calc input, .homa-calc select { font-family: inherit; box-sizing: border-box; }
.homa-calc button { cursor: pointer; }
.homa-calc button:disabled { cursor: not-allowed; opacity: .5; }
.homa-calc :focus-visible { outline: 3px solid rgba(32, 167, 103, .42); outline-offset: 2px; }
.homa-calc__hero { padding: 31px 36px 28px; color: #fff; background: radial-gradient(ellipse at 3% 0%, rgba(166, 235, 182, .26), transparent 40%), linear-gradient(110deg, #103f2f, #18583e 64%, #1d6b4a); }
.homa-calc__eyebrow { display: flex; align-items: center; gap: 8px; color: #d9f4dc; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
.homa-calc__dot { width: 8px; height: 8px; border-radius: 50%; background: #b0ecb9; box-shadow: 0 0 0 5px rgba(176, 236, 185, .16); }
.homa-calc__hero h2 { font-size: clamp(21px, 2.4vw, 30px); color: #fff; font-weight: 800; letter-spacing: -.5px; }
.homa-calc__hero p { max-width: 780px; color: #dceee2; margin-top: 7px; font-size: 14px; }
.homa-calc__hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 19px; }
.homa-calc__hero-pills span { padding: 4px 11px; border: 1px solid rgba(255, 255, 255, .17); border-radius: 30px; color: #edf8ed; font-size: 11px; background: rgba(255, 255, 255, .08); }
.homa-calc__content { padding: 26px 28px 28px; }
.homa-calc__product-row { display: flex; gap: 20px; justify-content: space-between; align-items: flex-end; margin-bottom: 20px; }
.homa-calc__field { display: flex; flex-direction: column; gap: 6px; margin: 0; min-width: 0; }
.homa-calc__field > span { font-size: 12px; font-weight: 700; color: #435e50; }
.homa-calc__field--name { width: min(100%, 410px); }
.homa-calc input, .homa-calc select { border: 1px solid #d8e2dc; border-radius: 10px; min-height: 44px; padding: 10px 12px; background: #fff; color: var(--homa-calc-ink); outline: none; box-shadow: none; font-size: 13px; max-width: 100%; width: 100%; margin: 0; line-height: 1.4; }
.homa-calc input:focus, .homa-calc select:focus { border-color: var(--homa-calc-brand); box-shadow: 0 0 0 3px rgba(20, 136, 80, .1); }
.homa-calc input::placeholder { color: #99a9a0; opacity: 1; }
.homa-calc input[inputmode="decimal"] { direction: ltr; text-align: right; font-variant-numeric: tabular-nums; }
.homa-calc__currency-tag { display: inline-block; font-size: 12px; color: #59705f; background: #f1f6f1; padding: 9px 14px; border-radius: 30px; border: 1px solid #e0ebe3; white-space: nowrap; margin-bottom: 3px; }
.homa-calc__currency-tag strong { color: #174e36; }
.homa-calc__layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(305px, .95fr); gap: 18px; align-items: start; }
.homa-calc__editor { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.homa-calc__panel { border: 1px solid var(--homa-calc-line); border-radius: 18px; background: #fff; padding: 22px 18px; min-width: 0; }
.homa-calc__section-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 18px; }
.homa-calc__section-head h3 { font-size: 16px; font-weight: 800; color: #1c4031; }
.homa-calc__section-head p { font-size: 12px; color: #738378; margin-top: 3px; }
.homa-calc__step { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; border-radius: 10px; background: var(--homa-calc-pale); color: var(--homa-calc-brand); font-size: 13px; font-weight: 800; }
.homa-calc__table-header, .homa-calc__ingredient { display: grid; grid-template-columns: minmax(108px, 1.4fr) minmax(82px, 1fr) minmax(76px, .78fr) minmax(76px, .86fr) minmax(74px, .75fr) minmax(86px, .85fr) 26px; align-items: center; column-gap: 7px; }
.homa-calc__table-header { padding: 0 3px 9px; font-size: 10px; font-weight: 700; color: #829289; white-space: nowrap; }
.homa-calc__ingredient { border-top: 1px solid #edf0ed; padding: 10px 2px; }
.homa-calc__ingredient--invalid { background: #fff5f2; }
.homa-calc__ingredient .homa-calc__cell { min-width: 0; display: block; }
.homa-calc__ingredient .homa-calc__cell > span { display: none; }
.homa-calc__ingredient input, .homa-calc__ingredient select { min-height: 38px; padding: 6px 7px; border-radius: 8px; font-size: 11px; }
.homa-calc__cell--cost output { font-size: 12px; white-space: nowrap; color: var(--homa-calc-brand); font-weight: 800; font-variant-numeric: tabular-nums; }
.homa-calc__remove { display: inline-grid; place-items: center; width: 26px; height: 30px; font-size: 22px; line-height: 1; border: 0; border-radius: 8px; color: #a94d4d; background: transparent; padding: 0; }
.homa-calc__remove:hover { background: #ffeded; }
.homa-calc__row-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.homa-calc__reset { border: 0; padding: 8px; background: transparent; color: #788b7f; font-size: 11px; font-weight: 700; margin-top: 10px; }
.homa-calc__reset:hover { color: #315d44; text-decoration: underline; }
.homa-calc__add { border: 1px dashed var(--homa-calc-brand); background: #f5fbf6; color: #136344; font-size: 12px; font-weight: 800; border-radius: 10px; padding: 9px 14px; margin-top: 10px; }
.homa-calc__add span { font-size: 18px; vertical-align: -1px; margin-left: 3px; }
.homa-calc__add:hover { background: #e6f6eb; }
.homa-calc__error { color: #9c2930; background: #fff1f1; border: 1px solid #f5d4d4; padding: 9px 12px; border-radius: 9px; margin-top: 12px; font-size: 12px; }
.homa-calc__error[hidden] { display: none; }
.homa-calc__field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 13px; }
.homa-calc__input-suffix { display: flex; align-items: center; position: relative; }
.homa-calc__input-suffix input { padding-left: 62px; }
.homa-calc__input-suffix em { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); font-size: 11px; font-style: normal; color: #839489; pointer-events: none; white-space: nowrap; }
.homa-calc__helper { font-size: 11px; color: #738579; margin-top: 16px !important; line-height: 2 !important; }
.homa-calc__summary { border-radius: 18px; overflow: hidden; border: 1px solid #d9e9df; background: #fff; box-shadow: 0 8px 25px rgba(24, 90, 58, .065); position: sticky; top: 24px; }
.homa-calc__summary-head { background: #eff8f1; padding: 19px 20px 16px; border-bottom: 1px solid #dcece1; }
.homa-calc__live { display: inline-flex; align-items: center; gap: 6px; color: #18714e; font-size: 10px; font-weight: 800; margin-bottom: 6px; }
.homa-calc__live-dot { background: #16aa65; width: 7px; height: 7px; border-radius: 50%; }
.homa-calc__summary-head h3 { color: #164d32; font-size: 19px; font-weight: 800; }
.homa-calc__summary-head p { color: #728677; font-size: 11px; }
.homa-calc__summary-inner { padding: 13px 18px 17px; }
.homa-calc__metric { display: flex; align-items: center; justify-content: space-between; gap: 9px; border-bottom: 1px solid #edf1ed; padding: 11px 0; }
.homa-calc__metric > span { color: #617368; font-size: 11px; line-height: 1.5; }
.homa-calc__metric > strong { font-size: 14px; font-weight: 800; white-space: nowrap; color: #213c2b; }
.homa-calc__metric--total > strong { color: #145d3f; }
.homa-calc__metric strong b, .homa-calc__result-highlight strong b { font-weight: inherit; font-variant-numeric: tabular-nums; }
.homa-calc__metric small, .homa-calc__result-highlight small { font-size: 10px; font-weight: 500; }
.homa-calc__result-highlight { margin: 16px 0 4px; padding: 14px 13px; border-radius: 12px; background: linear-gradient(135deg, #146940, #0e5235); color: #fff; display: flex; flex-direction: column; gap: 3px; }
.homa-calc__result-highlight > span { font-size: 11px; color: #d2f3de; }
.homa-calc__result-highlight strong { font-size: 24px; font-weight: 900; line-height: 1.45; }
.homa-calc__result-highlight strong small { color: #dcf6e1; font-size: 12px; }
.homa-calc__margin-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 17px; font-size: 11px; color: #617368; }
.homa-calc__margin-line strong { font-weight: 900; font-size: 18px; color: #138550; }
.homa-calc--loss .homa-calc__margin-line strong { color: #c33c3c; }
.homa-calc__meter { width: 100%; height: 8px; overflow: hidden; border-radius: 20px; background: #e8eee8; margin-top: 5px; }
.homa-calc__meter > span { display: block; background: linear-gradient(90deg, #159854, #80d69e); height: 100%; border-radius: 20px; width: 0; transition: width .25s ease; }
.homa-calc--loss .homa-calc__meter > span { background: #cf4545; }
.homa-calc__status { font-size: 11px; color: #708074; min-height: 33px; margin-top: 8px !important; }
.homa-calc--loss .homa-calc__status { color: #b63737; }
.homa-calc__scenario { background: #f8faf7; border: 1px solid #ecf0eb; border-radius: 11px; padding: 10px 12px; margin-top: 6px; }
.homa-calc__scenario-header { color: #26593a; font-weight: 800; font-size: 11px; margin-bottom: 6px; }
.homa-calc__scenario > div:not(:first-child) { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: #6b796f; padding: 3px 0; }
.homa-calc__scenario strong { color: #314b3d; white-space: nowrap; font-size: 11px; }
.homa-calc__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.homa-calc__btn { min-height: 40px; border-radius: 10px; font-size: 11px; font-weight: 800; padding: 8px 9px; border: 1px solid transparent; }
.homa-calc__btn--primary { background: var(--homa-calc-brand); color: white; }
.homa-calc__btn--primary:hover { filter: brightness(.9); }
.homa-calc__btn--secondary { background: #fff; color: #195c3d; border-color: #bdd9c9; }
.homa-calc__btn--secondary:hover { background: #f1f8f2; }
.homa-calc__copy-feedback { color: var(--homa-calc-brand); font-size: 11px; min-height: 18px; margin-top: 7px !important; }
.homa-calc__disclaimer { font-size: 10px; line-height: 1.85 !important; color: #8a978e; border-top: 1px dashed #e4ebe5; padding-top: 10px !important; }
.homa-calc__cta { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 15px; align-items: center; background: #f2f8f4; border-top: 1px solid #e0ece3; padding: 24px 30px; }
.homa-calc__cta-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: #e0f0e5; color: var(--homa-calc-brand); font-size: 25px; }
.homa-calc__cta h3 { font-size: 16px; font-weight: 850; color: #174a31; }
.homa-calc__cta p { color: #667c6d; font-size: 12px; margin-top: 3px; }
.homa-calc__cta-link, .homa-calc__cta-link:visited { background: var(--homa-calc-brand); color: white !important; text-decoration: none !important; border-radius: 12px; padding: 10px 19px; font-weight: 800; font-size: 12px; white-space: nowrap; }
.homa-calc__cta-link:hover { color: #fff; filter: brightness(.9); }
.homa-calc__cta-link span { margin-right: 8px; }
@media (max-width: 1180px) {
  .homa-calc__layout { grid-template-columns: minmax(0, 1fr); }
  .homa-calc__summary { position: static; }
  .homa-calc__table-header, .homa-calc__ingredient { grid-template-columns: minmax(110px, 1.4fr) minmax(90px, 1fr) minmax(82px, .8fr) minmax(82px, .9fr) minmax(80px, .8fr) minmax(94px, 1fr) 27px; }
}
@media (max-width: 760px) {
  .homa-calc { margin: 18px auto; border-radius: 16px; }
  .homa-calc__hero { padding: 22px 20px; }
  .homa-calc__hero h2 { font-size: 22px; }
  .homa-calc__hero p { font-size: 12px; }
  .homa-calc__content { padding: 17px 14px 20px; }
  .homa-calc__product-row { align-items: stretch; flex-direction: column; gap: 10px; }
  .homa-calc__field--name { width: 100%; }
  .homa-calc__currency-tag { align-self: flex-start; }
  .homa-calc__panel { padding: 16px 12px; border-radius: 13px; }
  .homa-calc__table-header { display: none; }
  .homa-calc__ingredient { position: relative; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px 9px; border: 1px solid #e2eae4; border-radius: 12px; padding: 13px; margin-bottom: 10px; }
  .homa-calc__ingredient .homa-calc__cell > span { display: block; font-size: 11px; color: #687d71; margin-bottom: 5px; }
  .homa-calc__ingredient .homa-calc__cell--name { grid-column: span 2; padding-left: 25px; }
  .homa-calc__ingredient .homa-calc__cell--cost { display: flex; justify-content: space-between; align-items: flex-end; }
  .homa-calc__remove { position: absolute; top: 12px; left: 12px; }
  .homa-calc__field-grid { gap: 11px; }
  .homa-calc__cta { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 19px 17px; }
  .homa-calc__cta-icon { height: 36px; width: 36px; }
  .homa-calc__cta h3 { font-size: 14px; }
  .homa-calc__cta-link { grid-column: 1 / -1; text-align: center; }
}
@media (max-width: 430px) {
  .homa-calc__field-grid { grid-template-columns: 1fr; }
  .homa-calc__ingredient { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .homa-calc__section-head h3 { font-size: 14px; }
  .homa-calc__section-head p { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  .homa-calc__meter > span { transition: none; }
}
@media print {
  @page { margin: 13mm; }
  body * { visibility: hidden !important; }
  .homa-calc--printing, .homa-calc--printing * { visibility: visible !important; }
  .homa-calc--printing { width: 100% !important; max-width: none !important; box-shadow: none !important; border: 0 !important; position: absolute !important; top: 0 !important; right: 0 !important; margin: 0 !important; background: white !important; }
  .homa-calc--printing .homa-calc__layout { grid-template-columns: 1fr !important; }
  .homa-calc--printing .homa-calc__editor { gap: 10px; }
  .homa-calc--printing .homa-calc__hero { padding: 16px 20px; }
  .homa-calc--printing .homa-calc__summary { position: static !important; break-inside: avoid; }
  .homa-calc--printing .homa-calc__hero-pills, .homa-calc--printing .homa-calc__add,
  .homa-calc--printing .homa-calc__remove, .homa-calc--printing .homa-calc__reset, .homa-calc--printing .homa-calc__actions,
  .homa-calc--printing .homa-calc__copy-feedback, .homa-calc--printing .homa-calc__cta { display: none !important; }
  .homa-calc--printing input, .homa-calc--printing select { border: 1px solid #ddd !important; }
  .homa-calc--printing .homa-calc__panel { break-inside: avoid; }
  .homa-calc--printing .homa-calc__ingredient { break-inside: avoid; }
  .homa-calc--printing .homa-calc__result-highlight { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .homa-calc--printing .homa-calc__field-grid { grid-template-columns: repeat(2, 1fr); }
}


/* v1.0.1: Keep the ingredients table inside its actual column width.
   On narrow parent containers (even on a large desktop viewport), display
   labeled ingredient cards instead of seven columns that overflow the editor. */
.homa-calc__layout,
.homa-calc__editor,
.homa-calc__panel,
.homa-calc__ingredients { min-width: 0; max-width: 100%; }
.homa-calc__content, .homa-calc__editor { container-type: inline-size; }
@media screen {
  @container (max-width: 1020px) {
    .homa-calc__layout { grid-template-columns: minmax(0, 1fr); }
    .homa-calc__summary { position: static; }
  }
}
.homa-calc__panel[aria-label="مواد اولیه"] { overflow-x: auto; }
@media screen {
  @container (max-width: 680px) {
    .homa-calc__editor .homa-calc__table-header { display: none; }
    .homa-calc__editor .homa-calc__ingredient {
      display: grid;
      position: relative;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 11px 9px;
      border: 1px solid #e2eae4;
      border-radius: 12px;
      padding: 13px;
      margin-bottom: 10px;
    }
    .homa-calc__editor .homa-calc__ingredient .homa-calc__cell > span {
      display: block;
      color: #687d71;
      font-size: 11px;
      margin-bottom: 5px;
    }
    .homa-calc__editor .homa-calc__ingredient .homa-calc__cell--name {
      grid-column: span 2;
      padding-left: 25px;
    }
    .homa-calc__editor .homa-calc__ingredient .homa-calc__cell--cost {
      display: flex;
      align-items: flex-end;
      justify-content: space-between;
      gap: 8px;
    }
    .homa-calc__editor .homa-calc__remove {
      position: absolute;
      left: 12px;
      top: 12px;
    }
  }
}
