:root,
html[data-portal-theme="dark"] {
    --p-primary: #002347;
    --p-accent: #2a86ff;
    --p-purple: #6a11cb;
    --p-ink: #ffffff;
    --p-bg: #0a0e14;
    --p-surface: #151b23;
    --p-text: #ffffff;
    --p-muted: #b0b8c4;
    --p-line: rgba(255, 255, 255, 0.08);
    --p-danger: #fecdd3;
    --p-danger-bg: #3f1d29;
    --p-ok-bg: #12352b;
    --p-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
    --p-radius: 24px;
    --p-sidebar: 272px;
    --p-header: 84px;
    color-scheme: dark;
}

html[data-portal-theme="light"] {
    --p-bg: #f3f6fb;
    --p-surface: #ffffff;
    --p-text: #102033;
    --p-muted: #5c6b80;
    --p-line: rgba(0, 35, 71, 0.12);
    --p-danger: #9f1239;
    --p-danger-bg: #fff1f2;
    --p-ok-bg: #ecfdf5;
    --p-shadow: 0 18px 40px rgba(0, 35, 71, 0.08);
    color-scheme: light;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", "IBM Plex Sans Arabic", "Heebo", "Segoe UI", Tahoma, sans-serif;
    background:
        radial-gradient(circle at 100% 0, rgba(42, 134, 255, 0.16), transparent 32%),
        radial-gradient(circle at 0 18%, rgba(106, 17, 203, 0.16), transparent 28%),
        var(--p-bg);
    color: var(--p-text);
    line-height: 1.7;
}

html[lang="ar"] body {
    font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
}

html[lang="he"] body {
    font-family: "Heebo", "Segoe UI", Tahoma, sans-serif;
}

a { color: var(--p-accent); text-decoration: none; }
img { max-width: 100%; height: auto; }
button, input, summary { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--p-accent) 70%, white); outline-offset: 3px; }

.p-skip {
    position: absolute;
    inset-inline-start: 16px;
    top: -48px;
    z-index: 30;
    padding: 8px 12px;
    border-radius: 10px;
    background: var(--p-accent);
    color: #fff;
}
.p-skip:focus { top: 12px; }

.p-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.p-wrap { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }

.p-icon {
    width: 1.15rem;
    height: 1.15rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

.p-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    text-decoration: none;
}
.p-brand img {
    width: auto;
    height: 58px;
    object-fit: contain;
}
.p-brand--light { color: #fff; }

.p-kicker {
    display: inline-flex;
    align-items: center;
    margin: 0 0 14px;
    color: var(--p-accent);
    font-weight: 700;
    font-size: 0.92rem;
}

.p-btn, .p-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 700;
}
.p-btn { padding: 0 18px; background: rgba(255, 255, 255, 0.05); color: var(--p-text); border-color: var(--p-line); }
.p-btn--primary {
    background: linear-gradient(135deg, var(--p-accent), var(--p-purple));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(42, 134, 255, 0.28);
}
.p-btn--ghost { background: transparent; }
.p-btn--block { width: 100%; }
.p-icon-btn {
    width: 46px;
    padding: 0;
    border-radius: 999px;
    background: transparent;
    border-color: var(--p-line);
    color: var(--p-text);
}

html[data-portal-theme="dark"] .p-theme-light,
html[data-portal-theme="light"] .p-theme-dark { display: none; }

[dir="rtl"] .p-actions .p-btn--primary .p-icon { transform: scaleX(-1); }

.p-lead, .p-note, .p-empty, .p-muted { color: var(--p-muted); }
h1, h2, h3 { line-height: 1.25; font-weight: 800; }
.p-lead { font-size: 1.05rem; max-width: 62ch; }

.p-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.p-grid { display: grid; gap: 18px; }
.p-grid--2, .p-grid--3 { grid-template-columns: 1fr; }

