/* ==========================================================================
   Eradeghavii Editorial Design System (Warm Alabaster + Imperial Violet)
   File: public/assets/css/editorial-theme.css
   Zero-dependency standalone CSS layer for cPanel PHP production
   ========================================================================== */

:root {
    --ed-bg: #FAF9F6;
    --ed-surface: #FFFFFF;
    --ed-surface-soft: #F2EFE9;
    --ed-surface-tint: #F4F0FC;
    --ed-border: #E5E2DA;
    --ed-border-strong: #D4CFC4;
    --ed-border-accent: #DDD6FE;

    --ed-ink: #141413;
    --ed-body: #3D3D3A;
    --ed-muted: #6E6D68;
    --ed-subtle: #8C8B85;

    --ed-brand: #5B21B6;
    --ed-brand-hover: #4C1D95;
    --ed-brand-deep: #2E1065;
    --ed-brand-soft: #EDE9FE;

    --ed-ochre: #9A5B13;
    --ed-ochre-soft: #FEF3C7;
    --ed-ochre-border: #FDE68A;

    --ed-emerald: #047857;
    --ed-emerald-soft: #ECFDF5;
    --ed-emerald-border: #A7F3D0;

    --ed-danger: #B91C1C;
    --ed-danger-soft: #FEF2F2;
    --ed-danger-border: #FECACA;

    --ed-radius-sm: 0.625rem;
    --ed-radius-md: 0.875rem;
    --ed-radius-lg: 1.25rem;
    --ed-radius-xl: 1.5rem;
    --ed-radius-pill: 9999px;

    --ed-shadow-xs: 0 1px 2px rgba(20, 20, 19, 0.04);
    --ed-shadow-sm: 0 4px 14px -2px rgba(20, 20, 19, 0.05), 0 1px 3px rgba(20, 20, 19, 0.03);
    --ed-shadow-md: 0 14px 34px -8px rgba(20, 20, 19, 0.09), 0 4px 12px -2px rgba(20, 20, 19, 0.04);
    --ed-shadow-lg: 0 24px 56px -12px rgba(20, 20, 19, 0.14);

    --ed-font-fa: 'IRANYekanX', 'IRANYekan', system-ui, -apple-system, sans-serif;
    --ed-font-en: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Editorial Page Canvas */
html.ed-theme,
html.ed-theme *,
html.ed-theme *::before,
html.ed-theme *::after {
    box-sizing: border-box;
}

html.ed-theme,
html.ed-theme body {
    background-color: var(--ed-bg) !important;
    color: var(--ed-ink) !important;
    font-family: var(--ed-font-fa) !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    max-width: 100%;
    overflow-x: clip !important;
}

html.ed-theme[lang="en"],
html.ed-theme[lang="en"] body,
html.ed-theme[lang="en"] body *:not(i):not(svg):not(path) {
    font-family: var(--ed-font-en) !important;
}

html.ed-theme body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: clip !important;
    line-height: 1.75;
}

html.ed-theme main {
    max-width: 100%;
    overflow-x: clip;
}

html.ed-theme ::selection {
    background: var(--ed-brand-soft);
    color: var(--ed-brand-deep);
}

html.ed-theme [hidden],
html.ed-theme .hidden {
    display: none !important;
}

/* Strict Font Awesome 6 Protection inside Editorial Theme */
html.ed-theme i.fa,
html.ed-theme i.fas,
html.ed-theme i.far,
html.ed-theme i.fab,
html.ed-theme i.fa-solid,
html.ed-theme i.fa-regular,
html.ed-theme i.fa-brands,
html.ed-theme .fa,
html.ed-theme .fas,
html.ed-theme .far,
html.ed-theme .fab,
html.ed-theme .fa-solid,
html.ed-theme .fa-regular,
html.ed-theme .fa-brands,
html.ed-theme [class^="fa-"],
html.ed-theme [class*=" fa-"] {
    font-family: "Font Awesome 6 Free" !important;
    font-style: normal !important;
    font-weight: 900 !important;
}

html.ed-theme i.fa-regular,
html.ed-theme i.far,
html.ed-theme .fa-regular,
html.ed-theme .far {
    font-weight: 400 !important;
}

