/* =========================================================================
   Galbraith — дизайн-система v3
   ---------------------------------------------------------------------
   Направление: неоновый «Vice City at night» — тёмно-синий (не чёрный!)
   фон, фирменный градиент электрик-синий → фиолетовый → маджента вместо
   плоского фиолетового акцента, холодные (не нейтрально-серые) тени и
   бордеры. Это тематически осмысленно для маркетплейса GTA-RP площадки
   (неон ночного города), а не просто «два модных цвета». Имена
   CSS-переменных (--g-*) не менялись — весь остальной код (80+ файлов)
   ссылается на них через var(...), поэтому смена палитры применяется сразу
   везде.
   ========================================================================= */

:root {
    /* Акцент — теперь не плоский цвет, а фирменный градиент; --g-accent
       остаётся плоским оттенком для мест, где градиент не подходит
       (бордеры, точки, текст ссылок). */
    --g-gradient: linear-gradient(135deg, #4C6FFF 0%, #8B5CF6 55%, #E14FD6 100%);
    --g-accent: #7C5CFF;
    --g-accent-light: #A78BFF;
    --g-accent-dim: rgba(124, 92, 255, 0.16);
    --g-accent-ink: #0B0A1F; /* тёмный текст поверх акцентной заливки */
    --g-accent-2: #E14FD6; /* второй тон градиента — для точечных акцентов */

    /* Фон и поверхности — тёмно-синий, не чёрный */
    --g-bg: #0A0C18;
    --g-bg-soft: #0F1224;
    --g-card: #141833;
    --g-card-hover: #1B2044;
    --g-border: rgba(150, 160, 255, 0.14);
    --g-border-strong: rgba(150, 160, 255, 0.26);

    /* Текст — холодный, не нейтрально-серый */
    --g-text: #EDEFFC;
    --g-text-secondary: #8B90BE;

    /* Форма */
    --g-radius: 16px;
    --g-radius-sm: 11px;
    --g-radius-lg: 22px;
    --g-radius-full: 999px;
    --g-shadow: 0 1px 2px rgba(0,0,0,.5), 0 12px 32px rgba(10,8,40,.5);
    --g-shadow-accent: 0 10px 28px rgba(139, 92, 246, 0.28);

    /* Семантика — подобраны так, чтобы не спорить с холодной палитрой */
    --g-success: #2FE0B0;
    --g-success-dim: rgba(47, 224, 176, 0.14);
    --g-danger: #FF4B7A;
    --g-danger-dim: rgba(255, 75, 122, 0.14);
    --g-warning: #FFB454;
    --g-warning-dim: rgba(255, 180, 84, 0.14);

    /* Шрифты: дисплейный (заголовки) + рабочий (текст) + моно (цены/коды) */
    --g-font-display: 'Unbounded', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --g-font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --g-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

body.light-mode {
    --g-bg: #F6F5F2;
    --g-bg-soft: #EFEEEA;
    --g-card: #FFFFFF;
    --g-card-hover: #F7F6F3;
    --g-border: rgba(20,18,14,0.09);
    --g-border-strong: rgba(20,18,14,0.18);
    --g-text: #17140F;
    --g-text-secondary: #6B6862;
    --g-accent-ink: #1A0D06;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--g-font-body);
    background: var(--g-bg);
    color: var(--g-text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-family: var(--g-font-display);
    letter-spacing: -0.01em;
    font-weight: 600;
}

/* Два сдержанных статичных неоновых блика по краям верха страницы — синий
   слева, маджента справа — вместо трёх анимированных шаров и hue-rotate.
   Минимализм — это дисциплина, а не отсутствие цвета: два тона фирменного
   градиента, статично, без движения. */
body::before, body::after {
    content: '';
    position: fixed;
    top: -25%;
    width: 900px; height: 700px;
    z-index: -1;
    pointer-events: none;
}
body::before {
    left: -10%;
    background: radial-gradient(ellipse at center, rgba(76,111,255,0.16) 0%, transparent 65%);
}
body::after {
    right: -10%;
    background: radial-gradient(ellipse at center, rgba(225,79,214,0.13) 0%, transparent 65%);
}
body.light-mode::before { background: radial-gradient(ellipse at center, rgba(76,111,255,0.10) 0%, transparent 65%); }
body.light-mode::after { background: radial-gradient(ellipse at center, rgba(225,79,214,0.08) 0%, transparent 65%); }

a { color: var(--g-accent-light); text-decoration: none; }
a:hover { opacity: 0.85; }

:focus-visible {
    outline: 2px solid var(--g-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

::selection { background: var(--g-accent); color: var(--g-accent-ink); }

/* Тонкий кастомный скроллбар — мелочь, но именно такие детали отличают
   аккуратный интерфейс от дефолтного. */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g-border-strong); border-radius: var(--g-radius-full); border: 2px solid var(--g-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--g-text-secondary); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(10,10,12,0.72);
    backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid var(--g-border);
}
body.light-mode .header { background: rgba(246,245,242,0.78); }

.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    height: 60px; gap: 16px;
}

.logo {
    flex: 0 0 auto;
    display: flex; align-items: center; gap: 10px;
    font-family: var(--g-font-display);
    font-size: 17px; font-weight: 600; color: var(--g-text);
    letter-spacing: -0.01em;
}
.logo-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--g-gradient); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
    box-shadow: var(--g-shadow-accent);
}

