@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --primary: #506D84;
    --primary-dark: #3d5669;
    --accent: #7FA3C0;
    --yellow: #F9A825;
    --background-start: #F4F7FA;
    --background-mid: #D4DEE8;
    --background-end: #9BB8CE;
    --success: #10B981;
    --success-dark: #059669;
    --danger: #EF4444;
    --danger-dark: #DC2626;
    --warning: #F59E0B;
    --text: #1f2937;
    --text-muted: #6b7280;
    --surface: rgba(255, 255, 255, 0.72);
    --surface-border: rgba(255, 255, 255, 0.45);
    --radius-sm: 0.75rem;
    --radius-md: 1rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --shadow-sm: 0 2px 10px rgba(80, 109, 132, 0.08);
    --shadow-md: 0 8px 28px rgba(80, 109, 132, 0.12);
    --shadow-lg: 0 16px 48px rgba(80, 109, 132, 0.16);
    --transition: 0.25s ease;
    --header-h: 4.25rem;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    overflow-x: clip;
    max-width: 100%;
}

body {
    margin: 0;
    background: linear-gradient(145deg, var(--background-start) 0%, var(--background-mid) 48%, var(--background-end) 100%);
    background-attachment: fixed;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--text);
    line-height: 1.55;
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

img, svg, video, canvas, iframe { max-width: 100%; height: auto; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; max-width: 100%; }

/* iOS fixed background can jank — disable on small screens */
@media (max-width: 768px) {
    body { background-attachment: scroll; }
}

/* ——— Tailwind-like color helpers (без конфига CDN) ——— */
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ——— Surfaces ——— */
.glass {
    background: var(--surface);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--surface-border);
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-xl);
    max-width: 100%;
    min-width: 0;
}

.glass-dark {
    background: rgba(80, 109, 132, 0.12);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: var(--radius-lg);
}

/* ——— Site header ——— */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(80, 109, 132, 0.12);
    box-shadow: var(--shadow-sm);
}

.site-header__inner {
    max-width: 80rem;
    margin: 0 auto;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-height: var(--header-h);
    width: 100%;
    box-sizing: border-box;
}

.site-logo {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}

.site-logo:hover { color: var(--primary-dark); }