html.ed-theme i.fa-brands,
html.ed-theme i.fab,
html.ed-theme .fa-brands,
html.ed-theme .fab {
    font-family: "Font Awesome 6 Brands" !important;
    font-weight: 400 !important;
}

/* Editorial Scrollbar */
html.ed-theme ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
html.ed-theme ::-webkit-scrollbar-track {
    background: var(--ed-bg);
}
html.ed-theme ::-webkit-scrollbar-thumb {
    background: var(--ed-border-strong);
    border-radius: 9999px;
}
html.ed-theme ::-webkit-scrollbar-thumb:hover {
    background: var(--ed-subtle);
}

/* Layout Helpers */
.ed-container {
    width: 100%;
    max-width: 78rem; /* 1248px */
    margin-inline: auto;
    padding-inline: 1rem;
}
@media (min-width: 640px) {
    .ed-container {
        padding-inline: 1.5rem;
    }
}
@media (min-width: 1024px) {
    .ed-container {
        padding-inline: 2rem;
    }
}

.ed-container-narrow {
    width: 100%;
    max-width: 56rem;
    margin-inline: auto;
    padding-inline: 1rem;
}

.ed-section {
    padding-block: 4rem;
}
@media (min-width: 768px) {
    .ed-section {
        padding-block: 5.5rem;
    }
}

.ed-section-soft {
    background-color: var(--ed-surface-soft);
    border-block: 1px solid var(--ed-border);
}

.ed-section-white {
    background-color: var(--ed-surface);
    border-block: 1px solid var(--ed-border);
}

/* Typography Hierarchy */
.ed-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    border: none;
    color: var(--ed-brand);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.5;
    max-width: 100%;
    flex-wrap: wrap;
}
.ed-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--ed-radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.5;
    max-width: 100%;
    flex-wrap: wrap;
}

.ed-h1 {
    font-size: clamp(1.48rem, 3.6vw, 2.85rem);
    font-weight: 800 !important;
    line-height: 1.48;
    letter-spacing: 0;
    text-wrap: balance;
    color: var(--ed-ink);
}
@media (min-width: 768px) {
    .ed-h1 {
        line-height: 1.38;
    }
}

.ed-h2 {
    font-size: clamp(1.35rem, 2.6vw, 2.15rem);
    font-weight: 800;
    line-height: 1.42;
    letter-spacing: 0;
    text-wrap: balance;
    color: var(--ed-ink);
}

.ed-h3 {
    font-size: clamp(1.08rem, 1.8vw, 1.32rem);
    font-weight: 800;
    line-height: 1.48;
    letter-spacing: 0;
    color: var(--ed-ink);
}

.ed-lead {
    font-size: clamp(0.95rem, 1.3vw, 1.1rem);
    color: var(--ed-body);
    line-height: 1.9;
    letter-spacing: 0;
    font-weight: 400;
}

html[lang="en"] .ed-eyebrow {
    letter-spacing: -0.01em;
}
html[lang="en"] .ed-h1 {
    letter-spacing: -0.025em;
    line-height: 1.18;
}
html[lang="en"] .ed-h2 {
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.ed-muted {
    color: var(--ed-muted);
}

/* Buttons */
.ed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 0.9rem;
    line-height: 1.4;
    padding: 0.75rem 1.25rem;
    border-radius: var(--ed-radius-md);
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.15s ease;
    white-space: normal;
    text-align: center;
    max-width: 100%;
    min-width: 0;
}

.ed-btn:focus-visible {
    outline: 2px solid var(--ed-brand);
    outline-offset: 2px;
}

.ed-btn:active {
    transform: translateY(1px);
}

.ed-btn-sm {
    font-size: 0.8125rem;
    padding: 0.55rem 1rem;
    border-radius: var(--ed-radius-sm);
}

.ed-btn-lg {
    font-size: 0.92rem;
    padding: 0.9rem 1.25rem;
    border-radius: var(--ed-radius-md);
}
@media (min-width: 640px) {
    .ed-btn-lg {
        font-size: 0.98rem;
        padding: 0.95rem 1.65rem;
    }
}

.ed-btn-primary {
    background-color: var(--ed-brand);
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(91, 33, 182, 0.22);
}

.ed-btn-primary:hover {
    background-color: var(--ed-brand-hover);
    color: #FFFFFF !important;
    box-shadow: 0 8px 20px -4px rgba(91, 33, 182, 0.32);
}