.nav { display: flex; gap: 22px; align-items: center; justify-content: center; flex: 1 1 auto; min-width: 0; }
.nav a {
    font-size: 14px; font-weight: 500; color: var(--g-text-secondary);
    transition: color 0.15s;
    position: relative;
}
.nav a:hover, .nav a.active { color: var(--g-text); }
.nav a.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -19px; height: 2px;
    background: var(--g-accent); border-radius: 2px;
}

.header-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
    width: 38px; height: 38px; border-radius: var(--g-radius-sm);
    background: transparent; border: 1px solid var(--g-border);
    color: var(--g-text-secondary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.icon-btn:hover { background: var(--g-card); color: var(--g-text); border-color: var(--g-border-strong); }
.icon-btn:active { transform: scale(0.94); }

/* Мобильное меню: гамбургер скрыт на десктопе (там уже виден .nav) */
.nav-toggle { display: none; }

.mobile-nav {
    display: none;
    position: fixed; top: 60px; left: 0; right: 0; bottom: 0; z-index: 99;
    background: var(--g-bg);
    padding: 10px 0 24px;
    overflow-y: auto;
    flex-direction: column;
}
.mobile-nav.open { display: flex; }
.mobile-nav a {
    padding: 14px 20px; font-size: 15px; font-weight: 500;
    color: var(--g-text); border-bottom: 1px solid var(--g-border);
}
.mobile-nav a.active { color: var(--g-accent); }
.mobile-nav-divider { height: 8px; background: var(--g-bg-soft); }

/* =========================================================================
   Кнопки — единая, узнаваемая система вместо разрозненных инлайн-стилей.
   Минимализм: без градиентов и лишних теней, характер — в чётком контрасте
   акцента, аккуратной анимации нажатия и внятной иерархии primary/secondary/
   ghost/danger.
   ========================================================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: var(--g-radius-sm);
    font-family: var(--g-font-body);
    font-size: 14px; font-weight: 600; letter-spacing: 0.005em;
    border: 1px solid transparent; cursor: pointer;
    transition: transform 0.12s ease, background-color 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s, opacity 0.15s;
    white-space: nowrap; user-select: none;
    line-height: 1.2;
}
.btn:active { transform: scale(0.97); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--g-gradient); color: #fff;
    box-shadow: 0 1px 0 rgba(255,255,255,0.18) inset, var(--g-shadow-accent);
}
.btn-primary:hover { filter: brightness(1.1); box-shadow: 0 1px 0 rgba(255,255,255,0.22) inset, 0 12px 32px rgba(139,92,246,0.36); }

.btn-secondary {
    background: var(--g-card); color: var(--g-text);
    border-color: var(--g-border-strong);
}
.btn-secondary:hover { background: var(--g-card-hover); border-color: var(--g-text-secondary); }

.btn-ghost {
    background: transparent; color: var(--g-text-secondary); border-color: transparent;
}
.btn-ghost:hover { background: var(--g-card); color: var(--g-text); }

.btn-danger {
    background: var(--g-danger-dim); color: var(--g-danger); border-color: rgba(240,71,92,0.28);
}
.btn-danger:hover { background: rgba(240,71,92,0.22); border-color: var(--g-danger); }

.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 14px 26px; font-size: 15.5px; border-radius: 12px; }

/* Inputs */
.input, .select, textarea.input {
    width: 100%; background: var(--g-card);
    border: 1px solid var(--g-border); border-radius: var(--g-radius-sm);
    padding: 11px 14px; color: var(--g-text); font-size: 14px;
    outline: none; transition: border-color 0.15s, background-color 0.15s;
    font-family: inherit;
}
.input::placeholder { color: var(--g-text-secondary); opacity: 0.75; }
.input:hover, .select:hover { border-color: var(--g-border-strong); }
.input:focus, .select:focus { border-color: var(--g-accent); background: var(--g-card-hover); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.card {
    background: var(--g-card);
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    position: relative;
}
a.card:hover, .card.is-interactive:hover {
    transform: translateY(-3px);
    box-shadow: var(--g-shadow);
    border-color: var(--g-border-strong);
}

.card-img {
    position: relative;
    height: 160px;
    background: linear-gradient(135deg, #17130f, #0f1613);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden;
}
.card-img img {
    width: 100%; height: 100%; object-fit: cover;
}

.card-badge {
    position: absolute; top: 10px; right: 10px;
    padding: 4px 10px; border-radius: var(--g-radius-full);
    font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
}
.badge-free { background: var(--g-success); color: #06231A; }
.badge-paid { background: var(--g-gradient); color: #fff; }

.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.card-desc {
    font-size: 13px; color: var(--g-text-secondary); line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-meta {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 12px; color: var(--g-text-secondary); margin-top: auto; padding-top: 8px;
    border-top: 1px solid var(--g-border);
}
.card-price { color: var(--g-accent-light); font-weight: 700; font-family: var(--g-font-mono); letter-spacing: -0.01em; }

/* Единый компонент уведомления/алерта — использовать вместо инлайновых
   rgba(...)-блоков там, где подключается заново. */
.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--g-radius-sm);
    font-size: 14px; line-height: 1.5;
    border: 1px solid var(--g-border);
    background: var(--g-card);
}
.alert-info { background: var(--g-accent-dim); border-color: rgba(124,92,255,0.28); }
.alert-success { background: var(--g-success-dim); border-color: rgba(34,197,139,0.28); color: var(--g-success); }
.alert-warning { background: var(--g-warning-dim); border-color: rgba(245,166,35,0.3); color: var(--g-warning); }
.alert-danger { background: var(--g-danger-dim); border-color: rgba(240,71,92,0.3); color: var(--g-danger); }

/* Всплывающие тосты живых уведомлений */
.gtoast-host {
    position: fixed; top: 76px; right: 16px; z-index: 500;
    display: flex; flex-direction: column; gap: 10px;
    max-width: 360px; width: calc(100vw - 32px);
    pointer-events: none;
}
.gtoast {
    display: flex; align-items: flex-start; gap: 12px;
    background: var(--g-card); border: 1px solid var(--g-border-strong);
    border-radius: var(--g-radius-sm); padding: 14px 16px;
    box-shadow: var(--g-shadow);
    text-decoration: none; color: var(--g-text);
    opacity: 0; transform: translateX(20px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: all;
    position: relative;
}
.gtoast::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    background: var(--g-gradient); border-radius: var(--g-radius-sm) 0 0 var(--g-radius-sm);
}
.gtoast-in { opacity: 1; transform: translateX(0) scale(1); }
.gtoast-out { opacity: 0; transform: translateX(20px) scale(0.98); }
.gtoast-icon { font-size: 20px; flex-shrink: 0; line-height: 1; margin-top: 1px; }
.gtoast-body { flex: 1; min-width: 0; }
.gtoast-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.gtoast-text { font-size: 13px; color: var(--g-text-secondary); line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gtoast-close { background: none; border: none; color: var(--g-text-secondary); cursor: pointer; font-size: 13px; padding: 2px; flex-shrink: 0; border-radius: 4px; }
.gtoast-close:hover { color: var(--g-text); background: var(--g-bg); }
@media (max-width: 640px) {
    .auto-delivery-card { width: 96%; }
    .auto-delivery-card-head { padding: 13px 14px; }
    .auto-delivery-section { margin-left: 10px; margin-right: 10px; }
    .gtoast-host { top: auto; bottom: 12px; right: 12px; left: 12px; width: auto; max-width: none; }
}



/* Admin Table */
.admin-table {
    width: 100%; border-collapse: collapse; font-size: 14px;
}
.admin-table th, .admin-table td {
    padding: 12px 14px; text-align: left;
    border-bottom: 1px solid var(--g-border);
}
.admin-table th {
    font-weight: 600; font-size: 12px; color: var(--g-text-secondary);
    text-transform: uppercase; letter-spacing: 0.3px;
}
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
body.light-mode .admin-table tr:hover td { background: rgba(0,0,0,0.02); }

/* Comments */
.comment {
    background: var(--g-card); border: 1px solid var(--g-border);
    border-radius: var(--g-radius-sm); padding: 14px; margin-bottom: 10px;
}
.comment-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 8px;
}
.comment-author { font-weight: 600; font-size: 14px; }
.comment-date { font-size: 12px; color: var(--g-text-secondary); }
.comment-text { font-size: 14px; color: var(--g-text-secondary); line-height: 1.6; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
    padding: 16px;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
    background: var(--g-card); border: 1px solid var(--g-border);
    border-radius: var(--g-radius); padding: 24px;
    width: 100%; max-width: 420px;
    transform: scale(0.96); transition: transform 0.2s;
}
.modal-overlay.active .modal { transform: scale(1); }
.modal h3 { font-size: 18px; font-weight: 600; margin-bottom: 16px; }

/* Footer */
.footer {
    margin-top: auto;
    border-top: 1px solid var(--g-border);
    padding: 24px 0;
    text-align: center; font-size: 13px; color: var(--g-text-secondary);
}
.footer a { margin: 0 8px; }

/* Status badges */
.status {
    display: inline-block; padding: 3px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.status-new { background: rgba(255,59,48,0.12); color: #FF3B30; }
.status-progress { background: rgba(255,204,0,0.12); color: #FFCC00; }
.status-closed { background: rgba(52,199,89,0.12); color: #34C759; }

/* Toast */
.toast {
    position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(30px);
    background: var(--g-card); border: 1px solid var(--g-border);
    padding: 18px 32px; border-radius: var(--g-radius);
    font-size: 16px; font-weight: 600; color: var(--g-text);
    opacity: 0; pointer-events: none; transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1); z-index: 300;
    box-shadow: 0 12px 40px rgba(0,0,0,0.35);
    max-width: 90vw; text-align: center; white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Material page */
.material-cover img { transition: transform 0.3s; }
.material-cover:hover img { transform: scale(1.03); }

/* Responsive */
@media (max-width: 640px) {
    .nav { display: none; }
    .nav-toggle { display: flex; }
    .grid { grid-template-columns: 1fr; }
    .material-header { flex-direction: column; }
    .material-cover { width: 100% !important; height: 200px !important; }
}

/* v4 marketplace UI — stable header / notification / chat styles */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    min-width: max-content;
}

.header-popup-wrap {
    position: static;
    flex: 0 0 auto;
}

.header-popup-trigger {
    position: relative;
}

.header-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 10px;
    background: #ff5050;
    color: #fff;
    font-size: 9px;
    line-height: 1;
    font-weight: 700;
    pointer-events: none;
    border: 2px solid var(--g-bg);
}

/* Dropdown is fixed to the viewport so it can NEVER stretch the header. */
.header-popup {
    position: fixed;
    top: 66px;
    right: max(16px, calc((100vw - 1200px) / 2));
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: min(520px, calc(100vh - 82px));
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    background: var(--g-card);
    border: 1px solid var(--g-border);
    border-radius: 14px;
    box-shadow: 0 22px 60px rgba(0,0,0,.45), 0 4px 18px rgba(0,0,0,.22);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-8px) scale(.985);
    transform-origin: top right;
    transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
    overflow: hidden;
}

.header-popup.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.header-popup-head {
    flex: 0 0 52px;
    height: 52px;
    padding: 0 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--g-border);
    background: var(--g-card);
}

.header-popup-head strong {
    font-size: 14px;
    font-weight: 700;
    color: var(--g-text);
}

.header-popup-action {
    border: 0;
    background: transparent;
    color: var(--g-accent-light);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    padding: 5px 0;
}

.notifications-list {
    min-height: 0;
    max-height: 420px;
    overflow-y: auto;
    overflow-x: hidden;
}

.notification-item {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    color: var(--g-text);
    text-decoration: none;
    border-bottom: 1px solid var(--g-border);
    transition: background .15s ease;
}

.notification-item:last-child { border-bottom: 0; }
.notification-item:hover { background: rgba(255,255,255,.035); }
.notification-item.unread { background: var(--g-accent-dim); }
.notification-item.unread .notification-title { position: relative; padding-right: 12px; }
.notification-item.unread .notification-title::after { content: ''; position: absolute; right: 0; top: 5px; width: 6px; height: 6px; border-radius: 50%; background: var(--g-accent); }

.notification-icon {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
    border-radius: 10px;
    background: var(--g-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
.notification-item.unread .notification-icon { background: var(--g-accent-dim); }

.notification-content {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
}

.notification-title {
    min-width: 0;
    margin-bottom: 3px;
    color: var(--g-text);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.notification-text {
    color: var(--g-text-secondary);
    font-size: 12.5px;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.notification-time {
    margin-top: 5px;
    color: var(--g-text-secondary);
    font-size: 11px;
    line-height: 1.2;
}

.notifications-empty {
    padding: 42px 20px;
    text-align: center;
    color: var(--g-text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

.notifications-empty:first-line { font-size: 22px; }

.auto-delivery-notification {
    background: var(--g-success-dim) !important;
    border-left: 3px solid var(--g-success);
    padding-left: 11px;
}

.auto-delivery-notification .notification-title {
    color: var(--g-success);
    font-weight: 800;
}

/* Seller chat */
.chat-card {
    border: 1px solid var(--g-border);
    border-radius: var(--g-radius);
    overflow: hidden;
    background: var(--g-card);
}

.chat-head {
    height: 64px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--g-border);
}

.chat-subtitle { font-size: 12px; color: var(--g-text-secondary); margin-top: 3px; }
.chat-live { font-size: 11px; color: #34c759; }

.seller-chat-box {
    height: 520px;
    max-height: 520px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-sizing: border-box;
}

.seller-chat-row { display: flex; justify-content: flex-start; min-width: 0; }
.seller-chat-row.mine { justify-content: flex-end; }

.seller-chat-bubble {
    max-width: min(72%, 620px);
    min-width: 0;
    padding: 10px 13px;
    border: 1px solid var(--g-border);
    border-radius: 14px;
    background: var(--g-bg);
    overflow-wrap: anywhere;
    word-break: break-word;
}

.seller-chat-row.mine .seller-chat-bubble {
    background: var(--g-accent);
    border-color: transparent;
    color: #fff;
}

.seller-chat-bubble.admin-message {
    background: rgba(255,59,48,.12) !important;
    border-color: rgba(255,59,48,.35) !important;
    color: var(--g-text) !important;
}

.seller-chat-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 5px;
    color: var(--g-text-secondary);
    font-size: 10px;
}

.seller-chat-row.mine .seller-chat-meta { color: rgba(255,255,255,.72); }

.admin-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 5px;
    border-radius: 5px;
    background: #ff3b30;
    color: #fff;
    font-size: 8px;
    line-height: 1;
    font-weight: 800;
}

.seller-chat-text { white-space: pre-wrap; font-size: 14px; line-height: 1.45; }

.chat-image-link img {
    display: block;
    max-width: 260px;
    max-height: 220px;
    margin-top: 8px;
    border-radius: 9px;
    object-fit: contain;
}

.seller-chat-form {
    padding: 12px;
    border-top: 1px solid var(--g-border);
    background: var(--g-card);
}

.seller-chat-form textarea {
    width: 100%;
    resize: none;
    box-sizing: border-box;
    margin-bottom: 8px;
}

.chat-form-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chat-file { font-size: 12px; color: var(--g-text-secondary); cursor: pointer; }
.chat-file input { display: none; }
.chat-list-item { padding: 16px 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.chat-message-link {
    color: var(--g-accent-light, #a995ff);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
}
.chat-message-link:hover { opacity: .82; }


.auto-delivery-row { width: 100%; margin: 10px 0; }
.auto-delivery-card {
    width: min(92%, 640px);
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid rgba(47,224,176,.38);
    border-radius: 18px;
    background: linear-gradient(145deg, rgba(47,224,176,.12), rgba(124,92,255,.09) 55%, rgba(16,22,52,.92));
    box-shadow: 0 10px 34px rgba(0,0,0,.22), 0 0 0 1px rgba(255,255,255,.025) inset;
}
.auto-delivery-card-head { display:flex; align-items:center; gap:12px; padding:15px 17px; border-bottom:1px solid rgba(255,255,255,.07); }
.auto-delivery-icon { width:38px; height:38px; flex:0 0 38px; display:grid; place-items:center; border-radius:12px; background:rgba(47,224,176,.16); font-size:20px; }
.auto-delivery-title { font-size:15px; font-weight:800; letter-spacing:.01em; color:var(--g-text); }
.auto-delivery-subtitle { margin-top:2px; font-size:12px; color:var(--g-text-secondary); }
.auto-delivery-status { margin-left:auto; padding:5px 8px; border-radius:999px; background:rgba(47,224,176,.14); color:var(--g-success); border:1px solid rgba(47,224,176,.25); font-size:10px; font-weight:800; letter-spacing:.06em; }
.auto-delivery-section { margin:12px 14px 0; padding:13px 14px; border-radius:13px; border:1px solid rgba(255,255,255,.07); background:rgba(8,12,32,.28); }
.auto-delivery-section-label { margin-bottom:8px; font-size:10px; font-weight:800; letter-spacing:.08em; color:var(--g-text-secondary); }
.auto-delivery-section-text { color:var(--g-text); font-size:13px; line-height:1.55; }
.auto-delivery-item-section { border-color:rgba(124,92,255,.34); background:linear-gradient(135deg, rgba(124,92,255,.16), rgba(47,224,176,.08)); }
.auto-delivery-item-section .auto-delivery-section-label { color:#b8a9ff; }
.auto-delivery-item-content { padding:11px 12px; border-radius:10px; background:rgba(0,0,0,.22); border:1px dashed rgba(255,255,255,.14); color:var(--g-text); font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono",monospace; font-size:13px; line-height:1.65; font-weight:650; word-break:break-word; }
.auto-delivery-item-content .chat-message-link { font-family:inherit; font-weight:800; }
.auto-delivery-card-foot { display:flex; align-items:center; gap:7px; padding:12px 15px 5px; color:var(--g-success); font-size:12px; font-weight:700; }
.auto-delivery-card-time { padding:0 15px 12px; text-align:right; color:var(--g-text-secondary); font-size:10px; }
.chat-message-link { color:var(--g-accent-light); text-decoration:underline; text-underline-offset:2px; overflow-wrap:anywhere; }
.chat-message-link:hover { opacity:.82; }
.seller-chat-system .seller-chat-text { color:var(--g-text-secondary); }

@media (max-width: 900px) {
    .header-inner { gap: 10px; }
    .nav { gap: 12px; }
    .nav a { font-size: 13px; }
}

@media (max-width: 640px) {
    .nav { display: none; }
    .nav-toggle { display: flex; }
    .header-popup {
        top: 62px;
        right: 12px;
        width: calc(100vw - 24px);
        max-width: none;
    }
    .seller-chat-bubble { max-width: 88%; }
    .seller-chat-box { height: calc(100vh - 260px); max-height: 560px; }
    .chat-list-item { gap: 12px; }

    /* Общая адаптация под телефон для мест с инлайновыми стилями (их много
       по всему проекту) — а не только компонентов с выделенным классом. */
    .container { padding: 0 12px; }
    h1 { font-size: 22px !important; }
    .card[style*="padding:28px"], .card[style*="padding: 28px"] { padding: 18px !important; }

    /* Двухколоночные инлайн-формы (админка/продавец) переходят в одну колонку */
    div[style*="grid-template-columns:1fr 1fr"],
    div[style*="grid-template-columns: 1fr 1fr"],
    div[style*="grid-template-columns:repeat(2"],
    div[style*="grid-template-columns: repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    /* Карточка профиля/товара с аватаром сбоку — переносим в столбец */
    div[style*="display:flex;gap:20px;align-items:center"] {
        flex-direction: column;
        align-items: flex-start !important;
        text-align: left;
    }

    /* Модалки на телефоне — меньше внутренних отступов, чтобы контенту было просторнее */
    .modal { padding: 18px; }

    table.admin-table { font-size: 13px; }
}
}


/* Notification cards: readable hierarchy and local-time presentation */
.notification-item {
    display:flex;
    align-items:flex-start;
    gap:12px;
    padding:12px 13px;
    border-bottom:1px solid var(--g-border);
    transition:background .15s, transform .15s;
}
.notification-item:hover { background:rgba(255,255,255,.025); }
.notification-item.unread { background:rgba(124,92,255,.055); }
.notification-icon {
    width:36px;height:36px;flex:0 0 36px;border-radius:10px;
    display:flex;align-items:center;justify-content:center;
    background:var(--g-bg);border:1px solid var(--g-border);font-size:18px;
}
.notification-content { min-width:0; flex:1; }
.notification-title { font-size:13px;font-weight:700;line-height:1.35;margin-bottom:3px; }
.notification-text { font-size:12px;line-height:1.5;color:var(--g-text-secondary); }
.notification-time {
    margin-top:6px;font-size:11px;color:var(--g-text-secondary);opacity:.82;
}
.gtoast { 
    display:flex;align-items:flex-start;gap:12px;
    background:var(--g-card);border:1px solid var(--g-border);
    box-shadow:0 12px 35px rgba(0,0,0,.35);border-radius:14px;
}