.site-nav-ads {
    display: none;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (min-width: 1024px) {
    .site-nav-ads { display: flex; }
}

.site-nav-ads a {
    color: var(--accent);
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color var(--transition);
}

.site-nav-ads a:hover { color: var(--primary); }

.site-nav-desktop {
    display: none;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem 1.1rem;
    font-weight: 500;
    font-size: 0.95rem;
}

@media (min-width: 900px) {
    .site-nav-desktop { display: flex; }
}

.site-nav-desktop a {
    color: var(--primary);
    text-decoration: none;
    padding: 0.35rem 0.15rem;
    border-radius: 0.35rem;
    transition: color var(--transition);
}

.site-nav-desktop a:hover { color: var(--accent); }
.site-nav-desktop a.is-active { font-weight: 700; color: var(--primary-dark); }
.site-nav-desktop a.nav-admin { color: #d97706; font-weight: 700; }
.site-nav-desktop a.nav-admin:hover { color: #b45309; }
.site-nav-desktop a.nav-logout { color: #dc2626; font-weight: 600; }
.site-nav-desktop a.nav-logout:hover { color: #b91c1c; }

.nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border: 1px solid rgba(80, 109, 132, 0.2);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.7);
    color: var(--primary);
    cursor: pointer;
    font-size: 1.15rem;
    transition: background var(--transition), box-shadow var(--transition);
}

.nav-burger:hover {
    background: #fff;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 900px) {
    .nav-burger { display: none; }
}

/* Mobile drawer */
.site-drawer {
    position: fixed;
    inset: 0;
    z-index: 200;
    pointer-events: none;
    visibility: hidden;
}

.site-drawer.is-open {
    pointer-events: auto;
    visibility: visible;
}

.site-drawer__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.site-drawer.is-open .site-drawer__backdrop { opacity: 1; }

.site-drawer__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(20rem, 88vw);
    height: 100%;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    display: flex;
    flex-direction: column;
    padding: 1.25rem 1.25rem calc(1.5rem + var(--safe-bottom));
    overflow-y: auto;
}

.site-drawer.is-open .site-drawer__panel { transform: translateX(0); }

.site-drawer__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.site-drawer__close {
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: var(--radius-md);
    background: #f3f4f6;
    color: var(--text);
    cursor: pointer;
    font-size: 1.1rem;
}

.site-drawer__links {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.site-drawer__links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
    transition: background var(--transition);
}

.site-drawer__links a:hover,
.site-drawer__links a:active {
    background: rgba(80, 109, 132, 0.08);
}

.site-drawer__links a.nav-admin { color: #d97706; }
.site-drawer__links a.nav-logout { color: #dc2626; }

.site-drawer__ads {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.site-drawer__ads a {
    color: var(--accent);
    font-weight: 500;
    text-decoration: none;
    font-size: 0.95rem;
}

/* ——— Buttons ——— */
.btn-primary,
.btn-accent,
.btn-success,
.btn-danger,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
    border-radius: var(--radius-lg);
    line-height: 1.2;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    color: #fff;
}

.btn-accent {
    background: linear-gradient(135deg, var(--yellow) 0%, #FBC02D 100%);
    color: #fff;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(249, 168, 37, 0.35);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(16, 185, 129, 0.35);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(239, 68, 68, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(80, 109, 132, 0.18);
    color: var(--primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.85);
    transform: translateY(-1px);
}

/* ——— Forms ——— */
.input-glass {
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(201, 214, 223, 0.55);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
    border-radius: var(--radius-lg);
    font-family: inherit;
    color: var(--text);
}

.input-glass:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(80, 109, 132, 0.15);
}

.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius-md);
}

.success-message {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-left: 4px solid var(--success);
    border-radius: var(--radius-md);
}

/* ——— Feature / misc ——— */
.feature-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    color: #fff;
}

.floating {
    animation: floating 3.2s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.spinner {
    border: 3px solid rgba(80, 109, 132, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    width: 40px;
    height: 40px;
    animation: spin 0.85s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.pulse-glow {
    animation: pulse-glow 2s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    from { box-shadow: 0 0 16px rgba(80, 109, 132, 0.25); }
    to { box-shadow: 0 0 28px rgba(80, 109, 132, 0.5); }
}

/* ——— Layout helpers ——— */
.site-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1rem 0.85rem 1.75rem;
    min-width: 0;
    overflow-x: clip;
}

@media (min-width: 640px) {
    .site-main { padding: 1.75rem 1.5rem 2.5rem; }
}

@media (min-width: 1024px) {
    .site-main { padding: 2.25rem 1.5rem 3rem; }
}

.site-footer {
    margin-top: auto;
    text-align: center;
    padding: 1.25rem 1rem calc(1.25rem + var(--safe-bottom));
    font-size: 0.875rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(80, 109, 132, 0.12);
    background: rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.site-footer__inner {
    max-width: 80rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .site-footer__inner {
        flex-direction: row;
        gap: 0.75rem;
    }
}

.site-footer a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.site-footer a:hover { text-decoration: underline; color: var(--primary-dark); }

/* ——— Cards / content polish ——— */
.page-hero {
    text-align: center;
    margin-bottom: 1.75rem;
}

.page-hero__icon {
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
}

@media (min-width: 640px) {
    .page-hero__icon {
        width: 5.5rem;
        height: 5.5rem;
        margin-bottom: 1.25rem;
    }
}

.page-hero h1 {
    font-size: clamp(1.75rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--primary);
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.page-hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem);
    color: var(--text-muted);
    margin: 0 auto;
    max-width: 40rem;
}

.card-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .card-grid { grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
}

.card-feature {
    text-align: center;
    padding: 1.5rem 1.25rem;
}

@media (min-width: 640px) {
    .card-feature { padding: 2rem 1.5rem; }
}

.card-feature h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 0.75rem;
}

.card-feature p {
    color: var(--text-muted);
    margin: 0;
    font-size: 0.95rem;
}

/* CTA buttons stack on mobile */
.cta-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    margin-top: 2rem;
}

@media (min-width: 640px) {
    .cta-row {
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }
}

.cta-row .btn-primary,
.cta-row .btn-success {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1.05rem;
    border-radius: var(--radius-lg);
}

@media (min-width: 640px) {
    .cta-row .btn-primary,
    .cta-row .btn-success {
        width: auto;
        min-width: 14rem;
        padding: 1.1rem 2rem;
        font-size: 1.1rem;
    }
}

/* Map / checker
 * Важно: у #map должна быть ЯВНАЯ высота в px — иначе Yandex API
 * рисует пусто (size=0) до fullscreen / resize.
 */
#map-container {
    display: none;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow: hidden;
    /* без фиксированной высоты flex-ребёнка — высоту задаёт #map */
}