.ed-btn-secondary {
    background-color: var(--ed-surface);
    color: var(--ed-ink) !important;
    border-color: var(--ed-border-strong);
    box-shadow: var(--ed-shadow-xs);
}

.ed-btn-secondary:hover {
    background-color: var(--ed-surface-soft);
    border-color: var(--ed-ink);
    color: var(--ed-ink) !important;
}

.ed-btn-ghost {
    background-color: transparent;
    color: var(--ed-body) !important;
    padding-inline: 0.75rem;
}

.ed-btn-ghost:hover {
    background-color: var(--ed-surface-soft);
    color: var(--ed-ink) !important;
}

.ed-btn-admin {
    background-color: var(--ed-ochre-soft);
    border-color: var(--ed-ochre-border);
    color: var(--ed-ochre) !important;
}

.ed-btn-admin:hover {
    background-color: #FDE68A;
    color: #78350F !important;
}

/* Cards */
.ed-card {
    background-color: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: 0.95rem;
    box-shadow: var(--ed-shadow-xs);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    max-width: 100%;
    min-width: 0;
}

.ed-card-hover:hover {
    border-color: var(--ed-border-strong);
    box-shadow: var(--ed-shadow-md);
}

.ed-card-soft {
    background-color: var(--ed-surface-soft);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-lg);
}

.ed-card-tint {
    background-color: var(--ed-surface-tint);
    border: 1px solid var(--ed-border-accent);
    border-radius: var(--ed-radius-lg);
}

.ed-callout-ochre {
    background-color: var(--ed-ochre-soft);
    border: 1px solid var(--ed-ochre-border);
    color: #78350F;
    border-radius: var(--ed-radius-md);
    padding: 1rem 1.25rem;
}

/* ==========================================================================
   TOP BAR & EDITORIAL HEADER (views/header.php)
   ========================================================================== */
.ed-topbar {
    background-color: var(--ed-brand-deep);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.76rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ed-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-block: 0.5rem;
    flex-wrap: wrap;
}

.ed-topbar-note {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.9);
}

.ed-topbar-link {
    color: #DDD6FE !important;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 600;
    transition: color 0.15s ease;
}

.ed-topbar-link:hover {
    color: #FFFFFF !important;
}

.ed-header {
    position: sticky;
    top: 0;
    z-index: 60;
    background-color: rgba(250, 249, 246, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--ed-border);
}

.ed-header-inner {
    height: 4.15rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ed-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--ed-ink) !important;
    flex-shrink: 0;
}

.ed-brand-logo-wrap {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.75rem;
    background-color: #141413;
    border: 1px solid rgba(20, 20, 19, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    box-shadow: var(--ed-shadow-xs);
    flex-shrink: 0;
}

.ed-brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ed-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.ed-brand-title {
    font-size: 1.05rem;
    font-weight: 900;
    color: var(--ed-ink);
    letter-spacing: -0.02em;
}

.ed-brand-sub {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--ed-muted);
    display: none;
}
@media (min-width: 640px) {
    .ed-brand-sub {
        display: block;
    }
}

.ed-nav {
    display: none;
    align-items: center;
    gap: 0.35rem;
}
@media (min-width: 960px) {
    .ed-nav {
        display: flex;
    }
}

.ed-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.85rem;
    border-radius: var(--ed-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ed-body) !important;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ed-nav-link:hover {
    background-color: var(--ed-surface-soft);
    color: var(--ed-ink) !important;
}

.ed-nav-link.is-active {
    background-color: var(--ed-surface-tint);
    color: var(--ed-brand) !important;
    font-weight: 700;
}

.ed-nav-link.is-vip {
    color: var(--ed-emerald) !important;
}

.ed-header-actions {
    display: none;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
@media (min-width: 960px) {
    .ed-header-actions {
        display: flex;
    }
}

.ed-lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.35rem;
    height: 2.25rem;
    padding-inline: 0.6rem;
    border-radius: var(--ed-radius-sm);
    border: 1px solid var(--ed-border-strong);
    background-color: var(--ed-surface);
    color: var(--ed-body) !important;
    font-size: 0.75rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.03em;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.ed-lang-pill:hover {
    border-color: var(--ed-brand);
    color: var(--ed-brand) !important;
    background-color: var(--ed-surface-tint);
}

.ed-mobile-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--ed-radius-sm);
    border: 1px solid var(--ed-border-strong);
    background-color: var(--ed-surface);
    color: var(--ed-ink);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.ed-mobile-trigger:hover {
    background-color: var(--ed-surface-soft);
}

