/* ============================================================
   AdMarket — основные стили
   Шрифт: Plus Jakarta Sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* -------------------------------------------------------
   CSS-переменные
   ------------------------------------------------------- */
:root {
    --color-bg:          #F8F9FB;
    --color-surface:     #FFFFFF;
    --color-border:      #E5E7EB;
    --color-border-dark: #D1D5DB;

    --color-text:        #111827;
    --color-text-muted:  #6B7280;
    --color-text-light:  #9CA3AF;

    --color-primary:     #2563EB;
    --color-primary-hover: #1D4ED8;
    --color-primary-light: #EFF6FF;

    --color-success:     #16A34A;
    --color-success-bg:  #F0FDF4;
    --color-warning:     #D97706;
    --color-warning-bg:  #FFFBEB;
    --color-danger:      #DC2626;
    --color-danger-bg:   #FEF2F2;

    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;

    --shadow-sm:   0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md:   0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:   0 8px 32px rgba(0,0,0,.10);

    --sidebar-width: 240px;
    --header-height: 56px;
    --mobile-nav-height: 56px;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* -------------------------------------------------------
   Сброс и базовые стили
   ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-size: 15px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    min-height: 100dvh;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* -------------------------------------------------------
   Layout
   ------------------------------------------------------- */
.layout {
    display: flex;
    min-height: 100vh;
}

/* --- Боковая панель --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar__logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    font-size: 17px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -.3px;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
}

.sidebar__logo-icon {
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar__nav {
    flex: 1;
    padding: 12px 10px;
}

.sidebar__section-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-text-light);
    padding: 8px 10px 4px;
}

.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background .15s, color .15s;
}

.sidebar__nav a:hover,
.sidebar__nav a.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    text-decoration: none;
}

.sidebar__nav a svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.sidebar__nav .badge {
    margin-left: auto;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 20px;
    line-height: 1.6;
}

/* --- Роль-свитчер в сайдбаре --- */
.role-switcher {
    padding: 12px;
    border-top: 1px solid var(--color-border);
}

.role-switcher__label {
    font-size: 11px;
    color: var(--color-text-light);
    margin-bottom: 6px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .05em;
}

.role-tabs {
    display: flex;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    padding: 3px;
    gap: 2px;
}

.role-tabs__btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 12.5px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-muted);
    transition: background .15s, color .15s;
}

