/* ================================================================
   ТОКЕНЫ — цвета, отступы, радиусы
================================================================ */
:root {
    --accent:        #2481cc;
    --accent-light:  #e8f3fc;
    --accent-dark:   #1a6aad;

    --bg:            #f0f2f5;
    --surface:       #ffffff;
    --border:        rgba(0, 0, 0, 0.08);
    --divider:       rgba(0, 0, 0, 0.06);

    --text:          #111827;
    --text-secondary:#6b7280;
    --text-muted:    #9ca3af;

    --success:       #16a34a;
    --success-light: #dcfce7;
    --warning:       #d97706;
    --warning-light: #fef3c7;
    --danger:        #dc2626;
    --danger-light:  #fee2e2;

    --radius-sm:     8px;
    --radius:        14px;
    --radius-lg:     18px;

    --shadow-sm:     0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:        0 4px 12px rgba(0,0,0,0.08);

    --header-h:      56px;
    --bottom-nav-h:  60px;
}

/* ================================================================
   СБРОС + БАЗОВЫЕ СТИЛИ
================================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ================================================================
   УТИЛИТЫ
================================================================ */
.hidden   { display: none !important; }
.mt-8     { margin-top: 8px; }
.mt-12    { margin-top: 12px; }
.mt-16    { margin-top: 16px; }
.text-muted { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.accent   { color: var(--accent); }

/* ================================================================
   ШАПКА
================================================================ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    height: var(--header-h);
    box-shadow: var(--shadow-sm);
}

.header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.header__brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header__logo { font-size: 20px; }

.header__title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

/* ================================================================
   НИЖНЯЯ НАВИГАЦИЯ
================================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    display: flex;
    align-items: stretch;
    justify-content: center;
    height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    overflow-x: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.bottom-nav::-webkit-scrollbar { display: none; }

.tab {
    flex: 1 1 0;
    max-width: 82px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 2px;
    background: none;
    border: none;
    color: var(--text-secondary); /* was text-muted (2.5:1) → text-secondary (4.6:1) */
    transition: color 0.15s;
    min-width: 0;
    touch-action: manipulation;
}

.tab:active { opacity: 0.7; }

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

.tab__icon {
    font-size: 20px;
    line-height: 1;
}

.tab__label {
    font-size: 11px; /* was 10px — improved readability */
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tab.active {
    color: var(--accent);
}

.tab.active .tab__icon {
    filter: drop-shadow(0 1px 4px rgba(36,129,204,0.4));
}

/* ================================================================
   ОСНОВНОЙ КОНТЕНТ
================================================================ */
.main {
    padding: 16px;
    padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px) + 16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: calc(100vh - var(--header-h));
}

/* ================================================================
   СТРАНИЦЫ
================================================================ */
.page { display: none; flex-direction: column; gap: 12px; }
.page.active { display: flex; }

/* ================================================================
   КАРТОЧКИ
================================================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    gap: 8px;
}

.card__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    flex: 1;
}

.card__badge {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

.card__sub {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ================================================================
   БЕЙДЖИ (статус)
================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge--subscriber { background: var(--success-light); color: var(--success); }
.badge--admin      { background: var(--accent-light);  color: var(--accent); }
.badge--guest      { background: var(--warning-light); color: var(--warning); }

/* ================================================================
   ПРОФИЛЬ (страница «Кабинет»)
================================================================ */
.profile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 0 12px;
}

.profile__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.profile__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

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

.divider {
    height: 1px;
    background: var(--divider);
    margin: 4px 0 12px;
}

.info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
}

.info-row:last-child { border-bottom: none; }

.info-row__label {
    font-size: 13px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.info-row__value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: right;
}

.toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 28px;
}

.toggle__input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle__track {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 42px;
    border-radius: 999px;
    background: var(--border);
    transition: background 0.16s ease;
}

.toggle__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.22);
    transition: transform 0.16s ease;
}

.toggle__input:checked + .toggle__track {
    background: var(--accent);
}

.toggle__input:checked + .toggle__track::after {
    transform: translateX(18px);
}

.toggle__input:disabled + .toggle__track {
    opacity: 0.55;
}