.p-card, .p-auth-card, .p-panel, .p-dl div, .p-faq details {
    background: var(--p-surface);
    border: 1px solid var(--p-line);
    border-radius: var(--p-radius);
    box-shadow: var(--p-shadow);
}
.p-card, .p-auth-card, .p-panel { padding: 28px; }
.p-card h2, .p-card h3, .p-page-head h1, .p-prose h1, .p-section h1, .p-auth-card h1 { margin-top: 0; }
.p-card__icon {
    display: inline-flex;
    width: 48px;
    height: 48px;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    border-radius: 14px;
    color: var(--p-accent);
    background: rgba(42, 134, 255, 0.12);
}
.p-card--tile { min-height: 180px; }
@media (hover: hover) {
    .p-card { transition: transform 180ms ease, border-color 180ms ease; }
    .p-card:hover { transform: translateY(-8px); border-color: var(--p-accent); }
}

.p-alert {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--p-ok-bg);
}
.p-alert--error { background: var(--p-danger-bg); color: var(--p-danger); }

.p-dl { display: grid; gap: 12px; margin: 20px 0 0; }
.p-dl div { padding: 16px 18px; box-shadow: none; }
.p-dl dt { color: var(--p-muted); font-size: 0.82rem; }
.p-dl dd { margin: 4px 0 0; font-weight: 800; }

.p-faq details { margin-bottom: 10px; padding: 4px 18px; box-shadow: none; }
.p-faq summary { cursor: pointer; padding: 14px 0; font-weight: 800; }
.p-faq p { margin-top: 0; color: var(--p-muted); }

.p-plan { display: flex; flex-direction: column; min-height: 100%; padding: 32px; }
.p-plan__meter {
    margin: 0;
    font-size: clamp(2.4rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    color: var(--p-accent);
}
.p-plan__meter small { font-size: 0.38em; font-weight: 700; color: var(--p-muted); }
.p-plan .p-kicker { margin: 10px 0 0; }
.p-plan h2 { margin-bottom: 8px; font-size: 1.25rem; }
.p-plan__price {
    margin: 8px 0 4px;
    font-size: 2rem;
    font-weight: 800;
}
.p-plan ul { margin: auto 0 0; padding: 0; list-style: none; color: var(--p-muted); }
.p-plan li + li { margin-top: 8px; }

.site-header, .portal-header, .portal-auth-bar {
    position: sticky;
    top: 0;
    z-index: 5;
}
.site-header {
    background: rgba(10, 14, 20, 0.92);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
}
html[data-portal-theme="light"] .site-header {
    background: rgba(255, 255, 255, 0.92);
}
.site-header__bar, .portal-auth-bar, .portal-header, .site-footer__bar {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--p-header);
}
.site-header__bar { width: min(1120px, calc(100% - 32px)); margin-inline: auto; }
.site-nav { display: none; }
.site-nav a {
    color: var(--p-muted);
    text-decoration: none;
    font-weight: 700;
}
.site-nav a[aria-current="page"],
.site-nav a:hover { color: var(--p-accent); }
.site-header__tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.site-header__tools .p-btn { display: none; }

.site-menu { position: relative; }
.site-menu summary, .p-lang summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 46px;
    padding-inline: 8px;
    list-style: none;
    cursor: pointer;
}
.site-menu summary::-webkit-details-marker,
.p-lang summary::-webkit-details-marker { display: none; }
.site-menu__panel, .p-lang__menu {
    position: absolute;
    z-index: 8;
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--p-line);
    border-radius: 18px;
    background: var(--p-surface);
    box-shadow: var(--p-shadow);
}
.site-menu__panel { inset-inline-end: 0; top: calc(100% + 8px); display: grid; }
.site-menu__panel a, .p-lang__menu a, .p-lang__menu span {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}
.p-lang { position: relative; }
.p-lang__menu { inset-inline-end: 0; top: 100%; }