.role-tabs__btn.active {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* --- Основной контент --- */
.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Шапка --- */
.header {
    height: var(--header-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header__title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.header__actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.header__balance {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--color-primary-light);
    border: 1px solid #BFDBFE;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-primary);
}

.header__balance svg { width: 14px; height: 14px; flex-shrink: 0; }

.header__notifications {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}

.header__notifications:hover { background: var(--color-bg); }

.header__notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    border: 2px solid var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.header__user {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background .15s;
    text-decoration: none;
    color: var(--color-text);
}

.header__user:hover { background: var(--color-bg); text-decoration: none; }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--color-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    color: var(--color-primary);
    flex-shrink: 0;
}

.avatar--lg { width: 56px; height: 56px; font-size: 20px; }
.avatar--xl { width: 80px; height: 80px; font-size: 28px; }

.header__user-name {
    font-size: 13.5px;
    font-weight: 600;
}

/* --- Основной контент страницы --- */
.page-content {
    flex: 1;
    padding: 28px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-header__left { flex: 1; }

.page-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.3px;
}

.page-subtitle {
    font-size: 13.5px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* -------------------------------------------------------
   Карточки
   ------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px;
}

.card--flat { box-shadow: none; }
.card--shadow { box-shadow: var(--shadow-sm); }

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card__title {
    font-size: 15px;
    font-weight: 700;
}

.card__subtitle {
    font-size: 12.5px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

/* -------------------------------------------------------
   Кнопки
   ------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn--primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn--primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    text-decoration: none;
    color: #fff;
}

.btn--secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border-dark);
}
.btn--secondary:hover:not(:disabled) {
    background: var(--color-bg);
    text-decoration: none;
}

.btn--ghost {
    background: transparent;
    color: var(--color-text-muted);
    border-color: transparent;
}
.btn--ghost:hover:not(:disabled) {
    background: var(--color-bg);
    color: var(--color-text);
    text-decoration: none;
}

.btn--danger {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: #FECACA;
}
.btn--danger:hover:not(:disabled) {
    background: var(--color-danger);
    color: #fff;
    text-decoration: none;
}

.btn--success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: #BBF7D0;
}
.btn--success:hover:not(:disabled) {
    background: var(--color-success);
    color: #fff;
    text-decoration: none;
}

.btn--sm { padding: 5px 12px; font-size: 12.5px; }
.btn--lg { padding: 11px 22px; font-size: 15px; }
.btn--block { width: 100%; }
.btn--icon { padding: 7px; border-radius: var(--radius-sm); }

/* -------------------------------------------------------
   Формы
   ------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 16px;
}

label {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.form-hint {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: -2px;
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    font-size: 14px;
    font-family: inherit;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
    outline: none;
}

.form-control:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.form-control.is-invalid { border-color: var(--color-danger); }

.invalid-feedback {
    font-size: 12px;
    color: var(--color-danger);
}

textarea.form-control { resize: vertical; min-height: 90px; }

select.form-control { cursor: pointer; }

.form-row {
    display: flex;
    gap: 16px;
}

.form-row > * { flex: 1; }

/* -------------------------------------------------------
   Таблицы
   ------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

thead th {
    padding: 11px 16px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    white-space: nowrap;
}

tbody tr {
    border-bottom: 1px solid var(--color-border);
    transition: background .1s;
}

tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--color-bg); }

tbody td {
    padding: 12px 16px;
    color: var(--color-text);
    vertical-align: middle;
}

/* -------------------------------------------------------
   Бэйджи / статусы
   ------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 20px;
    white-space: nowrap;
}

.badge--primary   { background: var(--color-primary-light);  color: var(--color-primary); }
.badge--success   { background: var(--color-success-bg);     color: var(--color-success); }
.badge--warning   { background: var(--color-warning-bg);     color: var(--color-warning); }
.badge--danger    { background: var(--color-danger-bg);      color: var(--color-danger);  }
.badge--gray      { background: #F3F4F6;                     color: var(--color-text-muted); }

/* -------------------------------------------------------
   Уведомления (toast / flash)
   ------------------------------------------------------- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    box-shadow: var(--shadow-lg);
    pointer-events: all;
    min-width: 280px;
    max-width: 380px;
    animation: toast-in .2s ease;
    font-size: 13.5px;
}

.toast--success { border-left: 3px solid var(--color-success); }
.toast--error   { border-left: 3px solid var(--color-danger); }
.toast--warning { border-left: 3px solid var(--color-warning); }
.toast--info    { border-left: 3px solid var(--color-primary); }

.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__body { flex: 1; }
.toast__title { font-weight: 600; }
.toast__msg { color: var(--color-text-muted); font-size: 12.5px; margin-top: 1px; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* -------------------------------------------------------
   Модальные окна
   ------------------------------------------------------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 480px;
    transform: translateY(8px);
    transition: transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal__header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modal__title {
    font-size: 16px;
    font-weight: 700;
}

.modal__close {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    transition: background .15s;
}
.modal__close:hover { background: var(--color-bg); }

.modal__body    { padding: 20px 24px; }
.modal__footer  { padding: 16px 24px 20px; border-top: 1px solid var(--color-border); display: flex; gap: 8px; justify-content: flex-end; }

/* -------------------------------------------------------
   Стат-карточки (дашборд)
   ------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.stat-card__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

.stat-card__value {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--color-text);
    line-height: 1.2;
}

.stat-card__sub {
    font-size: 12px;
    color: var(--color-text-muted);
}

.stat-card__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light);
    color: var(--color-primary);
    margin-bottom: 6px;
}

/* -------------------------------------------------------
   Auth-страницы
   ------------------------------------------------------- */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 20px;
}

.auth-box {
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: var(--color-text);
    margin-bottom: 28px;
    justify-content: center;
    text-decoration: none;
}

.auth-logo__icon {
    width: 36px;
    height: 36px;
    background: var(--color-primary);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
}

.auth-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
}

.auth-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13.5px;
    color: var(--color-text-muted);
    margin-bottom: 26px;
}

