/* ===== СБРОС ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--tg-theme-bg-color, #ffffff);
    color: var(--tg-theme-text-color, #000000);
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 16px;
    padding-bottom: 40px;
}

/* ===== ШАПКА ===== */
.header {
    text-align: center;
    padding: 24px 0 16px;
}

.header-icon {
    font-size: 48px;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
}

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

.header h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.subtitle {
    color: var(--tg-theme-hint-color, #999);
    font-size: 14px;
}

/* ===== КАРТОЧКИ ===== */
.card {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: box-shadow 0.2s;
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.hint {
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    margin-bottom: 12px;
    line-height: 1.4;
}

/* ===== ПРОФИЛЬ ===== */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.user-id {
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    font-family: monospace;
}

/* ===== СВОДКА ===== */
.stats-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.stat-tile {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 14px;
    padding: 14px 8px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.15s;
}

.stat-tile:active {
    transform: scale(0.96);
}

.stat-icon {
    font-size: 22px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #2481cc);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* ===== КНОПКИ ===== */
.btn {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    font-family: inherit;
}

.btn:active {
    opacity: 0.85;
    transform: scale(0.98);
}

.btn-primary {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #ffffff);
    box-shadow: 0 4px 12px rgba(36, 129, 204, 0.3);
}

.btn-secondary {
    background: var(--tg-theme-secondary-bg-color, #eee);
    color: var(--tg-theme-text-color, #000);
}

/* ===== ЗАГОЛОВОК РАЗДЕЛА ===== */
.section-title {
    font-size: 16px;
    font-weight: 600;
    margin: 20px 0 12px;
    padding-left: 4px;
}

/* ===== СПИСОК ГРУПП ===== */
.groups-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.group-item {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-item:active {
    transform: scale(0.98);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.group-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.group-content {
    flex: 1;
    min-width: 0;
}

.group-name {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.group-stats {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
}

.group-stat {
    display: flex;
    align-items: center;
    gap: 3px;
}

.group-arrow {
    color: var(--tg-theme-hint-color, #ccc);
    font-size: 20px;
    flex-shrink: 0;
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--tg-theme-hint-color, #999);
    font-size: 14px;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
    margin-bottom: 6px;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--tg-theme-bg-color, #ffffff);
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    border-radius: 20px 20px 0 0;
    padding: 24px 16px 32px;
    position: relative;
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f0f0f0);
    margin-bottom: 16px;
}

.modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 12px;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
    padding: 0 20px;
    word-break: break-word;
}

.modal-subtitle {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
    font-family: monospace;
}

.modal-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.modal-stat {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
}

.modal-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #2481cc);
    line-height: 1.2;
}

.modal-stat-label {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.modal-info {
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    text-align: center;
    margin-bottom: 16px;
    min-height: 20px;
}

/* ===== ФУТЕР ===== */
.footer {
    text-align: center;
    padding: 24px 0 8px;
    color: var(--tg-theme-hint-color, #999);
    font-size: 12px;
}
/* ===== ГРАФИК АКТИВНОСТИ ===== */
.modal-chart-container {
    margin-bottom: 16px;
}

.modal-chart-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
    color: var(--tg-theme-hint-color, #999);
}

.modal-chart-wrap {
    position: relative;
    height: 220px;
    width: 100%;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 8px;
    box-sizing: border-box;
}

.modal-chart-wrap canvas {
    max-width: 100%;
    max-height: 100%;
}
/* Кнопка-ссылка (для modal-open-tg) */
a.btn {
    display: block;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1.2;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
}

a.btn:visited {
    color: var(--tg-theme-button-text-color, #ffffff);
}
/* ===== ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКА ===== */


.lang-btn {
    background: transparent;
    border: none;
    padding: 12px 18px;              /* ← ещё больше для удобного тапа */
    margin: 0;                       /* ← убираем возможные browser-margins */
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    transition: all 0.15s;
    font-family: inherit;
    min-width: 52px;                 /* ← было 44px */
    min-height: 44px;                /* ← 44px — золотой стандарт Apple */
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;      /* ← убирает задержку 300ms на тап */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    line-height: 1;
}

.lang-btn.active {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #ffffff);
}

.lang-btn:active {
    transform: scale(0.96);
}

/* Header должен быть relative для absolute переключателя */
.header {
    position: relative;
}
/* ===== ПЕРЕКЛЮЧАТЕЛЬ ПЕРИОДА ГРАФИКА ===== */
.chart-period-switch {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    justify-content: center;
}

.period-btn {
    flex: 1;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    transition: all 0.15s;
    font-family: inherit;
    min-height: 36px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.period-btn.active {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #ffffff);
}

.period-btn:active {
    transform: scale(0.97);
}

/* ===== ПИРОГ КАТЕГОРИЙ ===== */
.modal-chart-wrap-pie {
    height: 260px;
}
/* ===== ТОП НАРУШИТЕЛЕЙ ===== */
.modal-violators-container {
    margin-bottom: 16px;
}

.violators-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.violator-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 10px;
}

.violator-rank {
    font-size: 18px;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    color: var(--tg-theme-hint-color, #999);
    flex-shrink: 0;
}

.violator-info {
    flex: 1;
    min-width: 0;
}

.violator-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.violator-meta {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.violator-count {
    font-size: 13px;
    font-weight: 700;
    color: var(--tg-theme-button-color, #2481cc);
    flex-shrink: 0;
    background: rgba(36, 129, 204, 0.12);
    padding: 4px 8px;
    border-radius: 8px;
}

.violators-loading,
.violators-empty {
    text-align: center;
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    padding: 12px 0;
    margin: 0;
}
/* ===== FOOTER LINK ===== */
.footer-link {
    margin-top: 6px;
}

.footer-link a {
    color: var(--tg-theme-link-color, #2481cc);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: opacity 0.15s;
}

.footer-link a:active {
    opacity: 0.7;
}

/* ===== НАСТРОЙКИ ГРУППЫ (модалка) ===== */
.modal-settings-container {
    margin-bottom: 16px;
}

.settings-toggles {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 10px;
}

.setting-info {
    flex: 1;
    min-width: 0;
}

.setting-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.setting-desc {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
}

/* Тумблер */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 24px;
    transition: 0.2s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

input:checked + .slider {
    background: var(--tg-theme-button-color, #2481cc);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

input:disabled + .slider {
    opacity: 0.5;
    cursor: wait;
}

.settings-hint {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    text-align: center;
    margin-top: 8px;
    transition: color 0.2s;
}

.settings-hint.applying {
    color: #5aa9e6;
}


/* ===== КНОПКА АДМИН-ПАНЕЛИ ===== */


.admin-btn:active {
    transform: scale(0.92);
    box-shadow: 0 2px 6px rgba(243, 156, 18, 0.6);
}

/* ===== АДМИН-МОДАЛКА ===== */
.admin-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeIn 0.2s;
}

.admin-modal {
    background: var(--tg-theme-bg-color, #ffffff);
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    padding: 24px 20px 28px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.admin-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-modal-header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--tg-theme-secondary-bg-color, #f0f0f0);
    margin-bottom: 16px;
}

.admin-modal-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.admin-modal-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.admin-modal-subtitle {
    font-size: 13px;
    color: var(--tg-theme-hint-color, #999);
}

.admin-placeholder {
    text-align: center;
    padding: 20px 12px;
    color: var(--tg-theme-hint-color, #999);
}

.admin-placeholder-icon {
    font-size: 56px;
    margin-bottom: 12px;
    opacity: 0.7;
}

.admin-placeholder p {
    font-size: 15px;
    margin-bottom: 8px;
    color: var(--tg-theme-text-color, #000);
    font-weight: 600;
}

.admin-placeholder-hint {
    font-size: 12px !important;
    color: var(--tg-theme-hint-color, #999) !important;
    font-weight: 400 !important;
    line-height: 1.5;
}


/* ===== АДМИН-ПАНЕЛЬ: ТАБЫ ===== */
.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tab {
    flex-shrink: 0;
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border: none;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    color: var(--tg-theme-hint-color, #999);
    transition: all 0.15s;
    font-family: inherit;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.admin-tab.active {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
}

.admin-tab:active { transform: scale(0.96); }

/* ===== КОНТЕНТ ===== */
.admin-content {
    min-height: 200px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 4px;
}

.admin-loading,
.admin-empty {
    text-align: center;
    color: var(--tg-theme-hint-color, #999);
    font-size: 13px;
    padding: 30px 12px;
}

/* ===== СВОДКА ===== */
.admin-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.admin-summary-tile {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 14px 12px;
    text-align: center;
}

.admin-summary-icon {
    font-size: 22px;
    margin-bottom: 4px;
}

.admin-summary-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--tg-theme-button-color, #2481cc);
    line-height: 1.1;
    margin-bottom: 2px;
}

.admin-summary-label {
    font-size: 10px;
    color: var(--tg-theme-hint-color, #999);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== СПИСКИ ===== */
.admin-item {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 6px;
}

.admin-item-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
}

.admin-item-main {
    flex: 1;
    min-width: 0;
}

.admin-item-name {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-item-meta {
    font-size: 11px;
    color: var(--tg-theme-hint-color, #999);
    line-height: 1.4;
}

.admin-item-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 8px;
    font-weight: 700;
    background: rgba(36, 129, 204, 0.15);
    color: var(--tg-theme-button-color, #2481cc);
    flex-shrink: 0;
}

.admin-item-badge.warn {
    background: rgba(231, 76, 60, 0.15);
    color: #e74c3c;
}

.admin-item-badge.gold {
    background: rgba(243, 156, 18, 0.18);
    color: #f39c12;
}

.admin-item-text {
    font-size: 12px;
    color: var(--tg-theme-text-color, #000);
    background: rgba(0, 0, 0, 0.04);
    padding: 6px 8px;
    border-radius: 6px;
    margin: 4px 0 6px;
    word-break: break-word;
    max-height: 80px;
    overflow-y: auto;
}

.admin-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.admin-action-btn {
    flex: 1;
    background: var(--tg-theme-bg-color, #fff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    color: var(--tg-theme-text-color, #000);
    font-family: inherit;
    transition: all 0.15s;
    touch-action: manipulation;
}

.admin-action-btn:active { transform: scale(0.96); }
.admin-action-btn:disabled { opacity: 0.5; }

.admin-action-btn.danger {
    color: #e74c3c;
    border-color: rgba(231, 76, 60, 0.3);
}

/* ===== РОЛИ ===== */
.admin-role-section {
    margin-bottom: 16px;
}

.admin-role-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--tg-theme-hint-color, #999);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
    padding-left: 4px;
}


/* ===== КАСТОМНЫЕ ТЕКСТЫ ===== */
.custom-texts-hint {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
    text-align: center;
    margin-bottom: 10px;
    line-height: 1.4;
}

.custom-texts-open-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
}

.custom-texts-modal {
    max-height: 90vh;
}

.custom-texts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 65vh;
    overflow-y: auto;
    padding-right: 4px;
}

.custom-texts-item {
    background: var(--tg-theme-secondary-bg-color, #f5f5f5);
    border-radius: 12px;
    padding: 12px;
}

.custom-texts-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.custom-texts-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
}

.custom-texts-item-status {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-texts-item-status.custom {
    background: rgba(243, 156, 18, 0.18);
    color: #f39c12;
}

.custom-texts-item-status.default {
    background: rgba(128, 128, 128, 0.15);
    color: var(--tg-theme-hint-color, #999);
}

.custom-texts-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 70px;
    max-height: 200px;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.4;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.custom-texts-textarea:focus {
    border-color: var(--tg-theme-button-color, #2481cc);
}

.custom-texts-hint-vars {
    font-size: 10px;
    color: var(--tg-theme-hint-color, #999);
    margin-top: 4px;
    line-height: 1.3;
}

.custom-texts-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}

.custom-texts-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: inherit;
    transition: all 0.15s;
    touch-action: manipulation;
}

.custom-texts-btn:active { transform: scale(0.97); }
.custom-texts-btn:disabled { opacity: 0.5; }

.custom-texts-btn.save {
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
}

.custom-texts-btn.reset {
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-hint-color, #999);
    border: 1px solid rgba(0, 0, 0, 0.08);
}


/* ===== GHOST MODE UI ===== */
.setting-help-btn {
    background: transparent;
    border: 1px solid var(--tg-theme-hint-color, #999);
    color: var(--tg-theme-hint-color, #999);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    line-height: 1;
    margin-left: 6px;
    transition: all 0.15s;
}

.setting-help-btn:active {
    background: rgba(128,128,128,0.15);
    transform: scale(0.92);
}

.ghost-settings-block {
    background: rgba(128, 80, 200, 0.08);
    border: 1px solid rgba(128, 80, 200, 0.2);
    border-radius: 10px;
    padding: 12px;
    margin-top: 6px;
    margin-bottom: 8px;
    display: none;
}

.ghost-settings-block.active {
    display: block;
}

.ghost-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--tg-theme-text-color, #000);
    margin-bottom: 6px;
    display: block;
}

.ghost-timeout-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.ghost-timeout-input {
    width: 90px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: var(--tg-theme-bg-color, #fff);
    color: var(--tg-theme-text-color, #000);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    outline: none;
}

.ghost-timeout-input:focus {
    border-color: var(--tg-theme-button-color, #2481cc);
}

.ghost-timeout-unit {
    font-size: 12px;
    color: var(--tg-theme-hint-color, #999);
}

.ghost-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tg-theme-text-color, #000);
    padding: 8px 10px;
    background: var(--tg-theme-bg-color, #fff);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
}

.ghost-radio:hover {
    border-color: rgba(36, 129, 204, 0.3);
}

.ghost-radio input[type="radio"] {
    accent-color: var(--tg-theme-button-color, #2481cc);
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin: 0;
    flex-shrink: 0;
}

.ghost-save-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: all 0.15s;
}

.ghost-save-btn:active {
    transform: scale(0.98);
    opacity: 0.9;
}

/* Help-модалка для ghost */
.help-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    animation: fadeIn 0.2s;
}

.help-modal {
    background: var(--tg-theme-bg-color, #fff);
    width: 100%;
    max-width: 420px;
    max-height: 85vh;
    overflow-y: auto;
    border-radius: 18px;
    padding: 22px 20px;
    box-sizing: border-box;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.help-modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
    text-align: center;
    color: var(--tg-theme-text-color, #000);
}

.help-modal-body {
    font-size: 13px;
    line-height: 1.55;
    color: var(--tg-theme-text-color, #000);
    margin-bottom: 16px;
}

.help-modal-body b {
    color: var(--tg-theme-text-color, #000);
}

.help-modal-close {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: none;
    background: var(--tg-theme-button-color, #2481cc);
    color: var(--tg-theme-button-text-color, #fff);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

/* ===== ПЕРЕКЛЮЧЕНИЕ ТЕМ ===== */
body.theme-light {
    --tg-theme-bg-color: #ffffff !important;
    --tg-theme-text-color: #000000 !important;
    --tg-theme-hint-color: #999999 !important;
    --tg-theme-link-color: #2678b6 !important;
    --tg-theme-button-color: #2678b6 !important;
    --tg-theme-button-text-color: #ffffff !important;
    --tg-theme-secondary-bg-color: #f4f4f5 !important;
    background-color: #ffffff !important;
    color: #000000 !important;
}

body.theme-dark {
    --tg-theme-bg-color: #17212b !important;
    --tg-theme-text-color: #ffffff !important;
    --tg-theme-hint-color: #7d8b99 !important;
    --tg-theme-link-color: #6ab2f2 !important;
    --tg-theme-button-color: #5288c1 !important;
    --tg-theme-button-text-color: #ffffff !important;
    --tg-theme-secondary-bg-color: #232e3c !important;
    background-color: #17212b !important;
    color: #ffffff !important;
}

/* Принудительно перекрашиваем элементы, если они были заданы жестко */
body.theme-light * {
    border-color: #e1e3e6 !important;
}
body.theme-light .setting-item, 
body.theme-light .card, 
body.theme-light .modal-content {
    background: #ffffff !important;
    color: #000000 !important;
}

body.theme-dark * {
    border-color: #2f3b4b !important;
}
body.theme-dark .setting-item, 
body.theme-dark .card, 
body.theme-dark .modal-content {
    background: #232e3c !important;
    color: #ffffff !important;
}

/* Fix header layout */




/* Возвращаем красивую кнопку админа */
.admin-btn {
    background: linear-gradient(135deg, #FFB75E, #ED8F03);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(237, 143, 3, 0.4);
    transition: transform 0.1s;
}
.admin-btn:active { transform: scale(0.95); }

/* Переключатель языка (Segmented) */
.lang-segmented {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
}
.lang-segmented .lang-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--tg-theme-hint-color, #999);
    padding: 6px 0;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.lang-segmented .lang-btn.active {
    background: var(--tg-theme-button-color, #5288c1);
    color: var(--tg-theme-button-text-color, #fff);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* Переключатель темы (Toggle) */
.theme-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
}
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 26px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #555;
    transition: .3s;
    border-radius: 26px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--tg-theme-button-color, #5288c1);
}
input:checked + .slider:before {
    transform: translateX(20px);
}

/* Стилизация кнопки меню */



/* Кнопка меню (Шильдик) */
.menu-btn {
    background: var(--tg-theme-button-color, #5288c1);
    color: var(--tg-theme-button-text-color, #ffffff);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
    padding: 0;
}
.menu-btn:active {
    transform: scale(0.95);
    opacity: 0.8;
}
