:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #16223a;
  --muted: #5b6b85;
  --accent: #1f6ff2;
  --accent-dark: #1554c0;
  --accent-soft: #e8f0fe;
  --green: #12995c;
  --border: #dbe4f0;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(22, 34, 58, .07);
}

html[data-theme="dark"] {
  --bg: #0f1626;
  --card: #182238;
  --ink: #e8eefa;
  --muted: #9fb0ca;
  --accent: #4d8dff;
  --accent-dark: #77a9ff;
  --accent-soft: #1d2c4a;
  --green: #2fc07f;
  --border: #2a3a58;
  --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: var(--bg);
  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; }

/* Header */
header.site {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
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: var(--accent);
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
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;
}
.result-actions button:hover { border-color: var(--accent); color: var(--accent-dark); }

/* 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: none; border-color: var(--accent); }

/* Hero */
.hero { text-align: center; padding: 48px 0 28px; }
.hero h1 { font-size: 2.1rem; font-weight: 800; margin-bottom: 10px; }
.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: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
  display: block;
  color: var(--ink);
}
.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 26px rgba(22, 34, 58, .12);
  text-decoration: none;
}
.tool-card .icon { font-size: 1.9rem; margin-bottom: 10px; }
.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: var(--shadow);
  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: none;
  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;
}
.seg button.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-dark);
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 30px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: var(--accent-dark); }

.result {
  margin-top: 20px;
  background: var(--accent-soft);
  border: 1.5px solid #c4d9fb;
  border-radius: 12px;
  padding: 18px 20px;
  display: none;
}
.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; }
}