/* -------------------------------------------------------
   Каталог
   ------------------------------------------------------- */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.channel-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color .15s, box-shadow .15s;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.channel-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 16px rgba(37,99,235,.10);
    text-decoration: none;
}

.channel-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.channel-card__avatar {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 800;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.channel-card__avatar img { width: 100%; height: 100%; object-fit: cover; }

.channel-card__name {
    font-size: 14.5px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-card__username {
    font-size: 12.5px;
    color: var(--color-text-muted);
}

.channel-card__stats {
    display: flex;
    gap: 16px;
}

.channel-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.channel-stat__value {
    font-size: 15px;
    font-weight: 700;
}

.channel-stat__label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: .04em;
}

.channel-card__price {
    font-size: 13px;
    color: var(--color-primary);
    font-weight: 600;
    padding-top: 8px;
    border-top: 1px solid var(--color-border);
}

/* -------------------------------------------------------
   Чат
   ------------------------------------------------------- */
.chat-layout {
    display: flex;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
}

.chat-list {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    background: var(--color-surface);
}

.chat-list__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    text-decoration: none;
    color: var(--color-text);
    transition: background .1s;
}

.chat-list__item:hover,
.chat-list__item.active {
    background: var(--color-primary-light);
    text-decoration: none;
}

.chat-list__info { flex: 1; min-width: 0; }
.chat-list__name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list__preview { font-size: 12px; color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list__meta { flex-shrink: 0; text-align: right; }
.chat-list__time { font-size: 11.5px; color: var(--color-text-light); }

.chat-unread {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
}

.chat-room {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-room__header {
    height: var(--header-height);
    border-bottom: 1px solid var(--color-border);
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-surface);
    flex-shrink: 0;
}

.chat-room__messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--color-bg);
}

.msg {
    display: flex;
    gap: 8px;
    max-width: 72%;
}

.msg--own { flex-direction: row-reverse; align-self: flex-end; }
.msg--other { align-self: flex-start; }

.msg.msg--system {
    max-width: 100%;
    align-self: center;
    justify-content: center;
}

.msg__bubble {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    border-bottom-left-radius: 3px;
    padding: 10px 14px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
}

.msg__inline-img {
    max-width: 100%;
    width: auto;
    height: auto;
    border-radius: 6px;
    display: block;
    vertical-align: middle;
}

.msg__media-link {
    display: block;
    max-width: min(280px, 100%);
    margin-bottom: 4px;
}

.msg--own .msg__bubble {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    border-radius: var(--radius-md);
    border-bottom-right-radius: 3px;
}

.msg__system {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 3px 12px;
    background: rgba(0,0,0,.04);
    border-radius: 20px;
    align-self: center;
}

.msg__time {
    font-size: 11px;
    color: var(--color-text-light);
    margin-top: 4px;
    text-align: right;
}

.msg--own .msg__time { color: rgba(255,255,255,.7); }

.msg__file {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
}

.msg__file a { color: inherit; text-decoration: underline; font-size: 13px; }
.msg--own .msg__file a { color: rgba(255,255,255,.9); }

.chat-input-wrap {
    padding: 14px 20px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    resize: none;
    outline: none;
    max-height: 140px;
    min-height: 44px;
    transition: border-color .15s;
    background: var(--color-bg);
}

.chat-input:focus {
    border-color: var(--color-primary);
    background: var(--color-surface);
}

/* -------------------------------------------------------
   Страница заказа
   ------------------------------------------------------- */
.order-status-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow-x: auto;
}

.order-step {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.order-step__circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text-muted);
    background: var(--color-surface);
    transition: all .2s;
}

.order-step--done   .order-step__circle { background: var(--color-success); border-color: var(--color-success); color: #fff; }
.order-step--active .order-step__circle { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }

.order-step__label { font-size: 12.5px; font-weight: 600; color: var(--color-text-muted); }
.order-step--done   .order-step__label,
.order-step--active .order-step__label { color: var(--color-text); }

.order-step__line {
    flex: 1;
    height: 2px;
    background: var(--color-border);
    margin: 0 4px;
    min-width: 20px;
}

.order-step--done + .order-step .order-step__line,
.order-step--done .order-step__line { background: var(--color-success); }

/* -------------------------------------------------------
   Вкладки
   ------------------------------------------------------- */
.tabs {
    display: flex;
    gap: 2px;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-muted);
    border: none;
    background: transparent;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}

