.container {
  max-width: 440px;
  margin: 10px auto;
  padding: 12px;
}

/* HEADER */
.header {
  /* TAG: selectable-color-themes-14050711-01 */
  /* Tokenized brand color so optional palettes recolor the header; default render is unchanged. */
  background: var(--primary);
  color: var(--primary-contrast, #fff);
  border-radius: 18px;
  padding: 10px 18px;
  /* TAG: visual-noise-2b-14050711-01 */
  /* Uniform spacing scale and neutral shadow token. */
  margin-bottom: var(--space-sm, 12px);
  box-shadow: var(--shadow-header, 0 4px 14px rgba(15, 23, 42, .12));
}

/* TOP BAR */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.title-wrap {
  flex: 1;
  min-width: 0;
}

.title-wrap h1 {
  font-size: clamp(14px, 4.5vw, 21px) !important;
}

/* اصلاح باگ: محدود کردن دامنه اثرگذاری تگ p به داخل هدر */
.title-wrap h1, 
.title-wrap p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.title-wrap p {
  margin: -6px 0px;
  opacity: 0.65;
}

/* SETTINGS BUTTON */
.settings-btn, 
.reset-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 32px;
  background: rgba(255, 255, 255, .16);
  backdrop-filter: blur(10px);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 0;
}

/* =========================================================
   HERO PAYMENT SECTION (اصلاح شده و کاملاً ریسپانسیو)
========================================================= */
.hero-payment {
  background: rgba(255, 255, 255, .14);
  border-radius: 14px;
  padding: 8px 16px;
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  overflow: hidden; /* جلوگیری از بیرون زدن هرگونه محتوای متنی */
}

.hero-label {
  font-size: 0.85em;
  white-space: nowrap !important; /* اصلاح اول: اجبار متن به ماندن در یک خط تحت هر شرایطی */
  flex-shrink: 0 !important;      /* مانع از مچاله شدن یا فشرده شدن متن لیبل می‌شود */
}

.hero-value {
  font-size: 25px;
  line-height: 1.2;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important; /* فعال‌سازی سه نقطه (...) در صورت طولانی بودن مفرط عدد */
  direction: ltr;
  flex: 1 !important;             /* اصلاح دوم: حذف مقدار ثابت درصد و تصاحب هوشمند فضای باقی‌مانده */
  min-width: 0 !important;        /* اجازه به مرورگر برای فشرده‌سازی تا مرز لیبل و اعمال سه نقطه */
  text-align: left !important;    /* چسبیدن مرتب عدد و واحد ریال به سمت چپ باکس */
  margin-inline: 10px;
}

/* CARD */
.card {
  background: #fff;
  border-radius: 22px;
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .05);
}

/* FORM */
.form-label {
  font-size: 13px;
  font-weight: 700;
  width: 35%; /* هماهنگ‌شده با معماری جدید برای تراز شدن عمودی */
  white-space: nowrap;
}

/* INPUT */
.input-wrap {
  display: flex;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  transition: .2s;
}

.input-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .08);
}

.input-wrap input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 11px 14px;
  font-size: 15px;
}

.unit {
  min-width: 60px;
  padding: 11px 10px;
  background: #eef2ff;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-align: center;
  border-right: 1px solid #dbeafe;
}

/* ACTIONS */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

button {
  border: none;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: scale(.98);
}