.toggle__text {
    min-width: 72px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-align: right;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.quick-action {
    min-height: 48px;
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.quick-action:active { opacity: 0.75; }
.quick-action__icon { font-size: 18px; flex-shrink: 0; }
.quick-action__text {
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ================================================================
   КНОПКИ
================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 20px;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    font-size: 14px;
    font-weight: 600;
    min-height: 44px;
    transition: all 0.15s ease;
    width: 100%;
    touch-action: manipulation;
}

.btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn--primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.btn--primary:hover  { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn--primary:active { opacity: 0.85; }

.btn--ghost {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn--ghost:hover { background: var(--accent-light); }

.btn--secondary {
    background: rgba(36, 129, 204, 0.08);
    color: var(--accent);
    border-color: rgba(36, 129, 204, 0.18);
}

.btn--secondary:hover { background: rgba(36, 129, 204, 0.12); }

/* ================================================================
   ИНПУТ
================================================================ */
.input {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 16px; /* 16px prevents iOS auto-zoom on focus */
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.15s;
    touch-action: manipulation;
}

.input:focus { border-color: var(--accent); background: var(--surface); }
.input:focus-visible { border-color: var(--accent); outline: 2px solid rgba(36,129,204,0.3); outline-offset: 1px; }

.search-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 4px;
}

.segmented {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.segmented__btn {
    min-height: 44px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    padding: 8px 10px;
    touch-action: manipulation;
}

.segmented__btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.segmented__btn.active {
    background: var(--accent);
    color: #fff;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.admin-actions .btn {
    padding: 10px 8px;
    min-height: 44px;
    font-size: 13px;
    white-space: nowrap;
}

.admin-company {
    margin-top: 16px;
}

.admin-company__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.subscription-renew {
    margin-top: 16px;
    padding: 14px;
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(47, 128, 237, 0.06) 0%, rgba(47, 128, 237, 0.02) 100%);
    border: 1px solid rgba(47, 128, 237, 0.14);
}

.subscription-renew__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.subscription-renew__toggle {
    border: 0;
    background: rgba(47, 128, 237, 0.12);
    color: var(--accent);
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.subscription-renew__title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.subscription-renew__sub {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.subscription-renew__warning {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(242, 153, 74, 0.1);
    color: #b86a17;
    font-size: 12px;
    line-height: 1.45;
}

.subscription-renew__body {
    margin-top: 10px;
}

.subscription-renew__plans {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.subscription-renew__loading {
    grid-column: 1 / -1;
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

.subscription-renew__plan {
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.subscription-renew__plan.active {
    border-color: rgba(47, 128, 237, 0.45);
    box-shadow: 0 10px 22px rgba(47, 128, 237, 0.08);
    transform: translateY(-1px);
}

.subscription-renew__plan-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.subscription-renew__plan-meta {
    margin-top: 3px;
    font-size: 11px;
    color: var(--text-muted);
}

.subscription-renew__plan-price {
    margin-top: 8px;
    font-size: 16px;
    font-weight: 800;
    color: var(--accent);
}

.subscription-renew__btn {
    width: 100%;
    margin-top: 12px;
}

.subscription-renew__status {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.45;
    background: rgba(47, 128, 237, 0.08);
    color: var(--text);
}

.subscription-renew__status--error {
    background: rgba(235, 87, 87, 0.08);
    color: #b53f3f;
}

.subscription-renew__status--success {
    background: rgba(39, 174, 96, 0.08);
    color: #1d8348;
}

.admin-payments__summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.admin-payments__metric {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1px solid var(--border);
}

.admin-payments__metric-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.admin-payments__metric-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text);
}

.admin-payments__list {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    overflow: hidden;
}

.admin-payments__item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--divider);
}

.admin-payments__item:last-child {
    border-bottom: none;
}

.admin-payments__item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.admin-payments__item-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.admin-payments__item-amount {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    white-space: nowrap;
}

.admin-payments__item-meta {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

@media (max-width: 420px) {
    .subscription-renew__plans {
        grid-template-columns: 1fr;
    }

    .admin-payments__summary {
        grid-template-columns: 1fr;
    }

    .admin-payments__metric {
        padding: 10px 12px;
    }

    .admin-payments__metric-label {
        font-size: 11px;
        line-height: 1.35;
    }

    .admin-payments__metric-value {
        font-size: 16px;
    }
}

/* ================================================================
   АЛЁРТЫ
================================================================ */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-top: 8px;
}

.alert--error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(220,38,38,0.15);
}

.alert--success {
    background: var(--success-light);
    color: var(--success);
}

/* ================================================================
   VIN РЕЗУЛЬТАТЫ
================================================================ */
.vin-result {
    padding: 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    border: 1.5px solid var(--border);
    margin-top: 4px;
}

.vin-result--blocked {
    background: var(--danger-light);
    border-color: rgba(220,38,38,0.2);
}

.vin-result--clear {
    background: var(--success-light);
    border-color: rgba(22,163,74,0.2);
}

.vin-result__icon { font-size: 20px; flex-shrink: 0; }

.vin-result__title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
}

.vin-result__row {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.vin-result__vin {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-family: monospace;
}

.vin-result__raw {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    line-height: 1.5;
}

.vin-result__label {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    min-width: 36px;
    margin-right: 4px;
}

.vin-result__row--violation {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(220,38,38,0.15);
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
}

.vin-result__actions {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.vin-result__actions .btn {
    width: auto;
    min-height: 44px;
    padding: 9px 16px;
    margin-top: 0;
    font-size: 13px;
}

.vin-toll-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(36, 129, 204, 0.16);
    background: rgba(36, 129, 204, 0.04);
}

.vin-toll-result--clear {
    background: var(--success-light);
    border-color: rgba(22, 163, 74, 0.18);
}

.vin-toll-result--debt {
    background: #fff6e8;
    border-color: rgba(245, 158, 11, 0.24);
}

.vin-toll-result--error {
    background: var(--danger-light);
    border-color: rgba(220,38,38,0.18);
}

.vin-toll-result__title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.vin-toll-result__plate {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted);
    font-family: monospace;
}

.vin-toll-result__text {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.45;
}

.vehicle-panel {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--divider);
}

.vehicle-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.vehicle-panel__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
}