.tab-btn.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* -------------------------------------------------------
   Поиск
   ------------------------------------------------------- */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--color-surface);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    transition: border-color .15s;
}

.search-bar:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.08);
}

.search-bar svg { color: var(--color-text-muted); flex-shrink: 0; }

.search-bar input {
    border: none;
    outline: none;
    font-size: 14px;
    font-family: inherit;
    background: transparent;
    color: var(--color-text);
    width: 100%;
}

/* -------------------------------------------------------
   Прочее
   ------------------------------------------------------- */
.divider {
    height: 1px;
    background: var(--color-border);
    margin: 16px 0;
}

.text-muted  { color: var(--color-text-muted); }
.text-sm     { font-size: 12.5px; }
.text-right  { text-align: right; }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }
.mt-0  { margin-top: 0; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0  { margin-bottom: 0; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.w-full { width: 100%; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}

.empty-state__icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    color: var(--color-text-light);
}

.empty-state__title { font-size: 15px; font-weight: 700; color: var(--color-text); margin-bottom: 5px; }
.empty-state__text  { font-size: 13.5px; }
.empty-state__hint {
    font-size: 13px;
    margin-top: 10px;
    max-width: 340px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
    color: var(--color-text-light);
}

/* -------------------------------------------------------
   Центр уведомлений
   ------------------------------------------------------- */
.page-header--notifications {
    flex-wrap: wrap;
    align-items: flex-start;
}

.page-header__actions {
    flex-shrink: 0;
}

.notifications-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notif-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    text-decoration: none;
    color: inherit;
    transition: border-color .15s, box-shadow .15s;
    min-height: 48px;
}

.notif-card:hover {
    border-color: var(--color-border-dark);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
}

.notif-card--unread {
    border-left: 3px solid var(--color-primary);
    background: linear-gradient(90deg, var(--color-primary-light) 0%, var(--color-surface) 48%);
}

.notif-card__icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.notif-card__title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
    line-height: 1.35;
}

.notif-card__text {
    font-size: 13px;
    color: var(--color-text-muted);
    line-height: 1.45;
    margin-bottom: 6px;
}

.notif-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--color-text-light);
}

.notif-card__hint {
    color: var(--color-primary);
    font-weight: 500;
}

.notif-card__chevron {
    flex-shrink: 0;
    color: var(--color-text-light);
    align-self: center;
}

/* Таблицы: горизонтальный скролл на узких экранах */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px;
}

/* Рейтинг */
.rating {
    display: flex;
    align-items: center;
    gap: 5px;
}

.rating__stars { color: #F59E0B; letter-spacing: 1px; font-size: 13px; }
.rating__score { font-weight: 700; font-size: 13.5px; }
.rating__count { color: var(--color-text-muted); font-size: 12px; }

/* Пагинация */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    text-decoration: none;
    transition: background .1s;
}

.pagination a:hover { background: var(--color-bg); }
.pagination .current { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

/* -------------------------------------------------------
   Мобильная нижняя навигация — скрыта на десктопе
   ------------------------------------------------------- */
.mobile-nav { display: none; }

/* -------------------------------------------------------
   Иконка корзины в шапке
   ------------------------------------------------------- */
.header__cart {
    position: relative;
}

.header__cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 17px;
    height: 17px;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--color-surface);
    padding: 0 2px;
}

/* -------------------------------------------------------
   Кнопка успех (корзина)
   ------------------------------------------------------- */
.btn--success {
    background: var(--color-success);
    color: #fff;
    border-color: var(--color-success);
}
.btn--success:hover { background: #15803D; border-color: #15803D; }

/* -------------------------------------------------------
   Корзина: layout
   ------------------------------------------------------- */
.cart-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    align-items: start;
}

.cart-summary {
    /* sticky реализован inline */
}

/* Карточка позиции в корзине */
.cart-item__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.cart-item__avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 800;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Статистика в карточке корзины */
.cart-item__stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 6px;
    padding: 12px 0;
    border-top: 1px solid var(--color-border);
}

