:root {
    --brand: #1e5bc4;
    --brand-mid: #2563eb;
    --brand-dark: #102a61;
    --hero-deep: #0b1f52;
    --bg: #e8eef9;
    --text: #0f172a;
    --muted: #51627a;
    --card: #ffffff;
    --border: #c9d9f5;
    --danger: #b42318;
    --success: #0f5132;
    --radius: 12px;
    --shadow: 0 14px 40px rgba(15, 50, 120, 0.12);
    --font-stack: "Cairo", ui-sans-serif, system-ui, "Segoe UI", "Noto Sans Arabic", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-stack);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background:
        radial-gradient(ellipse 100% 80% at 50% -20%, rgba(37, 99, 235, 0.18), transparent 55%),
        linear-gradient(180deg, #dbe7fc 0%, var(--bg) 38%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.page-home .site-main {
    padding-top: 0;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.visually-hidden {
    position: absolute;
    clip: rect(0 0 0 0);
    width: 1px;
    height: 1px;
    margin: -1px;
}

.site-header {
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 20;
}

.shell {
    width: min(1080px, 100% - 32px);
    margin: 0 auto;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
}

.brand-logo-link {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    line-height: 0;
    outline-offset: 3px;
    border-radius: 8px;
}

.brand-logo-link:hover {
    opacity: 0.92;
    text-decoration: none;
}

.brand-logo-img {
    display: block;
    height: clamp(42px, 9vw, 56px);
    width: auto;
    max-width: min(288px, 62vw);
    object-fit: contain;
}

.admin-brand-logo-img {
    height: 36px;
    max-width: 200px;
}

.site-title-small {
    font-weight: 600;
    color: var(--text);
}

.top-utils {
    margin-inline-start: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.lang-switch {
    display: inline-flex;
    gap: 6px;
}

.lang-chip {
    border: 1px solid var(--border);
    background: var(--card);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
    color: var(--text);
}

.lang-chip[aria-current="true"] {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 4px 0 14px;
    border-top: 1px solid var(--border);
}

.nav-link {
    display: inline-flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text);
}

.nav-link[aria-current="page"] {
    background: rgba(30, 91, 196, 0.12);
    color: var(--brand-dark);
    font-weight: 600;
}

main.site-main {
    flex: 1;
    padding: 28px 0 52px;
}

.home-flash-wrap {
    padding-top: 14px;
    margin-bottom: -6px;
    position: relative;
    z-index: 5;
}

/* —— Landing hero (home) —— */
.home-hero {
    position: relative;
    padding: clamp(36px, 8vw, 72px) 0 clamp(52px, 10vw, 88px);
    background:
        radial-gradient(circle at 85% 20%, rgba(96, 165, 250, 0.35), transparent 42%),
        radial-gradient(circle at 10% 60%, rgba(30, 64, 175, 0.45), transparent 48%),
        linear-gradient(135deg, var(--hero-deep) 0%, var(--brand-dark) 42%, var(--brand) 92%);
    color: #eef4ff;
    margin-bottom: 0;
    box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.home-hero-inner {
    max-width: 720px;
}

html[dir='rtl'] .home-hero-inner {
    margin-inline-end: auto;
}

html[dir='ltr'] .home-hero-inner {
    margin-inline-start: auto;
}

.hero-title {
    margin: 0 0 14px;
    font-size: clamp(28px, 4.6vw, 44px);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.025em;
    text-wrap: balance;
}

.hero-lead {
    margin: 0 0 26px;
    font-size: clamp(15px, 2.4vw, 18px);
    line-height: 1.65;
    color: rgba(238, 244, 255, 0.88);
    max-width: 56ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-actions .button {
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
}

.button-white {
    background: #ffffff;
    color: var(--brand-dark) !important;
    box-shadow: 0 12px 32px rgba(0, 0, 40, 0.2);
}

.button-white:hover {
    filter: brightness(1.04);
}

.button-ghost {
    background: transparent;
    color: #fff !important;
    border: 2px solid rgba(255, 255, 255, 0.45);
}

.button-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
}

/* Services grid */
.section-title {
    margin: 28px 0 8px;
    font-size: clamp(22px, 3.2vw, 28px);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--brand-dark);
}

.section-lead {
    margin: 0 0 22px;
    color: var(--muted);
    max-width: 62ch;
    font-size: 15px;
}

.home-service-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    margin-bottom: 8px;
}