@media (min-width: 960px) {
    .ed-mobile-trigger {
        display: none !important;
    }
}

/* Mobile Slide Drawer (Zero utility-cascade conflicts) */
.ed-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background-color: rgba(20, 20, 19, 0.45);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0.22s ease;
}

.ed-drawer-backdrop[data-open="true"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.ed-drawer-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    z-index: 95;
    width: min(86vw, 20.5rem);
    background-color: var(--ed-surface);
    border-inline-end: 1px solid var(--ed-border);
    box-shadow: var(--ed-shadow-lg);
    display: flex;
    flex-direction: column;
    overscroll-behavior: contain;
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.26s ease;
}

/* RTL (Default / Persian) - Slides from Right */
html[dir="rtl"] .ed-drawer-panel,
html:not([dir="ltr"]) .ed-drawer-panel {
    right: 0 !important;
    left: auto !important;
    border-left: 1px solid var(--ed-border);
    border-right: none;
    transform: translateX(105%);
}

html[dir="rtl"] .ed-drawer-panel[data-open="true"],
html:not([dir="ltr"]) .ed-drawer-panel[data-open="true"] {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

/* LTR (English) - Slides cleanly from Left */
html[dir="ltr"] .ed-drawer-panel {
    left: 0 !important;
    right: auto !important;
    border-right: 1px solid var(--ed-border);
    border-left: none;
    transform: translateX(-105%);
}

html[dir="ltr"] .ed-drawer-panel[data-open="true"] {
    transform: translateX(0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.ed-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--ed-border);
}

.ed-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.ed-drawer-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.78rem 0.9rem;
    border-radius: var(--ed-radius-sm);
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--ed-ink) !important;
    text-decoration: none;
    transition: background-color 0.15s ease;
}

.ed-drawer-link:hover,
.ed-drawer-link.is-active {
    background-color: var(--ed-surface-tint);
    color: var(--ed-brand) !important;
}

.ed-drawer-foot {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--ed-border);
    background-color: var(--ed-bg);
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

/* ==========================================================================
   EDITORIAL FOOTER (views/footer.php)
   ========================================================================== */
.ed-footer {
    margin-top: auto;
    background-color: var(--ed-surface-soft);
    border-top: 1px solid var(--ed-border);
    color: var(--ed-body);
    padding-top: 4rem;
    padding-bottom: 2.5rem;
}

.ed-footer-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2.5rem;
    margin-bottom: 3rem;
}
.ed-footer-grid > * {
    min-width: 0;
}
@media (min-width: 768px) {
    .ed-footer-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (min-width: 1024px) {
    .ed-footer-grid {
        grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, 0.85fr) minmax(0, 1.15fr);
        gap: 2.25rem;
    }
}

.ed-footer-heading {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--ed-ink);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ed-footer-heading::before {
    content: "";
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background-color: var(--ed-brand);
    flex-shrink: 0;
}

.ed-footer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ed-footer-list a {
    color: var(--ed-body) !important;
    font-size: 0.86rem;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.ed-footer-list a:hover {
    color: var(--ed-brand) !important;
}

.ed-footer-trust-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: var(--ed-radius-pill);
    background-color: var(--ed-emerald-soft);
    border: 1px solid var(--ed-emerald-border);
    color: var(--ed-emerald);
    font-size: 0.78rem;
    font-weight: 700;
}

.ed-footer-support-card {
    background-color: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-lg);
    padding: 1.25rem;
    box-shadow: var(--ed-shadow-xs);
}

.ed-footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid var(--ed-border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--ed-muted);
    text-align: center;
}
@media (min-width: 640px) {
    .ed-footer-bottom {
        flex-direction: row;
        text-align: start;
    }
}

/* ==========================================================================
   ACCESSIBLE NATIVE ACCORDION (<details>) & MODAL (<dialog>)
   ========================================================================== */
.ed-accordion {
    background-color: var(--ed-surface);
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-md);
    overflow: hidden;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.ed-accordion[open] {
    border-color: var(--ed-border-accent);
    box-shadow: var(--ed-shadow-sm);
}

