:root {
  --brand: #047857;
  --brand-600: #065f46;
  --brand-50: #ecfdf5;
  --brand-100: #d1fae5;
  --gold: #b45309;
  --gold-50: #fffbeb;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #ffffff;
  --bg-2: #f6f8f7;
  --danger: #b91c1c;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --font: "Segoe UI", Tahoma, "Noto Sans Arabic", "Noto Naskh Arabic", "Geeza Pro", system-ui, -apple-system, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.75; font-size: 17px; }
img, svg { max-width: 100%; }
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .5em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
.wrap { width: min(1100px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(820px, 100% - 32px); }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 10; }
.skip:focus { inset-inline-start: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { flex: none; }

/* Header */
.site-header { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.2rem; }
.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font-size: .97rem; }
.nav a:hover { background: var(--bg-2); }
.nav a[aria-current] { background: var(--brand-50); color: var(--brand-600); font-weight: 700; }

/* Hero */
.hero { background: linear-gradient(180deg, var(--brand-50), #fff 85%); padding: clamp(28px, 5vw, 56px) 0 clamp(24px, 4vw, 40px); }
.hero h1 { text-align: center; }
.lead { text-align: center; color: var(--ink-2); font-size: 1.08rem; max-width: 720px; margin: 0 auto 1.4em; }
.today { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 0 auto; max-width: 820px; }
.today-box { flex: 1 1 260px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-align: center; box-shadow: var(--shadow); }
.today-box .k { color: var(--muted); font-size: .9rem; display: block; }
.today-box .v { font-size: 1.35rem; font-weight: 800; color: var(--brand-600); display: block; }
.today-box .s { color: var(--ink-2); font-size: .95rem; }

/* Tool panel */
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: clamp(18px, 3vw, 28px); max-width: 820px; margin: 0 auto; }
.tabs { display: flex; gap: 6px; background: var(--bg-2); padding: 5px; border-radius: 12px; margin-bottom: 18px; }
.tabs button { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 700; color: var(--ink-2); padding: 10px 8px; border-radius: 9px; cursor: pointer; }
.tabs button[aria-selected="true"] { background: #fff; color: var(--brand-600); box-shadow: 0 1px 4px rgba(15, 23, 42, .12); }
.field-label { display: block; font-weight: 700; margin-bottom: 8px; }
.date-row { display: grid; grid-template-columns: 1fr 1.8fr 1.2fr; gap: 10px; margin-bottom: 16px; }
select, input[type="number"], input[type="text"] { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; min-height: 50px; }
select:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-100); }
.date-row label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.opt { margin: 4px 0 16px; }
.opt summary { cursor: pointer; color: var(--brand-600); font-weight: 700; font-size: .95rem; }
.opt[open] summary { margin-bottom: 10px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 800; border: 0; border-radius: 12px; cursor: pointer; text-decoration: none; }
.btn-primary { width: 100%; background: var(--brand); color: #fff; padding: 14px 20px; font-size: 1.08rem; }
.btn-primary:hover { background: var(--brand-600); }
.btn-copy { background: var(--brand-50); color: var(--brand-600); padding: 8px 14px; font-size: .92rem; }
.btn-copy:hover { background: var(--brand-100); }
.btn-copy.done { background: var(--brand); color: #fff; }
.error { color: var(--danger); font-weight: 700; margin: 12px 0 0; }

/* Results */
.result { margin-top: 22px; border-top: 1px dashed var(--line); padding-top: 22px; }
.big { text-align: center; font-size: clamp(1.25rem, 3.6vw, 1.7rem); font-weight: 800; color: var(--brand-600); margin-bottom: 6px; }
.sub { text-align: center; color: var(--ink-2); margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--bg-2); border-radius: 12px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.3rem; color: var(--ink); direction: ltr; unicode-bidi: plaintext; }
.stat span { color: var(--muted); font-size: .9rem; }
.facts { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.facts li { display: flex; justify-content: space-between; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.facts li span { color: var(--muted); }
.facts li b { text-align: left; }
.highlight { background: var(--gold-50); border: 1px solid #fde68a; border-radius: 12px; padding: 12px 16px; text-align: center; color: #78350f; font-weight: 700; margin-bottom: 16px; }
.copy-row { display: flex; justify-content: center; margin-top: 14px; }
.note { color: var(--muted); font-size: .9rem; text-align: center; margin: 14px 0 0; }

/* Name decoration */
.name-input { display: flex; gap: 10px; }
.name-input input { font-size: 1.15rem; text-align: center; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; justify-content: center; }
.chips button { font: inherit; font-size: .9rem; border: 1px solid var(--line); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 5px 14px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }
.deco-list { list-style: none; padding: 0; margin: 20px 0 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.deco-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; min-width: 0; }
.deco-text { font-size: 1.25rem; overflow-wrap: anywhere; unicode-bidi: plaintext; min-width: 0; }
.deco-empty { text-align: center; color: var(--muted); margin: 20px 0 0; }
.toast { position: fixed; bottom: 22px; inset-inline: 0; margin-inline: auto; width: max-content; max-width: 90vw; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; opacity: 0; transform: translateY(10px); transition: .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: none; }

/* Sections */
.section { padding: clamp(40px, 6vw, 64px) 0; }
.section.alt { background: var(--bg-2); }
.section h2 { text-align: center; margin-bottom: 1em; }
.prose h2 { text-align: start; margin-top: 1.4em; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.prose ul, .prose ol { padding-inline-start: 1.3em; margin: 0 0 1em; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card p { color: var(--ink-2); margin: 0; }
.tool-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool-card .icon { color: var(--brand); width: 34px; height: 34px; background: var(--brand-50); border-radius: 10px; padding: 6px; margin-bottom: 10px; }
.tool-card h3 { color: var(--brand-600); }
.tool-card:hover, .tool-card:focus-visible { border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; }
th, td { border: 1px solid var(--line); padding: 9px 12px; text-align: center; }
th { background: var(--brand-50); color: var(--brand-600); }

/* FAQ */
.faq details { background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; padding: 0 16px; }
.faq summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style: none; position: relative; padding-inline-end: 26px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; inset-inline-end: 0; top: 12px; font-size: 1.3rem; color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq details p { color: var(--ink-2); margin: 0 0 14px; }

/* Simple pages */
.page-head { background: var(--brand-50); padding: 36px 0 26px; }
.page-head p { color: var(--muted); margin: 0; }
.page-body { padding: 32px 0 56px; }

/* Footer */
.site-footer { background: #0b1f19; color: #cbd5e1; padding: 40px 0 24px; margin-top: 0; }
.footer-inner { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px; }
.site-footer .brand { color: #fff; }
.footer-brand p { color: #94a3b8; font-size: .93rem; margin-top: 10px; max-width: 420px; }
.footer-col h2 { font-size: 1rem; color: #fff; text-align: start; margin-bottom: 8px; }
.footer-col a { display: block; color: #cbd5e1; text-decoration: none; padding: 3px 0; font-size: .95rem; }
.footer-col a:hover { color: #6ee7b7; }
.footer-note { border-top: 1px solid #1e3a32; margin-top: 26px; padding-top: 16px; font-size: .85rem; color: #94a3b8; }
.footer-note p { margin: 0; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .header-inner { flex-direction: column; align-items: stretch; gap: 6px; padding: 8px 0; }
  .brand { justify-content: center; }
  .nav { justify-content: center; gap: 2px; }
  .nav a { padding: 5px 10px; font-size: .92rem; }
  .site-header { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .deco-list { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .date-row { grid-template-columns: .85fr 2fr 1.15fr; gap: 6px; }
  select, input[type="number"] { padding: 10px 6px; }
}