#map-container.is-visible {
    display: flex !important;
}

#map-container .map-toolbar {
    flex: 0 0 auto;
    flex-wrap: wrap;
    gap: 0.35rem;
    min-width: 0;
}

#map-container .map-ext-link {
    flex: 0 0 auto;
}

#map {
    flex: 0 0 auto;
    width: 100% !important;
    max-width: 100% !important;
    /* Явная высота — ключ к корректной инициализации ymaps */
    height: 280px !important;
    min-height: 280px !important;
    position: relative;
    overflow: hidden;
}

/* Яндекс.Карты: контейнер и canvas */
#map > ymaps,
#map .ymaps-2-1-79-map,
#map [class*="ymaps-"][class*="-map"] {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
}

@media (min-width: 480px) {
    #map {
        height: 340px !important;
        min-height: 340px !important;
    }
}

@media (min-width: 768px) {
    #map {
        height: 420px !important;
        min-height: 420px !important;
    }
}

@media (min-width: 1024px) {
    #map {
        height: 480px !important;
        min-height: 480px !important;
    }
}

#coords-input {
    min-height: 10rem;
    font-size: 16px !important; /* iOS: без зума при фокусе */
    max-width: 100%;
    word-break: break-all;
}

@media (min-width: 640px) {
    #coords-input {
        min-height: 16rem;
        font-size: 1.05rem !important;
    }
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    padding: 0;
}

@media (min-width: 640px) {
    .modal-overlay {
        align-items: center;
        padding: 1rem;
    }
}

.modal-overlay.hidden { display: none; }

.modal-panel {
    width: 100%;
    max-width: 28rem;
    max-height: min(92vh, 40rem);
    overflow-y: auto;
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    padding: 1.5rem 1.25rem calc(1.5rem + var(--safe-bottom));
    position: relative;
}

@media (min-width: 640px) {
    .modal-panel {
        border-radius: var(--radius-2xl);
        padding: 2rem 2rem 1.75rem;
    }
}

/* Tables scroll on mobile */
.table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}

/* FAQ */
.faq-item {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}

.faq-item:hover { box-shadow: var(--shadow-md); }

.faq-toggle {
    width: 100%;
    padding: 1.15rem 1.25rem;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    font: inherit;
    color: inherit;
}

@media (min-width: 640px) {
    .faq-toggle { padding: 1.35rem 1.75rem; }
}

.faq-toggle:hover { background: rgba(255, 255, 255, 0.2); }
.faq-toggle.active { background: rgba(80, 109, 132, 0.1); }

.faq-toggle .chevron { transition: transform 0.35s ease; flex-shrink: 0; }
.faq-toggle.active .chevron { transform: rotate(180deg); }

.faq-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.45s ease, padding 0.35s ease;
    padding: 0 1.25rem;
}

@media (min-width: 640px) {
    .faq-content { padding: 0 1.75rem; }
}

.faq-content.open {
    max-height: 1400px;
    padding-bottom: 1.5rem;
}

.forbidden-grid i {
    filter: drop-shadow(0 2px 6px rgba(80, 109, 132, 0.35));
}

/* Banner ads */
.banner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    justify-items: center;
}

@media (min-width: 768px) {
    .banner-grid { grid-template-columns: repeat(3, 1fr); }
}

.banner-grid a {
    width: 100%;
    max-width: 300px;
    transition: transform 0.2s ease;
}

.banner-grid a:hover { transform: scale(1.03); }