.ed-accordion summary {
    list-style: none;
    cursor: pointer;
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-weight: 700;
    font-size: 0.96rem;
    color: var(--ed-ink);
    user-select: none;
}

.ed-accordion summary::-webkit-details-marker {
    display: none;
}

.ed-accordion summary .ed-acc-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 9999px;
    background-color: var(--ed-surface-soft);
    color: var(--ed-brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    transition: transform 0.22s ease, background-color 0.2s ease;
}

.ed-accordion[open] summary .ed-acc-icon {
    transform: rotate(180deg);
    background-color: var(--ed-surface-tint);
}

.ed-accordion-body {
    padding: 0 1.25rem 1.25rem;
    color: var(--ed-body);
    font-size: 0.9rem;
    line-height: 1.85;
    border-top: 1px solid var(--ed-border);
    padding-top: 1rem;
}

@supports (interpolate-size: allow-keywords) {
    .ed-accordion {
        interpolate-size: allow-keywords;
    }
    .ed-accordion::details-content {
        transition: block-size 0.26s ease, opacity 0.22s ease, content-visibility 0.26s allow-discrete;
        block-size: 0;
        opacity: 0;
        overflow: clip;
    }
    .ed-accordion[open]::details-content {
        block-size: auto;
        opacity: 1;
    }
}

/* Native Dialog with Scroll Containment */
dialog.ed-dialog {
    padding: 0;
    border: 1px solid var(--ed-border);
    border-radius: var(--ed-radius-xl);
    background-color: var(--ed-surface);
    color: var(--ed-ink);
    width: min(92vw, 32rem);
    max-height: 88dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: var(--ed-shadow-lg);
    margin: auto;
}

dialog.ed-dialog::backdrop {
    background-color: rgba(20, 20, 19, 0.52);
    backdrop-filter: blur(6px);
}

/* ==========================================================================
   APP SHELL EDITORIAL OVERRIDES (app/header.php & app/footer.php)
   Active when $use_editorial_theme = true on /app/* pages
   ========================================================================== */
html.ed-theme.ed-app-shell body {
    background-color: var(--ed-bg) !important;
    color: var(--ed-ink) !important;
}

html.ed-theme.ed-app-shell .app-header-bar {
    background: rgba(250, 249, 246, 0.94) !important;
    border-bottom: 1px solid var(--ed-border) !important;
    box-shadow: none !important;
}

html.ed-theme.ed-app-shell .app-brand-name {
    color: var(--ed-ink) !important;
}

html.ed-theme.ed-app-shell .app-vip-badge {
    background: var(--ed-surface-tint) !important;
    border: 1px solid var(--ed-border-accent) !important;
    color: var(--ed-brand) !important;
}

html.ed-theme.ed-app-shell .app-nav-link {
    color: var(--ed-body) !important;
}

html.ed-theme.ed-app-shell .app-nav-link:hover {
    background: var(--ed-surface-soft) !important;
    color: var(--ed-ink) !important;
}

html.ed-theme.ed-app-shell .app-nav-link.is-active {
    background: var(--ed-surface-tint) !important;
    color: var(--ed-brand) !important;
    font-weight: 800 !important;
}

html.ed-theme.ed-app-shell .app-user-pill {
    background: var(--ed-surface) !important;
    border: 1px solid var(--ed-border-strong) !important;
    color: var(--ed-ink) !important;
}

html.ed-theme.ed-app-shell .app-user-avatar {
    background: var(--ed-surface-tint) !important;
    color: var(--ed-brand) !important;
}

html.ed-theme.ed-app-shell .user-dropdown-menu {
    background: var(--ed-surface) !important;
    border: 1px solid var(--ed-border) !important;
    box-shadow: var(--ed-shadow-lg) !important;
}

html.ed-theme.ed-app-shell .app-bottom-nav {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid var(--ed-border) !important;
    box-shadow: var(--ed-shadow-md) !important;
}

html.ed-theme.ed-app-shell .app-nav-item:not(.is-active) {
    color: var(--ed-muted) !important;
}

html.ed-theme.ed-app-shell .app-nav-item.is-active {
    background: var(--ed-surface-tint) !important;
    color: var(--ed-brand) !important;
}