.p-hero { padding: 72px 0 28px; }
.p-hero__grid { display: grid; gap: 28px; align-items: center; }
.p-hero .p-kicker {
    padding: 6px 16px;
    border: 1px solid var(--p-accent);
    border-radius: 999px;
    background: rgba(42, 134, 255, 0.12);
}
.p-hero h1 {
    margin: 0 0 16px;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    max-width: 14ch;
}
.p-hero__visual { display: grid; place-items: center; min-height: 280px; }
.p-fiber {
    position: relative;
    display: grid;
    place-items: center;
    width: min(100%, 420px);
    aspect-ratio: 1;
}
.p-fiber__glow {
    position: absolute;
    width: 78%;
    height: 78%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(42, 134, 255, 0.55), transparent 68%);
    filter: blur(18px);
}
.p-fiber__logo {
    position: relative;
    width: min(78%, 340px);
    border-radius: 50%;
    filter: drop-shadow(0 0 28px rgba(42, 134, 255, 0.45));
}
.p-fiber__ring, .p-fiber__core {
    position: absolute;
    inset: 18%;
    border-radius: 50%;
    border: 1px solid rgba(42, 134, 255, 0.45);
}
.p-fiber__ring--mid { inset: 30%; }
.p-fiber__core {
    inset: 42%;
    border: 0;
    background: radial-gradient(circle, #fff, var(--p-accent) 42%, transparent 70%);
}

.p-section { padding: 28px 0 72px; }
.p-section__head { margin-bottom: 18px; }
.p-prose, .p-page-head { max-width: 68ch; }
.p-page-head h1, .p-section h1, .p-prose h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin-bottom: 8px; }
.p-panel { color: var(--p-muted); }
.p-panel p:first-child { margin-top: 0; }

.site-footer { padding: 12px 0 40px; }
.site-footer__bar {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
    justify-content: space-between;
    flex-wrap: wrap;
    color: var(--p-muted);
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: inherit; font-weight: 700; }

