:root {
    --wa-green: #005940;
    --wa-green-dark: #003f2e;
    --wa-green-soft: #eaf5f1;
    --wa-mint: #9be3ca;
    --wa-ink: #13231e;
    --wa-muted: #66756f;
    --wa-line: #dce7e2;
    --wa-surface: #ffffff;
    --wa-radius: 18px;
    --wa-safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { scroll-behavior: smooth; scroll-padding-top: 86px; }
body { overflow-x: hidden; }
body.wa-drawer-open { overflow: hidden; touch-action: none; }
img { max-width: 100%; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, [role="button"], a { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }

.wa-visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.wa-skip-link {
    position: fixed;
    z-index: 99999;
    top: 10px;
    right: 12px;
    padding: 11px 16px;
    border-radius: 10px;
    color: #fff;
    background: var(--wa-green);
    transform: translateY(-150%);
}
.wa-skip-link:focus { transform: translateY(0); }

/* Mobile site drawer */
.wa-mobile-overlay {
    position: fixed;
    inset: 0;
    z-index: 8000;
    display: block;
    background: rgba(4, 24, 17, .55);
    opacity: 0;
    visibility: hidden;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    transition: opacity .25s ease, visibility .25s ease;
}
.wa-mobile-overlay[hidden] { display: block; }
.wa-mobile-overlay.is-open { opacity: 1; visibility: visible; }
.wa-mobile-drawer {
    position: fixed;
    z-index: 8010;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(88vw, 380px);
    padding: max(20px, env(safe-area-inset-top)) 18px calc(24px + var(--wa-safe-bottom));
    background: #fff;
    box-shadow: -20px 0 60px rgba(0, 47, 33, .24);
    overflow-y: auto;
    transform: translateX(105%);
    visibility: hidden;
    transition: transform .3s cubic-bezier(.2,.8,.2,1), visibility .3s;
}
.wa-mobile-drawer.is-open { transform: translateX(0); visibility: visible; }
.wa-drawer-head, .wa-drawer-brand, .wa-drawer-actions, .wa-drawer-contact { display: flex; }
.wa-drawer-head { align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 18px; border-bottom: 1px solid var(--wa-line); }
.wa-drawer-brand { align-items: center; gap: 11px; color: var(--wa-ink); text-decoration: none; }
.wa-drawer-brand img { flex: 0 0 44px; width: 44px; height: 44px; object-fit: contain; }
.wa-drawer-brand span { display: grid; gap: 2px; }
.wa-drawer-brand b { font-size: 15px; }
.wa-drawer-brand small { color: var(--wa-muted); font-size: 10.5px; }
.wa-drawer-close, .wa-mobile-menu-button, .site-navbar .nav-burger {
    display: inline-grid;
    width: 44px;
    height: 44px;
    min-width: 44px;
    place-items: center;
    border: 1px solid var(--wa-line);
    border-radius: 13px;
    color: var(--wa-green);
    background: #fff;
    cursor: pointer;
}
.wa-drawer-links { display: grid; gap: 6px; padding: 18px 0; }
.wa-drawer-links a {
    display: flex;
    min-height: 50px;
    align-items: center;
    gap: 13px;
    padding: 10px 13px;
    border-radius: 13px;
    color: var(--wa-ink);
    text-decoration: none;
    font-weight: 700;
}
.wa-drawer-links a i { width: 22px; color: var(--wa-green); text-align: center; }
.wa-drawer-links a[aria-current="page"] { color: var(--wa-green); background: var(--wa-green-soft); }
.wa-drawer-actions { flex-direction: column; gap: 10px; }
.wa-drawer-actions a { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 9px; border-radius: 13px; text-decoration: none; font-weight: 800; }
.wa-primary-action { color: #fff; background: var(--wa-green); box-shadow: 0 10px 24px rgba(0, 89, 64, .22); }
.wa-secondary-action { color: var(--wa-green); border: 1px solid var(--wa-green); }
.wa-drawer-contact { flex-direction: column; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--wa-line); }
.wa-drawer-contact a { display: flex; min-height: 38px; align-items: center; gap: 10px; color: var(--wa-muted); text-decoration: none; direction: ltr; justify-content: flex-end; }

/* App-like bottom navigation */
.wa-bottom-nav, .wa-panel-bottom-nav { display: none; }

/* Semantic homepage hero additions */
.hero-kicker, .hero-lead, .hero-actions, .hero-benefits, .hero-title-mobile { display: none; }
.wa-noscript-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.js .wa-noscript-grid { display: none; }
.wa-noscript-card { display: block; padding: 22px; border: 1px solid var(--wa-line); border-radius: var(--wa-radius); color: var(--wa-ink); background: #fff; text-decoration: none; }
.wa-noscript-card h3 { margin: 0 0 8px; font-size: 18px; }
.wa-noscript-card p { margin: 0; color: var(--wa-muted); line-height: 1.9; }
.wa-carousel-controls { display: none; }

@media (max-width: 1023px) {
    body { padding-bottom: calc(72px + var(--wa-safe-bottom)); }

    .site-navbar {
        display: flex !important;
        height: 68px !important;
        transform: translateY(0) !important;
        background: rgba(255,255,255,.96) !important;
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
    }
    .site-navbar .nav-container { width: 100%; min-height: 68px; padding-inline: clamp(14px, 3vw, 28px); gap: 10px; }
    .site-navbar .nav-menu { display: none !important; }
    .site-navbar .nav-logo { order: 1; margin-inline-end: 0; min-width: 0; }
    .site-navbar .nav-logo > img, .site-navbar .nav-logo-mark img { width: 42px !important; height: 42px !important; }
    .site-navbar .nav-logo span:last-child { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
    .site-navbar .nav-actions { order: 2; margin-inline-start: auto; gap: 7px !important; }
    .site-navbar .search-btn, .site-navbar .nav-burger, .wa-mobile-menu-button { min-width: 44px; width: 44px; height: 44px; }
    .site-navbar .btn-project, .site-navbar .btn-login { min-height: 44px; align-items: center; }

    .wa-bottom-nav, .wa-panel-bottom-nav {
        position: fixed;
        z-index: 5000;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        min-height: calc(64px + var(--wa-safe-bottom));
        padding: 6px max(8px, env(safe-area-inset-left)) var(--wa-safe-bottom) max(8px, env(safe-area-inset-right));
        border-top: 1px solid rgba(0, 89, 64, .14);
        background: rgba(255,255,255,.97);
        box-shadow: 0 -9px 30px rgba(0, 58, 41, .09);
        -webkit-backdrop-filter: blur(14px);
        backdrop-filter: blur(14px);
    }
    .wa-bottom-nav a, .wa-panel-bottom-nav a {
        display: flex;
        min-width: 0;
        min-height: 54px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        border-radius: 12px;
        color: #6c7b76;
        text-decoration: none;
        font-size: 10px;
        font-weight: 700;
    }
    .wa-bottom-nav a i, .wa-panel-bottom-nav a i { font-size: 18px; }
    .wa-bottom-nav a[aria-current="page"], .wa-panel-bottom-nav a[aria-current="page"] { color: var(--wa-green); background: var(--wa-green-soft); }

    .section { padding: 64px 0 !important; }
    .container { width: min(100% - 36px, 1180px) !important; }
    .section-head { margin-bottom: 30px !important; }
    .section-title { font-size: clamp(25px, 4.4vw, 36px) !important; line-height: 1.45 !important; }
    .section-sub { line-height: 1.95 !important; }

    .slider-arrow { width: 46px !important; height: 46px !important; }
    .carousel-dots button, .carousel-dots .dot { min-width: 34px; min-height: 34px; background-clip: content-box !important; padding: 11px !important; }
    .gallery-caption { opacity: 1 !important; transform: none !important; }

    .achievements-grid, .team-grid, .gallery-grid, .shared-team-grid {
        display: grid !important;
        grid-auto-flow: column;
        grid-auto-columns: minmax(260px, 72vw);
        grid-template-columns: none !important;
        gap: 16px !important;
        overflow-x: auto;
        overscroll-behavior-inline: contain;
        scroll-snap-type: inline mandatory;
        scrollbar-width: none;
        padding: 4px 2px 14px;
    }
    .achievements-grid::-webkit-scrollbar, .team-grid::-webkit-scrollbar, .gallery-grid::-webkit-scrollbar, .shared-team-grid::-webkit-scrollbar { display: none; }
    .achievement-card, .team-card, .gallery-item, .shared-team-grid > * { scroll-snap-align: start; }

    /* User panel */
    .admin-layout .content { padding-bottom: 96px !important; }
    .admin-layout .topbar { height: 68px; }
    .admin-layout .main-area { min-width: 0; }
    .admin-layout .menu-toggle { width: 44px; height: 44px; }
    .admin-layout .table-wrap { overflow: visible; }
    .admin-layout .sb-overlay {
        pointer-events: none;
        visibility: hidden;
    }
    .admin-layout .sb-overlay.show {
        pointer-events: auto;
        visibility: visible;
    }
    .admin-layout .tb-icon-btn, .admin-layout .tb-profile { min-width: 44px; min-height: 44px; }
    body.panel-sidebar-open { overflow: hidden; }
    body.panel-sidebar-open .wa-panel-bottom-nav { z-index: 80; opacity: .25; pointer-events: none; }

    .wa-section-carousel { position: relative; }
    .wa-carousel-controls {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 12px;
        margin-top: 14px;
        direction: ltr;
    }
    .wa-carousel-button {
        display: inline-grid;
        width: 44px;
        height: 44px;
        place-items: center;
        border: 1px solid var(--wa-line);
        border-radius: 13px;
        color: var(--wa-green);
        background: #fff;
        box-shadow: 0 7px 18px rgba(0, 70, 49, .08);
        cursor: pointer;
    }
    .wa-carousel-button:disabled { opacity: .35; cursor: default; }
    .wa-carousel-status {
        min-width: 76px;
        color: var(--wa-muted);
        font-size: 12px;
        font-weight: 800;
        text-align: center;
        direction: rtl;
    }
}

@media (min-width: 721px) and (max-width: 1023px) {
    .wa-bottom-nav, .wa-panel-bottom-nav { right: 50%; left: auto; width: min(680px, calc(100% - 40px)); transform: translateX(50%); bottom: 12px; border: 1px solid var(--wa-line); border-radius: 20px; padding-bottom: 6px; }
    .hero { min-height: 720px !important; }
    .hero-sidebar { left: 28px !important; width: 320px !important; }
    .hero-content { left: 380px !important; }
    .stats-bar { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 720px) {
    .site-navbar .btn-project { display: none !important; }
    .site-navbar .btn-login { padding: 9px 12px; font-size: 12px; }
    .site-navbar .nav-logo span:last-child { max-width: 92px; }

    .hero {
        display: flex !important;
        min-height: min(780px, 100svh) !important;
        align-items: flex-end;
        padding: 100px 18px 32px !important;
        overflow: hidden;
    }
    .hero-bg { background-position: 62% center !important; animation: none !important; }
    .hero-overlay { background: linear-gradient(180deg, rgba(0,35,25,.28), rgba(0,35,25,.88)) !important; }
    .hero-sidebar, .hero-vertical-text, .hero-title-line, .hero-date-bar { display: none !important; }
    .hero-content {
        position: relative !important;
        z-index: 5;
        inset: auto !important;
        width: 100%;
        padding: 24px;
        direction: rtl !important;
        text-align: right;
        border: 1px solid rgba(255,255,255,.18);
        border-radius: 24px;
        background: rgba(0,55,40,.64);
        box-shadow: 0 24px 70px rgba(0,0,0,.25);
        -webkit-backdrop-filter: blur(12px);
        backdrop-filter: blur(12px);
    }
    .hero-content h1 { margin: 8px 0 10px !important; font-family: Vazirmatn, sans-serif !important; font-size: clamp(30px, 9vw, 43px) !important; font-weight: 900 !important; line-height: 1.35 !important; letter-spacing: -.8px !important; }
    .hero-brand-latin { display: none; }
    .hero-title-mobile { display: inline; }
    .hero-content h2 { display: none; }
    .hero-main-link { color: #fff; }
    .hero-kicker { display: inline-flex; align-items: center; gap: 7px; color: var(--wa-mint); font-size: 12px; font-weight: 800; }
    .hero-kicker::before { content: ''; width: 20px; height: 2px; background: currentColor; }
    .hero-lead { display: block; margin: 0; color: rgba(255,255,255,.87); font-size: 14px; line-height: 2; }
    .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
    .hero-actions a { display: flex; min-height: 48px; align-items: center; justify-content: center; gap: 8px; border-radius: 13px; color: #fff; text-decoration: none; font-size: 13px; font-weight: 800; }
    .hero-actions .primary { color: var(--wa-green); background: #fff; }
    .hero-actions .secondary { border: 1px solid rgba(255,255,255,.45); background: rgba(255,255,255,.08); }
    .hero-benefits { display: flex; flex-wrap: wrap; gap: 8px 13px; margin-top: 18px; color: rgba(255,255,255,.8); font-size: 11px; }
    .hero-benefits span { display: flex; align-items: center; gap: 5px; }
    .hero-benefits i { color: var(--wa-mint); }

    .section { padding: 52px 0 !important; }
    .container { width: min(100% - 28px, 1180px) !important; }
    .section-head { text-align: right !important; }
    .section-title { font-size: clamp(23px, 7vw, 30px) !important; }

    .slider { padding-inline: 0 !important; }
    .slider-arrow { display: none !important; }
    .track { touch-action: pan-y !important; }
    .stats-bar { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; padding: 12px !important; }
    .stat-item { min-width: 0; padding: 16px 10px !important; flex-direction: column; text-align: center; gap: 9px !important; }
    .stat-item .num { font-size: 24px !important; }
    .stat-item .label { font-size: 11px !important; }
    .achievements-grid, .team-grid, .gallery-grid, .shared-team-grid { grid-auto-columns: 82vw; }
    .gallery-item, .team-card, .achievement-card { min-height: 300px; }

    /* اعضای تیم در موبایل به‌صورت شبکه واقعی نمایش داده می‌شوند. */
    .team-grid, .shared-team-grid {
        grid-auto-flow: row !important;
        grid-auto-columns: auto !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        overflow: visible !important;
        scroll-snap-type: none !important;
        padding-inline: 0 !important;
    }
    .team-card { width: 100%; min-height: 260px !important; height: 260px !important; padding: 16px !important; }
    .team-name { font-size: 16px !important; }
    .team-role { font-size: 12px !important; }
    .team-badge { font-size: 10px !important; }
    .shared-team-grid article { min-width: 0; }
    .shared-team-grid img { height: 220px; }

    .cta-section .cta-inner, .welcome-banner { padding: 26px 20px !important; border-radius: 20px !important; }
    .footer-grid { grid-template-columns: 1fr !important; }

    /* Forms and authentication */
    .auth-card { width: calc(100% - 24px) !important; margin: 78px auto 24px !important; border-radius: 22px !important; }
    .auth-card input, .auth-card select, .auth-card textarea, .server-form input, .server-form select, .server-form textarea { min-height: 48px; }
    .auth-card button, .server-actions .btn { min-height: 46px; }

    /* Panel tables become readable cards. data-label is filled by mobile-app.js. */
    .admin-layout .content { padding: 14px !important; padding-bottom: 92px !important; }
    .admin-layout .topbar { padding: 0 10px !important; gap: 7px !important; }
    .admin-layout .tb-actions { gap: 6px !important; margin-inline-start: auto; }
    .admin-layout .tb-title { min-width: 0; }
    .admin-layout .tb-title b { max-width: 105px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
    .admin-layout .tb-search { display: none !important; }
    .admin-layout .tb-profile { padding: 3px !important; }
    .admin-layout .tb-avatar { width: 38px !important; height: 38px !important; }
    .admin-layout .profile-drop { position: fixed !important; top: 62px !important; right: 10px !important; left: 10px !important; width: auto !important; max-width: 360px; margin-inline-start: auto; z-index: 7000 !important; }
    .admin-layout .page-head { gap: 12px; margin-bottom: 18px; }
    .admin-layout .page-head h1 { font-size: 21px; }
    .admin-layout .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 10px !important; }
    .admin-layout .stat-card { min-width: 0; padding: 15px !important; }
    .admin-layout table, .admin-layout thead, .admin-layout tbody, .admin-layout tr, .admin-layout th, .admin-layout td { display: block; width: 100%; }
    .admin-layout thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
    .admin-layout tbody { display: grid; gap: 12px; }
    .admin-layout tbody tr { padding: 8px 14px; border: 1px solid var(--wa-line); border-radius: 16px; background: #fff; box-shadow: 0 7px 20px rgba(0,70,49,.05); }
    .admin-layout tbody td { display: grid; grid-template-columns: minmax(86px, 34%) 1fr; align-items: center; gap: 10px; min-height: 42px; padding: 9px 0 !important; border: 0 !important; border-bottom: 1px dashed var(--wa-line) !important; text-align: right !important; white-space: normal !important; }
    .admin-layout tbody td:last-child { border-bottom: 0 !important; }
    .admin-layout tbody td::before { content: attr(data-label); color: var(--wa-muted); font-size: 11px; font-weight: 700; }
    .admin-layout tbody td[colspan] { display: block; }
    .admin-layout tbody td[colspan]::before { display: none; }
    .admin-layout .conversation { padding: 12px !important; }
    .admin-layout .conversation .message { max-width: 92%; }
}

@media (max-width: 390px) {
    .site-navbar .nav-logo span:last-child { display: none; }
    .site-navbar .btn-login { display: none; }
    .hero-content { padding: 20px; }
    .hero-actions { grid-template-columns: 1fr; }
    .admin-layout .stat-grid { grid-template-columns: 1fr !important; }
}

@media (hover: hover) and (pointer: fine) {
    .wa-drawer-links a:hover { color: var(--wa-green); background: var(--wa-green-soft); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .wa-mobile-overlay, .wa-mobile-drawer { transition: none; }
}