.cart-stat {
    padding: 8px 10px;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

.cart-stat__val {
    font-size: 15px;
    font-weight: 800;
}

.cart-stat__lbl {
    font-size: 10.5px;
    color: var(--color-text-muted);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Список тарифов в корзине */
.cart-pricing-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cart-pricing-opt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}

.cart-pricing-opt:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

.cart-pricing-opt--active {
    border-color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Строка итого */
.cart-sum-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -------------------------------------------------------
   Планшет
   ------------------------------------------------------- */
@media (max-width: 1024px) {
    .page-content {
        padding: 20px;
    }

    .page-title {
        font-size: clamp(17px, 4vw, 20px);
    }

    .channel-detail-grid {
        grid-template-columns: 1fr !important;
    }
}

/* -------------------------------------------------------
   Responsive (мобильная адаптация)
   ------------------------------------------------------- */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }

    .sidebar { display: none; }
    .main-wrap { margin-left: 0; }
    .page-content {
        padding: 12px 12px calc(72px + env(safe-area-inset-bottom));
    }
    .form-row { flex-direction: column; gap: 0; }
    .chat-list { width: 100%; }
    .chat-layout { flex-direction: column; }

    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }

    .btn--sm {
        min-height: 40px;
    }

    /* Корзина на мобильных — одна колонка */
    .cart-layout {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .page-header > div:last-child {
        width: 100%;
    }

    .page-header .btn {
        width: 100%;
        justify-content: center;
    }

    .page-header--notifications .page-header__actions {
        width: 100%;
    }

    .page-header--notifications .page-header__actions .btn {
        width: 100%;
    }

    .cart-item__header {
        flex-wrap: wrap;
    }

    .cart-item__stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .catalog-channel-grid {
        grid-template-columns: 1fr !important;
    }

    .order-status-bar {
        gap: 4px;
        padding: 10px 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        justify-content: flex-start;
    }

    .order-detail-layout {
        grid-template-columns: 1fr !important;
    }

    .header__balance span.balance-label { display: none; }

    .header {
        padding: 0 10px 0 12px;
        gap: 8px;
        min-height: 52px;
    }
    .header__user-name { display: none; }

    .header__notifications,
    .header__cart {
        min-width: 44px;
        min-height: 44px;
    }

    .header__user {
        min-height: 44px;
    }

    .modal .modal__footer {
        flex-direction: column;
    }

    .modal .modal__footer .btn {
        width: 100%;
    }

    .notif-card {
        padding: 12px 14px;
        gap: 10px;
    }

    .notif-card__chevron {
        display: none;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-top: 1px solid var(--color-border);
        z-index: 200;
        padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
        box-shadow: 0 -4px 20px rgba(0, 0, 0, .06);
        justify-content: space-around;
        align-items: stretch;
    }

    .mobile-nav--dense .mobile-nav__item {
        padding: 4px 1px;
    }

    .mobile-nav--dense .mobile-nav__label {
        font-size: 9px;
        letter-spacing: -0.02em;
    }

    .mobile-nav__item {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 4px 2px;
        color: var(--color-text-muted);
        text-decoration: none;
        position: relative;
        transition: color .15s;
    }

    .mobile-nav__label {
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
        text-align: center;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .mobile-nav__item.active,
    .mobile-nav__item:hover {
        color: var(--color-primary);
        text-decoration: none;
    }

    .mobile-nav__item svg {
        width: 22px;
        height: 22px;
        flex-shrink: 0;
    }

    .mobile-nav__badge {
        position: absolute;
        top: 0;
        left: 50%;
        margin-left: 6px;
        min-width: 16px;
        height: 16px;
        border-radius: 8px;
        background: var(--color-danger);
        color: #fff;
        font-size: 9px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--color-surface);
        padding: 0 4px;
        box-sizing: border-box;
    }

    .form-control,
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select {
        min-height: 44px;
        font-size: 16px;
    }

    textarea.form-control {
        min-height: 100px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .cart-item__stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .cart-pricing-list .cart-pricing-opt {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .header__balance {
        padding: 5px 8px;
        font-size: 12px;
    }
}