.vehicle-panel__count {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
}

.vehicle-panel__add {
    width: auto;
    min-height: 44px;
    padding: 9px 16px;
    margin-top: 0;
    font-size: 13px;
}

.vehicle-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.vehicle-form__actions {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 8px;
}

.vehicle-form__actions .btn {
    margin-top: 0;
}

.vehicle-message {
    margin-bottom: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    background: rgba(22,163,74,0.1);
    color: #166534;
    font-size: 13px;
    line-height: 1.35;
}

.vehicle-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vehicle-empty {
    padding: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.vehicle-empty__btn {
    width: auto;
    min-height: 34px;
    padding: 7px 12px;
    margin-top: 10px;
    font-size: 13px;
}

.vehicle-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg);
}

.vehicle-card__title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 3px;
}

.vehicle-card__meta,
.vehicle-card__note {
    font-size: 12px;
    color: var(--text-secondary);
}

.vehicle-card__actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.vehicle-card__btn {
    width: 100%;
    min-height: 44px;
    padding: 9px 8px;
    margin-top: 0;
    font-size: 12px;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .vehicle-card {
        grid-template-columns: 1fr;
    }

    .vehicle-form__actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 340px) {
    .vehicle-card__actions {
        grid-template-columns: 1fr;
    }
}

/* ================================================================
   ЛОАДЕР
================================================================ */
.loader-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.loader {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

/* ================================================================
   ФИЛЬТРЫ
================================================================ */
.filters {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-row label {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
    min-width: 48px;
}

.select {
    flex: 1;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--border);
    font-size: 16px; /* 16px prevents iOS auto-zoom */
    color: var(--text);
    background: var(--bg);
    outline: none;
    cursor: pointer;
    transition: border-color 0.15s;
    touch-action: manipulation;
}

.select:focus { border-color: var(--accent); }
.select:focus-visible { border-color: var(--accent); outline: 2px solid rgba(36,129,204,0.3); outline-offset: 1px; }

/* ================================================================
   РЕГИОНЫ — аккордеон
================================================================ */
.region-list { display: flex; flex-direction: column; gap: 8px; }

.stats-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 8px;
    margin-bottom: 12px;
}

.stats-summary span {
    padding: 10px 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(36,129,204,0.08), rgba(255,255,255,0.96));
    border: 1px solid rgba(36,129,204,0.10);
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.25;
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9);
}

.stats-summary strong {
    display: block;
    margin-top: 4px;
    color: var(--accent-dark);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.4px;
}

.region-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.region-row:hover { background: var(--accent-light); border-color: rgba(36,129,204,0.15); }

.region-list .region-row:hover {
    box-shadow: 0 6px 14px rgba(36,129,204,0.10);
}

.region-row.active {
    background: var(--accent-light);
    border-color: rgba(36,129,204,0.25);
}

.region-row__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.region-row__count {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-left: 6px;
    white-space: nowrap;
}

.region-row__arrow {
    font-size: 16px;
    color: var(--text-muted);
    margin-left: 6px;
    transition: transform 0.2s;
}

.region-row.active .region-row__arrow { transform: rotate(90deg); }

/* Детальная информация региона */
.region-detail {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.region-detail-inline {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 0 8px;
}

.country-block {
    background: var(--surface);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
}

.country-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg);
    cursor: pointer;
    transition: background 0.15s;
}

.country-header:hover { background: var(--accent-light); }

.country-flag { font-size: 18px; flex-shrink: 0; }

.country-name {
    font-size: 13px;
    font-weight: 600;
    flex: 1;
}

.country-total {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
}

.country-items { padding: 4px 14px 10px; }

.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--divider);
    gap: 8px;
}

.stat-row:last-child { border-bottom: none; }

.stat-row__name {
    font-size: 12px;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}

.stat-row__value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

/* ================================================================
   ПЕРСОНАЛЬНАЯ СТАТИСТИКА
================================================================ */
.summary-card {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.summary-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    text-align: center;
    border: 1px solid var(--border);
}

.summary-item__label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.summary-item__value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent);
}

.analytics-block {
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    overflow: hidden;
    transition: opacity 0.15s;
}

.analytics-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.analytics-block--history {
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.analytics-block--loading {
    opacity: 0.62;
    pointer-events: none;
}

.analytics-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--divider);
}

.analytics-block__head > div:first-child {
    min-width: 0;
}

