:root {
    --bg: #f7f7f4;
    --ink: #1b2a2a;
    --muted: #667170;
    --brand: #087a68;
    --brand-dark: #065d50;
    --gold: #b9892a;
    --line: #dde3df;
    --card: #ffffff;
    --danger: #b42318;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--ink);
}
a { color: var(--brand); text-decoration: none; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 5vw;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.brand { font-weight: 800; color: var(--ink); }
.nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.nav a, .link-button { font-weight: 650; color: var(--ink); }
.link-button { border: 0; background: none; cursor: pointer; padding: 0; font: inherit; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 5vw 60px; }
.hero {
    display: grid;
    gap: 14px;
    margin-bottom: 24px;
}
h1, h2, h3 { margin: 0 0 10px; line-height: 1.15; }
h1 { font-size: clamp(30px, 5vw, 52px); }
p { color: var(--muted); line-height: 1.65; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.module-grid { margin-bottom: 24px; }
.module-card { color: var(--ink); min-height: 118px; }
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(20, 40, 35, .04);
}
.resource-card { display: flex; flex-direction: column; min-height: 210px; }
.resource-card p { flex: 1; }
.badge {
    display: inline-flex;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f4ef;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}
.premium { background: #fff4da; color: #7a5108; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 7px;
    border: 1px solid var(--brand);
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}
.btn.secondary { background: #fff; color: var(--brand); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form { display: grid; gap: 12px; max-width: 560px; }
.form.wide { max-width: none; }
label { display: grid; gap: 6px; font-weight: 750; }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
legend { font-weight: 800; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 7px;
    min-height: 42px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
input[type="checkbox"] { width: auto; min-height: auto; }
textarea { min-height: 110px; resize: vertical; }
.alert { padding: 12px 14px; border-radius: 7px; margin-bottom: 16px; font-weight: 700; }
.alert.error { background: #fee4e2; color: #912018; }
.alert.success { background: #dcfae6; color: #05603a; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #eef4f1; font-size: 13px; text-transform: uppercase; }
.split { display: grid; grid-template-columns: minmax(280px, 360px) 1fr; gap: 18px; align-items: start; }
.locked {
    border: 1px solid #edd79b;
    background: #fff9e8;
    padding: 24px;
    border-radius: 8px;
}
.ad-banner {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 16px;
    align-items: center;
    background: #0b5f56;
    color: #fff;
    border-radius: 8px;
    padding: 18px;
    margin: 18px 0 24px;
}
.ad-banner span { color: #e8fffa; }
.ad-banner.compact { grid-template-columns: 1fr auto; }
.para-grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.arabic-title { font-size: 32px; color: var(--ink); direction: rtl; }
.video-wrap { aspect-ratio: 16 / 9; width: 100%; margin: 16px 0; }
.video-wrap iframe { width: 100%; height: 100%; border: 0; border-radius: 8px; }
.upgrade-popup {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 20;
    width: min(360px, calc(100vw - 36px));
    background: #fff;
    border: 1px solid var(--line);
    border-top: 5px solid var(--gold);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.18);
}
.site-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    background: #fff;
    padding: 18px 5vw;
    color: var(--muted);
    text-align: center;
}
.upgrade-popup p { margin: 8px 0 12px; }
.popup-close {
    position: absolute;
    right: 8px;
    top: 8px;
    border: 0;
    background: #eef4f1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
}
.preview-fade {
    max-height: 190px;
    overflow: hidden;
    position: relative;
}
.preview-fade:after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 70px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
}
.content-frame {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
}
.meta { color: var(--muted); font-size: 14px; }
.inline-form { display: inline; }
@media (max-width: 760px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .split { grid-template-columns: 1fr; }
    .ad-banner, .ad-banner.compact { grid-template-columns: 1fr; }
    table { display: block; overflow-x: auto; }
}