.primary-btn {
  /* TAG: selectable-color-themes-14050711-01 */
  /* Primary CTA follows the active palette; contrast token keeps dark palettes readable. */
  /* TAG: button-height-unification-14050711-01 */
  /* Shares the medium control height with the rest of the app's action buttons. */
  background: var(--primary);
  color: var(--primary-contrast, #fff);
  min-height: var(--control-height-md, 42px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-btn {
  /* TAG: button-height-unification-14050711-01 */
  background: #eef2ff;
  color: var(--primary);
  min-height: var(--control-height-md, 42px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* PDF delivery destination modal */
.pdf-delivery-modal {
  position: fixed;
  inset: 0;
  z-index: 11200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
  background: rgba(15, 23, 42, .48);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}

.pdf-delivery-modal.active {
  opacity: 1;
  visibility: visible;
}

.pdf-delivery-panel {
  width: 100%;
  max-width: 430px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 55px rgba(15, 23, 42, .20);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.pdf-delivery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.pdf-delivery-title {
  font-size: 19px;
  font-weight: 900;
}

.pdf-delivery-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.pdf-delivery-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

/* TAG: calculator-report-delivery-14050609-01 */
/* Group calculator report outputs without coupling this dialog to the admin report implementation. */
.report-delivery-sections {
  display: grid;
  gap: 12px;
}

.report-delivery-section {
  min-width: 0;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.report-delivery-section legend {
  padding-inline: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

/* The third PDF action spans the row, avoiding cramped labels while keeping the modal compact. */
.report-delivery-section:first-child .pdf-delivery-option:last-child {
  grid-column: 1 / -1;
}

.pdf-delivery-option {
  min-width: 0;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: .95rem;
  font-weight: 400;
}

.pdf-delivery-option > i {
  color: var(--primary);
  font-size: 25px;
}

.pdf-delivery-option-title {
  font-weight: 400;
}

.pdf-delivery-option-note {
  max-width: 100%;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pdf-delivery-option:disabled {
  opacity: .6;
  cursor: wait;
}

.pdf-delivery-message {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.app-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.app-dialog-actions > button {
  width: auto;
  min-width: 110px;
  margin: 0;
  padding-inline: 20px;
}

.pdf-delivery-message.success {
  color: #15803d;
}

.pdf-delivery-message.error {
  color: #940000;
}

body[data-theme="dark"] .pdf-delivery-message.success {
  color: #86efac;
}

body[data-theme="dark"] .pdf-delivery-message.error {
  color: #fca5a5;
}

/* RESULTS */
.result-title {
  font-size: 17px;
  font-weight: 800;
  margin-bottom:6px;
  margin-right: 6px;
}

.form-row{
  border: 1px solid var(--border) !important;
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
}

.result-box, .form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: var(--card) !important;
  background-image: none !important;
  box-shadow: none !important;
}

.result-box:first-of-type {
  background: linear-gradient(
    135deg,
    #ecfeff,
    #dbeafe
  );
}

.result-label {
  /* TAG: result-hierarchy-2a-14050711-01 */
  /* Labels recede behind the numbers: muted token + lighter weight. */
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  width: 35%; /* اصلاح چیدمان پایه برای هماهنگی با لیبل فرم */
  white-space: nowrap;
}

.result-value {
  font-size: var(--result-value-size, 1.0625rem);
  font-weight: 850;
}

.result-value.empty{
  color: var(--result-empty-color);
}

/* TAG: resalat-calculation-14050330-01 */
/* Visually marks fixed Resalat fields without changing the existing input layout */
.locked-input:disabled {
  opacity: .72;
  cursor: not-allowed;
}

/* Keep the two Resalat duration controls compact inside the shared form row. */
.resalat-deposit-duration,
.resalat-duration-field {
  display: flex;
  align-items: center;
}

.resalat-deposit-duration {
  justify-content: flex-end;
  gap: 10px;
}

.resalat-duration-field {
  min-width: 0;
  gap: 3px;
}

.resalat-duration-input {
  width: 32px !important;
  flex: 0 0 32px !important;
  text-align: center !important;
}

/* Only the compact deposit row needs narrower units than the shared result style. */
.resalat-deposit-duration .result-unit {
  min-width: 12px !important;
}

/* Keep the Resalat calculation mode visually consistent with the loan-type selector. */
.resalat-deposit-mode-select {
  position: relative;
  min-width: 0;
  /* Keep the full trigger, including its arrow, above the adjacent value field. */
  z-index: 2;
}

.resalat-deposit-mode-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: max-content;
  /* Keep the real hit area around both the dynamic title and its arrow. */
  max-width: none;
  overflow: visible;
  min-height: 28px;
  padding: 0;
  gap: 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: inherit;
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
}

.resalat-deposit-mode-trigger:hover,
.resalat-deposit-mode-trigger:focus,
.resalat-deposit-mode-trigger:active {
  transform: none;
}

.resalat-deposit-mode-trigger .custom-arrow {
  position: static;
  flex: 0 0 auto;
  border-color: var(--primary);
  transform: translateY(-20%) rotate(45deg);
}

.resalat-deposit-mode-select.open .custom-arrow {
  transform: translateY(20%) rotate(-135deg);
}

.resalat-deposit-mode-options {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 999;
}

.resalat-deposit-mode-select.open .resalat-deposit-mode-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.resalat-deposit-mode-option {
  display: block;
  width: 100%;
  /* TAG: button-height-unification-14050711-01 */
  min-height: var(--control-height-md, 42px);
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
  cursor: pointer;
}

.resalat-deposit-mode-option:hover,
.resalat-deposit-mode-option:focus,
.resalat-deposit-mode-option.active {
  background: rgba(37, 100, 235, .1);
  color: var(--primary);
  transform: none;
}

.resalat-deposit-amount-field {
  justify-content: flex-end;
}

.resalat-deposit-amount-field input {
  width: 100% !important;
  text-align: left !important;
}

.resalat-deposit-duration-result {
  justify-content: flex-end;
  gap: 10px;
}

.resalat-deposit-duration-result .result-unit {
  min-width: 12px !important;
}

/* The leftmost month unit must match regular result rows so its number shares their column. */
.resalat-deposit-duration-result .resalat-duration-field:last-child .result-unit {
  min-width: 35px !important;
}

/* Mirror the compact inputs while aligning digits with the other result values. */
.resalat-deposit-duration-result .result-value {
  width: 29px !important;
  flex: 0 0 29px;
  text-align: left !important;
}

@media (max-width: 420px) {
  .resalat-deposit-mode-options {
    min-width: 175px;
  }
}

/* INSTALL */
.install-wrap {
  text-align: center;
  margin-top: 14px;
}

.install-link {
  background: none;
  border: none;
  font-size: 12px;
  color: #64748b;
  padding: 0;
  cursor: pointer;
}

.install-link:hover {
  color: var(--primary);
  transform: none;
}

/* FOOTER */
.footer {
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  padding: 6px;
}

/* MOBILE */
@media(max-width: 300px) {
  .form-row {
    grid-template-columns: 92px 1fr;
    gap: 8px;
  }

  .hero-value {
    font-size: 22px;
  }

  .actions {
    grid-template-columns: 1fr;
  }

  .pdf-delivery-options {
    grid-template-columns: 1fr;
  }

  .title-wrap h1 {
    font-size: 22px;
  }
}

/* =========================================================
   CUSTOM SELECT
========================================================= */
.custom-select {
  position: relative;
  flex: 1; /* تصاحب هوشمند فضای باقی‌مانده در موبایل */
  min-width: 0;
  max-width: 285px; /* حداکثر عرض مجاز در دسکتاپ */
  display: flex;
  align-items: center;
}

/* TRIGGER */
.custom-select-trigger {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  padding-left: 34px;
  min-height: 28px;
  /* حذف کدهای اورفلو از این بخش برای باز شدن مجدد منو */
}

/* TEXT */
#selectedLoanType {
  width: 100%;
  text-align: left;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important; /* متن طولانی در حالت بسته به زیبایی سه نقطه می‌خورد */
}

/* ARROW */
.custom-arrow {
  position: absolute;
  left: 8px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--primary);
  border-bottom: 2px solid var(--primary);
  transform: translateY(-70%) rotate(45deg);
  transition: transform .2s ease;
  pointer-events: none;
  opacity: .9;
}

/* OPEN */
.custom-select.open .custom-arrow {
  transform: translateY(-30%) rotate(-135deg);
}

/* OPTIONS */
.custom-options {
  position: absolute;
  top: calc(100% + 12px);
  /* TAG: loan-type-dropdown-row-boundary-14050407-01 */
  /* Grow from the trigger's left edge but stop at the form row's calculated inner-right boundary */
  right: auto;
  left: 0;
  width: max-content;
  min-width: 100%;
  max-width: var(--loan-options-max-width, 100%);
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  /* TAG: loan-type-dropdown-light-elevation-revert-14050407-01 */
  /* Restore the original restrained light-theme elevation after visual review */
  box-shadow:
    0 8px 20px rgba(15, 23, 42, .12),
    0 2px 6px rgba(15, 23, 42, .08);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
  z-index: 999;
}

/* OPEN STATE */
.custom-select.open .custom-options {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* OPTION */
.custom-option {
  height: 46px;
  display: block; /* تغییر به حالت بلاک جهت فعال‌سازی استاندارد text-overflow */
  line-height: 46px; /* تراز عمودی کاملاً دقیق متن */
  padding: 0 10px 0 34px;
  text-align: left;
  direction: ltr;
  /* TAG: loan-type-dropdown-usability-14050330-01 */
  /* Keep closed selected text unchanged; only opened menu items are slightly smaller */
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  
  /* TAG: loan-type-dropdown-width-fix-14050407-01 */
  /* Restore ellipsis when an option reaches the menu's explicit maximum width */
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* TAG: loan-type-dropdown-usability-14050330-01 */
/* Make long Resalat option qualifiers smaller while preserving the main option title */
.custom-option .loan-option-note,
#selectedLoanType .loan-option-note {
  font-size: .86em;
}

/* HOVER */
.custom-option:hover {
  background: rgba(37, 100, 235, 0.1);
}

/* ACTIVE */
.custom-option.active {
  background: rgba(37, 99, 235, .08);
  color: var(--primary);
}

/* DARK */
body[data-theme="dark"] .custom-options {
  background: #1e293b;
  border-color: #334155;
  /* TAG: loan-type-dropdown-elevation-14050407-01 */
  /* Dark surfaces need slightly stronger depth while retaining the same restrained elevation */
  box-shadow:
    0 10px 24px rgba(0, 0, 0, .38),
    0 2px 7px rgba(0, 0, 0, .24);
}

body[data-theme="dark"] .custom-option:hover {
  background: rgba(59, 130, 246, .12);
}

body[data-theme="dark"] .custom-option.active {
  background: rgba(59, 130, 246, .16);
}

/* =========================================================
   HIDDEN FORM
========================================================= */
.hidden-form {
  display: none;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
}



/* =========================================================
   Tooltips
========================================================= */

/* =========================================================
   معماری جدید تولتیپ هوشمند - کاملاً محتومحور و بدون محدودیت عرض
========================================================= */

/* لایه نگهدارنده نقش انتقال‌دهنده فلکس‌باکس را ایفا می‌کند */
.calculated-field-wrapper {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
}

/* تضمین سازگاری فیلدهای ورودی درون رپر جدید */
.calculated-field-wrapper input {
  width: 100% !important;
  flex: 1;
}

/* لغو هرگونه محدودیت برش در والدین تا جعبه تولتیپ بتواند به راحتی خارج شود */
.value-wrap, .hero-payment, .result-box, .header, .header-top, .hero-block {
  overflow: visible !important;
}

/* اعمال رفتار سه‌نقطه (...) روی هدر اصلی و فیلدهای خلاصه نتایج */
.result-value, .hero-value {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  flex: 1;
  min-width: 0;
}

/* استایل نهایی تولتیپ شیشه‌ای و مدرن با اندازه فونت همسان */
.custom-tooltip {
  position: absolute;
  bottom: 135%; /* قرارگیری دقیق در بالای کادر */
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  
  /* ابعاد کاملاً پویا با حفظ مارجین معقول ۱۶ پیکسلی از لبه‌های صفحه */
  width: max-content;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  
  /* همسان‌سازی دقیق فونت با فیلدهای اصلی */
  font-size: 15px !important;
  font-weight: bold;
  white-space: nowrap;
  
  /* طراحی بصری جذاب تیره با افکت بلور */
  background: rgba(15, 23, 42, 0.96);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 999;
  
  /* حالت اولیه مخفی (استفاده از opacity بجای display جهت فعال بودن محاسبات ابعادی در JS) */
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, left 0.1s ease;
}

/* مثلث راهنما در زیر تولتیپ */
.custom-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(15, 23, 42, 0.96) transparent transparent transparent;
}

/* انیمیشن نرم ظهور هنگام فعال شدن کلاس اکتیو */
.calculated-field-wrapper.tooltip-active .custom-tooltip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* کلاس متغیر برای تولتیپ هدر اصلی (مبلغ قسط) */
.custom-tooltip.tooltip-hero {
  font-size: 17px !important; /* کمی بزرگتر و خواناتر برای رقم اصلی هدر */
  background: rgba(15, 23, 42, 0.98); /* تیره تر و با ابهت تر */
  padding: 8px 16px; /* پدینگ متناسب با سایز فونت جدید */
  border-color: rgba(255, 255, 255, 0.2); /* درخشش بیشتر لبه‌ها */
}

/* Copyable app-information values share one visual and interaction pattern. */
.copy-info-btn {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: inherit;
  cursor: pointer !important;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  direction: ltr;
  color: inherit; /* ۱. همرنگ شدن با بقیه اطلاعات برنامه در حالت عادی */
  transition: color 0.2s ease, opacity 0.2s ease;
}

/* رفتار المان در حالت هوور (موس اور) */
.copy-info-btn:hover {
  color: var(--primary, #2563eb); /* ۲. تغییر رنگ به آبی/رنگ اصلی تم فعال */
  text-decoration: none !important; /* ۳. حذف کامل خط زیرین در حالت هوور */
  opacity: 0.9;
}

.copy-info-btn .copy-icon {
  font-size: 13px;
  opacity: 0.6;
}

/*
  TAG: public-company-contact-14050524-01
  WHY: Public support and privacy links must remain readable in the existing app-info layout.
  SCOPE: App information links and the standalone privacy page only.
*/
.app-info-link,
.privacy-inline-link {
  color: var(--primary);
  text-decoration: none;
}

.privacy-inline-link:hover {
  text-decoration: underline;
}

.privacy-shell {
  width: min(760px, calc(100% - 28px));
  margin: 28px auto;
}

.privacy-header,
.privacy-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.privacy-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
}

.privacy-header h1 {
  font-size: 22px;
}

.privacy-card {
  padding: 22px;
}

.privacy-meta {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

.privacy-section + .privacy-section {
  margin-top: 22px;
}

.privacy-section h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.privacy-section p,
.privacy-section li {
  color: #334155;
}

body[data-theme="dark"] .privacy-section p,
body[data-theme="dark"] .privacy-section li {
  color: #cbd5e1;
}

.privacy-section p + p,
.privacy-section ul + p {
  margin-top: 8px;
}

.privacy-section ul {
  padding-right: 22px;
}

.privacy-contact {
  overflow-wrap: anywhere;
}

@media (max-width: 520px) {
  .privacy-shell {
    margin: 14px auto;
  }

  .privacy-header {
    align-items: flex-start;
    padding: 15px;
  }

  .privacy-header h1 {
    font-size: 19px;
  }

  .privacy-card {
    padding: 17px;
  }
}

/* لایه اعلان اختصاصی و شناور (Toast) - بدون تغییر */
.toast-notification {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(15, 23, 42, 0.98);
  color: #ffffff;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 14px;
  font-weight: bold;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 10005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}



/* آماده‌سازی المان برای پذیرش تولتیپ فرزند */
.has-tooltip {
  position: relative;
  overflow: visible !important; /* تضمین عدم بریده شدن تولتیپ توسط کادرهای والد */
}

/* کادر اصلی متنی تولتیپ */
.has-tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  background: rgba(15, 23, 42, 0.9);
  color: #ffffff;
  padding: 12px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
  opacity: 0;
  z-index: 10100;
  /* ۱. زمان انیمیشن محو شدن (اینجا delay روی 0s است تا آنی غیب شود) */
  transition: opacity 0.15s ease, transform 0.15s ease;
  transition-delay: 0s; 
}

/* فلش کوچک (مثلثی) */
.has-tooltip::after {
  content: '';
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  border-width: 0 5px 5px 5px;
  border-style: solid;
  border-color: transparent transparent rgba(15, 23, 42, 0.96) transparent;
  pointer-events: none;
  opacity: 0;
  z-index: 10100;
  /* زمان انیمیشن محو شدن آنی */
  transition: opacity 0.15s ease, transform 0.15s ease;
  transition-delay: 0s;
}

/* پدیدار شدن هوشمند با تاخیر ۱ ثانیه‌ای هنگام هوور و فوکوس */
.has-tooltip:hover::before,
.has-tooltip:hover::after{
opacity: 1; 
  transform: translateX(-50%) translateY(0); 
  transition-delay: 1.2s; 
}

/* حل مشکل اسکرول و لرزش برای دکمه‌های چسبیده به لبه چپ صفحه */

/* تراز کردن باکس متن تولتیپ از سمت چپ دکمه */
.has-tooltip.tooltip-left::before {
  left: 0;
  right: auto;
  transform: translateY(-4px); /* حذف translateX(-50%) برای جلوگیری از خروج از لبه صفحه */
}

/* حالت هوور برای باکس متن دکمه‌های سمت چپ */
.has-tooltip.tooltip-left:hover::before {
  transform: translateY(0); /* انیمیشن فقط در راستای عمودی اجرا می‌شود */
}

/* فلش کوچک (مثلثی) تولتیپ می‌تواند وسط دکمه باقی بماند چون عرض کمی دارد و بیرون نمی‌زند */
.has-tooltip.tooltip-left::after {
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
}
.has-tooltip.tooltip-left:hover::after {
  transform: translateX(-50%) translateY(0);
}

/* بالا آوردن دکمه‌های تولتیپ‌دار نسبت به لایه‌های فیلتردار زیرین */
.has-tooltip {
  position: relative; /* اگر از قبل تعریف نکرده‌اید */
  z-index: 10;        /* این مقدار باعث می‌شود تولتیپ همیشه روی لایه hero قرار بگیرد */
}




/* Path: /assets/css/components.css */

/* ۱. به هدر و باکس وام لایه‌های ثابت و مستقل می‌دهیم */
.header-top {
  position: relative !important;
  z-index: 10 !important; /* هدر به طور پیش‌فرض بالاتر قرار می‌گیرد */
}

.hero-payment {
  position: relative !important;
  z-index: 1 !important; /* باکس وام زیر هدر قرار می‌گیرد */
}

/* ۲. جادوی اصلی: وقتی موس روی تولتیپِ مبلغ وام می‌رود */
.hero-payment:hover,
.hero-payment:has(.has-tooltip:hover) {
  z-index: 100 !important; /* لایه باکس وام فوراً از هدر بالاتر می‌زند تا تولتیپش زیر هدر نرود */
}

/* ۳. وقتی موس روی هدر یا دکمه‌های آن می‌رود */
.header-top:hover,
.header-top:has(.has-tooltip:hover) {
  z-index: 200 !important; /* لایه هدر مجدداً بالاترین می‌شود تا تولتیپ دکمه‌ها زیر باکس وام نرود */
}

/* ۴. مهار قطعی تمام متن‌های تولتیپ در بالاترین سطح کل پروژه */
.has-tooltip::before,
.has-tooltip::after,
.tooltip-box {
  z-index: 99999 !important;
}

.result-box2{
  background: #dbeafe10;
  border: 1px solid var(--border);
  border-radius: 15px;
  align-items: center;
  justify-content: space-between;
  background-image: none !important;
}

.result-box2-int{
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* TAG: visual-noise-2b-14050711-01 */
  /* Tokenized row padding; 15px side padding unifies to the 12px scale step. */
  padding: var(--space-xs, 8px) var(--space-sm, 12px);
  position: relative;
}

/* Result rows are flex containers, so their per-loan visibility must win the cascade. */
.result-box2-int.hidden-form {
  display: none;
}

.result-box2-int:not(:last-child) {
    background-image: linear-gradient(
        to right, 
        transparent 0px, 
        #b0b0b07d 25%, 
        #b0b0b07d calc(100% - 25%), 
        transparent 100%
    );
    background-size: 100% 1px; /* عرض خط ۱۰۰٪ و ارتفاع ۱ پیکسل */
    background-position: bottom; /* خط در پایین قرار گیرد */
    background-repeat: no-repeat;
}

/* Avoid a trailing divider when the following Resalat-only result is hidden. */
.result-box2-int.is-last-visible {
  background-image: none;
}


/* =========================================================
   TAG: adaptive-height-fit-14050320-01
   Stage-based vertical fitting for mobile screens
========================================================= */

@media (max-width: 480px) {
  html,
  body {
    min-height: 100dvh;
    overflow-x: hidden;
  }

  /* Stage 1: reduce only vertical gaps between major blocks */
  body.fit-stage-1 .container {
    margin-top: 0;
    margin-bottom: 0;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  body.fit-stage-1 .header {
    margin-bottom: 8px;
  }

  body.fit-stage-1 .card {
    margin-bottom: 8px;
  }

  /* Stage 2: reduce form row density with safe minimums */
  body.fit-stage-2 .card {
    padding-top: 11px;
    padding-bottom: 11px;
  }

  body.fit-stage-2 .form-row {
    padding-top: 7px;
    padding-bottom: 7px;
    margin-bottom: 5px;
  }

  body.fit-stage-2 .actions {
    margin-top: 10px;
    gap: 8px;
  }

  body.fit-stage-2 button {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  /* Stage 3: reduce result rows and bottom spacing */
  body.fit-stage-3 .result-title {
    margin-bottom: 4px;
  }

  body.fit-stage-3 .result-box2-int {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  body.fit-stage-3 .install-wrap {
    margin-top: 7px;
  }
}

/* =========================================================
   TAG: info-modal-system-14050320-01
   App Changelog / Info Popup
========================================================= */

/* =========================
   INFO BUTTON
========================= */

/* TAG: install-state-fix-14050320-01 */
/* Preserve action row spacing even after install text is hidden */
.install-actions {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;

  min-height: 22px;
  margin-top: 14px;

  width: 100%;
}

/* =========================
   INFO MODAL
========================= */

.info-modal {
  position: fixed;
  inset: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;

  background: rgba(0,0,0,.45);
  backdrop-filter: blur(4px);

  opacity: 0;
  visibility: hidden;

  transition:
    opacity .25s ease,
    visibility .25s ease;

  z-index: 10050;
}

.info-modal.active {
  opacity: 1;
  visibility: visible;
}

/* =========================
   PANEL
========================= */

/* TAG: info-pagination-system-14050320-02 */
/* Fixed-height paged changelog modal */
.info-panel {
  width: 100%;
  max-width: 440px;

  max-height: 75dvh;
  overflow: hidden;

  border-radius: 18px;

  background: #f5f7fb;
  color: var(--text);

  box-shadow:
    0 20px 60px rgba(0,0,0,.18);

  transform: translateY(12px);

  transition:
    transform .25s ease;
}

.info-modal.active .info-panel {
  transform: translateY(0);
}

/* =========================
   HEADER
========================= */

/* TAG: info-modal-system-14050320-04 */
/* Header spacing tuned to reduce unused vertical height */
.info-header {
  position: relative;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 14px 18px 4px 18px;
}

/* TAG: info-modal-system-14050320-04 */
/* Faded divider matching result row separators */
.info-header::after {
  content: '';
  position: absolute;
  right: 18px;
  left: 18px;
  bottom: 0;

  height: 1px;

  background-image: linear-gradient(
    to right,
    transparent 0px,
    #b0b0b07d 25%,
    #b0b0b07d calc(100% - 25%),
    transparent 100%
  );
}

.info-title {
  display: flex;
  align-items: center;
  gap: 8px;

  font-size: 18px;
  font-weight: 800;
}

.info-close-btn {
  background: transparent;
  border: none;

  padding: 0;

  font-size: 24px;

  color: var(--muted);

  cursor: pointer;
}

/* TAG: info-modal-system-14050320-04 */
/* Match close button interaction with info button */
.info-close-btn:hover {
  opacity: .85;
  color: var(--primary);
}

.info-close-btn:active {
  transform: scale(.92);
}

/* =========================
   BODY
========================= */

/* TAG: info-accordion-system-14050510-01 */
/* Compact single-open changelog accordion */
.info-body {
  display: grid;
  gap: 10px;

  padding: 14px 18px 18px;
  min-height: 240px;
  max-height: 62dvh;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-color: transparent transparent;
  transition: scrollbar-color .2s ease;
}

.info-body:hover,
.info-body:focus-within,
.info-body:active {
  scrollbar-color: rgba(100, 116, 139, .55) transparent;
}

.info-body::-webkit-scrollbar {
  width: 8px;
}

.info-body::-webkit-scrollbar-thumb {
  background: transparent;
  border-radius: 999px;
}

.info-body:hover::-webkit-scrollbar-thumb,
.info-body:focus-within::-webkit-scrollbar-thumb,
.info-body:active::-webkit-scrollbar-thumb {
  background: rgba(100, 116, 139, .42);
}

.info-version {
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 14px;

  background: rgba(255, 255, 255, .58);

  overflow: hidden;
  transition:
    border-color .2s ease,
    background .2s ease,
    box-shadow .2s ease;
}

.info-version.active {
  border-color: rgba(37, 99, 235, .28);
  background: rgba(239, 246, 255, .72);
  box-shadow: 0 10px 28px rgba(37, 99, 235, .08);
}

.info-version-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;

  padding: 11px 12px;

  border: none;
  background: transparent;
  color: inherit;

  font: inherit;
  font-weight: 700;
  text-align: right;

  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.info-version-toggle:active,
.info-version-toggle:focus {
  background: transparent;
  outline: none;
}

.info-version-toggle span:first-child {
  flex: 1;
}

.info-version-toggle i {
  color: var(--primary);
  font-size: 18px;
  transition: transform .2s ease;
}

.info-version.active .info-version-toggle i {
  transform: rotate(180deg);
}

.info-version-content {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-6px);

  padding: 0 14px;

  transition:
    grid-template-rows .52s cubic-bezier(.16, 1, .3, 1),
    opacity .34s ease,
    padding .52s cubic-bezier(.16, 1, .3, 1),
    transform .52s cubic-bezier(.16, 1, .3, 1);
}

.info-version-content > * {
  overflow: hidden;
}

.info-version.active .info-version-content {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
  padding-bottom: 12px;
}

.info-version-date {
  opacity: .7;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.info-list {
  margin: 0;
  padding-right: 18px;
}

/* TAG: info-modal-system-14050320-05 */
/* More compact changelog rows with improved visual rhythm */
.info-list li {
  margin-bottom: 10px;
  line-height: 1.2;
}

/* =========================
   DARK MODE SUPPORT
========================= */

body[data-theme="dark"] .info-panel {
  background: #1e293b;
  color: #f8fafc;
}

body[data-theme="dark"] .info-version {
  border-color: rgba(148, 163, 184, .22);
  background: rgba(15, 23, 42, .28);
}

body[data-theme="dark"] .info-version.active {
  border-color: rgba(96, 165, 250, .34);
  background: rgba(15, 23, 42, .44);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
}


/* =========================
   MOBILE
========================= */

@media (max-width: 480px) {

  .info-panel {
    max-height: 90vh;
  }

  .info-header {
    padding: 14px 16px;
  }

  .info-body {
    padding: 16px;
    min-height: 260px;
    max-height: 70dvh;
  }

}

/* =========================================================
   TAG: info-pagination-system-14050320-01
   Changelog page navigation
========================================================= */

.info-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;

  padding: 0 0 16px;
}

.info-nav-btn {
  width: 32px;
  height: 32px;

  border: none;
  border-radius: 32px;

  background: transparent;

  color: #cbd5e1;

  font-size: 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  cursor: pointer;

  transition:
    opacity .2s ease,
    transform .2s ease,
    color .2s ease;
}

.info-nav-btn:hover {
  opacity: .85;
  color: var(--primary);
}

.info-nav-btn:active {
  transform: scale(.92);
}

.info-nav-btn.hidden {
  display: none;
}

/* =========================================================
   TAG: resalat-admin-config-14050330-01
   Admin config screen and Resalat receive-cost result row
========================================================= */

.admin-container {
  /* TAG: resalat-admin-login-flow-14050330-01 */
  /* Match admin card width with the main calculator cards */
  max-width: 440px;
}

.admin-card {
  margin-top: 18px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 18px;
  min-width: 0;
  overflow: hidden;
}

.admin-header > div:first-child {
  min-width: 0;
}

/* TAG: admin-header-actions-14050330-01 */
/* Match index header action grouping and keep admin icon buttons side by side */
.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: ltr;
  flex-shrink: 0;
}

.admin-header h1 {
  /* TAG: admin-responsive-title-14050330-01 */
  /* Match the main index header title scaling on narrow screens */
  font-size: clamp(14px, 4.5vw, 21px) !important;
  margin: 0 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* TAG: admin-copy-tuning-14050330-01 */
/* Make the login title visually stronger while keeping it responsive */
.admin-header h1.admin-login-title {
  font-size: clamp(18px, 5vw, 25px) !important;
}

.admin-header p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-form {
  display: grid;
  gap: 10px;
}

.admin-form-row {
  margin-bottom: 0;
}

.admin-form-row .input-minimal {
  width: 100%;
}

.admin-password-field {
  position: relative;
  width: 100%;
}

.admin-username-field {
  position: relative;
  width: 100%;
}

.admin-username-field .input-minimal {
  padding: 0 42px 0 0 !important;
}

body[data-theme="dark"] .admin-username-field .input-minimal {
  padding: 0 42px 0 0 !important;
}

.admin-username-icon {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  line-height: 1;
  color: var(--muted);
  font-size: 18px;
  pointer-events: none;
  transform: translateY(-50%);
}

.admin-password-field .input-minimal {
  padding: 0 42px 0 0 !important;
  text-align: right;
}

body[data-theme="dark"] .admin-password-field .input-minimal {
  padding: 0 42px 0 0 !important;
}

.admin-form-row .input-minimal:-webkit-autofill,
.admin-form-row .input-minimal:-webkit-autofill:hover,
.admin-form-row .input-minimal:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  font-weight: 500;
  box-shadow: 0 0 0 1000px transparent inset;
}

.admin-form-row .input-minimal.is-rtl:-webkit-autofill {
  direction: rtl !important;
  text-align: right !important;
}

.admin-form-row .input-minimal.is-ltr:-webkit-autofill {
  direction: ltr !important;
  text-align: left !important;
}

.admin-password-toggle {
  position: absolute;
  right: 8px;
  left: auto;
  top: 50%;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transform: translateY(-50%);
  cursor: pointer;
}

.admin-password-toggle:hover,
.admin-password-toggle:focus-visible {
  color: var(--primary);
  background: var(--surface-soft);
  transform: translateY(-50%);
}

.admin-password-toggle:active {
  transform: translateY(-50%) scale(.96);
}

.admin-password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.admin-submit {
  width: 100%;
  margin-top: 6px;
}

.admin-logout {
  /* TAG: admin-logout-ui-14050330-01 */
  /* Match icon-only admin header controls */
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 32px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

/* TAG: admin-back-link-14050330-01 */
/* Icon button mirrors the index info/share hover behavior */
.admin-back-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 32px;
  background: #f1f5f9;
  color: #64748b;
  font-size: 20px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  cursor: pointer;
}

.admin-back-btn:hover,
.admin-logout:hover {
  opacity: .85;
  color: var(--primary);
}

/* TAG: admin-release-notes-footer-14050609-01 */
/* The release log follows the version text instead of consuming header action space. */
.admin-release-notes {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  display: none;
  place-items: center;
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
}

.admin-dashboard-footer.show-release-notes .admin-release-notes {
  display: grid;
}

.admin-release-notes:hover {
  color: var(--primary);
  opacity: .85;
}

.admin-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  padding: 0 4px;
}

.admin-message {
  min-height: 22px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.admin-message[data-type="success"] {
  color: #16a34a;
}

.admin-message[data-type="error"] {
  color: #60a5fa;
}

.admin-message[data-type="version"] {
  color: var(--muted);
  font-weight: 400;
}

.admin-dashboard-footer {
  min-height: 22px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  direction: rtl;
}

.admin-dashboard-footer .admin-message {
  min-height: 0;
  margin: 0;
}

/* TAG: admin-logout-ui-14050330-01 */
/* Modern red tone for successful logout confirmation */
.admin-message[data-type="logout"] {
  /* TAG: admin-logout-ui-14050330-02 */
  /* Requested formal red tone for logout confirmation */
  color: #60a5fa;
}
