/* ---------- masthead (layout follows the AL-IDRAJ prototype) ---------- */
.topstrip { background: var(--emerald-900); color: #dfe9e5; font-size: .9rem; }
.topstrip .wrap { display: flex; justify-content: space-between; gap: 1rem; min-height: 36px; align-items: center; flex-wrap: wrap; }
.topstrip a, .topstrip button { color: #f5d16f; font-weight: 600; text-decoration: none; }
.topstrip .right { display: flex; gap: 1.1rem; align-items: center; }
.masthead { background: #fff; border-bottom: 1px solid var(--line); }
.masthead .wrap { padding-block: 14px; }
.brand { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; }
.brand svg { width: 96px; height: 96px; flex: none; }
.wordmark { display: block; font-family: var(--display); font-weight: 800; font-size: clamp(1.9rem, 5.2vw, 3rem); letter-spacing: .1em; color: #003d30; line-height: .9; }
.brand-ar { display: block; font-family: var(--arabic); font-weight: 700; font-size: 1.6rem; color: #b98520; line-height: 1.3; }
.brand-sub { font-family: var(--display); font-size: 1.1rem; font-weight: 500; letter-spacing: .02em; color: #2d3734; line-height: 1.1; }
@media (max-width: 560px) { .brand svg { width: 64px; height: 64px; } .brand-ar { font-size: 1.5rem; } .brand-sub { font-size: 1.1rem; } .wordmark { letter-spacing: .03em; font-size: clamp(1.45rem, 7vw, 1.9rem); } .brand { gap: .6rem; } }

.navbar { background: var(--emerald-800); border-bottom: 3px solid #94721f; position: sticky; top: 0; z-index: 50; }
.navbar .wrap { display: flex; align-items: center; flex-wrap: wrap; gap: 0 .1rem; }
.navbar a { color: #fff; text-decoration: none; font-weight: 700; font-size: .84rem; padding: 0 .7rem; min-height: 46px; display: inline-flex; align-items: center; white-space: nowrap; }
.navbar a:hover, .navbar a[aria-current="page"] { background: rgba(255, 255, 255, .08); box-shadow: inset 0 -3px var(--gold-500); }
.navbar :focus-visible { box-shadow: inset 0 0 0 3px var(--gold-400); border-radius: 0; }
.navbar .spacer { margin-left: auto; }
.navbar a.cta { background: linear-gradient(#e1b342, #c99218); color: #1d1a0e; border-radius: 4px; min-height: 36px; margin: 6px 0; box-shadow: none; }
@media (max-width: 800px) { .navbar .wrap { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; } }

/* ---------- hero ---------- */
.hero { background: linear-gradient(110deg, #064b3d 0%, #004033 54%, #062e27 100%); color: #fff; border-bottom: 1px solid #d7c07b; }
.hero .wrap { max-width: 820px; padding-block: clamp(36px, 7vw, 72px); text-align: center; }
.hero h1 { color: #fff; font-size: clamp(1.9rem, 5vw, 2.8rem); margin: 0 0 1.1rem; letter-spacing: -.02em; }
.searchbox { display: flex; gap: .5rem; max-width: 640px; margin: 0 auto; }
.searchbox input { flex: 1 1 auto; min-height: 52px; border: 0; font-size: 1.05rem; padding-inline: 1rem; }
.searchbox .btn { min-height: 52px; padding-inline: 1.6rem; }
.hero-meta { margin: 1rem 0 0; font-size: .95rem; color: #d6e6df; }
.hero-meta a { color: var(--gold-400); font-weight: 700; }

/* ---------- home grid ---------- */
.main-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 28px; padding-block: 28px; align-items: start; }
.main-grid > * { min-width: 0; }
@media (max-width: 760px) { .main-grid { grid-template-columns: minmax(0, 1fr); } }
.sec-title { font-family: var(--display); font-size: 1.2rem; font-weight: 800; letter-spacing: .02em; color: #173a31; margin: 0 0 .8rem; padding-bottom: .15rem; border-bottom: 3px solid var(--gold-500); display: inline-block; }
.stats4 { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 4px; margin-top: 1rem; overflow: hidden; }
.stats4 > div { padding: .75rem .25rem; text-align: center; border-right: 1px solid var(--line); }
.stats4 > div:last-child { border-right: 0; }
.stats4 strong { display: block; font-family: var(--display); font-weight: 800; font-size: 1.6rem; color: var(--emerald-700); line-height: 1; }
.stats4 span { font-size: .85rem; color: var(--muted); }
@media (max-width: 480px) { .stats4 { grid-template-columns: repeat(2, 1fr); } .stats4 > div:nth-child(2) { border-right: 0; } .stats4 > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); } }
.sidebox { border: 1px solid var(--line); border-radius: 4px; padding: .75rem 1rem 1rem; margin-bottom: .75rem; }
.sidebox h3 { font-size: 1.15rem; margin: 0 0 .6rem; border-bottom: 2px solid var(--gold-500); display: inline-block; }
.sidebox .pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.sidebox .pair div { text-align: center; padding: .4rem; border: 1px solid #eceeeb; background: #fafbf9; border-radius: 4px; font-weight: 700; color: #4c5b57; font-size: .95rem; }
.sidebox .pair small { display: block; font-weight: 400; color: var(--muted); }

/* ---------- journal rows ---------- */
.jlist { border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.jrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem 1rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); position: relative; }
.jrow:last-child { border-bottom: 0; }
.jrow:hover { background: #fbfaf5; }
.jrow h3 { font-size: 1.15rem; margin: 0 0 .1rem; }
.jrow h3 a { color: inherit; text-decoration: none; }
.jrow h3 a::after { content: ""; position: absolute; inset: 0; }
.jrow h3 a:hover { color: var(--emerald-600); text-decoration: underline; }
.jrow .by { font-size: .92rem; color: var(--muted); }
.jrow .scope { margin: .3rem 0 0; font-size: .95rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.jrow .side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; text-align: right; font-size: .88rem; color: var(--muted); }
.jrow .extra { grid-column: 1 / -1; position: relative; z-index: 1; }
.jrow .tags { font-size: .88rem; color: var(--muted); margin-top: .3rem; }
@media (max-width: 560px) { .jrow { grid-template-columns: minmax(0, 1fr); } .jrow .side { flex-direction: row; flex-wrap: wrap; align-items: center; text-align: left; } }

/* ---------- catalogue ---------- */
.page { padding-block: clamp(20px, 4vw, 36px); }
.catalog { display: grid; gap: 1.5rem; grid-template-columns: 280px minmax(0, 1fr); align-items: start; }
.catalog > * { min-width: 0; }
.filters { position: sticky; top: 64px; max-height: calc(100vh - 80px); overflow: auto; }
.filters summary { cursor: pointer; font-weight: 700; min-height: 44px; display: flex; align-items: center; list-style: none; }
.filters summary::-webkit-details-marker { display: none; }
.filters .fgroup { border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
@media (max-width: 900px) { .catalog { grid-template-columns: minmax(0, 1fr); } .filters { position: static; max-height: none; } }
@media (min-width: 901px) { .filters summary { display: none; } }
.resultbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.resultbar select { width: auto; min-width: 180px; }
.crumbs { font-size: .9rem; margin-bottom: 1rem; }
.detail-head { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.twocol { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.twocol > * { min-width: 0; }
@media (max-width: 900px) { .twocol { grid-template-columns: minmax(0, 1fr); } }
.evidence td:first-child { font-weight: 700; white-space: nowrap; }

/* ---------- tracker ---------- */
.mlist { display: grid; gap: .75rem; }
.mitem { display: grid; gap: .35rem; grid-template-columns: 1fr auto; align-items: center; text-decoration: none; color: inherit; }
.mitem:hover { border-color: var(--emerald-600); }
.timeline { list-style: none; margin: 0; padding: 0; border-left: 3px solid var(--emerald-100); }
.timeline li { position: relative; padding: 0 0 1rem 1.1rem; }
.timeline li::before { content: ""; position: absolute; left: -9px; top: .3rem; width: 15px; height: 15px; border-radius: 50%; background: var(--gold-500); border: 3px solid #fff; }

/* ---------- auth, billing, footer ---------- */
.authbox { max-width: 440px; margin: 0 auto; }
.planlist { display: grid; gap: .75rem; }
.plan { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem 1rem; align-items: center; }
.plan .price { font-family: var(--display); font-weight: 800; font-size: 1.5rem; color: var(--emerald-700); text-align: right; line-height: 1; }
.plan .price small { display: block; font-family: var(--sans); font-weight: 400; font-size: .85rem; color: var(--muted); }
@media (max-width: 480px) { .plan { grid-template-columns: minmax(0, 1fr); } .plan .price { text-align: left; } }
.bankbox { border: 2px dashed var(--emerald-600); border-radius: var(--radius); padding: 1rem 1.25rem; background: var(--emerald-50); }
.bankbox dl { margin: 0; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; font-weight: 700; }
.footer { background: #004234; color: #dbe7e2; margin-top: 2rem; }
.footer .wrap { display: grid; gap: 1.5rem; grid-template-columns: 1.2fr 1fr 1fr .8fr; padding-block: 1.6rem; }
@media (max-width: 800px) { .footer .wrap { grid-template-columns: minmax(0, 1fr); } }
.footer h2 { color: #f5d16f; font-size: 1rem; border: 0; margin: 0 0 .4rem; }
.footer a { color: #f5d16f; }
.footer p, .footer li { font-size: .92rem; margin: 0 0 .3rem; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer .copy { border-top: 1px solid rgba(255, 255, 255, .16); padding: .7rem var(--gutter); font-size: .85rem; color: #c7d8d2; text-align: center; }

/* ---------- prose pages ---------- */
.prose { max-width: 44rem; }
.prose h2 { margin-top: 1.6rem; }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: .3rem; }
.prose .motto { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--emerald-700); border-left: 4px solid var(--gold-500); padding-left: .9rem; margin: 1.4rem 0; }

/* ---------- research tools ---------- */
.matn { direction: rtl; text-align: right; font-family: var(--matn); font-size: 1.65rem; line-height: 2.1; margin: .6rem 0; }
.matn mark { background: var(--gold-100); color: inherit; border-radius: 3px; padding: 0 .15em; }
.hcard { display: grid; gap: .25rem; }
.hcard .head { display: flex; flex-wrap: wrap; gap: .4rem .6rem; align-items: center; justify-content: space-between; }
.hcard .src { font-weight: 700; }
.hcard .tr { margin: 0; }
.hcard .meta { font-size: .88rem; color: var(--muted); }
.hcard .acts { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.hlist { display: grid; gap: .75rem; }
.chain { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-width: 28rem; }
.chain li { position: relative; border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .9rem; background: #fff; margin-bottom: 1.4rem; }
.chain li:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: -1.4rem; height: 1.4rem; border-left: 2px solid var(--gold-500); }
.chain li.root { background: var(--emerald-50); text-align: center; font-weight: 700; }
.chain .term { font-size: .85rem; color: var(--muted); }
.chain .ar { font-family: var(--matn); font-size: 1.25rem; direction: rtl; }
.nlist { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.nlist a { text-decoration: none; color: inherit; }
.nlist a:hover { border-color: var(--emerald-600); }
.picker { display: flex; gap: .5rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
.picker .field { margin: 0; min-width: 220px; flex: 1 1 220px; }
.verdict { font-family: var(--matn); font-size: 1.3rem; direction: rtl; }
.searchbar { background: var(--emerald-50); border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem; }
input.matn-input { font-family: var(--matn); font-size: 1.4rem; direction: rtl; text-align: right; min-height: 52px; }
.chain li.dim { opacity: .35; }
.plainlist { list-style: none; margin: 0 0 .5rem; padding: 0; } .plainlist li { padding: .4rem 0; border-top: 1px solid var(--line); font-size: .95rem; } .plainlist li:first-child { border-top: 0; }

/* invoice */
.num { text-align: right; }
.invoice h2 { font-size: 1rem; }
@media print {
  .noprint, .masthead, .navbar, .demoband, .footer, .skip { display: none !important; }
  body { background: #fff; }
  .invoice { border: 0; box-shadow: none; padding: 0; }
}
