/* ===== ماشین‌حساب ارزش معاملاتی ملک (طرح «Melk») =====
   روی home.css سوار است (رنگ‌ها، هدر، فوتر)؛ فقط بخش‌های خاص این صفحه اینجاست.
   ساختارش هم‌الگوی mohlat.css است (پیشوند mk-).
   منطق محاسبه در melk.js است (کپی web-app/src/lib/calculators/melk-value.ts). */

.blob1 { top: -260px; right: -160px; height: 640px; width: 640px; background: radial-gradient(closest-side, rgba(48,111,87,.14), rgba(48,111,87,0)); }
.blob2 { top: 40px; left: -220px; height: 560px; width: 560px; background: radial-gradient(closest-side, rgba(0,167,157,.09), rgba(0,167,157,0)); }

/* ---------- هیرو ---------- */
.mk-hero { position: relative; margin: 0 auto; max-width: 1100px; padding: 48px 24px 36px; text-align: center; }
.crumbs { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--faint); }
.crumbs a { padding: 8px 4px; color: var(--soft); }
.crumbs a:hover { color: var(--gd); }
.crumbs .cur { color: var(--sub); }
.mk-kick { margin-top: 18px; }
.mk-hero h1 { margin: 14px 0 0; font-size: clamp(30px, 4.6vw, 52px); font-weight: 900; line-height: 1.35; letter-spacing: -.02em; color: var(--ink); }
.mk-hero > p { margin: 16px auto 0; max-width: 42rem; font-size: clamp(15.5px, 1.5vw, 17px); line-height: 2.05; color: var(--muted); text-wrap: balance; }
.mk-stats { margin: 26px auto 0; max-width: 720px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mk-stat { border-radius: 20px; border: 1px solid var(--line); background: #ffffff; padding: 16px 20px; text-align: right; }
.mk-stat > div { font-size: 13px; line-height: 1.7; font-weight: 700; color: var(--soft); }
.mk-stat b { display: block; margin-top: 6px; font-size: 24px; line-height: 1.5; font-weight: 900; color: var(--ink); }
.mk-stat small { font-size: 14px; font-weight: 700; color: var(--soft); }
.mk-stat-g { border-color: #c3dacd; background: #f0f6f2; }
.mk-stat-g > div { color: #3f6b57; }

/* ---------- ماشین‌حساب ---------- */
.mk-calc-w { position: relative; margin: 0 auto; max-width: 1140px; padding: 0 24px 32px; }
.mk-calc { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.mk-cards { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mk-card { display: flex; flex-direction: column; gap: 18px; border-radius: 24px; border: 1px solid #c6d9cd; background: #ffffff; padding: 26px; box-shadow: 0 1px 2px rgba(16,40,32,.04); }
.mk-card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mk-card-h h2 { margin: 0; font-size: 16.5px; font-weight: 900; color: var(--ink); }
.mk-card-h > span:not(.mk-n) { font-size: 12.5px; font-weight: 600; color: var(--faint); }
.mk-card:first-child .mk-card-h { align-items: baseline; gap: 8px; }
.mk-n { display: grid; height: 28px; width: 28px; flex-shrink: 0; place-items: center; border-radius: 9px; background: var(--g); font-size: 13.5px; font-weight: 900; color: #ffffff; }
.mk-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
/* برچسب دوخطی یکی از دو فیلد کنار هم، کادرها را ناهم‌تراز نکند (برچسب/کادر/راهنما سه ردیف مشترک) */
.mk-2 > .mk-f { display: grid; grid-template-rows: subgrid; grid-row: span 3; row-gap: 0; align-content: start; }
.mk-2 > .mk-f > label { align-self: end; }
.mk-f > label, .mk-lbl { display: block; margin-bottom: 8px; font-size: 13.5px; font-weight: 700; color: var(--sub); }
.mk-f input, .mk-f select { width: 100%; height: 50px; border-radius: 13px; border: 1px solid #d7e3db; background: #ffffff; padding: 0 14px; font-family: inherit; font-size: 15px; font-weight: 600; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
.mk-f input[dir="ltr"] { text-align: right; }
.mk-f input::placeholder { color: var(--faint2); font-weight: 600; }
.mk-f input:focus, .mk-f select:focus { border-color: #a9cbb7; box-shadow: 0 0 0 3px rgba(48,111,87,.12); }
.mk-hint { margin: 7px 0 0; font-size: 12.5px; line-height: 1.85; color: var(--soft); }
.mk-info { margin: 0; border-radius: 13px; background: #f0f6f2; padding: 11px 14px; font-size: 13px; line-height: 1.9; color: var(--sub); }
.mk-err { margin: 0; font-size: 12.5px; font-weight: 700; color: #c43d32; }
.mk-none { margin: 0; font-size: 13.5px; line-height: 1.9; color: var(--soft); }
.mk-info[hidden], .mk-err[hidden], .mk-none[hidden], .mk-f[hidden], .mk-front[hidden], .mk-body[hidden], .mk-floors[hidden], .mk-sw[hidden], .mk-add[hidden] { display: none; }
.mk-front, .mk-body { display: flex; flex-direction: column; gap: 12px; }
.mk-body { gap: 18px; }
.mk-floors { display: flex; flex-direction: column; gap: 8px; }
.mk-add { align-self: flex-start; border: none; background: transparent; cursor: pointer; padding: 2px 0; font-size: 13px; font-weight: 800; color: var(--g); }
.mk-add:hover { color: var(--gd); }
/* کادر دفترچه‌ی رسمی */
.mk-booklet { display: flex; align-items: center; gap: 12px; width: 100%; text-align: right; cursor: pointer; border-radius: 16px; border: 1.5px dashed #9cc7b3; background: #f3f9f5; padding: 12px 14px; transition: background .2s; }
.mk-booklet:hover { background: #e6f1ea; }
.mk-booklet-ic { display: grid; height: 38px; width: 38px; flex-shrink: 0; place-items: center; border-radius: 999px; background: #dcebe2; color: var(--gd); }
.mk-booklet > span:last-child { min-width: 0; }
.mk-booklet b { display: block; font-size: 13.5px; font-weight: 800; color: var(--gd); }
.mk-booklet b + span { display: block; font-size: 12px; line-height: 1.8; color: var(--muted); }
/* کلید «ساختمان دارد» */
.mk-sw { margin-right: auto; position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 0; font-size: 13px; font-weight: 700; color: var(--sub); }
.mk-sw input { position: absolute; opacity: 0; pointer-events: none; }
.mk-sw-t { position: relative; display: inline-block; height: 22px; width: 38px; border-radius: 999px; background: #c9d5cd; transition: background .2s; }
.mk-sw-t i { position: absolute; top: 3px; right: 19px; height: 16px; width: 16px; border-radius: 999px; background: #ffffff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: right .2s; }
.mk-sw input:checked + .mk-sw-t { background: var(--g); }
.mk-sw input:checked + .mk-sw-t i { right: 3px; }
.mk-sw:has(input:focus-visible) .mk-sw-t { outline: 2px solid var(--g); outline-offset: 2px; }
/* نوع واحد */
.seg { display: flex; gap: 3px; border-radius: 13px; background: #eef3ef; padding: 4px; }
.seg button { flex: 1; border: none; border-radius: 10px; cursor: pointer; padding: 10px 8px; font-size: 14px; font-weight: 700; background: transparent; color: var(--soft); transition: all .2s; }
.seg button.active { background: #ffffff; color: var(--gd); box-shadow: 0 1px 2px rgba(16,40,32,.08), 0 6px 14px -8px rgba(16,40,32,.2); }

/* نتیجه (ستون کناری چسبان) */
.mk-out { position: sticky; top: 96px; overflow: hidden; display: flex; flex-direction: column; border-radius: 26px; background: linear-gradient(160deg, #337a5e 0%, #27583f 55%, #1b4230 100%); padding: 28px 26px; box-shadow: 0 40px 80px -56px rgba(16,48,36,.55); }
.mk-out-mark { pointer-events: none; position: absolute; bottom: -50px; left: -20px; height: 220px; opacity: .07; }
.mk-out-t { position: relative; font-size: 13.5px; font-weight: 700; color: rgba(255,255,255,.8); }
.mk-result { position: relative; margin-top: 10px; font-size: clamp(24px, 2.6vw, 32px); font-weight: 900; line-height: 1.35; color: #ffffff; overflow-wrap: anywhere; }
.mk-result small { font-size: 14px; font-weight: 700; color: rgba(255,255,255,.75); }
.mk-rows { position: relative; margin: 16px 0 0; }
.mk-rows > div > div, .mk-rows > div:not(#mk-rows-ayani) { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mk-rows [hidden] { display: none !important; }
.mk-rows dt { min-width: 0; }
.mk-rows dd { margin: 0; text-align: left; white-space: nowrap; }
.mk-main { padding: 11px 0 6px; border-top: 1px solid rgba(255,255,255,.14); }
.mk-main dt { font-size: 14px; color: rgba(255,255,255,.8); }
.mk-main dd { font-size: 14px; font-weight: 800; color: #ffffff; }
.mk-sub { padding: 6px 0; }
.mk-sub dt { font-size: 12.5px; color: rgba(255,255,255,.6); }
.mk-sub dd { font-size: 12.5px; font-weight: 700; color: rgba(255,255,255,.8); }
.mk-sum { margin-top: 4px; padding: 12px 0 0; border-top: 1.5px solid rgba(255,255,255,.3); font-size: 14.5px; }
.mk-sum dt { font-weight: 800; color: #ffffff; }
.mk-sum dd { font-weight: 900; color: #b8f0d2; }
.mk-print { position: relative; margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 8px; border: none; border-radius: 13px; background: #ffffff; padding: 12px; font-size: 14.5px; font-weight: 800; color: var(--gd); cursor: pointer; transition: background .2s; }
.mk-print:hover { background: #f1f7f3; }
.mk-out-note { position: relative; margin: 14px 0 0; font-size: 12px; line-height: 1.9; color: rgba(255,255,255,.7); }

.mk-strip { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px 20px; border-radius: 22px; border: 1px solid #c3dacd; background: linear-gradient(120deg, #eef6f1, #e3f1ec); padding: 18px 22px; }
.mk-strip > div { display: flex; align-items: center; gap: 14px; font-size: 15px; font-weight: 700; line-height: 1.85; color: var(--ink); }
.mk-strip-ic { display: grid; height: 44px; width: 44px; flex-shrink: 0; place-items: center; border-radius: 13px; background: var(--grad); }
.mk-strip-ic img { height: 22px; display: block; }
.mk-strip > a { display: inline-flex; flex-shrink: 0; align-items: center; justify-content: center; border-radius: 12px; background: var(--grad); padding: 12px 20px; font-size: 14.5px; font-weight: 700; color: #ffffff; }
.mk-strip > a:hover { color: #ffffff; filter: brightness(1.06); }

/* ---------- عنوان بخش‌ها ---------- */
.mk-head { text-align: center; }
.mk-head h2 { margin: 14px 0 0; font-size: clamp(24px, 3.2vw, 36px); font-weight: 900; line-height: 1.5; color: var(--ink); text-wrap: balance; }
.mk-head p { margin: 12px 0 0; font-size: 15.5px; line-height: 1.95; color: var(--muted); }

/* ---------- جدول ضرایب ---------- */
.mk-sec { position: relative; margin: 0 auto; max-width: 980px; padding: 80px 24px 88px; }
.mk-tabs-w { margin-top: 22px; display: flex; justify-content: center; }
.mk-tabs { display: flex; gap: 3px; max-width: 100%; overflow-x: auto; border-radius: 14px; background: #e6efe9; padding: 4px; scrollbar-width: none; }
.mk-tabs::-webkit-scrollbar { display: none; }
.mk-tabs button { flex-shrink: 0; white-space: nowrap; border: none; border-radius: 10px; cursor: pointer; padding: 9px 18px; font-size: 14px; font-weight: 700; background: transparent; color: var(--soft); transition: all .2s; }
.mk-tabs button[aria-selected="true"] { background: #ffffff; color: var(--gd); box-shadow: 0 1px 2px rgba(16,40,32,.08), 0 6px 14px -8px rgba(16,40,32,.2); }
.mk-tbl-w { margin-top: 18px; overflow: hidden; border-radius: 22px; border: 1px solid #dfe9e3; background: #ffffff; }
.mk-tp[hidden] { display: none; }
.mk-tbl { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mk-tbl th { background: #f0f6f2; padding: 14px 16px; font-size: 13px; font-weight: 800; color: #3f6b57; text-align: right; }
.mk-tbl td { padding: 12px 16px; border-top: 1px solid var(--line2); font-size: 14px; font-weight: 700; line-height: 1.8; color: var(--ink); vertical-align: middle; }
.mk-tbl td:nth-child(2) { color: var(--gd); }
.mk-tbl td:nth-child(3) { font-weight: 600; color: var(--muted); }
.mk-tbl tbody tr:nth-child(even) td { background: #fafcfb; }
.mk-tbl-3 th:nth-child(1) { width: 50%; }
.mk-tbl-3 th:nth-child(2) { width: 14%; }
.mk-tbl-2 th:nth-child(1) { width: 34%; }

/* ---------- راهنما ---------- */
.mk-guide { background: var(--mint); border-top: 1px solid var(--line2); }
.mk-guide-in { margin: 0 auto; max-width: 1040px; padding: 80px 24px 88px; }
.mk-intro { margin: 18px auto 0; max-width: 46rem; text-align: center; font-size: 16.5px; line-height: 2.1; color: var(--sub); text-wrap: pretty; }
.mk-formula { margin: 30px auto 0; max-width: 860px; border-radius: 26px; border: 1px solid #dfe9e3; background: linear-gradient(160deg, #ffffff, #f3f9f5); padding: 30px 32px; box-shadow: 0 1px 2px rgba(16,40,32,.04), 0 30px 60px -48px rgba(16,48,36,.4); }
.mk-f-t { text-align: center; font-size: 12.5px; font-weight: 800; letter-spacing: .02em; color: var(--g); }
.mk-f-row { margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; }
.mk-f-row + .mk-f-row { margin-top: 12px; }
.tk { display: inline-flex; align-items: center; border-radius: 10px; border: 1px solid #cfe0d6; background: #ffffff; padding: 10px 14px; font-size: 14.5px; font-weight: 800; line-height: 1.5; white-space: nowrap; color: var(--ink); }
.tk-g { border-color: var(--g); background: var(--g); color: #ffffff; }
.op { font-size: 22px; font-weight: 900; color: #6b8a79; }
.mk-f-note { margin: 20px 0 0; border-radius: 16px; background: var(--mint2); padding: 14px 16px; font-size: 13.5px; line-height: 2; color: #27402f; }
.mk-gcards { margin-top: 28px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.mk-gcard { display: flex; flex-direction: column; scroll-snap-align: start; border-radius: 24px; border: 1px solid #d3e2d9; background: #ffffff; padding: 24px; box-shadow: 0 1px 2px rgba(16,40,32,.04); }
.mk-gcard-ic { display: grid; height: 46px; width: 46px; place-items: center; border-radius: 14px; background: var(--mint2); color: var(--g); }
.mk-gcard h3 { margin: 16px 0 0; font-size: 17.5px; font-weight: 800; line-height: 1.7; color: var(--ink); }
.mk-gcard p { margin: 8px 0 0; font-size: 14.5px; line-height: 2.05; color: var(--muted); }

/* ---------- پرسش‌ها (مثل صفحه‌ی تماس) ---------- */
.mk-faq { background: #ffffff; border-top: 1px solid var(--line2); }
.mk-faq-in { margin: 0 auto; max-width: 820px; padding: 80px 24px 88px; }
.faqs { margin-top: 32px; display: flex; flex-direction: column; gap: 10px; }
.faqs details { overflow: hidden; border-radius: 18px; border: 1px solid #e3ece6; background: #ffffff; transition: all .2s; }
.faqs details[open] { border-color: #cfe0d6; box-shadow: 0 18px 40px -30px rgba(16,48,36,.4); }
.faqs summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; padding: 18px 20px; list-style: none; font-size: 15.5px; font-weight: 800; color: var(--ink); }
.faqs summary::-webkit-details-marker { display: none; }
.faqs summary:focus-visible { outline: 2px solid var(--g); outline-offset: -2px; border-radius: 18px; }
.fq-ic { display: grid; flex-shrink: 0; height: 30px; width: 30px; place-items: center; border-radius: 10px; background: var(--mint2); color: var(--g); transition: transform .25s; }
.faqs details[open] .fq-ic { background: var(--g); color: #ffffff; transform: rotate(45deg); }
.faqs details p { margin: 0; padding: 0 20px 20px; font-size: 15px; line-height: 2.05; color: var(--muted); animation: rise .3s var(--ease) both; }

/* ---------- مودال دفترچه‌ها ---------- */
.mk-modal { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(15,30,24,.5); }
.mk-modal[hidden] { display: none; }
.mk-modal-box { width: 100%; max-width: 460px; max-height: 84vh; display: flex; flex-direction: column; overflow: hidden; border-radius: 24px; background: #ffffff; box-shadow: 0 40px 90px -30px rgba(10,30,22,.55); animation: rise .25s cubic-bezier(.22,.61,.36,1) both; }
.mk-modal-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid #e8eee9; }
.mk-modal-h b { font-size: 15.5px; font-weight: 900; color: var(--ink); }
.mk-modal-h button { display: grid; height: 34px; width: 34px; place-items: center; border: none; border-radius: 10px; background: #f2f6f3; cursor: pointer; color: var(--muted); }
.mk-modal-h button:hover { background: #e6efe9; }
.mk-modal-b { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; padding: 16px 20px 20px; }
.mk-modal-b > p { margin: 0; font-size: 13px; line-height: 1.9; color: var(--soft); }
#mk-pdf-list { display: flex; flex-direction: column; gap: 10px; }
.mk-modal-empty { margin: 0; padding: 18px 0; text-align: center; font-size: 13.5px; color: var(--faint); }
.mk-pdf-card { border-radius: 14px; border: 1px solid #e3ece6; background: #fafcfb; padding: 12px 14px; }
.mk-pdf-card b { display: block; font-size: 14px; font-weight: 800; color: var(--ink); }
.mk-pdf-card small { display: block; margin-top: 2px; font-size: 12px; color: var(--faint); }
.mk-pdf-links { margin-top: 10px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.mk-pdf-links a { display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #e6f1ea; padding: 8px; font-size: 12.5px; font-weight: 800; color: var(--gd); }
.mk-pdf-links a:hover { background: #d6e9dd; color: var(--gd); }
.mk-pdf-links span { display: flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px dashed #d7e3db; padding: 8px; font-size: 12px; color: var(--faint); }

/* ---------- موبایل و تبلت (طرح از ۹۲۰ به پایین تک‌ستونی است) ---------- */
@media (max-width: 920px) {
  .mk-hero { padding: 32px 20px 28px; }
  .mk-stat { padding: 12px 14px; }
  .mk-stat > div { font-size: 11.5px; }
  .mk-stat b { font-size: 17px; }
  .mk-stat small { font-size: 11.5px; }
  .mk-calc-w { padding: 0 14px 32px; }
  .mk-calc { grid-template-columns: minmax(0, 1fr); }
  .mk-card { padding: 20px 16px; }
  .mk-2 { grid-template-columns: minmax(0, 1fr); }
  .mk-out { position: relative; top: auto; padding: 22px 20px; }
  .mk-strip { flex-direction: column; align-items: stretch; padding: 18px; }
  .mk-strip > div { align-items: flex-start; font-size: 14px; }
  .mk-sec, .mk-guide-in, .mk-faq-in { padding: 56px 20px 64px; }
  .mk-tabs button { padding: 8px 12px; font-size: 13px; }
  .seg button { padding: 8px 6px; font-size: 13px; line-height: 1.45; }
  .mk-tbl th, .mk-tbl td { padding: 12px 10px; font-size: 13px; }
  .mk-tbl th { font-size: 12.5px; }
  .mk-tbl-3 th:nth-child(1) { width: 44%; }
  .mk-tbl-3 th:nth-child(2) { width: 58px; }
  .mk-tbl-2 th:nth-child(1) { width: 42%; }
  .mk-formula { padding: 20px 12px; }
  .mk-f-row { gap: 4px; flex-wrap: nowrap; }
  .tk { padding: 6px 7px; font-size: min(12px, 3.1vw); }
  .op { font-size: min(15px, 3.8vw); }
  /* کارت‌های راهنما: ردیف افقی با اسکرول */
  .mk-gcards { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 84%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: -20px; padding: 0 20px 8px; scroll-padding: 0 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .faqs details p, .mk-modal-box { animation: none; }
}