.analytics-block__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.analytics-block__period {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

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

.analytics-periods {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.analytics-period {
    min-height: 36px;
    padding: 0 10px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
}

.analytics-period.active {
    background: var(--accent);
    color: #fff;
}

.analytics-list {
    padding: 4px 14px 8px;
}

.analytics-list--public {
    padding-top: 10px;
}

.analytics-section + .analytics-section {
    margin-top: 4px;
}

.analytics-section__title {
    padding: 0 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.analytics-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--divider);
}

.analytics-row:last-child { border-bottom: none; }
.analytics-row__main { min-width: 0; }

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

.analytics-row__kind,
.analytics-row__meta,
.analytics-empty {
    font-size: 12px;
    color: var(--text-muted);
}

.analytics-row__kind {
    margin-top: 2px;
}

.analytics-row__meta {
    margin-top: 3px;
}

.analytics-empty {
    padding: 12px 14px;
}

.analytics-empty--section {
    padding: 4px 0 10px;
}

.history-chart {
    padding: 10px 14px 14px;
}

.history-summary {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    text-align: right;
}

.history-summary__delta {
    font-size: 11px;
    font-weight: 600;
}

.history-summary--positive .history-summary__delta { color: var(--success); }
.history-summary--negative .history-summary__delta { color: var(--danger); }
.history-summary--neutral .history-summary__delta { color: var(--text-muted); }

.history-metric {
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}

.history-metric:first-child {
    padding-top: 0;
}

.history-metric:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.history-metric__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.history-metric__label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.history-metric__dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
}

.history-metric__dot--issued { background: #6d9eeb; }
.history-metric__dot--returned { background: #f59e0b; }
.history-metric__dot--onhand { background: var(--accent); }

.history-metric__values {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    white-space: nowrap;
}

.history-metric__current {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
}

.history-metric__delta {
    font-size: 12px;
    font-weight: 700;
}

.history-metric__delta--positive { color: var(--success); }
.history-metric__delta--negative { color: var(--danger); }
.history-metric__delta--neutral { color: var(--text-muted); }

.history-metric__range {
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.history-sparkline__svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
    background: rgba(36, 129, 204, 0.03);
}

.history-sparkline__axis {
    stroke: rgba(0, 0, 0, 0.06);
    stroke-width: 1;
}

.history-sparkline__line {
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.history-sparkline__line--issued { stroke: #6d9eeb; }
.history-sparkline__line--returned { stroke: #f59e0b; }
.history-sparkline__line--onhand { stroke: var(--accent); }

.history-sparkline__dates {
    margin-top: 4px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 10px;
    color: var(--text-muted);
}

.analytics-delta {
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 800;
    white-space: nowrap;
}

.analytics-delta--positive { color: var(--success); }
.analytics-delta--negative { color: var(--danger); }
.analytics-delta--neutral { color: var(--text-muted); }

@media (max-width: 420px) {
    .analytics-block__head {
        align-items: flex-start;
        flex-direction: column;
    }

    .analytics-block__side {
        width: 100%;
        justify-content: space-between;
    }

    .history-summary {
        align-items: flex-start;
        text-align: left;
    }

    .history-metric__head {
        align-items: flex-start;
        flex-direction: column;
    }
}

.personal-country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.personal-country-row:hover { background: var(--accent-light); }

.personal-country-info { flex: 1; }

.personal-country-name {
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.personal-country-stats {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.personal-country-arrow {
    font-size: 16px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.personal-country-row.open .personal-country-arrow { transform: rotate(90deg); }

.personal-kinds { padding: 4px 14px 10px; display: none; }
.personal-kinds.visible { display: block; }

.kind-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
}

.kind-row:last-child { border-bottom: none; }

.kind-row__name {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 3px;
}

.kind-row__stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.kind-stat {
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.kind-stat__label { color: var(--text-muted); font-size: 11px; }
.kind-stat__value { font-weight: 700; color: var(--text); }

/* ================================================================
   ЦОНЫ / ИТК
================================================================ */
.directory-search {
    margin-bottom: 10px;
}

.directory-empty {
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.office-detail {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-top: 2px;
    display: none;
}

.office-detail.visible { display: block; }

.office-detail__address {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.office-detail__phones {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.office-detail__email {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 8px;
}

.office-map-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    background: var(--accent-light);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.office-map-btn:hover { background: rgba(36,129,204,0.15); }

/* ================================================================
   КОНТАКТЫ
================================================================ */
.contact-group {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--divider);
}

.contact-group:last-child { border-bottom: none; margin-bottom: 0; }

.contact-group__title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text);
}

.contact-group__note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--divider);
}

.contact-item:last-of-type { border-bottom: none; }

.contact-item--link { cursor: pointer; }

.contact-item__icon { font-size: 20px; flex-shrink: 0; }

.contact-item__label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.contact-item__value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
}

/* ================================================================
   РЕКЛАМНЫЙ БЛОК
================================================================ */
.ad-card { padding: 0; overflow: hidden; }
.ad-card__img { width: 100%; display: block; border-radius: var(--radius); }

/* ================================================================
   БЛОКИРОВЩИК (не Telegram)
================================================================ */
.blocker {
    position: fixed;
    inset: 0;
    background: var(--surface);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    text-align: center;
}

.blocker__icon { font-size: 56px; margin-bottom: 20px; }
.blocker__title { font-size: 20px; font-weight: 700; margin-bottom: 12px; }
.blocker__text { font-size: 14px; color: var(--text-secondary); margin-bottom: 8px; }

/* ================================================================
   PAYWALL
================================================================ */
.paywall {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
    box-sizing: border-box;
}

.paywall__card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px 18px 18px;
    box-shadow: var(--shadow);
    max-width: 420px;
    width: 100%;
    border: 1px solid var(--border);
    margin: 0 auto;
    max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 36px);
    overflow-y: auto;
    box-sizing: border-box;
    scrollbar-width: none;
}

.paywall__card::-webkit-scrollbar { display: none; }

.paywall__hero {
    text-align: left;
    margin-bottom: 14px;
}

.paywall__icon { font-size: 34px; margin-bottom: 10px; }
.paywall__title { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.paywall__desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0; }

.paywall__section-title {
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.paywall__status {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: rgba(47, 128, 237, 0.08);
    border: 1px solid rgba(47, 128, 237, 0.14);
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
    color: var(--text-primary);
}

.paywall__status--error {
    background: rgba(235, 87, 87, 0.08);
    border-color: rgba(235, 87, 87, 0.16);
    color: #b53f3f;
}

.paywall__status--success {
    background: rgba(39, 174, 96, 0.08);
    border-color: rgba(39, 174, 96, 0.16);
    color: #1d8348;
}

.paywall__plans {
    margin-bottom: 16px;
    text-align: left;
}

.paywall__plans-loading {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

.paywall__selector {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    overflow: hidden;
}

.paywall__selector--open {
    box-shadow: 0 12px 28px rgba(47, 128, 237, 0.08);
    border-color: rgba(47, 128, 237, 0.28);
}

.paywall__selector-toggle {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 14px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    cursor: pointer;
}

.paywall__selector-main {
    min-width: 0;
}

.paywall__selector-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.paywall__selector-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.paywall__selector-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-primary);
}

.paywall__selector-badge,
.paywall__plan-badge {
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(47, 128, 237, 0.12);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
}

.paywall__selector-meta {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.paywall__selector-aside {
    text-align: right;
    flex-shrink: 0;
}

.paywall__selector-price {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
}

.paywall__selector-action {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(47, 128, 237, 0.12);
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
}

.paywall__selector-action-text {
    line-height: 1;
}

.paywall__selector-arrow {
    font-size: 12px;
    line-height: 1;
    color: inherit;
}

.paywall__plan-list {
    display: none;
    padding: 0 12px 12px;
    border-top: 1px solid var(--border);
    background: rgba(47, 128, 237, 0.03);
}

.paywall__selector--open .paywall__plan-list {
    display: grid;
    gap: 8px;
    padding-top: 10px;
}

.paywall__plan-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
}

.paywall__plan-option + .paywall__plan-option {
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.paywall__plan-option-main {
    min-width: 0;
}

.paywall__plan-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.paywall__plan-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

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

.paywall__plan-btn {
    min-height: 44px;
    padding-left: 16px;
    padding-right: 16px;
    flex-shrink: 0;
}

.paywall__id {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 16px;
    text-align: left;
}

.paywall__id-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }

.paywall__id-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    user-select: all;
}

.paywall__id-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.paywall__copy-btn {
    margin-top: 10px;
    padding: 8px 12px;
    font-size: 13px;
}

.paywall__btn { margin-top: 10px; }

.paywall__legal {
    margin-top: 14px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--text-muted);
}

.paywall__legal-link {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--accent);
    font-size: inherit;
    font-weight: 600;
    text-decoration: underline;
}