.home-service-card {
    border-radius: var(--radius);
    padding: 20px 20px 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f2f7ff 100%);
    border: 1px solid rgba(30, 91, 196, 0.15);
    box-shadow: 0 8px 24px rgba(15, 50, 120, 0.06);
    position: relative;
    overflow: hidden;
}

.home-service-card::before {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    top: 18px;
    bottom: 18px;
    width: 3px;
    border-radius: 3px;
    background: linear-gradient(180deg, var(--brand), var(--brand-mid));
}

html[dir='rtl'] .home-service-card::before {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

.home-service-card h3 {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--brand-dark);
}

.home-service-card p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
    line-height: 1.55;
}

.home-service-icon {
    display: block;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.12);
    box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.2);
    position: relative;
}

.home-service-icon::after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 6px;
    background: var(--brand-mid);
    opacity: 0.25;
}

.home-service-icon-1::after {
    clip-path: polygon(20% 0, 80% 0, 100% 100%, 0 100%);
}
.home-service-icon-2::after {
    clip-path: circle(35% at 50% 50%);
}
.home-service-icon-3::after {
    clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.home-service-icon-4::after {
    border-radius: 50%;
    clip-path: none;
}

.home-about.intro {
    margin-top: 32px;
    margin-bottom: 8px;
}

.intro-heading {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--brand-dark);
}

/* IPO listing cards — badges */
.ipo-card-head {
    display: grid;
    gap: 10px;
    margin-bottom: 6px;
}

.ipo-badge {
    justify-self: start;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ipo-badge-live {
    background: rgba(37, 99, 235, 0.12);
    color: var(--brand);
    border: 1px solid rgba(37, 99, 235, 0.28);
}

.ipo-badge-muted {
    background: #edf1f8;
    color: var(--muted);
    border: 1px solid var(--border);
}

html[dir='rtl'] .ipo-badge {
    text-transform: none;
}

.ipo-card-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.3;
}

.ipo-card {
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.ipo-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(15, 50, 120, 0.12);
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px;
    box-shadow: var(--shadow);
}

.card + .card {
    margin-top: 18px;
}

/* IPO listing — stacked list (single column) */
.ipo-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* List layout uses gap — no stacked .card sibling margins */
.ipo-list > .ipo-card + .ipo-card {
    margin-top: 0;
}

.ipo-list > .ipo-card {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.ipo-card-list .ipo-card-title {
    margin: 0 0 10px;
}

.ipo-excerpt {
    margin: 0 0 4px;
    font-size: 15px;
    line-height: 1.55;
    color: var(--muted);
}

.ipo-card .ipo-actions.ipo-actions-list {
    margin-top: 14px;
    padding-top: 0;
    flex-shrink: 0;
}

.page-title {
    margin: 0 0 10px;
    font-size: clamp(26px, 4vw, 34px);
    letter-spacing: -0.03em;
}

.lead-muted {
    color: var(--muted);
    margin: 0;
}

.intro p {
    margin: 14px 0 0;
    color: #304257;
}

.grid {
    display: grid;
    gap: 16px;
}

.ipo-meta {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 10px;
}

.ipo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    padding: 10px 14px;
    border: none;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
}

.button-primary {
    background: linear-gradient(135deg, var(--brand-mid), var(--brand-dark));
    color: #fff !important;
    box-shadow: 0 14px 30px rgba(30, 64, 175, 0.28);
}

.button-primary:hover {
    filter: brightness(1.06);
}

.button-muted {
    background: rgba(37, 99, 235, 0.1);
    color: var(--brand-dark);
    border: 1px solid rgba(37, 99, 235, 0.2);
}