/* ==========================================================================
   EDITORIAL AUTH LAYOUT — Skill-Backed Mobile-First + Desktop Precision
   (modern-web-guidance + ui-ux-pro-max + WCAG 2.2 AA)
   ========================================================================== */
html.ed-theme {
    color-scheme: light;
}

.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

/* Autofill styling with non-color inset ring indicator + zero layout shift */
html.ed-theme input:is(:autofill, :-webkit-autofill) {
    box-shadow:
        inset 0 0 0 2px rgba(91, 33, 182, 0.35),
        inset 0 0 0 100vmax #FFFFFF !important;
    border-color: #5B21B6 !important;
    -webkit-text-fill-color: #111111 !important;
    caret-color: #111111 !important;
}
html.ed-theme input:is(:autofill, :-webkit-autofill):focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 2px;
}

.ed-auth-page {
    min-height: 100dvh;
    background-color: #FFFFFF;
    display: flex;
    flex-direction: column;
    overscroll-behavior-y: contain;
}
@media (min-width: 640px) {
    .ed-auth-page {
        background-color: #F9F9FB;
    }
}

.ed-auth-nav {
    width: 100%;
    max-width: 72rem;
    margin-inline: auto;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    border-bottom: 1px solid #F1F1F3;
}
@media (min-width: 640px) {
    .ed-auth-nav {
        padding: 1.75rem 2.5rem 0;
        border-bottom: none;
    }
}

.ed-auth-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 0.85rem;
    border-radius: 0.625rem;
    font-size: 0.84rem;
    font-weight: 600;
    color: #52525B !important;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.18s ease, background-color 0.18s ease;
}
.ed-auth-back:hover {
    color: #111111 !important;
    background-color: #EFEFF2;
}
.ed-auth-back:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 2px;
}

/* Mobile-first: top-aligned so virtual keyboard never obstructs submit CTA */
.ed-auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.5rem 1.25rem 2.5rem;
}
@media (min-width: 640px) {
    .ed-auth-main {
        justify-content: center;
        padding: 2rem 1.5rem 4rem;
    }
}

.ed-auth-wrap {
    width: 100%;
    max-width: 26.25rem; /* 420px */
    margin-inline: auto;
    min-width: 0;
}

/* Mobile: native borderless flow; Desktop: crisp elevated card */
.ed-auth-card {
    width: 100%;
    background-color: #FFFFFF;
    border: none;
    border-radius: 0;
    padding: 0;
}
@media (min-width: 640px) {
    .ed-auth-card {
        border: 1px solid #E4E4E7;
        border-radius: 1.125rem;
        padding: 2.35rem 2.15rem;
        box-shadow:
            0 1px 2px rgba(17, 17, 17, 0.03),
            0 20px 44px -24px rgba(17, 17, 17, 0.12);
    }
}

.ed-auth-head {
    margin-bottom: 1.5rem;
    text-align: right;
}

.ed-auth-title {
    font-size: 1.375rem;
    font-weight: 800;
    color: #111111;
    letter-spacing: -0.02em;
    line-height: 1.38;
    margin: 0 0 0.4rem;
}

.ed-auth-subtitle {
    font-size: 0.875rem;
    color: #52525B; /* 7.4:1 WCAG AAA contrast on white */
    margin: 0;
    line-height: 1.65;
}

/* Pure Typography Accessible Underline Tabs (>=44px touch height) */
.ed-auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 1px solid #E4E4E7;
    margin-bottom: 1.5rem;
    gap: 0.5rem;
}
.ed-auth-tab {
    min-height: 46px;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    color: #52525B;
    padding: 0.65rem 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
    text-align: center;
    min-width: 0;
}
.ed-auth-tab:hover {
    color: #111111;
}
.ed-auth-tab.is-active {
    color: #111111;
    font-weight: 800;
    border-bottom-color: #5B21B6;
}
.ed-auth-tab:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: -2px;
    border-radius: 0.35rem 0.35rem 0 0;
}

.ed-auth-field {
    margin-bottom: 1.25rem;
}
.ed-auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.ed-auth-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 700;
    color: #18181B;
    margin-bottom: 0.35rem;
}
.ed-auth-label-row .ed-auth-label {
    margin-bottom: 0;
}