@media (max-width: 420px) {
    .paywall {
        padding-left: 12px;
        padding-right: 12px;
    }

    .paywall__card {
        padding: 18px 14px 16px;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 24px);
    }

    .paywall__title {
        font-size: 20px;
    }

    .paywall__desc {
        font-size: 13px;
    }

    .paywall__plan-badge {
        font-size: 10px;
        padding: 4px 7px;
    }

    .paywall__selector-toggle {
        padding: 12px 10px;
    }

    .paywall__selector-price {
        font-size: 20px;
    }

    .paywall__plan-list {
        padding-left: 10px;
        padding-right: 10px;
    }

    .paywall__plan-option {
        align-items: flex-start;
        flex-direction: column;
    }

    .paywall__plan-btn {
        width: 100%;
    }
}

/* ================================================================
   НОВОСТИ
================================================================ */
.news-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 8px;
}

.news-item {
    display: block;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    cursor: pointer;
}

.news-item:last-child { border-bottom: none; }

.news-item__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

.news-item__excerpt {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 3px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ================================================================
   ФУТЕР
================================================================ */
.app-footer {
    text-align: center;
    padding: 10px 16px 6px;
}

.app-footer__link {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    outline: none;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 4px 8px;
}

/* ================================================================
   МОДАЛ: ПОЛЬЗОВАТЕЛЬСКОЕ СОГЛАШЕНИЕ
================================================================ */
.tos-modal {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: flex-end;
}

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

.tos-modal__overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.tos-modal__sheet {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.tos-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tos-modal__title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.tos-modal__close {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 10px 12px; /* expanded from 4px 8px for 44px touch target */
    line-height: 1;
    touch-action: manipulation;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tos-modal__body {
    overflow-y: auto;
    padding: 16px 16px 32px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tos-modal__body h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 16px 0 6px;
}

.tos-modal__body p { margin-bottom: 8px; }

.tos-modal__body ul {
    padding-left: 18px;
    margin-bottom: 8px;
}

.tos-modal__body ul li { margin-bottom: 4px; }

.tos-edition {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px !important;
}

.tos-copyright {
    margin-top: 20px !important;
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}



/* ================================================================
   COMPANY SELECTOR
================================================================ */
.company-selector {
    padding: 4px 0;
}

.company-selector__title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.company-selector__hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.company-results {
    margin-top: 8px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

.company-results:empty { border: none; }

.company-results__item {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.company-results__item:last-child { border-bottom: none; }
.company-results__item:hover { background: var(--surface-raised); }

.company-results__empty {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.company-confirm {
    margin-top: 14px;
    padding: 14px;
    background: var(--surface-raised);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.company-confirm__name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.company-confirm__text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    line-height: 1.5;
}

.company-confirm__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.company-confirm__actions .btn {
    flex: 1 1 0;
    min-width: 0;
}

.company-confirm--payment {
    background: linear-gradient(180deg, rgba(36, 129, 204, 0.08), rgba(36, 129, 204, 0.03));
    border-color: rgba(36, 129, 204, 0.18);
}

.company-confirm--payment .company-confirm__name {
    margin-bottom: 8px;
}

@media (max-width: 420px) {
    .company-confirm__actions {
        flex-direction: column;
    }

    .company-confirm__actions .btn {
        width: 100%;
    }
}

/* ================================================================
   VIN HISTORY
================================================================ */
.vin-history {
    margin-top: 20px;
}

.vin-history__title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.vin-history__item {
    display: grid;
    grid-template-columns: 20px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

.vin-history__item:last-child { border-bottom: none; }

.vin-history__query {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vin-history__label {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.vin-history__date {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Аналитика рынка ИТК ─────────────────────────────────────── */

.insights-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.insights-summary__total {
    flex: 2;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.insights-summary__label {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.3;
}

.insights-summary__value {
    display: block;
    margin-top: 3px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.insights-summary__delta {
    flex: 1;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

.summary-delta--up   { color: var(--success); }
.summary-delta--down { color: var(--danger); }
.summary-delta--flat { color: var(--text-muted); }

/* Сигналы */
.signals-list {
    display: flex;
    flex-direction: column;
    margin-bottom: 16px;
}

.signal-card {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--divider);
}

.signal-card:last-child { border-bottom: none; }

.signal-card__badge {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.signal-card__text {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    flex: 1;
}

.signal--critical .signal-card__badge      { color: var(--danger); }
.signal--empty .signal-card__badge         { color: var(--text-muted); }
.signal--warning .signal-card__badge       { color: var(--warning); }
.signal--replenishment .signal-card__badge { color: var(--success); }

/* Таблица стран */
.countries-block {
    margin-top: 4px;
}

.countries-block__title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.countries-list {
    display: flex;
    flex-direction: column;
}

.country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 0;
    border-bottom: 1px solid var(--divider);
}

.country-row:last-child { border-bottom: none; }

.country-row__main {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.country-row__flag {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.country-row__name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-row__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    flex-shrink: 0;
}

.country-row__residue {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.country-row__meta {
    font-size: 11px;
    color: var(--text-muted);
    white-space: normal;
    text-align: right;
    max-width: 140px;
}

/* Цветная точка-сигнал */
.country-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.country-dot--critical      { background: var(--danger); }
.country-dot--empty         { background: var(--text-muted); }
.country-dot--warning       { background: var(--warning); }
.country-dot--replenishment { background: var(--success); }

/* Analytics redesign overrides */
.analytics-dashboard {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.analytics-panel {
    background: var(--surface);
    border: 1px solid rgba(17,24,39,0.06);
    border-radius: 18px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.analytics-panel__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid var(--divider);
    background: linear-gradient(180deg, rgba(36,129,204,0.04), rgba(255,255,255,0));
}

.analytics-panel__eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent-dark);
}

.analytics-panel__title {
    margin-top: 4px;
    font-size: 16px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--text);
}

.analytics-panel__meta {
    flex-shrink: 0;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--bg);
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}

.analytics-panel__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analytics-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.analytics-toggle:disabled {
    color: var(--text-muted);
    cursor: default;
    background: var(--bg);
}

.analytics-toggle:not(:disabled):hover {
    border-color: rgba(36,129,204,0.24);
    background: var(--accent-light);
}

.analytics-toggle__arrow {
    display: inline-block;
    font-size: 15px;
    line-height: 1;
    transition: transform 0.2s;
}

.analytics-toggle[aria-expanded="true"] .analytics-toggle__arrow {
    transform: rotate(90deg);
}

.analytics-empty-state {
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.signals-list {
    display: flex;
    flex-direction: column;
    padding: 8px;
    gap: 8px;
    margin-bottom: 0;
}

.signal-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    border: 1px solid transparent;
}

.signal-card:last-child { border-bottom: none; }

.signal-card__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.signal-card__text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    flex: 1;
}

.signal--critical {
    background: linear-gradient(180deg, rgba(220,38,38,0.08), rgba(220,38,38,0.03));
    border-color: rgba(220,38,38,0.14);
}

.signal--critical .signal-card__badge {
    background: rgba(220,38,38,0.14);
    color: var(--danger);
}

.signal--empty {
    background: linear-gradient(180deg, rgba(107,114,128,0.10), rgba(107,114,128,0.04));
    border-color: rgba(107,114,128,0.14);
}

.signal--empty .signal-card__badge {
    background: rgba(107,114,128,0.14);
    color: #4b5563;
}

.signal--warning {
    background: linear-gradient(180deg, rgba(217,119,6,0.10), rgba(217,119,6,0.04));
    border-color: rgba(217,119,6,0.16);
}

.signal--warning .signal-card__badge {
    background: rgba(217,119,6,0.15);
    color: #9a5a06;
}

.signal--replenishment {
    background: linear-gradient(180deg, rgba(22,163,74,0.09), rgba(22,163,74,0.04));
    border-color: rgba(22,163,74,0.14);
}

.signal--replenishment .signal-card__badge {
    background: rgba(22,163,74,0.14);
    color: var(--success);
}

.countries-list {
    display: flex;
    flex-direction: column;
    padding: 6px 10px 10px;
}

.analytics-panel--collapsed .countries-list {
    display: none;
}

.country-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--divider);
}

.country-row__main {
    min-width: 0;
    flex: 1;
}

.country-row__identity {
    min-width: 0;
}

.country-row__title {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.country-row__subline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 12px;
    margin-top: 5px;
    padding-left: 21px;
    font-size: 11px;
    color: var(--text-secondary);
}

.country-row__flag {
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

.country-row__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-row__stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex-shrink: 0;
    text-align: right;
}

.country-row__residue {
    font-size: 18px;
    line-height: 1.1;
    font-weight: 800;
    color: var(--text);
}

.country-row__meta {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: normal;
    max-width: 130px;
}

.country-row__signal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.country-row__signal--critical {
    color: var(--danger);
    background: var(--danger-light);
}

.country-row__signal--empty {
    color: #4b5563;
    background: #e5e7eb;
}

.country-row__signal--warning {
    color: #9a5a06;
    background: var(--warning-light);
}

.country-row__signal--replenishment {
    color: var(--success);
    background: var(--success-light);
}

.country-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 4px rgba(17,24,39,0.04);
}

.country-dot--critical { background: var(--danger); }
.country-dot--empty { background: var(--text-muted); }
.country-dot--warning { background: var(--warning); }
.country-dot--replenishment { background: var(--success); }

@media (max-width: 520px) {
    .stats-summary {
        grid-template-columns: 1fr;
    }

    .country-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .country-row__stats {
        width: 100%;
        align-items: flex-start;
        text-align: left;
    }

    .country-row__meta {
        max-width: none;
    }

    .country-row__subline {
        padding-left: 17px;
    }

    .signal-card {
        flex-direction: column;
    }

    .analytics-panel__head,
    .analytics-panel__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .analytics-panel__meta,
    .analytics-toggle {
        justify-content: center;
    }
}

/* ================================================================
   ANALYTICS BAR CHART — countries visualization
================================================================ */

.country-row--chart {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 8px;
    border-bottom: 1px solid var(--divider);
}

.country-row--chart:last-child { border-bottom: none; }

.country-row__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.country-row--chart .country-row__title {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1;
}

.country-row--chart .country-row__name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.country-row__right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    flex-shrink: 0;
    gap: 1px;
}

.country-row--chart .country-row__residue {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
}

.country-trend {
    font-size: 11px;
    font-weight: 600;
}

.trend--up   { color: var(--success); }
.trend--down { color: var(--danger); }
.trend--flat { color: var(--text-muted); }

.country-bar-track {
    width: 100%;
    height: 6px;
    background: var(--divider);
    border-radius: 999px;
    overflow: hidden;
}

.country-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.country-bar--default       { background: var(--accent); }
.country-bar--replenishment { background: var(--success); }
.country-bar--warning       { background: var(--warning); }
.country-bar--empty         { background: var(--text-muted); }
.country-bar--critical      { background: var(--danger); }

.country-row__foot {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-secondary);
}

.forecast--ok       { color: var(--success); font-weight: 600; }
.forecast--caution  { color: #ca8a04; font-weight: 600; }
.forecast--warning  { color: var(--warning); font-weight: 700; }
.forecast--critical { color: var(--danger); font-weight: 700; }

/* ================================================================
   АНАЛИТИКА РЫНКА — РЕДИЗАЙН (mrkt-*)
================================================================ */

.mrkt-dashboard { display: flex; flex-direction: column; gap: 12px; }

.mrkt-summary {
    display: flex;
    align-items: center;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-sm);
}

.mrkt-summary__item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mrkt-summary__item--urgent   .mrkt-summary__value { color: var(--danger); }
.mrkt-summary__item--positive .mrkt-summary__value { color: var(--success); }

.mrkt-summary__value {
    font-size: 22px; font-weight: 700; line-height: 1;
    color: var(--text); font-variant-numeric: tabular-nums;
}

.mrkt-summary__label {
    font-size: 11px; font-weight: 500; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
}

.mrkt-summary__divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }

.mrkt-section { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }

.mrkt-section__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px 10px; border-bottom: 1px solid var(--divider);
}

.mrkt-section__title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); }

.mrkt-section__count {
    font-size: 12px; font-weight: 600; color: var(--text-muted);
    background: var(--bg); padding: 2px 8px; border-radius: 20px;
}

.mrkt-signals { display: flex; flex-direction: column; }

.mrkt-signal {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 11px 16px; border-bottom: 1px solid var(--divider);
    border-left: 3px solid transparent;
}

.mrkt-signal:last-child { border-bottom: none; }
.mrkt-signal--critical     { border-left-color: var(--danger); }
.mrkt-signal--empty        { border-left-color: var(--text-muted); }
.mrkt-signal--warning      { border-left-color: var(--warning); }
.mrkt-signal--replenishment{ border-left-color: var(--success); }

.mrkt-signal__icon { flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; }
.mrkt-signal--critical     .mrkt-signal__icon { color: var(--danger); }
.mrkt-signal--empty        .mrkt-signal__icon { color: var(--text-muted); }
.mrkt-signal--warning      .mrkt-signal__icon { color: var(--warning); }
.mrkt-signal--replenishment .mrkt-signal__icon { color: var(--success); }

.mrkt-signal__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.mrkt-signal__type { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.mrkt-signal--critical     .mrkt-signal__type { color: var(--danger); }
.mrkt-signal--empty        .mrkt-signal__type { color: var(--text-secondary); }
.mrkt-signal--warning      .mrkt-signal__type { color: var(--warning); }
.mrkt-signal--replenishment .mrkt-signal__type { color: var(--success); }

.mrkt-signal__text { font-size: 13px; color: var(--text); line-height: 1.4; }

.mrkt-countries { display: flex; flex-direction: column; }

.mrkt-country { padding: 12px 16px; border-bottom: 1px solid var(--divider); }
.mrkt-country:last-child { border-bottom: none; }

.mrkt-country__top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.mrkt-country__flag { font-size: 16px; line-height: 1; flex-shrink: 0; }

.mrkt-country__name {
    font-size: 14px; font-weight: 600; color: var(--text);
    flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.mrkt-country__badge {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px; flex-shrink: 0;
}

.mrkt-country__badge--critical     { color: var(--danger);         background: var(--danger-light); }
.mrkt-country__badge--empty        { color: var(--text-secondary); background: var(--bg); }
.mrkt-country__badge--warning      { color: var(--warning);        background: var(--warning-light); }
.mrkt-country__badge--replenishment{ color: var(--success);        background: var(--success-light); }

.mrkt-country__residue { font-size: 15px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; flex-shrink: 0; }

.mrkt-country__bar-wrap { height: 4px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-bottom: 8px; }

.mrkt-country__bar { height: 100%; border-radius: 2px; transition: width 0.3s ease; }
.mrkt-country__bar--critical     { background: var(--danger); }
.mrkt-country__bar--empty        { background: var(--text-muted); }
.mrkt-country__bar--warning      { background: var(--warning); }
.mrkt-country__bar--replenishment{ background: var(--success); }
.mrkt-country__bar--none         { background: var(--accent); }

.mrkt-country__foot { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); }

.mrkt-delta--positive { color: var(--success); font-weight: 500; }
.mrkt-delta--negative { color: var(--danger);  font-weight: 500; }
.mrkt-delta--neutral  { color: var(--text-muted); }

.mrkt-forecast--critical { color: var(--danger);  font-weight: 600; }
.mrkt-forecast--warning  { color: var(--warning); font-weight: 500; }

.mrkt-empty-state { padding: 20px 16px; font-size: 13px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* Personal stats — accordion arrow */
.mrkt-country__top { cursor: pointer; }
.mrkt-pers-arrow { margin-left: auto; color: var(--text-muted); font-size: 18px; line-height: 1; transition: transform 0.2s ease; flex-shrink: 0; }
.personal-country-row.open .mrkt-pers-arrow { transform: rotate(90deg); }

/* ================================================================
   A11Y & UX IMPROVEMENTS
================================================================ */

/* touch-action on quick-action buttons */
.quick-action {
    touch-action: manipulation;
}

.quick-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* subscription renew toggle — 44px touch target */
.subscription-renew__toggle {
    min-height: 44px;
    touch-action: manipulation;
}

/* vehicle empty button */
.vehicle-empty__btn {
    min-height: 44px;
    padding: 9px 16px;
}

/* office map button */
.office-map-btn {
    min-height: 44px;
    touch-action: manipulation;
}

/* region row keyboard/focus support */
.region-row:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* prefers-reduced-motion: disable all transitions and animations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