.forms .field {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.label {
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    background: #fbfcff;
    width: 100%;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
}

.footer-shell {
    width: min(1080px, 100% - 32px);
    margin: 0 auto;
    padding: 16px 0;
}

.footer-muted {
    color: var(--muted);
    margin: 0;
    font-size: 14px;
    text-align: center;
}

.alert {
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.alert-danger {
    background: rgba(180, 35, 24, 0.08);
    border-color: rgba(180, 35, 24, 0.25);
    color: var(--danger);
}

.alert-success {
    background: rgba(15, 81, 50, 0.08);
    border-color: rgba(15, 81, 50, 0.25);
    color: var(--success);
}

.muted-banner {
    color: var(--muted);
}

.captcha-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.captcha-refresh-icon {
    display: inline-block;
    font-size: 1.1em;
    line-height: 1;
    transform: translateY(0.05em);
}

.how-steps h2:first-child {
    margin-top: 0;
}

.subscribe-ipsub {
    font-weight: 600;
    color: var(--brand-dark);
    font-size: clamp(18px, 2.8vw, 22px);
    margin: -4px 0 12px;
    line-height: 1.4;
}

.subscribe-ipo-overview {
    margin: 0 0 24px;
    padding-bottom: 4px;
    font-size: 15px;
    line-height: 1.72;
    color: #394a60;
    overflow-wrap: break-word;
}

.checkbox-line {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-weight: 500;
}

.checkbox-line input[type='checkbox'] {
    width: 20px;
    height: 20px;
    margin-top: 3px;
    flex-shrink: 0;
}

.subscribe-sheet {
    max-width: min(1020px, 100%);
    margin-inline: auto;
}

.subscribe-block.forms {
    width: 100%;
}

.subscribe-form-stack {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-3);
}

.subscribe-field-aligned {
    display: grid;
    gap: var(--spacing-2);
}

@media (min-width: 640px) {
    .subscribe-field-aligned:not(.subscribe-terms) {
        grid-template-columns: minmax(140px, 200px) 1fr;
        align-items: start;
        column-gap: var(--spacing-4);
        row-gap: var(--spacing-2);
    }

    .page-subscribe .subscribe-field-aligned:not(.subscribe-terms) {
        grid-template-columns: minmax(160px, 240px) 1fr;
    }

    .subscribe-field-aligned .label {
        margin-top: 0.45rem;
    }

    .subscribe-field-aligned.subscribe-terms {
        grid-column: 1 / -1;
        padding-inline-start: min(40%, calc(140px + var(--spacing-4)));
    }
}
.subscribe-field-aligned .checkbox-line .label {
    margin-top: 0;
}

.input-wide,
.subscribe-field-aligned input[type='text']:not(#sub_captcha),
.subscribe-field-aligned select {
    width: 100%;
    max-width: 440px;
    box-sizing: border-box;
}

.page-subscribe .input-wide,
.page-subscribe .subscribe-field-aligned input[type='text']:not(#sub_captcha),
.page-subscribe .subscribe-field-aligned select {
    max-width: none;
}

.page-subscribe fieldset.subscribe-captcha-fieldset {
    max-width: min(560px, 100%);
}
.subscribe-captcha-block {
    margin-top: var(--spacing-2);
}

fieldset.subscribe-captcha-fieldset {
    border: 1px dashed var(--ring);
    border-radius: var(--radius-sm);
    padding: var(--spacing-3);
    margin: 0;
    max-width: 440px;
    box-sizing: border-box;
}

fieldset.subscribe-captcha-fieldset legend {
    padding-inline: 4px;
    margin-inline-end: 12px;
}

fieldset.subscribe-captcha-fieldset input#sub_captcha {
    margin-top: var(--spacing-2);
    width: 100%;
    max-width: 200px;
    box-sizing: border-box;
}

.subscribe-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: var(--spacing-2);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

html[dir='rtl'] .subscribe-actions {
    justify-content: flex-end;
}

.subscribe-pay-open-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-3);
    margin-top: var(--spacing-3);
}

html[dir='rtl'] .subscribe-pay-open-actions {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

/* Admin / sheet tables — column fit without overflow breaking layout */
table.sheet-table {
    width: 100%;
    table-layout: fixed;
    word-wrap: break-word;
}

table.sheet-table th,
table.sheet-table td {
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
}

table.sheet-table .col-pay-url {
    width: 40%;
}

/* Terms modal + full-page content */
.link-like-button {
    appearance: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--brand);
    text-decoration: underline;
    cursor: pointer;
    vertical-align: baseline;
    white-space: normal;
}

.link-like-button:hover {
    color: var(--brand-dark);
}

.link-like-button:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.terms-dialog {
    padding: 0;
    margin: auto;
    max-width: min(640px, 94vw);
    border: none;
    border-radius: var(--radius);
    background: transparent;
    box-shadow: none;
}

.terms-dialog::backdrop {
    background: rgba(10, 20, 40, 0.45);
}

.terms-dialog-panel {
    margin: 0;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.terms-dialog-header {
    flex-shrink: 0;
}

.terms-dialog-title {
    margin: 0 0 12px;
    font-size: 1.25rem;
}

.terms-dialog-scroll {
    overflow: auto;
    flex: 1;
    padding: 8px 0 12px;
    max-height: min(52vh, 420px);
}

.terms-dialog-footer {
    flex-shrink: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.prose-terms,
.prose-terms.full {
    font-size: 0.965rem;
    line-height: 1.65;
}

.terms-full-page {
    padding: 18px 20px;
}