/* Hints placed ABOVE input so mobile keyboard / autofill popover never hides them */
.ed-auth-hint-above {
    display: block;
    font-size: 0.78rem;
    color: #52525B;
    margin: 0 0 0.5rem;
    line-height: 1.55;
}

.ed-auth-input-wrap {
    position: relative;
}

/* 16px (1rem) font-size prevents iOS Safari auto-zoom on input focus */
.ed-auth-input {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    background-color: #FFFFFF;
    color: #111111;
    border: 1px solid #D4D4D8;
    border-radius: 0.65rem;
    padding: 0.65rem 0.95rem;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}
.ed-auth-input::placeholder {
    color: #71717A;
    font-weight: 400;
}
.ed-auth-input:hover {
    border-color: #A1A1AA;
}
.ed-auth-input:focus {
    outline: none;
    border-color: #5B21B6;
    box-shadow: 0 0 0 3px rgba(91, 33, 182, 0.14);
}
.ed-auth-input:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 1px;
}

/* Validate-after-interaction (:user-invalid / :user-valid + fallback) */
.ed-auth-input:is(:user-invalid, .user-invalid-fallback) {
    border-color: #B91C1C;
    background-color: #FEF2F2;
}
.ed-auth-input:is(:user-valid, .user-valid-fallback) {
    border-color: #15803D;
}

.ed-field-error {
    display: none;
    color: #B91C1C;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 0.4rem;
    line-height: 1.55;
}
.ed-auth-field:has(.ed-auth-input:is(:user-invalid, .user-invalid-fallback)) .ed-field-error {
    display: block;
}

.ed-auth-input.has-toggle-text {
    padding-right: 4.4rem;
}

.ed-auth-toggle-text {
    position: absolute;
    top: 50%;
    right: 0.35rem;
    transform: translateY(-50%);
    min-width: 44px;
    min-height: 40px;
    border: none;
    background: transparent;
    color: #52525B;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0 0.55rem;
    border-radius: 0.45rem;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.ed-auth-toggle-text:hover {
    color: #111111;
    background-color: #F4F4F5;
}
.ed-auth-toggle-text:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 1px;
}

.ed-auth-otp {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace !important;
    text-align: center;
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: 0.4em;
    min-height: 54px;
    font-variant-numeric: tabular-nums;
}

.ed-auth-submit {
    width: 100%;
    min-height: 48px;
    border-radius: 0.65rem;
    background-color: #5B21B6;
    color: #FFFFFF !important;
    font-size: 0.9375rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    padding: 0.7rem 1rem;
    transition: background-color 0.18s ease, opacity 0.18s ease;
}
.ed-auth-submit:hover:not(:disabled) {
    background-color: #4C1D95;
}
.ed-auth-submit:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 2px;
}
.ed-auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ed-auth-alt-btn {
    width: 100%;
    min-height: 46px;
    margin-top: 0.7rem;
    border-radius: 0.65rem;
    background-color: #FFFFFF;
    border: 1px solid #D4D4D8;
    color: #27272A;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.65rem 1rem;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.ed-auth-alt-btn:hover:not(:disabled) {
    background-color: #F4F4F5;
    border-color: #A1A1AA;
    color: #111111;
}
.ed-auth-alt-btn:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 2px;
}
.ed-auth-alt-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.ed-auth-alert {
    padding: 0.8rem 0.95rem;
    border-radius: 0.65rem;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.65;
    margin-bottom: 1.25rem;
}
.ed-auth-alert-error {
    background-color: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
}
.ed-auth-alert-success {
    background-color: #F0FDF4;
    border: 1px solid #BBF7D0;
    color: #166534;
}

.ed-auth-link {
    color: #5B21B6 !important;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0.35rem;
    padding: 0.15rem 0.25rem;
}
.ed-auth-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.ed-auth-link:focus-visible {
    outline: 2px solid #5B21B6;
    outline-offset: 2px;
}

.ed-auth-switch-link {
    margin-top: 1.4rem;
    padding-top: 1.25rem;
    border-top: 1px solid #EAEAEA;
    text-align: center;
    font-size: 0.84rem;
    color: #52525B;
}

.ed-auth-footnote {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.78rem;
    color: #52525B; /* WCAG AA compliant >= 4.5:1 */
    line-height: 1.7;
}

/* Reduced Motion Respect */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}