/* Portal-wide mobile responsiveness — landing, partner, admin */

html {
    -webkit-text-size-adjust: 100%;
}

body.landing-nav-open,
body.partner-stitch.partner-nav-open {
    overflow: hidden;
}

body .nav.nav-open {
    max-height: 100vh;
    overflow-y: auto;
}
body.landing-stitch .landing-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

body.landing-stitch .landing-nav-toggle .material-symbols-outlined {
    font-size: 24px;
}

body.landing-stitch .landing-nav-mobile-panel {
    display: none;
    position: fixed;
    inset: 80px 0 0 0;
    z-index: 45;
    padding: 16px;
    background: rgba(250, 248, 255, 0.98);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.landing-stitch.landing-nav-open .landing-nav-mobile-panel {
    display: block;
}

body.landing-stitch .landing-nav-mobile-links {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

body.landing-stitch .landing-nav-mobile-links a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 0 14px;
    border-radius: 12px;
    background: #fff;
    border: 1px solid var(--line);
    font-weight: 600;
    color: var(--ink);
}

body.landing-stitch .landing-nav-mobile-actions {
    display: grid;
    gap: 10px;
}

body.landing-stitch .landing-nav-mobile-actions .landing-btn {
    width: 100%;
    min-height: 48px;
}

@media (min-width: 900px) {
    body.landing-stitch .landing-nav-toggle,
    body.landing-stitch .landing-nav-mobile-panel {
        display: none !important;
    }
}

@media (max-width: 899px) {
    body.landing-stitch .landing-nav {
        min-height: 72px;
        padding: 0 16px;
        gap: 10px;
    }

    body.landing-stitch .landing-brand {
        font-size: 20px;
        flex: 1;
        min-width: 0;
    }

    body.landing-stitch .landing-nav-actions {
        gap: 8px;
    }

    body.landing-stitch .landing-nav-actions > .landing-btn-primary {
        display: none;
    }

    body.landing-stitch .landing-locale select {
        max-width: 72px;
        padding-right: 24px;
    }

    body.landing-stitch .landing-hero {
        padding: 96px 16px 56px;
    }

    body.landing-stitch .landing-hero-card {
        transform: none;
        max-width: 100%;
    }

    body.landing-stitch .landing-float-icon,
    body.landing-stitch .landing-float-social {
        display: none;
    }

    body.landing-stitch .landing-section {
        padding: 56px 16px;
    }

    body.landing-stitch .landing-section-head {
        margin-bottom: 32px;
    }

    body.landing-stitch .landing-stack {
        border-radius: 20px;
        padding: 24px 18px;
    }

    body.landing-stitch .landing-final-cta {
        border-radius: 24px;
    }

    body.landing-stitch .landing-footer-grid {
        flex-direction: column;
        align-items: flex-start;
    }

    body.landing-stitch.auth-page .landing-auth-nav {
        flex-wrap: wrap;
        min-height: 72px;
        padding: 12px 16px;
    }

    body.landing-stitch.auth-page .landing-nav-actions {
        margin-left: auto;
    }

    body.landing-stitch.auth-page .landing-auth-shell {
        padding: 20px 0 32px;
    }

    body.landing-stitch.auth-page .landing-auth-card {
        padding: 20px 18px;
    }
}

@media (max-width: 480px) {
    body.landing-stitch .landing-nav-actions .landing-btn:not(.landing-btn-primary) {
        display: none;
    }

    body.landing-stitch .landing-hero h1 {
        font-size: 28px;
    }

    body.landing-stitch .landing-stat-pill {
        width: 100%;
        justify-content: center;
    }
}

/* ---- Admin (app layout) ---- */
@media (max-width: 900px) {
    body .container {
        width: min(1120px, calc(100% - 20px));
    }

    body .nav-inner {
        flex-wrap: wrap;
        align-items: center;
        gap: 10px;
        padding: 10px 0;
    }

    body .nav .nav-links {
        flex-basis: 100%;
        order: 3;
        max-height: min(70vh, 520px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 8px 0 12px;
        border-top: 1px solid var(--line);
        margin-top: 4px;
    }

    body .nav .nav-links > a:not(.btn) {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    body .nav .nav-links .portal-notify {
        width: 100%;
        margin: 4px 0;
    }

    body .nav .nav-links .portal-notify-btn {
        width: 100%;
        justify-content: flex-start;
        padding-left: 14px;
        gap: 10px;
        border-radius: 8px;
        min-height: 44px;
    }

    body .nav .nav-links .portal-notify-panel {
        position: fixed;
        left: 10px;
        right: 10px;
        top: 72px;
        width: auto;
    }

    body .nav .locale-form,
    body .nav .locale-select {
        width: 100%;
    }

    body .nav .locale-select {
        min-height: 44px;
    }

    body .form {
        margin: 24px auto;
    }

    body .page-hero {
        padding: 18px 16px !important;
    }

    body h1 {
        font-size: clamp(24px, 7vw, 32px) !important;
    }

    body .footer .nav-links {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    body .partner-table-wrap,
    body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    body table {
        min-width: 640px;
    }

    body .panel {
        padding: 16px !important;
    }

    body .action-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 480px) {
    body .brand span {
        display: none;
    }
}

/* ---- Partner stitch ---- */
body.partner-stitch .partner-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(19, 27, 46, 0.45);
    backdrop-filter: blur(2px);
}

body.partner-stitch.partner-nav-open .partner-sidebar-backdrop {
    display: block;
}

@media (max-width: 899px) {
    body.partner-stitch .partner-main {
        padding: 12px 12px 32px;
    }

    body.partner-stitch .dash-kpi-row,
    body.partner-stitch .dash-kpi-row--4,
    body.partner-stitch .dash-kpi-row--5 {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .dash-steps {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .dash-quick {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .dash-analytics-grid {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .dash-conversions-table-wrap {
        width: 100%;
        max-width: 100%;
        overflow-x: auto;
        overscroll-behavior-x: contain;
    }

    body.partner-stitch .partner-table-wrap {
        margin: 0;
    }

    body.partner-stitch .portal-card form .btn {
        width: 100%;
        justify-content: center;
    }

    body.partner-stitch .partner-page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
    }

    body.partner-stitch .partner-page-header > div:first-child {
        order: 2;
    }

    body.partner-stitch .partner-header-actions {
        order: 1;
        width: 100%;
        justify-content: space-between;
    }

    body.partner-stitch .partner-profile-chip {
        flex: 1;
        min-width: 0;
        border-radius: 16px;
        padding: 8px 12px 8px 8px;
    }

    body.partner-stitch .partner-profile-chip .partner-locale-form {
        display: none;
    }

    body.partner-stitch .partner-profile-chip > div {
        min-width: 0;
    }

    body.partner-stitch .partner-profile-chip strong,
    body.partner-stitch .partner-profile-chip span.muted {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body.partner-stitch .partner-canvas {
        padding: 16px 14px;
        border-radius: 16px;
    }

    body.partner-stitch .portal-two-col {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .portal-two-col > .portal-card {
        border-left: 0 !important;
        padding: 0 !important;
        border-top: 1px solid rgba(187, 202, 188, 0.35);
        padding-top: 18px !important;
    }

    body.partner-stitch .portal-two-col > .portal-card:first-child {
        border-top: 0;
        padding-top: 0 !important;
    }

    body.partner-stitch .portal-metrics-secondary {
        flex-direction: column;
    }

    body.partner-stitch .portal-metrics-secondary .portal-metric-sm {
        min-width: 0;
        border-right: 0 !important;
        border-bottom: 1px solid rgba(187, 202, 188, 0.35);
    }

    body.partner-stitch .portal-metrics-secondary .portal-metric-sm:last-child {
        border-bottom: 0;
    }

    body.partner-stitch .settings-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        gap: 8px;
        padding-bottom: 4px;
    }

    body.partner-stitch .settings-tab {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    body.partner-stitch .partner-filter-actions {
        width: 100%;
    }

    body.partner-stitch .partner-filter-actions .btn {
        flex: 1 1 auto;
    }

    body.partner-stitch .partner-table-wrap {
        border-radius: 12px;
    }

    body.partner-stitch .portal-notify-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        top: 72px;
        width: auto;
    }

    body.partner-stitch .partner-sidebar {
        width: min(280px, 88vw);
    }
}

@media (max-width: 480px) {
    body .action-grid {
        grid-template-columns: 1fr !important;
    }

    body.partner-stitch .partner-topbar-brand {
        font-size: 16px;
    }

    body.partner-stitch .partner-page-header h1 {
        font-size: 22px;
    }

    body.partner-stitch .dash-tabs {
        grid-template-columns: 1fr !important;
    }
}

/* ---- Dashboard analytics ---- */
@media (max-width: 640px) {
    .dash-chart-card,
    .dash-conversions-card {
        padding: 16px 14px;
        border-radius: 14px;
    }

    .dash-chart-canvas-wrap {
        height: 220px;
    }

    .dash-conversions-table {
        min-width: 580px;
    }

    .dash-chart-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .portal-page-head {
        flex-direction: column;
        align-items: stretch;
    }

    .portal-page-head .btn {
        width: 100%;
    }
}