.portal-auth-body { min-height: 100vh; }
.auth-stage { min-height: 100vh; display: grid; }
.auth-aside {
    display: none;
    position: relative;
    padding: 36px;
    color: #fff;
    background:
        radial-gradient(420px 240px at 20% 16%, rgba(42, 134, 255, 0.35), transparent 60%),
        linear-gradient(165deg, #002347, #0a0e14 70%);
}
.auth-aside h2 { font-size: clamp(2rem, 4vw, 3.2rem); max-width: 12ch; }
.auth-aside__points { margin: 28px 0 0; padding: 0; list-style: none; }
.auth-aside__points li {
    margin-bottom: 12px;
    padding-inline-start: 16px;
    border-inline-start: 2px solid rgba(42, 134, 255, 0.7);
    color: #d5deea;
}
.auth-pane { display: flex; flex-direction: column; min-height: 100vh; }
.portal-auth-bar { padding-inline: 16px; background: transparent; }
.auth-pane__brand { display: inline-flex; }
.portal-auth-main {
    width: min(460px, calc(100% - 32px));
    margin: auto;
    padding: 12px 0 40px;
}
.p-form, .p-field { display: grid; gap: 8px; }
.p-form { margin-top: 18px; }
.p-auth-card input, .p-field input {
    width: 100%;
    min-height: 50px;
    border-radius: 12px;
    border: 1px solid var(--p-line);
    background: rgba(255, 255, 255, 0.04);
    padding: 0 14px;
    color: var(--p-text);
}
html[data-portal-theme="light"] .p-auth-card input,
html[data-portal-theme="light"] .p-field input { background: #f8f9fa; }
.p-auth-links { margin-bottom: 0; }
.portal-hp {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.portal-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 7;
    border: 0;
    background: rgba(5, 10, 18, 0.55);
}
body.portal-nav-open .portal-scrim { display: block; }

.portal-shell { min-height: 100vh; }
.portal-sidebar { display: none; }
.portal-header {
    margin: 12px 12px 0;
    padding-inline: 10px;
    border: 1px solid var(--p-line);
    border-radius: 18px;
    background: rgba(21, 27, 35, 0.92);
    backdrop-filter: blur(16px);
}
html[data-portal-theme="light"] .portal-header { background: rgba(255, 255, 255, 0.92); }
.portal-header__who { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.portal-header__who span { color: var(--p-muted); font-size: 0.82rem; }
.portal-content { width: min(980px, calc(100% - 28px)); margin: 22px auto 108px; }
.dash-hero {
    display: grid;
    gap: 16px;
    margin-bottom: 18px;
    padding: 28px;
    border-radius: 28px;
    color: #fff;
    background:
        radial-gradient(420px 180px at 100% 0, rgba(42, 134, 255, 0.35), transparent 60%),
        linear-gradient(145deg, #002347, #0a0e14);
    border: 1px solid rgba(42, 134, 255, 0.25);
}
.dash-hero h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 4vw, 2.8rem); }
.dash-hero p { margin: 0; color: #d5deea; }
.dash-hero .p-kicker { color: #8ec5ff; }
.dash-hero__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.p-status, .dash-hero__meta span {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(42, 134, 255, 0.16);
}

.portal-tabbar {
    position: fixed;
    z-index: 6;
    inset-inline: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px;
    border: 1px solid var(--p-line);
    border-radius: 18px;
    background: rgba(21, 27, 35, 0.94);
    box-shadow: var(--p-shadow);
    backdrop-filter: blur(16px);
}
html[data-portal-theme="light"] .portal-tabbar { background: rgba(255, 255, 255, 0.96); }
.portal-tabbar a, .portal-sidebar nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 2px;
    border-radius: 12px;
    color: var(--p-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
}
.portal-tabbar a[aria-current="page"] {
    color: #fff;
    background: linear-gradient(135deg, var(--p-accent), var(--p-purple));
}
.portal-sidebar nav a[aria-current="page"] {
    color: #fff;
    background: rgba(42, 134, 255, 0.18);
}
.portal-menu-btn { display: inline-flex; }

body.portal-nav-open .portal-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 8;
    inset-block: 10px;
    inset-inline-start: 10px;
    width: min(84vw, 320px);
    padding: 18px 14px;
    border-radius: 24px;
    background: var(--p-surface);
    box-shadow: var(--p-shadow);
}
body.portal-nav-open .portal-sidebar nav { display: grid; gap: 4px; }
body.portal-nav-open .portal-sidebar nav a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    padding: 11px 12px;
    font-size: 0.98rem;
}
.portal-sidebar__foot { display: grid; gap: 8px; margin-top: auto; padding-top: 12px; }
.portal-sidebar__foot a { color: var(--p-muted); font-weight: 700; text-decoration: none; }

@media (min-width: 900px) {
    .p-grid--2 { grid-template-columns: 1fr 1fr; }
    .p-grid--3 { grid-template-columns: repeat(3, 1fr); }
    .p-hero { padding: 96px 0 36px; }
    .p-hero__grid { grid-template-columns: 1.15fr 0.85fr; }
    .site-nav { display: flex; gap: 18px; margin-inline-start: 18px; }
    .site-menu, .portal-tabbar, .portal-menu-btn, .auth-pane__brand { display: none; }
    .site-header__tools .p-btn { display: inline-flex; border-radius: 999px; }
    .auth-stage { grid-template-columns: minmax(320px, 0.92fr) 1.08fr; }
    .auth-aside { display: flex; flex-direction: column; justify-content: space-between; }
    .portal-shell {
        display: grid;
        grid-template-columns: var(--p-sidebar) 1fr;
        gap: 8px;
        padding: 12px;
    }
    .portal-sidebar {
        display: flex;
        flex-direction: column;
        gap: 18px;
        position: sticky;
        top: 12px;
        height: calc(100vh - 24px);
        padding: 18px 14px;
        border: 1px solid var(--p-line);
        border-radius: 24px;
        background: var(--p-surface);
    }
    .portal-sidebar nav { display: grid; gap: 4px; }
    .portal-sidebar nav a {
        flex-direction: row;
        justify-content: flex-start;
        gap: 10px;
        padding: 11px 12px;
        font-size: 0.95rem;
    }
    .portal-header { margin: 0; }
    .portal-content { margin-bottom: 28px; }
    .dash-hero { grid-template-columns: 1fr auto; align-items: end; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; transition: none !important; }
}