/* Reduce motion */
@media (prefers-reduced-motion: reduce) {
    .floating, .pulse-glow { animation: none; }
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ========== Mobile overflow & polish ========== */
code, kbd, samp, pre,
.font-mono,
.break-all,
.break-url {
    overflow-wrap: anywhere;
    word-break: break-word;
    max-width: 100%;
}

pre, .pre-wrap {
    white-space: pre-wrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Длинные URL / webhook / base_url */
a {
    overflow-wrap: anywhere;
}

/* Flex/grid: дети не раздувают контейнер */
.site-main .flex,
.site-main .grid,
.glass .flex,
.glass .grid {
    min-width: 0;
}

.site-header__inner,
.site-header__inner > div {
    min-width: 0;
}

/* Кнопки: не вылезают, переносят текст */
.btn-primary,
.btn-accent,
.btn-success,
.btn-danger,
.btn-secondary {
    max-width: 100%;
    white-space: normal;
    text-align: center;
    box-sizing: border-box;
}

/* Бейджи результатов чекера */
.violation-badge,
.success-badge,
.warning-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.35rem 0.5rem;
    max-width: 100%;
    text-align: center;
    word-break: break-word;
}

.violation-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}
.success-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}
.warning-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
}

/* Ряды кнопок на карте / профиле */
.btn-row,
.actions-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    max-width: 100%;
}

.btn-row > a,
.btn-row > button,
.actions-row > a,
.actions-row > button {
    flex: 1 1 auto;
    min-width: min(100%, 8.5rem);
}

/* Карточки точек: координаты */
.point-card,
.coord-line {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

/* details/summary */
details > summary {
    list-style: none;
    cursor: pointer;
    min-width: 0;
}
details > summary::-webkit-details-marker { display: none; }

/* FAQ title wrap */
.faq-toggle span,
.faq-toggle {
    min-width: 0;
}
.faq-toggle .faq-q {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    overflow-wrap: anywhere;
}

/* Nested glass: только крупные блоки контента, не иконки/карточки auth */
@media (max-width: 639px) {
    .page-hero {
        margin-bottom: 1.25rem;
    }
    .page-hero h1 {
        font-size: clamp(1.45rem, 7vw, 1.85rem);
    }
    .site-logo {
        font-size: 1.4rem;
    }
    .site-header__inner {
        padding: 0.65rem 0.75rem;
        min-height: 3.5rem;
    }
    .nav-burger {
        width: 2.5rem;
        height: 2.5rem;
    }
    /* CTA / wide buttons */
    .cta-row .btn-primary,
    .cta-row .btn-success {
        padding: 0.9rem 1.1rem;
        font-size: 0.98rem;
    }
    /* Results from checker.js (legacy large paddings) */
    #results-container .glass {
        padding: 1rem !important;
    }
    #results-container h2,
    #results-container h3 {
        font-size: 1.15rem !important;
        line-height: 1.3;
    }
    #results-container .text-3xl,
    #results-container .text-2xl {
        font-size: 1.15rem !important;
    }
    #results-container .text-xl {
        font-size: 1.05rem !important;
    }
    #results-container .px-8 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    #results-container .py-4 {
        padding-top: 0.65rem !important;
        padding-bottom: 0.65rem !important;
    }
    #map-fallback .btn-primary {
        width: 100%;
        padding: 0.9rem 1rem !important;
        font-size: 1rem !important;
    }
    /* Modal full width */
    .modal-panel {
        max-width: 100%;
        border-radius: 1.25rem 1.25rem 0 0;
    }
}

/* ——— Profile layout ——— */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
    max-width: 100%;
    min-width: 0;
}

@media (min-width: 960px) {
    .profile-layout {
        grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.15fr);
        gap: 1.25rem;
    }
}

.profile-col--side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.profile-card {
    padding: 1rem 1.1rem;
    box-shadow: var(--shadow-md);
    min-width: 0;
    max-width: 100%;
}

@media (min-width: 640px) {
    .profile-card {
        padding: 1.25rem 1.35rem;
    }
}

.profile-card--security {
    padding: 0.9rem 1rem;
}

