:root {
  --bg: #e7ecf4;
  --bg2: #dde4f0;
  --card: #ffffff;
  --ink: #16223a;
  --muted: #5b6b85;
  --accent: #1f6ff2;
  --accent-dark: #1554c0;
  --accent-soft: #e8f0fe;
  --green: #12995c;
  --border: #c9d4e6;
  --edge: #c2cede;
  --btn-edge: #12459e;
  --radius: 16px;
  --shadow: 0 4px 18px rgba(22, 34, 58, .07);
}

html[data-theme="dark"] {
  --bg: #0f1626;
  --bg2: #0a101d;
  --card: #182238;
  --ink: #e8eefa;
  --muted: #9fb0ca;
  --accent: #4d8dff;
  --accent-dark: #77a9ff;
  --accent-soft: #1d2c4a;
  --green: #2fc07f;
  --border: #2a3a58;
  --edge: #0a1120;
  --btn-edge: #0d3b8f;
  --shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] .calc-box input[type="number"],
html[data-theme="dark"] .calc-box input[type="date"],
html[data-theme="dark"] .calc-box input[type="text"],
html[data-theme="dark"] .calc-box select,
html[data-theme="dark"] .seg button { background: #121b2e; color: var(--ink); }
html[data-theme="dark"] .calc-box input:focus, html[data-theme="dark"] .calc-box select:focus { background: #0e1526; }
html[data-theme="dark"] .seg button.active { background: var(--accent-soft); color: #a9c8ff; }
html[data-theme="dark"] .result { background: var(--accent-soft); border-color: #33507f; }
html[data-theme="dark"] .result td { border-bottom-color: #2c4166; }
html[data-theme="dark"] .example { background: #14311f; border-color: #245c3a; }
html[data-theme="dark"] .example, html[data-theme="dark"] .example strong { color: #cdeedd; }
html[data-theme="dark"] .note { background: #33270e; border-color: #5c4a1e; color: #d8c99a; }
html[data-theme="dark"] article.content p, html[data-theme="dark"] article.content li,
html[data-theme="dark"] .faq details p { color: #c3cfe4; }
html[data-theme="dark"] .btn { color: #fff; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Heebo', 'Segoe UI', Arial, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.7;
  direction: rtl;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 980px; margin: 0 auto; padding: 0 18px; }
.skip-link { position: absolute; right: -9999px; top: 0; z-index: 1000; background: var(--accent); color: #fff; padding: 12px 20px; border-radius: 0 0 0 10px; font-weight: 700; }
.skip-link:focus { right: 0; }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* Charts */
.chart-wrap { margin-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.donut { width: 188px; height: 188px; }
.donut-top { font-size: 15px; font-weight: 800; fill: var(--ink); }
.donut-bottom { font-size: 10.5px; fill: var(--muted); }
.growth { width: 100%; max-width: 360px; height: auto; }
.growth .ax { font-size: 10px; fill: var(--muted); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; }
.lg-item { display: flex; align-items: center; gap: 6px; font-size: .86rem; color: var(--muted); }
.lg-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.lg-val { font-weight: 700; color: var(--ink); }

/* Amortization schedule */
.amort { margin-top: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); }
.amort summary { cursor: pointer; font-weight: 700; padding: 13px 16px; }
.amort-scroll { max-height: 300px; overflow: auto; padding: 0 8px 8px; }
.amort-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.amort-table th, .amort-table td { padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--border); }
.amort-table th { position: sticky; top: 0; background: var(--accent-soft); color: var(--accent-dark); z-index: 1; }
.amort-table tbody tr:last-child td { border-bottom: none; }

/* Guides + trust signals */
.data-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: .95rem; background: var(--card); border-radius: 10px; overflow: hidden; box-shadow: 0 3px 0 var(--edge); }
.data-table th, .data-table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); }
.data-table th { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table-wrap { overflow-x: auto; }

.updated {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eafaf1; border: 1px solid #bde5cf; color: #0e7a49;
  border-radius: 999px; padding: 4px 14px; font-size: .85rem; font-weight: 600;
  margin: 6px 0 2px;
}
html[data-theme="dark"] .updated { background: #14311f; border-color: #245c3a; color: #7fd8a8; }

.sources {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; margin: 18px 0; font-size: .9rem; color: var(--muted);
}
.sources strong { color: var(--ink); }
.sources a { margin-inline-start: 4px; }

.trust { font-size: .84rem; color: var(--muted); margin-top: 10px; }
.trust a { color: var(--muted); text-decoration: underline; }
.trust a:hover { color: var(--accent); }

.cta-calc {
  display: block; background: linear-gradient(105deg, var(--accent-soft), #efe8ff);
  border: 1.5px solid #c4d9fb; border-radius: 12px; padding: 16px 20px; margin: 20px 0;
  color: var(--ink); font-weight: 600; box-shadow: 0 4px 0 var(--edge);
  transition: transform .12s ease, box-shadow .12s ease;
}
.cta-calc:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--edge); text-decoration: none; }
.cta-calc .go { color: var(--accent-dark); font-weight: 800; }
html[data-theme="dark"] .cta-calc { background: linear-gradient(105deg, #1d2c4a, #251d40); border-color: #33507f; }

/* Consent banner */
.consent-banner {
  position: fixed; bottom: 16px; right: 16px; left: 16px;
  max-width: 560px; margin: 0 auto;
  background: var(--card); border: 1.5px solid var(--border); border-radius: 14px;
  padding: 16px 20px; z-index: 200;
  box-shadow: 0 6px 0 var(--edge), 0 18px 40px rgba(16, 26, 46, .30);
}
.consent-banner p { font-size: .92rem; color: var(--ink); margin-bottom: 12px; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions .btn { padding: 8px 22px; font-size: .95rem; }
.consent-actions #ccNo {
  background: none; border: 1.5px solid var(--border); border-radius: 10px;
  padding: 8px 18px; font-family: inherit; font-size: .95rem; font-weight: 600;
  color: var(--muted); cursor: pointer; box-shadow: 0 3px 0 var(--edge);
}
.consent-actions #ccNo:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }

/* Category chips (homepage) */
.cats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px auto 0; max-width: 680px; }
.cats button {
  border: 1.5px solid var(--border); background: var(--card); color: var(--muted);
  border-radius: 999px; padding: 7px 17px; font-family: inherit; font-size: .9rem; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 0 var(--edge); transition: transform .1s ease, box-shadow .1s ease;
}
.cats button:active { transform: translateY(2px); box-shadow: none; }
.cats button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); box-shadow: 0 2px 0 #9dbef5; }
html[data-theme="dark"] .cats button.active { box-shadow: 0 2px 0 #0d3b8f; }

/* Header */
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 3px 12px rgba(22, 34, 58, .06);
}
header.site::before {
  content: '';
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), #7b3ff2, #e84393);
}
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}
.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo:hover { text-decoration: none; }
.logo .mark {
  background: linear-gradient(180deg, #3a83f7, var(--accent));
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 3px 0 var(--btn-edge);
}
nav.main { display: flex; align-items: center; }
nav.main a {
  margin-inline-start: 18px;
  color: var(--muted);
  font-weight: 500;
}
nav.main a:hover { color: var(--accent); text-decoration: none; }

.theme-btn {
  margin-inline-start: 18px;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  width: 36px; height: 36px;
  font-size: 1.05rem;
  cursor: pointer;
  line-height: 1;
  color: var(--ink);
}
.theme-btn:hover { border-color: var(--accent); }

/* Result actions (copy / WhatsApp share) */
.result-actions { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.result-actions button {
  border: 1.5px solid var(--border);
  background: var(--card);
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .1s ease, box-shadow .1s ease;
}
.result-actions button:hover { border-color: var(--accent); color: var(--accent-dark); }
.result-actions button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }

/* Homepage calculator search */
.tool-search { max-width: 460px; margin: 18px auto 0; }
.tool-search input {
  width: 100%;
  padding: 12px 18px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.tool-search input:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }

/* Hero */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 10px;
  background: linear-gradient(105deg, var(--accent) 20%, #7b3ff2 80%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
html[data-theme="dark"] .hero h1 { background-image: linear-gradient(105deg, #6ba1ff 20%, #b28aff 80%); }
.hero p { color: var(--muted); max-width: 640px; margin: 0 auto; font-size: 1.05rem; }

/* Cards grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 26px 0 40px;
}
.tool-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: 0 5px 0 var(--edge), 0 12px 22px rgba(22, 34, 58, .10);
  transition: transform .15s ease, box-shadow .15s ease;
  display: block;
  color: var(--ink);
}
.tool-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 9px 0 var(--edge), 0 20px 32px rgba(22, 34, 58, .16);
  text-decoration: none;
}
.tool-card:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 var(--edge), 0 6px 12px rgba(22, 34, 58, .10);
}
.tool-card .icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 15px;
  font-size: 1.8rem;
  margin-bottom: 14px;
  background: linear-gradient(145deg, #dbe9ff, #c3d9ff);
  box-shadow: inset 0 -4px 0 rgba(22, 34, 58, .10), inset 0 2px 0 rgba(255, 255, 255, .65);
}
.grid .tool-card:nth-child(6n+2) .icon { background: linear-gradient(145deg, #d9f5e5, #bceccf); }
.grid .tool-card:nth-child(6n+3) .icon { background: linear-gradient(145deg, #ffe9d2, #ffd9b0); }
.grid .tool-card:nth-child(6n+4) .icon { background: linear-gradient(145deg, #eadfff, #dcc8ff); }
.grid .tool-card:nth-child(6n+5) .icon { background: linear-gradient(145deg, #ffe0eb, #ffc9dd); }
.grid .tool-card:nth-child(6n) .icon { background: linear-gradient(145deg, #d5f2f2, #b6e7e7); }
html[data-theme="dark"] .tool-card .icon,
html[data-theme="dark"] .grid .tool-card .icon {
  background: linear-gradient(145deg, #22335a, #1a2846);
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .35), inset 0 2px 0 rgba(255, 255, 255, .06);
}
.tool-card h2, .tool-card h3 { font-size: 1.15rem; margin-bottom: 6px; }
.tool-card p { color: var(--muted); font-size: .93rem; }

/* Breadcrumbs */
.crumbs { padding: 18px 0 0; font-size: .88rem; color: var(--muted); }
.crumbs a { color: var(--muted); }

/* Calculator page */
.page-title { padding: 14px 0 6px; }
.page-title h1 { font-size: 1.8rem; font-weight: 800; }
.page-title .sub { color: var(--muted); margin-top: 4px; }

.calc-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--edge), 0 16px 30px rgba(22, 34, 58, .12);
  padding: 26px;
  margin: 20px 0;
}
.calc-box .row { margin-bottom: 16px; }
.calc-box label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .95rem; }
.calc-box input[type="number"],
.calc-box input[type="date"],
.calc-box input[type="text"],
.calc-box select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1.05rem;
  font-family: inherit;
  background: #fbfdff;
  color: var(--ink);
}
.calc-box input:focus, .calc-box select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
  background: #fff;
}
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .two-col { grid-template-columns: 1fr; } }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button {
  flex: 1;
  min-width: 110px;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  background: #fbfdff;
  border-radius: 10px;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--edge);
  transition: transform .1s ease, box-shadow .1s ease;
}
.seg button:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.seg button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: 0 3px 0 #9dbef5;
}
html[data-theme="dark"] .seg button.active { box-shadow: 0 3px 0 #0d3b8f; }

.btn {
  display: inline-block;
  background: linear-gradient(180deg, #3a83f7, var(--accent));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 30px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--btn-edge), 0 10px 18px rgba(31, 111, 242, .30);
  transition: transform .1s ease, box-shadow .1s ease, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 var(--btn-edge), 0 4px 8px rgba(31, 111, 242, .25);
}

.result {
  margin-top: 20px;
  background: var(--accent-soft);
  border: 1.5px solid #c4d9fb;
  border-radius: 12px;
  padding: 18px 20px;
  display: none;
  box-shadow: 0 4px 0 #b3cdf5;
}
html[data-theme="dark"] .result { box-shadow: 0 4px 0 #14264a; }
.result.show { display: block; }
.result .big {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--accent-dark);
}
.result table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .95rem; }
.result td { padding: 6px 4px; border-bottom: 1px solid #d5e3f8; }
.result tr:last-child td { border-bottom: none; }
.result td:last-child { text-align: left; font-weight: 600; }

/* Content sections */
article.content { padding: 10px 0 20px; }
article.content h2 { font-size: 1.35rem; margin: 26px 0 10px; }
article.content h3 { font-size: 1.1rem; margin: 18px 0 8px; }
article.content p, article.content li { color: #33415c; }
article.content ul, article.content ol { padding-inline-start: 22px; margin: 8px 0; }

.example {
  background: #f0fdf6;
  border: 1px solid #bde5cf;
  border-radius: 10px;
  padding: 14px 18px;
  margin: 12px 0;
  font-size: .96rem;
}

/* FAQ */
.faq { margin: 10px 0 26px; }
.faq details {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 0 18px;
}
.faq summary {
  cursor: pointer;
  font-weight: 700;
  padding: 14px 0;
  list-style-position: inside;
}
.faq details p { padding: 0 0 14px; color: #33415c; }

/* Related */
.related { padding: 6px 0 34px; }
.related h2 { font-size: 1.25rem; margin-bottom: 12px; }
.related .grid { padding: 0; }

/* Note */
.note {
  font-size: .85rem;
  color: var(--muted);
  background: #fff8e8;
  border: 1px solid #f0dfb0;
  border-radius: 10px;
  padding: 10px 14px;
  margin-top: 14px;
}

/* Footer */
footer.site {
  background: #101a2e;
  color: #b8c4d8;
  padding: 30px 0;
  margin-top: 30px;
  font-size: .92rem;
}
footer.site .cols {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
footer.site a { color: #d7e1f2; margin-inline-end: 16px; }
footer.site .copy { margin-top: 14px; color: #7788a5; font-size: .85rem; }

@media (max-width: 640px) {
  .hero h1 { font-size: 1.6rem; }
  nav.main a { margin-inline-start: 12px; font-size: .9rem; }
}