@media (min-width: 640px) {
    .profile-card--security {
        padding: 1rem 1.15rem;
    }
}

.profile-card__row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.profile-card__head {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.85rem;
    min-width: 0;
}

.profile-card__icon {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: var(--primary);
    font-size: 1.1rem;
}

.profile-card__icon--sm {
    width: 2.15rem;
    height: 2.15rem;
    font-size: 0.95rem;
    border-radius: 0.7rem;
}

@media (min-width: 640px) {
    .profile-card__icon {
        width: 2.75rem;
        height: 2.75rem;
        font-size: 1.2rem;
    }
}

.profile-card__body {
    flex: 1 1 auto;
    min-width: 0;
}

.profile-card__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.25;
}

@media (min-width: 640px) {
    .profile-card__title {
        font-size: 1.15rem;
    }
}

.profile-card__hint {
    margin: 0.2rem 0 0.65rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.profile-card--security .profile-card__hint {
    margin-bottom: 0.55rem;
}

.profile-card__btn {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 0.85rem;
    font-size: 0.9rem;
    font-weight: 700;
}

@media (min-width: 640px) {
    .profile-card__btn {
        width: auto;
        min-width: 11rem;
        padding: 0.7rem 1.15rem;
    }
}

/* Updates list under security */
.profile-updates {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.profile-updates__empty {
    margin: 0;
    padding: 0.75rem 0 0.25rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-updates__item {
    border-left: 3px solid var(--accent);
    padding: 0.15rem 0 0.15rem 0.85rem;
    min-width: 0;
}

.profile-updates__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 0.65rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.profile-updates__ver {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-weight: 700;
    color: var(--primary);
}

.profile-updates__title {
    margin: 0.25rem 0 0;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
    line-height: 1.3;
}

.profile-updates__text {
    margin-top: 0.3rem;
    font-size: 0.85rem;
    color: #4b5563;
    white-space: pre-line;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.profile-card--telegram .profile-card__head {
    margin-bottom: 1rem;
}

@media (min-width: 960px) {
    .profile-card--telegram {
        min-height: 100%;
    }
}

/* ——— Auth (login / register) ——— */
.auth-main {
    flex: 1 1 auto;
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
    padding: 1.25rem 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    box-sizing: border-box;
}

.auth-card {
    width: 100%;
    max-width: 28rem;
    padding: 1.5rem 1.35rem;
    box-sizing: border-box;
    min-width: 0;
}

@media (min-width: 640px) {
    .auth-card {
        padding: 2.25rem 2.5rem;
    }
}

.auth-card__icon {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    flex-shrink: 0;
    padding: 0 !important; /* не трогать mobile nested-glass */
}

@media (min-width: 640px) {
    .auth-card__icon {
        width: 5rem;
        height: 5rem;
        margin-bottom: 1.25rem;
    }
}

.auth-field {
    position: relative;
    width: 100%;
}

.auth-field .input-glass {
    width: 100%;
    box-sizing: border-box;
    padding: 0.9rem 1rem 0.9rem 2.85rem;
    font-size: 16px; /* iOS no zoom */
    border-radius: var(--radius-xl);
}

.auth-field .input-glass.has-toggle {
    padding-right: 3rem;
}

.auth-field__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(80, 109, 132, 0.55);
    pointer-events: none;
    z-index: 1;
    font-size: 0.95rem;
    line-height: 1;
}

.auth-field__toggle {
    position: absolute;
    right: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    padding: 0.35rem;
    z-index: 2;
    line-height: 1;
    max-width: none;
}

.auth-field__toggle:hover {
    color: var(--primary);
}

/* Prevent horizontal scroll from 100vw + scrollbar */
.w-screen { width: 100% !important; max-width: 100% !important; }

/* Tailwind-like helpers used in markup */
.min-w-0 { min-width: 0 !important; }
.break-words { overflow-wrap: anywhere; word-break: break-word; }

/* Input font-size 16px on mobile inputs (Tailwind text-sm often 14px) */
@media (max-width: 639px) {
    input.input-glass,
    textarea.input-glass,
    select.input-glass,
    .input-glass {
        font-size: 16px !important;
    }
}
